commit 77ca26d6c742f27d2388218c7cda0e777c677e4b Author: zer0Black <694429613@qq.com> Date: Wed Aug 31 14:06:07 2022 +0800 初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b144cb4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target/ +/.idea/ +*.iml +rebel.xml \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5509c7f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,100 @@ +## ADC-DA组件升级公告 +2019.09.09 + 1.更新maven地址 + 2.adc-da-swagger版本升级导出doc的功能 + 3.代码生成器版本改成RELEASE + +2019.03.04 + + 1.框架2.3.0发布 + 2.代码生成器改为2.3.0-SNAPSHOT,修复生产缺少{} + 3.Swagger组件升级至2.3.0,解决tags包含中文调用异常的问题 + 4.@MapperScan 位置转移 + 5.前端替换为layui版本 + + +2019.01.21 + + @author LeeKwanho 李坤澔 + + 组件改为Release 版本,自动检测私服的Jar包 + 升级Mysql驱动版本至8.0.13 支持SSL 连接 5.7支持SSL连接 + +2018.12.21 + + @author LeeKwanho 李坤澔 + + adc-da-base升级2.0.1,BaseEntity的toString方法复习,实现返回对象本身属性 + 解决部分pom文件重复依赖的问题 + + +2018.12.14 + + adc-da-util升级2.2.45,解决xss将类似updateTime视为非法字符的问题 + +2018.12.11 + + adc-da-sys 2.2.5 + adc-da-login 2.2.10 + adc-da-file 2.2.2 + +2018.11.2: + + adc-da-gen升级2.2.0 代码生成器支持SQL Server + + +2018.10.24: + + adc-da-login升级2.2.9 增加查询在线用户功能 + +2018.10.9: + + adc-da-util升级2.2.43 解决空指针bug + + +2018.9.30: + + adc-da-util升级2.2.5 增加低标准的xss过滤器来源于林工的售后件溯源系统需要低标准的xss过滤器 + + +2018.8.31: + + adc-da-login升级2.2.8 写入日志增加记录访问ip + + +2018.8.29: + + adc-da-sys升级2.2.2 增加登录用户不能删除自己的限制 + adc-da-login升级2.2.7 逻辑删除用户不能登录 + +2018.8.15: + + adc-da-login升级2.2.6版本 测试部测试标准总变,验证码验证成功也要从Session里清空 + + +2018.8.13: + + adc-da-gen升级2.1.0版本 代码生成器支持MySQL + + +2018.7.27: + + adc-da-sys升级到2.2.1版本 解决密码修改的问题 + adc-da-login升级到2.2.3版本 解决密码修改的问题 + + +2018.7.26: + + adc-da-util升级到2.2.41版本 解决过滤json xss时转小写的问题 + +2018.7.16: + + adc-da-util升级2.2.4版本 解决json的xss过滤问题 + + +2018.7.12: + + adc-da-util升级2.2.3版本 加入伪造JsessionID的安全测试Filter + adc-da-login升级2.2.2版本 解决安全测试问题 + + adc-da-login升级2.2.1版本 将main BusinessLogAspect类移入 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..04fa097 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM java:8 + +VOLUME /tmp + +COPY ./adc-da-main/target/adc-da-main-2.5.0.jar app.jar + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=test", "--server.port=8080", "> /log/app.log"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb1fec4 --- /dev/null +++ b/README.md @@ -0,0 +1,119 @@ +# 数据资源中心高效研发框架 **ADC-DA** +## 1.官网地址 +* http://221.239.111.146:50006/html/index.html + +## 2.平台测试接口地址 +* http://localhost:8080/swagger-ui.html + + + +## 3.详细使用步骤 (IDEA) + +0. 详细文档请参考官网,以下仅用IDEA演示 +1. 忽略SSL验证 + + ```sh + git config --global http.sslVerify false + ``` +2. 获取源码方式有二 + |-1. 用Git Bash +```sh +git clone https://60.247.58.117:50018/ADC-DA-Open/ADC-DA-2.0.git +``` + |-2. 用idea + ![avatar](img/use_idea_git_01.PNG)![avatar](img/use_idea_git_02.PNG) + +3. 启动平台 方法有二 + |-1.从spring-boot:run启动 +![avatar](img/spring-boot-run.PNG ) + |-2.从AdcDaApplication启动 (可能需要修改pom.xml中的参数) + ![avatar](img/adc_run.jpg) + +* 若无法正常用idea运行,请将根目录下的pom.xml中的如下代码注释掉 + ```xml + + + org.springframework.boot + spring-boot-starter-tomcat + provided + ${spring.boot.version} + + ``` + +3. 启动成功 访问swagger +|-1. +![avatar](img/Successful_startup.PNG) +|-2. +![avatar](img/swagger.PNG) + +4. 访问前端页面 + + http://localhost:8080/index.html + + + layui版本框架可以直接访问,也可以采用nginx进行分离式部署 + + +5. 启动nginx (建议) + |-1. 配置nginx目录下conf目录中的nginx.conf文件,不要用记事本编辑conf文件,可以用写字板或其他编写代码的程序 + |-1.1 需要配置的有 server,root,proxy_pass + + server { + listen 8011; + #前端端口号 + + root C:/IDEA/test/ADC-DA-2.0/adc-da-ui/src/main/resources; + #项目路径,定位到adc-da-ui/main/resources,注意"/" + + location / { + + # 动态页面 后端端口号 + if ( !-e $request_filename) { + proxy_pass http://localhost:8080; + } + #root html; + #index index.html index.htm; + } + } + |-2.启动nginx 任务管理器-详细里面会有2个nginx信息 + ![avatar](img/nginx_start.PNG) + + |-3. 访问 http://localhost:8011/html/index.html + |-3.1 如果可以访问 http://localhost:8011/swagger-ui.html ,不能访问index.html,则一定是root路径错误。 + |-3.2若可以访问 http://localhost:8080/swagger-ui.html ,不能访问 http://localhost:8011/swagger-ui.html ,则一定是端口配置错误。 + +RSA非对称加密 + + methods: { + login () { + let pubkey = `MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKtSP3y2DkyoDQsFGr6sn4saLBFwcijEPWsWQ1Hnz8sIvn7V3TyNrSesf+7nPgnUk9Gt/7aKsXUkY67BzMJ5xkECAwEAAQ==` + let pwd = this.encryptedData(pubkey, this.loginForm.password) + let username = this.encryptedData(pubkey, this.loginForm.username) + this.$axios + .post('/login', { + username: username, + password: pwd + }) + .then(successRes => { + if (successRes.data.code === 200) { + this.$store.commit('login', this.loginForm) + let path = this.$route.query.redirect + this.$router.replace({path: path === '/' || path === undefined ? '/index' : path}) + } + }) + .catch(failRes => { + + }) + }, + // 加密 + encryptedData (publicKey, str) { + // 私钥 和后端沟通 + // 新建JSEncrypt对象 + let encryptor = new JSEncrypt() + // 设置公钥 + encryptor.setPublicKey(publicKey) + // 加密数据 + let decrypt = encryptor.encrypt(str.toString()) + return decrypt + } + } \ No newline at end of file diff --git a/adc-da-login/README.md b/adc-da-login/README.md new file mode 100644 index 0000000..be080d6 --- /dev/null +++ b/adc-da-login/README.md @@ -0,0 +1,53 @@ +# 登录组件 + +## 2.3.1 + date 2019-03-04 + + dingqiang 修复登陆错误缓存常驻内存的问题 + + +## 2.3.0 + 继承2.2.11-SNAPSHOT改动 + release-date 2019-1-30 + + 0.增加校验验证码接口,增加角色鉴权功能 + + 1.采用tags代替description + 2.验证码加入参数由配置文件获取出现次数 + 3.base64加密默认UTF-8字符集 + 4.登录成功失败次数清零,取消初始化等多余操作 + 5.pom文件追加更新Release版本的配置 + 6.解决非序列化问题 + + +## 2.2.11-SNAPSHOT + Date 2019-1-14 + pom 文件修改,相关组件改为RELEASE版本 + + + DATE 2019-1-11 + 增加校验验证码接口,增加角色鉴权功能 + 由 dingqiang 提交 + + +## 2.2.10 + release date 2018-11-06 + + 在线人数bug修复 + + 头像相关功能合并 + +## 2.2.9 / 2018-10-24 + + 新增当前在线人数功能 + + 新增更新用户信息接口 + + 对get登录标记弃用 + +## 2.2.8 + + 登陆写ip +## 2.3.1 + + 修复登录错误次数永驻内存bug \ No newline at end of file diff --git a/adc-da-login/pom.xml b/adc-da-login/pom.xml new file mode 100644 index 0000000..587a011 --- /dev/null +++ b/adc-da-login/pom.xml @@ -0,0 +1,201 @@ + + + + + com.adc + ca-data + 2.5.0 + + 4.0.0 + + adc-da-login + + + UTF-8 + UTF-8 + 1.8 + 1.8 + 1.8 + 2.6.6 + 1.4.0-RC2 + + 1.8.5 + 3.7.0 + + + 4.0.0 + RELEASE + RELEASE + RELEASE + + + + + central + http://60.247.58.121:8182/repository/public + + true + always + + + false + + + + snapshot + http://60.247.58.121:8182/repository/snapshots/ + + false + + + true + always + warn + + + + + + + + thirdparty + Nexus Thirdparty Repository + http://60.247.58.121:8182/repository/thirdparty/ + + + snapshots + User Project SNAPSHOTS + http://60.247.58.121:8182/repository/snapshots/ + + + + + + org.projectlombok + lombok + 1.16.18 + + + com.adc + adc-da-base + ${adc-da-base.version} + + + com.adc + adc-da-swagger + ${adc-da-swagger.version} + + + javax.mail + mailapi + + + + + com.adc + adc-da-util + ${adc-da-util.version} + + + jackson-annotations + com.fasterxml.jackson.core + + + + + com.adc + adc-da-sys + 2.5.0 + + + + + + + + + + + + + + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + + + org.apache.shiro + shiro-core + ${shiro.version} + + + org.apache.shiro + shiro-spring + ${shiro.version} + + + org.apache.shiro + shiro-web + ${shiro.version} + + + org.apache.shiro + shiro-ehcache + ${shiro.version} + + + + + javax.validation + validation-api + 2.0.1.Final + + + + net.sf.ehcache + ehcache-core + ${ehcache.version} + + + net.sf.ehcache + ehcache-web + 2.0.4 + + + com.adc + adc-da-util + 2.3.2 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${org.apache.maven.plugins.version} + + ${java.version} + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.7 + + + + + diff --git a/adc-da-login/src/main/java/com/adc/da/login/LoginType.java b/adc-da-login/src/main/java/com/adc/da/login/LoginType.java new file mode 100644 index 0000000..9ce3cee --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/LoginType.java @@ -0,0 +1,15 @@ +package com.adc.da.login; + +public enum LoginType { + PASSWORD("password"), // 密码登录 + NOPASSWD("nopassword"); // 免密登录 + + private String code;// 状态值 + + private LoginType(String code) { + this.code = code; + } + public String getCode () { + return code; + } +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/NewHashedCredentialsMatcher.java b/adc-da-login/src/main/java/com/adc/da/login/NewHashedCredentialsMatcher.java new file mode 100644 index 0000000..1a39ac4 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/NewHashedCredentialsMatcher.java @@ -0,0 +1,41 @@ +package com.adc.da.login; + +import com.adc.da.login.security.UsernamePasswordToken; +import com.adc.da.login.util.EncryptUtil; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; + +public class NewHashedCredentialsMatcher extends HashedCredentialsMatcher { + + public NewHashedCredentialsMatcher(String hashAlgorithmName) { + super(hashAlgorithmName); + } + + @Override + public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { + UsernamePasswordToken upt = (UsernamePasswordToken) token; + if(LoginType.NOPASSWD.equals(upt.getType())){ + return true; + } + Object tokenHashedCredentials = encrypt((String.valueOf((upt.getPassword())))); + Object accountCredentials =info.getCredentials(); + return equals(tokenHashedCredentials, accountCredentials); + } + + +// public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { +// UsernamePasswordToken upt = (UsernamePasswordToken)token; +// if (LoginType.NOPASSWD.equals(upt.getType())) { +// return true; +// } else { +// Object tokenHashedCredentials = this.hashProvidedCredentials(token, info); +// Object accountCredentials = this.getCredentials(info); +// return this.equals(tokenHashedCredentials, accountCredentials); +// } +// } + + public String encrypt(String code){ + return EncryptUtil.encrypt(code); + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/aspect/BusinessLogAspect.java b/adc-da-login/src/main/java/com/adc/da/login/aspect/BusinessLogAspect.java new file mode 100644 index 0000000..f108f29 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/aspect/BusinessLogAspect.java @@ -0,0 +1,136 @@ +package com.adc.da.login.aspect; + +import java.lang.reflect.Method; +import java.util.Date; + +import com.adc.da.log.entity.LogEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.util.utils.IpUtil; +import com.adc.da.util.utils.UUID; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import javax.annotation.Resource; +import org.springframework.stereotype.Component; + +import com.adc.da.log.annotation.BusinessLog; +import com.adc.da.log.constant.LogConstants; +import com.adc.da.log.service.LogEOService; +import com.adc.da.login.util.UserUtils; +import com.adc.da.sys.dao.mysql.UserEODao; + +import javax.servlet.http.HttpServletRequest; + +/** + * 用于记录调用service层日志, + * 日志会记录在TS_LOG中 + * + */ +@Aspect +@Component +public class BusinessLogAspect { + + /** + * @see LogEOService + */ + @Resource + private LogEOService logEOService; + + @Resource + private HttpServletRequest request; + + @Resource + private UserEODao userEODao; + + /** + * 读取配置文件 + * 系统日志类别 + * dev:开发模式不拦截方法记日志, + * custom:客户自定义需要拦截记日志的方法, + * sys:系统原设需要拦截记日志的方法 + */ +// @Value("${sysLogType}") + private String sysLogType="custom"; + + /** + * 匹配Service层的save, update, delete, get, find, page等方法 + * com.adc.da.login.rest + */ + @Pointcut(value = "( execution(* com.adc.da.*.controller..*(..)) " + + "|| execution(* com.adc.da.*.rest..*(..))) " + + "&& !execution(* com.adc.da.log.service.LogEOService.*(..))") + private void servicePointcut() { + throw new UnsupportedOperationException("servicePointcut error"); + } + + @Around(value = "servicePointcut()") + public Object process(ProceedingJoinPoint joinPoint) throws Throwable { + Class cls = joinPoint.getTarget().getClass(); + String signature = joinPoint.getSignature().getName(); + Object result; + // 调用service层开始时间 + long startTime = System.currentTimeMillis(); + result = joinPoint.proceed(); + // 调用service层结束时间 + long endTime = System.currentTimeMillis(); + // dev模式下不记系统日志 + if (LogConstants.LOG_TYPE_DEV.equalsIgnoreCase(sysLogType)) { + return result; + } + String userId = UserUtils.getUserId(); + // 非登录模式下不记系统日志 + if (userId == null) { + return result; + } + // 业务日志组件开始工作,sys模式 + if (LogConstants.LOG_TYPE_SYS.equalsIgnoreCase(sysLogType)) { + writeLog(cls.getName(), signature, null, userId, startTime, endTime); + } else { + for (Method method : cls.getDeclaredMethods()) { + BusinessLog logAnnotation = method.getAnnotation(BusinessLog.class); + if (logAnnotation != null) { + String methodName = method.getName(); + if (signature.equals(methodName)) { + writeLog(cls.getName(), signature, logAnnotation.description(), userId, startTime, endTime); + } + } + } + } + // 业务日志组件工作结束 + return result; + } + + /** + * 写日志 + * + * @param className 类名 + * @param methodName 方法名 + * @param logAnnotation 描述 + * @param userId 用户名 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @throws Exception + */ + private void writeLog(String className, String methodName, String logAnnotation, String userId, + long startTime, long endTime) throws Exception { +// LogEO logEO = new LogEO(); +// logEO.setId(UUID.randomUUID10()); +// +// logEO.setClassName(className); +// logEO.setMethod(methodName); +// if (logAnnotation != null && !"".equals(logAnnotation)) { +// logEO.setDescription(logAnnotation); +// } +// logEO.setUsid(userId); +// UserEO userEO = userEODao.selectById(userId); +// // 写入ip信息 +// logEO.setIpAddress(IpUtil.getIpAddr(request)); +// if (userEO != null) { +// logEO.setAccount(userEO.getAccount()); +// } +// logEO.setStartTime(new Date(startTime)); +// logEO.setEndTime(new Date(endTime)); +// logEOService.insertSelective(logEO); + } +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/config/ShiroConfiguration.java b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroConfiguration.java new file mode 100644 index 0000000..cb0d0d2 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroConfiguration.java @@ -0,0 +1,160 @@ +package com.adc.da.login.config; + +import com.adc.da.login.security.SystemAuthorizingRealm; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.cache.ehcache.EhCacheManager; +import org.apache.shiro.codec.Base64; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO; +import org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator; +import org.apache.shiro.session.mgt.eis.SessionIdGenerator; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.web.mgt.CookieRememberMeManager; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.shiro.web.servlet.SimpleCookie; +import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; +import org.springframework.core.io.ClassPathResource; + +/** + * shiro 配置 + */ +@Configuration +public class ShiroConfiguration { + + @Bean(name = "ehCacheManagerFactoryBean") + public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() { + EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); + ClassPathResource classPathResource = new ClassPathResource("cache/ehcache-local.xml"); + ehCacheManagerFactoryBean.setConfigLocation(classPathResource); + return ehCacheManagerFactoryBean; + } + + @Bean(name = "shiroCacheManager") + @DependsOn({"ehCacheManagerFactoryBean"}) + public EhCacheManager shiroCacheManager() { + EhCacheManager ehCacheManager = new EhCacheManager(); + ehCacheManager.setCacheManager(ehCacheManagerFactoryBean().getObject()); + return ehCacheManager; + } + + @Bean + @DependsOn({"lifecycleBeanPostProcessor"}) + public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() { + DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator(); + proxyCreator.setProxyTargetClass(true); + return proxyCreator; + } + + /** + * @return + */ + @Bean(name = "lifecycleBeanPostProcessor") + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + @Bean(name = "securityManager") + public SecurityManager securityManager() { + DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); + defaultWebSecurityManager.setRealm(systemAuthorizingRealm()); + + defaultWebSecurityManager.setCacheManager(shiroCacheManager()); + + SecurityUtils.setSecurityManager(defaultWebSecurityManager); + + return defaultWebSecurityManager; + } + + /** + * session管理器 + * + * @author FastKing + * @date 13:06 2018/9/28 + **/ + @Bean(name = "defaultWebSessionManager") + public DefaultWebSessionManager getDefaultWebSessionManager() { + DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager(); + //设置过期时间30分钟 +// defaultWebSessionManager.setGlobalSessionTimeout(1800000); + //session cookie + defaultWebSessionManager.setSessionIdCookie(getSessionIdCookie()); + defaultWebSessionManager.setSessionIdCookieEnabled(true); + + defaultWebSessionManager.setCacheManager(shiroCacheManager()); + defaultWebSessionManager.setSessionDAO(sessionDao()); + + return defaultWebSessionManager; + } + + @Bean(name = "sessionDao") + public EnterpriseCacheSessionDAO sessionDao() { + EnterpriseCacheSessionDAO sessionDao = new EnterpriseCacheSessionDAO(); + sessionDao.setActiveSessionsCacheName("shiro-activeSessionCache"); + //sessionId生成器 + sessionDao.setSessionIdGenerator(sessionIdGenerator()); + return sessionDao; + } + + /** + * 配置会话ID生成器 + * + * @return + */ + @Bean + public SessionIdGenerator sessionIdGenerator() { + return new JavaUuidSessionIdGenerator(); + } + + /** + * rememberMe cookie对象 + * + * @author FastKing + * @date 12:49 2018/9/28 + **/ + private SimpleCookie rememberMeCookie() { + SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); + //防止cookie暴露给客户端 + simpleCookie.setHttpOnly(true); + //设置过期时间30天 + //simpleCookie.setMaxAge(2592000); + return simpleCookie; + } + + private SimpleCookie getSessionIdCookie() { + SimpleCookie simpleCookie = new SimpleCookie("sid"); + simpleCookie.setHttpOnly(true); +// simpleCookie.setMaxAge(-1); + return simpleCookie; + } + + /** + * 记住我管理器 + * + * @author FastKing + * @date 12:52 2018/9/28 + **/ + private CookieRememberMeManager cookieRememberMeManager() { + CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); + cookieRememberMeManager.setCookie(rememberMeCookie()); + cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag==")); + return cookieRememberMeManager; + } + + @Bean + public SystemAuthorizingRealm systemAuthorizingRealm() { + return new SystemAuthorizingRealm(); + } + + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() { + AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor(); + advisor.setSecurityManager(securityManager()); + return advisor; + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java new file mode 100644 index 0000000..dd527bc --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java @@ -0,0 +1,153 @@ +package com.adc.da.login.config; + +import com.adc.da.login.filter.BasicAuthFilter; +import com.adc.da.login.filter.DdmRSAAuthFilter; +import com.adc.da.login.filter.jwtFilter; +import com.adc.da.login.security.AdcFormAuthenticationFilter; +import com.adc.da.util.constant.GlobalConfig; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import javax.annotation.Resource; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import sun.misc.Cache; + +import javax.annotation.PostConstruct; +import javax.servlet.Filter; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * shiro 权限配置 + * 设置各连接的权限需求 + */ +@Configuration +public class ShiroFilterConfiguration { + + private static final String LOGIN = "/login"; + + /** + * 认证用户,需要登录才能使用的接口 + */ + private static final String AUTHC = "authc"; + + /** + * 匿名用户,无需登录 + */ + private static final String ANON = "anon"; + + + private String portalPath = ""; + + @Resource + private Environment env; + + + /** + * 初始化,设置adminPath和restPath + * 参数在 application.properties 下 + * 预设 adminPath = /a + * 预设 restPath =/api + */ + @PostConstruct + public void init() { + GlobalConfig.setAdminPath(env.getProperty("adminPath")); + GlobalConfig.setRestApiPath(env.getProperty("restPath")); + portalPath=env.getProperty("portalPath"); + } + + /** + * 设置过滤器 + * + * @param securityManager 必须参数 + */ + @Bean(name = "shiroFilter") + public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) { + String adminPath = GlobalConfig.getAdminPath(); + String restPath = GlobalConfig.getRestApiPath(); + ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); + /* 必须参数 */ + shiroFilterFactoryBean.setSecurityManager(securityManager); + //未登录跳转的url + shiroFilterFactoryBean.setLoginUrl("/notLogin"); + // 设置无权限时跳转的 url; + shiroFilterFactoryBean.setUnauthorizedUrl("/notRole"); + + /* 登陆成功跳转页,可选参数 */ + shiroFilterFactoryBean.setSuccessUrl(restPath); + + Map filterMap = new LinkedHashMap<>(); + filterMap.put(AUTHC, new AdcFormAuthenticationFilter()); + + filterMap.put("jwtFilter",new jwtFilter()); + filterMap.put("ddmFilter",new DdmRSAAuthFilter()); + shiroFilterFactoryBean.setFilters(filterMap); + + Map filterChainDefinitionMap = new LinkedHashMap<>(); + + /* 校验单点登录ticket 不需要认证 */ + filterChainDefinitionMap.put(restPath + "/login", ANON); + + /* 登出不需认证 */ + filterChainDefinitionMap.put(restPath + "/logout/**", ANON); + + /* 验证码,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/verifyCode", ANON); + + /* 注册,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/register", ANON); + + /* 找回密码,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/findPassWord", ANON); + + /* 找回密码,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/sendPassWord", ANON); + + /* 注册链接,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/registerUser", ANON); + + + /* 验证码预校验,不需要认证 */ + filterChainDefinitionMap.put(restPath + "/judgeVerify", ANON); + + /* 用户信息不用认证 */ + filterChainDefinitionMap.put(restPath + "/userInfo", ANON); + + /* 在线用户列表不用验证 */ + filterChainDefinitionMap.put(restPath + "/onlineUser", ANON); + + /* 用户所属菜单信息不需认证 */ + filterChainDefinitionMap.put(restPath + "/userMenu", ANON); + filterChainDefinitionMap.put(restPath + "/updateUserInfo", ANON); + filterChainDefinitionMap.put(restPath + "/updatePassword", ANON); + filterChainDefinitionMap.put(restPath + "/user/supplierRegistry/*", ANON); + + filterChainDefinitionMap.put(restPath + "/**", AUTHC); + + /* static 不需登录 */ + filterChainDefinitionMap.put("/static/**", ANON); + + /* userfiles 用户文件 不需登录 */ + filterChainDefinitionMap.put("/userfiles/**", ANON); + filterChainDefinitionMap.put(adminPath + LOGIN, AUTHC); + filterChainDefinitionMap.put(adminPath + "/logout", "logout"); + filterChainDefinitionMap.put("/swagger-ui.html", ANON); +// filterChainDefinitionMap.put("/swagger-ui.html", "jwtFilter"); + /* 全api一般需要登录才能使用 */ + + + filterChainDefinitionMap.put(portalPath+"/**", ANON); + shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); + + + + return shiroFilterFactoryBean; + } + + + + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/entity/MyPrincipal.java b/adc-da-login/src/main/java/com/adc/da/login/entity/MyPrincipal.java new file mode 100644 index 0000000..ba990bf --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/entity/MyPrincipal.java @@ -0,0 +1,48 @@ +package com.adc.da.login.entity; + +import com.adc.da.sys.entity.UserEO; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * 授权用户信息 + */ +public class MyPrincipal implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + private String loginName; + + private String name; + + private transient Map cacheMap; + + public MyPrincipal(UserEO user) { + this.id = user.getUsid() == null ? "" : String.valueOf(user.getUsid()); + this.loginName = user.getAccount(); + } + + public String getId() { + return id; + } + + public String getLoginName() { + return loginName; + } + + public String getName() { + return name; + } + + public Map getCacheMap() { + if (cacheMap == null) { + cacheMap = new HashMap<>(); + } + return cacheMap; + } + +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/entity/OnlineUserEO.java b/adc-da-login/src/main/java/com/adc/da/login/entity/OnlineUserEO.java new file mode 100644 index 0000000..d20215f --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/entity/OnlineUserEO.java @@ -0,0 +1,39 @@ +package com.adc.da.login.entity; + +import java.io.Serializable; +import java.util.Date; + +public class OnlineUserEO implements Serializable { + + private static final long serialVersionUID = 5949014199725915501L; + + private String ip; + + private String account; + + private Date loginTime; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public Date getLoginTime() { + return loginTime; + } + + public void setLoginTime(Date loginTime) { + this.loginTime = loginTime; + } +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/filter/BasicAuthFilter.java b/adc-da-login/src/main/java/com/adc/da/login/filter/BasicAuthFilter.java new file mode 100644 index 0000000..185f416 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/filter/BasicAuthFilter.java @@ -0,0 +1,56 @@ +package com.adc.da.login.filter; + +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.utils.StringUtils; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Value; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Properties; + +@Slf4j +@Data +public class BasicAuthFilter implements Filter { + private String appId ; + private String appSecrect ; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + log.info("-----------BasicAuthFilter-------------"); + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + Properties properties = System.getProperties(); + appId = properties.get("appId").toString(); + appSecrect = properties.get("appSecrect").toString(); + HttpServletRequest request = (HttpServletRequest) servletRequest; + String token = request.getHeader("Authorization"); + log.info("接口请求Authorization:"+token); + if (StringUtils.isNotEmpty(token)) { +// 值为Basic 用户名:密码的base64编码 + String str1 = new String(Base64.decodeBase64(token), StandardCharsets.UTF_8); + String str2 = "Basic "+appId+":"+appSecrect; + if (!str1.equals(str2)) { + throw new AdcDaBaseException("token不对"); + } else { + filterChain.doFilter(request, servletResponse); + } + + } else { + throw new AdcDaBaseException("token不对"); + } + + } + + @Override + public void destroy() { + + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/filter/DdmRSAAuthFilter.java b/adc-da-login/src/main/java/com/adc/da/login/filter/DdmRSAAuthFilter.java new file mode 100644 index 0000000..0ade5ca --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/filter/DdmRSAAuthFilter.java @@ -0,0 +1,51 @@ +package com.adc.da.login.filter; + +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.utils.StringUtils; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import javax.annotation.Resource; +import org.springframework.core.env.Environment; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Properties; + +@Slf4j +@Data +public class DdmRSAAuthFilter implements Filter { + + @Resource + private Environment env; + + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + log.info("-----------BasicAuthFilter-------------"); + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + Properties properties = System.getProperties(); + HttpServletRequest request = (HttpServletRequest) servletRequest; + String token = request.getHeader("token"); + log.info("接口请求Authorization:"+token); + if (StringUtils.isNotEmpty(token)) { +// 用公钥解密 + + + } else { + throw new AdcDaBaseException("token不对"); + } + + } + + @Override + public void destroy() { + + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/filter/jwtFilter.java b/adc-da-login/src/main/java/com/adc/da/login/filter/jwtFilter.java new file mode 100644 index 0000000..c3f3665 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/filter/jwtFilter.java @@ -0,0 +1,68 @@ +package com.adc.da.login.filter; + +import com.adc.da.login.util.CacheUtils; +import com.adc.da.login.util.JWTUtils; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.StringUtils; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Optional; + +@Slf4j +public class jwtFilter implements Filter { + + private final static String CACHE_NAME="jwtcahe"; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + log.info("-----------jwtfilter-------------"); + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + + HttpServletRequest request=(HttpServletRequest)servletRequest; + String token=request.getHeader("access_token"); + if(StringUtils.isNotEmpty(token)){ + token=token.substring(7); + } + Object cacheToken=CacheUtils.get(CACHE_NAME,token); + if(!StringUtils.isEmpty(cacheToken)){ + if(JWTUtils.isExp(cacheToken.toString())){ + CacheUtils.remove(CACHE_NAME,token); + throw new AdcDaBaseException("token不对"); + //renderJson(servletResponse,Result.error("401","token无效")); + } + else{ + filterChain.doFilter(request,servletResponse); + } + } + else{ + throw new AdcDaBaseException("token不对"); + //renderJson(servletResponse,Result.error("401","token无效")); + } + + } + + @Override + public void destroy() { + + } + + public static void renderJson(ServletResponse response, Object jsonObject) { + try { + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + PrintWriter writer = response.getWriter(); + writer.write(JSON.toJSONString(jsonObject)); + } catch (IOException var3) { + log.info("token错误"); + } + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/LogController.java b/adc-da-login/src/main/java/com/adc/da/login/rest/LogController.java new file mode 100644 index 0000000..88f46f2 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/LogController.java @@ -0,0 +1,57 @@ +package com.adc.da.login.rest; + +import com.adc.da.log.controller.LogEOController; +import com.adc.da.log.dao.mysql.LogEODao; +import com.adc.da.log.entity.MiLogEO; +import com.adc.da.login.util.UserUtils; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.UUID; + +/** + * @Author sima + * @Date 2022/7/8 16:54 + */ +@RestController +@RequestMapping("/${restPath}/log/log") +@Api(tags = "Sys-日志管理1") +public class LogController { + private static final Logger logger = LoggerFactory.getLogger(LogController.class); + @Resource + private LogEODao dao; + + @ApiOperation(value = "|mi|save") + @GetMapping("/save") + public ResponseMessage save(String accessPage) { +// if(null == UserUtils.getUser()){ +// logger.error("未登录"); +// } + try { + UserEO user = UserUtils.getUser(); + MiLogEO miLogEO = new MiLogEO(); + miLogEO.setId(UUID.randomUUID().toString().replaceAll("-","")); + miLogEO.setAccessPage(accessPage); + miLogEO.setAccount(user.getAccount()); + miLogEO.setUserName(user.getUsname()); + miLogEO.setDepartment(user.getDepartment()); + miLogEO.setOperateDate(new Date()); + dao.save(miLogEO); + + } catch (Exception e) { + logger.error("日志添加异常", e); + + } + return Result.success(); + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/LoginController.java b/adc-da-login/src/main/java/com/adc/da/login/rest/LoginController.java new file mode 100644 index 0000000..763feba --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/LoginController.java @@ -0,0 +1,23 @@ +package com.adc.da.login.rest; + +import com.adc.da.util.http.Result; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import com.adc.da.util.http.ResponseMessage; + +@RestController +public class LoginController { + + + @RequestMapping(value = "/notLogin", method = RequestMethod.GET) + public ResponseMessage notLogin() { + return Result.error("401", "未登录", null); + } + + @RequestMapping(value = "/notRole", method = RequestMethod.GET) + public ResponseMessage notRole() { + return Result.error("401", "未授权", null); + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/LoginRestController.java b/adc-da-login/src/main/java/com/adc/da/login/rest/LoginRestController.java new file mode 100644 index 0000000..b993269 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/LoginRestController.java @@ -0,0 +1,535 @@ +package com.adc.da.login.rest; + +import com.adc.da.log.annotation.BusinessLog; +import com.adc.da.login.entity.OnlineUserEO; +import com.adc.da.login.security.SystemAuthorizingRealm; +import com.adc.da.login.security.UsernamePasswordToken; +import com.adc.da.login.security.exception.CaptchaException; +import com.adc.da.login.security.validatecode.IVerifyCodeGen; +import com.adc.da.login.security.validatecode.SimpleCharVerifyCodeGenImpl; +import com.adc.da.login.security.validatecode.VerifyCode; +import com.adc.da.login.service.OnlineUserListener; +import com.adc.da.login.util.CacheUtils; +import com.adc.da.login.util.EncryptUtil; +import com.adc.da.login.util.UserUtils; +import com.adc.da.login.vo.LoginVO; +import com.adc.da.login.vo.OnlineUserVO; +import com.adc.da.sys.dao.mysql.UserEODao; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.RSAUtil; +import com.adc.da.sys.vo.UserVO; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.BeanMapper; +import com.adc.da.util.utils.RequestUtils; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.subject.Subject; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.*; + +import static org.apache.commons.lang3.StringUtils.isBlank; + +/** + * 登录接口 + * 1.登录 get,已弃用 + * 2.登录 post + * 3.登出 + * 4.修改密码 + * 5.修改用户信息 + * 6.获取登录用户信息 + * 7.获取登录用户菜单权限,已弃用 + * 8.生成4位验证码 + * 9.生成6位验证码 + * + * @author comments created by Lee Kwanho + * date 2018-09-06 + **/ +@Validated +@Controller +@RequestMapping(value = "${restPath}/") +@Api(tags = "Login-登录模块") +@Slf4j +public class LoginRestController { + + /** + * 无缓存,用于校验 + */ + private static final String NO_CACHE = "no-cache"; + + /** + * 登录失败Map字段 + */ + private static final String LOGIN_FAIL_MAP = "loginFailMap"; + + /** + * 服务层装配 + * + * @see UserEOService + */ + @Resource + private IUserEoService userService; + + + @Resource + private SystemAuthorizingRealm systemAuthorizingRealm; + + + @Resource + private UserEODao userEODao; + + + + /** + * eo vo 转换 + * + * @see BeanMapper + * @see dozer + */ + @Resource + BeanMapper beanMapper; + + /** + * 读取配置文件判断是否需要开启Base64加密 + * 默认值为false + */ + @Value("${isPassEncrypted}") + private boolean isPassEncrypted; + + /** + * 4位验证码 + * + * @param request 请求信息 + * @param response 返回信息 + */ + @GetMapping("/verifyCode") + public void verifyCode(HttpServletRequest request, HttpServletResponse response) { + verifyCode(request, response, 80, 28, 4); + } + + /** + * 6位验证码 + * + * @param request 请求信息 + * @param response 返回信息 + */ + @GetMapping("/verifyCode6") + public void verifyCode6(HttpServletRequest request, HttpServletResponse response) { + verifyCode(request, response, 100, 28, 6); + } + + /** + * 生成验证码 + * 由 verifyCode6 和 verifyCode 调用 + * + * @param request 请求信息 + * @param response 返回信息 + * @param width 宽度 + * @param height 高度 + * @param number 字符数 + * @author Lee Kwanho 李坤澔 + * date 2018-09-06 + */ + private void verifyCode(HttpServletRequest request, HttpServletResponse response, int width, int height, + int number) { + IVerifyCodeGen iVerifyCodeGen = new SimpleCharVerifyCodeGenImpl(); + try { + VerifyCode verifyCode = iVerifyCodeGen.generate(width, height, number); + request.getSession().setAttribute("VerifyCode", verifyCode.getCode()); + response.setHeader("Pragma", NO_CACHE); + response.setHeader("Cache-Control", NO_CACHE); + response.setDateHeader("Expires", 0); + response.setContentType("image/jpeg"); + response.getOutputStream().write(verifyCode.getImgBytes()); + response.getOutputStream().flush(); + } catch (IOException e) { + log.error("verifyCode Error", e); + } + } + + /** + * 预校验验证码 + * + * @param request 请求信息 + * @param verify 输入数据 + * @author dingqiang 丁强 + * date 2018-12-18 + */ + @ApiOperation(value = "预校验验证码") + @PutMapping("/judgeVerify") + @ResponseBody + public ResponseMessage judgeVerify(HttpServletRequest request, @RequestParam String verify) { + + String verifyCode = (String) request.getSession().getAttribute("VerifyCode"); + if (verify == null) { + return Result.error("验证码不能为空!"); + } + + if (null == verifyCode) { + return Result.error("验证码生成失败,请联系管理员!"); + } + + if (!verify.equalsIgnoreCase(verifyCode)) { + return Result.error("验证码不正确!"); + } + return Result.success("验证码输入正确"); + } + + /** + * 获取密码最近一次更换时间 + */ + /*@GetMapping(value = "/passwordUpdateTime") + @ResponseBody + public ResponseMessage passwordUpdateTime(){ + //获取登录用户的userid + String usid = UserUtils.getUserId(); + Date lodDate = userEODao.getUpdatePasswordTime(usid); + if(null == lodDate){ + return Result.success(); + } + long lodTime = lodDate.getTime(); + Date nweDate =new Date(); + long newTime = nweDate.getTime(); + //相差的天 + long i = (newTime - lodTime)/1000/60/60/24; + if(i>90){ + //超过90天未更改密码 + return Result.error("r0020", "已超过90天未更换密码,请及时更换"); + }else{ + return Result.success(); + } + } + public Boolean isExpire(String usname){ + + Date lodDate = userEODao.getUpdatePasswordTimeByAccount(usname); + if(null == lodDate){ + return true; + } + long lodTime = lodDate.getTime(); + Date nweDate =new Date(); + long newTime = nweDate.getTime(); + //相差的天 + long i = (newTime - lodTime)/1000/60/60/24; + if(i>180){ + //超过180天未更改密码 + return false; + }else{ + return true; + } + }*/ + + /** + * Post方式登录 + * + * @param request 请求体 + * @return 登录结果 + */ + @ApiOperation(value = "Post方式登录") + @PostMapping(value = "/login") + @ResponseBody + @BusinessLog(description = "登录") + public ResponseMessage postLogin(HttpServletRequest request, @RequestBody String requestString) throws Exception { + + + String username; + String password; + + JsonParser parser=new JsonParser(); + Gson gson=new Gson(); + String data=new String(Base64.decodeBase64(requestString),StandardCharsets.UTF_8); + JsonElement element = parser.parse(data); + LoginVO loginVO=gson.fromJson(element,LoginVO.class); + + String verifyCode = loginVO.getVerifyCode(); + + if (isBlank(loginVO.getUsername())) { + return Result.error("r0014", "登录名不能为空"); + } + if (isBlank(loginVO.getPassword())) { + return Result.error("r0016", "密码不能为空"); + } + // 前台如果base64传输密文,则需要解码 + if (isPassEncrypted) { + /* + * 用户与密码都需要加解密 + */ + + username = new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(loginVO.getUsername()),RSAUtil.PrivateKey)); + password = new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(loginVO.getPassword()),RSAUtil.PrivateKey)); + + +// username = new String(Encodes.decodeBase64(loginVO.getUsername()), StandardCharsets.UTF_8); +// password = new String(Encodes.decodeBase64(loginVO.getPassword()), StandardCharsets.UTF_8); + + } else { + + username = loginVO.getUsername(); + password = loginVO.getPassword(); + + } + + UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray(), verifyCode); + return login(request, token); + } + + /** + * + * loginPage testcontroller + * + * @param request 请求体 + * @return 登录结果 + */ + @ApiOperation(value = "loginPage_betaVersion") + @GetMapping(value = "/loginPage") + @ResponseBody + public ResponseMessage loginPage(HttpServletRequest request) { + + return new ResponseMessage("302", "/login.html", false); + } + + + /** + * 登录方法 + * + * @param request 请求体 + * @param token UsernamePasswordToken + * @return 登录信息 + */ + private ResponseMessage login(HttpServletRequest request, UsernamePasswordToken token) { + Subject subject = SecurityUtils.getSubject(); + UserEO userEO; + String username = token.getUsername(); + try { + subject.login(token); + //认证完成删除session中VerifyCode + request.getSession().removeAttribute("VerifyCode"); + //认证成功将库里错误次数改为0 +// userService.updatePasswordErrorsNumberByAccount(username,0); + userEO = UserUtils.getUser(); + request.getSession().setAttribute(RequestUtils.LOGIN_USER, userEO); + + UserEO returnEO = userService.getUserWithRoles(userEO.getUsid()); + + request.getSession().setAttribute(RequestUtils.LOGIN_USER_ID, userEO.getUsid()); + request.getSession().setAttribute(RequestUtils.LOGIN_ROLE_ID, UserUtils.getRoleIds()); + + + HttpSession session = request.getSession(); + String sessionid = session.getId(); + System.out.println(sessionid); + //首先将原session中的数据转移至一临时map中 + Map tempMap = new HashMap(); + Enumeration sessionNames = session.getAttributeNames(); + while(sessionNames.hasMoreElements()){ + String sessionName = sessionNames.nextElement(); + tempMap.put(sessionName, session.getAttribute(sessionName)); + } + + //注销原session,为的是重置sessionId + //session.invalidate(); + subject.logout(); + + //将临时map中的数据转移至新session + session = request.getSession(); + for(Map.Entry entry : tempMap.entrySet()){ + session.setAttribute(entry.getKey(), entry.getValue()); + } + System.out.println(session.getId()); + +// Session session = subject.getSession(); + if (null != session) { + CacheUtils.putShiroSessionCache(userEO.getUsid(), session.getId()); + } + + return Result.success(beanMapper.map(returnEO, UserVO.class)); + + } catch (CaptchaException e) { +// systemAuthorizingRealm.increaseLoginErrorCount(username); + log.info("验证码验证失败"); + return Result.error("r0012", "您输入的验证码不正确", systemAuthorizingRealm.isNeedValidCode(username)); + } catch (UnknownAccountException e) { +// systemAuthorizingRealm.increaseLoginErrorCount(username); + log.info("用户[{}]身份验证失败", username); + return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username)); + } catch (IncorrectCredentialsException e) { +// systemAuthorizingRealm.increaseLoginErrorCount(username); + log.info("用户[{}]密码验证失败", username); + //增加错误次数 + // return passwordErrorsNumber(username); + return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username)); + } catch (Exception e) { +// systemAuthorizingRealm.increaseLoginErrorCount(username); + log.error(e.getMessage(), e); + return Result.error("r0013", e.getMessage(), systemAuthorizingRealm.isNeedValidCode(username)); + } + + } + + /** + * 获取在线用户 + * + * @param response 请求体 + * @return 当前在线用户列表 + */ + @ApiOperation(value = "获取在线用户") + @GetMapping("/onlineUser") + @ResponseBody + public ResponseMessage onlineUser(HttpServletResponse response) { + Map map = OnlineUserListener.getOnlineMap(); + List onlineUsers = new ArrayList<>(map.values()); + OnlineUserVO onlineUserVO = new OnlineUserVO(); + onlineUserVO.setOnlineUsers(onlineUsers); + onlineUserVO.setTotal(onlineUsers.size()); + return Result.success(onlineUserVO); + } + + /** + * 退出登录 + * + * @return success + */ + @ApiOperation(value = "退出登录") + @GetMapping("/logout") + @ResponseBody + public ResponseMessage logout(HttpServletRequest request) { + + UserEO userEO = UserUtils.getUser(); + HttpSession session = request.getSession(false); + if(null != session){ + session.invalidate(); + } + if(null !=userEO ) { + CacheUtils.removeShiroSessionCache(userEO.getUsid()); + + } + if(userEO != null) { +// UserUtils.flush(); + UserUtils.logout(); + } + return Result.success(); + + } + + /** + * 登录成功之后获取当前登录用户信息的接口 + * + * @param response 请求体 + * @return 当前用户信息 + * + */ + @ApiOperation(value = "获取登录用户信息") + @GetMapping("/userInfo") + @ResponseBody + public ResponseMessage userInfo(HttpServletResponse response) { + + try { + UserEO user = UserUtils.getUser(); + if (user != null) { + String id = user.getUsid(); + /* 获取用户信息,角色信息,组织信息 */ + UserVO userVO = beanMapper.map(userService.getUserWithRoles(id), UserVO.class); + return Result.success(userVO); + } else { + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + return Result.error("401", "未授权", null); + } + } catch (Exception e) { + log.error("获取登录用户信息", e); + return Result.error("500", "获取登录用户信息" + e.getMessage(), null); + } + + } + + /** + * 获取用户菜单,已用菜单管理实现 + * + * @return 菜单权限 + * @author Lee Kwanho 李坤澔 + * date 2018-09-06 + * @see com.adc.da.sys.controller.MenuEOController + * @deprecated 使用菜单管理替代 + */ + @ApiOperation(value = "获取登录用户菜单权限") + @GetMapping("/userMenu") + @ResponseBody + @Deprecated + public ResponseMessage userMenu() { + return Result.success(UserUtils.getMenuTree()); + } + + + + @GetMapping("getIp") + @ResponseBody + public static String getIp(HttpServletRequest request) throws Exception{ + //发给nginx请求的地址 + String ip = request.getHeader("X-Real-IP"); + if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) { + return ip; + } + //一个或多个地址,每次代理都会多一个ip,所以第一为真实地址(类似于这种形式:192.168.1.2, 192.168.1.3, 192.168.1.n) + ip = request.getHeader("X-Forwarded-For"); + if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) { + // 多次反向代理后会有多个IP值,第一个为真实IP。 + int index = ip.indexOf(','); + if (index != -1) { + return ip.substring(0, index); + } else { + return ip; + } + } else { + //ng的地址 + return request.getRemoteAddr(); + } + } + +// public static void main(String[] args) { +// String json=""; +// Base64.encodeBase64String() +// } + + @GetMapping("/testtest") + @ResponseBody + public ResponseMessage test(HttpServletRequest request){ + HttpSession session = request.getSession(); + if(session.getAttribute("haha")==null){ + session.setAttribute("haha","haha"); + session.setMaxInactiveInterval(20); + } + return Result.success(); + } + + public static void main(String[] args) throws Exception { + String decrypt = EncryptUtil.decrypt("F6lnqMmPc/zkC8LcdSnDIMkH3Pt3DC1/53blM5P0FkM="); + System.out.println(decrypt); + } + + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/cas/controller/CasClientController.java b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/controller/CasClientController.java new file mode 100644 index 0000000..ed45c56 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/controller/CasClientController.java @@ -0,0 +1,132 @@ +//package com.adc.da.login.rest.cas.controller; +// +//import com.adc.da.login.rest.cas.util.CASServiceUtil; +//import com.adc.da.login.rest.cas.util.XmlUtils; +//import com.adc.da.login.security.UsernamePasswordToken; +//import com.adc.da.login.util.CacheUtils; +//import com.adc.da.login.util.UserUtils; +//import com.adc.da.sys.entity.UserEO; +//import com.adc.da.sys.service.iservice.IUserEoService; +//import com.adc.da.sys.vo.UserVO; +//import com.adc.da.util.http.ResponseMessage; +//import com.adc.da.util.http.Result; +//import com.adc.da.util.utils.BeanMapper; +//import com.adc.da.util.utils.RequestUtils; +//import lombok.extern.slf4j.Slf4j; +//import org.apache.commons.lang.StringUtils; +//import org.apache.shiro.SecurityUtils; +//import org.apache.shiro.subject.Subject; +//import javax.annotation.Resource; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.web.bind.annotation.*; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import javax.servlet.http.HttpSession; +//import java.io.IOException; +//import java.util.Enumeration; +//import java.util.HashMap; +//import java.util.Map; +// +///** +// *

+// * CAS单点登录客户端登录认证 +// *

+// * +// * @Author zhoujf +// * @since 2018-12-20 +// */ +//@Slf4j +//@RestController +//@RequestMapping(value = "${restPath}/") +//public class CasClientController { +// +// @Value("${restPath}") +// private String restpath; +// +// @Value("${cas.server-url-prefix}") +// private String prefixUrl; +// +// private String serverUrl="http://localhost:7060"; +// +// @Resource +// private IUserEoService userService; +// +// @Resource +// BeanMapper beanMapper; +// +// @RequestMapping(value = "/caslogin",method= RequestMethod.GET) +// public void login(HttpServletResponse response, HttpSession session) throws IOException { +// // 单点登录之前先登出 +// UserUtils.logout(); +// String url = prefixUrl+ "/login?&service=" + serverUrl +restpath+ "/cas/validateLogin"; +// response.sendRedirect(url); +// } +// +// +// @GetMapping("/cas/validateLogin") +// public ResponseMessage validateLogin(@RequestParam(name="ticket") String ticket, +// @RequestParam(name="service") String service, +// HttpServletRequest request, +// HttpServletResponse response) throws Exception { +// +// log.info("cas validateLogin"); +// try { +// String validateUrl = prefixUrl+"/p3/serviceValidate"; +// String res = CASServiceUtil.getSTValidate(validateUrl, ticket, service); +// log.info("res."+res); +// final String error = XmlUtils.getTextForElement(res, "authenticationFailure"); +// if(StringUtils.isNotEmpty(error)) { +// throw new Exception(error); +// } +// final String principal = XmlUtils.getTextForElement(res, "user"); +// if (StringUtils.isEmpty(principal)) { +// throw new Exception("No principal was found in the response from the CAS server."); +// } +// log.info("-------token----username---"+principal); +// +// UserEO user = userService.getUserByLoginNameNotDeleted(principal); +// if (null == user) { +// return Result.error("401", "该用户不存在", null); +// } +// Subject subject = SecurityUtils.getSubject(); +// UsernamePasswordToken token = new UsernamePasswordToken(user.getAccount()); +// subject.login(token); +// UserEO returnEO = userService.getUserWithRoles(user.getUsid());//登录成功后存储session +// request.getSession().setAttribute(RequestUtils.LOGIN_USER_ID, user.getUsid()); +// request.getSession().setAttribute(RequestUtils.LOGIN_ROLE_ID, UserUtils.getRoleIds()); +// +// HttpSession session = request.getSession(); +// String sessionid = session.getId(); +// System.out.println(sessionid); +// //首先将原session中的数据转移至一临时map中 +// Map tempMap = new HashMap(); +// Enumeration sessionNames = session.getAttributeNames(); +// while(sessionNames.hasMoreElements()){ +// String sessionName = sessionNames.nextElement(); +// tempMap.put(sessionName, session.getAttribute(sessionName)); +// } +// subject.logout(); +// //将临时map中的数据转移至新session +// session = request.getSession(); +// for(Map.Entry entry : tempMap.entrySet()){ +// session.setAttribute(entry.getKey(), entry.getValue()); +// } +// System.out.println(session.getId()); +// +//// Session session = subject.getSession(); +// if (null != session) { +// CacheUtils.putShiroSessionCache(user.getUsid(), session.getId()); +// } +// return Result.success(beanMapper.map(returnEO, UserVO.class)); +// +// +// } catch (Exception e) { +// //e.printStackTrace(); +// return Result.error("401", "未登录", null); +// } +// +// } +// +// +//} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/CASServiceUtil.java b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/CASServiceUtil.java new file mode 100644 index 0000000..4f06dc5 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/CASServiceUtil.java @@ -0,0 +1,105 @@ +//package com.adc.da.login.rest.cas.util; +// +//import org.apache.http.HttpResponse; +//import org.apache.http.client.methods.HttpGet; +//import org.apache.http.conn.socket.LayeredConnectionSocketFactory; +//import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +//import org.apache.http.impl.client.CloseableHttpClient; +//import org.apache.http.impl.client.HttpClientBuilder; +//import org.apache.http.impl.client.HttpClients; +// +//import javax.net.ssl.SSLContext; +//import javax.net.ssl.TrustManager; +//import javax.net.ssl.X509TrustManager; +//import java.io.BufferedReader; +//import java.io.IOException; +//import java.io.InputStreamReader; +//import java.security.cert.X509Certificate; +// +//public class CASServiceUtil { +// +// public static void main(String[] args) { +// String serviceUrl = "https://cas.8f8.com.cn:8443/cas/p3/serviceValidate"; +// String service = "http://localhost:3003/user/login"; +// String ticket = "ST-5-1g-9cNES6KXNRwq-GuRET103sm0-DESKTOP-VKLS8B3"; +// String res = getSTValidate(serviceUrl,ticket, service); +// +// System.out.println("---------res-----"+res); +// } +// +// +// /** +// * 验证ST +// */ +// public static String getSTValidate(String url,String st, String service){ +// try { +// url = url+"?service="+service+"&ticket="+st; +// CloseableHttpClient httpclient = createHttpClientWithNoSsl(); +//// CloseableHttpClient httpclient= HttpClientBuilder.create().build(); +// +// HttpGet httpget = new HttpGet(url); +// HttpResponse response = httpclient.execute(httpget); +// String res = readResponse(response); +// return res == null ? null : (res == "" ? null : res); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return ""; +// } +// +// +// /** +// * 读取 response body 内容为字符串 +// * +// * @param response +// * @return +// * @throws IOException +// */ +// private static String readResponse(HttpResponse response) throws IOException { +// BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); +// String result = new String(); +// String line; +// while ((line = in.readLine()) != null) { +// result += line; +// } +// return result; +// } +// +// +// /** +// * 创建模拟客户端(针对 https 客户端禁用 SSL 验证) +// * +// * @param cookieStore 缓存的 Cookies 信息 +// * @return +// * @throws Exception +// */ +// private static CloseableHttpClient createHttpClientWithNoSsl() throws Exception { +// // Create a trust manager that does not validate certificate chains +// TrustManager[] trustAllCerts = new TrustManager[]{ +// new X509TrustManager() { +// @Override +// public X509Certificate[] getAcceptedIssuers() { +// return null; +// } +// +// @Override +// public void checkClientTrusted(X509Certificate[] certs, String authType) { +// // don't check +// } +// +// @Override +// public void checkServerTrusted(X509Certificate[] certs, String authType) { +// // don't check +// } +// } +// }; +// +// SSLContext ctx = SSLContext.getInstance("TLS"); +// ctx.init(null, trustAllCerts, null); +// LayeredConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(ctx); +// return HttpClients.custom() +// .setSSLSocketFactory(sslSocketFactory) +// .build(); +// } +// +//} diff --git a/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/XmlUtils.java b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/XmlUtils.java new file mode 100644 index 0000000..fb6de08 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/rest/cas/util/XmlUtils.java @@ -0,0 +1,286 @@ +//package com.adc.da.login.rest.cas.util; +// +// +//import lombok.extern.slf4j.Slf4j; +//import org.w3c.dom.Document; +//import org.xml.sax.Attributes; +//import org.xml.sax.InputSource; +//import org.xml.sax.SAXException; +//import org.xml.sax.XMLReader; +//import org.xml.sax.helpers.DefaultHandler; +// +//import javax.xml.XMLConstants; +//import javax.xml.parsers.DocumentBuilderFactory; +//import javax.xml.parsers.ParserConfigurationException; +//import javax.xml.parsers.SAXParser; +//import javax.xml.parsers.SAXParserFactory; +//import java.io.StringReader; +//import java.util.*; +// +///** +// * 解析cas,ST验证后的xml +// * +// */ +//@Slf4j +//public final class XmlUtils { +// +// /** +// * Creates a new namespace-aware DOM document object by parsing the given XML. +// * +// * @param xml XML content. +// * +// * @return DOM document. +// */ +// public static Document newDocument(final String xml) { +// final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); +// final Map features = new HashMap(); +// features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true); +// features.put("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); +// for (final Map.Entry entry : features.entrySet()) { +// try { +// factory.setFeature(entry.getKey(), entry.getValue()); +// } catch (ParserConfigurationException e) { +// log.warn("Failed setting XML feature {}: {}", entry.getKey(), e); +// } +// } +// factory.setNamespaceAware(true); +// try { +// return factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); +// } catch (Exception e) { +// throw new RuntimeException("XML parsing error: " + e); +// } +// } +// +// /** +// * Get an instance of an XML reader from the XMLReaderFactory. +// * +// * @return the XMLReader. +// */ +// public static XMLReader getXmlReader() { +// try { +// final XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); +// reader.setFeature("http://xml.org/sax/features/namespaces", true); +// reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); +// reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); +// return reader; +// } catch (final Exception e) { +// throw new RuntimeException("Unable to create XMLReader", e); +// } +// } +// +// +// /** +// * Retrieve the text for a group of elements. Each text element is an entry +// * in a list. +// *

This method is currently optimized for the use case of two elements in a list. +// * +// * @param xmlAsString the xml response +// * @param element the element to look for +// * @return the list of text from the elements. +// */ +// public static List getTextForElements(final String xmlAsString, final String element) { +// final List elements = new ArrayList(2); +// final XMLReader reader = getXmlReader(); +// +// final DefaultHandler handler = new DefaultHandler() { +// +// private boolean foundElement = false; +// +// private StringBuilder buffer = new StringBuilder(); +// +// public void startElement(final String uri, final String localName, final String qName, +// final Attributes attributes) throws SAXException { +// if (localName.equals(element)) { +// this.foundElement = true; +// } +// } +// +// public void endElement(final String uri, final String localName, final String qName) throws SAXException { +// if (localName.equals(element)) { +// this.foundElement = false; +// elements.add(this.buffer.toString()); +// this.buffer = new StringBuilder(); +// } +// } +// +// public void characters(char[] ch, int start, int length) throws SAXException { +// if (this.foundElement) { +// this.buffer.append(ch, start, length); +// } +// } +// }; +// +// reader.setContentHandler(handler); +// reader.setErrorHandler(handler); +// +// try { +// reader.parse(new InputSource(new StringReader(xmlAsString))); +// } catch (final Exception e) { +// log.error(e.getMessage(), e); +// return null; +// } +// +// return elements; +// } +// +// /** +// * Retrieve the text for a specific element (when we know there is only +// * one). +// * +// * @param xmlAsString the xml response +// * @param element the element to look for +// * @return the text value of the element. +// */ +// public static String getTextForElement(final String xmlAsString, final String element) { +// final XMLReader reader = getXmlReader(); +// final StringBuilder builder = new StringBuilder(); +// +// final DefaultHandler handler = new DefaultHandler() { +// +// private boolean foundElement = false; +// +// public void startElement(final String uri, final String localName, final String qName, +// final Attributes attributes) throws SAXException { +// if (localName.equals(element)) { +// this.foundElement = true; +// } +// } +// +// public void endElement(final String uri, final String localName, final String qName) throws SAXException { +// if (localName.equals(element)) { +// this.foundElement = false; +// } +// } +// +// public void characters(char[] ch, int start, int length) throws SAXException { +// if (this.foundElement) { +// builder.append(ch, start, length); +// } +// } +// }; +// +// reader.setContentHandler(handler); +// reader.setErrorHandler(handler); +// +// try { +// reader.parse(new InputSource(new StringReader(xmlAsString))); +// } catch (final Exception e) { +// log.error(e.getMessage(), e); +// return null; +// } +// +// return builder.toString(); +// } +// +// +// public static Map extractCustomAttributes(final String xml) { +// final SAXParserFactory spf = SAXParserFactory.newInstance(); +// spf.setNamespaceAware(true); +// spf.setValidating(false); +// try { +// final SAXParser saxParser = spf.newSAXParser(); +// final XMLReader xmlReader = saxParser.getXMLReader(); +// final CustomAttributeHandler handler = new CustomAttributeHandler(); +// xmlReader.setContentHandler(handler); +// xmlReader.parse(new InputSource(new StringReader(xml))); +// return handler.getAttributes(); +// } catch (final Exception e) { +// log.error(e.getMessage(), e); +// return Collections.emptyMap(); +// } +// } +// +// private static class CustomAttributeHandler extends DefaultHandler { +// +// private Map attributes; +// +// private boolean foundAttributes; +// +// private String currentAttribute; +// +// private StringBuilder value; +// +// @Override +// public void startDocument() throws SAXException { +// this.attributes = new HashMap(); +// } +// +// @Override +// public void startElement(final String namespaceURI, final String localName, final String qName, +// final Attributes attributes) throws SAXException { +// if ("attributes".equals(localName)) { +// this.foundAttributes = true; +// } else if (this.foundAttributes) { +// this.value = new StringBuilder(); +// this.currentAttribute = localName; +// } +// } +// +// @Override +// public void characters(final char[] chars, final int start, final int length) throws SAXException { +// if (this.currentAttribute != null) { +// value.append(chars, start, length); +// } +// } +// +// @Override +// public void endElement(final String namespaceURI, final String localName, final String qName) +// throws SAXException { +// if ("attributes".equals(localName)) { +// this.foundAttributes = false; +// this.currentAttribute = null; +// } else if (this.foundAttributes) { +// final Object o = this.attributes.get(this.currentAttribute); +// +// if (o == null) { +// this.attributes.put(this.currentAttribute, this.value.toString()); +// } else { +// final List items; +// if (o instanceof List) { +// items = (List) o; +// } else { +// items = new LinkedList(); +// items.add(o); +// this.attributes.put(this.currentAttribute, items); +// } +// items.add(this.value.toString()); +// } +// } +// } +// +// public Map getAttributes() { +// return this.attributes; +// } +// } +// +// +// public static void main(String[] args) { +// String result = "\r\n" + +// " \r\n" + +// " admin\r\n" + +// " \r\n" + +// " UsernamePasswordCredential\r\n" + +// " true\r\n" + +// " 2019-08-01T19:33:21.527+08:00[Asia/Shanghai]\r\n" + +// " RestAuthenticationHandler\r\n" + +// " RestAuthenticationHandler\r\n" + +// " false\r\n" + +// " \r\n" + +// " \r\n" + +// ""; +// +// String errorRes = "\r\n" + +// " 未能够识别出目标 'ST-5-1g-9cNES6KXNRwq-GuRET103sm0-DESKTOP-VKLS8B3'票根\r\n" + +// ""; +// +// String error = XmlUtils.getTextForElement(errorRes, "authenticationFailure"); +// System.out.println("------"+error); +// +// String error2 = XmlUtils.getTextForElement(result, "authenticationFailure"); +// System.out.println("------"+error2); +// String principal = XmlUtils.getTextForElement(result, "user"); +// System.out.println("---principal---"+principal); +// Map attributes = XmlUtils.extractCustomAttributes(result); +// System.out.println("---attributes---"+attributes); +// } +//} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java b/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java new file mode 100644 index 0000000..eb3a027 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java @@ -0,0 +1,72 @@ +package com.adc.da.login.security; + +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.ResponseMessage; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.subject.Subject; +import org.apache.shiro.util.ThreadContext; +import org.apache.shiro.web.servlet.ShiroHttpServletResponse; +import org.apache.shiro.web.subject.WebSubject; +import org.apache.shiro.web.util.WebUtils; +import org.springframework.stereotype.Service; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +/** + * 表单验证(包含验证码)过滤类 + */ +@Service +public class AdcFormAuthenticationFilter extends org.apache.shiro.web.filter.authc.FormAuthenticationFilter { + + /** + * 验证码 + */ + public static final String DEFAULT_CAPTCHA_PARAM = "validateCode"; + + private String captchaParam = DEFAULT_CAPTCHA_PARAM; + + public String getCaptchaParam() { + return captchaParam; + } + + protected String getCaptcha(ServletRequest request) { + return WebUtils.getCleanParam(request, getCaptchaParam()); + } + + @Override + protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) { + // 不知道什么原因,在Spring Boot应用中,无法初始化WebSubject + WebSubject.Builder builder = new WebSubject.Builder(request, response); + WebSubject webSubject = builder.buildWebSubject(); + ThreadContext.bind(webSubject); + + String username = getUsername(request); + String password = getPassword(request); + String record; + if (password == null) { + record = ""; + } else { + record = password; + } + boolean rememberMe = isRememberMe(request); + String host = getHost(request); + String captcha = getCaptcha(request); + return new UsernamePasswordToken(username, record.toCharArray(), rememberMe, host, captcha); + } + + protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { + Subject subject = this.getSubject(request, response); + + if (subject.getPrincipal() == null) { + /* 设置状态码 为401 */ + ((HttpServletResponse) response).setStatus(401); + ((HttpServletResponse) response).sendError(401,"登录失效,请重新登录!"); + return true; + } else { + return false; + } + } + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/SystemAuthorizingRealm.java b/adc-da-login/src/main/java/com/adc/da/login/security/SystemAuthorizingRealm.java new file mode 100644 index 0000000..4c4d1bf --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/SystemAuthorizingRealm.java @@ -0,0 +1,260 @@ +package com.adc.da.login.security; + +import com.adc.da.login.LoginType; +import com.adc.da.login.NewHashedCredentialsMatcher; +import com.adc.da.login.entity.MyPrincipal; +import com.adc.da.login.util.CacheUtils; +import com.adc.da.sys.entity.UserEO; + +import com.adc.da.login.security.exception.CaptchaException; +import com.adc.da.login.util.UserUtils; +import com.adc.da.sys.service.UserEOServiceImpl; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.util.utils.Encodes; +import com.adc.da.util.utils.PasswordUtils; +import com.adc.da.util.utils.SpringContextHolder; +import com.google.common.collect.Maps; +import org.apache.shiro.SecurityUtils; + +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.cache.Cache; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.session.Session; +import org.apache.shiro.session.mgt.eis.SessionDAO; +import org.apache.shiro.subject.PrincipalCollection; +import org.apache.shiro.subject.SimplePrincipalCollection; +import org.apache.shiro.util.ByteSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import static com.adc.da.util.utils.PasswordUtils.HASH_ALGORITHM; +import static com.adc.da.util.utils.PasswordUtils.HASH_INTERATIONS; + +/** + * 系统安全认证实现类 + */ +@Service("systemAuthorizingRealm1") +public class SystemAuthorizingRealm extends AuthorizingRealm { + + /** + * 日志 + */ + private static final Logger LOG = LoggerFactory.getLogger(SystemAuthorizingRealm.class); + + /** + * 验证码 + */ + private static final Object VERIFY_CODE = "VerifyCode"; + + /** + * 读取验证码模式配置, + * 1为不开启,2为开启,3为三次输错用户名或密码才开启, + * 默认为1 + *

+ * 若配置文件缺少该参数,将设置为1 + */ + @Value("${verifyCodeMode:1}") + private int verifyCodeMode; + + /** + * @see IUserEoService + */ + @Resource + private IUserEoService userService; + + + /** + * 若userService为空,获取userService + * + * @return + */ + public IUserEoService getUserService() { + if (userService == null) { + userService = SpringContextHolder.getBean(UserEOServiceImpl.class); + } + return userService; + } + + /** + * 认证回调函数, 登录时调用 + */ + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) { + UsernamePasswordToken token = (UsernamePasswordToken) authcToken; + UserEO user; + if (token.getType().getCode() == LoginType.PASSWORD.getCode()) { + +// if (verifyCodeMode == 2 +// || (verifyCodeMode == 3 && isNeedValidCode(token.getUsername()))) { +// /* verifyCodeMode == 2 或 +// 如果登录失败超过3次需要验证码 */ +// doVerifyCode(token); +// } + // 如果登录失败超过3次需要验证码 + //if (LoginRestController.isNeedValidCode(token.getUsername())) { + Session session = SecurityUtils.getSubject().getSession(); + String verifyCode = (String) session.getAttribute("VerifyCode"); + //去掉验证码校验 + if (token.getCaptcha() == null || !token.getCaptcha().toUpperCase().equals(verifyCode)) { + if (token.getCaptcha() != null || !token.getCaptcha().toUpperCase().equals(verifyCode)) { + session.removeAttribute("VerifyCode"); + } + throw new CaptchaException("验证码错误."); + } + + user = getUserService().getUserByLoginNameNotDeleted(token.getUsername()); + if (user == null) { + return null; + } + +// byte[] salt = Encodes.decodeHex(user.getPassword().substring(0, 8)); +// return new SimpleAuthenticationInfo(new MyPrincipal(user), user.getPassword().substring(8), +// ByteSource.Util.bytes(salt), getName()); + +// byte[] salt = Encodes.decodeHex(user.getPassword().substring(0, 16)); +// return new SimpleAuthenticationInfo(new MyPrincipal(user), user.getPassword().substring(16), +// ByteSource.Util.bytes(salt), getName()); + } else{ + user = this.getUserService().getUserByLoginNameNotDeleted(token.getUsername()); + if (user == null) { + return null; + } + } + return new SimpleAuthenticationInfo(new MyPrincipal(user), user.getPassword(),getName()); + } + + /** + * 登录失败map + */ + private static final String LOGIN_FAIL_MAP = "loginFailMap"; + + /** + * 10分钟内最大错误次数 + */ + @Value("${maxLoginErrorCount:3}") + private int maxLoginErrorCount; + + /** + * 判断是否需要验证验证码 + * + * @param userName 用户名 + * @return + */ + public boolean isNeedValidCode(String userName) { + Map loginFailMap = (Map) CacheUtils.getErrorCache(LOGIN_FAIL_MAP); + if (loginFailMap == null) { + return false; + } + + Integer loginFailNum = loginFailMap.get(userName); + if (loginFailNum == null) { + return false; + } + + return loginFailNum >= maxLoginErrorCount; + } + + + + + /** + * 授权查询回调函数, 进行鉴权但缓存中无用户的授权信息时调用 + */ + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { + MyPrincipal principal = (MyPrincipal) getAvailablePrincipal(principals); + UserEO user = userService.getUserByLoginName(principal.getLoginName(),null); + if (user != null) { + try { + return UserUtils.getAuthInfo(); + } catch (NumberFormatException e) { + + LOG.error("AuthorizationInfo NumberFormatException", e); + } catch (Exception e) { + LOG.error("AuthorizationInfo Exception", e); + + } + } else { + return null; + } + return null; + } + + /** + * 验证码验证 + */ + private void doVerifyCode(UsernamePasswordToken token) { + Session session = SecurityUtils.getSubject().getSession(); + String verifyCode = (String) session.getAttribute(VERIFY_CODE); + /* + * 忽略大小写改用 equalsIgnoreCase + * date 2018-08-29 + */ + if (token.getCaptcha() == null || !token.getCaptcha().equalsIgnoreCase(verifyCode)) { + session.removeAttribute(VERIFY_CODE); + throw new CaptchaException("验证码错误."); + } + // 登录成功也清空验证码 + session.removeAttribute(VERIFY_CODE); + } + + /** + * 设定密码校验的Hash算法与迭代次数, + * 将 HASH_ALGORITHM 和 HASH_INTERATIONS 改为util中的参数 + *

+ * date 2018-09-06 + * @author Lee Kwanho + */ + @PostConstruct + public void initCredentialsMatcher() { + NewHashedCredentialsMatcher matcher = new NewHashedCredentialsMatcher(HASH_ALGORITHM); + matcher.setHashIterations(PasswordUtils.HASH_INTERATIONS); + setCredentialsMatcher(matcher); + +// HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(HASH_ALGORITHM); +// matcher.setHashIterations(HASH_INTERATIONS); +// setCredentialsMatcher(matcher); + } + + /** + * 清空用户关联权限认证,待下次使用时重新加载 + */ + public void clearCachedAuthorizationInfo(String principal) { + SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); + clearCachedAuthorizationInfo(principals); + } + + /** + * 清空用户关联权限认证,待下次使用时重新加载 + */ + public void clearCachedAuthorizationInfo(MyPrincipal principal) { + SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); + clearCachedAuthorizationInfo(principals); + } + + + + /** + * 清空所有关联认证 + */ + public void clearAllCachedAuthorizationInfo() { + Cache cache = getAuthorizationCache(); + if (cache != null) { + for (Object key : cache.keys()) { + cache.remove(key); + } + } + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/UsernamePasswordToken.java b/adc-da-login/src/main/java/com/adc/da/login/security/UsernamePasswordToken.java new file mode 100644 index 0000000..e73885d --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/UsernamePasswordToken.java @@ -0,0 +1,60 @@ +package com.adc.da.login.security; + +import com.adc.da.login.LoginType; + +/** + * 用户和密码(包含验证码)令牌类 + */ +public class UsernamePasswordToken extends org.apache.shiro.authc.UsernamePasswordToken { + + private String captcha; + + private LoginType type; + + public UsernamePasswordToken() { + super(); + } + + public UsernamePasswordToken(String username, char[] password) { + super(username, password); + } + + /** + * 账号密码登录 + */ + public UsernamePasswordToken(String username, char[] password, String captcha) { + super(username, password); + this.captcha = captcha; + this.type = LoginType.PASSWORD; + } + + /** + * 免密登录 + */ + public UsernamePasswordToken(String username) { + super(username, ""); + this.captcha = captcha; + this.type = LoginType.NOPASSWD; + } + + public UsernamePasswordToken(String username, char[] password, boolean rememberMe, String host, String captcha) { + super(username, password, rememberMe, host); + this.captcha = captcha; + } + + public String getCaptcha() { + return captcha; + } + + public void setCaptcha(String captcha) { + this.captcha = captcha; + } + + public LoginType getType() { + return type; + } + + public void setType(LoginType type) { + this.type = type; + } +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/exception/CaptchaException.java b/adc-da-login/src/main/java/com/adc/da/login/security/exception/CaptchaException.java new file mode 100644 index 0000000..376aa73 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/exception/CaptchaException.java @@ -0,0 +1,28 @@ +package com.adc.da.login.security.exception; + +import org.apache.shiro.authc.AuthenticationException; + +/** + * 验证码异常处理类 + */ +public class CaptchaException extends AuthenticationException { + + private static final long serialVersionUID = 1L; + + public CaptchaException() { + super(); + } + + public CaptchaException(String message, Throwable cause) { + super(message, cause); + } + + public CaptchaException(String message) { + super(message); + } + + public CaptchaException(Throwable cause) { + super(cause); + } + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/IVerifyCodeGen.java b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/IVerifyCodeGen.java new file mode 100644 index 0000000..ea5da14 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/IVerifyCodeGen.java @@ -0,0 +1,29 @@ +package com.adc.da.login.security.validatecode; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * 验证码生成接口 + */ +public interface IVerifyCodeGen { + + /** + * 生成验证码并返回code,将图片写的os中 + * @param width + * @param height + * @param os + * @return + * @throws IOException + */ + String generate(int width, int height, OutputStream os, int number) throws IOException; + + /** + * 生成验证码对象 + * @param width + * @param height + * @return + * @throws IOException + */ + VerifyCode generate(int width, int height, int number) throws IOException; +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.java b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.java new file mode 100644 index 0000000..59ba98a --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.java @@ -0,0 +1,123 @@ +package com.adc.da.login.security.validatecode; + +import com.adc.da.util.utils.RandomUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.imageio.ImageIO; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Random; + +public class SimpleCharVerifyCodeGenImpl implements IVerifyCodeGen { + + /** + * 日志 + */ + private static final Logger LOG = LoggerFactory.getLogger(SimpleCharVerifyCodeGenImpl.class); + + /** + * 字体 + */ + private static final String[] FONT_TYPES = {"宋体", "新宋体", "黑体", "楷体", "隶书" }; + + /** + * 验证码生成 + * + * @param width + * @param height + * @param os + * @param number + * @return + * @throws IOException + */ + @Override + public String generate(int width, int height, OutputStream os, int number) throws IOException { + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics graphics = image.getGraphics(); + fillBackground(graphics, width, height); + String randomStr = RandomUtils.randomString(number); + createCharacter(graphics, randomStr); + graphics.dispose(); + ImageIO.write(image, "JPEG", os); + return randomStr; + } + + /** + * 验证码生成模块 + * 改为try-with-resource写法 + * + * @param width 宽度 + * @param height 高度 + * @param number 数字 + * @return 验证码 + * @author Lee Kwanho 李坤澔 + * date 2018-08-29 + **/ + @Override + public VerifyCode generate(int width, int height, int number) throws IOException { + VerifyCode verifyCode = null; + + try (ByteArrayOutputStream baos = new ByteArrayOutputStream();) { + String code = generate(width, height, baos, number); + verifyCode = new VerifyCode(); + verifyCode.setCode(code); + verifyCode.setImgBytes(baos.toByteArray()); + } catch (Exception e) { + LOG.error(e.getMessage(), e); + verifyCode = null; + } + return verifyCode; + + } + + /** + * 验证码背景填充 + * + * @param graphics 二维码 + * @param width 宽度 + * @param height 高度 + * @author comments created by Lee Kwanho + * date 2018-08-29 + **/ + private static void fillBackground(Graphics graphics, int width, int height) { + // 填充背景 + graphics.setColor(Color.WHITE); + graphics.fillRect(0, 0, width, height); + + // 加入干扰线条 + for (int i = 0; i < 8; i++) { + graphics.setColor(RandomUtils.randomColor(40, 150)); + Random random = new Random(); + int x = random.nextInt(width); + int y = random.nextInt(height); + int x1 = random.nextInt(width); + int y1 = random.nextInt(height); + graphics.drawLine(x, y, x1, y1); + } + } + /** + * 生成随机字 + * + * @param g 验证码 + * @param randomStr 随机字 + * @author comments created by Lee Kwanho + * date 2018-08-29 + **/ + private void createCharacter(Graphics g, String randomStr) { + char[] charArray = randomStr.toCharArray(); + for (int i = 0; i < charArray.length; i++) { + g.setColor(new Color(50 + RandomUtils.nextInt(100), 50 + RandomUtils.nextInt(100), + 50 + RandomUtils.nextInt(100))); + g.setFont(new Font(FONT_TYPES[RandomUtils.nextInt(FONT_TYPES.length)], Font.BOLD, 26)); + g.drawString(String.valueOf(charArray[i]), 15 * i + 5, 19 + RandomUtils.nextInt(8)); + } + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/VerifyCode.java b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/VerifyCode.java new file mode 100644 index 0000000..887f8a5 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/security/validatecode/VerifyCode.java @@ -0,0 +1,46 @@ +package com.adc.da.login.security.validatecode; + +/** + * 验证码实体类 + */ +public class VerifyCode { + + /** + * 验证码 + */ + private String code; + + /** + * 背景图片 + */ + private byte[] imgBytes; + + /** + * 过期时间 + */ + private long expireTime; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public byte[] getImgBytes() { + return imgBytes; + } + + public void setImgBytes(byte[] imgBytes) { + this.imgBytes = imgBytes; + } + + public long getExpireTime() { + return expireTime; + } + + public void setExpireTime(long expireTime) { + this.expireTime = expireTime; + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/service/OnlineUserListener.java b/adc-da-login/src/main/java/com/adc/da/login/service/OnlineUserListener.java new file mode 100644 index 0000000..8b85b20 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/service/OnlineUserListener.java @@ -0,0 +1,57 @@ +package com.adc.da.login.service; + +import java.io.Serializable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import com.adc.da.login.entity.OnlineUserEO; + +/** + * 用于记录在线用户 + */ +public class OnlineUserListener implements HttpSessionBindingListener , Serializable { + + private OnlineUserEO onlineUser; + + private static final Map ONLINE_MAP = new ConcurrentHashMap<>(); + + /** + * 初始化 + */ + public OnlineUserListener() { + } + + public OnlineUserListener(OnlineUserEO onlineUser) { + + this.onlineUser = onlineUser; + } + + /** + * 用户上线 + */ + @Override + public void valueBound(HttpSessionBindingEvent e) { + HttpSession session = e.getSession(); + // 把用户名放入在线列表 + ONLINE_MAP.put(session.getId(), onlineUser); + } + + /** + * 用户下线 + */ + @Override + public void valueUnbound(HttpSessionBindingEvent e) { + HttpSession session = e.getSession(); + // 把用户名移除在线列表 + ONLINE_MAP.remove(session.getId()); + } + + public static Map getOnlineMap() { + return ONLINE_MAP; + } + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/CacheUtils.java b/adc-da-login/src/main/java/com/adc/da/login/util/CacheUtils.java new file mode 100644 index 0000000..32804eb --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/util/CacheUtils.java @@ -0,0 +1,141 @@ +package com.adc.da.login.util; + +import com.adc.da.util.utils.SpringContextHolder; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; + +/** + * Cache工具类 + */ +public class CacheUtils { + + private CacheUtils() { + throw new IllegalStateException("CacheUtils.java"); + } + + private static CacheManager cacheManager = SpringContextHolder.getBean("ehCacheManagerFactoryBean"); + + private static final String SYS_CACHE = "sysCache"; + + private static final String ERROR_CACHE = "errorCache"; + + private static final String SUBJECT_CACHE = "subjectCache" ; + private static final String SHIRO_ACTIVE_SESSION_CACHE = "shiro-activeSessionCache"; + + + public static Object get(String key) { + return get(SYS_CACHE, key); + } + + public static void put(String key, Object value) { + put(SYS_CACHE, key, value); + } + + public static void remove(String key) { + remove(SYS_CACHE, key); + } + + //以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml + // + public static Object getErrorCache(String key) { + return get(ERROR_CACHE, key); + } + + public static void putErrorCache(String key, Object value) { + put(ERROR_CACHE, key, value); + } + + public static void removeErrorCache(String key) { + remove(ERROR_CACHE, key); + } + + + //以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml + // + public static Object getSubjectCache(String key) { + return get(SUBJECT_CACHE, key); + } + + public static void putSubjectCache(String key, Object value) { + put(SUBJECT_CACHE, key, value); + } + + public static void removeSubjectCache(String key) { + remove(SUBJECT_CACHE, key); + } + + public static Cache getSubjectCacheObject() { + Cache cache = cacheManager.getCache(SUBJECT_CACHE); + if (cache == null) { + cacheManager.addCache(SUBJECT_CACHE); + cache = cacheManager.getCache(SUBJECT_CACHE); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + //cacheManager.getCache("shiroActiveSessionCache").remove(sessionid) + + public static Cache getShiroSessionCacheObject() { + Cache cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE); + if (cache == null) { + cacheManager.addCache(SHIRO_ACTIVE_SESSION_CACHE); + cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + public static void putShiroSessionCache(String key, Object value) { + put(SHIRO_ACTIVE_SESSION_CACHE, key, value); + } + + public static Object getShiroSessionCache(String key) { + return get(SUBJECT_CACHE, key); + } + + public static void removeShiroSessionCache(String key) { + remove(SHIRO_ACTIVE_SESSION_CACHE, key); + } + + + + + + + public static Object get(String cacheName, String key) { + Element element = getCache(cacheName).get(key); + return element == null ? null : element.getObjectValue(); + } + + public static void put(String cacheName, String key, Object value) { + Element element = new Element(key, value); + getCache(cacheName).put(element); + } + + public static void remove(String cacheName, String key) { + getCache(cacheName).remove(key); + } + + /** + * 获得一个Cache,没有则创建一个。 + * + * @param cacheName + * @return + */ + private static Cache getCache(String cacheName) { + Cache cache = cacheManager.getCache(cacheName); + if (cache == null) { + cacheManager.addCache(cacheName); + cache = cacheManager.getCache(cacheName); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + public static CacheManager getCacheManager() { + return cacheManager; + } + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java b/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java new file mode 100644 index 0000000..e834ff7 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java @@ -0,0 +1,116 @@ +package com.adc.da.login.util; + +import com.adc.da.login.entity.MyPrincipal; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.RoleEOService; +import com.adc.da.sys.service.UserEOServiceImpl; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.vo.LabelReturnVo; +import com.adc.da.util.utils.SpringContextHolder; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.session.InvalidSessionException; +import org.apache.shiro.subject.Subject; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * @Author doudxw + * @Date 2021/8/3 14:52 + */ +@Slf4j +public class CommonUtils { + + private static final RoleEOService roleEOService = SpringContextHolder.getBean(RoleEOService.class); + + private static final IUserEoService userService = SpringContextHolder.getBean(UserEOServiceImpl.class); + + private static final List labelTypeList=new ArrayList<>(); + + private static final ExecutorService executorService = new ThreadPoolExecutor(400,800 + ,10L,TimeUnit.SECONDS,new LinkedBlockingQueue<>(200) + ,new ThreadFactoryBuilder().setNameFormat("price-pool-%d").build()); + + + private static final ExecutorService executorServiceLabel=new ThreadPoolExecutor(100, 200 + , 60L, TimeUnit.SECONDS + , new LinkedBlockingQueue<>(),new ThreadFactoryBuilder().setNameFormat("label-pool-%d").build()); + + + static { + labelTypeList.add(new LabelReturnVo("labelOne","1")); + labelTypeList.add(new LabelReturnVo("labelTwo","2")); + labelTypeList.add(new LabelReturnVo("labelThree","3")); + } + + public static String getUserId() { +// String userId = null; +// try { +// Subject subject = SecurityUtils.getSubject(); +// MyPrincipal principal = (MyPrincipal) subject.getPrincipal(); +// if (principal != null) { +// userId = principal.getId(); +// } +// } catch (UnavailableSecurityManagerException e) { +// log.error("getUserId UnavailableSecurityManagerException", e); +// } catch (InvalidSessionException e) { +// log.error("getUserId InvalidSessionException", e); +// +// } +// return userId; +// return "BKS7G52TVR";//拆解管理员 + + return "ZGGJP3N7FT"; + } + + public static List getRoleList() throws Exception { +// List roleList = (List) CacheUtils.getCache(CACHE_ROLE_LIST); +// if (roleList == null) { +// UserEO user = getUser(); +// if (user != null) { +// roleList = roleEOService.getSysRoleListByUserId(user.getUsid()); +// } +// CacheUtils.putCache(CACHE_ROLE_LIST, roleList); +// } + if(null == getUserId()) {return null;} + + List roleList = roleEOService.getSysRoleListByUserId(getUserId()); + return roleList; + } + + public static boolean isAdmin() throws Exception { + List idList = getRoleList().stream().map(RoleEO::getId).collect(Collectors.toList()); + if( idList.contains("35LLRCAQ8D")){ + return true; + } + return false; + + } + + public static UserEO getUserInfo(){ + UserEO userEO = userService.getUserById(getUserId()); + return userEO; + } + + + + + public static ExecutorService threadPoolExecutor(){ + return executorServiceLabel; + } + + public static List getLableList(){ + return labelTypeList; + } + + + public static ExecutorService getPriceThreadPool(){ + return executorService; + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/EncryptUtil.java b/adc-da-login/src/main/java/com/adc/da/login/util/EncryptUtil.java new file mode 100644 index 0000000..4103f1a --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/util/EncryptUtil.java @@ -0,0 +1,480 @@ +package com.adc.da.login.util; + +import org.apache.commons.codec.binary.Base64; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +/** + * 功能描述 加密常用类 + */ +public class EncryptUtil { + // 密钥是16位长度的byte[]进行Base64转换后得到的字符串 + public static String key = "LmMGStGtOpF4xNyvYt54EQ=="; + + /** + *

  • + * 方法名称:encrypt
  • + * 加密方法 + * + * @param xmlStr + * 需要加密的消息字符串 + * @return 加密后的字符串 + */ + public static String encrypt(String xmlStr) { + byte[] encrypt = null; + + try { + // 取需要加密内容的utf-8编码。 + encrypt = xmlStr.getBytes("utf-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + // 取MD5Hash码,并组合加密数组 + byte[] md5Hasn = null; + try { + md5Hasn = EncryptUtil.MD5Hash(encrypt, 0, encrypt.length); + } catch (Exception e) { + e.printStackTrace(); + } + // 组合消息体 + byte[] totalByte = EncryptUtil.addMD5(md5Hasn, encrypt); + + // 取密钥和偏转向量 + byte[] key = new byte[8]; + byte[] iv = new byte[8]; + getKeyIV(EncryptUtil.key, key, iv); + SecretKeySpec deskey = new SecretKeySpec(key, "DES"); + IvParameterSpec ivParam = new IvParameterSpec(iv); + + // 使用DES算法使用加密消息体 + byte[] temp = null; + try { + temp = EncryptUtil.DES_CBC_Encrypt(totalByte, deskey, ivParam); + } catch (Exception e) { + e.printStackTrace(); + } + + // 使用Base64加密后返回 + return new BASE64Encoder().encode(temp); + } + + /** + *
  • + * 方法名称:encrypt
  • + * 功能描述: + * + *
    +	 * 解密方法
    +	 * 
    + * + *
  • + * + * @param xmlStr + * 需要解密的消息字符串 + * @return 解密后的字符串 + * @throws Exception + */ + public static String decrypt(String xmlStr) throws Exception { + // base64解码 + BASE64Decoder decoder = new BASE64Decoder(); + byte[] encBuf = null; + try { + encBuf = decoder.decodeBuffer(xmlStr); + } catch (IOException e) { + e.printStackTrace(); + } + + // 取密钥和偏转向量 + byte[] key = new byte[8]; + byte[] iv = new byte[8]; + getKeyIV(EncryptUtil.key, key, iv); + + SecretKeySpec deskey = new SecretKeySpec(key, "DES"); + IvParameterSpec ivParam = new IvParameterSpec(iv); + + // 使用DES算法解密 + byte[] temp = null; + try { + temp = EncryptUtil.DES_CBC_Decrypt(encBuf, deskey, ivParam); + } catch (Exception e) { + e.printStackTrace(); + } + + // 进行解密后的md5Hash校验 + byte[] md5Hash = null; + try { + md5Hash = EncryptUtil.MD5Hash(temp, 16, temp.length - 16); + } catch (Exception e) { + e.printStackTrace(); + } + + // 进行解密校检 + for (int i = 0; i < md5Hash.length; i++) { + if (md5Hash[i] != temp[i]) { + // System.out.println(md5Hash[i] + "MD5校验错误。" + temp[i]); + throw new Exception("MD5校验错误。"); + } + } + + // 返回解密后的数组,其中前16位MD5Hash码要除去。 + return new String(temp, 16, temp.length - 16, "utf-8"); + } + + /** + *
  • + * 方法名称:TripleDES_CBC_Encrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的三重DES/CBC加密算法,如果包含中文,请注意编码。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要加密内容的字节数组。 + * @param deskey + * KEY 由24位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 + * @return 加密后的字节数组 + * @throws Exception + */ + public static byte[] TripleDES_CBC_Encrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + byte[] cipherByte; + // 使用DES对称加密算法的CBC模式加密 + Cipher encrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding"); + + encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam); + + cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回加密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:TripleDES_CBC_Decrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的三重DES / CBC解密算法
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要解密内容的字节数组 + * @param deskey + * KEY 由24位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 + * @return 解密后的字节数组 + * @throws Exception + */ + public static byte[] TripleDES_CBC_Decrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + + byte[] cipherByte; + // 获得Cipher实例,使用CBC模式。 + Cipher decrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding"); + // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量 + decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam); + + cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回解密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:DES_CBC_Encrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的DES/CBC加密算法,如果包含中文,请注意编码。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要加密内容的字节数组。 + * @param deskey + * KEY 由8位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 + * @return 加密后的字节数组 + * @throws Exception + */ + public static byte[] DES_CBC_Encrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + byte[] cipherByte; + // 使用DES对称加密算法的CBC模式加密 + Cipher encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding"); + + encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam); + + cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回加密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:DES_CBC_Decrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的DES/CBC解密算法。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要解密内容的字节数组 + * @param deskey + * KEY 由8位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 + * @return 解密后的字节数组 + * @throws Exception + */ + public static byte[] DES_CBC_Decrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + + byte[] cipherByte; + // 获得Cipher实例,使用CBC模式。 + Cipher decrypt = Cipher.getInstance("DES/CBC/PKCS5Padding"); + // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量 + decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam); + + cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回解密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:MD5Hash
  • + * 功能描述: + * + *
    +	 * MD5,进行了简单的封装,以适用于加,解密字符串的校验。
    +	 * 
    + * + *
  • + * + * @param buf + * 需要MD5加密字节数组。 + * @param offset + * 加密数据起始位置。 + * @param length + * 需要加密的数组长度。 + * @return + * @throws Exception + */ + public static byte[] MD5Hash(byte[] buf, int offset, int length) + throws Exception { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(buf, offset, length); + return md.digest(); + } + + /** + *
  • + * 方法名称:byte2hex
  • + * 功能描述: + * + *
    +	 * 字节数组转换为二行制表示
    +	 * 
    + * + *
  • + * + * @param inStr + * 需要转换字节数组。 + * @return 字节数组的二进制表示。 + */ + public static String byte2hex(byte[] inStr) { + String stmp; + StringBuffer out = new StringBuffer(inStr.length * 2); + + for (int n = 0; n < inStr.length; n++) { + // 字节做"与"运算,去除高位置字节 11111111 + stmp = Integer.toHexString(inStr[n] & 0xFF); + if (stmp.length() == 1) { + // 如果是0至F的单位字符串,则添加0 + out.append("0" + stmp); + } else { + out.append(stmp); + } + } + return out.toString(); + } + + /** + *
  • + * 方法名称:addMD5
  • + * 功能描述: + * + *
    +	 * MD校验码 组合方法,前16位放MD5Hash码。 把MD5验证码byte[],加密内容byte[]组合的方法。
    +	 * 
    + * + *
  • + * + * @param md5Byte + * 加密内容的MD5Hash字节数组。 + * @param bodyByte + * 加密内容字节数组 + * @return 组合后的字节数组,比加密内容长16个字节。 + */ + public static byte[] addMD5(byte[] md5Byte, byte[] bodyByte) { + int length = bodyByte.length + md5Byte.length; + byte[] resutlByte = new byte[length]; + + // 前16位放MD5Hash码 + for (int i = 0; i < length; i++) { + if (i < md5Byte.length) { + resutlByte[i] = md5Byte[i]; + } else { + resutlByte[i] = bodyByte[i - md5Byte.length]; + } + } + + return resutlByte; + } + + /** + *
  • + * 方法名称:getKeyIV
  • + * 功能描述: + * + *
    +	 * 
    +	 * 
    + *
  • + * + * @param encryptKey + * @param key + * @param iv + */ + public static void getKeyIV(String encryptKey, byte[] key, byte[] iv) { + // 密钥Base64解密 + BASE64Decoder decoder = new BASE64Decoder(); + byte[] buf = null; + try { + buf = decoder.decodeBuffer(encryptKey); + } catch (IOException e) { + e.printStackTrace(); + } + // 前8位为key + int i; + for (i = 0; i < key.length; i++) { + key[i] = buf[i]; + } + // 后8位为iv向量 + for (i = 0; i < iv.length; i++) { + iv[i] = buf[i + 8]; + } + } + + /** + * AES加密算法 + * + * @param content + * 加密内容 + * @param password + * 密匙 + * @return + */ + public static String encryptAES(String content, String password) { + try { + if (content == null || content.equalsIgnoreCase("")) { + return ""; + } + + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + BASE64Encoder coder = new BASE64Encoder(); + coder.encode(enCodeFormat); + Cipher cipher = Cipher.getInstance("AES"); + byte[] byteContent = content.getBytes("utf-8"); + cipher.init(1, key); + byte[] result = cipher.doFinal(byteContent); + String str = Base64.encodeBase64String(result); + return str; + } catch (NoSuchAlgorithmException var13) { + var13.printStackTrace(); + } catch (NoSuchPaddingException var14) { + var14.printStackTrace(); + } catch (InvalidKeyException var15) { + var15.printStackTrace(); + } catch (UnsupportedEncodingException var16) { + var16.printStackTrace(); + } catch (IllegalBlockSizeException var17) { + var17.printStackTrace(); + } catch (BadPaddingException var18) { + var18.printStackTrace(); + } + + return null; + } + + /** + * AES解密 + * + * @param str + * @param password + * @return + */ + public static String decryptAES(String str, String password) { + try { + if (str == null || str.equalsIgnoreCase("")) { + return ""; + } + byte[] content = Base64.decodeBase64(str); + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + Cipher cipher = Cipher.getInstance("AES");// 创建密码器 + cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 + byte[] result = cipher.doFinal(content); + return new String(result, "utf-8"); // 加密 + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/JWTUtils.java b/adc-da-login/src/main/java/com/adc/da/login/util/JWTUtils.java new file mode 100644 index 0000000..bac0dd1 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/util/JWTUtils.java @@ -0,0 +1,142 @@ +package com.adc.da.login.util; + +import com.adc.da.sys.service.UserEOServiceImpl; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.vo.UserVO; +import com.adc.da.util.utils.SpringContextHolder; +import com.adc.da.util.utils.StringUtils; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +import java.util.Date; +import java.util.Map; +import java.util.UUID; + +public class JWTUtils { + + private static final long EXPIRE_TIME = 30L *60L * 1000L; + //设置存放token的key + private static final String TOKEN_KEY = "Authorization"; + + private static final String KEY = "tokenkey"; + + private static IUserEoService userService = SpringContextHolder.getBean(UserEOServiceImpl.class); + + + /** + * 生成JWT字符串 + * + * @param userVO + * @param ttlMillis + * @return + */ + public static String createJWT(Object userVO) { + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + long nowMillis = System.currentTimeMillis(); + long expMills; + //设置过期时间 + expMills=nowMillis+EXPIRE_TIME; + Date exp = new Date(expMills); + Date now = new Date(nowMillis); + + //添加构成JWT的参数 + JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT") + .claim("id", UUID.randomUUID().toString()) + .claim("isu", now) + .claim("sub", userVO) + .claim("exp", expMills) + .signWith(signatureAlgorithm, KEY); + //添加Token过期时间 + builder.setExpiration(exp).setNotBefore(now); + + //生成JWT + return builder.compact(); + } + + + /** + * 解码 + * + * @param jwt + * @return + */ + public static Claims parseJWT(String jwt) { + Claims claims = Jwts.parser() + .setSigningKey(KEY) + .parseClaimsJws(jwt).getBody(); + return claims; + + } + + /** + * 校验用户 + * + * @param token + * @return + */ +// public static boolean auth(String token) { +// Claims claims = parseJWT(token); +// //校验用户 +// Map userMap = (Map) claims.get("sub"); +// String id = userMap.get("userId").toString(); +// if (StringUtils.isNotBlank(id)) { +// UserVO user = userService.(id); +// if (user != null) { +// return true; +// } +// } +// return false; +// } + + + /** + * 判断token是否过期 + * + * @param + * @return + */ + public static boolean isExp(String token) { + Claims claims = parseJWT(token); + Date exp = claims.getExpiration(); + long now = System.currentTimeMillis(); + Date currentDate = new Date(now); + return currentDate.after(exp); + } + + + /** + * 判断token刷新时间是否过期 + * + * @param + * @return + */ + public static boolean isAllowRefresh(String token) { + + Claims claims = parseJWT(token); + long refreshTime = (long) claims.get("refresh_ttl"); + long now = System.currentTimeMillis(); + Date refreshDate = new Date(refreshTime); + Date currentDate = new Date(now); + if (currentDate.after(refreshDate)) { + return false; + } else { + return true; + } + } + + + /** + * 获取token-key + * + * @return + */ + public static String getTokenKey() { + return TOKEN_KEY; + } + + public static void main(String[] args) { + System.out.println(createJWT(null)); + } +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/UserUtils.java b/adc-da-login/src/main/java/com/adc/da/login/util/UserUtils.java new file mode 100644 index 0000000..0cc7c26 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/util/UserUtils.java @@ -0,0 +1,347 @@ +package com.adc.da.login.util; + +import com.adc.da.login.entity.MyPrincipal; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.login.security.SystemAuthorizingRealm; +import com.adc.da.sys.service.MenuEOService; +import com.adc.da.sys.service.RoleEOService; +import com.adc.da.sys.service.UserEOServiceImpl; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.CollectionUtils; +import com.adc.da.util.utils.ObjectUtils; +import com.adc.da.util.utils.SpringContextHolder; +import com.google.common.collect.Maps; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.UnavailableSecurityManagerException; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.session.InvalidSessionException; +import org.apache.shiro.subject.Subject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; +import java.util.Map; + +/** + * 用户信息工具类 + * + * @author comments created by Lee Kwanho + * date 2018-09-05 + **/ +public class UserUtils { + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(UserUtils.class); + + /** + * 当前登陆用户 + */ + public static final String CURRENT_USER = "currentUser"; + + /** + * 角色信息 + */ + public static final String CACHE_ROLE_LIST = "roleList"; + + /** + * 菜单信息 + */ + public static final String CACHE_MENU_LIST = "menuList"; + + /** + * 菜单树 + */ + public static final String CACHE_MENU_TREE = "menuTree"; + + /** + * 保留 + */ + public static final String CACHE_AREA_LIST = "areaList"; + + /** + * 保留 + */ + public static final String CACHE_OFFICE_LIST = "officeList"; + + /** + * 行业数据权限 + */ + public static final String CACHE_INDUSTRY_LIST = "industryList"; + + + /** + * @see UserEOService + */ + private static IUserEoService userService = SpringContextHolder.getBean(UserEOServiceImpl.class); + + /** + * @see MenuEOService + */ + private static MenuEOService menuService = SpringContextHolder.getBean(MenuEOService.class); + + /** + * @see RoleEOService + */ + private static RoleEOService roleEOService = SpringContextHolder.getBean(RoleEOService.class); + + private UserUtils() { + throw new IllegalStateException("UserUtils.java"); + } + + /** + * 退出 + */ + public static void logout() { + try { + SecurityUtils.getSubject().logout(); + } catch (UnavailableSecurityManagerException e) { + logger.error("logout UnavailableSecurityManagerException", e); + } catch (InvalidSessionException e) { + logger.error("logout InvalidSessionException", e); + } + } + + /** + * 获取当前登录用户ID + * + * @return userId + */ + public static String getUserId() { + String userId = null; + try { + Subject subject = SecurityUtils.getSubject(); + MyPrincipal principal = (MyPrincipal) subject.getPrincipal(); + if (principal != null) { + userId = principal.getId(); + } + } catch (UnavailableSecurityManagerException e) { + logger.error("getUserId UnavailableSecurityManagerException", e); + } catch (InvalidSessionException e) { + logger.error("getUserId InvalidSessionException", e); + + } + return userId; + //return "BKS7G52TVR"; + } + + /** + * 获取当前登录用户信息 + */ + public static UserEO getUser() { + UserEO user = (UserEO) CacheUtils.getCache(CURRENT_USER); + if (user == null) { + String userId = getUserId(); + + if (StringUtils.isNotEmpty(userId)) { + UserEO userInDb = userService.getUserById(userId); + user = ObjectUtils.clone(userInDb); + user.setPassword(null); + CacheUtils.putCache(CURRENT_USER, user); + } + } + return user; + } + + /** + * 修改当前用户信息 + * + * @param userVo 用户信息 + * @throws Exception 异常信息 + */ + public static void updateUserInfo(UserEO userVo) throws Exception { +// UserEO user = (UserEO) CacheUtils.getCache(CURRENT_USER); +// if (user != null) { +// String userId = getUserId(); +// +// if (StringUtils.isNotEmpty(userId)) { +// UserEO userInDb = userService.selectByPrimaryKey(userId); +// userInDb.setUsname(userVo.getUsname()); +// userService.save(userInDb); +// +// CacheUtils.removeCache(CURRENT_USER); +// } +// } + } + + /** + * 获取当前登录用户角色列表 + * + * @return 角色信息 + * @throws Exception + */ + public static List getRoleList() throws Exception { +// List roleList = (List) CacheUtils.getCache(CACHE_ROLE_LIST); +// if (roleList == null) { +// UserEO user = getUser(); +// if (user != null) { +// roleList = roleEOService.getSysRoleListByUserId(user.getUsid()); +// } +// CacheUtils.putCache(CACHE_ROLE_LIST, roleList); +// } + if(null == getUserId()) {return null;} + + List roleList = roleEOService.getSysRoleListByUserId(getUserId()); + return roleList; + } + + + + + /** + * @return + * @throws Exception + */ + public static String getRoleIds() throws Exception { + List roleList = getRoleList(); + if (CollectionUtils.isEmpty(roleList)) { + return ""; + } + StringBuilder roleIds = new StringBuilder(); + for (RoleEO sysRoleEO : roleList) { + roleIds.append(sysRoleEO.getId()).append(","); + } + return roleIds.substring(0, roleIds.length() - 1); + } + + + + + /** + * 获取当前登录用户菜单列表 + */ + public static List getMenuList() throws Exception { + List menuList = (List) CacheUtils.getCache(CACHE_MENU_LIST); + if (menuList == null) { + UserEO user = getUser(); + if (user != null) { + if (isAdmin(user)) { + menuList = menuService.findAll(); + } else { + menuList = menuService.listMenuEOByUserId(String.valueOf(user.getUsid())); + } + CacheUtils.putCache(CACHE_MENU_LIST, menuList); + } + } + return menuList; + } + + /** + * 获取当前登录用户菜单树 + */ + public static MenuEO getMenuTree() { + MenuEO menu = (MenuEO) CacheUtils.getCache(CACHE_MENU_TREE); + if (menu != null) { + + CacheUtils.putCache(CACHE_MENU_TREE, menu); + } + return menu; + } + + /** + * 判断用户是否是超级管理员 + * + * @param userVo 用户信息 + * @return 返回判断 + */ + public static boolean isAdmin(UserEO userVo) { + return userVo != null && "GHVRTMA9H2".equals(userVo.getUsid()); + } + + /** + * 获取用户菜单权限信息 + */ + public static SimpleAuthorizationInfo getAuthInfo() throws Exception { + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + List list = UserUtils.getMenuList(); + List roleEOList = UserUtils.getRoleList(); + for (MenuEO menu : list) { + if (StringUtils.isNotBlank(menu.getPermission())) { + // 添加基于Permission的权限信息 + for (String permission : StringUtils.split(menu.getPermission(), ",")) { + info.addStringPermission(permission); + } + } + } + for (RoleEO roleEO : roleEOList) { + if (StringUtils.isNotBlank(roleEO.getName()) && roleEO.getDelFlag() == 0) { + // 添加角色信息 + info.addRole(roleEO.getName()); + } + } + return info; + } + + /** + * 清空缓存 + */ + public static void flush() { + CacheUtils.removeCache(CURRENT_USER); + CacheUtils.removeCache(CACHE_MENU_LIST); + CacheUtils.removeCache(CACHE_MENU_TREE); + } + + /** + * + */ + private static final class CacheUtils { + /** + * @param key + * @return + */ + public static Object getCache(String key) { + return getCache(key, null); + } + + /** + * @param key + * @param defaultValue + * @return + */ + public static Object getCache(String key, Object defaultValue) { + Object obj = getCacheMap().get(key); + return obj == null ? defaultValue : obj; + } + + /** + * @param key + * @param value + */ + public static void putCache(String key, Object value) { + getCacheMap().put(key, value); + } + + /** + * @param key + */ + public static void removeCache(String key) { + getCacheMap().remove(key); + } + + /** + * @return + */ + public static Map getCacheMap() { + Map map = Maps.newHashMap(); + try { + Subject subject = SecurityUtils.getSubject(); + MyPrincipal principal = (MyPrincipal) subject.getPrincipal(); + return principal != null ? principal.getCacheMap() : map; + } catch (UnavailableSecurityManagerException e) { + logger.error("getCacheMap UnavailableSecurityManagerException", e); + } catch (InvalidSessionException e) { + logger.error("getCacheMap InvalidSessionException", e); + } + return map; + } + } + + +} diff --git a/adc-da-login/src/main/java/com/adc/da/login/vo/LoginVO.java b/adc-da-login/src/main/java/com/adc/da/login/vo/LoginVO.java new file mode 100644 index 0000000..985bdd3 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/vo/LoginVO.java @@ -0,0 +1,52 @@ +package com.adc.da.login.vo; + +import com.adc.da.base.entity.BaseEntity; + +/** + * 功能:LoginVO
    + * 作者:Alex
    + * 日期: 2018-7-31
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + */ +public class LoginVO extends BaseEntity { + /** + * 用户名 + */ + private String username; + + /** + * 密码 + */ + + private String password; + + /** + * 验证码 + */ + private String verifyCode; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getVerifyCode() { + return verifyCode; + } + + public void setVerifyCode(String verifyCode) { + this.verifyCode = verifyCode; + } + +} \ No newline at end of file diff --git a/adc-da-login/src/main/java/com/adc/da/login/vo/OnlineUserVO.java b/adc-da-login/src/main/java/com/adc/da/login/vo/OnlineUserVO.java new file mode 100644 index 0000000..75be995 --- /dev/null +++ b/adc-da-login/src/main/java/com/adc/da/login/vo/OnlineUserVO.java @@ -0,0 +1,29 @@ +package com.adc.da.login.vo; + +import java.util.List; + +import com.adc.da.login.entity.OnlineUserEO; + +public class OnlineUserVO { + + private List onlineUsers; + + private Integer total; + + public List getOnlineUsers() { + return onlineUsers; + } + + public void setOnlineUsers(List onlineUsers) { + this.onlineUsers = onlineUsers; + } + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + +} diff --git a/adc-da-login/target/classes/com/adc/da/login/LoginType.class b/adc-da-login/target/classes/com/adc/da/login/LoginType.class new file mode 100644 index 0000000..6e167e7 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/LoginType.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/NewHashedCredentialsMatcher.class b/adc-da-login/target/classes/com/adc/da/login/NewHashedCredentialsMatcher.class new file mode 100644 index 0000000..92f443a Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/NewHashedCredentialsMatcher.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/aspect/BusinessLogAspect.class b/adc-da-login/target/classes/com/adc/da/login/aspect/BusinessLogAspect.class new file mode 100644 index 0000000..6eb3254 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/aspect/BusinessLogAspect.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/config/ShiroConfiguration.class b/adc-da-login/target/classes/com/adc/da/login/config/ShiroConfiguration.class new file mode 100644 index 0000000..6d19b67 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/config/ShiroConfiguration.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/config/ShiroFilterConfiguration.class b/adc-da-login/target/classes/com/adc/da/login/config/ShiroFilterConfiguration.class new file mode 100644 index 0000000..8dd9341 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/config/ShiroFilterConfiguration.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/entity/MyPrincipal.class b/adc-da-login/target/classes/com/adc/da/login/entity/MyPrincipal.class new file mode 100644 index 0000000..ef23ea2 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/entity/MyPrincipal.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/entity/OnlineUserEO.class b/adc-da-login/target/classes/com/adc/da/login/entity/OnlineUserEO.class new file mode 100644 index 0000000..08f4ae0 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/entity/OnlineUserEO.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/filter/BasicAuthFilter.class b/adc-da-login/target/classes/com/adc/da/login/filter/BasicAuthFilter.class new file mode 100644 index 0000000..469e5c2 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/filter/BasicAuthFilter.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/filter/DdmRSAAuthFilter.class b/adc-da-login/target/classes/com/adc/da/login/filter/DdmRSAAuthFilter.class new file mode 100644 index 0000000..68c83d4 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/filter/DdmRSAAuthFilter.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/filter/jwtFilter.class b/adc-da-login/target/classes/com/adc/da/login/filter/jwtFilter.class new file mode 100644 index 0000000..cb14ddd Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/filter/jwtFilter.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/rest/LogController.class b/adc-da-login/target/classes/com/adc/da/login/rest/LogController.class new file mode 100644 index 0000000..8b0d800 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/rest/LogController.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/rest/LoginController.class b/adc-da-login/target/classes/com/adc/da/login/rest/LoginController.class new file mode 100644 index 0000000..58d3863 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/rest/LoginController.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/rest/LoginRestController.class b/adc-da-login/target/classes/com/adc/da/login/rest/LoginRestController.class new file mode 100644 index 0000000..8585716 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/rest/LoginRestController.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/AdcFormAuthenticationFilter.class b/adc-da-login/target/classes/com/adc/da/login/security/AdcFormAuthenticationFilter.class new file mode 100644 index 0000000..98ac0a5 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/AdcFormAuthenticationFilter.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/SystemAuthorizingRealm.class b/adc-da-login/target/classes/com/adc/da/login/security/SystemAuthorizingRealm.class new file mode 100644 index 0000000..2a6d435 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/SystemAuthorizingRealm.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/UsernamePasswordToken.class b/adc-da-login/target/classes/com/adc/da/login/security/UsernamePasswordToken.class new file mode 100644 index 0000000..2bb0c2f Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/UsernamePasswordToken.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/exception/CaptchaException.class b/adc-da-login/target/classes/com/adc/da/login/security/exception/CaptchaException.class new file mode 100644 index 0000000..b0cd198 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/exception/CaptchaException.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/validatecode/IVerifyCodeGen.class b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/IVerifyCodeGen.class new file mode 100644 index 0000000..a1397ac Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/IVerifyCodeGen.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.class b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.class new file mode 100644 index 0000000..a81c980 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/SimpleCharVerifyCodeGenImpl.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/security/validatecode/VerifyCode.class b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/VerifyCode.class new file mode 100644 index 0000000..56cf88e Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/security/validatecode/VerifyCode.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/service/OnlineUserListener.class b/adc-da-login/target/classes/com/adc/da/login/service/OnlineUserListener.class new file mode 100644 index 0000000..cee50b0 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/service/OnlineUserListener.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/CacheUtils.class b/adc-da-login/target/classes/com/adc/da/login/util/CacheUtils.class new file mode 100644 index 0000000..867d327 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/CacheUtils.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/CommonUtils.class b/adc-da-login/target/classes/com/adc/da/login/util/CommonUtils.class new file mode 100644 index 0000000..02cd602 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/CommonUtils.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/EncryptUtil.class b/adc-da-login/target/classes/com/adc/da/login/util/EncryptUtil.class new file mode 100644 index 0000000..61b027e Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/EncryptUtil.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/JWTUtils.class b/adc-da-login/target/classes/com/adc/da/login/util/JWTUtils.class new file mode 100644 index 0000000..09b0ee1 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/JWTUtils.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/UserUtils$CacheUtils.class b/adc-da-login/target/classes/com/adc/da/login/util/UserUtils$CacheUtils.class new file mode 100644 index 0000000..ebec5b3 Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/UserUtils$CacheUtils.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/util/UserUtils.class b/adc-da-login/target/classes/com/adc/da/login/util/UserUtils.class new file mode 100644 index 0000000..e29b66d Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/util/UserUtils.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/vo/LoginVO.class b/adc-da-login/target/classes/com/adc/da/login/vo/LoginVO.class new file mode 100644 index 0000000..b99b00f Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/vo/LoginVO.class differ diff --git a/adc-da-login/target/classes/com/adc/da/login/vo/OnlineUserVO.class b/adc-da-login/target/classes/com/adc/da/login/vo/OnlineUserVO.class new file mode 100644 index 0000000..fd57bad Binary files /dev/null and b/adc-da-login/target/classes/com/adc/da/login/vo/OnlineUserVO.class differ diff --git a/adc-da-main/pom.xml b/adc-da-main/pom.xml new file mode 100644 index 0000000..cc40a99 --- /dev/null +++ b/adc-da-main/pom.xml @@ -0,0 +1,454 @@ + + + 4.0.0 + + + com.adc + ca-data + 2.5.0 + + + adc-da-main + jar + + web + web project for Spring Boot + + adc + + registry.cn-hangzhou.aliyuncs.com + + adc-da + adc-da-docker + adc + + + + + + + + + + + + + + + + adc + http://60.247.58.121:8182/repository/public + + true + always + + + false + + + + snapshot + http://60.247.58.121:8182/repository/snapshots/ + + false + + + true + always + warn + + + + + + + + + + + + + + + + + + + com.adc + adc-da-base + 3.0.0-SNAPSHOT + + + adc-da-util + com.adc + + + + + + com.adc + adc-da-util + 2.3.3-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.adc + adc-da-login + 2.5.0 + + + + com.adc + adc-da-sys + 2.5.0 + + + + com.adc + adc-da-report + 2.5.0 + + + + + + + + + + + + + + + + + + + + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + + + + + + + + + + + + + + + + + + + + com.adc + adc-da-file + 2.0.0 + + + adc-da-base + com.adc + + + adc-da-util + com.adc + + + + + + com.adc + adc-da-gen + 2.3.2-SNAPSHOT + + + + + + + + + + com.alibaba + druid-spring-boot-starter + 1.1.9 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + log4j + log4j + 1.2.17 + + + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + com.baomidou + mybatis-plus-boot-starter + + + + com.baomidou + mybatis-plus-generator + 3.2.0 + + + org.freemarker + freemarker + 2.3.29 + + + + net.sourceforge.javacsv + javacsv + 2.0 + + + net.sf.opencsv + opencsv + 2.3 + + + commons-fileupload + commons-fileupload + + + com.alibaba + fastjson + + + com.google.guava + guava + + + com.mashape.unirest + unirest-java + + + + com.microsoft.sqlserver + mssql-jdbc + + + + com.oracle + ojdbc7 + + + + mysql + mysql-connector-java + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + commons-logging + commons-logging + + + commons-beanutils + commons-beanutils + + + commons-collections + commons-collections + + + + + org.apache.httpcomponents + httpclient + 4.4.1 + + + org.apache.httpcomponents + httpcore + 4.4.1 + + + + org.aspectj + aspectjweaver + + + + com.github.xiaoymin + swagger-bootstrap-ui + 1.8.9 + + + javax.mail + mailapi + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + + + + + + + + + + + + + + + + + + + + io.github.swagger2markup + swagger2markup-maven-plugin + 1.3.1 + + http://localhost:8080/v2/api-docs + src/docs/asciidoc/generated + + ASCIIDOC + + + + + org.asciidoctor + asciidoctor-maven-plugin + 1.5.6 + + src/docs/asciidoc/generated + src/docs/asciidoc/html + html + coderay + + left + + + + + com.spotify + docker-maven-plugin + 1.1.1 + + true + true + + ${project.build.finalName}.jar + + ${docker.repository.url}/${docker.repository.namespace}/${docker.registry.name}/${project.artifactId}:${project.version} + ${docker.repository.serverId} + ${docker.repository.url} + src/main/docker + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + + + + + + diff --git a/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java new file mode 100644 index 0000000..c96a8c7 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java @@ -0,0 +1,18 @@ +package com.adc.da; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ServletComponentScan +@ComponentScan("com.adc") +public class AdcDaApplication { + + public static void main(String[] args) { + ApplicationContext applicationContext = SpringApplication.run(AdcDaApplication.class, args); + } + +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java b/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java new file mode 100644 index 0000000..a8fdf40 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java @@ -0,0 +1,16 @@ +package com.adc.da; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * Springboot打war包的启动口 + */ +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + // 注意这里要指向原先用main方法执行的Application启动类 + return builder.sources(AdcDaApplication.class); + } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java new file mode 100644 index 0000000..cabe6eb --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java @@ -0,0 +1,39 @@ +package com.adc.da.main.advice; + +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.ResponseMessageCodeEnum; +import com.adc.da.util.http.Result; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ControllerAdvice +@Order(value=3) +public class AdcDaBaseExceptionAdvice { + + private static final Logger logger = LoggerFactory.getLogger(AdcDaBaseExceptionAdvice.class); + + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(AdcDaBaseException.class) + @ResponseBody + public ResponseMessage handlerAdcDaBaseException(AdcDaBaseException exception) { + logger.warn(exception.getMessage(), exception); + return Result.error(exception.getErrorCode(), exception.getMessage()); + } + + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(Exception.class) + @ResponseBody + public ResponseMessage handlerAdcDaBaseException(Exception exception) { + logger.error(exception.getMessage(), exception); + // TODO 在数据库中记录程序异常,这个地方的异常是未处理的异常,需要管理员查看并进行处理以防重复出现 + return Result.error(ResponseMessageCodeEnum.ERROR.getCode(), "程序异常,请重试。如果重复出现请联系管理员处理!"); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/MultipartExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/MultipartExceptionAdvice.java new file mode 100644 index 0000000..9f9aeb7 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/MultipartExceptionAdvice.java @@ -0,0 +1,31 @@ +package com.adc.da.main.advice; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.multipart.MultipartException; + +@ControllerAdvice +public class MultipartExceptionAdvice { + + private static final Logger logger = LoggerFactory.getLogger(MultipartExceptionAdvice.class); + + @Value("${spring.servlet.multipart.max-file-size}") + private String maxFileSize; + + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(MultipartException.class) + @ResponseBody + public ResponseMessage handlerAdcDaBaseException(MultipartException exception) { + logger.warn(exception.getMessage(), exception); + return Result.error("文件大小超过限制(" + maxFileSize.toUpperCase() + ")"); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/NotValidExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/NotValidExceptionAdvice.java new file mode 100644 index 0000000..b9bcb1a --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/NotValidExceptionAdvice.java @@ -0,0 +1,84 @@ +package com.adc.da.main.advice; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.ResponseMessageCodeEnum; +import com.adc.da.util.http.Result; +import com.adc.da.util.http.ValidError; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.ValidationException; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + * 参考:http://javaninja.net/2013/12/getting-spring-mvc-validation-messages-from-a-json-service/ + */ +@ControllerAdvice +public class NotValidExceptionAdvice { + + private static final Logger logger = LoggerFactory.getLogger(NotValidExceptionAdvice.class); + + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + public ResponseMessage> handleMethodArgumentNotValidException( + MethodArgumentNotValidException exception) { +// logger.error(exception.getMessage(), exception); + + List validErrorList = new ArrayList<>(); + BindingResult result = exception.getBindingResult(); + for (FieldError fieldError : result.getFieldErrors()) { + validErrorList.add(new ValidError(fieldError.getField(), fieldError.getDefaultMessage())); + logger.warn("valid error: obj[{}], filed[{}], message[{}]", + fieldError.getObjectName(), + fieldError.getField(), + fieldError.getDefaultMessage()); + } + + return Result.error(ResponseMessageCodeEnum.VALID_ERROR.getCode(), "", validErrorList); + } + + @ExceptionHandler(ConstraintViolationException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + public ResponseMessage> handleConstraintViolationException( + ConstraintViolationException exception) { +// logger.error(exception.getMessage(), exception); + + List validErrorList = new ArrayList<>(); + Set> violationSet = exception.getConstraintViolations(); + for (ConstraintViolation violation : violationSet) { + validErrorList.add(new ValidError(violation.getPropertyPath().toString(), violation.getMessage())); + logger.warn("param valid error: obj[{}], filed[{}], message[{}]", + violation.getRootBeanClass(), + violation.getPropertyPath(), + violation.getMessage()); + } + + return Result.error(ResponseMessageCodeEnum.VALID_ERROR.getCode(), "", validErrorList); + } + + @ExceptionHandler(value = ValidationException.class) + public ResponseMessage validationExceptionHandling(ValidationException e) { + ResponseMessage result = Result.error(e.getMessage()); + return result; + } + + +} + + + diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java new file mode 100644 index 0000000..5718cb0 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java @@ -0,0 +1,44 @@ +package com.adc.da.main.advice; + +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authz.UnauthenticatedException; +import org.apache.shiro.authz.UnauthorizedException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.ResponseMessageCodeEnum; +import com.adc.da.util.http.Result; + +@ControllerAdvice +@Order(value=0) +public class ShiroExceptionAdvice { + + private static final Logger logger = LoggerFactory.getLogger(ShiroExceptionAdvice.class); + + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ExceptionHandler({AuthenticationException.class, UnknownAccountException.class, + UnauthenticatedException.class, IncorrectCredentialsException.class}) + @ResponseBody + public ResponseMessage unauthorized(Exception exception) { + logger.warn(exception.getMessage(), exception); + logger.info("catch UnknownAccountException"); + return Result.error(ResponseMessageCodeEnum.ERROR.getCode(), exception.getMessage()); + } + + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ExceptionHandler(UnauthorizedException.class) + @ResponseBody + public ResponseMessage unauthorized1(UnauthorizedException exception) { + logger.warn(exception.getMessage(), exception); + return Result.error(ResponseMessageCodeEnum.ERROR.getCode(), exception.getMessage()); + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/ValidExcetipnAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/ValidExcetipnAdvice.java new file mode 100644 index 0000000..995ec97 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/ValidExcetipnAdvice.java @@ -0,0 +1,25 @@ +package com.adc.da.main.advice; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * @Author doudxw + * @Date 2021/4/27 14:13 + */ +@RestControllerAdvice +@Order(1) +public class ValidExcetipnAdvice { + + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(HttpStatus.OK) + public ResponseMessage valisException(MethodArgumentNotValidException ex){ + return Result.error(ex.getBindingResult().getFieldError().getDefaultMessage()); + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/aspect/ResponseLogAspect.java b/adc-da-main/src/main/java/com/adc/da/main/aspect/ResponseLogAspect.java new file mode 100644 index 0000000..625b358 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/aspect/ResponseLogAspect.java @@ -0,0 +1,36 @@ +package com.adc.da.main.aspect; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.adc.da.util.utils.GsonUtil; + +/** + * 用于记录调用controller层返回日志 + */ +@Aspect +@Component +public class ResponseLogAspect { + private static Logger logger = LoggerFactory.getLogger(ResponseLogAspect.class); + + /** + * 匹配controller层的方法 + */ + @Pointcut(value = "(execution(* com.adc.da.*.rest.*.*(..)))") + private void controllerPointcut() { + // 切面方法 + } + + @Around(value = "controllerPointcut()") + public Object process(ProceedingJoinPoint joinPoint) throws Throwable { + Object result = joinPoint.proceed(); + logger.info("==================== 调用Controller层返回json值 ===================="); + logger.info(GsonUtil.toJson(result)); + return result; + } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource1.java b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource1.java new file mode 100644 index 0000000..ecc38de --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource1.java @@ -0,0 +1,63 @@ +//package com.adc.da.main.config.DataSource; +// +//import com.baomidou.mybatisplus.core.MybatisConfiguration; +//import com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver; +//import com.baomidou.mybatisplus.core.config.GlobalConfig; +//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; +//import org.apache.ibatis.plugin.Interceptor; +//import org.apache.ibatis.session.SqlSessionFactory; +//import org.apache.ibatis.type.JdbcType; +//import org.mybatis.spring.SqlSessionTemplate; +//import org.mybatis.spring.annotation.MapperScan; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.Primary; +//import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +//import org.springframework.jdbc.datasource.DataSourceTransactionManager; +// +//import javax.sql.DataSource; +// +///** +// * @Author doudxw +// * @Date 2022/1/5 09:19 +// * for kylin +// * 连接长安麒麟的数据源 +// */ +//@Configuration +//@ConditionalOnProperty(prefix = "datatype",name ="change",havingValue ="kylin" ) +//@MapperScan(basePackages = "com.adc.da.**.dao.kylin", sqlSessionTemplateRef = "ds1SqlSessionTemplate") +//public class DataSource1 { +// +// //ds1数据源 +// @Bean("ds1SqlSessionFactory") +// public SqlSessionFactory ds1SqlSessionFactory(@Qualifier("ds1DataSource") DataSource dataSource) throws Exception { +// MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean(); +// sqlSessionFactory.setDataSource(dataSource); +// MybatisConfiguration configuration = new MybatisConfiguration(); +// configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); +// configuration.setJdbcTypeForNull(JdbcType.NULL); +// sqlSessionFactory.setConfiguration(configuration); +// sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver(). +// getResources("classpath*:mybatis/mapper/**/kylin/**/*.xml")); +// sqlSessionFactory.setPlugins(new Interceptor[]{ +// new PaginationInterceptor() +//// .setFormat(true), +// }); +// sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false)); +// return sqlSessionFactory.getObject(); +// } +// +// @Bean(name = "ds1TransactionManager") +// public DataSourceTransactionManager ds1TransactionManager(@Qualifier("ds1DataSource") DataSource dataSource) { +// return new DataSourceTransactionManager(dataSource); +// } +// +// @Bean(name = "ds1SqlSessionTemplate") +// public SqlSessionTemplate ds1SqlSessionTemplate(@Qualifier("ds1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { +// return new SqlSessionTemplate(sqlSessionFactory); +// } +// +//} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource2.java b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource2.java new file mode 100644 index 0000000..81f8705 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSource2.java @@ -0,0 +1,61 @@ +//package com.adc.da.main.config.DataSource; +// +//import com.baomidou.mybatisplus.core.MybatisConfiguration; +//import com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver; +//import com.baomidou.mybatisplus.core.config.GlobalConfig; +//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; +//import org.apache.ibatis.plugin.Interceptor; +//import org.apache.ibatis.session.SqlSessionFactory; +//import org.apache.ibatis.type.JdbcType; +//import org.mybatis.spring.SqlSessionTemplate; +//import org.mybatis.spring.annotation.MapperScan; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.Primary; +//import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +//import org.springframework.jdbc.datasource.DataSourceTransactionManager; +// +//import javax.sql.DataSource; +// +///** +// * @Author doudxw +// * @Date 2022/1/5 09:19 +// * for mysql +// */ +//@Configuration +//@ConditionalOnProperty(prefix = "datatype",name ="change",havingValue ="kylin" ) +//@MapperScan(basePackages ={"com.adc.da.**.dao.mysql","com.adc.da.file.dao"}, sqlSessionTemplateRef = "ds2SqlSessionTemplate") +//public class DataSource2 { +// //ds2数据源 +// @Bean("ds2SqlSessionFactory") +// public SqlSessionFactory ds2SqlSessionFactory(@Qualifier("ds2DataSource") DataSource dataSource) throws Exception { +// MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean(); +// sqlSessionFactory.setDataSource(dataSource); +// MybatisConfiguration configuration = new MybatisConfiguration(); +// configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); +// configuration.setJdbcTypeForNull(JdbcType.NULL); +// sqlSessionFactory.setConfiguration(configuration); +// sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver(). +// getResources("classpath*:mybatis/mapper/**/mysql/**/*.xml")); +// sqlSessionFactory.setPlugins(new Interceptor[]{ +// new PaginationInterceptor() +//// .setFormat(true), +// }); +// sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false)); +// return sqlSessionFactory.getObject(); +// } +// +// @Primary +// @Bean(name = "ds2TransactionManager") +// public DataSourceTransactionManager ds2TransactionManager(@Qualifier("ds2DataSource") DataSource dataSource) { +// return new DataSourceTransactionManager(dataSource); +// } +// +// @Bean(name = "ds2SqlSessionTemplate") +// public SqlSessionTemplate ds2SqlSessionTemplate(@Qualifier("ds2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { +// return new SqlSessionTemplate(sqlSessionFactory); +// } +//} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSourceConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSourceConfig.java new file mode 100644 index 0000000..256b790 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DataSourceConfig.java @@ -0,0 +1,79 @@ +package com.adc.da.main.config.DataSource; + +/** + * @Author doudxw + * @Date 2022/1/5 09:26 + */ + +import com.alibaba.druid.pool.DruidDataSource; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.sql.DataSource; +import java.sql.DataTruncation; + +/** + * 多数据源配置 + */ +@Configuration +@ConditionalOnProperty(prefix = "datatype",name ="change",havingValue ="kylin" ) +public class DataSourceConfig { + + //主数据源配置 ds1数据源 +// @Primary +// @Bean(name = "ds1DataSourceProperties") +// @ConfigurationProperties(prefix = "spring.datasource.kylin") +// public DataSourceProperties ds1DataSourceProperties() { +// return new DataSourceProperties(); +// } + + //主数据源 ds1数据源 +// @Primary +// @Bean(name = "ds1DataSource") +// public DataSource ds1DataSource(@Qualifier("ds1DataSourceProperties") DataSourceProperties dataSourceProperties) { +// DataSource dataSource = dataSourceProperties.initializeDataSourceBuilder().build(); +//// HikariDataSource hikariDataSource = (HikariDataSource) dataSource; +//// hikariDataSource.setMinimumIdle(200); +//// hikariDataSource.setMaximumPoolSize(500); +// DataSource build = dataSourceProperties.initializeDataSourceBuilder().build(); +// DruidDataSource druidDataSource = new DruidDataSource(dataSourceProperties); +// druidDataSource.setInitialSize(500); +// druidDataSource.setMinIdle(500); +// druidDataSource.setMaxActive(500); +// return druidDataSource; +// } + +// @Primary +// @Bean(name = "ds1DataSource") +// public DataSource druidDataSource(@Qualifier("ds1DataSourceProperties") DataSourceProperties dataSourceProperties){ +// DruidDataSource druidDataSource = new DruidDataSource(); +// druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName()); +// druidDataSource.setUrl(dataSourceProperties.getUrl()); +// druidDataSource.setUsername(dataSourceProperties.getUsername()); +// druidDataSource.setPassword(dataSourceProperties.getPassword()); +// druidDataSource.setInitialSize(500); +// druidDataSource.setMinIdle(500); +// druidDataSource.setMaxActive(500); +// return druidDataSource; +// } +// +// //第二个ds2数据源配置 +// @Bean(name = "ds2DataSourceProperties") +// @ConfigurationProperties(prefix = "spring.datasource.mysql") +// public DataSourceProperties ds2DataSourceProperties() { +// return new DataSourceProperties(); +// } +// +// //第二个ds2数据源 +// @Bean("ds2DataSource") +// public DataSource ds2DataSource(@Qualifier("ds2DataSourceProperties") DataSourceProperties dataSourceProperties) { +// return dataSourceProperties.initializeDataSourceBuilder().build(); +// } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DruidDataSourceConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DruidDataSourceConfig.java new file mode 100644 index 0000000..dfebe55 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DataSource/DruidDataSourceConfig.java @@ -0,0 +1,43 @@ +//package com.adc.da.main.config.DataSource; +// +//import com.alibaba.druid.filter.Filter; +//import com.alibaba.druid.filter.logging.Slf4jLogFilter; +//import com.alibaba.druid.filter.stat.StatFilter; +//import com.alibaba.druid.pool.DruidDataSource; +//import com.alibaba.druid.support.http.StatViewServlet; +//import com.alibaba.druid.support.http.WebStatFilter; +//import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; +//import com.alibaba.druid.wall.WallConfig; +//import com.alibaba.druid.wall.WallFilter; +//import org.bouncycastle.pqc.math.linearalgebra.PolynomialRingGF2; +//import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.boot.context.properties.ConfigurationProperties; +//import org.springframework.boot.web.servlet.FilterRegistrationBean; +//import org.springframework.boot.web.servlet.ServletRegistrationBean; +//import org.springframework.context.EnvironmentAware; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.core.env.Environment; +//import org.springframework.jdbc.datasource.DataSourceTransactionManager; +// +//import javax.sql.DataSource; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +///** +// * @Author sima +// * @Date 2022/6/9 11:45 +// */ +////@Configuration +////@ConditionalOnProperty(prefix = "datatype",name ="change",havingValue ="mysql" ) +//public class DruidDataSourceConfig { +//// @ConfigurationProperties(prefix = "spring.datasource") +//// @Bean +//// public DataSource druidDataSource(){ +//// return new DruidDataSource(); +//// } +//} +// diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DozerConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/DozerConfig.java new file mode 100644 index 0000000..4fd147a --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DozerConfig.java @@ -0,0 +1,24 @@ +package com.adc.da.main.config; + +import java.util.Arrays; +import java.util.List; + +import org.dozer.DozerBeanMapper; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 各个模块的dozer配置文件 + */ +@Configuration +public class DozerConfig { + + @Bean(name = "org.dozer.Mapper") + public DozerBeanMapper dozer() { + List mappingFiles = Arrays.asList("dozer/dozer-mappings-sys.xml"); + DozerBeanMapper dozerBean = new DozerBeanMapper(); + dozerBean.setMappingFiles(mappingFiles); + return dozerBean; + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java new file mode 100644 index 0000000..77fff00 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java @@ -0,0 +1,39 @@ +package com.adc.da.main.config; + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +//import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * MybatisPlus配置 + */ +@Configuration +@MapperScan({"com.adc.da.**.dao","com.adc.**.dao"}) +@EnableTransactionManagement +public class MybatisPlusConfig { + + /** + * MybatisPlus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } + + /*** + * MybatisPlus的性能优化 + */ +// @Bean +// public PerformanceInterceptor performanceInterceptor() { +// PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor(); +// /* */ +// // performanceInterceptor.setMaxTime(1000); +// /* */ +// performanceInterceptor.setFormat(true); +// return performanceInterceptor; +// } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/RedisConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/RedisConfig.java new file mode 100644 index 0000000..0884256 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/RedisConfig.java @@ -0,0 +1,24 @@ +package com.adc.da.main.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; + +/** + * @Author doudxw + * @Date 2021/11/11 09:38 + */ +@Configuration +public class RedisConfig { + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate(); + template.setConnectionFactory(factory); + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); + template.setDefaultSerializer(jackson2JsonRedisSerializer); + return template; + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java new file mode 100644 index 0000000..bc3ddfe --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java @@ -0,0 +1,103 @@ +package com.adc.da.main.config; + +import com.adc.da.util.filter.CorsFilter; +import com.adc.da.util.filter.CsrfFilter; +import com.adc.da.util.filter.FakeJSessionIdFilter; +import com.adc.da.util.filter.HttpCacheFilter; +import com.adc.da.util.filter.RequestInfoFilter; +import com.adc.da.util.security.filter.TimestampFilter; +import com.adc.da.util.xss.XssFilter; +import com.adc.da.util.security.filter.NonceFilter; +import com.adc.da.util.xssshield.XssShieldFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Web配置,用于注入过滤器,拦截器等 + */ +//@Configuration +public class WebConfig { + + +// @Bean +// public FilterRegistrationBean urlFilter(){ +// FilterRegistrationBean registration = new FilterRegistrationBean(); +// registration.setFilter(new UrlFilter()); +// registration.addUrlPatterns("/home/pic/html/*"); +// registration.setName("urlFilter"); +// registration.setOrder(1); +// return registration; +// +// } + + + + /** + * xss过滤器(高标准) + */ + @Bean + public FilterRegistrationBean xssFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns("/*"); + registration.setName("xssFilter"); + registration.setOrder(10); + return registration; + } + + @Bean + public FilterRegistrationBean csrfFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new CsrfFilter()); + registration.addUrlPatterns("/*"); + registration.setName("csrfFilter"); + registration.setOrder(9); + return registration; + } + + @Bean + public FilterRegistrationBean requestInfoFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new RequestInfoFilter()); + registration.addUrlPatterns("/*"); + registration.setName("RequestInfoFilter"); + registration.setOrder(8); + return registration; + } + + @Bean + public FilterRegistrationBean corsFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new CorsFilter()); + registration.addUrlPatterns("/*"); + registration.setName("corsFilter"); + registration.setOrder(7); + return registration; + } + + @Bean + public FilterRegistrationBean httpCacheFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new HttpCacheFilter()); + registration.addUrlPatterns("/*"); + registration.setName("httpCacheFilter"); + registration.addInitParameter("maxAge", String.valueOf(60 * 60 * 24 * 7)); + registration.setOrder(6); + return registration; + } + + /** + * 防伪造jsessionid + */ + @Bean + public FilterRegistrationBean fakeJSessionIdFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new FakeJSessionIdFilter()); + registration.addUrlPatterns("/*"); + registration.setName("fakeJSessionIdFilter"); + registration.setOrder(5); + return registration; + } + +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java new file mode 100644 index 0000000..da045a1 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java @@ -0,0 +1,27 @@ +package com.adc.da.main.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @Author doudxw + * @Date 2021/6/30 14:21 + */ +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + + @Value("${picPath}") + private String picPath; + + @Value("${uploadFile}") + private String uploadFile; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + // /home/file/**为前端URL访问路径 后面 file:xxxx为本地磁盘映射 + registry.addResourceHandler(picPath+"**").addResourceLocations("file://"+uploadFile); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/schedule/ApplicationContextUtil.java b/adc-da-main/src/main/java/com/adc/da/main/schedule/ApplicationContextUtil.java new file mode 100644 index 0000000..49e4db9 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/schedule/ApplicationContextUtil.java @@ -0,0 +1,38 @@ +package com.adc.da.main.schedule; + +/** + * @Author sima + * @Date 2022/7/15 16:32 + */ + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * @Auther: sima + * @Date: 2022/7/15 16:32 + * 配置类,解决定时任务无法注入的问题 + */ +@Component +public class ApplicationContextUtil implements ApplicationContextAware { + + private static ApplicationContext applicationContext; + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + ApplicationContextUtil.applicationContext = applicationContext; + + } + + + public static Object getBean(String beanName) { + return applicationContext.getBean(beanName); + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/schedule/ScheduleUtil.java b/adc-da-main/src/main/java/com/adc/da/main/schedule/ScheduleUtil.java new file mode 100644 index 0000000..976570c --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/schedule/ScheduleUtil.java @@ -0,0 +1,29 @@ +//package com.adc.da.main.schedule; +// +//import com.adc.da.price.service.impl.CarQueryServiceImpl; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.scheduling.annotation.EnableScheduling; +//import org.springframework.scheduling.annotation.Scheduled; +//import org.springframework.stereotype.Component; +// +///** +// * @Author sima +// * @Date 2022/7/15 16:32 +// */ +//@Component +//@EnableScheduling +//@Slf4j +//public class ScheduleUtil { +// +// +// @Scheduled(cron = "0 0 0 * * ?") +//// @Scheduled(cron = "0 */1 * * * ?") +// public void updateCarQuery() { +// log.debug("开始更新查询表--------------***************--------------"); +// CarQueryServiceImpl carQueryService= (CarQueryServiceImpl) ApplicationContextUtil.getBean("carQueryServiceImpl"); +// carQueryService.insert(); +//// System.out.println(carQueryService); +// log.debug("查询表更新完成--------------***************--------------"); +// +// } +//} diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties new file mode 100644 index 0000000..7898e80 --- /dev/null +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -0,0 +1,133 @@ +#Development System +#spring.datasource.driverClassName = oracle.jdbc.OracleDriver +#spring.datasource.url = jdbc:oracle:thin:@//60.247.58.117:50011/ADC +##spring.datasource.username = ADC_PLATFORM +##spring.datasource.password = ADC_PLATFORM + +#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.136:19290/ADC +#spring.datasource.username = EPR +#spring.datasource.password = EPR + +#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.103:19290/ADC +#spring.datasource.username = EPR_TEST +#spring.datasource.password = EPR_TEST + +#spring.datasource.driverClassName = com.mysql.jdbc.Driver +#spring.datasource.url = jdbc:mysql://192.168.144.124:3306/cadata2?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#spring.datasource.username = adc_forecast +#spring.datasource.password = adc_forecast + + +#kylin数据库 ds1 +#spring.datasource.kylin.name=PROJECT_MI +#spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver +#spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI +#spring.datasource.kylin.username=64459 +#spring.datasource.kylin.password=ichangan_ps9 +##10s +#spring.datasource.kylin.maxWaitTime=10000 +#spring.datasource.kylin.poolSize=10 +# +##mysql数据库 ds2 +#spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver +#spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#spring.datasource.mysql.username = root +#spring.datasource.mysql.password = root + +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver +spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai +spring.datasource.username = root +spring.datasource.password = hzwlsoft.com + +#后端端口 +server.port=7060 + +#验证码后台模式,默认为1:1为不开启,2为开启,3为输错 用户名或密码 ${maxLoginErrorCount} 次 才开启 +verifyCodeMode=3 +#仅当验证码模式 ${verifyCodeMode} 为 3时生效,设置错误登录出现验证码的阈值,默认为3 +maxLoginErrorCount=3 + +#密码Base64加密开关,true为开启,false为关闭 +isPassEncrypted=true +#{ +#"password": "YWJjMTIz", +#"username": "YWRtaW4x" +#} +#swagger 显示api,1为只显示${restPath:/api}前缀的api,0为显示所有api,其他为不显示api +swaggerLevel=0 + + +#uploadFile=/EPR/file/EPR/test/ +# +#picPath=/EPR/file/home/pic/ + +# 本地存储文件的磁盘地址 +uploadFile=D:\\work\\idea\\changan\\ +# 本地文件访问的url地址 +picPath=/api/home/pic/ + + +serverIp=http://127.0.0.1:7060/ + + +#MAIL_SMTP =smtp.163.com +#MAIL_SMTP_PORT=465 +#MAIL_USERNAME=cagds@catarc.ac.cn +#MAIL_PASSWORD=Cagds9760 + +MAIL_SMTP =smtp.163.com +MAIL_SMTP_PORT=465 +MAIL_USERNAME=simashihao@163.com +MAIL_PASSWORD=VQBNNQBLDIALAYCV + +#MAIL_SMTP =cmp.changan.com +#MAIL_SMTP_PORT=25 +MAIL_POP_PORT=110 +#MAIL_USERNAME=64459@Any3.com +#MAIL_PASSWORD=65316975Xiaoq + + + + + + +IPANDPORT=http://localhost:7061/ + +#redis +#Redis服务器地址 +spring.redis.host=192.168.144.29 +#spring.redis.host=localhost +## Redis服务器连接端口 +spring.redis.port=6379 +## Redis服务器连接密码(默认为空) +spring.redis.password=123321 +## 连接超时时间(毫秒) +spring.redis.timeout=200000ms +## 连接池中的最大空闲连接,默认值是8。 +spring.redis.jedis.pool.max-idle=50 +##连接池中的最小空闲连接,默认值是0。 +spring.redis.jedis.pool.min-idle=10 +## 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。 +spring.redis.jedis.pool.max-active=2000 +## 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException +spring.redis.jedis.pool.max-wait=2000ms + +spring.redis.database=6 + + +# ======= 阿里OSS配置 ========= +aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com +aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 +aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC +aliyun.OSS.bucketName=qqxexamplebucket +aliyun.OSS.fileMaxSize=10 #文件上传最大M数 + +logging.level.com.adc: debug + + +# ======= ddm权限接口 集成 ========= +ddm-identity=changan_test +ddm-company=9 +ddm-ras-public-key= + + diff --git a/adc-da-main/src/main/resources/application.properties b/adc-da-main/src/main/resources/application.properties new file mode 100644 index 0000000..593d808 --- /dev/null +++ b/adc-da-main/src/main/resources/application.properties @@ -0,0 +1,117 @@ +spring.profiles.active=dev + +############################################### +#公共配置部分 +############################################## +# =============================== +# = DATA SOURCE +# =============================== +spring.datasource.type = com.alibaba.druid.pool.DruidDataSource +# 下面为连接池的补充设置,应用到上面所有数据源中 +# 初始化大小,最小,最大 +spring.datasource.initialSize = 500 +spring.datasource.minIdle = 500 +spring.datasource.maxActive = 500 +# 配置获取连接等待超时的时间 +spring.datasource.maxWait = 60000 +# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 +spring.datasource.timeBetweenEvictionRunsMillis = 30000 +# 配置一个连接在池中最小生存的时间,单位是毫秒 +spring.datasource.minEvictableIdleTimeMillis = 100000 +spring.datasource.validationQuery= 'SELECT 1 FROM DUAL' +spring.datasource.testWhileIdle = true +spring.datasource.testOnBorrow = false +spring.datasource.testOnReturn = false +# 打开PSCache,并且指定每个连接上PSCache的大小 +spring.datasource.poolPreparedStatements = true +spring.datasource.maxPoolPreparedStatementPerConnectionSize = 20 +# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 +spring.datasource.filters = stat,wall,log4j +# 通过connectProperties属性来打开mergeSql功能;慢SQL记录 +#spring.datasource.connectionProperties = 'druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000' +# 合并多个DruidDataSource的监控数据 +#useGlobalDataSourceStat: true +spring.datasource.mergeSql=true +spring.datasource.slowSqlMillis=1 +spring.datasource.logSlowSql=true +# =============================== +#默认关闭SpringBootActuator +endpoints.enabled=false +# http-only +server.servlet.session.cookie.http-only=true + +# mybatis_config +mybatis-plus.config-locations=classpath:mybatis/mybatis-config.xml +mybatis-plus.mapper-locations=classpath*:mybatis/mapper/**/mysql/**/*.xml + +#显示sql +logging.level.com.adc=debug +logging.level.org.hibernate=info +logging.level.org.springframework=info + +adminPath=/library/a +restPath=/library/api +portalPath=/library/portalSystem + +#是否使用rsa非对称加密(adc-ad-login:2.3.3-SNAPSHOT支持) 使用时,请设置 isPassEncrypted=false +isPassEncrypted=true +useRSALogin=true +#请您执行main模块下test包com.adc.da.rsa.RSATest 的测试方法 生成公钥及私钥,并由公钥前端加密(前端建议使用 jsencrypt工具包),后端配置useRSALogin=true开启加密,并且将生成的私钥配置到RAS_PRI_KEY +RAS_PRI_KEY=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAq1I/fLYOTKgNCwUavqyfixosEXByKMQ9axZDUefPywi+ftXdPI2tJ6x/7uc+CdST0a3/toqxdSRjrsHMwnnGQQIDAQABAkB5ZPBDiCUdwD5tvpIy5dKvGD59pPXfWR5EESRmlyGwNTlJ/fIV1wL7UsRYoFslAEcHLyKY7kX8wIefqw2k9R8hAiEA6mH2xls2BZ6nftz6aA8V6CSrsZ49qO9l6SPirXrxg0UCIQC7H1WXLHEV65PUaMTNvzuLc43xkac9DZX4FpUXDeuIzQIgXghhjiEH4mdNgas8V0U+H72emIsI597r/wYjqj/55xUCIDATfuQWUP+2xQZ/3ICYL25GxCNarsMq6GsTMj74HpnJAiAb6BqTkVklIMsl2lAZbE49fluSm3YLt4eNnVVdzJkpFg== +#{ +#"password": "SN/qCzazttK/kzezk+bMo/b/aZP0Mqfpl66hj24p2oayZs3/vDmv7MM9+451I5FTaq2jq/EbOxIjiK2zLAiZ5w==", +#"username": "SC/dfdsf/kzezk+fd/b/fdf/vDmv7MM9+fd/fds==" +#} +#useRSALogin= +#RAS_PRI_KEY= + +# file模块上传文件的服务器地址 +file.path=/Users/sxh/uploadFiles + +# ppt图片保存的路径 +file.pptPath=/pptImg + +# file模块上传文件大小限制 +spring.servlet.multipart.max-request-size=100MB +spring.servlet.multipart.max-file-size=100MB + +# 系统日志类别dev:开发模式不拦截方法记日志, custom:客户自定义需要拦截记日志的方法, sys:系统原设需要拦截记日志的方法 +sysLogType=dev + +#rabbitMQ +spring.rabbitmq.host=192.168.1.219 +spring.rabbitmq.port=5672 +spring.rabbitmq.username=guest +spring.rabbitmq.password=guest +spring.rabbitmq.publisher-confirms=true + +#redis +# Redis服务器地址 +spring.redis.host=221.239.111.146 +# Redis服务器连接端口 +spring.redis.port=15777 +# Redis服务器连接密码(默认为空) +spring.redis.password=cvdecs + +#线程池 +core.pool.size=10 +max.pool.size=30 +keep.alive.seconds=60 +queue.capacity=8 + + +mybatis-plus.configuration.map-underscore-to-camel-case=true + +modelpath=/EPR/file/template/eprmodel.docx + +wordurl=http://localhost:8333/word/make + +#datatype.change=kylin +#datatype.change=mysql + +#elastic search +#clusterName=elasticsearch +#clusterNodes=10.10.0.3:9300 + + + diff --git a/adc-da-main/src/main/resources/banner.txt b/adc-da-main/src/main/resources/banner.txt new file mode 100644 index 0000000..a4f9a52 --- /dev/null +++ b/adc-da-main/src/main/resources/banner.txt @@ -0,0 +1,9 @@ +${AnsiColor.RED} _ _ + __ _ __| | ___ __| | __ _ + / _` |/ _` |/ __|____ / _` |/ _` | + | (_| | (_| | (_|_____| (_| | (_| | + \__,_|\__,_|\___| \__,_|\__,_| + +${AnsiColor.YELLOW}------------------------------------------------ +${AnsiColor.YELLOW} :: ${AnsiColor.YELLOW}@数据资源中心 +${AnsiColor.YELLOW}------------------------------------------------${AnsiColor.WHITE} \ No newline at end of file diff --git a/adc-da-main/src/main/resources/cache/ehcache-hibernate-local.xml b/adc-da-main/src/main/resources/cache/ehcache-hibernate-local.xml new file mode 100644 index 0000000..9695429 --- /dev/null +++ b/adc-da-main/src/main/resources/cache/ehcache-hibernate-local.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/src/main/resources/cache/ehcache-hibernate-rmi.xml b/adc-da-main/src/main/resources/cache/ehcache-hibernate-rmi.xml new file mode 100644 index 0000000..9be764f --- /dev/null +++ b/adc-da-main/src/main/resources/cache/ehcache-hibernate-rmi.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/src/main/resources/cache/ehcache-local.xml b/adc-da-main/src/main/resources/cache/ehcache-local.xml new file mode 100644 index 0000000..852899e --- /dev/null +++ b/adc-da-main/src/main/resources/cache/ehcache-local.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/src/main/resources/cache/ehcache-rmi.xml b/adc-da-main/src/main/resources/cache/ehcache-rmi.xml new file mode 100644 index 0000000..3d0e04b --- /dev/null +++ b/adc-da-main/src/main/resources/cache/ehcache-rmi.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/src/main/resources/config/application.yml b/adc-da-main/src/main/resources/config/application.yml new file mode 100644 index 0000000..e69de29 diff --git a/adc-da-main/src/main/resources/gen/config.properties b/adc-da-main/src/main/resources/gen/config.properties new file mode 100644 index 0000000..760785a --- /dev/null +++ b/adc-da-main/src/main/resources/gen/config.properties @@ -0,0 +1,44 @@ +#define code path +source_root_package=src/main/java +resources_root_package=src/main/resources +test_root_package=src/test/java +webroot_package=src/app + +#define project +core_project=/adc-da-configuration +#client_project=/data-cloud-report/ui +client_project=.. + +rest_project=/adc-da-configuration + +#define base class package +base_class_package=com.adc.da.base + +#bussi_package[User defined] +biz_package=com.adc.da +biz_app_package=admin + + + +#ftl resource url +template_path=template +system_encoding=utf-8 + +#Search Param num [User defined] +table_id=id +search_filed_num=1 + +#table_prefix=TD_DC_VISUAL_,TD_DC_,dict_,UM_,TD_ +table_prefix=TS_,TR_,T,dmk. + +#PageType 1: mapper_xml, 2: dao, 3: service, 4: rest, 5: javascript, 6: html + +page_gen_type=1,2,3,4 + + + +#Not Used +mapper_xml_only=false +backend_only=true +entity_open_type=dialog +entity_save_type=form diff --git a/adc-da-main/src/main/resources/gen/database.properties b/adc-da-main/src/main/resources/gen/database.properties new file mode 100644 index 0000000..72df0dc --- /dev/null +++ b/adc-da-main/src/main/resources/gen/database.properties @@ -0,0 +1,30 @@ +#mysql +#----------------------------- mysql ------------------------------------------ +#diver_name=com.mysql.jdbc.Driver +#url=jdbc:mysql://localhost:3306/adc_platform?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#username=root +#password=root +#database_name=adc_platform + + +#oracle +#----------------------------- oracle ------------------------------------------ +#diver_name=oracle.jdbc.driver.OracleDriver +#url=jdbc:oracle:thin:@60.247.58.117:50011/ADC +#username=ADC_PLATFORM +#password=ADC_PLATFORM +#database_name=adc_platform + +diver_name = com.mysql.jdbc.Driver +url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +username = root +password = root +database_name=cadata + +#ldap +#----------------------------- LDAP ------------------------------------------ +ldap.connection.url=ldap://localhost:10389 +ldap.connection.base=dc=wlt,dc=com +ldap.connection.username=uid=admin,ou=system +ldap.connection.password=12345678 +ldap.schema.cn=um diff --git a/adc-da-main/src/main/resources/logback-spring.xml b/adc-da-main/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..a76dcef --- /dev/null +++ b/adc-da-main/src/main/resources/logback-spring.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + + + + + INFO + + ACCEPT + + ACCEPT + + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_all.%d{yyyy-MM-dd}.%i.log + + 7 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + ERROR + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_error.%d{yyyy-MM-dd}.%i.log + + 30 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + INFO + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_info.%d{yyyy-MM-dd}.%i.log + + 15 + + 50MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + WARN + + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_warn.%d{yyyy-MM-dd}.%i.log + + 30 + + 50MB + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/src/main/resources/logo/logo_white.png b/adc-da-main/src/main/resources/logo/logo_white.png new file mode 100644 index 0000000..e744da1 Binary files /dev/null and b/adc-da-main/src/main/resources/logo/logo_white.png differ diff --git a/adc-da-main/src/main/resources/mybatis/mybatis-config.xml b/adc-da-main/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e041bc2 --- /dev/null +++ b/adc-da-main/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/src/main/resources/py4j/py4j.dic b/adc-da-main/src/main/resources/py4j/py4j.dic new file mode 100644 index 0000000..9198324 --- /dev/null +++ b/adc-da-main/src/main/resources/py4j/py4j.dic @@ -0,0 +1,297 @@ +a#阿 +ao#拗口/违拗/拗断/执拗/拗口/拗口风/拗口令/拗曲/拗性/拗折/警拗 +ai#艾 +bang#膀/磅/蚌 +ba#扒 +bai#叔伯/百/柏杨/㧳/梵呗/呗佛/呗音/呗唱/呗偈/呗声/呗赞/赞呗 +bao#剥皮/薄/暴/堡/曝 +bei#呗 +beng#蚌埠 +bi#复辟/臂/秘鲁/泌阳 +bing#屏息/屏弃/屏气/屏除/屏声 +bian#扁/便/便宜坊 +bo#薄荷/单薄/伯/泊/波/柏/萝卜/孛 +bu#卜/柨 +can#参 +cang#藏/欌 +cen#参差 +ceng#曾/噌 +cha#差/刹那/宝刹/一刹/查/碴/喳喳/喀喳 +chai#公差/差役/专差/官差/听差/美差/办差/差事/差使/肥差/当差/钦差/苦差/出差 +chan#颤/单于/禅 +chang#长/厂 +chao#朝/嘲/焯 +che#工尺/车 +chen#称职/匀称/称心/相称/对称 +cheng#称/乘/澄/噌吰/橙 秤/盛满/盛器/盛饭 +chu#畜 +chui#椎心 +chuai#揣 +chuan#传 +chi#匙/尺/吃 +chong#重庆/重重/虫 +chou#臭/帱 +chuang#经幢 +chuo#绰 +ci#参差/鳞差/伺候/龟兹 +cuan#攒聚/攒动/攒集/攒宫/攒所 +cuo#撮儿/撮要/撮合 +da#大/嗒 +dao#叨/帱载/帱察 +dai#大夫 +dan#单/弹/掸/澹 +dang#铛 +de#的/得 +di#堤/底/怎的/有的/目的/标的/打的/的确/有的放/的卢/矢之的/言中的/语中的/的士/地/提防/快的/美的 +diao#蓝调/调调/音调/论调/格调/调令/低调/笔调/基调/强调/声调/滥调/老调/色调/单调/腔调/跑调/曲调/步调/语调/主调/情调 +ding#丁 +du#读/都/度 +dou#全都/句读 +duo#舵/测度/忖度/揣度/猜度 +dun#粮囤/盾/顿/沌/敦 +e#阿谀/阿胶/阿弥/恶/擜 +er#儿 +fan#番 +feng#冯 +fei#婔 +fo#佛 +fu#仿佛/果脯/罘/莩 +fou#否 +fiao#覅 +ga#咖喱/伽马/嘎/戛纳 +gai#盖 +gao#告 +gang#扛鼎 +ge#革/蛤蚧/文蛤/蛤蜊/咯 +gei#给 +geng#脖颈 +gong#女红/共 +gu#谷/中鹄/鼓 +gui#龟/柜/硅/倭傀/傀异/傀然/傀垒/傀怪/傀卓/傀奇/傀伟/傀民/傀俄/琦傀/奇傀 +gua#呱 +guan#纶巾/东莞 +guang#广 +ha#蛤/哈/虾蟆 +hai#还/嗨/咳声/咳笑 +hao#貉子/貉绒 +hang#夯/总行/分行/支行/行业/排行/行情/央行/商行/外行/银行/中行/交行/招行/农行/工行/建行/商行/酒行/麻行/琴行/行业/同行/行列/行货/行会/行家/巷道/引吭/扼吭/批吭/搤吭/高吭/喉吭/咔吭/絶吭/吭嗌/吭咽/吭首 +he#和/合/核/鶴/猲 +heng#道行/涥 +hu#鹄/水浒/嗀/唬 +hua#滑/呚/椛 +huan#归还/放还/奉还/圜 +hui#会/浍河/媈/灳/哕/瑗珲 +hong#红/虹 +huo#软和/热和/暖和 +hun#尡/珲 +ji#病革/给养/自给/给水/薪给/给予/供给/稽/缉/藉/奇数/亟/诘屈/荠菜/愱 +jia#雪茄/伽/家/价/贾/戛 +jian#见/浅浅 +jiang#降 +jiao#嚼舌/嚼字/嚼蜡/角/剿/饺/脚/蕉/矫/睡觉/侥/校对/校验/校正/校准/审校/校场/校核/校勘/校订/校阅/校样 +jie#解/慰藉/蕴藉/诘/媘/煯 +jin#矜/劲/禁 +jing#颈/景/强劲/劲风/劲旅/劲敌/劲射/苍劲/遒劲/劲草 +jiong#炅 +ju#咀/居/桔/句/婮 +jun#均 +juan#棚圈/圈养/猪圈/羊圈 +jue#主角/角色/旦角/女角/丑角/角力/名角/配角/嚼/觉/䏐 +jun#龟裂/俊 +ka#咖/卡/喀 +kai#楷 +kang#扛 +ke#咳/壳 +keng#吭 +kuai#会计/财会/浍 +kui#傀 +kuo#括 +la#癞痢/腊/蜡 +lai#癞疮/癞子/癞蛤/癞皮 +lao#积潦/络子/落枕/落价/粩/姥 +le#乐/勒/了 +lei#勒紧 +lo#然咯 +lou#佝偻/泄露/露面/露脸/露骨/露底/露馅/露一手/露相/露马脚/露怯 +long#里弄/弄堂/泷 +li#跞/礼/櫔/栃 +liao#了解/了结/明了/了得/末了/未了/了如/潦/撩 +liang#靓/俩 +lie#挘 +lin#崊 +ling#霗/令 +liu#六/遛 +lu#碌/陆/露 +luo#络/落/漯/囖/洜/泺 +lv#率/绿 +lve#鋢/稤 +lun#纶 +ma#嫲/抹布/抹脸/抹桌子/摩挲 +mai#埋 +man#埋怨/蔓 +mai#脉 +mang#氓/芒 +mao#冒 +me#嚒 +men#椚 +meng#群氓/盟/癦 +mei#没/旀 +mo#淹没/没收/出没/沉没/没落/吞没/覆没/没入/埋没/鬼没/隐没/湮没/辱没/脉脉/模/摩/抹 +mou#绸缪/牟 +mi#秘/泌尿/分泌/谜/檷枸 +mian#渑 +ming#掵 +miu#谬/谬论/纰缪 +mu#大模/字模/模板/模样/模具/装模/模子/牟尼/子牟/夷牟/悬牟/相牟/头牟/宾牟/曹牟/岑牟/兜牟/卢牟/弥牟/牟食/牟槊/牟衫/牟光/牟牟/牟甲 +na#哪/娜/那 +nao#臑 +nan#南 +ne#哪吒/呢 +nei#氞 +neus#莻 +nong#弄/燶 +ni#毛呢/花呢/呢绒/线呢/呢料/呢子/呢喃/溺/檷 +niao#尿/鸟/便溺 +nian#粘膜/粘度/粘土/粘合剂/粘液/粘稠/粘合/粘着/粘结/粘性/粘附/不粘锅/粘糊/粘虫/粘聚/粘滞/焾/哖 +niang#酿 +nin#脌 +ning#倿/拧 +niu#拗/汼 +nu#努 +nuo#婀娜/袅娜/喏 +nv#女 +nve#疟/硸 +o#喔/筽 +ou#膒 +pa#扒手/扒窃/扒外/扒分/扒糕/扒灰/扒犁/扒龙/扒搂/扒山虎/扒艇 +pai#派/迫击/迫击炮 +pao#刨/炮/萢 +pan#番禺 +pang#胖/膀/磅 +pei#蓜 +pi#辟/否极/臧否/龙陂/芘 +pian#扁舟/便宜/魸 +piao#朴姓/饿莩/饥莩/葭莩 +pin#穦 +ping#屏/苹/冯河 +po#湖泊/血泊 /迫/朴刀/坡/陂 +pu#一曝十寒/里堡/十里堡/脯/朴/曝晒/瀑/埔 +qi#期/其/泣/祇 +qiu#龟兹/湭 +qi#稽首/缉鞋/栖/奇/漆/齐 +qia#卡脖/卡子/关卡/卡壳/哨卡/边卡/发卡/峠 +qiao#雀盲/雀子/地壳/甲壳/躯壳 +qian#纤/乾/浅 +qiang#强/㛨/㩖/䅚/䵁 +qie#茄/趔趄/聺/籡 +qin#亲/沁 +qing#干亲/亲家 +qiong#熍 +qu#区/趣/爠 +quan#圈/券 +que#雀/炔 +re#声喏/唱喏 +rong#嬫 +ruo#若/嵶 +saeng#栍 +sang#槡 +sai#塞/嘥 +sao#螦 +se#堵塞/搪塞/茅塞/闭塞/鼻塞/梗塞/阻塞/淤塞/拥塞/哽塞/色 +sha#莎/刹车/急刹/厦/杉木/杉篙 +shai#色子 +shao#勺/红苕 +shan#姓单/单县/杉/敾/禅让/受禅/禅变/禅代/禅诰 +shang#衣裳 +she#拾级/折本/射/蛇 +shen#沙参/野参/参王/人参/红参/丹参/山参/海参/鹿参/什么/身/沈/桑椹/食椹/烂椹/木椹 +sheng#野乘/千乘/史乘/省/晟/盛/陹/渑水 +shi#钥匙/什/识/似的/食/石/氏/拾/适/瑡 +shiwa#瓧 +shuai#表率/率性/率直/率真/粗率/率领/轻率/直率/草率/大率/坦率/衰 +shuang#泷水/鏯 +shu#属/数/术/熟 +shui#游说 +shuo#数见/说 +si#伺/似/思 +sou#蓃/摗 +su#宿/鯂 +sui#尿泡 +ta#拓片/拓印/拓本/拓墨/拓写/拓手/拓工/碑拓/疲沓/拖沓/杂沓/沓/塔/鸿塔 +tang#汤/镗 +tao#陶 +tan#反弹/弹性/弹簧/弹力/弹奏/弹跳/弹指/弹劾/弹唱/弹射/弹性体/吹弹/评弹/乱弹琴/弹压/弹指/弹簧/弹冠/弹雀/弹雀/弹丝/弹丸/澹台 +te#脦 +teng#虅 +ti#提/体 +tiao#调/苕 +ting#町/听 +tong#通 +tu#迌 +tuan#湪 +tui#褪 +tuo#拓/袥 +tun#囤/屯 +wei#尾/蔚/圩堤/圩垸/圩田/圩子/赶圩/歌圩 +weng#攚 +wu#无/可恶/交恶/好恶/厌恶/憎恶/嫌恶/痛恶/深恶/兀 +wan#藤蔓/枝蔓/根蔓/蔓草/瓜蔓/蔓儿/莞/万/百万/皖 +wang#亡 +wai#崴 +xia#虾/吓/夏/厦门/厦大/唬杀 +xi#栖/系/蹊/洗/溪/戏/焁/铣/褶衣/褶裤 +xiao#校/切削/削面/刀削/刮削 +xian#纤细/光纤/纤巧/纤柔/纤小/纤维/纤瘦/纤纤/化纤/纤秀/棉纤/纤尘/铣铁/金铣 +xiang#投降/巷 +xie#解数/出血/采血/换血/血糊/尿血/淤血/放血/血晕/血淋/便血/吐血/咯血/叶韵/蝎/蝎子/邪/猲猲 +xin#嬜/邤 +xiu#铜臭/乳臭/成宿/星宿/璓 +xin#馨/信/鸿信 +xing#深省/省视/内省/不省人事/省悟/省察/行/荥 +xiong#匂 +xu#牧畜/畜产/畜牧/畜养/并畜/畜锐/吁/圩/浒 +xuan#箮 +xue#削/血/樰 +xun#荨/寻 +ya#琊 +yao#钥/耀/曜/佋侥/侥觎/侥僺/侥利/侥傒/侥觊/侥会/侥滥/侥望/侥求/侥竞/侥薄/侥躐/侥取/侥奇/侥忝/侥速/侥冀/侥冒/疟子 +yan#咽/殷红/朱殷/腌/烟/曕 +ye#液/抽咽/哽咽/咽炎/呜咽/幽咽/悲咽/叶/葉/璍/潱/拽步/拽扶/拽扎 +yi#自艾/遗/屹/嬄/噫 +yin#殷/栶 +ying#荥经/緓/灜 +yo#杭育 +yong#涌/硧 +you#牗 +yu#余/呼吁/吁请/吁求/育/熨帖/熨烫/於 +yuan#员/茒/圜丘 +yun#熨 +yue#约/乐音/器乐/乐律/乐章/音乐/乐理/民乐/乐队/声乐/奏乐/弦乐/乐坛/管乐/配乐/乐曲/乐谱/锁钥/密钥/乐团/乐器/嬳/咽哕/唾哕/发哕/干哕/哕吐/哕饭/哕呕/哕息/哕厥/哕噫/哕逆/哕咽/哕骂/哕心/哕喈/口哕/呕哕 +za#绑扎/结扎/包扎/捆扎/咱家 +zan#攒/咱 +zang#宝藏/藏历/藏文/藏语/藏青/藏族/藏医/藏药/藏蓝/西藏 +zai#牛仔/龟仔/龙仔/鼻仔/羊仔/仔仔/麻仔/麵包仔/麦旺仔/鸿仔/煲仔/福仔/畠 +zao#栆 +ze#择 +zeng#曾国藩/曾孙/曾祖父/曾祖/曾祖母/曾孙女/曾巩/囎/缯 +zong#综/繌 +zha#扎/柞狭/柞薪/柞子/柞鄂/柞叶/柞撒/槱柞/一柞/五柞宫/五柞/雠柞/芟柞/蜡祭/喳 +zhai#宅/夈/择席/择菜 +zhan#粘 +zhang#列车长/行长/村长/镇长/乡长/区长/县长/市长/省长/会长/班长/排长/连长/营长/团长/旅长/师长/军长/委员长/局长/厅长/所长/部长/组长/生长/长大/长高/长个/ +zhao#朝朝/明朝/朝晖/朝夕/朝思/今朝/朝气/朝三/朝秦/朝霞/鹰爪/龙爪/魔爪/爪牙/着急/着迷/着火/怎么着/正着/着凉/一着/犯不着/着数/这么着/犯得着/着慌/着忙/数得着/龙爪槐/嘲哳/嘲惹 +zhe#折/着/褶 +zhen#殝/椹 +zhi#标识/吱/殖/枝/方祇/后祇/皇祇/黄祇/皇地祇/金祇/祇树/月氏 +zhong#重/种 +zhou#粥 +zhu#属意/著/駯 +zhua#爪子 +zhuai#拽 +zhuan#芈月传/外传/传记/自传/正传/小传/评传/传略/别传 +zhui#椎/隹 +zhuo#执著/着装/着落/着意/着力/附着/着笔/胶着/着实/衣着/着眼/着想/着重/穿着/执着/着墨/着实/沉着/着陆/着想/着色/焯见/焯烁/辉焯 +zhuang#幢房/一幢/幢楼/庒 +zi#仔/兹 +zu#足 +zuo#柞/穝 \ No newline at end of file diff --git a/adc-da-main/src/main/resources/white/csrfWhite.txt b/adc-da-main/src/main/resources/white/csrfWhite.txt new file mode 100644 index 0000000..27c2916 --- /dev/null +++ b/adc-da-main/src/main/resources/white/csrfWhite.txt @@ -0,0 +1,3 @@ +127.0.0.1 +localhost +index.html \ No newline at end of file diff --git a/adc-da-main/src/main/resources/white/uploadWhite.txt b/adc-da-main/src/main/resources/white/uploadWhite.txt new file mode 100644 index 0000000..fd4a3ae --- /dev/null +++ b/adc-da-main/src/main/resources/white/uploadWhite.txt @@ -0,0 +1,12 @@ +pdf +doc +docx +xlsx +xls +zip +rar +jpg +jpge +png +gif +ppt \ No newline at end of file diff --git a/adc-da-main/src/main/resources/white/xssWhite.txt b/adc-da-main/src/main/resources/white/xssWhite.txt new file mode 100644 index 0000000..b724e4d --- /dev/null +++ b/adc-da-main/src/main/resources/white/xssWhite.txt @@ -0,0 +1 @@ +/upload/ \ No newline at end of file diff --git a/adc-da-main/src/main/webapp/WEB-INF/web.xml.bak b/adc-da-main/src/main/webapp/WEB-INF/web.xml.bak new file mode 100644 index 0000000..738eaf1 --- /dev/null +++ b/adc-da-main/src/main/webapp/WEB-INF/web.xml.bak @@ -0,0 +1,50 @@ + + + Archetype Created Web Application + + + org.springframework.web.context.request.RequestContextListener + + + + + SpringEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + forceEncoding + true + + + + + SpringEncodingFilter + /* + + + + + + + + webAppRootKey + springmvc.root + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + index.html + + + diff --git a/adc-da-main/src/test/java/com/adc/da/doc/DocGenerate.java b/adc-da-main/src/test/java/com/adc/da/doc/DocGenerate.java new file mode 100644 index 0000000..60c5abb --- /dev/null +++ b/adc-da-main/src/test/java/com/adc/da/doc/DocGenerate.java @@ -0,0 +1,38 @@ +package com.adc.da.doc; + +import io.github.swagger2markup.GroupBy; +import io.github.swagger2markup.Language; +import io.github.swagger2markup.Swagger2MarkupConfig; +import io.github.swagger2markup.Swagger2MarkupConverter; +import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder; +import io.github.swagger2markup.markup.builder.MarkupLanguage; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.net.URL; +import java.nio.file.Paths; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +public class DocGenerate { + + @Test + public void generateDocs() throws Exception { + + Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder() + .withMarkupLanguage(MarkupLanguage.MARKDOWN) +// .withMarkupLanguage(MarkupLanguage.ASCIIDOC) + .withOutputLanguage(Language.ZH) + .withPathsGroupedBy(GroupBy.TAGS) + .withGeneratedExamples() + .withoutInlineSchema() + .build(); + + Swagger2MarkupConverter.from(new URL("http://localhost:8080/v2/api-docs")) + .withConfig(config) + .build() + .toFile(Paths.get("./docs/api")); + } +} \ No newline at end of file diff --git a/adc-da-main/src/test/java/com/adc/da/gen/CodeUtil.java b/adc-da-main/src/test/java/com/adc/da/gen/CodeUtil.java new file mode 100644 index 0000000..b3bb9dc --- /dev/null +++ b/adc-da-main/src/test/java/com/adc/da/gen/CodeUtil.java @@ -0,0 +1,76 @@ +package com.adc.da.gen; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import com.codemagic.DbCodeGenerateFactory; + +public class CodeUtil { + + public CodeUtil() {} + + public static void main(String args[]) { + + String entityPackage; + + + + entityPackage = "configuration"; + + DbCodeGenerateFactory.codeGenerate("dmk.dmk_mi_wide_table_configuration", entityPackage); + DbCodeGenerateFactory.codeGenerate("dmk.dmk_mi_wide_table_configuration", entityPackage); +// DbCodeGenerateFactory.codeGenerate("TS_ROLE", entityPackage); +// DbCodeGenerateFactory.codeGenerate("TS_MENU", entityPackage); + +// testOracle(); + } + + + public static void testOracle() + { + Connection con = null;// 创建一个数据库连接 + PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Statement + ResultSet result = null;// 创建一个结果集对象 + try + { + Class.forName("oracle.jdbc.driver.OracleDriver");// 加载Oracle驱动程序 + System.out.println("开始尝试连接数据库!"); + String url = "jdbc:oracle:thin:@//192.168.5.171:1521/orcl";// 127.0.0.1是本机地址,XE是精简版Oracle的默认数据库名 + String user = "adcepis_test";// 用户名,系统默认的账户名 + String password = "adcepis_test";// 你安装时选设置的密码 + con = DriverManager.getConnection(url, user, password);// 获取连接 + System.out.println("连接成功!"); + String sql = "select * from TEST";// 预编译语句,“?”代表参数 + pre = con.prepareStatement(sql);// 实例化预编译语句 + result = pre.executeQuery();// 执行查询,注意括号中不需要再加参数 + while (result.next()) + // 当结果集不为空时 + System.out.println("学号:" + result.getInt("id") ); + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + // 逐一将上面的几个对象关闭,因为不关闭的话会影响性能、并且占用资源 + // 注意关闭的顺序,最后使用的最先关闭 + if (result != null) + result.close(); + if (pre != null) + pre.close(); + if (con != null) + con.close(); + System.out.println("数据库连接已关闭!"); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } +} diff --git a/adc-da-main/src/test/java/com/adc/da/mp/CodeGenerator.java b/adc-da-main/src/test/java/com/adc/da/mp/CodeGenerator.java new file mode 100644 index 0000000..67c12ab --- /dev/null +++ b/adc-da-main/src/test/java/com/adc/da/mp/CodeGenerator.java @@ -0,0 +1,198 @@ +package com.adc.da.mp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class CodeGenerator { + + private static String moduleName = "demo"; //模块名称 + private static String author = "Alex"; //作者 + private static String projectPath = "D:\\workspace\\workspace_adc-da-components\\adc-da-demo"; //代码生成路径 + private static String[] tableNames = new String[] {"TS_TEST"}; //需要生成代码的数据库表名 + private static String[] tablePrefix = new String[] { "TR_", "TS_", "V_" }; //表前缀 + + private static String url = "jdbc:oracle:thin:@60.247.58.117:50011:ADC"; //数据源url + private static String username = "ADC_PLATFORM"; //数据源连接用户名 + private static String password = "ADC_PLATFORM"; //数据源连接密码 + + public static void main(String[] args) { + + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + gc.setOutputDir(projectPath + "/src/main/java"); + gc.setAuthor(author); + gc.setOpen(false); + gc.setSwagger2(true); //实体属性 Swagger2 注解 + gc.setBaseColumnList(true); + gc.setBaseResultMap(true); + gc.setIdType(IdType.UUID); + gc.setDateType(DateType.ONLY_DATE); + gc.setFileOverride(true); + gc.setActiveRecord(true); + gc.setControllerName("%sEOController"); + gc.setServiceName("I%sEOService"); + gc.setServiceImplName("%sEOServiceImpl"); +// gc.setEntityName("%sEO"); + gc.setMapperName("%sEODao"); + gc.setXmlName("%sEOMapper"); +// gc.setEnableCache(true); + mpg.setGlobalConfig(gc); + + // 数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl(url); + // dsc.setSchemaName("public"); + dsc.setDriverName("oracle.jdbc.OracleDriver"); + dsc.setUsername(username); + dsc.setPassword(password); + mpg.setDataSource(dsc); + + // 包配置 + PackageConfig pc = new PackageConfig(); + pc.setModuleName(moduleName); + pc.setParent("com.adc.da"); + pc.setMapper("dao"); + mpg.setPackageInfo(pc); + + // 自定义配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { +// Map map = new HashMap<>(); +// map.put("restPath", "${restPath}"); +// this.setMap(map); + } + }; + + // 如果模板引擎是 freemarker + String templatePath = "/templates/mapper.xml.ftl"; + String templatePath2 = "/templates/entity.java.ftl"; + // 如果模板引擎是 velocity + // String templatePath = "/templates/mapper.xml.vm"; + + // 自定义输出配置 + List focList = new ArrayList<>(); + // 自定义配置会被优先输出 + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! + return projectPath + "/src/main/resources/mybatis/mapper/" + moduleName+ "/" + tableInfo.getEntityName() + "EOMapper" + + StringPool.DOT_XML; + } + }); + focList.add(new FileOutConfig(templatePath2) { + @Override + public String outputFile(TableInfo tableInfo) { + // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! + return projectPath + "/src/main/java/com/adc/da/" + moduleName + "/entity/" + tableInfo.getEntityName() + "EO" + + StringPool.DOT_JAVA; + } + }); + /* + cfg.setFileCreate(new IFileCreate() { + @Override + public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) { + // 判断自定义文件夹是否需要创建 + checkDir("调用默认方法创建的目录"); + return false; + } + }); + */ + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + + // 配置模板 + TemplateConfig templateConfig = new TemplateConfig(); + + // 配置自定义输出模板 + //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别 + // templateConfig.setEntity("templates/entity2.java"); + // templateConfig.setService(); + // templateConfig.setController(); + + templateConfig.setEntity(null); +// templateConfig.setService(null); +// templateConfig.setServiceImpl(null); +// templateConfig.setController(null); +// templateConfig.setMapper(null); + templateConfig.setXml(null); + mpg.setTemplate(templateConfig); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setControllerMappingHyphenStyle(false); + strategy.setEntityTableFieldAnnotationEnable(true); + strategy.setEntityColumnConstant(true); + strategy.setNaming(NamingStrategy.underline_to_camel); + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + strategy.setEntityLombokModel(true); + strategy.setEntitySerialVersionUID(true); + // strategy.setInclude("TR_PROPERTY_ENGINE", "TR_PROPERTY_VEHICLE", "TR_PROPERTY_VEHICLE_MODEL", "TR_ROLE_MENU", + // "TR_USER_ROLE", "TS_DEPARTMENT", "TS_FILE", "TS_LOG", "TS_MENU", "TS_PROPERTY", "TS_ROLE", + // "TS_TENANT", "TS_USER", "TS_AREA", "TT_CHIP", "TT_ENGINE", "TT_SIM", "TT_TERMINAL", + // "TT_VEHICLE", "TT_VEHICLE_MODEL", "V_TENANT_PAGE", "V_USER_PAGE", "V_DEPARTMENT_PAGE", + // "V_ROLE_PAGE"); + // strategy.setInclude("TR_ROLE_MENU", "TR_USER_ROLE", "TS_DEPARTMENT", "TS_FILE", "TS_LOG", "TS_MENU", + // "TS_PROPERTY", "TS_ROLE", "TS_TENANT", "TS_USER"); + // strategy.setInclude("TR_PROPERTY_ENGINE", "TR_PROPERTY_VEHICLE", "TR_PROPERTY_VEHICLE_MODEL", "TT_CHIP", + // "TT_ENGINE", "TT_SIM", "TT_TERMINAL", "TT_VEHICLE", "TT_VEHICLE_MODEL"); +// strategy.setInclude("V_TERMINAL_PAGE","TT_CHIP","TT_TERMINAL"); + // strategy.setInclude("TS_DEPARTMENT"); + // strategy.setInclude("TS_USER", "TS_TENANT"); + // strategy.setInclude("V_TENANT_PAGE", "TS_TENANT"); + // strategy.setRestControllerStyle(true); + strategy.setInclude(tableNames); + // 公共父类 + strategy.setSuperControllerClass("com.adc.da.mp.base.BaseController"); + // 写于父类中的公共字段 + strategy.setSuperServiceClass("com.adc.da.mp.base.IBaseService"); + strategy.setSuperEntityClass("com.adc.da.mp.base.BaseEntity"); +// strategy.setSuperEntityColumns("CREATER_ID", "CREATER_TIME", "UPDATER_ID", "UPDATER_TIME"); + + strategy.setRestControllerStyle(true); + // strategy.setSuperEntityColumns("id"); + // strategy.setControllerMappingHyphenStyle(true); + strategy.setTablePrefix(tablePrefix); + mpg.setStrategy(strategy); + mpg.setTemplateEngine(new FreemarkerTemplateEngine()); + mpg.execute(); + } + + /** + *

    + * 读取控制台内容 + *

    + */ + public static String scanner(String tip) { + + Scanner scanner = new Scanner(System.in); + StringBuilder help = new StringBuilder(); + help.append("请输入" + tip + ":"); + System.out.println(help.toString()); + if (scanner.hasNext()) { + String ipt = scanner.next(); + if (StringUtils.isNotEmpty(ipt)) { + return ipt; + } + } + throw new MybatisPlusException("请输入正确的" + tip + "!"); + } + +} diff --git a/adc-da-main/src/test/java/com/adc/da/rsa/RSATest.java b/adc-da-main/src/test/java/com/adc/da/rsa/RSATest.java new file mode 100644 index 0000000..0793431 --- /dev/null +++ b/adc-da-main/src/test/java/com/adc/da/rsa/RSATest.java @@ -0,0 +1,17 @@ +package com.adc.da.rsa; + + +import com.adc.da.util.utils.RSAUtils; +import org.junit.Test; + +import java.util.Map; + +public class RSATest { + @Test + public void getRSA(){ + Map map = RSAUtils.createKeys(512); + System.out.println("publicKey: "+map.get("publicKey")); + System.out.println("privateKey: "+map.get("privateKey")); +// System.out.println("model: "+map.get("model")); + } +} diff --git a/adc-da-main/target/classes/application-dev.properties b/adc-da-main/target/classes/application-dev.properties new file mode 100644 index 0000000..432f58a --- /dev/null +++ b/adc-da-main/target/classes/application-dev.properties @@ -0,0 +1,132 @@ +#Development System +#spring.datasource.driverClassName = oracle.jdbc.OracleDriver +#spring.datasource.url = jdbc:oracle:thin:@//60.247.58.117:50011/ADC +##spring.datasource.username = ADC_PLATFORM +##spring.datasource.password = ADC_PLATFORM + +#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.136:19290/ADC +#spring.datasource.username = EPR +#spring.datasource.password = EPR + +#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.103:19290/ADC +#spring.datasource.username = EPR_TEST +#spring.datasource.password = EPR_TEST + +#spring.datasource.driverClassName = com.mysql.jdbc.Driver +#spring.datasource.url = jdbc:mysql://192.168.144.124:3306/cadata2?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#spring.datasource.username = adc_forecast +#spring.datasource.password = adc_forecast + + +#kylin数据库 ds1 +#spring.datasource.kylin.name=PROJECT_MI +#spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver +#spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI +#spring.datasource.kylin.username=64459 +#spring.datasource.kylin.password=ichangan_ps9 +##10s +#spring.datasource.kylin.maxWaitTime=10000 +#spring.datasource.kylin.poolSize=10 +# +##mysql数据库 ds2 +#spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver +#spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#spring.datasource.mysql.username = root +#spring.datasource.mysql.password = root + +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver +spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai +spring.datasource.username = root +spring.datasource.password = hzwlsoft.com + +#后端端口 +server.port=7060 + +#验证码后台模式,默认为1:1为不开启,2为开启,3为输错 用户名或密码 ${maxLoginErrorCount} 次 才开启 +verifyCodeMode=3 +#仅当验证码模式 ${verifyCodeMode} 为 3时生效,设置错误登录出现验证码的阈值,默认为3 +maxLoginErrorCount=3 + +#密码Base64加密开关,true为开启,false为关闭 +isPassEncrypted=true +#{ +#"password": "YWJjMTIz", +#"username": "YWRtaW4x" +#} +#swagger 显示api,1为只显示${restPath:/api}前缀的api,0为显示所有api,其他为不显示api +swaggerLevel=0 + + +#uploadFile=/EPR/file/EPR/test/ +# +#picPath=/EPR/file/home/pic/ + +uploadFile=D:\\work\\idea\\changan\\ + +picPath=/api/home/pic/ + + +serverIp=http://192.2.10.32:8020/ + + +#MAIL_SMTP =smtp.163.com +#MAIL_SMTP_PORT=465 +#MAIL_USERNAME=cagds@catarc.ac.cn +#MAIL_PASSWORD=Cagds9760 + +MAIL_SMTP =smtp.163.com +MAIL_SMTP_PORT=465 +MAIL_USERNAME=simashihao@163.com +MAIL_PASSWORD=VQBNNQBLDIALAYCV + +#MAIL_SMTP =cmp.changan.com +#MAIL_SMTP_PORT=25 +MAIL_POP_PORT=110 +#MAIL_USERNAME=64459@Any3.com +#MAIL_PASSWORD=65316975Xiaoq + + + + + + +IPANDPORT=http://localhost:7061/ + +#redis +#Redis服务器地址 +spring.redis.host=192.168.144.29 +#spring.redis.host=localhost +## Redis服务器连接端口 +spring.redis.port=6379 +## Redis服务器连接密码(默认为空) +spring.redis.password=123321 +## 连接超时时间(毫秒) +spring.redis.timeout=200000ms +## 连接池中的最大空闲连接,默认值是8。 +spring.redis.jedis.pool.max-idle=50 +##连接池中的最小空闲连接,默认值是0。 +spring.redis.jedis.pool.min-idle=10 +## 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。 +spring.redis.jedis.pool.max-active=2000 +## 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException +spring.redis.jedis.pool.max-wait=2000ms + +spring.redis.database=6 + + +# ======= 阿里OSS配置 ========= +aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com +aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 +aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC +aliyun.OSS.bucketName=qqxexamplebucket +aliyun.OSS.fileMaxSize=10 #文件上传最大M数 + +logging.level.com.adc: debug + + +# ======= ddm权限接口 集成 ========= +ddm-identity=changan_test +ddm-company=9 +ddm-ras-public-key= + + diff --git a/adc-da-main/target/classes/application.properties b/adc-da-main/target/classes/application.properties new file mode 100644 index 0000000..593d808 --- /dev/null +++ b/adc-da-main/target/classes/application.properties @@ -0,0 +1,117 @@ +spring.profiles.active=dev + +############################################### +#公共配置部分 +############################################## +# =============================== +# = DATA SOURCE +# =============================== +spring.datasource.type = com.alibaba.druid.pool.DruidDataSource +# 下面为连接池的补充设置,应用到上面所有数据源中 +# 初始化大小,最小,最大 +spring.datasource.initialSize = 500 +spring.datasource.minIdle = 500 +spring.datasource.maxActive = 500 +# 配置获取连接等待超时的时间 +spring.datasource.maxWait = 60000 +# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 +spring.datasource.timeBetweenEvictionRunsMillis = 30000 +# 配置一个连接在池中最小生存的时间,单位是毫秒 +spring.datasource.minEvictableIdleTimeMillis = 100000 +spring.datasource.validationQuery= 'SELECT 1 FROM DUAL' +spring.datasource.testWhileIdle = true +spring.datasource.testOnBorrow = false +spring.datasource.testOnReturn = false +# 打开PSCache,并且指定每个连接上PSCache的大小 +spring.datasource.poolPreparedStatements = true +spring.datasource.maxPoolPreparedStatementPerConnectionSize = 20 +# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 +spring.datasource.filters = stat,wall,log4j +# 通过connectProperties属性来打开mergeSql功能;慢SQL记录 +#spring.datasource.connectionProperties = 'druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000' +# 合并多个DruidDataSource的监控数据 +#useGlobalDataSourceStat: true +spring.datasource.mergeSql=true +spring.datasource.slowSqlMillis=1 +spring.datasource.logSlowSql=true +# =============================== +#默认关闭SpringBootActuator +endpoints.enabled=false +# http-only +server.servlet.session.cookie.http-only=true + +# mybatis_config +mybatis-plus.config-locations=classpath:mybatis/mybatis-config.xml +mybatis-plus.mapper-locations=classpath*:mybatis/mapper/**/mysql/**/*.xml + +#显示sql +logging.level.com.adc=debug +logging.level.org.hibernate=info +logging.level.org.springframework=info + +adminPath=/library/a +restPath=/library/api +portalPath=/library/portalSystem + +#是否使用rsa非对称加密(adc-ad-login:2.3.3-SNAPSHOT支持) 使用时,请设置 isPassEncrypted=false +isPassEncrypted=true +useRSALogin=true +#请您执行main模块下test包com.adc.da.rsa.RSATest 的测试方法 生成公钥及私钥,并由公钥前端加密(前端建议使用 jsencrypt工具包),后端配置useRSALogin=true开启加密,并且将生成的私钥配置到RAS_PRI_KEY +RAS_PRI_KEY=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAq1I/fLYOTKgNCwUavqyfixosEXByKMQ9axZDUefPywi+ftXdPI2tJ6x/7uc+CdST0a3/toqxdSRjrsHMwnnGQQIDAQABAkB5ZPBDiCUdwD5tvpIy5dKvGD59pPXfWR5EESRmlyGwNTlJ/fIV1wL7UsRYoFslAEcHLyKY7kX8wIefqw2k9R8hAiEA6mH2xls2BZ6nftz6aA8V6CSrsZ49qO9l6SPirXrxg0UCIQC7H1WXLHEV65PUaMTNvzuLc43xkac9DZX4FpUXDeuIzQIgXghhjiEH4mdNgas8V0U+H72emIsI597r/wYjqj/55xUCIDATfuQWUP+2xQZ/3ICYL25GxCNarsMq6GsTMj74HpnJAiAb6BqTkVklIMsl2lAZbE49fluSm3YLt4eNnVVdzJkpFg== +#{ +#"password": "SN/qCzazttK/kzezk+bMo/b/aZP0Mqfpl66hj24p2oayZs3/vDmv7MM9+451I5FTaq2jq/EbOxIjiK2zLAiZ5w==", +#"username": "SC/dfdsf/kzezk+fd/b/fdf/vDmv7MM9+fd/fds==" +#} +#useRSALogin= +#RAS_PRI_KEY= + +# file模块上传文件的服务器地址 +file.path=/Users/sxh/uploadFiles + +# ppt图片保存的路径 +file.pptPath=/pptImg + +# file模块上传文件大小限制 +spring.servlet.multipart.max-request-size=100MB +spring.servlet.multipart.max-file-size=100MB + +# 系统日志类别dev:开发模式不拦截方法记日志, custom:客户自定义需要拦截记日志的方法, sys:系统原设需要拦截记日志的方法 +sysLogType=dev + +#rabbitMQ +spring.rabbitmq.host=192.168.1.219 +spring.rabbitmq.port=5672 +spring.rabbitmq.username=guest +spring.rabbitmq.password=guest +spring.rabbitmq.publisher-confirms=true + +#redis +# Redis服务器地址 +spring.redis.host=221.239.111.146 +# Redis服务器连接端口 +spring.redis.port=15777 +# Redis服务器连接密码(默认为空) +spring.redis.password=cvdecs + +#线程池 +core.pool.size=10 +max.pool.size=30 +keep.alive.seconds=60 +queue.capacity=8 + + +mybatis-plus.configuration.map-underscore-to-camel-case=true + +modelpath=/EPR/file/template/eprmodel.docx + +wordurl=http://localhost:8333/word/make + +#datatype.change=kylin +#datatype.change=mysql + +#elastic search +#clusterName=elasticsearch +#clusterNodes=10.10.0.3:9300 + + + diff --git a/adc-da-main/target/classes/banner.txt b/adc-da-main/target/classes/banner.txt new file mode 100644 index 0000000..a4f9a52 --- /dev/null +++ b/adc-da-main/target/classes/banner.txt @@ -0,0 +1,9 @@ +${AnsiColor.RED} _ _ + __ _ __| | ___ __| | __ _ + / _` |/ _` |/ __|____ / _` |/ _` | + | (_| | (_| | (_|_____| (_| | (_| | + \__,_|\__,_|\___| \__,_|\__,_| + +${AnsiColor.YELLOW}------------------------------------------------ +${AnsiColor.YELLOW} :: ${AnsiColor.YELLOW}@数据资源中心 +${AnsiColor.YELLOW}------------------------------------------------${AnsiColor.WHITE} \ No newline at end of file diff --git a/adc-da-main/target/classes/cache/ehcache-hibernate-local.xml b/adc-da-main/target/classes/cache/ehcache-hibernate-local.xml new file mode 100644 index 0000000..9695429 --- /dev/null +++ b/adc-da-main/target/classes/cache/ehcache-hibernate-local.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/target/classes/cache/ehcache-hibernate-rmi.xml b/adc-da-main/target/classes/cache/ehcache-hibernate-rmi.xml new file mode 100644 index 0000000..9be764f --- /dev/null +++ b/adc-da-main/target/classes/cache/ehcache-hibernate-rmi.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/target/classes/cache/ehcache-local.xml b/adc-da-main/target/classes/cache/ehcache-local.xml new file mode 100644 index 0000000..852899e --- /dev/null +++ b/adc-da-main/target/classes/cache/ehcache-local.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/target/classes/cache/ehcache-rmi.xml b/adc-da-main/target/classes/cache/ehcache-rmi.xml new file mode 100644 index 0000000..3d0e04b --- /dev/null +++ b/adc-da-main/target/classes/cache/ehcache-rmi.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/target/classes/com/adc/da/AdcDaApplication.class b/adc-da-main/target/classes/com/adc/da/AdcDaApplication.class new file mode 100644 index 0000000..0b1659a Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/AdcDaApplication.class differ diff --git a/adc-da-main/target/classes/com/adc/da/ServletInitializer.class b/adc-da-main/target/classes/com/adc/da/ServletInitializer.class new file mode 100644 index 0000000..98cfc91 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/ServletInitializer.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.class b/adc-da-main/target/classes/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.class new file mode 100644 index 0000000..f84c18d Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/advice/MultipartExceptionAdvice.class b/adc-da-main/target/classes/com/adc/da/main/advice/MultipartExceptionAdvice.class new file mode 100644 index 0000000..f0b04fc Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/advice/MultipartExceptionAdvice.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/advice/NotValidExceptionAdvice.class b/adc-da-main/target/classes/com/adc/da/main/advice/NotValidExceptionAdvice.class new file mode 100644 index 0000000..8bad256 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/advice/NotValidExceptionAdvice.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/advice/ShiroExceptionAdvice.class b/adc-da-main/target/classes/com/adc/da/main/advice/ShiroExceptionAdvice.class new file mode 100644 index 0000000..6233766 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/advice/ShiroExceptionAdvice.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/advice/ValidExcetipnAdvice.class b/adc-da-main/target/classes/com/adc/da/main/advice/ValidExcetipnAdvice.class new file mode 100644 index 0000000..7c69d39 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/advice/ValidExcetipnAdvice.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/aspect/ResponseLogAspect.class b/adc-da-main/target/classes/com/adc/da/main/aspect/ResponseLogAspect.class new file mode 100644 index 0000000..3785160 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/aspect/ResponseLogAspect.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/DataSource/DataSourceConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/DataSource/DataSourceConfig.class new file mode 100644 index 0000000..9778535 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/DataSource/DataSourceConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/DozerConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/DozerConfig.class new file mode 100644 index 0000000..980607d Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/DozerConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/MybatisPlusConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/MybatisPlusConfig.class new file mode 100644 index 0000000..9960c2c Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/MybatisPlusConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/RedisConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/RedisConfig.class new file mode 100644 index 0000000..9867c42 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/RedisConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/WebConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/WebConfig.class new file mode 100644 index 0000000..fd7e80e Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/WebConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/config/WebMvcConfig.class b/adc-da-main/target/classes/com/adc/da/main/config/WebMvcConfig.class new file mode 100644 index 0000000..0bc4974 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/config/WebMvcConfig.class differ diff --git a/adc-da-main/target/classes/com/adc/da/main/schedule/ApplicationContextUtil.class b/adc-da-main/target/classes/com/adc/da/main/schedule/ApplicationContextUtil.class new file mode 100644 index 0000000..7312053 Binary files /dev/null and b/adc-da-main/target/classes/com/adc/da/main/schedule/ApplicationContextUtil.class differ diff --git a/adc-da-main/target/classes/config/application.yml b/adc-da-main/target/classes/config/application.yml new file mode 100644 index 0000000..e69de29 diff --git a/adc-da-main/target/classes/gen/config.properties b/adc-da-main/target/classes/gen/config.properties new file mode 100644 index 0000000..760785a --- /dev/null +++ b/adc-da-main/target/classes/gen/config.properties @@ -0,0 +1,44 @@ +#define code path +source_root_package=src/main/java +resources_root_package=src/main/resources +test_root_package=src/test/java +webroot_package=src/app + +#define project +core_project=/adc-da-configuration +#client_project=/data-cloud-report/ui +client_project=.. + +rest_project=/adc-da-configuration + +#define base class package +base_class_package=com.adc.da.base + +#bussi_package[User defined] +biz_package=com.adc.da +biz_app_package=admin + + + +#ftl resource url +template_path=template +system_encoding=utf-8 + +#Search Param num [User defined] +table_id=id +search_filed_num=1 + +#table_prefix=TD_DC_VISUAL_,TD_DC_,dict_,UM_,TD_ +table_prefix=TS_,TR_,T,dmk. + +#PageType 1: mapper_xml, 2: dao, 3: service, 4: rest, 5: javascript, 6: html + +page_gen_type=1,2,3,4 + + + +#Not Used +mapper_xml_only=false +backend_only=true +entity_open_type=dialog +entity_save_type=form diff --git a/adc-da-main/target/classes/gen/database.properties b/adc-da-main/target/classes/gen/database.properties new file mode 100644 index 0000000..72df0dc --- /dev/null +++ b/adc-da-main/target/classes/gen/database.properties @@ -0,0 +1,30 @@ +#mysql +#----------------------------- mysql ------------------------------------------ +#diver_name=com.mysql.jdbc.Driver +#url=jdbc:mysql://localhost:3306/adc_platform?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +#username=root +#password=root +#database_name=adc_platform + + +#oracle +#----------------------------- oracle ------------------------------------------ +#diver_name=oracle.jdbc.driver.OracleDriver +#url=jdbc:oracle:thin:@60.247.58.117:50011/ADC +#username=ADC_PLATFORM +#password=ADC_PLATFORM +#database_name=adc_platform + +diver_name = com.mysql.jdbc.Driver +url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull +username = root +password = root +database_name=cadata + +#ldap +#----------------------------- LDAP ------------------------------------------ +ldap.connection.url=ldap://localhost:10389 +ldap.connection.base=dc=wlt,dc=com +ldap.connection.username=uid=admin,ou=system +ldap.connection.password=12345678 +ldap.schema.cn=um diff --git a/adc-da-main/target/classes/logback-spring.xml b/adc-da-main/target/classes/logback-spring.xml new file mode 100644 index 0000000..a76dcef --- /dev/null +++ b/adc-da-main/target/classes/logback-spring.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + + + + + INFO + + ACCEPT + + ACCEPT + + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_all.%d{yyyy-MM-dd}.%i.log + + 7 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + ERROR + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_error.%d{yyyy-MM-dd}.%i.log + + 30 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + INFO + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_info.%d{yyyy-MM-dd}.%i.log + + 15 + + 50MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + WARN + + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_warn.%d{yyyy-MM-dd}.%i.log + + 30 + + 50MB + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/target/classes/logo/logo_white.png b/adc-da-main/target/classes/logo/logo_white.png new file mode 100644 index 0000000..e744da1 Binary files /dev/null and b/adc-da-main/target/classes/logo/logo_white.png differ diff --git a/adc-da-main/target/classes/mybatis/mybatis-config.xml b/adc-da-main/target/classes/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e041bc2 --- /dev/null +++ b/adc-da-main/target/classes/mybatis/mybatis-config.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/target/classes/py4j/py4j.dic b/adc-da-main/target/classes/py4j/py4j.dic new file mode 100644 index 0000000..9198324 --- /dev/null +++ b/adc-da-main/target/classes/py4j/py4j.dic @@ -0,0 +1,297 @@ +a#阿 +ao#拗口/违拗/拗断/执拗/拗口/拗口风/拗口令/拗曲/拗性/拗折/警拗 +ai#艾 +bang#膀/磅/蚌 +ba#扒 +bai#叔伯/百/柏杨/㧳/梵呗/呗佛/呗音/呗唱/呗偈/呗声/呗赞/赞呗 +bao#剥皮/薄/暴/堡/曝 +bei#呗 +beng#蚌埠 +bi#复辟/臂/秘鲁/泌阳 +bing#屏息/屏弃/屏气/屏除/屏声 +bian#扁/便/便宜坊 +bo#薄荷/单薄/伯/泊/波/柏/萝卜/孛 +bu#卜/柨 +can#参 +cang#藏/欌 +cen#参差 +ceng#曾/噌 +cha#差/刹那/宝刹/一刹/查/碴/喳喳/喀喳 +chai#公差/差役/专差/官差/听差/美差/办差/差事/差使/肥差/当差/钦差/苦差/出差 +chan#颤/单于/禅 +chang#长/厂 +chao#朝/嘲/焯 +che#工尺/车 +chen#称职/匀称/称心/相称/对称 +cheng#称/乘/澄/噌吰/橙 秤/盛满/盛器/盛饭 +chu#畜 +chui#椎心 +chuai#揣 +chuan#传 +chi#匙/尺/吃 +chong#重庆/重重/虫 +chou#臭/帱 +chuang#经幢 +chuo#绰 +ci#参差/鳞差/伺候/龟兹 +cuan#攒聚/攒动/攒集/攒宫/攒所 +cuo#撮儿/撮要/撮合 +da#大/嗒 +dao#叨/帱载/帱察 +dai#大夫 +dan#单/弹/掸/澹 +dang#铛 +de#的/得 +di#堤/底/怎的/有的/目的/标的/打的/的确/有的放/的卢/矢之的/言中的/语中的/的士/地/提防/快的/美的 +diao#蓝调/调调/音调/论调/格调/调令/低调/笔调/基调/强调/声调/滥调/老调/色调/单调/腔调/跑调/曲调/步调/语调/主调/情调 +ding#丁 +du#读/都/度 +dou#全都/句读 +duo#舵/测度/忖度/揣度/猜度 +dun#粮囤/盾/顿/沌/敦 +e#阿谀/阿胶/阿弥/恶/擜 +er#儿 +fan#番 +feng#冯 +fei#婔 +fo#佛 +fu#仿佛/果脯/罘/莩 +fou#否 +fiao#覅 +ga#咖喱/伽马/嘎/戛纳 +gai#盖 +gao#告 +gang#扛鼎 +ge#革/蛤蚧/文蛤/蛤蜊/咯 +gei#给 +geng#脖颈 +gong#女红/共 +gu#谷/中鹄/鼓 +gui#龟/柜/硅/倭傀/傀异/傀然/傀垒/傀怪/傀卓/傀奇/傀伟/傀民/傀俄/琦傀/奇傀 +gua#呱 +guan#纶巾/东莞 +guang#广 +ha#蛤/哈/虾蟆 +hai#还/嗨/咳声/咳笑 +hao#貉子/貉绒 +hang#夯/总行/分行/支行/行业/排行/行情/央行/商行/外行/银行/中行/交行/招行/农行/工行/建行/商行/酒行/麻行/琴行/行业/同行/行列/行货/行会/行家/巷道/引吭/扼吭/批吭/搤吭/高吭/喉吭/咔吭/絶吭/吭嗌/吭咽/吭首 +he#和/合/核/鶴/猲 +heng#道行/涥 +hu#鹄/水浒/嗀/唬 +hua#滑/呚/椛 +huan#归还/放还/奉还/圜 +hui#会/浍河/媈/灳/哕/瑗珲 +hong#红/虹 +huo#软和/热和/暖和 +hun#尡/珲 +ji#病革/给养/自给/给水/薪给/给予/供给/稽/缉/藉/奇数/亟/诘屈/荠菜/愱 +jia#雪茄/伽/家/价/贾/戛 +jian#见/浅浅 +jiang#降 +jiao#嚼舌/嚼字/嚼蜡/角/剿/饺/脚/蕉/矫/睡觉/侥/校对/校验/校正/校准/审校/校场/校核/校勘/校订/校阅/校样 +jie#解/慰藉/蕴藉/诘/媘/煯 +jin#矜/劲/禁 +jing#颈/景/强劲/劲风/劲旅/劲敌/劲射/苍劲/遒劲/劲草 +jiong#炅 +ju#咀/居/桔/句/婮 +jun#均 +juan#棚圈/圈养/猪圈/羊圈 +jue#主角/角色/旦角/女角/丑角/角力/名角/配角/嚼/觉/䏐 +jun#龟裂/俊 +ka#咖/卡/喀 +kai#楷 +kang#扛 +ke#咳/壳 +keng#吭 +kuai#会计/财会/浍 +kui#傀 +kuo#括 +la#癞痢/腊/蜡 +lai#癞疮/癞子/癞蛤/癞皮 +lao#积潦/络子/落枕/落价/粩/姥 +le#乐/勒/了 +lei#勒紧 +lo#然咯 +lou#佝偻/泄露/露面/露脸/露骨/露底/露馅/露一手/露相/露马脚/露怯 +long#里弄/弄堂/泷 +li#跞/礼/櫔/栃 +liao#了解/了结/明了/了得/末了/未了/了如/潦/撩 +liang#靓/俩 +lie#挘 +lin#崊 +ling#霗/令 +liu#六/遛 +lu#碌/陆/露 +luo#络/落/漯/囖/洜/泺 +lv#率/绿 +lve#鋢/稤 +lun#纶 +ma#嫲/抹布/抹脸/抹桌子/摩挲 +mai#埋 +man#埋怨/蔓 +mai#脉 +mang#氓/芒 +mao#冒 +me#嚒 +men#椚 +meng#群氓/盟/癦 +mei#没/旀 +mo#淹没/没收/出没/沉没/没落/吞没/覆没/没入/埋没/鬼没/隐没/湮没/辱没/脉脉/模/摩/抹 +mou#绸缪/牟 +mi#秘/泌尿/分泌/谜/檷枸 +mian#渑 +ming#掵 +miu#谬/谬论/纰缪 +mu#大模/字模/模板/模样/模具/装模/模子/牟尼/子牟/夷牟/悬牟/相牟/头牟/宾牟/曹牟/岑牟/兜牟/卢牟/弥牟/牟食/牟槊/牟衫/牟光/牟牟/牟甲 +na#哪/娜/那 +nao#臑 +nan#南 +ne#哪吒/呢 +nei#氞 +neus#莻 +nong#弄/燶 +ni#毛呢/花呢/呢绒/线呢/呢料/呢子/呢喃/溺/檷 +niao#尿/鸟/便溺 +nian#粘膜/粘度/粘土/粘合剂/粘液/粘稠/粘合/粘着/粘结/粘性/粘附/不粘锅/粘糊/粘虫/粘聚/粘滞/焾/哖 +niang#酿 +nin#脌 +ning#倿/拧 +niu#拗/汼 +nu#努 +nuo#婀娜/袅娜/喏 +nv#女 +nve#疟/硸 +o#喔/筽 +ou#膒 +pa#扒手/扒窃/扒外/扒分/扒糕/扒灰/扒犁/扒龙/扒搂/扒山虎/扒艇 +pai#派/迫击/迫击炮 +pao#刨/炮/萢 +pan#番禺 +pang#胖/膀/磅 +pei#蓜 +pi#辟/否极/臧否/龙陂/芘 +pian#扁舟/便宜/魸 +piao#朴姓/饿莩/饥莩/葭莩 +pin#穦 +ping#屏/苹/冯河 +po#湖泊/血泊 /迫/朴刀/坡/陂 +pu#一曝十寒/里堡/十里堡/脯/朴/曝晒/瀑/埔 +qi#期/其/泣/祇 +qiu#龟兹/湭 +qi#稽首/缉鞋/栖/奇/漆/齐 +qia#卡脖/卡子/关卡/卡壳/哨卡/边卡/发卡/峠 +qiao#雀盲/雀子/地壳/甲壳/躯壳 +qian#纤/乾/浅 +qiang#强/㛨/㩖/䅚/䵁 +qie#茄/趔趄/聺/籡 +qin#亲/沁 +qing#干亲/亲家 +qiong#熍 +qu#区/趣/爠 +quan#圈/券 +que#雀/炔 +re#声喏/唱喏 +rong#嬫 +ruo#若/嵶 +saeng#栍 +sang#槡 +sai#塞/嘥 +sao#螦 +se#堵塞/搪塞/茅塞/闭塞/鼻塞/梗塞/阻塞/淤塞/拥塞/哽塞/色 +sha#莎/刹车/急刹/厦/杉木/杉篙 +shai#色子 +shao#勺/红苕 +shan#姓单/单县/杉/敾/禅让/受禅/禅变/禅代/禅诰 +shang#衣裳 +she#拾级/折本/射/蛇 +shen#沙参/野参/参王/人参/红参/丹参/山参/海参/鹿参/什么/身/沈/桑椹/食椹/烂椹/木椹 +sheng#野乘/千乘/史乘/省/晟/盛/陹/渑水 +shi#钥匙/什/识/似的/食/石/氏/拾/适/瑡 +shiwa#瓧 +shuai#表率/率性/率直/率真/粗率/率领/轻率/直率/草率/大率/坦率/衰 +shuang#泷水/鏯 +shu#属/数/术/熟 +shui#游说 +shuo#数见/说 +si#伺/似/思 +sou#蓃/摗 +su#宿/鯂 +sui#尿泡 +ta#拓片/拓印/拓本/拓墨/拓写/拓手/拓工/碑拓/疲沓/拖沓/杂沓/沓/塔/鸿塔 +tang#汤/镗 +tao#陶 +tan#反弹/弹性/弹簧/弹力/弹奏/弹跳/弹指/弹劾/弹唱/弹射/弹性体/吹弹/评弹/乱弹琴/弹压/弹指/弹簧/弹冠/弹雀/弹雀/弹丝/弹丸/澹台 +te#脦 +teng#虅 +ti#提/体 +tiao#调/苕 +ting#町/听 +tong#通 +tu#迌 +tuan#湪 +tui#褪 +tuo#拓/袥 +tun#囤/屯 +wei#尾/蔚/圩堤/圩垸/圩田/圩子/赶圩/歌圩 +weng#攚 +wu#无/可恶/交恶/好恶/厌恶/憎恶/嫌恶/痛恶/深恶/兀 +wan#藤蔓/枝蔓/根蔓/蔓草/瓜蔓/蔓儿/莞/万/百万/皖 +wang#亡 +wai#崴 +xia#虾/吓/夏/厦门/厦大/唬杀 +xi#栖/系/蹊/洗/溪/戏/焁/铣/褶衣/褶裤 +xiao#校/切削/削面/刀削/刮削 +xian#纤细/光纤/纤巧/纤柔/纤小/纤维/纤瘦/纤纤/化纤/纤秀/棉纤/纤尘/铣铁/金铣 +xiang#投降/巷 +xie#解数/出血/采血/换血/血糊/尿血/淤血/放血/血晕/血淋/便血/吐血/咯血/叶韵/蝎/蝎子/邪/猲猲 +xin#嬜/邤 +xiu#铜臭/乳臭/成宿/星宿/璓 +xin#馨/信/鸿信 +xing#深省/省视/内省/不省人事/省悟/省察/行/荥 +xiong#匂 +xu#牧畜/畜产/畜牧/畜养/并畜/畜锐/吁/圩/浒 +xuan#箮 +xue#削/血/樰 +xun#荨/寻 +ya#琊 +yao#钥/耀/曜/佋侥/侥觎/侥僺/侥利/侥傒/侥觊/侥会/侥滥/侥望/侥求/侥竞/侥薄/侥躐/侥取/侥奇/侥忝/侥速/侥冀/侥冒/疟子 +yan#咽/殷红/朱殷/腌/烟/曕 +ye#液/抽咽/哽咽/咽炎/呜咽/幽咽/悲咽/叶/葉/璍/潱/拽步/拽扶/拽扎 +yi#自艾/遗/屹/嬄/噫 +yin#殷/栶 +ying#荥经/緓/灜 +yo#杭育 +yong#涌/硧 +you#牗 +yu#余/呼吁/吁请/吁求/育/熨帖/熨烫/於 +yuan#员/茒/圜丘 +yun#熨 +yue#约/乐音/器乐/乐律/乐章/音乐/乐理/民乐/乐队/声乐/奏乐/弦乐/乐坛/管乐/配乐/乐曲/乐谱/锁钥/密钥/乐团/乐器/嬳/咽哕/唾哕/发哕/干哕/哕吐/哕饭/哕呕/哕息/哕厥/哕噫/哕逆/哕咽/哕骂/哕心/哕喈/口哕/呕哕 +za#绑扎/结扎/包扎/捆扎/咱家 +zan#攒/咱 +zang#宝藏/藏历/藏文/藏语/藏青/藏族/藏医/藏药/藏蓝/西藏 +zai#牛仔/龟仔/龙仔/鼻仔/羊仔/仔仔/麻仔/麵包仔/麦旺仔/鸿仔/煲仔/福仔/畠 +zao#栆 +ze#择 +zeng#曾国藩/曾孙/曾祖父/曾祖/曾祖母/曾孙女/曾巩/囎/缯 +zong#综/繌 +zha#扎/柞狭/柞薪/柞子/柞鄂/柞叶/柞撒/槱柞/一柞/五柞宫/五柞/雠柞/芟柞/蜡祭/喳 +zhai#宅/夈/择席/择菜 +zhan#粘 +zhang#列车长/行长/村长/镇长/乡长/区长/县长/市长/省长/会长/班长/排长/连长/营长/团长/旅长/师长/军长/委员长/局长/厅长/所长/部长/组长/生长/长大/长高/长个/ +zhao#朝朝/明朝/朝晖/朝夕/朝思/今朝/朝气/朝三/朝秦/朝霞/鹰爪/龙爪/魔爪/爪牙/着急/着迷/着火/怎么着/正着/着凉/一着/犯不着/着数/这么着/犯得着/着慌/着忙/数得着/龙爪槐/嘲哳/嘲惹 +zhe#折/着/褶 +zhen#殝/椹 +zhi#标识/吱/殖/枝/方祇/后祇/皇祇/黄祇/皇地祇/金祇/祇树/月氏 +zhong#重/种 +zhou#粥 +zhu#属意/著/駯 +zhua#爪子 +zhuai#拽 +zhuan#芈月传/外传/传记/自传/正传/小传/评传/传略/别传 +zhui#椎/隹 +zhuo#执著/着装/着落/着意/着力/附着/着笔/胶着/着实/衣着/着眼/着想/着重/穿着/执着/着墨/着实/沉着/着陆/着想/着色/焯见/焯烁/辉焯 +zhuang#幢房/一幢/幢楼/庒 +zi#仔/兹 +zu#足 +zuo#柞/穝 \ No newline at end of file diff --git a/adc-da-main/target/classes/white/csrfWhite.txt b/adc-da-main/target/classes/white/csrfWhite.txt new file mode 100644 index 0000000..27c2916 --- /dev/null +++ b/adc-da-main/target/classes/white/csrfWhite.txt @@ -0,0 +1,3 @@ +127.0.0.1 +localhost +index.html \ No newline at end of file diff --git a/adc-da-main/target/classes/white/uploadWhite.txt b/adc-da-main/target/classes/white/uploadWhite.txt new file mode 100644 index 0000000..fd4a3ae --- /dev/null +++ b/adc-da-main/target/classes/white/uploadWhite.txt @@ -0,0 +1,12 @@ +pdf +doc +docx +xlsx +xls +zip +rar +jpg +jpge +png +gif +ppt \ No newline at end of file diff --git a/adc-da-main/target/classes/white/xssWhite.txt b/adc-da-main/target/classes/white/xssWhite.txt new file mode 100644 index 0000000..b724e4d --- /dev/null +++ b/adc-da-main/target/classes/white/xssWhite.txt @@ -0,0 +1 @@ +/upload/ \ No newline at end of file diff --git a/adc-da-main/target/test-classes/com/adc/da/doc/DocGenerate.class b/adc-da-main/target/test-classes/com/adc/da/doc/DocGenerate.class new file mode 100644 index 0000000..833d03e Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/doc/DocGenerate.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/gen/CodeUtil.class b/adc-da-main/target/test-classes/com/adc/da/gen/CodeUtil.class new file mode 100644 index 0000000..4ccea2a Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/gen/CodeUtil.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$1.class b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$1.class new file mode 100644 index 0000000..703b63c Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$1.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$2.class b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$2.class new file mode 100644 index 0000000..b7c1acf Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$2.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$3.class b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$3.class new file mode 100644 index 0000000..2247869 Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator$3.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator.class b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator.class new file mode 100644 index 0000000..f279b61 Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/mp/CodeGenerator.class differ diff --git a/adc-da-main/target/test-classes/com/adc/da/rsa/RSATest.class b/adc-da-main/target/test-classes/com/adc/da/rsa/RSATest.class new file mode 100644 index 0000000..4ed4ba0 Binary files /dev/null and b/adc-da-main/target/test-classes/com/adc/da/rsa/RSATest.class differ diff --git a/adc-da-report/pom.xml b/adc-da-report/pom.xml new file mode 100644 index 0000000..277a48d --- /dev/null +++ b/adc-da-report/pom.xml @@ -0,0 +1,119 @@ + + + + ca-data + com.adc + 2.5.0 + + 4.0.0 + + com.adc + adc-da-report + 2.5.0 + + + + com.aliyun.oss + aliyun-sdk-oss + 3.10.2 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-actuator + + + + org.springframework.boot + spring-boot-starter-test + + + + org.springframework.boot + spring-boot-starter-aop + + + + com.baomidou + mybatis-plus-boot-starter + + + + org.projectlombok + lombok + + + + org.apache.pdfbox + pdfbox + 2.0.16 + + + org.apache.pdfbox + fontbox + 2.0.16 + + + + com.adc + adc-da-sys + 2.5.0 + + + + com.adc + adc-da-login + 2.5.0 + + + + cn.afterturn + easypoi-base + 3.2.0 + + + cn.afterturn + easypoi-web + 3.2.0 + + + cn.afterturn + easypoi-annotation + 3.2.0 + + + + com.aspose + aspose-words + system + 1.0.0 + ${project.basedir}/src/main/resources/libs/aspose-words-15.8.0-jdk16.jar + + + + org.apache.poi + poi-scratchpad + + + + fr.opensagres.xdocreport + fr.opensagres.poi.xwpf.converter.xhtml + 2.0.1 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/annotation/ReportLog.java b/adc-da-report/src/main/java/com/adc/da/report/annotation/ReportLog.java new file mode 100644 index 0000000..e851e78 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/annotation/ReportLog.java @@ -0,0 +1,15 @@ +package com.adc.da.report.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @Author doudxw + * @Date 2021/11/10 13:24 + */ +@Target({ java.lang.annotation.ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface ReportLog { + String description(); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/aspect/ReportLogAspect.java b/adc-da-report/src/main/java/com/adc/da/report/aspect/ReportLogAspect.java new file mode 100644 index 0000000..50737c3 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/aspect/ReportLogAspect.java @@ -0,0 +1,104 @@ +package com.adc.da.report.aspect; + +import com.adc.da.login.util.CommonUtils; +import com.adc.da.report.annotation.ReportLog; +import com.adc.da.report.eo.LogEntity; +import com.adc.da.report.service.ILogService; +import com.adc.da.report.vo.ReportVo; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import javax.annotation.Resource; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.lang.reflect.Method; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * @Author doudxw + * @Date 2021/11/10 13:18 + */ +@Aspect +@Slf4j +@Component +public class ReportLogAspect { + + @Resource + private ILogService logService; + + //@Pointcut("@annotation(com.adc.da.report.annotation.ReportLog)") + @Pointcut(value = "(execution(* com.adc.da.report.controller.*.*(..)))") + public void poput() { + log.info("初始化切面完成"); + } + + @ResponseBody + @Around(value = "poput()") + public Object doArround(ProceedingJoinPoint joinPoint) throws Throwable { + + Object obj = joinPoint.proceed(); + Object[] args = joinPoint.getArgs(); + String name = joinPoint.getSignature().getName(); + Class cs = joinPoint.getTarget().getClass(); + //获取类中的所有方法 + Method[] method = cs.getDeclaredMethods(); + //遍历方法 + for (Method method1 : method) { + ReportLog reportLog = method1.getAnnotation(ReportLog.class); + //如果是当前方法,并且方法上有ReportLog注解 + if (reportLog != null && method1.getName().equals(name)) { + String description = reportLog.description(); + ResponseMessage returnValue = (ResponseMessage) obj; + //判断是否正确返回 + if (returnValue.isOk()) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + LogEntity entity = new LogEntity(); + + String account = Optional.ofNullable(CommonUtils.getUserInfo()).orElse(new UserEO()).getAccount(); + account = StringUtils.isEmpty(account) ? "未知用户" : account; + entity.setAccount(account); + entity.setClassName(cs.getName()); + entity.setOperateTime(format.format(new Date())); + entity.setMethod(name); + + entity.setUsid(CommonUtils.getUserId()); + //新增或者编辑操作 + if ("新增或编辑".equals(description)) { + Map map = (Map) returnValue.getData(); + String reportName = map.get("reportName"); + entity.setReportName(reportName); + ReportVo vo = (ReportVo) args[0]; + if (StringUtils.isNotEmpty(vo.getId())) { + entity.setDescription("新增"); + } else { + entity.setDescription("编辑"); + } + logService.insert(entity); + } + //删除操作 + else { + List list = (List) returnValue.getData(); + entity.setDescription(description); + list.forEach(c -> { + entity.setReportName(c); + logService.insert(entity); + }); + + } + + } + } + } + return obj; + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java new file mode 100644 index 0000000..8516866 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java @@ -0,0 +1,91 @@ +package com.adc.da.report.controller; + +import com.adc.da.report.annotation.ReportLog; +import com.adc.da.report.eo.LabelEntity; +import com.adc.da.report.service.ILabelService; +import com.adc.da.report.vo.LabelAllVo; +import com.adc.da.report.vo.LabelVo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; + +/** + * @Author doudxw + * @Date 2021/11/9 13:46 + */ +@Slf4j +@RestController +@Api(tags = "标签管理") +@RequestMapping("/${restPath}/label") +public class LabelManageController { + + + @Resource + private ILabelService labelService; + + /** + * 新增或编辑标签 + * @param vo + * @return + */ + @ApiOperation("新增或编辑标签") + @PostMapping("/add") + public ResponseMessage add(@Valid @RequestBody LabelVo vo){ + LabelEntity entity=new LabelEntity(); + BeanUtils.copyProperties(vo,entity); + labelService.insert(entity); + return Result.success(); + } + + @ApiOperation("上移|下移|置顶|置尾") + @PostMapping("/move") + public ResponseMessage move(String id,String type,String moveType){ + labelService.move(id,type,moveType); + return Result.success(); + } + + /** + * 标签列表 + * @return + * @throws ExecutionException + * @throws InterruptedException + */ + @ApiOperation("标签列表") + @GetMapping("/list") + public ResponseMessage list() throws ExecutionException, InterruptedException { + Map list = labelService.list(); + return Result.success(list); + } + + @ApiOperation("标签删除|单个") + @PostMapping("/delete/{id}") + public ResponseMessage delete(@PathVariable("id")String id){ + Map map=new HashMap<>(); + String status="0"; + boolean isDelete = labelService.delete(id); + if(!isDelete){ + status="1"; + } + map.put("status",status); + return Result.success(map); + } + + @ApiOperation("标签批量保存") + @PostMapping("/save") + public ResponseMessage save(@RequestBody LabelAllVo vo){ + labelService.save(vo); + return Result.success(); + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogController.java new file mode 100644 index 0000000..538c908 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogController.java @@ -0,0 +1,53 @@ +package com.adc.da.report.controller; + +import com.adc.da.report.service.ILogService; +import com.adc.da.report.vo.LogVo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; + +/** + * @Author doudxw + * @Date 2021/11/10 14:00 + */ +@Api(tags = "报告日志管理") +@RequestMapping("/${restPath}/reportLog") +@RestController +public class ReportLogController { + + @Resource + private ILogService logService; + + /** + * 日志列表 + * @param pageNo + * @param pageSize + * @param doName + * @param reportName + * @param startDate + * @param endDate + * @return + * @throws ParseException + */ + @ApiOperation("日志列表") + @GetMapping("/list") + public ResponseMessage list(int pageNo,int pageSize,String doName,String reportName + ,String startDate,String endDate) throws ParseException { + + IPage list = logService.list(pageNo, pageSize, doName, reportName, startDate, endDate); + + return Result.success(list); + } + + + + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java new file mode 100644 index 0000000..9442f8c --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java @@ -0,0 +1,295 @@ +package com.adc.da.report.controller; + +import com.adc.da.report.annotation.ReportLog; +import com.adc.da.report.eo.FileEntity; +import com.adc.da.report.eo.ReportEntity; +import com.adc.da.report.service.IFileService; +import com.adc.da.report.service.IReportService; +import com.adc.da.report.util.OSSClientUtil; +import com.adc.da.report.vo.ReportQueryVo; +import com.adc.da.report.vo.ReportVo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.aliyun.oss.OSS; +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @Author doudxw + * @Date 2021/11/4 14:26 + */ +@Slf4j +@RestController +@Api(tags = "报告管理") +@RequestMapping("/${restPath}/report") +public class ReportManageConroller { + + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Value("${uploadFile}") + private String uploadFile; + + @Value("${picPath}") + private String picPath; + + @Resource + private IFileService fileService; + + @Resource + private IReportService reportService; + + @Resource + private OSSClientUtil ossClientUtil; + + + /** + * 新增或编辑报告 + * @param vo + * @return + */ + @ApiOperation("新增或编辑报告") + @PostMapping("/add") + @ReportLog(description = "新增或编辑") + public ResponseMessage add(@RequestBody ReportVo vo) { + ReportEntity entity = new ReportEntity(); + BeanUtils.copyProperties(vo, entity); + String name = reportService.insert(entity); + Map map = new HashMap<>(); + map.put("reportName", name); + return Result.success(map); + } + + /** + * 报告列表 + * @param vo + * @return + * @throws Exception + */ + @ApiOperation("报告列表") + @PostMapping("/list") + public ResponseMessage list(@RequestBody ReportQueryVo vo) throws Exception { + IPage list = reportService.list(vo); + return Result.success(list); + } + + /** + * 删除报告 + * @param ids id + * @return + */ + @ApiOperation("删除报告") + @PostMapping("/delete") + @ReportLog(description = "删除") + public ResponseMessage delete(String ids) { + List nameList = reportService.delete(ids); + return Result.success(nameList); + } + + /** + * 获取报告日期列表 + * @return + * @throws Exception + */ + @ApiOperation("获取报告日期列表") + @GetMapping("/reportDateList") + public ResponseMessage reportDateList() throws Exception { + List reportDateList = reportService.getReportDateList(); + Map map = new HashMap<>(); + map.put("list", reportDateList); + return Result.success(map); + } + + + /** + * 获取报告预览 + * @param id + * @return + */ + @ApiOperation("获取报告预览") + @GetMapping("/getReportHtml/{id}") + public ResponseMessage getReportHtml(@PathVariable("id") String id) { + String html = reportService.reportHtml(id); + Map map = new HashMap<>(); + map.put("content", html); + return Result.success(map); + } + + /** + * 测试 + */ + @ApiOperation("testtest") + @GetMapping("/test") + @Deprecated + public void ttt() { + stringRedisTemplate.boundValueOps("1121212").set("1212"); + + } + + + /** + * 上传文件 + * @param file + * @return + * @throws IOException + */ + @ApiOperation(value = "详情||上传文件") + @PostMapping("/uploadFile") + public ResponseMessage> uploadFile(MultipartFile file) throws IOException { + Map resultMap = new HashMap(); + //上传路径 + //此路径映射到localhost + String path = uploadFile; + String realName = file.getOriginalFilename(); + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String date = dateFormat.format(now); + Random r = new Random(); + String num = ""; + for (int i = 0; i < 3; i++) { + int s = r.nextInt(10); + num += String.valueOf(s); + } + + //获取上传文件名 + String fileName = file.getOriginalFilename(); + String contentType = file.getContentType(); + String ext = fileName.substring(fileName.lastIndexOf(".") + 1); + fileName = fileName.substring(0, fileName.lastIndexOf("."))+date + num + "." + ext; + log.info("fileName>>" + fileName); + try{ + String result=ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName); + + resultMap.put("key", date + num); + resultMap.put("value", path + "//" + fileName); + resultMap.put("name", realName); + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + FileEntity entity = new FileEntity(); + entity.setContentType(contentType); + entity.setCreateTime(new Date()); + entity.setFileName(realName); + entity.setFileType(ext); + entity.setFileSize(String.valueOf(file.getSize())); + entity.setFileId(date + num); + entity.setSavePath(fileName); + fileService.addFile(entity); + return Result.success(resultMap); + + } + + /** + * 上传图片 + * @param file + * @param request + * @return + * @throws IOException + */ + @ApiOperation(value = "上传图片") + @PostMapping("/uploadPicFile") + public ResponseMessage> uploadPicFile(MultipartFile file, HttpServletRequest request) throws IOException { + + try (InputStream input = file.getInputStream()) { + Map resultMap = new HashMap(); + String path = uploadFile;//此路径映射到localhost + File files = new File(path); + String realName = file.getOriginalFilename(); + if (!files.exists()) { + files.mkdirs(); + } + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String date = dateFormat.format(now); + Random r = new Random(); + String num = ""; + for (int i = 0; i < 3; i++) { + int s = r.nextInt(10); + num += String.valueOf(s); + } + + //获取上传文件名 + String fileName = file.getOriginalFilename(); + String contentType = file.getContentType(); + String ext = fileName.split("\\.")[1]; + fileName = date + num + "." + ext; + log.info("fileName>>" + fileName); + File dirFile = new File(path, fileName); + log.info("dir.exists()>>" + dirFile.exists()); + if (!dirFile.exists()) { + boolean newFile = dirFile.createNewFile(); + if(!newFile){ + return Result.error(); + } + } + + try (OutputStream output = new FileOutputStream(dirFile)) { + byte[] bt = new byte[1024 * 1024]; + int len = 0; + while ((len = input.read(bt)) != -1) { + output.write(bt, 0, len); + } + resultMap.put("key", date + num); + resultMap.put("value", picPath + "/" + fileName); + resultMap.put("name", realName); + FileEntity entity = new FileEntity(); + entity.setContentType(contentType); + entity.setCreateTime(new Date()); + entity.setFileName(realName); + entity.setFileSize(String.valueOf(file.getSize())); + entity.setFileId(date + num); + entity.setSavePath(picPath + "/" + fileName); + fileService.addFile(entity); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return Result.success(resultMap); + } catch (Exception e) { + return Result.error(); + } + + } + + + /** + * 下载文件 + * @param response + * @param fileId + * @throws IOException + */ + @ApiOperation(value = "|下载文件") + @GetMapping("/download") + public void downloadPic(HttpServletResponse response, String fileId) throws IOException { + + try { + FileEntity entity = fileService.getFile(fileId); + String fileName = entity.getFileName(); + String filename = URLEncoder.encode(fileName, "UTF-8"); + response.setHeader("Content-Disposition", "attachment;filename=" + filename); + response.setContentType("application/x-download"); +// File file = new File(uploadFile, entity.getSavePath()); + ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response); + + } catch (Exception ex) { + log.info(ex.getMessage(),ex); + } + } + + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/FileDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/FileDao.java new file mode 100644 index 0000000..74087c8 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/FileDao.java @@ -0,0 +1,11 @@ +package com.adc.da.report.dao.mysql; + +import com.adc.da.report.eo.FileEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Author doudxw + * @Date 2021/6/28 15:19 + */ +public interface FileDao extends BaseMapper { +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LabelDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LabelDao.java new file mode 100644 index 0000000..b0d304d --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LabelDao.java @@ -0,0 +1,14 @@ +package com.adc.da.report.dao.mysql; + +import com.adc.da.report.eo.LabelEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Author doudxw + * @Date 2021/11/9 13:53 + */ +public interface LabelDao extends BaseMapper { + + int getMaxNum(@Param("type")String type); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LogDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LogDao.java new file mode 100644 index 0000000..aadf609 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/LogDao.java @@ -0,0 +1,11 @@ +package com.adc.da.report.dao.mysql; + +import com.adc.da.report.eo.LogEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Author doudxw + * @Date 2021/11/10 13:55 + */ +public interface LogDao extends BaseMapper { +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java new file mode 100644 index 0000000..210fa97 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java @@ -0,0 +1,33 @@ +package com.adc.da.report.dao.mysql; + +import com.adc.da.report.eo.ReportEntity; +import com.adc.da.report.vo.ReportQueryVo; +import com.adc.da.report.vo.ReportVo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/9 08:35 + */ +public interface ReportDao extends BaseMapper { + + /** + * 报告列表 + * @param page + * @param vo + * @return + */ + IPage list(IPage page, @Param("Vo") ReportQueryVo vo); + + /** + * 报告日期列表 + * @param usid + * @return + */ + List getReportDateList(@Param("usid")String usid); + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportUserDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportUserDao.java new file mode 100644 index 0000000..9d7ef9c --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportUserDao.java @@ -0,0 +1,11 @@ +package com.adc.da.report.dao.mysql; + +import com.adc.da.report.eo.ReportUserEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Author doudxw + * @Date 2021/11/9 09:03 + */ +public interface ReportUserDao extends BaseMapper { +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/FileEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/FileEntity.java new file mode 100644 index 0000000..5e25bda --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/FileEntity.java @@ -0,0 +1,66 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @Author doudxw + * @Date 2021/6/28 14:32 + */ +@Data +@TableName("TS_FILE") +public class FileEntity { + + /** + * 文件id + */ + @TableId(value = "FILE_ID",type = IdType.INPUT) + private String fileId; + + /** + * 类型 + */ + @TableField("CONTENT_TYPE") + private String contentType; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private Date createTime; + + /** + * 文件名称 + */ + @TableField("FILE_NAME") + private String fileName; + + /** + * 文件后缀 + */ + @TableField("FILE_TYPE") + private String fileType; + + /** + * 存储路径 + */ + @TableField("SAVE_PATH") + private String savePath; + + /** + * 用户id + */ + @TableField("USER_ID") + private String userId; + + /** + * 文件大小 + */ + @TableField("FILE_SIZE") + private String fileSize; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java new file mode 100644 index 0000000..ba067b7 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java @@ -0,0 +1,54 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * @Author doudxw + * @Date 2021/11/9 13:49 + */ +@Data +@Accessors(chain = true) +@TableName("TS_LABEL") +public class LabelEntity { + + /** + * id + */ + @TableId(value = "id",type = IdType.INPUT) + private String id; + + /** + * 标签名 + */ + @TableField("name") + private String name; + + /** + * 标签类型 + */ + @TableField("type") + private String type; + + /** + * 父id + */ + @TableField("parentId") + private String parentId; + + /** + * 创建时间 + */ + @TableField("createDate") + private String createDate; + + @TableField("orderNum") + private int orderNum; + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/LogEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/LogEntity.java new file mode 100644 index 0000000..c761dec --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/LogEntity.java @@ -0,0 +1,96 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @Author doudxw + * @Date 2021/11/10 13:49 + */ +@Data +@TableName("TS_LOG") +public class LogEntity { + + /** + * id + */ + @TableId(value = "ID",type = IdType.AUTO) + private int id; + + /** + * 账号 + */ + @TableField("ACCOUNT") + private String account; + + /** + * 类名 + */ + @TableField("CLASS_NAME") + private String className; + + /** + * 操作 + */ + @TableField("DESCRIPTION") + private String description; + + /** + * 方法名 + */ + @TableField("METHOD") + private String method; + + /** + * 操作时间 + */ + @TableField("OPERATE_TIME") + private String operateTime; + + /** + * 开始时间 + */ + @TableField("START_TIME") + private String startTime; + + /** + * 结束时间 + */ + @TableField("END_TIME") + private String endTime; + + /** + * 浏览器 + */ + @TableField("BROWSER") + private String browser; + + /** + * ipaddress + */ + @TableField("IP_ADDRESS") + private String ipAddress; + + /** + * 用户姓名 + */ + @TableField("USER_NAME") + private String userName; + + /** + * 用户id + */ + @TableField("USID") + private String usid; + + /** + * 报告名称 + */ + @TableField("REPORTNAME") + private String reportName; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java new file mode 100644 index 0000000..fbdae99 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java @@ -0,0 +1,109 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/9 08:16 + */ +@Data +@TableName("TT_REPORT_MANAGE") +public class ReportEntity { + + /** + * id + */ + @TableId(value = "id",type = IdType.INPUT) + private String id; + + /** + * 报告名 + */ + @TableField("name") + private String name; + + /** + * 关键字 + */ + @TableField("keycontent") + private String keyContent; + + /** + * 主要内容 + */ + @TableField("maincontent") + private String mainContent; + + /** + * 部门 + */ + @TableField("department") + private String department; + + /** + * 年 + */ + @TableField("year") + private String year; + + /** + * 标签1id + */ + @TableField("labelOneId") + private String labelOneId; + + /** + * 标签2id + */ + @TableField("labelTwoId") + private String labelTwoId; + + /** + * 标签3id + */ + @TableField("labelThreeId") + private String labelThreeId; + + /** + * 文件id + */ + @TableField("fileId") + private String fileId; + + /** + * 创建人id + */ + @TableField("createUserId") + private String createUserId; + + /** + * 创建时间 + */ + @TableField("createDate") + private String createDate; + + /** + * 修改时间 + */ + @TableField("updateDate") + private String updateDate; + + /** + * 删除标志 + */ + @TableField("del_flag") + private String delFlag; + + /** + * 用户id列表 + */ + @TableField(exist = false) + private List reportUserIdList; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportUserEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportUserEntity.java new file mode 100644 index 0000000..d88a7bd --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportUserEntity.java @@ -0,0 +1,27 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @Author doudxw + * @Date 2021/11/9 08:58 + */ +@Data +@TableName("TR_REPORT_USER") +public class ReportUserEntity { + + /** + * 报告id + */ + @TableField("reportId") + private String reportId; + + /** + * 用户id + */ + @TableField("userId") + private String userId; + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IFileService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IFileService.java new file mode 100644 index 0000000..c220c44 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IFileService.java @@ -0,0 +1,25 @@ +package com.adc.da.report.service; + + +import com.adc.da.report.eo.FileEntity; + +/** + * @Author doudxw + * @Date 2021/8/2 14:09 + */ +public interface IFileService { + + /** + * 新增文件 + * @param entity + */ + void addFile(FileEntity entity); + + /** + * 根据文件id获取文件 + * @param fileId + * @return + */ + FileEntity getFile(String fileId); + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/ILabelService.java b/adc-da-report/src/main/java/com/adc/da/report/service/ILabelService.java new file mode 100644 index 0000000..1e207aa --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/ILabelService.java @@ -0,0 +1,38 @@ +package com.adc.da.report.service; + +import com.adc.da.report.eo.LabelEntity; +import com.adc.da.report.vo.LabelAllVo; + +import java.util.Map; +import java.util.concurrent.ExecutionException; + +/** + * @Author doudxw + * @Date 2021/11/9 13:53 + */ +public interface ILabelService { + + /** + * 插入或编辑标签 + * @param entity + */ + void insert(LabelEntity entity); + + /** + * 标签列表展示 + * @return + * @throws ExecutionException + * @throws InterruptedException + */ + Map list() throws ExecutionException, InterruptedException; + + /** + * 标签删除 + * @param id + */ + boolean delete(String id); + + void save(LabelAllVo vo); + + void move(String id,String type,String moveType); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/ILogService.java b/adc-da-report/src/main/java/com/adc/da/report/service/ILogService.java new file mode 100644 index 0000000..b99c641 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/ILogService.java @@ -0,0 +1,36 @@ +package com.adc.da.report.service; + +import com.adc.da.report.eo.LogEntity; +import com.adc.da.report.vo.LogVo; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.text.ParseException; +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/10 13:57 + */ +public interface ILogService { + + /** + * 插入日志 + * @param entity + */ + void insert(LogEntity entity); + + /** + * 日志列表 + * @param pageNo + * @param pageSize + * @param doName + * @param reportName + * @param startDate + * @param endDate + * @return + * @throws ParseException + */ + IPage list(int pageNo,int pageSize,String doName,String reportName + ,String startDate,String endDate) throws ParseException; + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java new file mode 100644 index 0000000..e4b615d --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java @@ -0,0 +1,48 @@ +package com.adc.da.report.service; + +import com.adc.da.report.eo.ReportEntity; +import com.adc.da.report.vo.ReportQueryVo; +import com.adc.da.report.vo.ReportVo; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/9 08:37 + */ +public interface IReportService { + + /** + * 新增或编辑报告 + * @param entity + * @return 报告名称 + */ + String insert(ReportEntity entity); + + /** + * 报告列表展示 + * @param vo + * @return + */ + IPage list(ReportQueryVo vo) throws Exception; + + /** + * 删除报告 + * @param ids + */ + List delete(String ids); + + /** + * 获取日期列表 + * @return + */ + List getReportDateList() throws Exception; + + /** + * 获取报告htmlString + * @param id + * @return + */ + String reportHtml(String id); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IFileServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IFileServiceImpl.java new file mode 100644 index 0000000..7a5eba7 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IFileServiceImpl.java @@ -0,0 +1,39 @@ +package com.adc.da.report.service.impl; + +import com.adc.da.report.dao.mysql.FileDao; +import com.adc.da.report.eo.FileEntity; +import com.adc.da.report.service.IFileService; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; + +/** + * @Author doudxw + * @Date 2021/11/8 15:00 + */ +@Service +public class IFileServiceImpl implements IFileService { + + @Resource + private FileDao fileDao; + + + /** + * 添加文件 + * @param entity + */ + @Override + public void addFile(FileEntity entity) { + fileDao.insert(entity); + } + + /** + * 根据文件id获取文件 + * @param fileId + * @return + */ + @Override + public FileEntity getFile(String fileId) { + FileEntity fileEntity = fileDao.selectById(fileId); + return fileEntity; + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILabelServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILabelServiceImpl.java new file mode 100644 index 0000000..75481b2 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILabelServiceImpl.java @@ -0,0 +1,330 @@ +package com.adc.da.report.service.impl; + +import com.adc.da.login.util.CommonUtils; +import com.adc.da.report.dao.mysql.LabelDao; +import com.adc.da.report.dao.mysql.ReportDao; +import com.adc.da.report.eo.LabelEntity; +import com.adc.da.report.eo.ReportEntity; +import com.adc.da.report.service.ILabelService; +import com.adc.da.report.vo.LabelAllVo; +import com.adc.da.report.vo.LabelVo; +import com.adc.da.sys.vo.LabelReturnVo; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.utils.StringUtils; +import com.adc.da.util.utils.UUID; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.stream.Collectors; + +/** + * @Author doudxw + * @Date 2021/11/9 13:58 + */ +@Slf4j +@Service +public class ILabelServiceImpl implements ILabelService { + + @Resource + private LabelDao labelDao; + + @Resource + private ReportDao reportDao; + + /** + * 新增或编辑标签 + * + * @param entity + */ + @Override + public void insert(LabelEntity entity) { + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (!"0".equals(entity.getParentId())) { + int count = labelDao.selectCount(new QueryWrapper() + .eq("id", entity.getParentId())); + if (count == 0) { + throw new AdcDaBaseException("父标签不存在"); + } + + } + if (StringUtils.isEmpty(entity.getId())) { + entity.setId(UUID.randomUUID10()); + entity.setCreateDate(format.format(new Date())); + if (!"0".equals(entity.getParentId())) { + int maxNum = labelDao.getMaxNum(entity.getType()); + entity.setOrderNum(maxNum + 1); + } + labelDao.insert(entity); + } else { + LabelEntity labelEntity = labelDao.selectById(entity.getId()); + entity.setOrderNum(labelEntity.getOrderNum()); + labelDao.updateById(entity); + } + } + + /** + * 标签列表 + * + * @return + * @throws ExecutionException + * @throws InterruptedException + */ + @Override + public Map list() throws ExecutionException, InterruptedException { + //找到三类标签 + List lableList = CommonUtils.getLableList(); + + CompletableFuture[] completableFuture = new CompletableFuture[lableList.size()]; + + Map reMap = new ConcurrentHashMap<>(); + + //标签类型遍历 + for (int i = 0; i < lableList.size(); i++) { + + int j = i; + + CompletableFuture future = CompletableFuture.runAsync(() -> { + String value = lableList.get(j).getValue(); + Map map = new HashMap<>(); + + //父标签 + LabelEntity entity = labelDao.selectOne(new QueryWrapper() + .eq("type", value).eq("parentId", "0")); + //标签大类的名称 + map.put("name", entity.getName()); + map.put("id", entity.getId()); + map.put("type", entity.getType()); + map.put("parentId", "0"); + + + //父标签下所有的子标签 + List childList = labelDao.selectList( + new QueryWrapper().eq("parentId", entity.getId()).orderByAsc("orderNum")); + List> child = childList.stream().map(c -> { + Map detailmap = new HashMap<>(); + detailmap.put("id", c.getId()); + detailmap.put("name", c.getName()); + detailmap.put("type", c.getType()); + //标签是否被使用 + detailmap.put("status", isBeUsed(c.getId())); + detailmap.put("parentId", c.getParentId()); + return detailmap; + }).collect(Collectors.toList()); + + map.put("childList", child); + reMap.put(lableList.get(j).getName(), map); + log.info(lableList.get(j).getName() + "---------执行完成-------"); + }, CommonUtils.threadPoolExecutor()); + + completableFuture[i] = future; + + } + CompletableFuture.allOf(completableFuture).get(); + return reMap; + } + + /** + * 删除标签 + * + * @param id + * @return + */ + @Override + public boolean delete(String id) { + LabelEntity labelEntity = labelDao.selectById(id); + int currentNum = labelEntity.getOrderNum(); + int maxNum=labelDao.getMaxNum(labelEntity.getType()); + List labelList = labelDao.selectList(new QueryWrapper().gt("orderNum", currentNum) + .le("orderNum", maxNum)); + for (LabelEntity entity : labelList) { + entity.setOrderNum(entity.getOrderNum()-1); + labelDao.updateById(entity); + } + labelDao.delete(new QueryWrapper().eq("id", id)); + return true; + } + + /** + * 批量保存标签 + * + * @param vo + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(LabelAllVo vo) { + + List allIdList = new ArrayList<>(); + + //更新所有的父标签 + vo.getLabelList().forEach(c -> { + LabelEntity entity = new LabelEntity(); + BeanUtils.copyProperties(c, entity); + labelDao.updateById(entity); + //更新子标签 + List idList = childListSave(c.getChildList()); + allIdList.add(entity.getId()); + allIdList.addAll(idList); + }); + + //删除标签 + labelDao.delete(new QueryWrapper().notIn("id", allIdList)); + } + + /** + * 子标签更新 + * + * @param list + * @return + */ + private List childListSave(List list) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List idList = new ArrayList<>(); + list.forEach(c -> { + LabelEntity entity = new LabelEntity(); + BeanUtils.copyProperties(c, entity); + if (StringUtils.isEmpty(entity.getId())) { + entity.setId(UUID.randomUUID10()); + entity.setCreateDate(format.format(new Date())); + if (!"0".equals(entity.getParentId())) { + int maxNum = labelDao.getMaxNum(entity.getType()); + entity.setOrderNum(maxNum + 1); + } + labelDao.insert(entity); + } else { + LabelEntity labelEntity = labelDao.selectById(entity.getId()); + entity.setOrderNum(labelEntity.getOrderNum()); + labelDao.updateById(entity); + } + idList.add(entity.getId()); + }); + return idList; + } + + private String isBeUsed(String labelId) { + int count = reportDao.selectCount(new QueryWrapper().eq("labelOneId", labelId) + .or(c -> c.eq("labelTwoId", labelId).or(f -> f.eq("labelThreeId", labelId)))); + if (count > 0) { + return "1"; + } else { + return "0"; + } + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void move(String id, String type, String moveType) { + synchronized (this) { + switch (moveType) { + //上移 + case "up": + up(id,type); + break; + //下移 + case "down": + down(id,type); + break; + //置顶 + case "top": + top(id,type); + break; + //置尾 + case "last": + last(id,type); + break; + default: + break; + } + } + } + + /** + * 上移 + * @param id + * @param type + */ + private void up(String id, String type){ + LabelEntity labelEntity = labelDao.selectById(id); + if(!"1".equals(labelEntity.getOrderNum())){ + int currentNum=labelEntity.getOrderNum(); + int preNum=labelEntity.getOrderNum()-1; + LabelEntity preEntity = labelDao.selectOne(new QueryWrapper().eq("type", type) + .eq("orderNum", preNum)); + //将当前数据上移 + labelEntity.setOrderNum(preNum); + labelDao.updateById(labelEntity); + + //将原先数据下移一位 + preEntity.setOrderNum(currentNum); + labelDao.updateById(preEntity); + } + } + + /** + * 下移 + * @param id + * @param type + */ + private void down(String id, String type){ + LabelEntity labelEntity = labelDao.selectById(id); + int maxNum = labelDao.getMaxNum(type); + if(maxNum!=labelEntity.getOrderNum()){ + int nextNum=labelEntity.getOrderNum()+1; + int currentNum=labelEntity.getOrderNum(); + + //将原先数据上移一位 + + LabelEntity nextEntity = labelDao.selectOne(new QueryWrapper().eq("type", type) + .eq("orderNum", nextNum)); + nextEntity.setOrderNum(currentNum); + labelDao.updateById(nextEntity); + + //将当前数据下移 + labelEntity.setOrderNum(nextNum); + labelDao.updateById(labelEntity); + } + } + + private void top(String id, String type){ + LabelEntity labelEntity = labelDao.selectById(id); + int currentNum = labelEntity.getOrderNum(); + List labelList = labelDao.selectList(new QueryWrapper().lt("orderNum", currentNum) + .gt("orderNum", 0).eq("type", type).orderByAsc("orderNum")); + + for (int i = 0; i < labelList.size(); i++) { + LabelEntity entity = labelList.get(i); + entity.setOrderNum(i+2); + labelDao.updateById(entity); + } + + labelEntity.setOrderNum(1); + labelDao.updateById(labelEntity); + } + + private void last(String id, String type){ + LabelEntity labelEntity = labelDao.selectById(id); + int currentNum = labelEntity.getOrderNum(); + int maxNum = labelDao.getMaxNum(type); + List labelList = labelDao.selectList(new QueryWrapper().le("orderNum", maxNum) + .gt("orderNum", currentNum).eq("type", type).orderByAsc("orderNum")); + + for (int i = 0; i < labelList.size(); i++) { + LabelEntity entity = labelList.get(i); + entity.setOrderNum(entity.getOrderNum()-1); + labelDao.updateById(entity); + } + + labelEntity.setOrderNum(maxNum); + labelDao.updateById(labelEntity); + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILogServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILogServiceImpl.java new file mode 100644 index 0000000..6f2874d --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ILogServiceImpl.java @@ -0,0 +1,112 @@ +package com.adc.da.report.service.impl; + +import com.adc.da.report.dao.mysql.LogDao; +import com.adc.da.report.eo.LogEntity; +import com.adc.da.report.service.ILogService; +import com.adc.da.report.vo.LogVo; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author doudxw + * @Date 2021/11/10 13:59 + */ +@Service +public class ILogServiceImpl implements ILogService { + + @Resource + private LogDao logDao; + + /** + * 添加报告日志 + * + * @param entity + */ + @Override + public void insert(LogEntity entity) { + logDao.insert(entity); + } + + /** + * 报告日志列表 + * + * @param pageNo + * @param pageSize + * @param doName + * @param reportName + * @param startDate + * @param endDate + * @return + */ + @Override + public IPage list(int pageNo, int pageSize, String doName, String reportName + , String startDate, String endDate) { + IPage page = new Page<>(); + page.setSize(pageSize); + page.setCurrent(pageNo); + + //初始化wrapper + QueryWrapper wrapper = new QueryWrapper(); + + + if (StringUtils.isNotEmpty(doName)) { + //操作名称分割 + String[] doList = doName.split(","); + //遍历名称 + switch (doList.length) { + case 1: + wrapper.and(c -> c.like("DESCRIPTION", doList[0])); + break; + case 2: + wrapper.and(c -> c.like("DESCRIPTION", doList[0]).or().like("DESCRIPTION", doList[1])); + break; + case 3: + wrapper.and(c -> c.like("DESCRIPTION", doList[0]).or() + .like("DESCRIPTION", doList[1]).or().like("DESCRIPTION", doList[2])); + break; + default: + break; + + } + + } + + //报告名称 + if (StringUtils.isNotEmpty(reportName)) { + wrapper.and(c -> c.like("REPORTNAME", reportName)); + } + //开始时间 + if (StringUtils.isNotEmpty(startDate)) { + wrapper.and(c -> c.ge("OPERATE_TIME", startDate)); + } + + //结束时间 + if (StringUtils.isNotEmpty(endDate)) { + wrapper.and(c -> c.le("OPERATE_TIME", endDate + "23:59:59")); + } + //操作时间排序 + wrapper.orderByDesc("OPERATE_TIME"); + + IPage pageList = logDao.selectPage(page, wrapper); + + IPage retuPage = new Page<>(); + BeanUtils.copyProperties(pageList, retuPage); + //返回值映射vo + List voList = pageList.getRecords().stream().map(c -> { + LogVo vo = new LogVo(); + BeanUtils.copyProperties(c, vo); + return vo; + }).collect(Collectors.toList()); + + retuPage.setRecords(voList); + return retuPage; + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java new file mode 100644 index 0000000..a998ef0 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -0,0 +1,316 @@ +package com.adc.da.report.service.impl; + +import com.adc.da.login.util.CommonUtils; +import com.adc.da.report.dao.mysql.FileDao; +import com.adc.da.report.dao.mysql.ReportDao; +import com.adc.da.report.dao.mysql.ReportUserDao; +import com.adc.da.report.eo.FileEntity; +import com.adc.da.report.eo.ReportEntity; +import com.adc.da.report.eo.ReportUserEntity; +import com.adc.da.report.service.IReportService; +import com.adc.da.report.util.*; +import com.adc.da.report.vo.ReportQueryVo; +import com.adc.da.report.vo.ReportVo; +import com.adc.da.util.utils.FileUtil; +import com.adc.da.util.utils.StringUtils; +import com.adc.da.util.utils.UUID; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @Author doudxw + * @Date 2021/11/9 08:37 + */ + +@Slf4j +@Service +public class IReportServiceImpl implements IReportService { + + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Resource + private ReportDao reportDao; + + @Resource + private ReportUserDao reportUserDao; + + @Resource + private FileDao fileDao; + + @Value("${uploadFile}") + private String uploadFile; + + @Value("${IPANDPORT}") + private String ipAddress; + + @Resource + private OSSClientUtil ossClientUtil; + + /** + * 新增或编辑报告 + * + * @param entity + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public String insert(ReportEntity entity) { + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (StringUtils.isEmpty(entity.getId())) { + entity.setId(UUID.randomUUID10()); + entity.setCreateDate(format.format(new Date())); + entity.setCreateUserId(CommonUtils.getUserId()); + entity.setDelFlag("0"); + entity.setUpdateDate(format.format(new Date())); + reportDao.insert(entity); + + //插入用户关系表 + entity.getReportUserIdList().forEach(c -> { + ReportUserEntity reportUserEntity = new ReportUserEntity(); + reportUserEntity.setReportId(entity.getId()); + reportUserEntity.setUserId(c); + reportUserDao.insert(reportUserEntity); + }); + + CommonUtils.threadPoolExecutor().execute(() -> { + //生成html + try { + String htmlString = createHtmlString(entity.getFileId()); + + log.info("执行完成html" + htmlString); + + //key:报告id-文件id + String key = entity.getId() + "-" + entity.getFileId(); + stringRedisTemplate.boundValueOps(key).set(htmlString); + log.info(key + "已经存好"); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + }); + + } else { + entity.setUpdateDate(format.format(new Date())); + reportDao.updateById(entity); + reportUserDao.delete(new QueryWrapper() + .eq("reportId", entity.getId())); + + //插入用户关系表 + entity.getReportUserIdList().forEach(c -> { + ReportUserEntity reportUserEntity = new ReportUserEntity(); + reportUserEntity.setReportId(entity.getId()); + reportUserEntity.setUserId(c); + reportUserDao.insert(reportUserEntity); + }); + + CommonUtils.threadPoolExecutor().execute(() -> { + String key = entity.getId() + "-" + entity.getFileId(); + Boolean hasKey = stringRedisTemplate.hasKey(key); + if (!hasKey) { + String htmlString = null; + try { + htmlString = createHtmlString(entity.getFileId()); + stringRedisTemplate.boundValueOps(key).set(htmlString); + log.info(key + "已经更新"); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } else { + log.info(key + "存在不需要更新"); + } + }); + + } + + return entity.getName(); + } + + /** + * 报告列表 + * + * @param vo + * @return + * @throws Exception + */ + @Override + public IPage list(ReportQueryVo vo) throws Exception { + + IPage page = new Page<>(); + page.setCurrent(vo.getPageNo()); + page.setSize(vo.getPageSize()); + + //判断是不是管理员 + boolean admin = CommonUtils.isAdmin(); + if (admin) { + vo.setUsid(null); + } else { + vo.setUsid(CommonUtils.getUserId()); + } + + + IPage list = reportDao.list(page, vo); + list.getRecords().forEach(c -> { + FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity()); + if (StringUtils.isEmpty(fileEntity.getFileType())) { + c.setFileType(null); + } + //ppt文件 + else if ("ppt".equals(fileEntity.getFileType().toLowerCase()) || "pptx".equals(fileEntity.getFileType())) { + c.setFileType("1"); + } + //excel文件 + else if ("xls".equals(fileEntity.getFileType().toLowerCase()) || "xlsx".equals(fileEntity.getFileType())) { + c.setFileType("2"); + } + //pdf文件 + else if ("pdf".equals(fileEntity.getFileType().toLowerCase())) { + c.setFileType("3"); + } + //word文件 + else { + c.setFileType("4"); + } + + //文件大小 + c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize()) + ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb"); + c.setFileName(fileEntity.getFileName()); + List userIdList = reportUserDao.selectList( + new QueryWrapper().eq("reportId", c.getId())) + .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList()); + c.setReportUserIdList(userIdList); + }); + + + return list; + } + + /** + * 报告删除 + * + * @param ids + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public List delete(String ids) { + List nameList = new ArrayList<>(); + String[] idList = ids.split(","); + for (String id : idList) { + ReportEntity entity = reportDao.selectById(id); + entity.setDelFlag("1"); + reportDao.updateById(entity); + //删除redis中的key + String key = entity.getId() + "-" + entity.getFileId(); + stringRedisTemplate.delete(key); + log.info(key + "已经删除"); + nameList.add(entity.getName()); + } + return nameList; + } + + /** + * 报告日期列表 + * + * @return + * @throws Exception + */ + @Override + public List getReportDateList() throws Exception { + String userId = CommonUtils.getUserId(); + boolean admin = CommonUtils.isAdmin(); + if (admin) { + userId = null; + } + return reportDao.getReportDateList(userId); + } + + + /** + * 报告html + * + * @param id + * @return + */ + @Override + public String reportHtml(String id) { + try { + ReportEntity entity = reportDao.selectById(id); + String key = entity.getId() + "-" + entity.getFileId(); + String html = stringRedisTemplate.boundValueOps(key).get(); + return html; + } catch (Exception ex) { + return ""; + } + + } + + /** + * 创建htmlstring + * + * @param fileId + * @return + * @throws Exception + */ + public String createHtmlString(String fileId) throws Exception { + FileEntity fileEntity = fileDao.selectById(fileId); + String path = uploadFile + fileEntity.getSavePath(); + FileOutputStream outputStream = new FileOutputStream(path); + ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream); + + String html = null; + switch (fileEntity.getFileType()) { + //03excel + case "xls": + html = ExcelUtil.excel03Html(new FileInputStream(path)); + break; + //07excel + case "xlsx": + html = ExcelUtil.excel07Html(new FileInputStream(path)); + break; + //03word + case "doc": + html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); + break; + //07word + case "docx": + html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); + break; + //03ppt + case "ppt": + html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress); + break; + //07ppt + case "pptx": + html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress); + break; + //pdf + case "pdf": + html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress); + break; + default: + break; + } + FileUtil.deleteFile(path); + return html; + } +} + diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/ExcelUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/ExcelUtil.java new file mode 100644 index 0000000..1f759f2 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/ExcelUtil.java @@ -0,0 +1,46 @@ +package com.adc.da.report.util; + +import cn.afterturn.easypoi.cache.manager.POICacheManager; +import cn.afterturn.easypoi.excel.ExcelXorHtmlUtil; +import cn.afterturn.easypoi.excel.entity.ExcelToHtmlParams; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import java.io.IOException; +import java.io.InputStream; + +/** + * @Author doudxw + * @Date 2021/11/11 10:06 + */ +public class ExcelUtil { + + private ExcelUtil(){ + throw new IllegalStateException("Utility class"); + } + + /** + * 07 版本EXCEL预览 + * @param filePath + * @return + * @throws IOException + * @throws InvalidFormatException + */ + public static String excel07Html(InputStream inputStream) throws IOException, InvalidFormatException { + ExcelToHtmlParams params = new ExcelToHtmlParams(WorkbookFactory.create( + inputStream)); + return ExcelXorHtmlUtil.excelToHtml(params); + } + + /** + * 03 版本EXCEL预览 + * @param filePath + * @return + * @throws IOException + * @throws InvalidFormatException + */ + public static String excel03Html(InputStream inputStream) throws IOException, InvalidFormatException { + ExcelToHtmlParams params = new ExcelToHtmlParams(WorkbookFactory.create( + inputStream)); + return ExcelXorHtmlUtil.excelToHtml(params); + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/OSSClientUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/OSSClientUtil.java new file mode 100644 index 0000000..edea0d9 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/OSSClientUtil.java @@ -0,0 +1,275 @@ +package com.adc.da.report.util; + +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.utils.DateUtils; +import com.adc.da.util.utils.StringUtils; +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.model.*; +import lombok.Data; +import lombok.extern.log4j.Log4j; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URL; +import java.util.Date; +import java.util.List; + +/** + * @ProjectName: Hematopathy + * @Package: com.jeeplus.oss.utils + * @ClassName: OSSUtil + * @Author: MC + * @Description: ${description} + * @Date: 2019/11/16 0016 10:34 + * @Version: 1.0 + */ +@Component +@Data +@Slf4j +public class OSSClientUtil { + @Value("${aliyun.OSS.endpoint}") + private String endpoint; + @Value("${aliyun.OSS.accessKeyId}") + private String accessKeyId; + @Value("${aliyun.OSS.accessKeySecret}") + private String accessKeySecret; + //空间 + @Value("${aliyun.OSS.bucketName}") + private String bucketName; + //文件存储目录 + @Value("${uploadFile}") + private String filedir; + + + /** + * 上传到OSS服务器 如果同名文件会覆盖服务器上的 + * + * @param instream 文件流 + * @param fileName 文件名称 包括后缀名 + * @return 出错返回"" ,唯一MD5数字签名 + */ + public String uploadFile2OSS(InputStream instream, String fileName) { + + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + PutObjectResult putObjectResult = new PutObjectResult(); + try { + putObjectResult = ossClient.putObject(bucketName, fileName, instream); + } catch (OSSException oe) { + System.out.println("Caught an OSSException, which means your request made it to OSS, " + + "but was rejected with an error response for some reason."); + System.out.println("Error Message:" + oe.getErrorMessage()); + System.out.println("Error Code:" + oe.getErrorCode()); + System.out.println("Request ID:" + oe.getRequestId()); + System.out.println("Host ID:" + oe.getHostId()); + throw new AdcDaBaseException("OSS连接失败: "+ oe.getErrorMessage()); + } catch (ClientException ce) { + System.out.println("Caught an ClientException, which means the client encountered " + + "a serious internal problem while trying to communicate with OSS, " + + "such as not being able to access the network."); + System.out.println("Error Message:" + ce.getMessage()); + throw new AdcDaBaseException("OSS连接失败,请检查网络"); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + return putObjectResult.getRequestId(); + } + + public void downloadFileFromOSS(String objectName,HttpServletResponse response) throws IOException { + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + PutObjectResult putObjectResult = new PutObjectResult(); + try { + // 调用ossClient.getObject返回一个OSSObject实例,该实例包含文件内容及文件元信息。 + OSSObject ossObject = ossClient.getObject(bucketName, objectName); + // 调用ossObject.getObjectContent获取文件输入流,可读取此输入流获取其内容。 + InputStream content = ossObject.getObjectContent(); + if (content != null) { + byte[] bt = new byte[1024 * 1024]; + int len = 0; + while ((len = content.read(bt)) != -1) { + response.getOutputStream().write(bt, 0, len); + } + // 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 + content.close(); + response.getOutputStream().close(); + } + } catch (OSSException oe) { + System.out.println("Caught an OSSException, which means your request made it to OSS, " + + "but was rejected with an error response for some reason."); + System.out.println("Error Message:" + oe.getErrorMessage()); + System.out.println("Error Code:" + oe.getErrorCode()); + System.out.println("Request ID:" + oe.getRequestId()); + System.out.println("Host ID:" + oe.getHostId()); + throw new AdcDaBaseException("OSS连接失败: "+ oe.getErrorMessage()); + } catch (ClientException ce) { + System.out.println("Caught an ClientException, which means the client encountered " + + "a serious internal problem while trying to communicate with OSS, " + + "such as not being able to access the network."); + System.out.println("Error Message:" + ce.getMessage()); + throw new AdcDaBaseException("OSS连接失败,请检查网络"); + + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public void getFileFromOSS(String objectName,FileOutputStream outputStream) throws IOException { + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + PutObjectResult putObjectResult = new PutObjectResult(); + try { + // 调用ossClient.getObject返回一个OSSObject实例,该实例包含文件内容及文件元信息。 + OSSObject ossObject = ossClient.getObject(bucketName, objectName); + // 调用ossObject.getObjectContent获取文件输入流,可读取此输入流获取其内容。 + InputStream content = ossObject.getObjectContent(); + if (content != null) { + byte[] bt = new byte[1024 * 1024]; + int len = 0; + while ((len = content.read(bt)) != -1) { + outputStream.write(bt, 0, len); + } + // 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 + content.close(); + outputStream.close(); + } + } catch (OSSException oe) { + System.out.println("Caught an OSSException, which means your request made it to OSS, " + + "but was rejected with an error response for some reason."); + System.out.println("Error Message:" + oe.getErrorMessage()); + System.out.println("Error Code:" + oe.getErrorCode()); + System.out.println("Request ID:" + oe.getRequestId()); + System.out.println("Host ID:" + oe.getHostId()); + throw new AdcDaBaseException("OSS连接失败: "+ oe.getErrorMessage()); + } catch (ClientException ce) { + System.out.println("Caught an ClientException, which means the client encountered " + + "a serious internal problem while trying to communicate with OSS, " + + "such as not being able to access the network."); + System.out.println("Error Message:" + ce.getMessage()); + throw new AdcDaBaseException("OSS连接失败,请检查网络"); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + /** + * Description: 判断OSS服务文件上传时文件的contentType + * + * @param FilenameExtension 文件后缀 + * @return String + */ + public static String getcontentType(String FilenameExtension) { + if (FilenameExtension.equalsIgnoreCase(".bmp")) { + return "image/bmp"; + } + if (FilenameExtension.equalsIgnoreCase(".gif")) { + return "image/gif"; + } + if (FilenameExtension.equalsIgnoreCase(".jpeg") || + FilenameExtension.equalsIgnoreCase(".jpg") || + FilenameExtension.equalsIgnoreCase(".png")) { + return "image/jpeg"; + } + if (FilenameExtension.equalsIgnoreCase(".html")) { + return "text/html"; + } + if (FilenameExtension.equalsIgnoreCase(".txt")) { + return "text/plain"; + } + if (FilenameExtension.equalsIgnoreCase(".vsd")) { + return "application/vnd.visio"; + } + if (FilenameExtension.equalsIgnoreCase(".pptx") || + FilenameExtension.equalsIgnoreCase(".ppt")) { + return "application/vnd.ms-powerpoint"; + } + if (FilenameExtension.equalsIgnoreCase(".docx") || + FilenameExtension.equalsIgnoreCase(".doc")) { + return "application/msword"; + } + if (FilenameExtension.equalsIgnoreCase(".xml")) { + return "text/xml"; + } + return "image/jpeg"; + } + + /** + * 获得url链接 + * + * @param key + * @return + */ + public String getUrl(String key, OSS ossClient) { + // 设置URL过期时间为10年 3600l* 1000*24*365*10 + Date nowDate = new Date(); + long time = nowDate.getTime(); + Date expiration = new Date(time + 3600L * 1000 * 24 * 365 * 10); + // 生成URL + URL url = ossClient.generatePresignedUrl(bucketName, key, expiration); + if (url != null) { + return url.toString(); + } + return null; + } + + + /** + * 删除某个Object + * http://127.0.0.1:8080/a/oss/del?url= sys/2019-11-16MC11:34:52.png + * + * @param bucketUrl + * @return + */ + public boolean deleteObject(String bucketUrl, OSS ossClient) { +// try { +// boolean b = ossClient.doesObjectExist(bucketName, bucketUrl); +// System.out.println("查询文件是否存在:"+b + "================================="); +// if(!b){ +// System.out.println("Error: OSS file not find,file:{} ==============="); +// return false; +// } +// // 删除Object. +// ossClient.deleteObject(bucketName, bucketUrl); +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } finally { +// this.destory(ossClient); +// } + return true; + } + +// /** +// * 删除多个Object +// * +// * @param bucketUrls +// * @return +// */ +// public boolean deleteObjects(List bucketUrls,OSS ossClient) { +// try { +// // 删除Object. +// DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(bucketUrls)); +// List deletedObjects = deleteObjectsResult.getDeletedObjects(); +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// return true; +// } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java new file mode 100644 index 0000000..4d09cf9 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java @@ -0,0 +1,123 @@ +package com.adc.da.report.util; + +import com.adc.da.util.utils.UUID; +import lombok.extern.slf4j.Slf4j; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.rendering.PDFRenderer; +import sun.misc.BASE64Encoder; + +import javax.imageio.ImageIO; +import javax.imageio.stream.ImageOutputStream; +import java.awt.image.BufferedImage; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class PdfUtil { + + + private PdfUtil(){ + throw new IllegalStateException("Utility class"); + } + + /** + * 截取pdf成图片 + * @param inputStream + * @param targetPath + * @param ipAddress + * @return + */ + public static String pdfStreamToPng( InputStream inputStream,String targetPath,String ipAddress) { + + try(PDDocument doc=PDDocument.load( inputStream)) { + PDFRenderer renderer = new PDFRenderer(doc); + List list=new ArrayList<>(); + int pageCount = doc.getNumberOfPages(); + BufferedImage image = null; + log.info("开始时间"+System.currentTimeMillis()); + String fileName = UUID.randomUUID10(); + for (int i = 0; i < pageCount; i++) { + image = renderer.renderImage(i, 2.0f); + image.flush(); + + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + ImageOutputStream imOut; + imOut = ImageIO.createImageOutputStream(bs); + ImageIO.write(image, "png", imOut); + + try(ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());){ + File ff=new File(targetPath+"/"+fileName); + if(!ff.exists()){ + ff.mkdirs(); + } + File uploadFile = new File(targetPath+"/"+fileName+"/"+i+".png"); + try(FileOutputStream fops = new FileOutputStream(uploadFile);){ + fops.write(readInputStream(byteInputStream)); + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + + list.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png"); + } + catch (Exception e){ + + } + + } + log.info("结束时间"+System.currentTimeMillis()); + + String htmlByBase64 = createHtmlByImg(list); + return htmlByBase64; + } catch (Exception e) { + log.error(e.getMessage(),e); + return ""; + } + } + + + private static String createHtmlByImg(List baseList) { + // 输入HTML文件内容 + StringBuffer buffer = new StringBuffer(); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + for(int i=0;i"); + } + + buffer.append(""); + try { + return buffer.toString(); + } catch (Exception e) { + log.error(e.getMessage(),e); + return ""; + } + + } + +// public static void main(String[] args) throws IOException { +// pdfStreamToPng("/Users/sxh/00000000000000000产品决策文件及代码/111.pdf","/Users/sxh/EPR/test/",null); +// } + + + public static byte[] readInputStream(InputStream inStream) throws Exception { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024*1024]; + int len = 0; + while ((len = inStream.read(buffer)) != -1) { + outStream.write(buffer, 0, len); + } + inStream.close(); + return outStream.toByteArray(); + } + +} + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/PptUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/PptUtil.java new file mode 100644 index 0000000..aab61d8 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/PptUtil.java @@ -0,0 +1,270 @@ +package com.adc.da.report.util; + +import com.adc.da.util.utils.UUID; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hslf.usermodel.HSLFShape; +import org.apache.poi.hslf.usermodel.HSLFSlide; +import org.apache.poi.hslf.usermodel.HSLFSlideShow; +import org.apache.poi.sl.usermodel.*; +import org.apache.poi.sl.usermodel.Shape; +import org.apache.poi.xslf.usermodel.*; +import org.springframework.beans.factory.annotation.Value; +import sun.misc.BASE64Encoder; + +import javax.imageio.ImageIO; +import javax.imageio.stream.ImageOutputStream; +import java.awt.*; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + + +/** + * @Author doudxw + * @Date 2021/10/26 10:04 + */ + +@Slf4j +@Data +public class PptUtil { + + private PptUtil(){ + throw new IllegalStateException("Utility class"); + } + + + /** + * ppt2003转图片 + * @param inputStream + * @param targetPath + * @param ipAddress + * @return + * @throws Exception + */ + public static String doPpt2003toImage(InputStream inputStream,String targetPath,String ipAddress) throws Exception { + + try(FileInputStream is = (FileInputStream) inputStream) { + HSLFSlideShow ppt =new HSLFSlideShow(is); + Dimension pgsize = ppt.getPageSize(); + List slides = ppt.getSlides(); + + double scale = 3; + + int width = (int) (pgsize.width * scale); + int height = (int) (pgsize.height * scale); + + List baseList=new ArrayList<>(); + String fileName = UUID.randomUUID10(); + for (int i = 0; i < slides.size(); i++) { + + List shapes = slides.get(i).getShapes(); + for (Shape shape : shapes) { + if (shape instanceof TextShape) { + TextShape sh = (TextShape) shape; + List textParagraphs = sh.getTextParagraphs(); + for (TextParagraph xslfTextParagraph : textParagraphs) { + List textRuns = xslfTextParagraph.getTextRuns(); + for (TextRun xslfTextRun : textRuns) { + xslfTextRun.setFontFamily("宋体"); + } + } + } + } + + BufferedImage img = new BufferedImage(width,height, BufferedImage.TYPE_INT_RGB); + + Graphics2D graphics = img.createGraphics(); + graphics.setPaint(Color.white); + graphics.fill(new Rectangle2D.Float(0, 0, width, height)); + + // 最核心的代码 + graphics.scale(scale, scale); + + slides.get(i).draw(graphics); + + + try(ByteArrayOutputStream bs = new ByteArrayOutputStream();){ + ImageOutputStream imOut=ImageIO.createImageOutputStream(bs); + ImageIO.write(img, "png", imOut); + + File ff=new File(targetPath+fileName); + if(!ff.exists()){ + ff.mkdirs(); + } + File uploadFile = new File(targetPath+fileName+"/"+i+".png"); + + try( InputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray()); + FileOutputStream fops = new FileOutputStream(uploadFile)){ + fops.write(readInputStream(byteInputStream)); + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + + baseList.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png"); + + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + + } + String html = createHtmlByImg(baseList); + return html; + } catch (FileNotFoundException e) { + log.error(e.getMessage(),e); + return ""; + } catch (IOException e) { + return ""; + } + } + + + /** + * ppt2007转图片 + * @param inputStream + * @param targetPath + * @param ipAddress + * @return + */ + public static String doPpt2007toImage(InputStream inputStream,String targetPath,String ipAddress) { + try( FileInputStream is=(FileInputStream)inputStream;) { + XMLSlideShow xmlSlideShow = new XMLSlideShow(is); + // 获取大小 + Dimension pgsize = xmlSlideShow.getPageSize(); + // 获取幻灯片 + List slides = xmlSlideShow.getSlides(); + double scale = 3; + + int width = (int) (pgsize.width * scale); + int height = (int) (pgsize.height * scale); + + List baseList=new ArrayList<>(); + String fileName = UUID.randomUUID10(); + for (int i = 0 ; i < slides.size() ; i++) { + // 解决乱码问题 + List shapes = slides.get(i).getShapes(); + for (XSLFShape shape : shapes) { + if (shape instanceof XSLFTextShape) { + XSLFTextShape sh = (XSLFTextShape) shape; + List textParagraphs = sh.getTextParagraphs(); + for (XSLFTextParagraph xslfTextParagraph : textParagraphs) { + List textRuns = xslfTextParagraph.getTextRuns(); + for (XSLFTextRun xslfTextRun : textRuns) { + xslfTextRun.setFontFamily("宋体"); + } + } + } + + if(shape instanceof XSLFTable){ + XSLFTable sh=(XSLFTable) shape; + List rows = sh.getRows(); + rows.forEach(c->{ + List cells = c.getCells(); + cells.forEach(a->{ + List textParagraphs = a.getTextParagraphs(); + for (XSLFTextParagraph xslfTextParagraph : textParagraphs) { + List textRuns = xslfTextParagraph.getTextRuns(); + for (XSLFTextRun xslfTextRun : textRuns) { + xslfTextRun.setFontFamily("宋体"); + } + } + }); + }); + } + + } + + //根据幻灯片大小生成图片 + BufferedImage img = new BufferedImage(width,height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = img.createGraphics(); + graphics.setPaint(Color.white); + graphics.fill(new Rectangle2D.Float(0, 0, width,height)); + // 最核心的代码 + graphics.scale(scale, scale); + + slides.get(i).draw(graphics); + + try(ByteArrayOutputStream bs = new ByteArrayOutputStream();){ + ImageOutputStream imOut=ImageIO.createImageOutputStream(bs); + ImageIO.write(img, "png", imOut); + + File ff=new File(targetPath+"/"+fileName); + if(!ff.exists()){ + ff.mkdirs(); + } + File uploadFile = new File(targetPath+"/"+fileName+"/"+i+".png"); + + try( InputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray()); + FileOutputStream fops = new FileOutputStream(uploadFile)){ + fops.write(readInputStream(byteInputStream)); + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + + baseList.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png"); + + } + catch (Exception e){ + log.error(e.getMessage(),e); + } + } + System.out.print("PPT转换成图片 成功!"); + return createHtmlByImg(baseList); + } + catch (Exception e) { + log.error(e.getMessage(),e); + // log.error("PPT转换成图片 发生异常!", e); + return ""; + } + } +// public static void main(String[] args) { +// System.out.println(doPpt2007toImage("/Users/sxh/00000000000000000产品决策文件及代码/1111.pptx",null,null)); +// } + + /** + * 创建图片拼接html + * @param baseList + * @return + */ + private static String createHtmlByImg(List baseList) { + // 输入HTML文件内容 + StringBuffer buffer = new StringBuffer(); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + buffer.append("\r\n"); + for(int i=0;i"); + } + + buffer.append(""); + try { + return buffer.toString(); + } catch (Exception e) { + log.error(e.getMessage(),e); + return ""; + } + + } + + + public static byte[] readInputStream(InputStream inStream) throws Exception { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = inStream.read(buffer)) != -1) { + outStream.write(buffer, 0, len); + } + inStream.close(); + return outStream.toByteArray(); + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/WordUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/WordUtil.java new file mode 100644 index 0000000..1f99428 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/WordUtil.java @@ -0,0 +1,78 @@ +package com.adc.da.report.util; + +import com.adc.da.util.utils.FileUtil; +import com.adc.da.util.utils.UUID; +import com.aspose.words.Document; +import com.aspose.words.FontSettings; +import com.aspose.words.License; +import com.aspose.words.PdfSaveOptions; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.ClassPathResource; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; + +/** + * @Author doudxw + * @Date 2021/11/10 15:50 + */ +@Slf4j +public class WordUtil { + + private WordUtil() { + throw new IllegalStateException("Utility class"); + } + + private static boolean getLicense() { + boolean result = false; + try { + + ClassPathResource resource = new ClassPathResource("license.xml"); + InputStream is = resource.getInputStream(); + License aposeLic = new License(); + aposeLic.setLicense(is); + result = true; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + public static String doc2pdf(InputStream inputStream, String targetPath, String ipAddress) { + // 验证License 若不验证则转化出的pdf文档会有水印产生 + if (!getLicense()) { + return ""; + } + long old = System.currentTimeMillis(); + String outPath = targetPath + UUID.randomUUID10() + ".pdf"; + // 新建一个空白pdf文档 + File file = new File(outPath); + try (FileOutputStream os = new FileOutputStream(file)) { + Document doc = new Document(inputStream); // Address是将要被转化的word文档 + PdfSaveOptions options = new PdfSaveOptions(); + options.setExportDocumentStructure(true); + + /* + 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF, + EPUB, XPS, SWF 相互转换 + */ + doc.save(os, options); + + FontSettings.setFontsFolder("/usr/share/fonts/windows", false); + + //pdf转html + String s = PdfUtil.pdfStreamToPng(new FileInputStream(file), targetPath, ipAddress); + long now = System.currentTimeMillis(); + //转化用时 + log.info("pdf转换成功,共耗时:" + ((now - old) / 1000.0) + "秒"); + FileUtil.deleteFile(outPath); + return s; + } catch (Exception e) { + log.error(e.getMessage(), e); + return ""; + } + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllDetailVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllDetailVo.java new file mode 100644 index 0000000..f7c339f --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllDetailVo.java @@ -0,0 +1,38 @@ +package com.adc.da.report.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/15 15:01 + */ +@Data +public class LabelAllDetailVo { + + /** + * id + */ + private String id; + + /** + * 标签名称 + */ + private String name; + + /** + * 类型 + */ + private String type; + + /** + * 父id + */ + private String parentId; + + /** + * 子类 + */ + private List childList; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllVo.java new file mode 100644 index 0000000..10fbce8 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelAllVo.java @@ -0,0 +1,20 @@ +package com.adc.da.report.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/15 10:36 + */ +@Data +public class LabelAllVo { + + /** + * 标签树 + */ + private List labelList; + + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/LabelVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelVo.java new file mode 100644 index 0000000..9335e85 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/LabelVo.java @@ -0,0 +1,35 @@ +package com.adc.da.report.vo; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Author doudxw + * @Date 2021/11/9 13:54 + */ +@Data +public class LabelVo { + + /** + * id + */ + private String id; + + /** + * 标签名称 + */ + @NotBlank(message = "名称不能为空") + private String name; + + /** + * 类型 + */ + @NotBlank(message = "类型不能为空") + private String type; + + /** + * 父id + */ + private String parentId; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/LogVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/LogVo.java new file mode 100644 index 0000000..2022192 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/LogVo.java @@ -0,0 +1,33 @@ +package com.adc.da.report.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @Author doudxw + * @Date 2021/11/10 13:49 + */ +@Data +public class LogVo { + + private int id; + + private String account; + + private String className; + + private String description; + + private String method; + + private String operateTime; + + private String usid; + + private String reportName; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java new file mode 100644 index 0000000..6a185fb --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java @@ -0,0 +1,54 @@ +package com.adc.da.report.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/9 16:01 + */ +@Data +public class ReportQueryVo { + + /** + * 页数 + */ + private int pageNo; + + /** + * 每页数量 + */ + private int pageSize; + + /** + * 搜索内容 + */ + private String keyContent; + + /** + * 标签1 + */ + private List labelOneId; + + /** + * 标签2 + */ + private List labelTwoId; + + /** + * 标签3 + */ + private List labelThreeId; + + /** + * 年 + */ + private List year; + + /** + * 用户id + */ + private String usid; + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java new file mode 100644 index 0000000..2634a30 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java @@ -0,0 +1,103 @@ +package com.adc.da.report.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author doudxw + * @Date 2021/11/9 09:16 + */ +@Data +public class ReportVo { + + /** + * id + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 关键字 + */ + private String keyContent; + + /** + * 主要内容 + */ + private String mainContent; + + /** + * 部门 + */ + private String department; + + /** + * 年 + */ + private String year; + + /** + * 标签1 + */ + private String labelOneName; + + /** + * 标签2 + */ + private String labelTwoName; + + /** + * 标签3 + */ + private String labelThreeName; + + /** + * 文件id + */ + private String fileId; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 文件类型 + */ + private String fileType; + + /** + * 创建时间 + */ + private String createDate; + + /** + * 报告用户id + */ + private List reportUserIdList; + + /** + * 标签1id + */ + private String labelOneId; + + /** + * 标签2id + */ + private String labelTwoId; + + /** + * 标签3id + */ + private String labelThreeId; + + /** + * 文件大小 + */ + private String fileSize; +} diff --git a/adc-da-report/src/main/resources/libs/aspose-words-15.8.0-jdk16.jar b/adc-da-report/src/main/resources/libs/aspose-words-15.8.0-jdk16.jar new file mode 100644 index 0000000..c0e699f Binary files /dev/null and b/adc-da-report/src/main/resources/libs/aspose-words-15.8.0-jdk16.jar differ diff --git a/adc-da-report/src/main/resources/license.xml b/adc-da-report/src/main/resources/license.xml new file mode 100644 index 0000000..2cdb711 --- /dev/null +++ b/adc-da-report/src/main/resources/license.xml @@ -0,0 +1,14 @@ + + + + + Aspose.Total for Java + Aspose.Words for Java + + Enterprise + 20991231 + 20991231 + 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7 + + sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU= + \ No newline at end of file diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/LabelManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/LabelManageMapper.xml new file mode 100644 index 0000000..885b1fb --- /dev/null +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/LabelManageMapper.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml new file mode 100644 index 0000000..344a55c --- /dev/null +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + diff --git a/adc-da-report/target/classes/com/adc/da/report/annotation/ReportLog.class b/adc-da-report/target/classes/com/adc/da/report/annotation/ReportLog.class new file mode 100644 index 0000000..f92b175 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/annotation/ReportLog.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/aspect/ReportLogAspect.class b/adc-da-report/target/classes/com/adc/da/report/aspect/ReportLogAspect.class new file mode 100644 index 0000000..54dd915 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/aspect/ReportLogAspect.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/controller/LabelManageController.class b/adc-da-report/target/classes/com/adc/da/report/controller/LabelManageController.class new file mode 100644 index 0000000..1caebdd Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/controller/LabelManageController.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/controller/ReportLogController.class b/adc-da-report/target/classes/com/adc/da/report/controller/ReportLogController.class new file mode 100644 index 0000000..b67b734 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/controller/ReportLogController.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class b/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class new file mode 100644 index 0000000..abe4e7b Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/dao/mysql/FileDao.class b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/FileDao.class new file mode 100644 index 0000000..d59bf71 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/FileDao.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LabelDao.class b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LabelDao.class new file mode 100644 index 0000000..c63bc0d Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LabelDao.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LogDao.class b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LogDao.class new file mode 100644 index 0000000..6dd8614 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/LogDao.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportDao.class b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportDao.class new file mode 100644 index 0000000..1d5b22a Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportDao.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportUserDao.class b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportUserDao.class new file mode 100644 index 0000000..7cde300 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/dao/mysql/ReportUserDao.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/eo/FileEntity.class b/adc-da-report/target/classes/com/adc/da/report/eo/FileEntity.class new file mode 100644 index 0000000..71e5f9e Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/eo/FileEntity.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/eo/LabelEntity.class b/adc-da-report/target/classes/com/adc/da/report/eo/LabelEntity.class new file mode 100644 index 0000000..7750009 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/eo/LabelEntity.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/eo/LogEntity.class b/adc-da-report/target/classes/com/adc/da/report/eo/LogEntity.class new file mode 100644 index 0000000..8ec3f9e Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/eo/LogEntity.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/eo/ReportEntity.class b/adc-da-report/target/classes/com/adc/da/report/eo/ReportEntity.class new file mode 100644 index 0000000..7aab7fe Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/eo/ReportEntity.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/eo/ReportUserEntity.class b/adc-da-report/target/classes/com/adc/da/report/eo/ReportUserEntity.class new file mode 100644 index 0000000..48f6089 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/eo/ReportUserEntity.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/IFileService.class b/adc-da-report/target/classes/com/adc/da/report/service/IFileService.class new file mode 100644 index 0000000..2c49e5f Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/IFileService.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/ILabelService.class b/adc-da-report/target/classes/com/adc/da/report/service/ILabelService.class new file mode 100644 index 0000000..5085b32 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/ILabelService.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/ILogService.class b/adc-da-report/target/classes/com/adc/da/report/service/ILogService.class new file mode 100644 index 0000000..2550156 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/ILogService.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/IReportService.class b/adc-da-report/target/classes/com/adc/da/report/service/IReportService.class new file mode 100644 index 0000000..6d5864c Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/IReportService.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/IFileServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/IFileServiceImpl.class new file mode 100644 index 0000000..3c8f935 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/impl/IFileServiceImpl.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/ILabelServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/ILabelServiceImpl.class new file mode 100644 index 0000000..b636574 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/impl/ILabelServiceImpl.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/ILogServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/ILogServiceImpl.class new file mode 100644 index 0000000..ae4c7e6 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/impl/ILogServiceImpl.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class new file mode 100644 index 0000000..aa30609 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/ExcelUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/ExcelUtil.class new file mode 100644 index 0000000..b8c849a Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/ExcelUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/OSSClientUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/OSSClientUtil.class new file mode 100644 index 0000000..fc83aba Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/OSSClientUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class new file mode 100644 index 0000000..dbaa4e4 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class new file mode 100644 index 0000000..ae60fb8 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/WordUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/WordUtil.class new file mode 100644 index 0000000..8a90418 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/WordUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllDetailVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllDetailVo.class new file mode 100644 index 0000000..3c6da39 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllDetailVo.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllVo.class new file mode 100644 index 0000000..e77df9d Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/LabelAllVo.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/LabelVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/LabelVo.class new file mode 100644 index 0000000..c5f38bf Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/LabelVo.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/LogVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/LogVo.class new file mode 100644 index 0000000..3f61de4 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/LogVo.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/ReportQueryVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/ReportQueryVo.class new file mode 100644 index 0000000..9f30ec0 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/ReportQueryVo.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/vo/ReportVo.class b/adc-da-report/target/classes/com/adc/da/report/vo/ReportVo.class new file mode 100644 index 0000000..ac79f50 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/vo/ReportVo.class differ diff --git a/adc-da-report/target/classes/libs/aspose-words-15.8.0-jdk16.jar b/adc-da-report/target/classes/libs/aspose-words-15.8.0-jdk16.jar new file mode 100644 index 0000000..c0e699f Binary files /dev/null and b/adc-da-report/target/classes/libs/aspose-words-15.8.0-jdk16.jar differ diff --git a/adc-da-report/target/classes/license.xml b/adc-da-report/target/classes/license.xml new file mode 100644 index 0000000..2cdb711 --- /dev/null +++ b/adc-da-report/target/classes/license.xml @@ -0,0 +1,14 @@ + + + + + Aspose.Total for Java + Aspose.Words for Java + + Enterprise + 20991231 + 20991231 + 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7 + + sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU= + \ No newline at end of file diff --git a/adc-da-report/target/classes/mybatis/mapper/mysql/LabelManageMapper.xml b/adc-da-report/target/classes/mybatis/mapper/mysql/LabelManageMapper.xml new file mode 100644 index 0000000..885b1fb --- /dev/null +++ b/adc-da-report/target/classes/mybatis/mapper/mysql/LabelManageMapper.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml new file mode 100644 index 0000000..344a55c --- /dev/null +++ b/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + diff --git a/adc-da-sys/pom.xml b/adc-da-sys/pom.xml new file mode 100644 index 0000000..1784a17 --- /dev/null +++ b/adc-da-sys/pom.xml @@ -0,0 +1,191 @@ + + + + com.adc + ca-data + 2.5.0 + + 4.0.0 + + adc-da-sys + + + UTF-8 + 1.8 + + 3.4.2 + 1.4.0-RC2 + 1.8.5 + 3.7.0 + 2.6.6 + + + + + adc + http://60.247.58.121:8182/repository/public + + true + + + true + + + + + + + thirdparty + Nexus Thirdparty Repository + http://60.247.58.121:8182/repository/thirdparty/ + + + + snapshots + User Project SNAPSHOTS + http://60.247.58.121:8182/repository/snapshots/ + + + + + + + + + + + + com.adc + adc-da-swagger + RELEASE + + + javax.mail + mailapi + + + + + com.adc + adc-da-base + RELEASE + + + adc-da-util + com.adc + + + + + com.adc + adc-da-util + RELEASE + + + log4j + log4j + + + + + + + + + + + + + + + com.baomidou + mybatis-plus-boot-starter + + + javax.validation + validation-api + 2.0.1.Final + + + + org.apache.shiro + shiro-core + ${shiro.version} + + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + com.adc + adc-da-file + 2.0.0 + + + adc-da-util + com.adc + + + adc-da-sys + com.adc + + + + + com.adc + adc-da-excel + 2.0.9 + compile + + + log4j + log4j + + + + + + + net.sf.ehcache + ehcache-core + ${ehcache.version} + + + net.sf.ehcache + ehcache-web + 2.0.4 + + + + org.projectlombok + lombok + + + + javax.mail + mail + 1.4.7 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${org.apache.maven.plugins.version} + + 8 + 8 + ${java.version} + ${project.build.sourceEncoding} + + + + + diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialSaleDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialSaleDTO.java new file mode 100644 index 0000000..c96ace7 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialSaleDTO.java @@ -0,0 +1,30 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:30 + */ +public class SelectCommercialSaleDTO { + @Excel(name = "品牌", orderNum = "1") + private String brand; + @Excel(name = "车辆类别", orderNum = "2") + private String vehicleCategory; + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getVehicleCategory() { + return vehicleCategory; + } + + public void setVehicleCategory(String vehicleCategory) { + this.vehicleCategory = vehicleCategory; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialYieldDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialYieldDTO.java new file mode 100644 index 0000000..699e1a6 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectCommercialYieldDTO.java @@ -0,0 +1,31 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:26 + */ +public class SelectCommercialYieldDTO { + @Excel(name = "企业名称", orderNum = "1") + private String enterpriseName; + @Excel(name = "车辆类别", orderNum = "2") + private String vehicleCategory; + + + public String getEnterpriseName() { + return enterpriseName; + } + + public void setEnterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public String getVehicleCategory() { + return vehicleCategory; + } + + public void setVehicleCategory(String vehicleCategory) { + this.vehicleCategory = vehicleCategory; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectNewEnergySaleDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectNewEnergySaleDTO.java new file mode 100644 index 0000000..187b77c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectNewEnergySaleDTO.java @@ -0,0 +1,50 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:33 + */ +public class SelectNewEnergySaleDTO { + @Excel(name = "车型大类", orderNum = "1") + private String vehicleType; + @Excel(name = "品牌", orderNum = "2") + private String brand; + @Excel(name = "车型", orderNum = "3") + private String vehicleModel; + @Excel(name = "新能源类型", orderNum = "4") + private String newEnergyType; + + public String getVehicleType() { + return vehicleType; + } + + public void setVehicleType(String vehicleType) { + this.vehicleType = vehicleType; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getVehicleModel() { + return vehicleModel; + } + + public void setVehicleModel(String vehicleModel) { + this.vehicleModel = vehicleModel; + } + + public String getNewEnergyType() { + return newEnergyType; + } + + public void setNewEnergyType(String newEnergyType) { + this.newEnergyType = newEnergyType; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectPassengerSaleDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectPassengerSaleDTO.java new file mode 100644 index 0000000..0b9b759 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectPassengerSaleDTO.java @@ -0,0 +1,30 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:30 + */ +public class SelectPassengerSaleDTO { + @Excel(name = "品牌", orderNum = "1") + private String brand; + @Excel(name = "车型", orderNum = "2") + private String vehicleModel; + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getVehicleModel() { + return vehicleModel; + } + + public void setVehicleModel(String vehicleModel) { + this.vehicleModel = vehicleModel; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectPolityDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectPolityDTO.java new file mode 100644 index 0000000..07c30b7 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectPolityDTO.java @@ -0,0 +1,31 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:38 + */ +public class SelectPolityDTO { + + @Excel(name = "政策级别", orderNum = "1") + private String polityLevel; + @Excel(name = "政策分类", orderNum = "2") + private String polityType; + + public String getPolityLevel() { + return polityLevel; + } + + public void setPolityLevel(String polityLevel) { + this.polityLevel = polityLevel; + } + + public String getPolityType() { + return polityType; + } + + public void setPolityType(String polityType) { + this.polityType = polityType; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectStockDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectStockDTO.java new file mode 100644 index 0000000..fef7a4d --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectStockDTO.java @@ -0,0 +1,52 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 18:40 + */ +public class SelectStockDTO { + + @Excel(name = "车型大类", orderNum = "1") + private String vehicleType; + @Excel(name = "品牌", orderNum = "2") + private String brand; + @Excel(name = "车辆类别", orderNum = "3") + private String vehicleCategory; + + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVehicleType() { + return vehicleType; + } + + public void setVehicleType(String vehicleType) { + this.vehicleType = vehicleType; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getVehicleCategory() { + return vehicleCategory; + } + + public void setVehicleCategory(String vehicleCategory) { + this.vehicleCategory = vehicleCategory; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/SelectYieldDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/SelectYieldDTO.java new file mode 100644 index 0000000..a7d1e54 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/SelectYieldDTO.java @@ -0,0 +1,30 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2020/12/21 19:26 + */ +public class SelectYieldDTO { + @Excel(name = "企业名称", orderNum = "1") + private String enterpriseName; + @Excel(name = "车辆类别", orderNum = "2") + private String vehicleCategory; + + public String getEnterpriseName() { + return enterpriseName; + } + + public void setEnterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public String getVehicleCategory() { + return vehicleCategory; + } + + public void setVehicleCategory(String vehicleCategory) { + this.vehicleCategory = vehicleCategory; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/dto/selectMacroscopicDTO.java b/adc-da-sys/src/main/java/com/adc/da/dto/selectMacroscopicDTO.java new file mode 100644 index 0000000..aa43028 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/dto/selectMacroscopicDTO.java @@ -0,0 +1,40 @@ +package com.adc.da.dto; + +import com.adc.da.excel.annotation.Excel; + +/** + * @Author sima + * @Date 2021/1/5 14:25 + */ +public class selectMacroscopicDTO { + @Excel(name = "区域", orderNum = "1") + private String area; + @Excel(name = "分类", orderNum = "2") + private String sort; + @Excel(name = "指标", orderNum = "3") + private String indes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getIndes() { + return indes; + } + + public void setIndes(String indes) { + this.indes = indes; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/annotation/BusinessLog.java b/adc-da-sys/src/main/java/com/adc/da/log/annotation/BusinessLog.java new file mode 100644 index 0000000..3e6c5cf --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/annotation/BusinessLog.java @@ -0,0 +1,11 @@ +package com.adc.da.log.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ java.lang.annotation.ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface BusinessLog { + public String description(); +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/log/constant/LogConstants.java b/adc-da-sys/src/main/java/com/adc/da/log/constant/LogConstants.java new file mode 100644 index 0000000..888283c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/constant/LogConstants.java @@ -0,0 +1,23 @@ +package com.adc.da.log.constant; + +public class LogConstants { + private LogConstants() { + throw new IllegalStateException("LogConstants class"); + } + + /** + * 开发模式不拦截方法记日志 + */ + public static final String LOG_TYPE_DEV = "DEV"; + + /** + * 客户自定义需要拦截记日志的方法 + */ + public static final String LOG_TYPE_CUSTOM = "CUSTOM"; + + /** + * 系统原设需要拦截记日志的方法 + */ + public static final String LOG_TYPE_SYS = "SYS"; + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/controller/LogEOController.java b/adc-da-sys/src/main/java/com/adc/da/log/controller/LogEOController.java new file mode 100644 index 0000000..c494517 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/controller/LogEOController.java @@ -0,0 +1,152 @@ +package com.adc.da.log.controller; + +import java.util.List; + +import com.adc.da.base.page.Pager; +import com.adc.da.util.utils.BeanMapper; +import org.apache.commons.lang.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.adc.da.base.web.BaseController; +import com.adc.da.log.entity.LogEO; +import com.adc.da.log.vo.LogVO; +import com.adc.da.log.page.LogEOPage; +import com.adc.da.log.service.LogEOService; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + + +/** + * 日志管理模块 + * 1.日志分页查询 @author 李坤澔 + * 2.日志详情 + * date 2018-08-16 + * + * @author comments created by Lee Kwanho + * @see LogEOService + * @see LogEO + * @see LogVO + * @see LogEOPage + * @see mybatis.mapper.log + */ +@RestController +@RequestMapping("/${restPath}/log/log") +@Api(tags = "Sys-日志管理") +public class LogEOController extends BaseController { + + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(LogEOController.class); + + /** + * 统一标识日志异常 + */ + private static final String ERROR_INFO = "日志管理异常"; + + /** + * @see LogEOService + */ + @Resource + private LogEOService logEOService; + + /** + * dozer相关,EO间VO转换 + * + * @see dozer + */ + @Resource + private BeanMapper beanMapper; + + /** + * new paging query, using GetMapping. + * total 5 variable: pageNo,pageSize,account,startTime,endTime + * date 2018/03/26 + * 按照时间节点 + * 权限字段:sys:log:list + * + * @param pageNo 页码 + * @param pageSize 分页大小 + * @param account 账户 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 查询结果 + * @author Lee Kwanho 李坤澔 + */ + @ApiOperation(value = "|LogEO|分页查询") + @GetMapping("") +// @RequiresPermissions("sys:log:list") + public ResponseMessage> page(Integer page, Integer limit, String account, + String startTime, String endTime) { + + LogEOPage eoPage = new LogEOPage(); + //设置排序字段,对应是数据库中的字段非EO中的字段 倒叙排序 + eoPage.setOrderBy("start_time DESC"); + if (page != null) { + eoPage.setPage(page); + } + if (limit != null) { + eoPage.setPageSize(limit); + } + + /* 日志相关账户查询 */ + if (StringUtils.isNotEmpty(account)) { + eoPage.setAccount(account); + eoPage.setAccountOperator("LIKE"); + } + + /* 设置查询起始时间 */ + if (StringUtils.isNotEmpty(startTime)) { + eoPage.setStartTime1(startTime); + } + + /* 设置查询终止时间 */ + if (StringUtils.isNotEmpty(endTime)) { + eoPage.setStartTime2(endTime); + } + eoPage.setPager(new Pager()); + + try { + List rows = logEOService.queryByPage(eoPage); + return Result.success(beanMapper.mapPage(getPageInfo(eoPage.getPager(), rows), LogVO.class)); + } catch (Exception e) { + logger.error(ERROR_INFO, e); + return Result.error(ERROR_INFO + e.getMessage()); + } + + } + + /** + * 日志详情 + * 权限字段:sys:log:get + * + * @param id 日志id + * @return 日志详情 + */ + @ApiOperation(value = "|LogEO|详情") + @GetMapping("/{id}") +// @RequiresPermissions("sys:log:get") + public ResponseMessage find(@PathVariable String id) { + try { + LogVO logVO = beanMapper.map(logEOService.selectByPrimaryKey(id), LogVO.class); + return Result.success(logVO); + } catch (Exception e) { + logger.error(ERROR_INFO, e); + return Result.error(ERROR_INFO + e.getMessage()); + } + + } + +} + diff --git a/adc-da-sys/src/main/java/com/adc/da/log/dao/mysql/LogEODao.java b/adc-da-sys/src/main/java/com/adc/da/log/dao/mysql/LogEODao.java new file mode 100644 index 0000000..bc26460 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/dao/mysql/LogEODao.java @@ -0,0 +1,21 @@ +package com.adc.da.log.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.log.entity.LogEO; +import com.adc.da.log.entity.MiLogEO; +import com.adc.da.sys.entity.UserEO; + +/** + *
    + * 功能:TS_LOG LogEODao
    + * 作者:code generator
    + * 日期: 2017-12-24
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * sql实现在xml中路径如下 + * + * @see mybatis.mapper.log + */ +public interface LogEODao extends BaseDao { + + void save(MiLogEO user); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/entity/LogEO.java b/adc-da-sys/src/main/java/com/adc/da/log/entity/LogEO.java new file mode 100644 index 0000000..31490e7 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/entity/LogEO.java @@ -0,0 +1,204 @@ +package com.adc.da.log.entity; + +import com.adc.da.base.entity.BaseEntity; + +import java.util.Date; + +/** + * 功能:TS_LOG LogEOEntity
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    + *

    字段列表:

    + *
  • ipAddress -> ip_address
  • + *
  • browser -> browser
  • + *
  • startTime -> start_time
  • + *
  • endTime -> end_time
  • + *
  • usid -> usid
  • + *
  • operateTime -> operate_time
  • + *
  • method -> method
  • + *
  • description -> description
  • + *
  • className -> class_name
  • + *
  • account -> account
  • + *
  • id -> id
  • + * date 2018-08-15 + * + * @author comments created by Lee Kwanho + * @see com.adc.da.log.controller.LogEOController + */ +public class LogEO extends BaseEntity { + + /** + * ip地址 + */ + private String ipAddress; + + /** + * 浏览器信息 + */ + private String browser; + + /** + * 生成时间 + * 格式转换为 年-月-日 时:分:秒 + * 类型为Date 与 VO不同 + */ + @org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** + * 日志结束时间(意义不明,数值与日志生成时间相同) + * 格式转换为 年-月-日 时:分:秒 + * 类型为Date 与 VO不同 + */ + @org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + /** + * 操作用户的ID + */ + private String usid; + + /** + * 默认为空,意义不明,操作时间 + * 格式转换为 年-月-日 时:分:秒 + * 类型为Date 与 VO不同 + */ + @org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operateTime; + + /** + * 日志涉及的操作方法 + */ + private String method; + + /** + * 默认为空,描述字段 + */ + private String description; + + /** + * 日志涉及的类名 + */ + private String className; + + /** + * 操作用户的账号 + */ + private String account; + + /** + * 日志ID + */ + private String id; + + /** **/ + public String getIpAddress() { + return this.ipAddress; + } + + /** **/ + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + /** **/ + public String getBrowser() { + return this.browser; + } + + /** **/ + public void setBrowser(String browser) { + this.browser = browser; + } + + /** **/ + public Date getStartTime() { + return this.startTime; + } + + /** **/ + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + /** **/ + public Date getEndTime() { + return this.endTime; + } + + /** **/ + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + /** **/ + public String getUsid() { + return this.usid; + } + + /** **/ + public void setUsid(String usid) { + this.usid = usid; + } + + /** **/ + public Date getOperateTime() { + return this.operateTime; + } + + /** **/ + public void setOperateTime(Date operateTime) { + this.operateTime = operateTime; + } + + /** **/ + public String getMethod() { + return this.method; + } + + /** **/ + public void setMethod(String method) { + this.method = method; + } + + /** **/ + public String getDescription() { + return this.description; + } + + /** **/ + public void setDescription(String description) { + this.description = description; + } + + /** **/ + public String getClassName() { + return this.className; + } + + /** **/ + public void setClassName(String className) { + this.className = className; + } + + /** **/ + public String getAccount() { + return this.account; + } + + /** **/ + public void setAccount(String account) { + this.account = account; + } + + /** **/ + public String getId() { + return this.id; + } + + /** **/ + public void setId(String id) { + this.id = id; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/entity/MiLogEO.java b/adc-da-sys/src/main/java/com/adc/da/log/entity/MiLogEO.java new file mode 100644 index 0000000..d0ce6c2 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/entity/MiLogEO.java @@ -0,0 +1,66 @@ +package com.adc.da.log.entity; + +import com.adc.da.base.entity.BaseEntity; + +import java.util.Date; + +public class MiLogEO extends BaseEntity { + private String id; + private String account; + private String userName; + private String accessPage; + private String department; + private Date operateDate; + + public MiLogEO() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAccessPage() { + return accessPage; + } + + public void setAccessPage(String accessPage) { + this.accessPage = accessPage; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public Date getOperateDate() { + return operateDate; + } + + public void setOperateDate(Date operateDate) { + this.operateDate = operateDate; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/page/LogEOPage.java b/adc-da-sys/src/main/java/com/adc/da/log/page/LogEOPage.java new file mode 100644 index 0000000..3b9c3f4 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/page/LogEOPage.java @@ -0,0 +1,297 @@ +package com.adc.da.log.page; + +import com.adc.da.base.page.BasePage; + + + +/** + * 功能:TS_LOG LogEOPage
    + * 作者:code generator
    + * 日期: 2017-12-24
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @author comments created by Lee Kwanho + */ +public class LogEOPage extends BasePage { + + private String ipAddress; + + private String ipAddressOperator = "="; + + private String browser; + + private String browserOperator = "="; + + private String startTime; + + private String startTime1; + + private String startTime2; + + private String startTimeOperator = "="; + + private String endTime; + + private String endTime1; + + private String endTime2; + + private String endTimeOperator = "="; + + private String usid; + + private String usidOperator = "="; + + private String operateTime; + + private String operateTime1; + + private String operateTime2; + + private String operateTimeOperator = "="; + + private String method; + + private String methodOperator = "="; + + private String description; + + private String descriptionOperator = "="; + + private String className; + + private String classNameOperator = "="; + + private String account; + + private String accountOperator = "="; + + private String id; + + private String idOperator = "="; + + public String getIpAddress() { + return this.ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getIpAddressOperator() { + return this.ipAddressOperator; + } + + public void setIpAddressOperator(String ipAddressOperator) { + this.ipAddressOperator = ipAddressOperator; + } + + public String getBrowser() { + return this.browser; + } + + public void setBrowser(String browser) { + this.browser = browser; + } + + public String getBrowserOperator() { + return this.browserOperator; + } + + public void setBrowserOperator(String browserOperator) { + this.browserOperator = browserOperator; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getStartTime1() { + return this.startTime1; + } + + public void setStartTime1(String startTime1) { + this.startTime1 = startTime1; + } + + public String getStartTime2() { + return this.startTime2; + } + + public void setStartTime2(String startTime2) { + this.startTime2 = startTime2; + } + + public String getStartTimeOperator() { + return this.startTimeOperator; + } + + public void setStartTimeOperator(String startTimeOperator) { + this.startTimeOperator = startTimeOperator; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getEndTime1() { + return this.endTime1; + } + + public void setEndTime1(String endTime1) { + this.endTime1 = endTime1; + } + + public String getEndTime2() { + return this.endTime2; + } + + public void setEndTime2(String endTime2) { + this.endTime2 = endTime2; + } + + public String getEndTimeOperator() { + return this.endTimeOperator; + } + + public void setEndTimeOperator(String endTimeOperator) { + this.endTimeOperator = endTimeOperator; + } + + public String getUsid() { + return this.usid; + } + + public void setUsid(String usid) { + this.usid = usid; + } + + public String getUsidOperator() { + return this.usidOperator; + } + + public void setUsidOperator(String usidOperator) { + this.usidOperator = usidOperator; + } + + public String getOperateTime() { + return this.operateTime; + } + + public void setOperateTime(String operateTime) { + this.operateTime = operateTime; + } + + public String getOperateTime1() { + return this.operateTime1; + } + + public void setOperateTime1(String operateTime1) { + this.operateTime1 = operateTime1; + } + + public String getOperateTime2() { + return this.operateTime2; + } + + public void setOperateTime2(String operateTime2) { + this.operateTime2 = operateTime2; + } + + public String getOperateTimeOperator() { + return this.operateTimeOperator; + } + + public void setOperateTimeOperator(String operateTimeOperator) { + this.operateTimeOperator = operateTimeOperator; + } + + public String getMethod() { + return this.method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getMethodOperator() { + return this.methodOperator; + } + + public void setMethodOperator(String methodOperator) { + this.methodOperator = methodOperator; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDescriptionOperator() { + return this.descriptionOperator; + } + + public void setDescriptionOperator(String descriptionOperator) { + this.descriptionOperator = descriptionOperator; + } + + public String getClassName() { + return this.className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getClassNameOperator() { + return this.classNameOperator; + } + + public void setClassNameOperator(String classNameOperator) { + this.classNameOperator = classNameOperator; + } + + public String getAccount() { + return this.account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getAccountOperator() { + return this.accountOperator; + } + + public void setAccountOperator(String accountOperator) { + this.accountOperator = accountOperator; + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return this.idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/service/LogEOService.java b/adc-da-sys/src/main/java/com/adc/da/log/service/LogEOService.java new file mode 100644 index 0000000..94be1cc --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/service/LogEOService.java @@ -0,0 +1,42 @@ +package com.adc.da.log.service; + +import com.adc.da.log.entity.MiLogEO; +import com.adc.da.sys.entity.UserEO; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.adc.da.base.service.BaseService; +import com.adc.da.log.dao.mysql.LogEODao; +import com.adc.da.log.entity.LogEO; + +/** + *
    + * 功能:TS_LOG LogEOService
    + * 作者:code generator
    + * 日期: 2017-12-24
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @see LogEODao + */ +@Service("logEOService") +@Transactional +public class LogEOService extends BaseService { + + /** + * @see LogEODao + * @see mybatis.mapper.log + */ + @Resource + private LogEODao dao; + + @Override + public LogEODao getDao() { + return dao; + } + + public void save(MiLogEO user) { + dao.save(user); + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/log/vo/LogVO.java b/adc-da-sys/src/main/java/com/adc/da/log/vo/LogVO.java new file mode 100644 index 0000000..d2be0e2 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/log/vo/LogVO.java @@ -0,0 +1,198 @@ +package com.adc.da.log.vo; + +import com.adc.da.base.entity.BaseEntity; + +/** + * 功能:TS_LOG LogEOEntity
    + * 作者:code generator
    + * 日期: 2017-12-24
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • ipAddress -> ip_address
  • + *
  • browser -> browser
  • + *
  • startTime -> start_time
  • + *
  • endTime -> end_time
  • + *
  • usid -> usid
  • + *
  • operateTime -> operate_time
  • + *
  • method -> method
  • + *
  • description -> description
  • + *
  • className -> class_name
  • + *
  • account -> account
  • + *
  • id -> id
  • + *

    + * date 2018-08-17 + * + * @author comments created by Lee Kwanho + * @see com.adc.da.log.controller.LogEOController + */ +public class LogVO extends BaseEntity { + + /** + * ip地址 + */ + private String ipAddress; + + /** + * 浏览器 + */ + private String browser; + + /** + * 日志生成时间 + * 类型为String 与 EO不同 + */ + private String startTime; + + /** + * 日志结束时间(意义不明,数值与日志生成时间相同) + * 类型为String 与 EO不同 + */ + private String endTime; + + /** + * 操作用户的ID + */ + private String usid; + + /** + * 默认为空,意义不明 + * 类型为String 与 EO不同 + */ + private String operateTime; + + /** + * 日志涉及的操作方法 + */ + private String method; + + /** + * 默认为空 + */ + private String description; + + /** + * 日志涉及的类名 + */ + private String className; + + /** + * 操作用户的账号 + */ + private String account; + + /** + * 日志ID + */ + private String id; + + /** **/ + public String getIpAddress() { + return this.ipAddress; + } + + /** **/ + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + /** **/ + public String getBrowser() { + return this.browser; + } + + /** **/ + public void setBrowser(String browser) { + this.browser = browser; + } + + /** **/ + public String getStartTime() { + return this.startTime; + } + + /** **/ + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + /** **/ + public String getEndTime() { + return this.endTime; + } + + /** **/ + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + /** **/ + public String getUsid() { + return this.usid; + } + + /** **/ + public void setUsid(String usid) { + this.usid = usid; + } + + /** **/ + public String getOperateTime() { + return this.operateTime; + } + + /** **/ + public void setOperateTime(String operateTime) { + this.operateTime = operateTime; + } + + /** **/ + public String getMethod() { + return this.method; + } + + /** **/ + public void setMethod(String method) { + this.method = method; + } + + /** **/ + public String getDescription() { + return this.description; + } + + /** **/ + public void setDescription(String description) { + this.description = description; + } + + /** **/ + public String getClassName() { + return this.className; + } + + /** **/ + public void setClassName(String className) { + this.className = className; + } + + /** **/ + public String getAccount() { + return this.account; + } + + /** **/ + public void setAccount(String account) { + this.account = account; + } + + /** **/ + public String getId() { + return this.id; + } + + /** **/ + public void setId(String id) { + this.id = id; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sync/service/SyncService.java b/adc-da-sys/src/main/java/com/adc/da/sync/service/SyncService.java new file mode 100644 index 0000000..5f12a22 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sync/service/SyncService.java @@ -0,0 +1,20 @@ +//package com.adc.da.sync.service; +// +//import com.adc.da.sys.dao.mysql.UserEODao; +//import javax.annotation.Resource; +//import org.springframework.stereotype.Service; +//import org.springframework.transaction.annotation.Propagation; +//import org.springframework.transaction.annotation.Transactional; +// +//@Service("syncService") +//@Transactional +//public class SyncService { +// +// @Resource +// private UserEODao userEODao; +// +//// public void syncUserOrg(String usid, String oldOrgId, String newOrgId) { +//// userEODao.deleteUserOrgByUsidAndOrgId(usid ,oldOrgId); +//// userEODao.saveUserOrg(usid ,newOrgId); +//// } +//} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sync/vo/SyncVO.java b/adc-da-sys/src/main/java/com/adc/da/sync/vo/SyncVO.java new file mode 100644 index 0000000..387fb57 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sync/vo/SyncVO.java @@ -0,0 +1,92 @@ +package com.adc.da.sync.vo; + +public class SyncVO { + + private String account; + + private String userCode; //工号 + + private String oldOrgName; + + private String newOrgName; + + private String newContactAddress; + + /** + * 办公电话 + */ + private String officePhone; + + /** + * 手机号码 + */ + private String cellPhoneNumber; + /** + * 电子邮件 + */ + private String email; + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getUserCode() { + return userCode; + } + + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getOldOrgName() { + return oldOrgName; + } + + public void setOldOrgName(String oldOrgName) { + this.oldOrgName = oldOrgName; + } + + public String getNewOrgName() { + return newOrgName; + } + + public void setNewOrgName(String newOrgName) { + this.newOrgName = newOrgName; + } + + public String getNewContactAddress() { + return newContactAddress; + } + + public void setNewContactAddress(String newContactAddress) { + this.newContactAddress = newContactAddress; + } + + public String getOfficePhone() { + return officePhone; + } + + public void setOfficePhone(String officePhone) { + this.officePhone = officePhone; + } + + public String getCellPhoneNumber() { + return cellPhoneNumber; + } + + public void setCellPhoneNumber(String cellPhoneNumber) { + this.cellPhoneNumber = cellPhoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/annotation/DataFilter.java b/adc-da-sys/src/main/java/com/adc/da/sys/annotation/DataFilter.java new file mode 100644 index 0000000..99b7129 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/annotation/DataFilter.java @@ -0,0 +1,27 @@ +package com.adc.da.sys.annotation; + +import java.lang.annotation.*; + +/** + * 数据过滤 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataFilter { + + /** 表的别名 */ + String tableAlias() default ""; + + /** true:没有本部门数据权限,也能查询本人数据 */ + boolean user() default true; + + /** true:拥有子部门数据权限 */ + boolean subOrg() default false; + + /** 部门ID */ + String orgId() default "id"; + + /** 用户ID */ + String userId() default "usid"; +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/constant/IsBelongEnum.java b/adc-da-sys/src/main/java/com/adc/da/sys/constant/IsBelongEnum.java new file mode 100644 index 0000000..b685c5a --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/constant/IsBelongEnum.java @@ -0,0 +1,37 @@ +package com.adc.da.sys.constant; + +/** + * 用於菜單和角色判斷 + * + * @author comments created by Lee Kwanho + * date 2018-08-15 + * @see com.adc.da.sys.controller.MenuEOController + * @see com.adc.da.sys.controller.RoleEOController + */ +public enum IsBelongEnum { + BELONG(1, "属于"); + + /** + * 对应数值 + */ + private int value; + + /** + * 代表意义 + */ + private String label; + + IsBelongEnum(int value, String label) { + this.value = value; + this.label = label; + } + + public int getValue() { + return value; + } + + public String getLabel() { + return label; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailController.java new file mode 100644 index 0000000..36550d1 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailController.java @@ -0,0 +1,193 @@ +package com.adc.da.sys.controller; + + +import com.adc.da.sys.dao.mysql.MailEODao; +import com.adc.da.sys.entity.MailEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.DefaultConfigurer; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.util.MailTestUtils; +import com.adc.da.sys.util.SendEmailMessage; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + + +/** + * @Author sima + * @Date 2022/6/24 13:06 + */ +@RestController +@RequestMapping("/${restPath}/sys/mail") +@Api(tags = {"Sys-发送邮件"}) +@Slf4j +public class MailController { + + @Resource + private MailEODao mailEODao; + @Resource + private IUserEoService userEOService; + + + @Value("${MAIL_SMTP}") + private String mail_smtp; + + @Value("${MAIL_SMTP_PORT}") + private String mail_smtp_port; + + @Value("${MAIL_USERNAME}") + private String mail_username; + + @Value("${MAIL_PASSWORD}") + private String mail_password; + @Value("${MAIL_POP_PORT}") + private String mail_pop_port; + + + @Value("${IPANDPORT}") + private String piAndPort; + + + /** + * 废弃 + * @param mailEO + * @return + */ + /* @ApiOperation("发送邮件") + @PostMapping("/send") + public ResponseMessage send(@RequestBody MailEO mailEO) { + MailUtils sendmail = new MailUtils(); + sendmail.setHost(mail_smtp); + sendmail.setPort(mail_smtp_port); + sendmail.setUserName(mail_username); // 发送邮箱 + sendmail.setPassWord(mail_password); // 发送邮箱密码 + sendmail.setFrom(mail_username);// 发送邮箱 + sendmail.setSubject(mailEO.getSubject()); + sendmail.setContent(mailEO.getContent()); + + String mails = mailEO.getToMail(); + Set set = strToList(mails); + + int i = 0; + for (String mail : set) { + sendmail.setTo(mail); // 目的邮箱 + + if (sendmail.sendMail()) { + mailEO.setSendDate(new Date()); + mailEO.setId(UUID.randomUUID().toString()); + mailEO.setToMail(mail); + mailEODao.insert(mailEO); + i++; + //保存记录 +// return Result.success("成功"); + } + } + if(i>0){ + return Result.success("成功"); + } + return Result.error("发送失败"); + + }*/ + + + + @ApiOperation("发送邮件") + @PostMapping("/send") + public ResponseMessage send(@RequestBody MailEO mailEO) throws Exception { + + MailTestUtils eu = new MailTestUtils(mail_username, mail_password); + SendEmailMessage sem = new SendEmailMessage(); + sem.setFrom(mail_username); + sem.setRecipient(mailEO.getToMail()); + sem.setCopyRecipient(mailEO.getCcMail()); + sem.setSubject(mailEO.getSubject()); + sem.setContent(mailEO.getContent()); + + DefaultConfigurer defaultConfigurer = new DefaultConfigurer(); + defaultConfigurer.setMail_smtp(mail_smtp); + defaultConfigurer.setMail_smtp_port(mail_smtp_port); + defaultConfigurer.setMail_pop_port(mail_pop_port); + try{ + eu.sendMail(defaultConfigurer.getSMTP(), sem); + mailEO.setSendDate(new Date()); + mailEO.setId(UUID.randomUUID().toString().replaceAll("-","")); + mailEO.setToMail(getUserByMail(mailEO.getToMail())); + mailEO.setCcMail(getUserByMail(mailEO.getCcMail())); + mailEODao.insert(mailEO); + System.out.println("发送成功"); + return Result.success("发送成功"); + }catch (Exception e){ + e.printStackTrace(); + log.error("邮件发送失败:",e); + return Result.error("发送失败"); + } + + +// 收邮件 +// eu.receiveMail(defaultConfigurer.getPOP3(), "pop3"); // pop3收信 +// System.out.println("收取完毕"); + +// 使用IMAP收信会抛出 Failed to load IMAP envelope 异常 +//eu.receiveMail(DefaultConfigurer.getIMAP(), "imap"); // imap收信 + + } + + private String getUserByMail(String mails) { + if(null == mails || "".equals(mails)){ + return ""; + } + List mailList = Arrays.asList(mails.split(",")); + List accountList = new ArrayList<>(); + for (int i = 0; i < mailList.size(); i++) { + String mail = mailList.get(i); + String account = mail.substring(0, mail.indexOf("@")); + accountList.add(account); + } +// List userEOList = userEOService.getUserByMail(mailList); + List userEOList = userEOService.getUserByAccount(accountList); + StringBuilder sb = new StringBuilder(); + for (UserEO user:userEOList) { + sb.append(","); + sb.append(user.getUsname()); + sb.append("-"); + sb.append(user.getDepartment()); + sb.append("<"); + sb.append(user.getAccount()); + sb.append("@Any3.com"); + sb.append(">"); + } + return sb.toString().substring(1); + } + + @ApiOperation("发送记录") + @PostMapping("/list") + public ResponseMessage list(Integer pageNo, Integer pageSize) { + pageNo = null == pageNo ? 1 : pageNo; + pageSize = null == pageSize ? 10 : pageSize; + IPage page = new Page(); + page.setCurrent(pageNo); + page.setSize(pageSize); + IPage list = mailEODao.list(page); + List records = list.getRecords(); + DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + for (MailEO eo:records) { + eo.setStrSendDate(sdf.format(eo.getSendDate())); + } + return Result.success(list); + } + + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailTestController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailTestController.java new file mode 100644 index 0000000..c00d623 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MailTestController.java @@ -0,0 +1,82 @@ +package com.adc.da.sys.controller; + +import com.adc.da.sys.dao.mysql.MailEODao; +import com.adc.da.sys.entity.MailEO; +import com.adc.da.sys.util.DefaultConfigurer; +import com.adc.da.sys.util.MailTestUtils; +import com.adc.da.sys.util.MailUtils; +import com.adc.da.sys.util.SendEmailMessage; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +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; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + + +/** + * @Author sima + * @Date 2022/6/24 13:06 + */ +@RestController +@RequestMapping("/${restPath}/sys/mailtest") +@Api(tags = {"Sys-发送邮件test"}) +@Slf4j +public class MailTestController { + + @Value("${MAIL_USERNAME}") + private String mail_username; + + @Value("${MAIL_PASSWORD}") + private String mail_password; + + @Value("${MAIL_SMTP}") + private String mail_smtp; + + @Value("${MAIL_SMTP_PORT}") + private String mail_smtp_port; + + @Value("${MAIL_POP_PORT}") + private String mail_pop_port; + + /** + * 程序入口点 + * @param + * @throws Exception + */ + @ApiOperation("发送邮件") + @PostMapping("/send") + public ResponseMessage send(@RequestBody MailEO mailEO) throws Exception { + + MailTestUtils eu = new MailTestUtils(mail_username, mail_password); + SendEmailMessage sem = new SendEmailMessage(); + sem.setFrom(mail_username); + sem.setRecipient(mailEO.getToMail()); + sem.setSubject("镇长"); + sem.setText("hello world"); + DefaultConfigurer defaultConfigurer = new DefaultConfigurer(); + defaultConfigurer.setMail_smtp(mail_smtp); + defaultConfigurer.setMail_smtp_port(mail_smtp_port); + defaultConfigurer.setMail_pop_port(mail_pop_port); + eu.sendMail(defaultConfigurer.getSMTP(), sem); + System.out.println("发送成功"); +// 收邮件 +// eu.receiveMail(defaultConfigurer.getPOP3(), "pop3"); // pop3收信 +// System.out.println("收取完毕"); + +// 使用IMAP收信会抛出 Failed to load IMAP envelope 异常 +//eu.receiveMail(DefaultConfigurer.getIMAP(), "imap"); // imap收信 + return Result.success(); + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/MenuEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MenuEOController.java new file mode 100644 index 0000000..284b9e6 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/MenuEOController.java @@ -0,0 +1,291 @@ +package com.adc.da.sys.controller; + +import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; + + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.constraints.NotNull; + +import com.adc.da.sys.constant.IsBelongEnum; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.RoleMenuEO; +import com.adc.da.sys.page.RoleMenuEOPage; +import com.adc.da.sys.service.RoleEOService; +import com.adc.da.sys.service.RoleMenuEOService; +import com.adc.da.sys.vo.MenuVO; + +import com.adc.da.util.utils.BeanMapper; + +import com.adc.da.util.utils.StringUtils; +import com.adc.da.util.utils.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; + +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.service.MenuEOService; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.multipart.MultipartFile; + +@RestController +@RequestMapping("/${restPath}/sys/menu") +@Api(tags = {"Sys-菜单管理"}) +public class MenuEOController extends BaseController { + + /** + * 用于记录日志. + */ + private static final Logger logger = LoggerFactory.getLogger(MenuEOController.class); + + /** + * 1.MenuEOService 用于菜单相关service方法. + * + * @see MenuEOService + */ + @Resource + private MenuEOService menuEOService; + + @Resource + private RoleMenuEOService roleMenuEOService ; + + @Resource + private RoleEOService roleEOService ; + + + /** + * dozer相关,EO间VO转换 + * + * @see dozer + */ + @Resource + private BeanMapper beanMapper; + + /** + * 显示菜单详情,需要输入菜单id. + * 权限字段:sys:menu:get + * + * @param id 菜单ID + * @return 成功返回菜单详情,失败返回异常信息 + */ + @ApiOperation(value = "|MenuEO|详情") + @GetMapping("/{id}") + //@RequiresPermissions("sys:menu:get") + public ResponseMessage find(@NotNull @PathVariable("id") final String id) { + + try { + return Result.success(beanMapper.map(menuEOService.selectByPrimaryKey(id), MenuVO.class)); + } catch (Exception e) { + logger.error("菜单详情获取失败", e); + return Result.error("表单详情获取失败:"); + } + + } + + /** + * 新增菜单.若菜单名为空之间返回error. + * 权限字段:sys:menu:save + * + * @param menuVO 菜单单信息 + * @return 成功返回菜单信息,失败返回异常信息 + */ + @ApiOperation(value = "|MenuEO|新增") + @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE) + //@RequiresPermissions("sys:menu:save") + public ResponseMessage create(@RequestBody final MenuVO menuVO) { + + if (StringUtils.isEmpty(menuVO.getName())) { + return Result.error("菜单名不能为空"); + } + if(StringUtils.isEmpty(menuVO.getParentId())){ + return Result.error("父菜单id不能为空"); + } + try { + menuVO.setId(UUID.randomUUID10()); + int conflict = menuEOService.queryConflict(menuVO.getName(),menuVO.getId(),menuVO.getParentId()); + if (conflict == 0) { + MenuEO menuEO = beanMapper.map(menuVO, MenuEO.class) ; + MenuEO parentMenu = menuEOService.selectByPrimaryKey(menuVO.getParentId()); + menuEO.setParent(parentMenu); + menuEOService.insertMenu(menuEO); + return Result.success(beanMapper.map(menuEO, MenuVO.class)); + }else { + return Result.error("-1","新增菜单失败: 所选父节点下有相同的“菜单名称”,请修改!"); + } + } catch (Exception e) { + logger.error("新增菜单失败", e); + return Result.error("-1","新增菜单失败!"); + } + + } + + /** + * 显示角色对应菜单. + * 权限字段:sys:menu:list + * 路径"/" + * + * @param roleId 角色id + * @return 菜单列表 + */ + @ApiOperation(value = "|MenuEO|列表 --> 角色对应的菜单") + @GetMapping() + //@RequiresPermissions("sys:menu:list") + public ResponseMessage> listType( String roleId) throws Exception { + List menuVOs = beanMapper.mapList(menuEOService.findAll(),MenuVO.class); + RoleMenuEOPage roleMenuEOPage = new RoleMenuEOPage() ; + roleMenuEOPage.setPageSize(1000); + + if (roleId != null && !"".equals(roleId)) { + roleMenuEOPage.setRoleId(roleId); + RoleEO roleEO = roleEOService.selectByPrimaryKey(roleId); + if ("管理员".equals(roleEO.getName())) { + menuVOs.forEach(menuVO -> { + menuVO.setBelong(IsBelongEnum.BELONG.getValue()); + }); + }else{ + List roleMenuEOList =roleMenuEOService.queryByList(roleMenuEOPage); + for (MenuVO menuVO : menuVOs) { + for (RoleMenuEO roleMenuEO : roleMenuEOList){ + if (StringUtils.equals(menuVO.getId(),roleMenuEO.getMenuId())){ + menuVO.setBelong(IsBelongEnum.BELONG.getValue()); + break; + } + } + } + } + + } + + //List levelMenus = menuEOService.changeMenu(menuVOs); + + return Result.success(menuVOs); + } + + + + /** + * 修改菜单信息. + * 权限字段:sys:menu:update + * + * @param menuVO 菜单参数 + * @return 修改结果,和改动后的参数 + */ + @ApiOperation(value = "|MenuEO|修改") + @PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE) + //@RequiresPermissions("sys:menu:update") + public ResponseMessage update(@RequestBody final MenuVO menuVO) { + if (StringUtils.isEmpty(menuVO.getName())) { + return Result.error("菜单名不能为空"); + } + try { + int conflict = menuEOService.queryConflict(menuVO.getName(),menuVO.getId(),menuVO.getParentId()); + if (conflict == 0) { + MenuEO menuEO = beanMapper.map(menuVO, MenuEO.class) ; + MenuEO parentMenu = menuEOService.selectByPrimaryKey(menuVO.getParentId()); + menuEO.setParent(parentMenu); + MenuVO parentMenuVO = beanMapper.map(parentMenu, MenuVO.class) ; + menuVO.setParent(parentMenuVO); + menuEOService.updateMenu(menuVO); + }else { + return Result.error("-1", "修改菜单失败: 所选父节点下有相同的“菜单排序”,请修改! ", menuVO); + } + } catch (Exception e) { + logger.error("修改菜单失败: ", e); + return Result.error("-1", "修改菜单失败 ", menuVO); + } + return Result.success(menuVO); + } + + /** + * 删除菜单,可删除多个菜单. + * 权限字段:sys:menu:delete + * + * @param ids 菜单组 + * @return 处理结果 + */ + @ApiOperation(value = "|MenuEO|删除") + @DeleteMapping("/{ids}") + //@RequiresPermissions("sys:menu:delete") + public ResponseMessage delete(@NotNull @PathVariable("ids") final String[] ids) { + + menuEOService.delete(ids); + logger.info("log===>delete from TS_MENU where ids = {}", ids); + return Result.success(); + } + + /** + * 获取用户菜单列表. + * 权限字段:sys:menu:listMenuByUserId + * + * @param userId 用户id + * @return 菜单列表 + */ + @ApiOperation(value = "用户菜单列表|MenuEO|") + @GetMapping(value = "/listMenuByUserId") + //@RequiresPermissions("sys:menu:listMenuByUserId") + public ResponseMessage> listMenuByUserId(String userId) { + if(StringUtils.isEmpty(userId)){ + return Result.error("用户id不能为空"); + } + List list= menuEOService.listMenuEOByUserId(userId); + List entities = beanMapper.mapList(list, MenuVO.class); + + //List levelMenus = menuEOService.changeMenu(entities); + return Result.success(entities); + } + + @ApiOperation(value = "查询菜单|MenuEO|") + @GetMapping("/findAllMenus") +// @RequiresPermissions("sys:menu:listByName") + public ResponseMessage> findAllMenus() { + + List entities = beanMapper.mapList(menuEOService.findAll(),MenuVO.class); + //List levelMenus = menuEOService.changeMenu(entities); + return Result.success(entities); + + } + + + +// @ApiOperation(value = "查询提示信息") +// @GetMapping("/information") +// public ResponseMessage information() { +// +// String information = menuEOService.queryInformation(); +// return Result.success(information); +// +// } +// +// @ApiOperation(value = "编辑提示信息") +// @GetMapping("/updateInformation") +// public ResponseMessage updateInformation(String information) { +// +// int i = menuEOService.updateInformation(information); +// if(i==0){ +// menuEOService.insertInformation(information); +// } +// return Result.success(); +// +// } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleEOController.java new file mode 100644 index 0000000..32c0cc1 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleEOController.java @@ -0,0 +1,267 @@ +package com.adc.da.sys.controller; + +import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; + +import java.util.List; + +import javax.validation.constraints.NotNull; + +import com.adc.da.sys.dao.mysql.RoleEODao; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.vo.MenuVO; +import com.adc.da.util.utils.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.DeleteMapping; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.adc.da.base.page.Pager; +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.constant.IsBelongEnum; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.UserRoleEO; +import com.adc.da.sys.page.RoleEOPage; +import com.adc.da.sys.service.RoleEOService; +import com.adc.da.sys.vo.RoleVO; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.BeanMapper; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 角色管理模块相关接口. + * 1.分页查询 + * 2.角色详情 + * 3.角色列表 + * 4.新增角色 + * 5.修改角色 + * 6.删除角色 + * 7.配置角色菜单 + * date 2018/08/15 + * + * @author comments created by Lee Kwanho + * @see RoleEOService + * @see RoleEO + * @see RoleVO + * @see RoleEOPage + * @see RoleEODao + * @see mybatis.mapper.sys + */ +@RestController +@RequestMapping("/${restPath}/sys/role") +@Api(tags = {"Sys-角色管理"}) +public class RoleEOController extends BaseController { + + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(RoleEOController.class); + + /** + * 角色相关Service + */ + @Resource + private RoleEOService roleEOService; + + + /** + * dozer相关,EO间VO转换 + */ + @Resource + private BeanMapper beanMapper; + + /** + * 分页查询角色列表,可以根据角色名称进行查询 + * 权限字段:sys:role:pageList + * + * @param pageNo 页码 + * @param pageSize 分页大小 + * @param roleName 角色名称,非id + * @return 查询结果分页,异常会返回异常信息 + */ + @ApiOperation(value = "|RoleEO|分页查询") + @GetMapping("/page") +// @RequiresPermissions("sys:role:pageList") + public ResponseMessage> page(Integer pageNo, Integer pageSize, String roleName) { + RoleEOPage page = new RoleEOPage(); + if (pageNo != null) { + page.setPage(pageNo); + } + if (pageSize != null) { + page.setPageSize(pageSize); + } + if (StringUtils.isNotEmpty(roleName)) { + page.setName('%' + roleName + '%'); + page.setNameOperator("LIKE"); + } + page.setDelFlag("0");//没有删除 + page.setPager(new Pager()); + + try { + List rows = roleEOService.queryByPage(page); + return Result.success(beanMapper.mapPage(getPageInfo(page.getPager(), rows), RoleVO.class)); + } catch (Exception e) { + logger.error("Role Page Error:", e); + return Result.error("参数异常" + e.getMessage()); + } + + } + + /** + * 根据角色id查询角色信息 + * 权限字段:sys:role:get + * + * @param id 角色id + * @return 角色详情 + */ + @ApiOperation(value = "|RoleEO|详情") + @GetMapping("/{id}") +// @RequiresPermissions("sys:role:get") + public ResponseMessage getById(@NotNull @PathVariable("id") String id) { + RoleEO roleEO = roleEOService.getRoleWithMenus(id); + return Result.success(beanMapper.map(roleEO, RoleVO.class)); + } + + /** + * 根据角色编码查询角色信息 + * 权限字段:sys:role:get + * + * @param roleCode 角色编码 + * @return 角色详情 + */ + @ApiOperation(value = "|RoleEO|详情") + @GetMapping("getRoleByCode/{roleCode}") +// @RequiresPermissions("sys:role:get") + public ResponseMessage> getRoleByCode(@NotNull @PathVariable("roleCode") String roleCode) { + List roleEO = roleEOService.getRoleByCode(roleCode); + return Result.success(beanMapper.mapList(roleEO, RoleVO.class)); + } + + /** + * 显示角色列表,同时对该用户已有角色进行belong字段标注 + * 权限字段:sys:role:list + * + * @param userId 用户id + * @return 角色列表,该用户角色身份会的belong字段会标注 + */ + @ApiOperation(value = "|RoleEO|列表") + @GetMapping("") +// @RequiresPermissions("sys:role:list") + public ResponseMessage> list(String userId) { + List roleVOs = beanMapper.mapList(roleEOService.findAll(), RoleVO.class); + if (userId != null) { + for (RoleVO roleVO : roleVOs) { + if (roleEOService.isBelong(userId, roleVO.getRid())) { + roleVO.setBelong(IsBelongEnum.BELONG.getValue()); + } + } + } + return Result.success(roleVOs); + } + + /** + * 新增角色 + * 权限字段:sys:role:save + * + * @param roleVO 角色信息 + * @return 角色信息 + */ + @ApiOperation(value = "|RoleEO|新增") + @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE) +// @RequiresPermissions("sys:role:save") + public ResponseMessage create(@RequestBody RoleVO roleVO) { + RoleEO roleEO = roleEOService.save(beanMapper.map(roleVO, RoleEO.class)); + roleVO.setRid(roleEO.getId()); + return Result.success(roleVO); + } + + /** + * 修改角色信息 + * 权限字段:sys:role:update + * + * @param roleVO 角色信息 + * @return 若成功,返回角色信息;否则记录日志,返回异常信息 + */ + @ApiOperation(value = "|RoleEO|修改") + @PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE) +// @RequiresPermissions("sys:role:update") + public ResponseMessage update(@RequestBody RoleVO roleVO) { + + try { + roleEOService.updateByPrimaryKeySelective(beanMapper.map(roleVO, RoleEO.class)); + return Result.success(roleVO); + } catch (Exception e) { + logger.error("角色修改异常", e); + return Result.error("角色修改异常:" + e.getMessage()); + } + + } + + /** + * 删除角色,逻辑删除,若角色有对应用户则不能删除 + * 权限字段:sys:role:delete + * + * @param id 角色id + * @return 处理结果 + */ + @ApiOperation(value = "|RoleEO|删除") + @DeleteMapping("/{id}") +// @RequiresPermissions("sys:role:delete") + public ResponseMessage delete(@NotNull @PathVariable("id") String id) throws Exception { + RoleEO roleEO = roleEOService.selectByPrimaryKey(id); + if ("管理员".equals(roleEO.getName())) { + return Result.error( "管理员角色不能删除"); + } + List list = roleEOService.getUserRoleListByRoleId(id); + // 如果角色有对应用户,则不允许删除 + if (CollectionUtils.isNotEmpty(list)) { + return Result.error("该角色有对应用户,不能删除"); + } + + roleEOService.delete(id); + return Result.success(); + } + + /** + * 配置角色菜单 + * 权限字段:sys:role:saveRoleMenu + * + * @param roleVO 角色信息 + * @return 处理结果,返回角色VO + */ + @ApiOperation(value = "配置角色菜单|RoleEO|") + @PostMapping("/saveRoleMenu") +// @RequiresPermissions("sys:role:saveRoleMenu") + public ResponseMessage saveRoleMenu(@RequestBody RoleVO roleVO) { + roleEOService.saveRoleMenu(beanMapper.map(roleVO, RoleEO.class)); + return Result.success(roleVO); + } + + @ApiOperation(value = "配置角色首页|RoleEO|") + @PostMapping("/saveRoleHome") + public ResponseMessage saveRoleHome(@RequestBody RoleVO roleVO) { + roleEOService.saveRoleHome(beanMapper.map(roleVO, RoleEO.class)); + return Result.success(); + } + + @ApiOperation(value = "得到角色首页|RoleEO|") + @GetMapping("/getRoleHome") + public ResponseMessage getRoleHome(String roleId) throws Exception { + List homeList = roleEOService.getHomeMenu(roleId); + return Result.success(homeList); + } + +} + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleMenuEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleMenuEOController.java new file mode 100644 index 0000000..ffac158 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/RoleMenuEOController.java @@ -0,0 +1,58 @@ +package com.adc.da.sys.controller; + +import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; + +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.*; + +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.entity.RoleMenuEO; +import com.adc.da.sys.page.RoleMenuEOPage; +import com.adc.da.sys.service.RoleMenuEOService; + +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.http.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; + +@RestController +@RequestMapping("/${restPath}/sys/roleMenu") +@Api(description = "|RoleMenuEO|") +public class RoleMenuEOController extends BaseController{ + + private static final Logger logger = LoggerFactory.getLogger(RoleMenuEOController.class); + + @Resource + private RoleMenuEOService roleMenuEOService; + + @ApiOperation(value = "|RoleMenuEO|分页查询") + @GetMapping("/page") + //@RequiresPermissions("sys:roleMenu:page") + public ResponseMessage> page(RoleMenuEOPage page) throws Exception { + List rows = roleMenuEOService.queryByPage(page); + return Result.success(getPageInfo(page.getPager(), rows)); + } + + @ApiOperation(value = "|RoleMenuEO|查询") + @GetMapping("") + //@RequiresPermissions("sys:roleMenu:list") + public ResponseMessage> list(RoleMenuEOPage page) throws Exception { + return Result.success(roleMenuEOService.queryByList(page)); + } + + @ApiOperation(value = "|RoleMenuEO|新增") + @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE) + //@RequiresPermissions("sys:roleMenu:save") + public ResponseMessage create(@RequestBody RoleMenuEO roleMenuEO) throws Exception { + roleMenuEOService.insertSelective(roleMenuEO); + return Result.success(roleMenuEO); + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java new file mode 100644 index 0000000..7de7015 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java @@ -0,0 +1,274 @@ +package com.adc.da.sys.controller; + +import com.adc.da.base.web.BaseController; +import com.adc.da.excel.poi.excel.ExcelImportUtil; +import com.adc.da.excel.poi.excel.entity.ImportParams; +import com.adc.da.excel.poi.excel.entity.result.ExcelImportResult; +import com.adc.da.excel.poi.excel.entity.result.ExcelVerifyHanlderErrorResult; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.util.RSAUtil; +import com.adc.da.sys.vo.UserImportVO; +import com.adc.da.sys.vo.UserVO; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.FileUtil; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; + +@RestController +@RequestMapping("/${restPath}/sys/user") +@Api(tags = {"Sys-用户管理"}) +@Slf4j +public class UserEOController extends BaseController { + // + @Resource + private IUserEoService userEOService; +// +// +// +// /** +// * dozer相关,EO间VO转换 +// * +// * +// * @see dozer +// */ + + @Value("${MAIL_SMTP}") + private String mail_smtp; + + @Value("${MAIL_SMTP_PORT}") + private String mail_smtp_port; + + @Value("${MAIL_USERNAME}") + private String mail_username; + + @Value("${MAIL_PASSWORD}") + private String mail_password; + + @Value("${isPassEncrypted}") + private boolean isPassEncrypted; + + + @ApiOperation(value = "|UserEO|新增|编辑") + @PostMapping("addUser") +// @RequiresPermissions("sys:user:save") +// @BusinessLog(description = "用户新增") + @Transactional + public ResponseMessage addUser(@RequestBody String requestString) throws Exception { + + JsonParser parser = new JsonParser(); + Gson gson = new Gson(); + + String data = new String(Base64.decodeBase64(requestString), StandardCharsets.UTF_8); + JsonElement element = parser.parse(data); + UserEO eo = gson.fromJson(element, UserEO.class); +// UserEO eo=new UserEO(); +// BeanUtils.copyProperties(vo,eo); + eo.setPassword("EI$XIL@vdc9ptev7"); + if (StringUtils.isBlank(eo.getAccount())) { + return Result.error("用户名不能为空!"); + } + + if (StringUtils.isBlank(eo.getUsname())) { + return Result.error("姓名不能为空!"); + } + if (eo.getUsname().length() > 20) { + return Result.error("姓名不超过20字符!"); + } + if (eo.getRoleIdList() == null || eo.getRoleIdList().size() == 0) { + return Result.error("角色不能为空!"); + } + + /* + * 用户与密码都需要加解密 + */ + if (isPassEncrypted) { + + eo.setAccount(new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(eo.getAccount()), RSAUtil.PrivateKey))); +// eo.setPassword(new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(eo.getPassword()), RSAUtil.PrivateKey))); + } + +// if (!eo.getAccount().matches("^[A-Za-z0-9]{1,20}$")){ +// return Result.error("用户名必须为≤20位的纯数字、纯字母或字母数字组合!"); +// } + if ("admin".equals(eo.getAccount()) || + "root".equals(eo.getAccount()) || + "administrator".equals(eo.getAccount()) || + "test".equals(eo.getAccount()) || + "tester".equals(eo.getAccount())) { + return Result.error("用户名不符合规则!"); + } +// if (!eo.getPassword().matches("^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[a-zA-Z0-9]{8,16}$")){ +// return Result.error("密码必须为8-16位的大、小写字母和数字组合!"); +// } + if (StringUtils.isNotBlank(eo.getCellPhoneNumber())) { + if (!eo.getCellPhoneNumber().matches("^[1][3,4,5,7,8,9][0-9]{9}$")) { + return Result.error("手机号不符合规则!"); + } + } + //部门 非必填 <=20字符 + if (StringUtils.isNotBlank(eo.getDepartment())) { + if (eo.getDepartment().length() > 50) { + return Result.error("部门不超过50字符!"); + } + } + + if (eo.getEmail() != null) { + eo.setEmail(eo.getEmail().replace("amp;", "")); + } + + + //是新增 + if (userEOService.getUserByLoginName(eo.getAccount(), eo.getUsid()) != null) { + return Result.error("用户名已存在!"); + } + + + userEOService.save(eo); + + return Result.success(); + } + + @ApiOperation("用户启用或禁用") + @PostMapping("/isUse/{usid}/{type}") + public ResponseMessage isUse(@PathVariable("usid") String usid, @PathVariable("type") String type) { + userEOService.setIsUse(usid, type); + return Result.success(); + } + + @ApiOperation("获取所有用户") + @GetMapping("/list") + public ResponseMessage list(int pageNo, int pageSize, String account, String roleName) { + IPage> list = userEOService.list(pageNo, pageSize, account, roleName); + list.getRecords().forEach(c -> { + try { + c.put("CELLPHONE_NUMBER", StringUtils.isNotEmpty(c.get("CELLPHONE_NUMBER")) ? EncryptUtil.decrypt(c.get("CELLPHONE_NUMBER").toString()) + : ""); + c.put("EMAIL", StringUtils.isNotEmpty(c.get("EMAIL")) ? EncryptUtil.decrypt(c.get("EMAIL").toString()) : ""); + } catch (Exception e) { + e.printStackTrace(); + } + }); + return Result.success(list); + } + + @ApiOperation("获取所有用户All") + @GetMapping("/allList") + public ResponseMessage allList( String account, String roleName) { + List> list = userEOService.allList(account, roleName); + list.forEach(c -> { + try { + c.put("CELLPHONE_NUMBER", StringUtils.isNotEmpty(c.get("CELLPHONE_NUMBER")) ? EncryptUtil.decrypt(c.get("CELLPHONE_NUMBER").toString()) + : ""); + c.put("EMAIL", StringUtils.isNotEmpty(c.get("EMAIL")) ? EncryptUtil.decrypt(c.get("EMAIL").toString()) : ""); + } catch (Exception e) { + e.printStackTrace(); + } + }); + return Result.success(list); + } + + + @ApiOperation("删除用户") + @PostMapping("/delete") + public ResponseMessage delete(String ids) { + userEOService.delete(ids); + return Result.success(); + } + + + @ApiOperation("批量导入") + @PostMapping("/import") + public ResponseMessage importExcel(@RequestPart MultipartFile file) { + InputStream is = null; + try { + String fileExtension = FileUtil.getFileExtension(file.getOriginalFilename()); + is = file.getInputStream(); + if (!fileExtension.endsWith("xls") && !fileExtension.endsWith("xlsx")) { + return Result.error("请上传Excel格式文件"); + } + ImportParams params = new ImportParams(); + + List userImportVOList = ExcelImportUtil.importExcel(file.getInputStream(), UserImportVO.class, params); + userEOService.importExcelUser(userImportVOList); + + } catch (Exception e) { + e.printStackTrace(); + return Result.error(e.getMessage()); + } finally { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + return Result.error(e.getMessage()); + } + } + + return Result.success(); + } + + @ApiOperation("下载模板") + @GetMapping("/template") + public ResponseMessage download(HttpServletResponse response) { + + try { + InputStream fis = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/用户导入模板.xlsx"); + byte[] buffer = new byte[fis.available()]; + fis.read(buffer); + fis.close(); + response.reset(); + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("用户导入模板.xlsx","UTF-8")); + OutputStream toClient = new BufferedOutputStream(response.getOutputStream()); + + toClient.write(buffer); + + toClient.flush(); + + toClient.close(); + + } catch (IOException ex) { + + ex.printStackTrace(); + + } + return Result.success(); + + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmMenuEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmMenuEOController.java new file mode 100644 index 0000000..ced392c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmMenuEOController.java @@ -0,0 +1,70 @@ +package com.adc.da.sys.controller.ddm; + +import com.adc.da.base.page.BasePage; +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.MenuEOService; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.vo.ddm.DdmMenuListVO; +import com.adc.da.sys.vo.ddm.DdmMenuVO; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/${portalPath}") +@Api(tags = {"ddm-菜单类接口"}) +public class DdmMenuEOController extends BaseController { +// + @Resource + private MenuEOService menuEOService; + + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(DdmMenuEOController.class); + + @ApiOperation("查询菜单") + @PostMapping("/model/list.do") + public DdmResponseMessage list( ){ + try { + + List menuEOS = menuEOService.findAll(); + List ddmMenuListVOList = new ArrayList<>(); + menuEOS.forEach(menuEO -> { + DdmMenuListVO ddmMenuListVO = new DdmMenuListVO(); + ddmMenuListVO.setModelId(menuEO.getId()); + ddmMenuListVO.setModelName(menuEO.getName()); + ddmMenuListVO.setParentModelCode(menuEO.getParentId()); + ddmMenuListVOList.add(ddmMenuListVO); + }); + HashMap dataMap =new HashMap<>(); + dataMap.put("modelList",ddmMenuListVOList); + return DdmResult.success(dataMap) ; + + } catch (Exception e) { + logger.error("查询菜单", e); + return DdmResult.error("查询菜单:" + e.getMessage()); + } + } + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResponseMessage.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResponseMessage.java new file mode 100644 index 0000000..92b0148 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResponseMessage.java @@ -0,0 +1,47 @@ +package com.adc.da.sys.controller.ddm; + + +public class DdmResponseMessage { + private String resCode; + private String resMsg; + private T data; + + public DdmResponseMessage() { + } + + public DdmResponseMessage(String respCode, String message,T data) { + this.resCode = respCode; + this.resMsg = message; + this.data=data; + } + + public DdmResponseMessage(String respCode, String message) { + this.resCode = respCode; + this.resMsg = message; + } + + public String getResCode() { + return resCode; + } + + public void setResCode(String resCode) { + this.resCode = resCode; + } + + public String getResMsg() { + return resMsg; + } + + public void setResMsg(String resMsg) { + this.resMsg = resMsg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResult.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResult.java new file mode 100644 index 0000000..809236d --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmResult.java @@ -0,0 +1,36 @@ +package com.adc.da.sys.controller.ddm; + +public class DdmResult { + public DdmResult() { + } + + + public static DdmResponseMessage success(String code, T t) { + return new DdmResponseMessage(code, "success", t); + } + + public static DdmResponseMessage success( T t) { + return success("0","success", t); + } + + public static DdmResponseMessage success() { + return success("0","success"); + } + + public static DdmResponseMessage success(String code, String message) { + return new DdmResponseMessage(code, message); + } + + public static DdmResponseMessage success(String code, String message, T t) { + return new DdmResponseMessage(code, message, t); + } + + + public static DdmResponseMessage error(String message) { + return new DdmResponseMessage("1", message); + } + + + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmRoleEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmRoleEOController.java new file mode 100644 index 0000000..7234a1b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmRoleEOController.java @@ -0,0 +1,327 @@ +package com.adc.da.sys.controller.ddm; + +import com.adc.da.base.page.Pager; +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.constant.IsBelongEnum; +import com.adc.da.sys.dao.mysql.RoleEODao; +import com.adc.da.sys.dao.mysql.UserEODao; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.RoleMenuEO; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.entity.UserRoleEO; +import com.adc.da.sys.page.RoleEOPage; +import com.adc.da.sys.page.RoleMenuEOPage; +import com.adc.da.sys.service.MenuEOService; +import com.adc.da.sys.service.RoleEOService; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.vo.MenuVO; +import com.adc.da.sys.vo.RoleVO; +import com.adc.da.sys.vo.UserRoleVO; +import com.adc.da.sys.vo.ddm.*; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.BeanMapper; +import com.adc.da.util.utils.CollectionUtils; +import com.adc.da.util.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.crypto.hash.Hash; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; + +/** + * 角色管理模块相关接口. + * 1.分页查询 + * 2.角色详情 + * 3.角色列表 + * 4.新增角色 + * 5.修改角色 + * 6.删除角色 + * 7.配置角色菜单 + * date 2018/08/15 + * + * @author comments created by Lee Kwanho + * @see RoleEOService + * @see RoleEO + * @see RoleVO + * @see RoleEOPage + * @see RoleEODao + * @see mybatis.mapper.sys + */ +@RestController +@RequestMapping("/${portalPath}") +@Api(tags = {"ddm-角色类接口"}) +public class DdmRoleEOController extends BaseController { + + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(DdmRoleEOController.class); + + /** + * 角色相关Service + */ + @Resource + private RoleEOService roleEOService; + + @Resource + private RoleEODao roleEODao; + + @Resource + private UserEODao userEODao; + + + /** + * dozer相关,EO间VO转换 + */ + @Resource + private BeanMapper beanMapper; + + + @ApiOperation(value = "|查询角色") + @GetMapping("/role/list.do") +// @RequiresPermissions("sys:role:list") + public DdmResponseMessage>> list() { + List roleEOList = roleEOService.findAll(); + List ddmRoleVOList = new ArrayList<>(); + for (RoleEO roleEO : roleEOList) { + DdmRoleVO ddmRoleVO = new DdmRoleVO(roleEO); + ddmRoleVOList.add(ddmRoleVO); + } + HashMap> dataMap = new HashMap<>(); + dataMap.put("roles",ddmRoleVOList); + return DdmResult.success(dataMap); + } + + + @ApiOperation(value = "|角色创建") + @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE, value = "/role/save.do") +// @RequiresPermissions("sys:role:save") + public DdmResponseMessage create(@RequestBody DdmRoleCreateVO ddmRoleCreateVO) { + if (null == ddmRoleCreateVO || StringUtils.isEmpty(ddmRoleCreateVO.getRoleName())) { + return DdmResult.error("角色名称不能为空"); + } + try { + RoleEO roleEO = new RoleEO(); + roleEO.setName(ddmRoleCreateVO.getRoleName()); + roleEO.setRemarks(ddmRoleCreateVO.getRoleDesc()); + roleEO = roleEOService.save(roleEO); + } catch (Exception e) { + logger.error("角色创建失败:", e); + return DdmResult.error("角色创建失败:"+e.getMessage()); + } + return DdmResult.success(); + } + + @ApiOperation(value = "角色修改") + @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE, value = "/role/update.do") +// @RequiresPermissions("sys:role:update") + public DdmResponseMessage update(@RequestBody DdmRoleVO ddmRoleVO) { + if (null == ddmRoleVO || StringUtils.isEmpty(ddmRoleVO.getRoleName()) || StringUtils.isEmpty(ddmRoleVO.getRoleId())) { + return DdmResult.error("角色ID和角色名称不能为空"); + } + try { + RoleEO roleEO = new RoleEO(); + roleEO.setId(ddmRoleVO.getRoleId()); + roleEO.setRemarks(ddmRoleVO.getRoleDesc()); + roleEO.setName(ddmRoleVO.getRoleName()); + roleEOService.updateByPrimaryKeySelective(roleEO); + return DdmResult.success(); + } catch (Exception e) { + logger.error("角色修改失败:", e); + return DdmResult.error("角色修改失败:"+e.getMessage()); + } + + } + + /** + * 删除角色,逻辑删除,若角色有对应用户则不能删除 + */ + //todo + @ApiOperation(value = "|角色删除") + @PostMapping("/role/delete.do") +// @RequiresPermissions("sys:role:delete") + public DdmResponseMessage delete(@RequestBody HashMap query) { + + if (CollectionUtils.isEmpty(query) || StringUtils.isEmpty(query.get("roleCode"))) { + return DdmResult.error("角色ID不能为空"); + } + String roleId = query.get("roleCode"); + try { + RoleEO roleEO = roleEOService.selectByPrimaryKey(roleId); + if ("管理员".equals(roleEO.getName())) { + return DdmResult.error("管理员角色不能删除"); + } + List list = roleEOService.getUserRoleListByRoleId(roleId); + // 如果角色有对应用户,则不允许删除 + if (CollectionUtils.isNotEmpty(list)) { + return DdmResult.error("该角色有对应用户,不能删除"); + } + roleEOService.delete(roleId); + } catch (Exception e) { + logger.error("删除角色失败:", e); + return DdmResult.error("删除角色失败:"+e.getMessage()); + } + return DdmResult.success(); + } + + @ApiOperation(value = "查询角色用户") + @PostMapping("/role/queryRoleUser.do") + public DdmResponseMessage getRoleUsers(@RequestBody DdmRoleUserQuery query) { + List list; + if (null == query.getPageSize()) { + query.setPageSize(10000); + } + try { + PageInfo userInfoPage = roleEOService.getUserInfoPageByRoleId(query); + List ddmUserVOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(userInfoPage.getList())) { + userInfoPage.getList().forEach(userRoleVO -> { + DdmUserVO ddmUserVO = new DdmUserVO(); + ddmUserVO.setUserId(userRoleVO.getUserId()); + ddmUserVO.setUserAccount(userRoleVO.getAccount()); + ddmUserVO.setUserName(userRoleVO.getUsname()); + ddmUserVOList.add(ddmUserVO); + }); + } + HashMap resultMap = new HashMap<>(); + resultMap.put("recordCount", userInfoPage.getCount()); + resultMap.put("recordPages", userInfoPage.getPageCount()); + resultMap.put("userList", ddmUserVOList); + return DdmResult.success(resultMap); + + } catch (Exception e) { + logger.error("查询角色用户失败", e); + return DdmResult.error("查询角色用户失败:" + e.getMessage()); + } + } + + @ApiOperation(value = "角色添加用户") + @PostMapping("/role/roleAddUser.do") + public DdmResponseMessage saveRoleUsers(@RequestBody DdmUserRoleAdd ddmUserRoleAdd) { + if (null==ddmUserRoleAdd){ + return DdmResult.error("角色添加用户失败:" + "参数不能为空"); + } + List userRoles = ddmUserRoleAdd.getUserRoles(); + try { + userRoles.forEach(ddmUserRoleVO -> { + //传参由用户id变成了用户账号,根绝用户id 找出account + UserEO ddmUser = userEODao.getDdmUserEOByAccountNotDeleted(ddmUserRoleVO.getUserId()); + if (null==ddmUser){ + throw new AdcDaBaseException("角色添加用户失败:" + "用户"+ddmUserRoleVO.getUserId()+"不存在"); + } + UserRoleEO userRoleEO = new UserRoleEO(); + userRoleEO.setRoleId(ddmUserRoleVO.getRoleId()); + userRoleEO.setUserId(ddmUser.getUsid()); + roleEOService.saveRoleUser(userRoleEO); + }); + } catch (Exception e) { + logger.error("角色添加用户失败", e); + return DdmResult.error("角色添加用户失败:" + e.getMessage()); + } + return DdmResult.success(); + } + + @ApiOperation(value = "角色删除用户") + @PostMapping("/role/roleDelUser.do") + public DdmResponseMessage deleteRoleUsers(@RequestBody DdmUserRolesDeleteVO ddmUserRolesDeleteVO) { + try { + if (null == ddmUserRolesDeleteVO || null == ddmUserRolesDeleteVO.getUserRoles()) { + return DdmResult.error("参数不能为空"); + } + List userRoles = ddmUserRolesDeleteVO.getUserRoles(); + + List userRoleEOList = new ArrayList<>(); + userRoles.forEach(ddmUserRoleVO -> { + //传参由用户id变成了用户账号,根绝用户id 找出account + UserEO ddmUser = userEODao.getDdmUserEOByAccountNotDeleted(ddmUserRoleVO.getUserId()); + if (null==ddmUser){ + throw new AdcDaBaseException("角色删除用户失败:" + "用户"+ddmUserRoleVO.getUserId()+"不存在"); + } + UserRoleEO userRoleEO = new UserRoleEO(); + userRoleEO.setUserId(ddmUser.getUsid()); + userRoleEO.setRoleId(ddmUserRoleVO.getRoleId()); + userRoleEOList.add(userRoleEO); + }); + roleEOService.deleteRoleUsers(userRoleEOList); + } catch (Exception e) { + logger.error("角色删除用户失败", e); + return DdmResult.error("角色删除用户失败:" + e.getMessage()); + } + return DdmResult.success(); + } + + + @ApiOperation(value = "查询角色菜单") + @PostMapping("/role/queryRoleModel.do") + public DdmResponseMessage getRoleMenus(@RequestBody HashMap queryMap) { + try { + if (CollectionUtils.isEmpty(queryMap) || StringUtils.isEmpty(queryMap.get("roleId"))) { + return DdmResult.error("参数不能为空"); + } + String roleId = queryMap.get("roleId"); + List roleMenuEOList = roleEOService.getRoleMenuInfoList(roleId); + HashMap dataMap = new HashMap<>(); + dataMap.put("modelList", roleMenuEOList); + return DdmResult.success(dataMap); + + } catch (Exception e) { + logger.error("查询角色菜单失败", e); + return DdmResult.error("查询角色菜单失败:" + e.getMessage()); + } + + } + + @ApiOperation(value = "角色添加菜单") + @PostMapping("/role/roleAddModel.do") + public DdmResponseMessage addRoleMenus(@RequestBody DdmRoleMenuCreate ddmRoleMenuCreate) { + if (null==ddmRoleMenuCreate ||CollectionUtils.isEmpty( ddmRoleMenuCreate.getRoleModels())) { + return DdmResult.error("参数不能为空"); + } + try { + List roleModels = ddmRoleMenuCreate.getRoleModels(); + roleEOService.saveRoleMenuByDdm(roleModels); + return DdmResult.success(); + + } catch (Exception e) { + logger.error("角色添加菜单失败", e); + return DdmResult.error("角色添加菜单失败:" + e.getMessage()); + } + + } + + @ApiOperation(value = "角色删除菜单") + @PostMapping("/role/roleDelModel.do") + public DdmResponseMessage deleteRoleMenus(@RequestBody DdmRoleMenuDelete ddmRoleMenuDelete) { + try { + if (null==ddmRoleMenuDelete ||CollectionUtils.isEmpty( ddmRoleMenuDelete.getRoleModels())) { + return DdmResult.error("参数不能为空"); + } + List roleModels = ddmRoleMenuDelete.getRoleModels(); + for (DdmRoleMenuCreateVO ddmRoleMenuCreateVO : roleModels) { + /*新增角色关联*/ + roleEODao.deleteRoleMenu(ddmRoleMenuCreateVO.getRoleId(), ddmRoleMenuCreateVO.getModelId()); + } + return DdmResult.success(); + + } catch (Exception e) { + logger.error("角色删除菜单失败", e); + return DdmResult.error("角色删除菜单失败:" + e.getMessage()); + } + + } +} + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmUserEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmUserEOController.java new file mode 100644 index 0000000..d9f31fd --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/ddm/DdmUserEOController.java @@ -0,0 +1,71 @@ +package com.adc.da.sys.controller.ddm; + +import com.adc.da.base.web.BaseController; +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.util.RSAUtil; +import com.adc.da.sys.vo.UserRoleVO; +import com.adc.da.sys.vo.UserVO; +import com.adc.da.sys.vo.ddm.DdmUserQueryVO; +import com.adc.da.sys.vo.ddm.DdmUserVO; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/${portalPath}") +@Api(tags = {"ddm-用户类接口"}) +@Slf4j +public class DdmUserEOController extends BaseController { +// + @Resource + private IUserEoService userEOService; + + /** + * 日志 + */ + private static final Logger logger = LoggerFactory.getLogger(DdmUserEOController.class); + + @ApiOperation("查询用户") + @PostMapping("/user/list.do") + public DdmResponseMessage list(@RequestBody DdmUserQueryVO userQueryVO){ + try { + if (null==userQueryVO.getPageSize()){ + userQueryVO.setPageSize(100000); + } + PageInfo userPage = userEOService.getUserPage(userQueryVO); + HashMap resultMap = new HashMap<>(); + resultMap.put("recordCount", userPage.getCount()); + resultMap.put("recordPages", userPage.getPageCount()); + resultMap.put("userList", userPage.getList()); + return DdmResult.success(resultMap); + + } catch (Exception e) { + logger.error("查询角色用户失败", e); + return DdmResult.error("查询角色用户失败:" + e.getMessage()); + } + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MailEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MailEODao.java new file mode 100644 index 0000000..28386de --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MailEODao.java @@ -0,0 +1,15 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.MailEO; +import com.adc.da.sys.entity.MenuEO; +import com.baomidou.mybatisplus.core.metadata.IPage; + +/** + * @Author sima + * @Date 2022/6/24 14:16 + */ +public interface MailEODao extends BaseDao { + + IPage list(IPage page); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MenuEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MenuEODao.java new file mode 100644 index 0000000..fefcc73 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/MenuEODao.java @@ -0,0 +1,106 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.MenuEO; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.PathVariable; + +import java.util.ArrayList; +import java.util.List; + +/** + *
    + * 功能:TS_MENU MenuEODao
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @author comments created by Lee Kwanho + * @see mybatis.mapper.sys + */ +public interface MenuEODao extends BaseDao { + + /** + * 获取所有的菜单 + * + * @return 所有菜单 + */ + List findAll(); + + /** + * 获取角色对应的所有菜单 + * + * @param roleId 角色ID + * @return 角色对应的所有菜单 + */ + List listMenuEOByRoleID(String roleId); + + /** + * 获取用户的所有菜单 + * + * @param userId 用户ID + * @return 用户的所有菜单 + */ + List listMenuEOByUserId(String userId); + + + /** + * 获取当前节点的所有子节点 + * + * @param parentId 当前节点 + * @return 返回所有子节点 + */ + List getChildMenus(String parentId); + + /** + * 逻辑删除所有菜单 + * + * @param ids 菜单ID + */ + void deleteMenuLogic(String[] ids); + + void deleteMenuByParentId(@Param("pId")String pId); + + /** + * 删除角色与当前菜单以及子菜单关系 + * + * @param ids 菜单id组 + */ + void deleteRoleMenus(String[] ids); + + /** + * 判定菜单是否属于角色 + * + * @param roleId 角色ID + * @param menuId 菜单ID + * @return 如果>0说明存在记录,菜单属于角色 + */ + int isBelong(@Param("roleId") String roleId, @Param("menuId") String menuId); + + /** + * Dao 根据菜单名进行菜单查询,返回关联菜单以及父级菜单信息 + * + * @param menuName 菜单名 + * @return 查询结果 + * @author Lee Kwanho 李坤澔 + * date 2018-08-22 + **/ + List listMenuEOByMenuName(@Param("menuName") String menuName); + + + int queryConflict(@Param("name") String name ,@Param("id") String id , @Param("parentId") String parentId); + + List findIndustryAll(); + + List listIndustryByUserId(String userId); + + List listMenuEOByMenuIds(@Param("ids") List ids); + + List listMenuEOByRoleId(@Param("roleId")String roleId); + +// String queryInformation(); +// +// int updateInformation(@Param("information") String information); +// +// int insertInformation(@Param("information") String information ); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleEODao.java new file mode 100644 index 0000000..df2e0b7 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleEODao.java @@ -0,0 +1,120 @@ +package com.adc.da.sys.dao.mysql; + +import java.util.List; + +import com.adc.da.sys.vo.UserRoleVO; +import com.adc.da.sys.vo.ddm.DdmRoleUserQuery; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.UserRoleEO; + +/** + *
    + * 功能:TS_ROLE RoleEODao
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @author comments created by Lee Kwanho + * @see mybatis.mapper.sys + */ +public interface RoleEODao extends BaseDao { + + /** + * 保存角色信息 + * + * @param sysRoleEO 角色信息 + */ + void save(RoleEO sysRoleEO); + + /** + * 获取角色菜单 + * + * @param id 角色id + * @return 角色菜单 + */ + RoleEO getRoleWithMenus(String id); + + /** + * 获取角色信息,可能有多角色 + * + * @param userId 用户id + * @return 角色列表 + */ + List getRoleListByUserId(String userId); + + /** + * 删除角色 + * + * @param roleId 角色id + */ + void deleteLogic(String roleId); + + /** + * 删除角色菜单关联 + * + * @param roleId 角色id + */ + void deleteRoleMenuByRoleId(String roleId); + + /** + * 获取所有角色 + * + * @return 全角色信息 + */ + List findAll(); + + /** + * 查询角色所对应的用户 + * + * @param roleId 角色id + * @return 用户列表 + */ + List getUserRoleListByRoleId(String roleId); + + /** + * 获取菜单id组 , 用角色id + * + * @param roleId 角色id + * @return 菜单id组 + */ + List getMenuIdListByRoleId(String roleId); + + /** + * 新增角色菜单关联 + * + * @param roleId 角色id + * @param menuId 菜单id + */ + void saveRoleMenu(@Param("roleId") String roleId, @Param("menuId") String menuId); + + /** + * 删除角色菜单关联 + * + * @param roleId 角色id + * @param menuId 菜单id + */ + void deleteRoleMenu(@Param("roleId") String roleId, @Param("menuId") String menuId); + + /** + * 判断角色是否属于相应用户 + * + * @param userId 用户id + * @param roleId 角色id + * @return 若属于返回1 ,否则返回0 + */ + int isBelong(@Param("userId") String userId, @Param("roleId") String roleId); + + List getRoleByCode(String roleCode); + + String getpidByMenuId(@Param("id") String id); + + List getUserInfoListByRoleId(@Param("roleId") String roleId); + + IPage getUserInfoPageByRoleId(IPage page,String roleId); + + Long getUserCountByRoleId(@Param("roleId") String roleId); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleHomeEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleHomeEODao.java new file mode 100644 index 0000000..5b65d8b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleHomeEODao.java @@ -0,0 +1,26 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.entity.RoleHomeEO; +import com.adc.da.sys.entity.RoleMenuEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * + *
    + * 功能:TR_ROLE_MENU RoleMenuEODao
    + * 作者:code generator
    + * 日期: 2019-09-02
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public interface RoleHomeEODao extends BaseMapper { + + void insertRoleHomeBatch(@Param("rhList")List list); + + List getHomeListByRoleId(@Param("roleId")String roleId); + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleMenuEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleMenuEODao.java new file mode 100644 index 0000000..5b3e786 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleMenuEODao.java @@ -0,0 +1,23 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.RoleMenuEO; +import com.adc.da.sys.vo.ddm.DdmMenuVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *
    + * 功能:TR_ROLE_MENU RoleMenuEODao
    + * 作者:code generator
    + * 日期: 2019-09-02
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public interface RoleMenuEODao extends BaseDao { + + List getRoleMenuList(@Param("roleId") String roleId); + + List getRoleMenuInfoList(@Param("roleId") String roleId); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleOrgEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleOrgEODao.java new file mode 100644 index 0000000..0063f08 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/RoleOrgEODao.java @@ -0,0 +1,28 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.RoleOrgEO; + +import java.util.List; + +/** + * + *
    + * 功能:TR_ROLE_ORG RoleOrgEODao
    + * 作者:Wei Jinjin
    + * 日期: 2019-10-28
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public interface RoleOrgEODao extends BaseDao { + + /** + * 删除角色组织机构关联 + */ + void deleteRoleOrgByRoleId(String roleId); + + /** + * 根据角色ID,获取部门ID列表 + */ + List queryOrgIdList(String[] roleIds); + +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java new file mode 100644 index 0000000..1eb83e8 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java @@ -0,0 +1,52 @@ +package com.adc.da.sys.dao.mysql; + +import java.util.List; +import java.util.Map; + +import com.adc.da.sys.vo.ddm.DdmUserQueryVO; +import com.adc.da.sys.vo.ddm.DdmUserVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; + +import com.adc.da.sys.entity.UserEO; + +/** + *
    + * 功能:TS_USER UserEODao
    + * 作者:code generator
    + * 日期: 2017-12-18
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @author comments created by Lee Kwanho + * @see mybatis.mapper.sys + */ +public interface UserEODao extends BaseMapper { + + IPage> list(IPage page, @Param("account") String account, @Param("roleName") String roleName); + + /** + * 查询用户及用户所对应的角色 + * + * @param id 用户id + * @return 用户信息 + */ + UserEO getUserWithRoles(String id); + + // 根据account获取未逻辑删除的UserEO + UserEO getUserEOByAccountNotDeleted(String account); + + IPage getUserPage(IPage page, @Param("userAccount") String account, @Param("userName") String userName); + + Long getUserCount(DdmUserQueryVO ddmUserQueryVO); + + int insertUserBatch(@Param("userEOList") List userEOList); + + UserEO getDdmUserEOByAccountNotDeleted(String account); + + List> allList( @Param("account") String account, @Param("roleName") String roleName); + + List getUserByMail(@Param("mailList") List mailList); + + List getUserByAccount(@Param("accountList") List accountList); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserRoleEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserRoleEODao.java new file mode 100644 index 0000000..afdee88 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserRoleEODao.java @@ -0,0 +1,23 @@ +package com.adc.da.sys.dao.mysql; + +import com.adc.da.base.dao.BaseDao; +import com.adc.da.sys.entity.UserRoleEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *
    + * 功能:TR_USER_ROLE UserRoleEODao
    + * 作者:code generator
    + * 日期: 2017-11-07
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @see mybatis.mapper.sys + */ +public interface UserRoleEODao extends BaseMapper { + + public int insertBatch(@Param("userRoleEOList") List userRoleEOList); + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/MailEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/MailEO.java new file mode 100644 index 0000000..31c8845 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/MailEO.java @@ -0,0 +1,23 @@ +package com.adc.da.sys.entity; + +import com.adc.da.base.entity.BaseEntity; +import lombok.Data; + +import java.util.Date; + +/** + * @Author sima + * @Date 2022/6/24 14:10 + */ +@Data +public class MailEO extends BaseEntity { + + String id; + String toMail;//收件人邮箱 + String ccMail;//抄送人 + String subject ;// 邮件主题 + String content ;// 邮件正文 + Date sendDate; + String strSendDate; + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/MenuEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/MenuEO.java new file mode 100644 index 0000000..3a5bfd5 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/MenuEO.java @@ -0,0 +1,183 @@ +package com.adc.da.sys.entity; + +import java.io.Serializable; + +import com.adc.da.base.entity.TreeEntity; + +/** + * 功能:TS_MENU MenuEOEntity
    + *

    + * 日期: 2017-12-21
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • extInfo -> ext_info
  • + *
  • sort -> sort
  • + *
  • remarks -> remarks
  • + *
  • permission -> permission
  • + *
  • isShow -> is_show
  • + *
  • icon -> icon
  • + *
  • href -> href
  • + *
  • parentIds -> parent_ids
  • + *
  • parentId -> parent_id
  • + *
  • name -> name
  • + *
  • delFlag -> del_flag
  • + *
  • id -> id
  • + * + * @author comments created by Lee Kwanho + * date 2018-08-17 + * @see com.adc.da.sys.controller.MenuEOController + */ +public class MenuEO extends TreeEntity implements Serializable { + private static final long serialVersionUID = 2497292638985614077L; + + /** + * 路径,网页路径 + */ + private String href; + + /** + * 图标 + */ + private String icon; + + + private String iconHref; + + + private String iconClick; + + + + private String iconClickHref; + + /** + * 排序字段 + */ + private String sort; + + /** + * 是否显示 + */ + private Integer isShow; + + /** + * 权限 + */ + private String permission; + + /** + * 说明 + */ + private String remarks; + + /** + * 以下为扩展字段-保留字段 + */ + private String extInfo; + /** + * + */ + private String isUrl; + + public String getIsUrl() { + return isUrl; + } + + public void setIsUrl(String isUrl) { + this.isUrl = isUrl; + } + + /** **/ + public String getExtInfo() { + return this.extInfo; + } + + /** **/ + public void setExtInfo(String extInfo) { + this.extInfo = extInfo; + } + + /** **/ + public String getSort() { + return this.sort; + } + + /** **/ + public void setSort(String sort) { + this.sort = sort; + } + + /** **/ + public String getRemarks() { + return this.remarks; + } + + /** **/ + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + /** **/ + public String getPermission() { + return this.permission; + } + + /** **/ + public void setPermission(String permission) { + this.permission = permission; + } + + /** **/ + public Integer getIsShow() { + return this.isShow; + } + + /** **/ + public void setIsShow(Integer isShow) { + this.isShow = isShow; + } + + /** **/ + public String getIcon() { + return this.icon; + } + + /** **/ + public void setIcon(String icon) { + this.icon = icon; + } + + /** **/ + public String getHref() { + return this.href; + } + + /** **/ + public void setHref(String href) { + this.href = href; + } + + public String getIconHref() { + return iconHref; + } + + public void setIconHref(String iconHref) { + this.iconHref = iconHref; + } + + public String getIconClick() { + return iconClick; + } + + public void setIconClick(String iconClick) { + this.iconClick = iconClick; + } + + public String getIconClickHref() { + return iconClickHref; + } + + public void setIconClickHref(String iconClickHref) { + this.iconClickHref = iconClickHref; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/OpenUserEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/OpenUserEO.java new file mode 100644 index 0000000..1e54b4e --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/OpenUserEO.java @@ -0,0 +1,80 @@ +package com.adc.da.sys.entity; + +import com.adc.da.base.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 功能:TS_USER UserEOEntity
    + * 日期: 2017-12-18
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • extInfo -> ext_info
  • + *
  • usname -> usname
  • + *
  • password -> password
  • + *
  • delFlag -> del_flag
  • + *
  • account -> account
  • + *
  • usid -> usid
  • + * + * @author comments created by Lee Kwanho + * date 2018-08-16 + * @see com.adc.da.sys.controller.UserEOController + */ + +@Data +@Accessors(chain = true) +@TableName("TS_OPEN_USER") +public class OpenUserEO extends BaseEntity implements Serializable { + + + + + /** + * 用户id + */ + @TableId(value = "ID",type =IdType.INPUT) + private String id; + + /** + * 用户id + */ + @TableId(value = "APP_ID") + private String appId; + + /** + * 密码 + */ + + @TableField("APP_SECRET") + private String password; + + /** + * 删除标记 + */ + @TableField("DEL_FLAG") + private Integer delFlag; + + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private String createTime; + /** + * 更新时间 + */ + @TableField("UPDATE_TIME") + private String updateTime; + + + @TableField("USNAME") + private String usname; + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleEO.java new file mode 100644 index 0000000..3516e5a --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleEO.java @@ -0,0 +1,204 @@ +package com.adc.da.sys.entity; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.adc.da.base.entity.BaseEntity; + +/** + * 功能:TS_ROLE RoleEOEntity
    + *

    + * 日期: 2017-12-21
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * java字段名转换为原始数据库列名。如果不存在则返回null
    + *

    字段列表:

    + *
  • isDefault -> is_default
  • + *
  • delFlag -> del_flag
  • + *
  • dataScope -> data_scope
  • + *
  • id -> id
  • + *
  • extInfo -> ext_info
  • + *
  • remarks -> remarks
  • + *
  • name -> name
  • + * + * @author comments created by Lee Kwanho + * date 2018-08-17 + * @see com.adc.da.sys.controller.RoleEOController + */ +public class RoleEO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = -1386892031737294731L; + + /** + *默认字段 + */ + private Integer isDefault; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 角色用户数 + */ + private Integer dataScope; + + /** + * 角色id + */ + private String id; + + /** + * 标识 + */ + private String remarks; + + /** + * 角色名 + */ + private String name; + + /* 以下为扩展字段 */ + + /** + * 拓展字段 + */ + private String extInfo; + + private String extInfo2; + + private String extInfo3; + + private String extInfo4; + + private String extInfo5; + + /** + * 菜单列表 + */ + private List menuEOList = new ArrayList<>(); + + /** + * 菜单id列表 + */ + private List menuEOIdList = new ArrayList<>(); + + /** **/ + public Integer getIsDefault() { + return this.isDefault; + } + + /** **/ + public void setIsDefault(Integer isDefault) { + this.isDefault = isDefault; + } + + /** **/ + public Integer getDelFlag() { + return this.delFlag; + } + + /** **/ + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + /** **/ + public Integer getDataScope() { + return this.dataScope; + } + + /** **/ + public void setDataScope(Integer dataScope) { + this.dataScope = dataScope; + } + + /** **/ + public String getId() { + return this.id; + } + + /** **/ + public void setId(String id) { + this.id = id; + } + + /** **/ + public String getExtInfo() { + return this.extInfo; + } + + /** **/ + public void setExtInfo(String extInfo) { + this.extInfo = extInfo; + } + + public String getExtInfo2() { + return extInfo2; + } + + public void setExtInfo2(String extInfo2) { + this.extInfo2 = extInfo2; + } + + public String getExtInfo3() { + return extInfo3; + } + + public void setExtInfo3(String extInfo3) { + this.extInfo3 = extInfo3; + } + + public String getExtInfo4() { + return extInfo4; + } + + public void setExtInfo4(String extInfo4) { + this.extInfo4 = extInfo4; + } + + public String getExtInfo5() { + return extInfo5; + } + + public void setExtInfo5(String extInfo5) { + this.extInfo5 = extInfo5; + } + + /** **/ + public String getRemarks() { + return this.remarks; + } + + /** **/ + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + /** **/ + public String getName() { + return this.name; + } + + /** **/ + public void setName(String name) { + this.name = name; + } + + public List getMenuEOList() { + return menuEOList; + } + + public void setMenuEOList(List menuEOList) { + this.menuEOList = menuEOList; + } + + public List getMenuEOIdList() { + return menuEOIdList; + } + + public void setMenuEOIdList(List menuEOIdList) { + this.menuEOIdList = menuEOIdList; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleHomeEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleHomeEO.java new file mode 100644 index 0000000..ba267ed --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleHomeEO.java @@ -0,0 +1,21 @@ +package com.adc.da.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @Author doudxw + * @Date 2022/3/11 09:33 + */ +@Data +@TableName("TR_ROLE_HOME") +public class RoleHomeEO { + + @TableField("ROLEID") + private String roleId; + + @TableField("MENUID") + private String menuId; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleMenuEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleMenuEO.java new file mode 100644 index 0000000..ba86d84 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleMenuEO.java @@ -0,0 +1,67 @@ +package com.adc.da.sys.entity; + +import com.adc.da.base.entity.BaseEntity; + + +/** + * 功能:TR_ROLE_MENU RoleMenuEOEntity
    + * 作者:code generator
    + * 日期: 2019-09-02
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public class RoleMenuEO extends BaseEntity { + + private String roleId; + private String menuId; + + /** + * java字段名转换为原始数据库列名。如果不存在则返回null
    + *

    字段列表:

    + *
  • roleId -> role_id
  • + *
  • menuId -> menu_id
  • + */ + public static String fieldToColumn(String fieldName) { + if (fieldName == null) { return null; } + switch (fieldName) { + case "roleId": return "role_id"; + case "menuId": return "menu_id"; + default: return null; + } + } + + /** + * 原始数据库列名转换为java字段名。如果不存在则返回null
    + *

    字段列表:

    + *
  • role_id -> roleId
  • + *
  • menu_id -> menuId
  • + */ + public static String columnToField(String columnName) { + if (columnName == null) { return null; } + switch (columnName) { + case "role_id": return "roleId"; + case "menu_id": return "menuId"; + default: return null; + } + } + + /** **/ + public String getRoleId() { + return this.roleId; + } + + /** **/ + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + /** **/ + public String getMenuId() { + return this.menuId; + } + + /** **/ + public void setMenuId(String menuId) { + this.menuId = menuId; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleOrgEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleOrgEO.java new file mode 100644 index 0000000..6d88388 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/RoleOrgEO.java @@ -0,0 +1,67 @@ +package com.adc.da.sys.entity; + +import com.adc.da.base.entity.BaseEntity; + + +/** + * 功能:TR_ROLE_ORG RoleOrgEOEntity
    + * 作者:code generator
    + * 日期: 2019-10-28
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public class RoleOrgEO extends BaseEntity { + + private String roleId; + private String orgId; + + /** + * java字段名转换为原始数据库列名。如果不存在则返回null
    + *

    字段列表:

    + *
  • roleId -> role_id
  • + *
  • orgId -> org_id
  • + */ + public static String fieldToColumn(String fieldName) { + if (fieldName == null) { return null; } + switch (fieldName) { + case "roleId": return "role_id"; + case "orgId": return "org_id"; + default: return null; + } + } + + /** + * 原始数据库列名转换为java字段名。如果不存在则返回null
    + *

    字段列表:

    + *
  • role_id -> roleId
  • + *
  • org_id -> orgId
  • + */ + public static String columnToField(String columnName) { + if (columnName == null) { return null; } + switch (columnName) { + case "role_id": return "roleId"; + case "org_id": return "orgId"; + default: return null; + } + } + + /** **/ + public String getRoleId() { + return this.roleId; + } + + /** **/ + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + /** **/ + public String getOrgId() { + return this.orgId; + } + + /** **/ + public void setOrgId(String orgId) { + this.orgId = orgId; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserEO.java new file mode 100644 index 0000000..d415989 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserEO.java @@ -0,0 +1,129 @@ +package com.adc.da.sys.entity; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.adc.da.base.entity.BaseEntity; +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 功能:TS_USER UserEOEntity
    + * 日期: 2017-12-18
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • extInfo -> ext_info
  • + *
  • usname -> usname
  • + *
  • password -> password
  • + *
  • delFlag -> del_flag
  • + *
  • account -> account
  • + *
  • usid -> usid
  • + * + * @author comments created by Lee Kwanho + * date 2018-08-16 + * @see com.adc.da.sys.controller.UserEOController + */ + +@Data +@Accessors(chain = true) +@TableName("TS_USER") +public class UserEO extends BaseEntity implements Serializable { + private static final long serialVersionUID = 3658632939727891047L; + + + /** + * 区分本系统自建用户和同步过来的用户 + * 1代表本系统自建用户 + * 0代表同步过来的用户 + */ + @TableField("ISSELF") + private String isSelf; + + + /** + * 用户id + */ + @TableId(value = "USID",type =IdType.INPUT) + private String usid; + + /** + * 密码 + */ + + @TableField("PASSWORD") + private String password; + + /** + * 删除标记 + */ + @TableField("DEL_FLAG") + private Integer delFlag; + + /** + * 用户名 + */ + @TableField("ACCOUNT") + private String account; + + + /** + * 手机号码 + */ + @TableField("CELLPHONE_NUMBER") + private String cellPhoneNumber; + + /** + * 电子邮件 + */ + @TableField("EMAIL") + private String email; + + /** + * 创建时间 + */ + @TableField("CREATE_TIME") + private String createTime; + /** + * 更新时间 + */ + @TableField("UPDATE_TIME") + private String updateTime; + + + @TableField("ISUSE") + private String isUse; + + + @TableField("DEPARTMENT") + private String department; + + + @TableField("USNAME") + private String usname; + + + /** + * 角色ID列表 + */ + @TableField(exist = false) + private List roleIdList = new ArrayList<>(); + + /** + * 角色EO列表 + */ + @TableField(exist = false) + private List roleEOList = new ArrayList<>(); + + @TableField(exist = false) + private String roleId; + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserRoleEO.java b/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserRoleEO.java new file mode 100644 index 0000000..5ca708b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/entity/UserRoleEO.java @@ -0,0 +1,35 @@ +package com.adc.da.sys.entity; + +import com.adc.da.base.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * 功能:TR_USER_ROLE UserRoleEOEntity
    + * 作者:code generator
    + * 日期: 2017-11-07
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • userId -> user_id
  • + *
  • roleId -> role_id
  • + * @author comments created by Lee Kwanho + * date 2018-08-16 + */ +@Data +@TableName("TR_USER_ROLE") +public class UserRoleEO extends BaseEntity { + + /** + * 用户id + */ + @TableField("USER_ID") + private String userId; + + /** + * 角色id + */ + @TableField("ROLE_ID") + private String roleId; + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/DicTypeEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/DicTypeEOPage.java new file mode 100644 index 0000000..716be48 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/DicTypeEOPage.java @@ -0,0 +1,118 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +import java.util.List; + +public class DicTypeEOPage extends BasePage { + private String id; + + private String idOperator = "="; + + private String dicTypeCode; + + private String dicTypeCodeOperator = "="; + + private String dicTypeName; + + private String dicTypeNameOperator = "="; + + private String dicId; + + private String dicIdOperator = "="; + + private Integer delFlag; + + private String delFlagOperator = "="; + + private List dicIdList ; + + public List getDicIdList() { + return dicIdList; + } + + public void setDicIdList(List dicIdList) { + this.dicIdList = dicIdList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + + public String getDicTypeCode() { + return dicTypeCode; + } + + public void setDicTypeCode(String dicTypeCode) { + this.dicTypeCode = dicTypeCode; + } + + public String getDicTypeCodeOperator() { + return dicTypeCodeOperator; + } + + public void setDicTypeCodeOperator(String dicTypeCodeOperator) { + this.dicTypeCodeOperator = dicTypeCodeOperator; + } + + public String getDicTypeName() { + return dicTypeName; + } + + public void setDicTypeName(String dicTypeName) { + this.dicTypeName = dicTypeName; + } + + public String getDicTypeNameOperator() { + return dicTypeNameOperator; + } + + public void setDicTypeNameOperator(String dicTypeNameOperator) { + this.dicTypeNameOperator = dicTypeNameOperator; + } + + public String getDicId() { + return dicId; + } + + public void setDicId(String dicId) { + this.dicId = dicId; + } + + public String getDicIdOperator() { + return dicIdOperator; + } + + public void setDicIdOperator(String dicIdOperator) { + this.dicIdOperator = dicIdOperator; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/DictionaryEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/DictionaryEOPage.java new file mode 100644 index 0000000..4dbbd4b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/DictionaryEOPage.java @@ -0,0 +1,102 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +import java.util.List; + +/** + * @author comments by Lee Kwanho + * date 2018-08-16 + */ +public class DictionaryEOPage extends BasePage { + private String id; + + private String idOperator = "="; + + private String dictionaryCode; + + private String dictionaryCodeOperator = "="; + + private String dictionaryName; + + private String dictionaryNameOperator = "="; + + private Integer delFlag; + + private String delFlagOperator = "="; + + private List dicIdList ; + + public List getDicIdList() { + return dicIdList; + } + + public void setDicIdList(List dicIdList) { + this.dicIdList = dicIdList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + + public String getDictionaryCode() { + return dictionaryCode; + } + + public void setDictionaryCode(String dictionaryCode) { + this.dictionaryCode = dictionaryCode; + } + + public String getDictionaryCodeOperator() { + return dictionaryCodeOperator; + } + + public void setDictionaryCodeOperator(String dictionaryCodeOperator) { + this.dictionaryCodeOperator = dictionaryCodeOperator; + } + + public String getDictionaryName() { + return dictionaryName; + } + + public void setDictionaryName(String dictionaryName) { + this.dictionaryName = dictionaryName; + } + + public String getDictionaryNameOperator() { + return dictionaryNameOperator; + } + + public void setDictionaryNameOperator(String dictionaryNameOperator) { + this.dictionaryNameOperator = dictionaryNameOperator; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/MenuEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/MenuEOPage.java new file mode 100644 index 0000000..e0c0c5c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/MenuEOPage.java @@ -0,0 +1,213 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + + +/** + * 功能:TS_MENU MenuEOPage
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + */ +public class MenuEOPage extends BasePage { + + private String id; + private String idOperator = "="; + private String delFlag; + private String delFlagOperator = "="; + private String name; + private String nameOperator = "="; + private String parentId; + private String parentIdOperator = "="; + private String parentIds; + private String parentIdsOperator = "="; + private String href; + private String hrefOperator = "="; + private String icon; + private String iconOperator = "="; + private String isShow; + private String isShowOperator = "="; + private String permission; + private String permissionOperator = "="; + private String remarks; + private String remarksOperator = "="; + private String sort; + private String sortOperator = "="; + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return this.idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + + public String getDelFlag() { + return this.delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return this.delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNameOperator() { + return this.nameOperator; + } + + public void setNameOperator(String nameOperator) { + this.nameOperator = nameOperator; + } + + public String getParentId() { + return this.parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentIdOperator() { + return this.parentIdOperator; + } + + public void setParentIdOperator(String parentIdOperator) { + this.parentIdOperator = parentIdOperator; + } + + public String getParentIds() { + return this.parentIds; + } + + public void setParentIds(String parentIds) { + this.parentIds = parentIds; + } + + public String getParentIdsOperator() { + return this.parentIdsOperator; + } + + public void setParentIdsOperator(String parentIdsOperator) { + this.parentIdsOperator = parentIdsOperator; + } + + public String getHref() { + return this.href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getHrefOperator() { + return this.hrefOperator; + } + + public void setHrefOperator(String hrefOperator) { + this.hrefOperator = hrefOperator; + } + + public String getIcon() { + return this.icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getIconOperator() { + return this.iconOperator; + } + + public void setIconOperator(String iconOperator) { + this.iconOperator = iconOperator; + } + + public String getIsShow() { + return this.isShow; + } + + public void setIsShow(String isShow) { + this.isShow = isShow; + } + + public String getIsShowOperator() { + return this.isShowOperator; + } + + public void setIsShowOperator(String isShowOperator) { + this.isShowOperator = isShowOperator; + } + + public String getPermission() { + return this.permission; + } + + public void setPermission(String permission) { + this.permission = permission; + } + + public String getPermissionOperator() { + return this.permissionOperator; + } + + public void setPermissionOperator(String permissionOperator) { + this.permissionOperator = permissionOperator; + } + + public String getRemarks() { + return this.remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getRemarksOperator() { + return this.remarksOperator; + } + + public void setRemarksOperator(String remarksOperator) { + this.remarksOperator = remarksOperator; + } + + public String getSort() { + return this.sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getSortOperator() { + return this.sortOperator; + } + + public void setSortOperator(String sortOperator) { + this.sortOperator = sortOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/OrgEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/OrgEOPage.java new file mode 100644 index 0000000..460913f --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/OrgEOPage.java @@ -0,0 +1,207 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +public class OrgEOPage extends BasePage { + + private String id; + + private String idOperator = "="; + + private String delFlag; + + private String delFlagOperator = "="; + + private String name; + + private String nameOperator = "="; + + private String orgDesc; + + private String orgDescOperator = "="; + + private String orgCode; + + private String orgCodeOperator = "="; + + private String orgType; + + private String orgTypeOperator = "="; + + private String isShow; + + private String isShowOperator = "="; + + private String parentId; + + private String parentIdOperator = "="; + + private String parentIds; + + private String parentIdsOperator = "="; + + private String remarks; + + private String remarksOperator = "="; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNameOperator() { + return nameOperator; + } + + public void setNameOperator(String nameOperator) { + this.nameOperator = nameOperator; + } + + public String getOrgDesc() { + return orgDesc; + } + + public void setOrgDesc(String orgDesc) { + this.orgDesc = orgDesc; + } + + public String getOrgDescOperator() { + return orgDescOperator; + } + + public void setOrgDescOperator(String orgDescOperator) { + this.orgDescOperator = orgDescOperator; + } + + public String getOrgCode() { + return orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getOrgCodeOperator() { + return orgCodeOperator; + } + + public void setOrgCodeOperator(String orgCodeOperator) { + this.orgCodeOperator = orgCodeOperator; + } + + public String getOrgType() { + return orgType; + } + + public void setOrgType(String orgType) { + this.orgType = orgType; + } + + public String getOrgTypeOperator() { + return orgTypeOperator; + } + + public void setOrgTypeOperator(String orgTypeOperator) { + this.orgTypeOperator = orgTypeOperator; + } + + public String getIsShow() { + return isShow; + } + + public void setIsShow(String isShow) { + this.isShow = isShow; + } + + public String getIsShowOperator() { + return isShowOperator; + } + + public void setIsShowOperator(String isShowOperator) { + this.isShowOperator = isShowOperator; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentIdOperator() { + return parentIdOperator; + } + + public void setParentIdOperator(String parentIdOperator) { + this.parentIdOperator = parentIdOperator; + } + + public String getParentIds() { + return parentIds; + } + + public void setParentIds(String parentIds) { + this.parentIds = parentIds; + } + + public String getParentIdsOperator() { + return parentIdsOperator; + } + + public void setParentIdsOperator(String parentIdsOperator) { + this.parentIdsOperator = parentIdsOperator; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getRemarksOperator() { + return remarksOperator; + } + + public void setRemarksOperator(String remarksOperator) { + this.remarksOperator = remarksOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleEOPage.java new file mode 100644 index 0000000..2a8a215 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleEOPage.java @@ -0,0 +1,133 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +/** + * 功能:TS_ROLE RoleEOPage
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + */ +public class RoleEOPage extends BasePage { + + private String id; + + private String idOperator = "="; + + private String dataScope; + + private String dataScopeOperator = "="; + + private String delFlag; + + private String delFlagOperator = "="; + + private String isDefault; + + private String isDefaultOperator = "="; + + private String name; + + private String nameOperator = "="; + + private String remarks; + + private String remarksOperator = "="; + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIdOperator() { + return this.idOperator; + } + + public void setIdOperator(String idOperator) { + this.idOperator = idOperator; + } + + public String getDataScope() { + return this.dataScope; + } + + public void setDataScope(String dataScope) { + this.dataScope = dataScope; + } + + public String getDataScopeOperator() { + return this.dataScopeOperator; + } + + public void setDataScopeOperator(String dataScopeOperator) { + this.dataScopeOperator = dataScopeOperator; + } + + public String getDelFlag() { + return this.delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return this.delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + + public String getIsDefault() { + return this.isDefault; + } + + public void setIsDefault(String isDefault) { + this.isDefault = isDefault; + } + + public String getIsDefaultOperator() { + return this.isDefaultOperator; + } + + public void setIsDefaultOperator(String isDefaultOperator) { + this.isDefaultOperator = isDefaultOperator; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNameOperator() { + return this.nameOperator; + } + + public void setNameOperator(String nameOperator) { + this.nameOperator = nameOperator; + } + + public String getRemarks() { + return this.remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getRemarksOperator() { + return this.remarksOperator; + } + + public void setRemarksOperator(String remarksOperator) { + this.remarksOperator = remarksOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleMenuEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleMenuEOPage.java new file mode 100644 index 0000000..62006bb --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleMenuEOPage.java @@ -0,0 +1,51 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + + +/** + * 功能:TR_ROLE_MENU RoleMenuEOPage
    + * 作者:code generator
    + * 日期: 2019-09-02
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public class RoleMenuEOPage extends BasePage { + + private String roleId; + private String roleIdOperator = "="; + private String menuId; + private String menuIdOperator = "="; + + public String getRoleId() { + return this.roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleIdOperator() { + return this.roleIdOperator; + } + + public void setRoleIdOperator(String roleIdOperator) { + this.roleIdOperator = roleIdOperator; + } + + public String getMenuId() { + return this.menuId; + } + + public void setMenuId(String menuId) { + this.menuId = menuId; + } + + public String getMenuIdOperator() { + return this.menuIdOperator; + } + + public void setMenuIdOperator(String menuIdOperator) { + this.menuIdOperator = menuIdOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleOrgEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleOrgEOPage.java new file mode 100644 index 0000000..d5ae186 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/RoleOrgEOPage.java @@ -0,0 +1,51 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + + +/** + * 功能:TR_ROLE_ORG RoleOrgEOPage
    + * 作者:code generator
    + * 日期: 2019-10-28
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +public class RoleOrgEOPage extends BasePage { + + private String roleId; + private String roleIdOperator = "="; + private String orgId; + private String orgIdOperator = "="; + + public String getRoleId() { + return this.roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleIdOperator() { + return this.roleIdOperator; + } + + public void setRoleIdOperator(String roleIdOperator) { + this.roleIdOperator = roleIdOperator; + } + + public String getOrgId() { + return this.orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getOrgIdOperator() { + return this.orgIdOperator; + } + + public void setOrgIdOperator(String orgIdOperator) { + this.orgIdOperator = orgIdOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/UserEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserEOPage.java new file mode 100644 index 0000000..12ef943 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserEOPage.java @@ -0,0 +1,225 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +/** + * 功能:TS_USER UserEOPage
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + */ +public class UserEOPage extends BasePage { + + private String usid; + + private String usidOperator = "="; + + private String account; + + private String accountOperator = "="; + + private String delFlag; + + private String delFlagOperator = "="; + + private String usname; + + private String usnameOperator = "="; + + private String password; + + private String rolename; + + private String rolenameOperator = "="; + + private String roleId; + + private String roleIdOperator = "="; + + private String orgId; + + private String orgIdOperator = "="; + + private String weight; + + private String weightOperator = ">="; + + + private String isuse; + + private String companyName; + + private String companyId; + + private String isAdmin; + + + public String getUsid() { + return this.usid; + } + + public void setUsid(String usid) { + this.usid = usid; + } + + public String getUsidOperator() { + return this.usidOperator; + } + + public void setUsidOperator(String usidOperator) { + this.usidOperator = usidOperator; + } + + public String getAccount() { + return this.account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getAccountOperator() { + return this.accountOperator; + } + + public void setAccountOperator(String accountOperator) { + this.accountOperator = accountOperator; + } + + public String getDelFlag() { + return this.delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlagOperator() { + return this.delFlagOperator; + } + + public void setDelFlagOperator(String delFlagOperator) { + this.delFlagOperator = delFlagOperator; + } + + public String getUsname() { + return this.usname; + } + + public void setUsname(String usname) { + this.usname = usname; + } + + public String getUsnameOperator() { + return this.usnameOperator; + } + + public void setUsnameOperator(String usnameOperator) { + this.usnameOperator = usnameOperator; + } + + public String getRolename() { + return rolename; + } + + public void setRolename(String rolename) { + this.rolename = rolename; + } + + public String getRolenameOperator() { + return rolenameOperator; + } + + public void setRolenameOperator(String rolenameOperator) { + this.rolenameOperator = rolenameOperator; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleIdOperator() { + return roleIdOperator; + } + + public void setRoleIdOperator(String roleIdOperator) { + this.roleIdOperator = roleIdOperator; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getOrgIdOperator() { + return orgIdOperator; + } + + public void setOrgIdOperator(String orgIdOperator) { + this.orgIdOperator = orgIdOperator; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String getWeightOperator() { + return weightOperator; + } + + public void setWeightOperator(String weightOperator) { + this.weightOperator = weightOperator; + } + + + public String getIsuse() { + return isuse; + } + + public void setIsuse(String isuse) { + this.isuse = isuse; + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getIsAdmin() { + return isAdmin; + } + + public void setIsAdmin(String isAdmin) { + this.isAdmin = isAdmin; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/UserOrgEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserOrgEOPage.java new file mode 100644 index 0000000..6a869a2 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserOrgEOPage.java @@ -0,0 +1,47 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +public class UserOrgEOPage extends BasePage { + + private String userId; + + private String userIdOperator = "="; + + private String orgId; + + private String orgIdOperator = "="; + + public String getUserId() { + return this.userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserIdOperator() { + return this.userIdOperator; + } + + public void setUserIdOperator(String userIdOperator) { + this.userIdOperator = userIdOperator; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getOrgIdOperator() { + return orgIdOperator; + } + + public void setOrgIdOperator(String orgIdOperator) { + this.orgIdOperator = orgIdOperator; + } + +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/page/UserRoleEOPage.java b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserRoleEOPage.java new file mode 100644 index 0000000..1bd8ecd --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/page/UserRoleEOPage.java @@ -0,0 +1,53 @@ +package com.adc.da.sys.page; + +import com.adc.da.base.page.BasePage; + +/** + * 功能:TR_USER_ROLE UserRoleEOPage
    + * 作者:code generator
    + * 日期: 2017-11-07
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + */ +public class UserRoleEOPage extends BasePage { + + private String userId; + + private String userIdOperator = "="; + + private String roleId; + + private String roleIdOperator = "="; + + public String getUserId() { + return this.userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserIdOperator() { + return this.userIdOperator; + } + + public void setUserIdOperator(String userIdOperator) { + this.userIdOperator = userIdOperator; + } + + public String getRoleId() { + return this.roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleIdOperator() { + return this.roleIdOperator; + } + + public void setRoleIdOperator(String roleIdOperator) { + this.roleIdOperator = roleIdOperator; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/MenuEOService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/MenuEOService.java new file mode 100644 index 0000000..bce6ae5 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/MenuEOService.java @@ -0,0 +1,272 @@ +package com.adc.da.sys.service; + +import com.adc.da.sys.vo.MenuVO; +import com.adc.da.util.constant.DeleteFlagEnum; +import com.adc.da.util.utils.BeanMapper; + +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.adc.da.base.entity.TreeEntity; +import com.adc.da.base.service.BaseService; +import com.adc.da.sys.dao.mysql.MenuEODao; +import com.adc.da.sys.entity.MenuEO; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *
    + * 功能:TS_MENU MenuEOService
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    + * + * @author comments created by Lee Kwanho + * date 2018-08-16 + * @see MenuEODao + * @see + */ +@Service("menuEOService") +@Transactional +public class MenuEOService extends BaseService { + + /** + * Dao层自动装配 + * + * @see MenuEODao + */ + @Resource + private MenuEODao dao; + + /** + * @see dozer + */ + @Resource + private BeanMapper beanMapper; + + @Override + public MenuEODao getDao() { + return dao; + } + + /** + * 添加菜单 构建菜单树 , 生成uuid,初始化删除标识符 + * + * @param menuEO 菜单信息 + * @return 返回生成的菜单信息 + * @throws Exception 添加菜单异常,由上级进行处理 + */ + public MenuEO insertMenu(MenuEO menuEO) throws Exception { + /** + * 生成10位随机id + */ +// menuEO.setId(UUID.randomUUID(10)); + menuEO.setDelFlag(DeleteFlagEnum.NORMAL.getValue()); + TreeEntity parent = menuEO.getParent(); + if (parent != null) { + menuEO.setParentId(parent.getId()); + menuEO.setParentIds(parent.getParentIds() + parent.getId() + ","); + } + menuEO.setIsShow(1); + super.insertSelective(menuEO); + return menuEO; + } + + /** + * 更新菜单 + * + * @param menuVO 菜单VO对象 + */ + public void updateMenu(MenuVO menuVO) { + /* 处理当前节点 + 构建菜单 */ + String oldParentId = menuVO.getParentId(); + String oldParentIds = menuVO.getParentIds(); + MenuVO parentMenu = menuVO.getParent(); + if (parentMenu != null) { + menuVO.setParentId(parentMenu.getId()); + menuVO.setParentIds(parentMenu.getParentIds() + parentMenu.getId() + ","); + } + /*处理所有的子节点 + 判断父节点是否移动到其他节点*/ + if (oldParentId != null && !oldParentId.equals(menuVO.getParentId())) { + // 获取要修改的当前节点的所有子节点 + List childMenus = dao.getChildMenus(menuVO.getId()); + // 修改所有子节点的ParentIds为当前节点的parentIds + parentId + for (MenuEO childMenu : childMenus) { + childMenu.setParentIds(childMenu.getParentIds().replace(oldParentIds, menuVO.getParentIds())); + // 更新到数据库 + dao.updateByPrimaryKey(childMenu); + } + } + // 修改当前节点 + dao.updateByPrimaryKeySelective(beanMapper.map(menuVO, MenuEO.class)); + + } + + /** + * 逻辑删除菜单及其子菜单,物理删除菜单及其子菜单与角色的关联 + * + * @param ids 待删除的所有菜单ID + */ + public void delete(String[] ids) { + dao.deleteMenuLogic(ids); + + //删除子菜单 + for(String id:ids){ + dao.deleteMenuByParentId(id); + } + dao.deleteRoleMenus(ids); + } + + /** + * 获取用户的所有菜单 + * + * @param userId 用户ID + */ + @Transactional(readOnly = true, rollbackFor = Throwable.class) + public List listMenuEOByUserId(String userId) { + List menuEOS = dao.listMenuEOByUserId(userId); + Set menuIds = new HashSet<>(); + menuEOS.forEach(c -> { + Arrays.asList(c.getParentIds().split(",")).forEach( + d -> { + menuIds.add(d); + } + ); + menuIds.add(c.getId()); + }); + + if(menuIds.size()==0){ + return new ArrayList<>(); + } + return dao.listMenuEOByMenuIds(new ArrayList(menuIds)); + +// return dao.listMenuEOByUserId(userId); + } + + + /** + * 获取所有的菜单 + * + * @return 所有菜单 + */ + @Transactional(readOnly = true, rollbackFor = Throwable.class) + public List findAll() { + return dao.findAll(); + } + + /** + * 判定菜单是否属于角色 + * + * @param roleId 角色ID + * @param menuId 菜单ID + * @return true -> 菜单属于角色 + */ + @Transactional(readOnly = true, rollbackFor = Exception.class) + public boolean isBelong(String roleId, String menuId) { + int count = dao.isBelong(roleId, menuId); + return count > 0; + } + + /** + * 获取角色对应的所有菜单 + * + * @param roleId 角色ID + * @return 角色对应的所有菜单 + */ + @Transactional(readOnly = true, rollbackFor = Exception.class) + public List listMenuEOByRoleId(String roleId) { + return dao.listMenuEOByRoleID(roleId); + } + + /** + * 递归生成列表, + * Sonar 建议 listMenuByParent 类型设置成Map而不是HashMap + * 同时sons为空时建议返回Collections.emptyList(),而不是null + * + * @param sons 子菜单 + * @param listMenuByParent 菜单列表 + * @return 父菜单的子菜单信息 + */ + public List> recursionList(List sons, Map> listMenuByParent) { + /** + * 判断空值,返回空list + */ + if (sons == null) { + return Collections.emptyList(); + } + + List> list = new ArrayList<>(); + for (MenuVO son : sons) { + HashMap map = new HashMap<>(); + map.put("text", son.getName()); + map.put("icon", son.getIcon()); + map.put("link", son.getHref()); + List> sonList = recursionList(listMenuByParent.get(son.getId()), listMenuByParent); + if (sonList != null) { + map.put("children", sonList); + map.put("group", true); + } + list.add(map); + } + return list; + } + + + public int queryConflict(String name ,String id , String parentId){ + return dao.queryConflict(name , id , parentId) ; + } + + + + public List changeMenu(List entities){ + //2.1)、找到所有一级分类 + List levelMenus = entities.stream() + .filter(e -> e.getParentId().equals("0")) + .map((menu) -> { + menu.setChildList(getChildrens(menu, entities)); + return menu; + }) + .sorted((menu, menu2) -> { + return Integer.parseInt(menu.getSort() == null ? "0" :menu.getSort()) - Integer.parseInt(menu2.getSort() == null ? "0" : menu2.getSort()); + }) + .collect(Collectors.toList()); + + return levelMenus; + } + + //递归查找所有菜单的子菜单 + private List getChildrens(MenuVO root, List all) { + + List children = all.stream().filter(categoryEntity -> { + return categoryEntity.getParentId().equals(root.getId()); + }).map(categoryEntity -> { + //1、找到子菜单(递归) + categoryEntity.setChildList(getChildrens(categoryEntity, all)); + return categoryEntity; + }).sorted((menu, menu2) -> { + //2、菜单的排序 + return Integer.parseInt(menu.getSort() == null ? "0" :menu.getSort()) - Integer.parseInt(menu2.getSort() == null ? "0" : menu2.getSort()); + }).collect(Collectors.toList()); + + return children; + + } + +// public String queryInformation() { +// return dao.queryInformation(); +// } +// +// public int updateInformation(String information) { +// return dao.updateInformation(information); +// } +// +// public int insertInformation(String information) { +// return dao.insertInformation(information); +// } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleEOService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleEOService.java new file mode 100644 index 0000000..399a130 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleEOService.java @@ -0,0 +1,341 @@ +package com.adc.da.sys.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.adc.da.sys.dao.mysql.*; +import com.adc.da.sys.entity.*; +import com.adc.da.sys.vo.MenuVO; +import com.adc.da.sys.vo.UserRoleVO; +import com.adc.da.sys.vo.ddm.DdmMenuVO; +import com.adc.da.sys.vo.ddm.DdmRoleMenuCreateVO; +import com.adc.da.sys.vo.ddm.DdmRoleUserQuery; +import com.adc.da.sys.vo.ddm.DdmUserVO; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.utils.BeanMapper; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.adc.da.base.service.BaseService; +import com.adc.da.util.constant.DeleteFlagEnum; +import com.adc.da.util.utils.CollectionUtils; +import com.adc.da.util.utils.UUID; + +/** + *
    + * 功能:TS_ROLE RoleEOService
    + * 作者:code generator
    + * 日期: 2017-11-06
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * date 2018-08-17 + * + * @author comments created by Lee Kwanho + * @see RoleEODao + * @see com.adc.da.sys.controller.RoleEOController + */ +@Service("roleEOService") +@Transactional +public class RoleEOService extends BaseService { + + /** + * Dao层自动装配 + * + * @see RoleEODao + */ + @Resource + private RoleEODao dao; + + public RoleEODao getDao() { + return dao; + } + + @Resource + private RoleHomeEODao roleHomeEODao; + + @Resource + private RoleMenuEODao roleMenuEODao; + + @Resource + private MenuEODao menuEODao; + + @Resource + private UserRoleEODao userRoleEODao; + + @Resource + private BeanMapper beanMapper; + + /** + * 保存角色信息,生成uuid,删除标识位 + * + * @param sysRoleEO 角色信息 + * @return 完整的角色信息 + */ + public RoleEO save(RoleEO sysRoleEO) { + sysRoleEO.setId(UUID.randomUUID10()); + sysRoleEO.setDelFlag(DeleteFlagEnum.NORMAL.getValue()); + dao.insertSelective(sysRoleEO); + return sysRoleEO; + } + + /** + * 获取角色id + * + * @param id + * @return + */ + @Transactional(readOnly = true) + public RoleEO getRoleWithMenus(String id) { + return dao.getRoleWithMenus(id); + } + + /** + * 获取用户所关联的所有角色id + * + * @author Wei Jinjin + * date 2019-10-29 + */ + public List getRoleIdListByUserId(String userId) { + List roleIdList = new ArrayList<>(); + List roleList = dao.getRoleListByUserId(userId); + for (RoleEO roleEO : roleList) { + roleIdList.add(roleEO.getId()); + } + return roleIdList; + } + + @Transactional(readOnly = true) + public List getSysRoleListByUserId(String userId) { + return dao.getRoleListByUserId(userId); + } + + /** + * 删除角色及角色菜单关联(角色有对应用户则不能被删除) + */ + @Transactional(rollbackFor = Exception.class) + public void delete(String roleId) { + dao.deleteLogic(roleId); + dao.deleteRoleMenuByRoleId(roleId); + } + + @Transactional(readOnly = true) + public List findAll() { + return dao.findAll(); + } + + @Transactional(readOnly = true) + public List findAll(String roleName) { + return dao.findAll(); + } + + /** + * 查询角色所对应的用户 + * + * @param roleId 角色id + * @return 角色信息 + */ + @Transactional(readOnly = true) + public List getUserRoleListByRoleId(String roleId) { + return dao.getUserRoleListByRoleId(roleId); + } + + /** + * 查询角色所对应的用户 + * + * @param roleId 角色id + * @return 角色信息 + */ + @Transactional(readOnly = true) + public List getUserInfoListByRoleId(String roleId) { + return dao.getUserInfoListByRoleId(roleId); + } + + @Transactional(readOnly = true) + public PageInfo getUserInfoPageByRoleId(DdmRoleUserQuery query) { + IPage page = new Page(); + page.setCurrent(query.getPageNum()); + page.setSize(query.getPageSize()); + IPage userInfoList = dao.getUserInfoPageByRoleId(page, query.getRoleId()); + Long count = dao.getUserCountByRoleId(query.getRoleId()); + PageInfo pageInfo = new PageInfo(); + pageInfo.setPageSize(query.getPageSize()); + pageInfo.setCount(count); + pageInfo.setList(userInfoList.getRecords()); + return pageInfo; + } + + + /** + * 设置角色菜单关联 + * + * @param roleEO 角色信息 + * @return 角色信息 + */ + @Transactional(rollbackFor = Exception.class) + public RoleEO saveRoleMenu(RoleEO roleEO) { + if (CollectionUtils.isNotEmpty(roleEO.getMenuEOIdList())) { + /*删除旧角色关联*/ + dao.deleteRoleMenuByRoleId(roleEO.getId()); + +/* List newMenuList=new ArrayList<>(); + roleEO.getMenuEOIdList().forEach(c->{ + String pId = dao.getpidByMenuId(c); + if(!"0".equals(pId)&&!roleEO.getMenuEOIdList().contains(pId)){ + newMenuList.add(pId); + } + }); + roleEO.getMenuEOIdList().addAll(newMenuList.stream().distinct().collect(Collectors.toList()));*/ + for (String menuId : roleEO.getMenuEOIdList()) { + /*新增角色关联*/ + dao.saveRoleMenu(roleEO.getId(), menuId); + } + } else { + dao.deleteRoleMenuByRoleId(roleEO.getId()); + } + return roleEO; + } + + /** + * ddm设置角色菜单关联,同时设置首页权限 + * + * @return 角色信息 + */ + @Transactional(rollbackFor = Exception.class) + public void saveRoleMenuByDdm(List roleModels) { + if (CollectionUtils.isNotEmpty(roleModels)) { + Map> roldMenuMap = roleModels.stream().collect(Collectors.groupingBy(DdmRoleMenuCreateVO::getRoleId)); + for (String key : roldMenuMap.keySet()) { + String roleId=key; + List menuList = roldMenuMap.get(key); + List rmList = new ArrayList<>(); + /*删除旧角色关联*/ + dao.deleteRoleMenuByRoleId(roleId); +// /*删除旧角色首页权限关联*/ 修改 ddm不管理首页权限 +// roleHomeEODao.delete(new QueryWrapper().eq("ROLEID", roleId)); + for (DdmRoleMenuCreateVO roleModel : menuList) { + if (StringUtils.isNotEmpty(roleModel.getModelId())){ + /*新增角色关联*/ + dao.saveRoleMenu(roleModel.getRoleId(), roleModel.getModelId()); +// /*新增角色首页权限*/ +// RoleMenuEO roleMenuEO = new RoleMenuEO(); +// roleMenuEO.setRoleId(roleModel.getRoleId()); +// roleMenuEO.setMenuId(roleModel.getModelId()); +// rmList.add(roleMenuEO); + } + } +// if (CollectionUtils.isNotEmpty(rmList)) { +// roleHomeEODao.insertRoleHomeBatch(rmList); +// } + } + + } + + } + + + /** + * 判断角色是否属于相应用户 + * + * @param userId 用户id + * @param roleId 角色id + * @return 返回布尔值,确认是否有该角色信息 + */ + public boolean isBelong(String userId, String roleId) { + int count = dao.isBelong(userId, roleId); + return count > 0; + } + + public List getRoleByCode(String roleCode) { + return dao.getRoleByCode(roleCode); + } + + @Transactional(rollbackFor = Exception.class) + public void saveRoleHome(RoleEO roleEO) { + if (roleEO.getMenuEOIdList() == null || roleEO.getMenuEOIdList().size() == 0) { + //将首页展示默认调整成角色菜单 + roleHomeEODao.delete(new QueryWrapper().eq("ROLEID", roleEO.getId())); + List roleMenuList = roleMenuEODao.getRoleMenuList(roleEO.getId()); + roleHomeEODao.insertRoleHomeBatch(roleMenuList); + } else { + roleHomeEODao.delete(new QueryWrapper().eq("ROLEID", roleEO.getId())); + List rmList = new ArrayList<>(); + roleEO.getMenuEOIdList().forEach(c -> { + RoleMenuEO roleMenuEO = new RoleMenuEO(); + roleMenuEO.setRoleId(roleEO.getId()); + roleMenuEO.setMenuId(c); + rmList.add(roleMenuEO); + }); + + roleHomeEODao.insertRoleHomeBatch(rmList); + } + } + + public List getHomeMenu(String roleId) throws Exception { + if (StringUtils.isEmpty(roleId)) { + return new ArrayList(); + } + List homeMenuList = roleHomeEODao.getHomeListByRoleId(roleId); + List roleMenuList=menuEODao.listMenuEOByRoleId(roleId); + + List idList = roleMenuList.stream().map(MenuEO::getId).collect(Collectors.toList()); + //已分配好的菜单权限为基础,`找出其中的配置首页 + + RoleEO roleEO = selectByPrimaryKey(roleId); + List allList; + if ("管理员".equals(roleEO.getName())) { + //管理员返回所有菜单权限 + allList = beanMapper.mapList(menuEODao.findAll(), MenuVO.class); + allList.forEach(c -> { + c.setBelong(1); + }); + } else { + allList = beanMapper.mapList(homeMenuList, MenuVO.class); + allList.forEach(c -> { + if (idList.contains(c.getId())) { + c.setBelong(1); + } else { + c.setBelong(0); + } + + }); + } + return allList; + } + + //角色添加用户 + public int saveRoleUser(UserRoleEO userRoleEO) { + QueryWrapper queryWrapper1 = new QueryWrapper().eq("USER_ID", userRoleEO.getUserId()).eq("ROLE_ID", userRoleEO.getRoleId()); + List userRoleEOS1 = userRoleEODao.selectList(queryWrapper1); + if (userRoleEOS1.size() > 0) { + throw new AdcDaBaseException("此角色下该用户已存在,请不要重复添加"); + } + //因为系统用户角色1对一 ,所以删除原先角色 + QueryWrapper queryWrapper2 = new QueryWrapper().eq("USER_ID", userRoleEO.getUserId()); + userRoleEODao.delete(queryWrapper2); + + return userRoleEODao.insert(userRoleEO); + } + + //角色删除用户 + public int deleteRoleUsers(List userRoleEOList) { + int i = 0; + for (UserRoleEO userRoleEO : userRoleEOList) { + userRoleEODao.delete(new QueryWrapper().eq("USER_ID", userRoleEO.getUserId()).eq("ROLE_ID", userRoleEO.getRoleId())); + } + return i; + } + + public List getRoleMenuInfoList(@Param("roleId") String roleId) { + return roleMenuEODao.getRoleMenuInfoList(roleId); + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleMenuEOService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleMenuEOService.java new file mode 100644 index 0000000..5090ef6 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/RoleMenuEOService.java @@ -0,0 +1,37 @@ +package com.adc.da.sys.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.adc.da.base.service.BaseService; +import com.adc.da.sys.dao.mysql.RoleMenuEODao; +import com.adc.da.sys.entity.RoleMenuEO; + + +/** + * + *
    + * 功能:TR_ROLE_MENU RoleMenuEOService
    + * 作者:code generator
    + * 日期: 2019-09-02
    + * 版权所有:版权归北京卡达克数据技术中心所有。
    + */ +@Service("roleMenuEOService") +@Transactional +public class RoleMenuEOService extends BaseService { + + private static final Logger logger = LoggerFactory.getLogger(RoleMenuEOService.class); + + @Resource + private RoleMenuEODao dao; + + @Override + public RoleMenuEODao getDao() { + return dao; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java new file mode 100644 index 0000000..d72abbe --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java @@ -0,0 +1,382 @@ +package com.adc.da.sys.service; + +import java.text.SimpleDateFormat; +import java.util.*; + +import com.adc.da.sys.dao.mysql.UserRoleEODao; +import com.adc.da.sys.entity.RoleEO; +import com.adc.da.sys.entity.UserRoleEO; +import com.adc.da.sys.service.iservice.IUserEoService; +import com.adc.da.sys.util.EncryptUtil; +import com.adc.da.sys.vo.UserImportVO; +import com.adc.da.sys.vo.ddm.DdmUserQueryVO; +import com.adc.da.sys.vo.ddm.DdmUserVO; +import com.adc.da.util.exception.AdcDaBaseException; +import com.adc.da.util.http.PageInfo; +import com.adc.da.util.utils.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.BeanUtils; +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adc.da.sys.dao.mysql.UserEODao; +import com.adc.da.sys.entity.UserEO; +import java.util.stream.Collectors; + +/** + * 用户管理模块Service层 + * 版权所有:版权归天津卡达克数据技术中心所有。
    + * + * @author comments created by Lee Kwanho + * @see UserEODao + * @see com.adc.da.sys.controller.UserEOController + */ +@Service("userEOService") +@Transactional +public class UserEOServiceImpl implements IUserEoService { + + + @Value("${isPassEncrypted}") + private boolean isPassEncrypted; + + @Resource + private UserEODao dao; + + @Resource + private UserRoleEODao userRoleEODao; + + @Resource + private RoleEOService roleEOService; + + + /** + * 获取角色信息,用户名,用于新增用户校验 + * 根据account获取UserEO + * + * @param userName 用户名 + * @return 用户信息 + */ + @Override + @Transactional(readOnly = true) + public UserEO getUserByLoginName(String userName, String usid) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("ACCOUNT", userName).eq("DEL_FLAG", "0"); + if (StringUtils.isNotEmpty(usid)) { + wrapper.ne("USID", usid); + } + return dao.selectOne(wrapper); + } + + @Override + public int getUserCountByEmail(String email, String usid) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("EMAIL", email).eq("DEL_FLAG", "0"); + if (StringUtils.isNotEmpty(usid)) { + wrapper.ne("USID", usid); + } + return dao.selectCount(wrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(UserEO eo) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (StringUtils.isEmpty(eo.getUsid())) { + eo.setDelFlag(0); + eo.setEmail(EncryptUtil.encrypt(eo.getEmail())); + eo.setCreateTime(format.format(new Date())); + eo.setUpdateTime(format.format(new Date())); + eo.setPassword(EncryptUtil.encrypt(eo.getPassword())); + eo.setCellPhoneNumber(EncryptUtil.encrypt(eo.getCellPhoneNumber())); + eo.setIsUse("1"); + /** + * 区分本系统自建用户和同步过来的用户 + * 1代表本系统自建用户 + * 0代表同步过来的用户 + */ + eo.setIsSelf("1"); + eo.setUsid(com.adc.da.util.utils.UUID.randomUUID10()); + dao.insert(eo); + } else { + UserEO userEO = dao.selectById(eo.getUsid()); + userEO.setUsname(eo.getUsname()); + userEO.setCellPhoneNumber(EncryptUtil.encrypt(eo.getCellPhoneNumber())); + userEO.setEmail(EncryptUtil.encrypt(eo.getEmail())); + userEO.setDepartment(eo.getDepartment()); + userEO.setPassword(StringUtils.isEmpty(eo.getPassword()) ? userEO.getPassword() : EncryptUtil.encrypt(eo.getPassword())); + userEO.setUpdateTime(format.format(new Date())); + userEO.setAccount(eo.getAccount()); + dao.updateById(userEO); + //删除旧的角色 + QueryWrapper deleteWapper =new QueryWrapper<>(); + deleteWapper.eq("user_id",userEO.getUsid()); + userRoleEODao.delete(deleteWapper); + } + eo.getRoleIdList().forEach(c -> { + UserRoleEO userRoleEO = new UserRoleEO(); + userRoleEO.setUserId(eo.getUsid()); + userRoleEO.setRoleId(c); + userRoleEODao.insert(userRoleEO); + }); + + } + + + @Transactional(rollbackFor = Exception.class) + public void saveBatch(List userEOList) { + dao.insertUserBatch(userEOList); + } + + + @Override + public void setIsUse(String usid, String type) { + UserEO userEO = dao.selectById(usid); + userEO.setIsUse(type); + dao.updateById(userEO); + } + + @Override + public UserEO getUserById(String usid) { + UserEO userEO = dao.selectById(usid); + return userEO; + } + + @Override + public IPage> list(int pageNo, int pageSize, String account, String roleName) { + IPage page = new Page(); + page.setCurrent(pageNo); + page.setSize(pageSize); + IPage> list = dao.list(page, account, roleName); + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String ids) { + String[] idArray = ids.split(","); + for (String id : idArray) { + + UserEO userEO = dao.selectById(id); + userEO.setDelFlag(1); + dao.updateById(userEO); + //删除用户的角色 + QueryWrapper deleteWapper =new QueryWrapper<>(); + deleteWapper.eq("user_id",userEO.getUsid()); + userRoleEODao.delete(deleteWapper); + + + } + } + + /** + * 查询用户及用户所对应的角色 + * + * @param id 用户id + * @return 用户角色信息 + */ + @Transactional(readOnly = true) + public UserEO getUserWithRoles(String id) { + return dao.getUserWithRoles(id); + } + + + // 根据account获取未逻辑删除的UserEO + @Transactional(readOnly = true) + public UserEO getUserByLoginNameNotDeleted(String userName) { + + UserEO userEO = dao.getUserEOByAccountNotDeleted(userName); + if (userEO == null) { + return null; + } + return userEO; + } + + @Transactional(readOnly = true) + public PageInfo getUserPage(DdmUserQueryVO query) { + IPage page = new Page(); + page.setCurrent(query.getPageNum()); + page.setSize(query.getPageSize()); + IPage userPage = dao.getUserPage(page,query.getUserAccount(),query.getUserName()); + Long count = dao.getUserCount(query); + PageInfo pageInfo = new PageInfo(); + pageInfo.setPageSize(query.getPageSize()); + pageInfo.setCount(count); + pageInfo.setList(userPage.getRecords()); + return pageInfo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void importExcelUser(List list) { + checkExcel(list); + Map> dataMap = list.stream().collect(Collectors.groupingBy(UserImportVO::getOperation)); + Set keySet = dataMap.keySet(); + Date date = new Date(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + keySet.forEach(key -> { + //新增 + if ("add".equals(key)) { + List userEOArrayList = dataMap.get(key); + ArrayList addList = new ArrayList<>(); + ArrayList addRoleList = new ArrayList<>(); + userEOArrayList.forEach(userImportVO -> { + UserEO userEO = new UserEO(); + BeanUtils.copyProperties(userImportVO, userEO); + userEO.setDelFlag(0); + userEO.setIsSelf("1"); + userEO.setUsid(com.adc.da.util.utils.UUID.randomUUID10()); + userEO.setCellPhoneNumber(userImportVO.getCellPhoneNumber() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getCellPhoneNumber())); + userEO.setPassword(EncryptUtil.encrypt("EI$XIL@vdc9ptev7")); + userEO.setEmail(userImportVO.getEmail() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getEmail())); + userEO.setCreateTime(simpleDateFormat.format(date)); + userEO.setUpdateTime(simpleDateFormat.format(date)); + userEO.setRoleId(userImportVO.getRoleId()); + addList.add(userEO); + + }); + saveBatch(addList); + //添加角色 + addList.forEach(userEO -> { + //角色 + UserRoleEO userRoleEO = new UserRoleEO(); + userRoleEO.setRoleId(userEO.getRoleId()); + userRoleEO.setUserId(userEO.getUsid()); + addRoleList.add(userRoleEO); + }); + userRoleEODao.insertBatch(addRoleList); + + } + //更新 + if ("full".equals(key)) { + List userEOArrayList = dataMap.get(key); + ArrayList userIDList = new ArrayList<>(); + ArrayList userRoleList = new ArrayList<>(); + userEOArrayList.forEach(userImportVO -> { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("ACCOUNT", userImportVO.getAccount()); + queryWrapper.eq("DEL_FLAG", 0); + UserEO userEO = dao.selectOne(queryWrapper); + if(null!=userEO){ + userEO.setUsname(userImportVO.getUsname()); + userEO.setCellPhoneNumber(userImportVO.getCellPhoneNumber() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getCellPhoneNumber())); + userEO.setEmail(userImportVO.getEmail() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getEmail())); + userEO.setDepartment(userImportVO.getDepartment()); + userEO.setIsUse(userImportVO.getIsUse()); + userEO.setUpdateTime(simpleDateFormat.format(date)); + dao.updateById(userEO); + userIDList.add(userEO.getUsid()); + UserRoleEO userRoleEO = new UserRoleEO(); + userRoleEO.setUserId(userEO.getUsid()); + userRoleEO.setRoleId(userImportVO.getRoleId()); + userRoleList.add(userRoleEO); + } + }); + QueryWrapper deleteWapper = new QueryWrapper<>(); + deleteWapper.in("user_id", userIDList); + userRoleEODao.delete(deleteWapper); + userRoleEODao.insertBatch(userRoleList); + } + }); + } + + @Override + public List> allList(String account, String roleName) { + return dao.allList(account,roleName); + } + + @Override + public List getUserByMail(List mailList) { + return dao.getUserByMail(mailList); + } + + @Override + public List getUserByAccount(List accountList) { + return dao.getUserByAccount(accountList); + } + + void checkExcel(List list) { + if (CollectionUtils.isEmpty(list)) { + throw new AdcDaBaseException("数据不能为空"); + } + //所有角色 + List allRoles = roleEOService.findAll(); + HashMap roleEOMap = new HashMap<>(); + for (RoleEO roleEO : allRoles) { + roleEOMap.put(roleEO.getName(), roleEO); + } + //所有用户 + List existUserAccounts = new ArrayList<>(); + List existUserAccountsUpdate = new ArrayList<>(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("del_flag", 0); + List allUsers = dao.selectList(queryWrapper); + for (UserEO userEO : allUsers) { + existUserAccounts.add(userEO.getAccount()); + existUserAccountsUpdate.add(userEO.getAccount()); + } + + + for (int i = 0; i < list.size(); i++) { + UserImportVO userImportVO = list.get(i); + if (StringUtils.isEmpty(userImportVO.getAccount())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不能为空"); + } + if (StringUtils.isEmpty(userImportVO.getUsname())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不能为空"); + } + if (userImportVO.getUsname().length() > 20) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不超过20字符"); + } + if ("admin".equals(userImportVO.getAccount()) || + "root".equals(userImportVO.getAccount()) || + "administrator".equals(userImportVO.getAccount()) || + "test".equals(userImportVO.getAccount()) || + "tester".equals(userImportVO.getAccount())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不符合规则"); + } + if (StringUtils.isNotBlank(userImportVO.getDepartment())) { + if (userImportVO.getDepartment().length() > 50) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"部门不超过50字符"); + } + } + if (StringUtils.isNotBlank(userImportVO.getEmail())) { + userImportVO.setEmail(userImportVO.getEmail().replace("amp;", "")); + } + if (StringUtils.isNotBlank(userImportVO.getCellPhoneNumber())) { + if (!userImportVO.getCellPhoneNumber().matches("^[1][3,4,5,7,8,9][0-9]{9}$")) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"手机号不符合规则"); + } + } + if (StringUtils.isEmpty(userImportVO.getOperation())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"操作(add添加、full覆盖角色)不能为空"); + } + if (StringUtils.isEmpty(userImportVO.getIsUse())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"是否启用不能为空"); + } + if (!roleEOMap.keySet().contains(userImportVO.getRoleName())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"角色:" + userImportVO.getRoleName() + "不存在,请检查"); + } + if ("add".equals(userImportVO.getOperation())) { + if (existUserAccounts.contains(userImportVO.getAccount())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "已存在,请检查"); + }else{ + existUserAccounts.add(userImportVO.getAccount()); + } + } + if ("full".equals(userImportVO.getOperation())) { + if (!existUserAccountsUpdate.contains(userImportVO.getAccount())) { + throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "不存在,无法更新,请检查"); + } + } + userImportVO.setRoleId(roleEOMap.get(userImportVO.getRoleName()).getId()); + + + } + + } +} + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java new file mode 100644 index 0000000..19c31c9 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java @@ -0,0 +1,62 @@ +package com.adc.da.sys.service.iservice; + +import com.adc.da.sys.entity.UserEO; +import com.adc.da.sys.vo.UserImportVO; +import com.adc.da.sys.vo.ddm.DdmUserQueryVO; +import com.adc.da.sys.vo.ddm.DdmUserVO; +import com.adc.da.util.http.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Author doudxw + * @Date 2021/11/4 09:17 + */ +public interface IUserEoService { + + /** 根据登录名和id查询用户 + * @param userName + * @param usid + * @return + */ + UserEO getUserByLoginName(String userName,String usid); + + /** + * 根据邮箱和id查询用户数量 + * @param email + * @param usid + * @return + */ + int getUserCountByEmail(String email,String usid); + + /** + * 新增或者编辑用户 + * @param eo + */ + void save(UserEO eo); + + void setIsUse(String usid,String type); + + UserEO getUserById(String usid); + + IPage> list(int pageNo, int pageSize, String account, String roleName); + + void delete(String ids); + + UserEO getUserWithRoles(String id); + + UserEO getUserByLoginNameNotDeleted(String userName); + + public PageInfo getUserPage(DdmUserQueryVO query); + + public void importExcelUser(List list); + + List> allList(String account, String roleName); + + List getUserByMail(List mailList); + + List getUserByAccount(List mailList); +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/CacheUtils.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/CacheUtils.java new file mode 100644 index 0000000..896aa46 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/CacheUtils.java @@ -0,0 +1,141 @@ +package com.adc.da.sys.util; + +import com.adc.da.util.utils.SpringContextHolder; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; + +/** + * Cache工具类 + */ +public class CacheUtils { + + private CacheUtils() { + throw new IllegalStateException("CacheUtils.java"); + } + + private static CacheManager cacheManager = SpringContextHolder.getBean("ehCacheManagerFactoryBean"); + + private static final String SYS_CACHE = "sysCache"; + + private static final String ERROR_CACHE = "errorCache"; + + private static final String SUBJECT_CACHE = "subjectCache" ; + private static final String SHIRO_ACTIVE_SESSION_CACHE = "shiro-activeSessionCache"; + + + public static Object get(String key) { + return get(SYS_CACHE, key); + } + + public static void put(String key, Object value) { + put(SYS_CACHE, key, value); + } + + public static void remove(String key) { + remove(SYS_CACHE, key); + } + + //以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml + // + public static Object getErrorCache(String key) { + return get(ERROR_CACHE, key); + } + + public static void putErrorCache(String key, Object value) { + put(ERROR_CACHE, key, value); + } + + public static void removeErrorCache(String key) { + remove(ERROR_CACHE, key); + } + + + //以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml + // + public static Object getSubjectCache(String key) { + return get(SUBJECT_CACHE, key); + } + + public static void putSubjectCache(String key, Object value) { + put(SUBJECT_CACHE, key, value); + } + + public static void removeSubjectCache(String key) { + remove(SUBJECT_CACHE, key); + } + + public static Cache getSubjectCacheObject() { + Cache cache = cacheManager.getCache(SUBJECT_CACHE); + if (cache == null) { + cacheManager.addCache(SUBJECT_CACHE); + cache = cacheManager.getCache(SUBJECT_CACHE); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + //cacheManager.getCache("shiroActiveSessionCache").remove(sessionid) + + public static Cache getShiroSessionCacheObject() { + Cache cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE); + if (cache == null) { + cacheManager.addCache(SHIRO_ACTIVE_SESSION_CACHE); + cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + public static void putShiroSessionCache(String key, Object value) { + put(SHIRO_ACTIVE_SESSION_CACHE, key, value); + } + + public static Object getShiroSessionCache(String key) { + return get(SUBJECT_CACHE, key); + } + + public static void removeShiroSessionCache(String key) { + remove(SHIRO_ACTIVE_SESSION_CACHE, key); + } + + + + + + + public static Object get(String cacheName, String key) { + Element element = getCache(cacheName).get(key); + return element == null ? null : element.getObjectValue(); + } + + public static void put(String cacheName, String key, Object value) { + Element element = new Element(key, value); + getCache(cacheName).put(element); + } + + public static void remove(String cacheName, String key) { + getCache(cacheName).remove(key); + } + + /** + * 获得一个Cache,没有则创建一个。 + * + * @param cacheName + * @return + */ + private static Cache getCache(String cacheName) { + Cache cache = cacheManager.getCache(cacheName); + if (cache == null) { + cacheManager.addCache(cacheName); + cache = cacheManager.getCache(cacheName); + cache.getCacheConfiguration().setEternal(true); + } + return cache; + } + + public static CacheManager getCacheManager() { + return cacheManager; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/CompressUtil.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/CompressUtil.java new file mode 100644 index 0000000..2829e5c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/CompressUtil.java @@ -0,0 +1,183 @@ +package com.adc.da.sys.util; + +import java.io.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + + +public class CompressUtil { + + /** + * @param path 要压缩的文件路径 + * @param format 生成的格式(zip、rar)d + */ + public static void generateFile(String path, String format) throws Exception { + + File file = new File(path); + // 压缩文件的路径不存在 + if (!file.exists()) { + throw new Exception("路径 " + path + " 不存在文件,无法进行压缩..."); + } + // 用于存放压缩文件的文件夹 +// String generateFile = file.getParent() + File.separator + "CompressFile"; +// File compress = new File(generateFile); +// // 如果文件夹不存在,进行创建 +// if (!compress.exists()) { +// compress.mkdirs(); +// } +// +// // 目的压缩文件 +// String generateFileName = compress.getAbsolutePath() + File.separator + "AAA" + file.getName() + "." + format; + + String generateFileName="/Users/sxh/test.rar"; + + // 输入流 表示从一个源读取数据 + // 输出流 表示向一个目标写入数据 + + // 输出流 + FileOutputStream outputStream = new FileOutputStream(generateFileName); + + // 压缩输出流 + ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(outputStream)); + + generateFile(zipOutputStream, file, ""); + + System.out.println("源文件位置:" + file.getAbsolutePath() + ",目的压缩文件生成位置:" + generateFileName); + // 关闭 输出流 + zipOutputStream.close(); + } + + /** + * @param out 输出流 + * @param file 目标文件 + * @param dir 文件夹 + * @throws Exception + */ + private static void generateFile(ZipOutputStream out, File file, String dir) throws Exception { + + // 当前的是文件夹,则进行一步处理 + if (file.isDirectory()) { + //得到文件列表信息 + File[] files = file.listFiles(); + + //将文件夹添加到下一级打包目录 + out.putNextEntry(new ZipEntry(dir + "/")); + + dir = dir.length() == 0 ? "" : dir + "/"; + + //循环将文件夹中的文件打包 + for (int i = 0; i < files.length; i++) { + generateFile(out, files[i], dir + files[i].getName()); + } + + } else { // 当前是文件 + + // 输入流 + FileInputStream inputStream = new FileInputStream(file); + // 标记要打包的条目 + out.putNextEntry(new ZipEntry(file.getName())); + // 进行写操作 + int len = 0; + byte[] bytes = new byte[1024]; + while ((len = inputStream.read(bytes)) > 0) { + out.write(bytes, 0, len); + } + // 关闭输入流 + inputStream.close(); + } + + } + + + + /** + * 递归压缩文件 + * @param output ZipOutputStream 对象流 + * @param file 压缩的目标文件流 + * @param childPath 条目目录 + */ + private static void zip(ZipOutputStream output,File file,String childPath){ + FileInputStream input = null; + try { + // 文件为目录 + if (file.isDirectory()) { + // 得到当前目录里面的文件列表 + File list[] = file.listFiles(); + childPath = childPath + (childPath.length() == 0 ? "" : "/") + + file.getName(); + // 循环递归压缩每个文件 + for (File f : list) { + zip(output, f, childPath); + } + } else { + // 压缩文件 + childPath = (childPath.length() == 0 ? "" : childPath + "/") + + file.getName(); + output.putNextEntry(new ZipEntry(childPath)); + input = new FileInputStream(file); + int readLen = 0; + byte[] buffer = new byte[1024 * 8]; + while ((readLen = input.read(buffer, 0, 1024 * 8)) != -1) { + output.write(buffer, 0, readLen); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + // 关闭流 + if (input != null) { + try { + input.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + } + + + + public static String zipFile(File path,String format) throws Exception { + String generatePath = ""; + if( path.isDirectory() ){ + generatePath = path.getParent().endsWith("/") == false ? path.getParent() + File.separator + path.getName() + "." + format: path.getParent() + path.getName() + "." + format; + }else { + generatePath = path.getParent().endsWith("/") == false ? path.getParent() + File.separator : path.getParent(); + generatePath += path.getName().substring(0,path.getName().lastIndexOf(".")) + "." + format; + } + // 输出流 + FileOutputStream outputStream = new FileOutputStream( generatePath ); + // 压缩输出流 + ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(outputStream)); + zip(out, path,""); + out.flush(); + out.close(); + + return generatePath; + } + + // 测试 + public static void main(String[] args) { +// String path = "/Users/sxh/reportTest/2020-02"; +// String format = "rar"; +// +// try { +// generateFile(path, format); +// } catch (Exception e) { +// e.printStackTrace(); +// System.out.println(e.getMessage()); +// } + + + String path = "/Users/sxh/reportTest/2020-02"; + String format = "rar"; + try { + System.out.println(zipFile(new File(path),format)); + } catch (Exception e) { + e.printStackTrace(); + System.out.println(e.getMessage()); + } + + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/DefaultConfigurer.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/DefaultConfigurer.java new file mode 100644 index 0000000..add6453 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/DefaultConfigurer.java @@ -0,0 +1,108 @@ +package com.adc.da.sys.util; + +import org.springframework.beans.factory.annotation.Value; + +import java.util.Properties; + +/** + * @Author sima + * @Date 2022/7/11 10:30 + */ +public class DefaultConfigurer { + + private String mail_smtp; + + private String mail_smtp_port; + + private String mail_pop_port; + + public String getMail_smtp() { + return mail_smtp; + } + + public void setMail_smtp(String mail_smtp) { + this.mail_smtp = mail_smtp; + } + + public String getMail_smtp_port() { + return mail_smtp_port; + } + + public void setMail_smtp_port(String mail_smtp_port) { + this.mail_smtp_port = mail_smtp_port; + } + + public String getMail_pop_port() { + return mail_pop_port; + } + + public void setMail_pop_port(String mail_pop_port) { + this.mail_pop_port = mail_pop_port; + } + + /** + * 获取SMTP默认配置 + * + * @return + */ + public Properties getSMTP() { + Properties p = new Properties(); +// p.setProperty("mail.smtp.host", "smtp.qq.com"); // 按需要更改 + p.setProperty("mail.smtp.host", mail_smtp); // 按需要更改 + p.setProperty("mail.smtp.protocol", "smtp"); +// p.setProperty("mail.smtp.port", "465"); + p.setProperty("mail.smtp.port", mail_smtp_port); + + p.setProperty("mail.smtp.auth", "true"); + + // SSL安全连接参数 长安发件服务器不配,qq网易邮箱需要配 + if ("cmp.changan.com".equals(mail_smtp)) { + p.setProperty("mail.smtp.starttls.enable", "true"); + } else { + p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + p.setProperty("mail.smtp.socketFactory.fallback", "false"); +// p.setProperty("mail.smtp.socketFactory.port", "465"); + p.setProperty("mail.smtp.socketFactory.port", mail_smtp_port); + } + + + + return p; + } + + /** + * 获取POP3收信配置 + * + * @return + */ + public Properties getPOP3() { + Properties p = new Properties(); +// p.setProperty("mail.pop3.host", "pop.qq.com"); // 按需要更改 + p.setProperty("mail.pop3.host", mail_smtp); // 按需要更改 +// p.setProperty("mail.pop3.port", "995"); + p.setProperty("mail.pop3.port", mail_pop_port); +// SSL安全连接参数 +// p.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); +// p.setProperty("mail.pop3.socketFactory.fallback", "false"); +//// p.setProperty("mail.pop3.socketFactory.port", "995"); +// p.setProperty("mail.pop3.socketFactory.port", mail_pop_port); + p.setProperty("mail.smtp.starttls.enable", "true"); + return p; + } + + /** + * 获取IMAP收信配置 + * + * @return + */ + public Properties getIMAP() { + Properties p = new Properties(); + p.setProperty("mail.imap.host", "imap.qq.com"); // 按需要更改 + p.setProperty("mail.imap.port", "993"); +// SSL安全连接参数 + p.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + p.setProperty("mail.imap.socketFactory.fallback", "false"); + p.setProperty("mail.imap.socketFactory.port", "993"); + return p; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/EncryptUtil.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/EncryptUtil.java new file mode 100644 index 0000000..50aaf35 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/EncryptUtil.java @@ -0,0 +1,482 @@ +package com.adc.da.sys.util; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +/** + * 功能描述 加密常用类 + */ +@Slf4j +public class EncryptUtil { + // 密钥是16位长度的byte[]进行Base64转换后得到的字符串 + public static String key = "LmMGStGtOpF4xNyvYt54EQ=="; + + /** + *

  • + * 方法名称:encrypt
  • + * 加密方法 + * + * @param xmlStr + * 需要加密的消息字符串 + * @return 加密后的字符串 + */ + public static String encrypt(String xmlStr) { + byte[] encrypt = null; + + try { + // 取需要加密内容的utf-8编码。 + encrypt = xmlStr.getBytes("utf-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + // 取MD5Hash码,并组合加密数组 + byte[] md5Hasn = null; + try { + md5Hasn = EncryptUtil.MD5Hash(encrypt, 0, encrypt.length); + } catch (Exception e) { + e.printStackTrace(); + } + // 组合消息体 + byte[] totalByte = EncryptUtil.addMD5(md5Hasn, encrypt); + + // 取密钥和偏转向量 + byte[] key = new byte[8]; + byte[] iv = new byte[8]; + getKeyIV(EncryptUtil.key, key, iv); + SecretKeySpec deskey = new SecretKeySpec(key, "DES"); + IvParameterSpec ivParam = new IvParameterSpec(iv); + + // 使用DES算法使用加密消息体 + byte[] temp = null; + try { + temp = EncryptUtil.DES_CBC_Encrypt(totalByte, deskey, ivParam); + } catch (Exception e) { + e.printStackTrace(); + } + + // 使用Base64加密后返回 + return new BASE64Encoder().encode(temp); + } + + /** + *
  • + * 方法名称:encrypt
  • + * 功能描述: + * + *
    +	 * 解密方法
    +	 * 
    + * + *
  • + * + * @param xmlStr + * 需要解密的消息字符串 + * @return 解密后的字符串 + * @throws Exception + */ + public static String decrypt(String xmlStr) throws Exception { + // base64解码 + BASE64Decoder decoder = new BASE64Decoder(); + byte[] encBuf = null; + try { + encBuf = decoder.decodeBuffer(xmlStr); + } catch (IOException e) { + e.printStackTrace(); + } + + // 取密钥和偏转向量 + byte[] key = new byte[8]; + byte[] iv = new byte[8]; + getKeyIV(EncryptUtil.key, key, iv); + + SecretKeySpec deskey = new SecretKeySpec(key, "DES"); + IvParameterSpec ivParam = new IvParameterSpec(iv); + + // 使用DES算法解密 + byte[] temp = null; + try { + temp = EncryptUtil.DES_CBC_Decrypt(encBuf, deskey, ivParam); + } catch (Exception e) { + e.printStackTrace(); + } + + // 进行解密后的md5Hash校验 + byte[] md5Hash = null; + try { + md5Hash = EncryptUtil.MD5Hash(temp, 16, temp.length - 16); + } catch (Exception e) { + e.printStackTrace(); + } + + // 进行解密校检 + for (int i = 0; i < md5Hash.length; i++) { + if (md5Hash[i] != temp[i]) { + // System.out.println(md5Hash[i] + "MD5校验错误。" + temp[i]); + throw new Exception("MD5校验错误。"); + } + } + + // 返回解密后的数组,其中前16位MD5Hash码要除去。 + return new String(temp, 16, temp.length - 16, "utf-8"); + } + + /** + *
  • + * 方法名称:TripleDES_CBC_Encrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的三重DES/CBC加密算法,如果包含中文,请注意编码。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要加密内容的字节数组。 + * @param deskey + * KEY 由24位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 + * @return 加密后的字节数组 + * @throws Exception + */ + public static byte[] TripleDES_CBC_Encrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + byte[] cipherByte; + // 使用DES对称加密算法的CBC模式加密 + Cipher encrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding"); + + encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam); + + cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回加密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:TripleDES_CBC_Decrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的三重DES / CBC解密算法
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要解密内容的字节数组 + * @param deskey + * KEY 由24位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 + * @return 解密后的字节数组 + * @throws Exception + */ + public static byte[] TripleDES_CBC_Decrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + + byte[] cipherByte; + // 获得Cipher实例,使用CBC模式。 + Cipher decrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding"); + // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量 + decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam); + + cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回解密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:DES_CBC_Encrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的DES/CBC加密算法,如果包含中文,请注意编码。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要加密内容的字节数组。 + * @param deskey + * KEY 由8位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 + * @return 加密后的字节数组 + * @throws Exception + */ + public static byte[] DES_CBC_Encrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + byte[] cipherByte; + // 使用DES对称加密算法的CBC模式加密 + Cipher encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding"); + + encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam); + + cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回加密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:DES_CBC_Decrypt
  • + * 功能描述: + * + *
    +	 * 经过封装的DES/CBC解密算法。
    +	 * 
    + * + *
  • + * + * @param sourceBuf + * 需要解密内容的字节数组 + * @param deskey + * KEY 由8位字节数组通过SecretKeySpec类转换而成。 + * @param ivParam + * IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 + * @return 解密后的字节数组 + * @throws Exception + */ + public static byte[] DES_CBC_Decrypt(byte[] sourceBuf, + SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception { + + byte[] cipherByte; + // 获得Cipher实例,使用CBC模式。 + Cipher decrypt = Cipher.getInstance("DES/CBC/PKCS5Padding"); + // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量 + decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam); + + cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length); + // 返回解密后的字节数组 + return cipherByte; + } + + /** + *
  • + * 方法名称:MD5Hash
  • + * 功能描述: + * + *
    +	 * MD5,进行了简单的封装,以适用于加,解密字符串的校验。
    +	 * 
    + * + *
  • + * + * @param buf + * 需要MD5加密字节数组。 + * @param offset + * 加密数据起始位置。 + * @param length + * 需要加密的数组长度。 + * @return + * @throws Exception + */ + public static byte[] MD5Hash(byte[] buf, int offset, int length) + throws Exception { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(buf, offset, length); + return md.digest(); + } + + /** + *
  • + * 方法名称:byte2hex
  • + * 功能描述: + * + *
    +	 * 字节数组转换为二行制表示
    +	 * 
    + * + *
  • + * + * @param inStr + * 需要转换字节数组。 + * @return 字节数组的二进制表示。 + */ + public static String byte2hex(byte[] inStr) { + String stmp; + StringBuffer out = new StringBuffer(inStr.length * 2); + + for (int n = 0; n < inStr.length; n++) { + // 字节做"与"运算,去除高位置字节 11111111 + stmp = Integer.toHexString(inStr[n] & 0xFF); + if (stmp.length() == 1) { + // 如果是0至F的单位字符串,则添加0 + out.append("0" + stmp); + } else { + out.append(stmp); + } + } + return out.toString(); + } + + /** + *
  • + * 方法名称:addMD5
  • + * 功能描述: + * + *
    +	 * MD校验码 组合方法,前16位放MD5Hash码。 把MD5验证码byte[],加密内容byte[]组合的方法。
    +	 * 
    + * + *
  • + * + * @param md5Byte + * 加密内容的MD5Hash字节数组。 + * @param bodyByte + * 加密内容字节数组 + * @return 组合后的字节数组,比加密内容长16个字节。 + */ + public static byte[] addMD5(byte[] md5Byte, byte[] bodyByte) { + int length = bodyByte.length + md5Byte.length; + byte[] resutlByte = new byte[length]; + + // 前16位放MD5Hash码 + for (int i = 0; i < length; i++) { + if (i < md5Byte.length) { + resutlByte[i] = md5Byte[i]; + } else { + resutlByte[i] = bodyByte[i - md5Byte.length]; + } + } + + return resutlByte; + } + + /** + *
  • + * 方法名称:getKeyIV
  • + * 功能描述: + * + *
    +	 * 
    +	 * 
    + *
  • + * + * @param encryptKey + * @param key + * @param iv + */ + public static void getKeyIV(String encryptKey, byte[] key, byte[] iv) { + // 密钥Base64解密 + BASE64Decoder decoder = new BASE64Decoder(); + byte[] buf = null; + try { + buf = decoder.decodeBuffer(encryptKey); + } catch (IOException e) { + e.printStackTrace(); + } + // 前8位为key + int i; + for (i = 0; i < key.length; i++) { + key[i] = buf[i]; + } + // 后8位为iv向量 + for (i = 0; i < iv.length; i++) { + iv[i] = buf[i + 8]; + } + } + + /** + * AES加密算法 + * + * @param content + * 加密内容 + * @param password + * 密匙 + * @return + */ + public static String encryptAES(String content, String password) { + try { + if (content == null || content.equalsIgnoreCase("")) { + return ""; + } + + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + BASE64Encoder coder = new BASE64Encoder(); + coder.encode(enCodeFormat); + Cipher cipher = Cipher.getInstance("AES"); + byte[] byteContent = content.getBytes("utf-8"); + cipher.init(1, key); + byte[] result = cipher.doFinal(byteContent); + String str = Base64.encodeBase64String(result); + return str; + } catch (NoSuchAlgorithmException var13) { + var13.printStackTrace(); + } catch (NoSuchPaddingException var14) { + var14.printStackTrace(); + } catch (InvalidKeyException var15) { + var15.printStackTrace(); + } catch (UnsupportedEncodingException var16) { + var16.printStackTrace(); + } catch (IllegalBlockSizeException var17) { + var17.printStackTrace(); + } catch (BadPaddingException var18) { + var18.printStackTrace(); + } + + return null; + } + + /** + * AES解密 + * + * @param str + * @param password + * @return + */ + public static String decryptAES(String str, String password) { + try { + if (str == null || str.equalsIgnoreCase("")) { + return ""; + } + byte[] content = Base64.decodeBase64(str); + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + Cipher cipher = Cipher.getInstance("AES");// 创建密码器 + cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 + byte[] result = cipher.doFinal(content); + return new String(result, "utf-8"); // 加密 + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/MailSenderInfo.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailSenderInfo.java new file mode 100644 index 0000000..6bbbd11 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailSenderInfo.java @@ -0,0 +1,119 @@ +package com.adc.da.sys.util; + +import java.util.Properties; + +/** + * @Author sima + * @Date 2022/6/30 16:51 + */ +public class MailSenderInfo { + // 发送邮件的服务器的IP和端口 + private String mailServerHost; + private String mailServerPort; + // 邮件发送者的地址 + private String fromAddress; + // 邮件接收者的地址 + private String toAddress; + // 登陆邮件发送服务器的用户名和密码 + private String userName; + private String password; + // 是否需要身份验证 + private boolean validate = false; + // 邮件主题 + private String subject; + // 邮件的文本内容 + private String content; + // 邮件附件的文件名 + private String[] attachFileNames; + + /** + * 获得邮件会话属性 + */ + public Properties getProperties() { + Properties p = new Properties(); + p.put("mail.smtp.host", this.mailServerHost); + p.put("mail.smtp.port", this.mailServerPort); + p.put("mail.smtp.auth", validate ? "true" : "false"); + return p; + } + + public String getMailServerHost() { + return mailServerHost; + } + + public void setMailServerHost(String mailServerHost) { + this.mailServerHost = mailServerHost; + } + + public String getMailServerPort() { + return mailServerPort; + } + + public void setMailServerPort(String mailServerPort) { + this.mailServerPort = mailServerPort; + } + + public boolean isValidate() { + return validate; + } + + public void setValidate(boolean validate) { + this.validate = validate; + } + + public String[] getAttachFileNames() { + return attachFileNames; + } + + public void setAttachFileNames(String[] fileNames) { + this.attachFileNames = fileNames; + } + + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getToAddress() { + return toAddress; + } + + public void setToAddress(String toAddress) { + this.toAddress = toAddress; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getContent() { + return content; + } + + public void setContent(String textContent) { + this.content = textContent; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/MailTestUtils.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailTestUtils.java new file mode 100644 index 0000000..31dbb08 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailTestUtils.java @@ -0,0 +1,259 @@ +package com.adc.da.sys.util; + + + + + +import java.io.UnsupportedEncodingException; + +import java.util.*; + + +import javax.mail.Authenticator; + +import javax.mail.FetchProfile; + +import javax.mail.Folder; + +import javax.mail.Message; + +import javax.mail.Message.RecipientType; + +import javax.mail.PasswordAuthentication; + +import javax.mail.Session; + +import javax.mail.Store; + +import javax.mail.Transport; + +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; + +import javax.mail.internet.MimeMessage; + +import javax.mail.internet.MimeUtility; + + +/** + *

    + * Title: 使用javamail + *

    + */ +public class MailTestUtils { + + + + + private String username = null; // 邮箱用户名 + + private String password = null; // 邮箱密码 + + + + + /** + + * 传入自己的邮箱用户名和密码 + + * @param username + + * @param password + + */ + + public MailTestUtils(String username, String password) { + + this.username = username; + + this.password = password; + + } + + + /** + + * 创建连接会话 + + * @param props + + * @return + + */ + + public Session createSession(Properties props) { + + + Session session = Session.getInstance(props, new Authenticator() { + +// 返回用户名密码认证 + + @Override + + public PasswordAuthentication getPasswordAuthentication() { + + PasswordAuthentication pa = new PasswordAuthentication(username, password); + + return pa; + + } + + }); + + + return session; + + } + + + + + /** + + * 发送邮件(需设置SMTP) + + * @throws Exception + + */ + + public void sendMail(Properties props, SendEmailMessage sem) throws Exception { + + + Session session = createSession(props); + +// 消息 + Message msg = new MimeMessage(session); + + msg.setFrom(InternetAddress.parse(MimeUtility.decodeText(sem.getFrom()))[0]); + +// TO为初级收件人,CC为邮件副本抄送,BCC应该是密秘抄送吧 + +// msg.setRecipients(RecipientType.TO, InternetAddress.parse(sem.getRecipient())); + + // 添加收件人 + if (sem.getRecipient() != null && !"".equals(sem.getRecipient())) { + msg.setRecipients(Message.RecipientType.TO, getInternetAddress(sem.getRecipient())); + } + // 添加抄送人 + if (sem.getCopyRecipient() != null && !"".equals(sem.getCopyRecipient())) { + msg.setRecipients(Message.RecipientType.CC, getInternetAddress(sem.getCopyRecipient())); + } + + msg.setSubject(sem.getSubject()); + +// msg.setText(sem.getText()); + msg.setContent(sem.getContent(),"text/html;charset=utf-8"); + + msg.setSentDate(new Date()); + + +// 发送消息 + + Transport.send(msg); + + } + + + public InternetAddress[] getInternetAddress(String mails) throws AddressException { + List mailList = Arrays.asList(mails.split(",")); + int length=mailList.size(); + if (length == 0) { + return null; + } + InternetAddress[] internetAddresses = new InternetAddress[length]; + for (int i = 0; i < length; i++) { + internetAddresses[i]=new InternetAddress(mailList.get(i)); + } + return internetAddresses; + } + + /** + + * 接收邮件(需设置POP3或SAMP) + + * @throws Exception + + */ + + public void receiveMail(Properties props, String protocol) throws Exception { + + + Session session = createSession(props); + + Store store = session.getStore(protocol); + + store.connect(); // 连接 + + Folder inbox = store.getFolder("INBOX"); // 进入根目录 + + inbox.open(Folder.READ_WRITE); // 只读方式 + + FetchProfile profile = new FetchProfile(); + + profile.add(FetchProfile.Item.ENVELOPE); // 获取信封 + + Message[] msgs = inbox.getMessages(); // 得到所有邮件 + + inbox.fetch(msgs, profile); // 预获取信息 + +// 打印 + + for (int i = 0; i < msgs.length; i++) { + + System.out.println("发送时间:" + msgs[i].getSentDate()); + + System.out.println("发送人:" + decodeText(msgs[i].getFrom()[0].toString())); + + System.out.println("大小:" + msgs[i].getSize()); + + System.out.println("标题:" + msgs[i].getSubject()); + + System.out.println("内容" + msgs[i].getContent()); + + System.out.println("-------------------"); + + } + + + store.close(); + + } + + + /** + + * 处理中文编码问题 + + * @param text + + * @return + + * @throws UnsupportedEncodingException + + */ + + private String decodeText(String text) throws UnsupportedEncodingException { + + + if (text == null) { + + return null; + + } + + + if (text.startsWith("=?GB") || text.startsWith("=?gb")) + + text = MimeUtility.decodeText(text); + + else + + text = new String(text.getBytes("ISO8859_1")); + + return text; + + } + + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/MailUtils.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailUtils.java new file mode 100644 index 0000000..6e4cdc1 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/MailUtils.java @@ -0,0 +1,354 @@ +package com.adc.da.sys.util; + +import com.adc.da.sys.entity.UserEO; +import com.adc.da.util.utils.StringUtils; +import org.apache.commons.codec.binary.Base64; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.*; +import javax.mail.internet.*; +import javax.validation.constraints.NotBlank; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.Properties; +import java.util.Vector; + + +/** + *

    + * Title: 使用javamail + *

    + */ +public class MailUtils { + + String to = "";// 收件人 + String from = "";// 发件人 + String host = "";// smtp主机 + String port = ""; + String username = ""; + String password = ""; + String filename = "";// 附件文件名 + String subject = "";// 邮件主题 + String content = "";// 邮件正文 + Vector file = new Vector();// 附件文件集合 + + /** + *
    + * 方法说明:默认构造器
    + * 输入参数:
    + * 返回类型: + */ + public MailUtils() { + } + + /** + *
    + * 方法说明:构造器,提供直接的参数传入
    + * 输入参数:
    + * 返回类型: + */ + public MailUtils(String to, String from, String smtpServer, + String username, String password, String subject, String content) { + this.to = to; + this.from = from; + this.host = smtpServer; + this.username = username; + this.password = password; + this.subject = subject; + this.content = content; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + /** + *
    + * 方法说明:设置邮件服务器地址
    + * 输入参数:String host 邮件服务器地址名称
    + * 返回类型: + */ + + public void setHost(String host) { + this.host = host; + } + + /** + *
    + * 方法说明:设置登录服务器校验密码
    + * 输入参数:
    + * 返回类型: + */ + public void setPassWord(String pwd) { + this.password = pwd; + } + + /** + *
    + * 方法说明:设置登录服务器校验用户
    + * 输入参数:
    + * 返回类型: + */ + public void setUserName(String usn) { + this.username = usn; + } + + /** + *
    + * 方法说明:设置邮件发送目的邮箱
    + * 输入参数:
    + * 返回类型: + */ + public void setTo(String to) { + this.to = to; + } + + /** + *
    + * 方法说明:设置邮件发送源邮箱
    + * 输入参数:
    + * 返回类型: + */ + public void setFrom(String from) { + this.from = from; + } + + /** + *
    + * 方法说明:设置邮件主题
    + * 输入参数:
    + * 返回类型: + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + *
    + * 方法说明:设置邮件内容
    + * 输入参数:
    + * 返回类型: + */ + public void setContent(String content) { + this.content = content; + } + + /** + *
    + * 方法说明:把主题转换为中文
    + * 输入参数:String strText
    + * 返回类型: + */ + public String transferChinese(String strText) { + try { + // strText = MimeUtility.encodeText(new String(strText.getBytes(), + // "UTF-8"), "UTF-8", "B"); + strText = MimeUtility.encodeText(strText); + } catch (Exception e) { + e.printStackTrace(); + } + return strText; + } + + /** + *
    + * 方法说明:往附件组合中添加附件
    + * 输入参数:
    + * 返回类型: + */ + public void attachfile(String fname) { + file.addElement(fname); + } + + /** + *
    + * 方法说明:发送邮件
    + * 输入参数:
    + * 返回类型:boolean 成功为true,反之为false + */ + public boolean sendMail() { + + // 构造mail session + Properties props = new Properties(); + // props.put("mail.smtp.host", host); + // props.put("mail.smtp.auth", "true"); + final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; +// props.setProperty("mail.smtp.host", "smtp.163.com"); + props.setProperty("mail.smtp.host", host); + props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); + props.setProperty("mail.smtp.socketFactory.fallback", "false"); + props.setProperty("mail.smtp.port", port); + props.setProperty("mail.smtp.socketFactory.port", port); + props.setProperty("mail.smtp.auth", "true"); + Session session = Session.getDefaultInstance(props, + new Authenticator() { + @Override + public PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + // Session session = Session.getDefaultInstance(props); + // Session session = Session.getDefaultInstance(props, null); + + try { + // 构造MimeMessage 并设定基本的值 + MimeMessage msg = new MimeMessage(session); + // MimeMessage msg = new MimeMessage(); + msg.setFrom(new InternetAddress(from)); + + // msg.addRecipients(Message.RecipientType.TO, address); + // //这个只能是给一个人发送email + msg.setRecipients(Message.RecipientType.BCC, + InternetAddress.parse(to)); + subject = transferChinese(subject); + msg.setSubject(subject); + + // 构造Multipart + Multipart mp = new MimeMultipart(); + + // 向Multipart添加正文 + MimeBodyPart mbpContent = new MimeBodyPart(); + mbpContent.setContent(content, "text/html;charset=utf-8"); + + // 向MimeMessage添加(Multipart代表正文) + mp.addBodyPart(mbpContent); + + // 向Multipart添加附件 + Enumeration efile = file.elements(); + while (efile.hasMoreElements()) { + + MimeBodyPart mbpFile = new MimeBodyPart(); + filename = efile.nextElement().toString(); + FileDataSource fds = new FileDataSource(filename); + mbpFile.setDataHandler(new DataHandler(fds)); + // //这个方法可以解决附件乱码问题。 + String filename = new String(fds.getName().getBytes(), "UTF-8"); + + mbpFile.setFileName(filename); + // 向MimeMessage添加(Multipart代表附件) + mp.addBodyPart(mbpFile); + + } + + file.removeAllElements(); + // 向Multipart添加MimeMessage + msg.setContent(mp); + msg.setSentDate(new Date()); + msg.saveChanges(); + // 发送邮件 + + Transport transport = session.getTransport("smtp"); + transport.connect(host, username, password); + transport.sendMessage(msg, msg.getAllRecipients()); + transport.close(); + } catch (Exception mex) { + mex.printStackTrace(); + // Exception ex = null; + // if ((ex = mex.getNextException()) != null) { + // ex.printStackTrace(); + // } + return false; + } + return true; + } + + /** + *
    + * 方法说明:主方法,用于测试
    + * 输入参数:
    + * 返回类型: + */ + public static void main(String[] args) { + MailUtils sendmail = new MailUtils(); + + sendmail.setHost("smtp.163.com"); + sendmail.setPort("465"); +// sendmail.setUserName("simashihao@163.com"); +// sendmail.setPassWord("VQBNNQBLDIALAYCV"); + sendmail.setUserName("cagds@catarc.ac.cn"); + sendmail.setPassWord("Cagds9760"); + sendmail.setTo("1845769955@qq.com"); + sendmail.setFrom("cagds@catarc.ac.cn"); + sendmail.setSubject("你好,这是测试!"); + sendmail.setContent("你好这是一个带多附件的测试!"); + // Mail sendmail = new + // Mail("dujiang@sricnet.com","du_jiang@sohu.com","smtp.sohu.com","du_jiang","31415926","你好","胃,你好吗?"); +// sendmail.attachfile("D:\\123\\测试Excel.xls"); + + System.out.println(sendmail.sendMail()); + + } + public static void main1(String[] args) { + + String toEmailAddress = "simashihao@163.com"; + + + MailSenderInfo mailInfo = new MailSenderInfo(); + mailInfo.setMailServerHost("smtp.qiye.163.com"); + mailInfo.setMailServerPort("25"); + mailInfo.setValidate(true); + mailInfo.setUserName("service@tbrat.org"); + mailInfo.setPassword("Wang2018"); // 您的邮箱密码 + mailInfo.setFromAddress("service@tbrat.org"); + mailInfo.setToAddress(toEmailAddress); + mailInfo.setSubject("subject"); + mailInfo.setContent("mailContent"); + + MailUtils sms = new MailUtils(); + sms.sendHtmlMail(mailInfo);// 发送html格式 + } + + public static boolean sendHtmlMail(MailSenderInfo mailInfo) { + // 判断是否需要身份认证 + MyAuthenticator authenticator = null; + Properties pro = mailInfo.getProperties(); + // 如果需要身份认证,则创建一个密码验证器 + if (mailInfo.isValidate()) { + authenticator = new MyAuthenticator(mailInfo.getUserName(), + mailInfo.getPassword()); + } + // 根据邮件会话属性和密码验证器构造一个发送邮件的session + Session sendMailSession = Session + .getDefaultInstance(pro, authenticator); + try { + // 根据session创建一个邮件消息 + Message mailMessage = new MimeMessage(sendMailSession); + // 创建邮件发送者地址 + Address from = new InternetAddress(mailInfo.getFromAddress()); + // 设置邮件消息的发送者 + mailMessage.setFrom(from); + // 创建邮件的接收者地址,并设置到邮件消息中 + Address to = new InternetAddress(mailInfo.getToAddress()); + // Message.RecipientType.TO属性表示接收者的类型为TO + mailMessage.setRecipient(Message.RecipientType.TO, to); + // 设置邮件消息的主题 + mailMessage.setSubject(mailInfo.getSubject()); + // 设置邮件消息发送的时间 + mailMessage.setSentDate(new Date()); + // MiniMultipart类是一个容器类,包含MimeBodyPart类型的对象 + Multipart mainPart = new MimeMultipart(); + // 创建一个包含HTML内容的MimeBodyPart + BodyPart html = new MimeBodyPart(); + // 设置HTML内容 + html.setContent(mailInfo.getContent(), "text/html; charset=utf-8"); + mainPart.addBodyPart(html); + // 将MiniMultipart对象设置为邮件内容 + mailMessage.setContent(mainPart); + // 发送邮件 + Transport.send(mailMessage); + return true; + } catch (MessagingException ex) { + ex.printStackTrace(); + } + return false; + } + + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/MyAuthenticator.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/MyAuthenticator.java new file mode 100644 index 0000000..7854f29 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/MyAuthenticator.java @@ -0,0 +1,25 @@ +package com.adc.da.sys.util; + +import javax.mail.Authenticator; +import javax.mail.PasswordAuthentication; + +/** + * @Author sima + * @Date 2022/6/30 16:55 + */ +public class MyAuthenticator extends Authenticator { + String userName = null; + String password = null; + + public MyAuthenticator() { + } + + public MyAuthenticator(String username, String password) { + this.userName = username; + this.password = password; + } + + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(userName, password); + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/RSAUtil.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/RSAUtil.java new file mode 100644 index 0000000..8336630 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/RSAUtil.java @@ -0,0 +1,208 @@ +package com.adc.da.sys.util; + + +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Cipher; +import java.io.ByteArrayOutputStream; +import java.security.Key; +import java.security.KeyFactory; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + *

    + * RSA公钥/私钥/签名工具包 + *

    + */ +public class RSAUtil { + + public static final String PrivateKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMrC+KYc0YSLJX" + + "kvveWUB5O/w7/dz0otkuM0OnM1U6/OjCTUwnJJ1KHoGJk8VcYsnj1Gun/RTUvrxkK8LZm/TthhOuv" + + "sF3yjyUoH0eVSpwmj+x4gessIuXZ4+4uf41i0gzjHFtu8A53LkSn9BsrhpbPwbu+zHyly2KMuSxgo0" + + "FDJAgMBAAECgYAySZTdrfwQwWnz2nFghQw0CrWD2oFUxmTN0OBGPo2Y5sM/Rz1KlyETXrrrFlm3os1E" + + "KUyL8t8W20z6tC0jGp10/2FVXUaBgXX/nBC+KNu6UjYT1PeQDg4bqS6xs4HSGCxOfyyWhnJ9szgLF4GX" + + "9fR3UFIFeECbnmsVoZQg97QBAQJBAPwTLaxiJLbfiXRDNbTqNV1O3tp+1iXW4pFES/vnleY9uE4a/zejJa" + + "51HleOdvMoGimLT4i7RUm7eZqN4bPUe5ECQQDN6zhVQaHDBqb/WDgUhpFW87hHmakiizufOpbkaIlZluMb" + + "aXRUm18rmoNKTGTSm0DvSFWRxZMYWEl54aZIzjW5AkA/5BCIh9usal4plLtxHofmHY6IrOtUbfHBRiFIO" + + "PuafvxO97LGhFiRrmfBY3+sw/ZVn1TKYEUAmj8JOHsDnJCxAkBP6tl7JTS9tyg686cYOD3SDFbZ2wYsdPM" + + "X0ipbzUJ5NblAm0XdzEs8ZgRMYqfCoSSreVxUbeSvzxv9JJlfqkBpAkEA8kGuzB4sNjv88obNXcYgjOQr" + + "zrM6mTkzyq3flipzFTQFkPLaT1JGg2qegRqezatRH8dwt84UDNXF+w3uQjl16w=="; + + + /** + * 加密算法RSA + */ + public static final String KEY_ALGORITHM = "RSA"; + + /** + * RSA最大加密明文大小 + */ + private static final int MAX_ENCRYPT_BLOCK = 117; + + /** + * RSA最大解密密文大小 + */ + private static final int MAX_DECRYPT_BLOCK = 128; + + + + /** + *

    + * 私钥解密 + *

    + * + * @param encryptedData 已加密数据 + * @param privateKey 私钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) + throws Exception { + byte[] keyBytes = Base64.decodeBase64(privateKey); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, privateK); + int inputLen = encryptedData.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段解密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_DECRYPT_BLOCK) { + cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); + } else { + cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_DECRYPT_BLOCK; + } + byte[] decryptedData = out.toByteArray(); + out.close(); + return decryptedData; + } + + /** + *

    + * 公钥解密 + *

    + * + * @param encryptedData 已加密数据 + * @param publicKey 公钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) + throws Exception { + byte[] keyBytes = Base64.decodeBase64(publicKey); + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicK = keyFactory.generatePublic(x509KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, publicK); + int inputLen = encryptedData.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段解密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_DECRYPT_BLOCK) { + cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); + } else { + cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_DECRYPT_BLOCK; + } + byte[] decryptedData = out.toByteArray(); + out.close(); + return decryptedData; + } + + /** + *

    + * 公钥加密 + *

    + * + * @param data 源数据 + * @param publicKey 公钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String publicKey) + throws Exception { + byte[] keyBytes = Base64.decodeBase64(publicKey); + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicK = keyFactory.generatePublic(x509KeySpec); + // 对数据加密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, publicK); + int inputLen = data.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段加密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { + cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); + } else { + cache = cipher.doFinal(data, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_ENCRYPT_BLOCK; + } + byte[] encryptedData = out.toByteArray(); + out.close(); + return encryptedData; + } + + /** + *

    + * 私钥加密 + *

    + * + * @param data 源数据 + * @param privateKey 私钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] encryptByPrivateKey(byte[] data, String privateKey) + throws Exception { + byte[] keyBytes = Base64.decodeBase64(privateKey); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, privateK); + int inputLen = data.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段加密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { + cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); + } else { + cache = cipher.doFinal(data, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_ENCRYPT_BLOCK; + } + byte[] encryptedData = out.toByteArray(); + out.close(); + return encryptedData; + } + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/ReValidUtil.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/ReValidUtil.java new file mode 100644 index 0000000..50b302c --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/ReValidUtil.java @@ -0,0 +1,67 @@ +package com.adc.da.sys.util; + +import cn.hutool.core.util.ReUtil; + +import java.text.ParseException; +import java.text.SimpleDateFormat; + +/** + * @Author doudxw + * @Date 2021/10/12 14:10 + */ +public class ReValidUtil { + + //验证是否是手机号或固定电话 + public static boolean validPhone(String content){ + if(ReUtil.isMatch("\\d{3}-\\d{8}|\\d{4}-\\d{7}",content)){ + return true; + } + + if(ReUtil.isMatch("^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}$",content)){ + return true; + } + return false; + } + + //验证身份证号 + public static boolean validIdCard(String content){ + return ReUtil.isMatch("^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",content); + } + + //验证营业执照 + public static boolean validBussinessCard(String content){ + return ReUtil.isMatch("^[A-Z]\\d{17}$",content); + } + + //验证发动机(字母+数字的组合) + public static boolean validMotor(String content){ + if(ReUtil.isMatch("^[0-9]*$",content)){ + return false; + } + if(ReUtil.isMatch("^[A-Za-z]+$",content)){ + return false; + } + + if(ReUtil.isMatch("^[A-Za-z0-9]+$",content)){ + return true; + } + return false; + } + + //验证日期 + public static boolean validDate(String content){ + SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); + try { + format.parse(content); + return true; + } catch (ParseException e) { + return false; + } + } + //验证质量 + public static boolean validQuality(String content){ + return ReUtil.isMatch("^(\\+)?\\d+(\\.\\d+)?$",content); + } + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/util/SendEmailMessage.java b/adc-da-sys/src/main/java/com/adc/da/sys/util/SendEmailMessage.java new file mode 100644 index 0000000..23c9167 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/util/SendEmailMessage.java @@ -0,0 +1,95 @@ +package com.adc.da.sys.util; + +/** + * @Author sima + * @Date 2022/7/11 10:27 + */ +public class SendEmailMessage { + + + private String type; // 格式类型,如 text/html;charset=gbk + private String from; // 发送人 + private String subject; // 标题 + private String text; // 文本内容 + private String content; // html内容 + private String recipient; // 接收人,多个接收人用逗号分隔 + private String copyRecipient; //抄送人 + private String datetime; // 发送时间 + + + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public String getSubject() { + return subject; + } + + + public void setSubject(String subject) { + this.subject = subject; + } + + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public String getRecipient() { + return recipient; + } + + + public void setRecipient(String recipient) { + this.recipient = recipient; + } + + + public String getDatetime() { + return datetime; + } + + + public void setDatetime(String datetime) { + this.datetime = datetime; + } + + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCopyRecipient() { + return copyRecipient; + } + + public void setCopyRecipient(String copyRecipient) { + this.copyRecipient = copyRecipient; + } +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/LabelReturnVo.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/LabelReturnVo.java new file mode 100644 index 0000000..364adf1 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/LabelReturnVo.java @@ -0,0 +1,20 @@ +package com.adc.da.sys.vo; + +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author doudxw + * @Date 2021/11/9 14:55 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class LabelReturnVo { + + private String name; + + private String value; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/MenuVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/MenuVO.java new file mode 100644 index 0000000..91664a4 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/MenuVO.java @@ -0,0 +1,164 @@ +package com.adc.da.sys.vo; + +/** + * 菜单对应VO + * + * @author comments created by Lee Kwanho + * date 2018-08-17 + * @see com.adc.da.sys.controller.MenuEOController + */ +public class MenuVO extends TreeVO { + + /** + * 菜单对应网页 + */ + private String href; + + /** + * 图标 + */ + private String icon; + + + private String iconHref; + + + private String iconClick; + + + + private String iconClickHref; + /** + * 序列 + */ + private String sort; + + /** + * 权限 + */ + private String permission; + + /** + * 描述,标记 + */ + private String remarks; + + /** + * 属于 + */ + private Integer belong; + + /** + * 展示 + */ + private Integer isShow; + + /** + * 扩展字段 + */ + + private String extInfo; + + /** + * + * @return + */ + private String isUrl; + + public String getIsUrl() { + return isUrl; + } + + public void setIsUrl(String isUrl) { + this.isUrl = isUrl; + } + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getPermission() { + return permission; + } + + public void setPermission(String permission) { + this.permission = permission; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getBelong() { + return belong; + } + + public void setBelong(Integer belong) { + this.belong = belong; + } + + public Integer getIsShow() { + return isShow; + } + + public void setIsShow(Integer isShow) { + this.isShow = isShow; + } + + public String getExtInfo() { + return extInfo; + } + + public void setExtInfo(String extInfo) { + this.extInfo = extInfo; + } + + + public String getIconHref() { + return iconHref; + } + + public void setIconHref(String iconHref) { + this.iconHref = iconHref; + } + + public String getIconClick() { + return iconClick; + } + + public void setIconClick(String iconClick) { + this.iconClick = iconClick; + } + + public String getIconClickHref() { + return iconClickHref; + } + + public void setIconClickHref(String iconClickHref) { + this.iconClickHref = iconClickHref; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ModuleVo.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ModuleVo.java new file mode 100644 index 0000000..a60233b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ModuleVo.java @@ -0,0 +1,23 @@ +package com.adc.da.sys.vo; + +public class ModuleVo{ + private String id; + + private String moduleName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } +} \ No newline at end of file diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/RoleVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/RoleVO.java new file mode 100644 index 0000000..44854de --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/RoleVO.java @@ -0,0 +1,65 @@ +package com.adc.da.sys.vo; + +import java.util.ArrayList; +import java.util.List; + +import com.adc.da.sys.entity.MenuEO; +import lombok.Data; + +/** + * 角色对应VO + * + * @author comments created by Lee Kwanho + * date 2018-08-17 + * @see com.adc.da.sys.controller.RoleEOController + */ +@Data +public class RoleVO { + /** + * 角色id + */ + private String rid; + + /** + * 角色名称 + */ + private String rname; + + /** + * 角色描述 + */ + private String rdesc; + + /** + * 删除标记 + */ + private int enabled; + + /** + * 用户数 + */ + private int usercount; + + /** + * 属于与否 + */ + private int belong; + + // 扩展字段 + private String extInfo; + + private String extInfo2; + + private String extInfo3; + + private String extInfo4; + + private String extInfo5; + + private List menus = new ArrayList<>(); + + private List menusstr = new ArrayList<>(); + + private List orgsstr = new ArrayList<>(); + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/TreeVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/TreeVO.java new file mode 100644 index 0000000..97b0e76 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/TreeVO.java @@ -0,0 +1,104 @@ +package com.adc.da.sys.vo; + +import java.util.List; + +/** + * 抽象类VO + * 用于菜单和组织 + * + * @param + * @author comments created by Lee Kwanho + * date 2018-08-16 + * @see OrgVO + * @see MenuVO + */ +public abstract class TreeVO { + + /** + * id字段 + */ + protected String id; + + /** + * 名称字段 + */ + protected String name; + + /** + * 所有父级编号 + */ + protected String parentId; + + /** + * 所有父级编号 + */ + protected String parentIds; + + /** + * 父级编号 + */ + protected T parent; + + protected List childList; + + /** + * 删除标识 + */ + protected Integer delFlag; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentIds() { + return parentIds; + } + + public void setParentIds(String parentIds) { + this.parentIds = parentIds; + } + + public T getParent() { + return parent; + } + + public void setParent(T parent) { + this.parent = parent; + } + + public List getChildList() { + return childList; + } + + public void setChildList(List childList) { + this.childList = childList; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserImportVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserImportVO.java new file mode 100644 index 0000000..bf062e2 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserImportVO.java @@ -0,0 +1,73 @@ +package com.adc.da.sys.vo; + +import com.adc.da.excel.annotation.Excel; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class UserImportVO { + + /** + * 用户id + */ + + private String usid; + + + /** + * 删除标记 + */ + private Integer delFlag; + + /** + * 用户名 + */ + @Excel(name = "用户名", width = 20) + private String account; + + + /** + * 手机号码 + */ + @Excel(name = "手机号", width = 20) + private String cellPhoneNumber; + + /** + * 电子邮件 + */ + @Excel(name = "邮箱", width = 20) + private String email; + + /** + * 创建时间 + */ + + private String createTime; + /** + * 更新时间 + */ + + private String updateTime; + + + @Excel(name = "是否启用(0禁用、1启用)", width = 20) + private String isUse; + + + @Excel(name = "部门", width = 20) + private String department; + + + @Excel(name = "姓名", width = 20) + private String usname; + + @Excel(name = "角色", width = 20) + private String roleName; + + private String roleId; + + @Excel(name = "操作(add添加、full覆盖角色)", width = 20) + private String operation; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserRoleVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserRoleVO.java new file mode 100644 index 0000000..104c4ff --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserRoleVO.java @@ -0,0 +1,53 @@ +package com.adc.da.sys.vo; + +import com.adc.da.base.entity.BaseEntity; +import lombok.Data; + +/** + * 功能:TR_USER_ROLE UserRoleEOEntity
    + * 作者:code generator
    + * 日期: 2017-11-07
    + * 版权所有:版权归天津卡达克数据技术中心所有。
    + *

    字段列表:

    + *
  • userId -> user_id
  • + *
  • roleId -> role_id
  • + * @author comments created by Lee Kwanho + * date 2018-08-16 + */ +@Data +public class UserRoleVO extends BaseEntity { + + /** + * 用户id + */ + private String userId; + + /** + * 角色id + */ + private String roleId; + + /** + * 用户名 + */ + private String account; + + + /** + * 手机号码 + */ + private String cellPhoneNumber; + + /** + * 电子邮件 + */ + private String email; + + + + private String department; + + + private String usname; + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserVO.java new file mode 100644 index 0000000..0f201d3 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/UserVO.java @@ -0,0 +1,57 @@ +package com.adc.da.sys.vo; + +import java.util.ArrayList; +import java.util.List; + +import com.adc.da.sys.entity.RoleEO; +import lombok.Data; + + +@Data +public class UserVO { + + /** + * 用户id + */ + private String usid; + + /** + * 密码 + */ + + private String password; + + + /** + * 用户名 + */ + private String account; + + + /** + * 手机号码 + */ + private String cellPhoneNumber; + + /** + * 电子邮件 + */ + private String email; + + + + + private String department; + + + private String usname; + + + /** + * 角色ID列表 + */ + private List roleIdList = new ArrayList<>(); + + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuListVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuListVO.java new file mode 100644 index 0000000..129976b --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuListVO.java @@ -0,0 +1,15 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +@Data +public class DdmMenuListVO { + //菜单id + private String modelId; + //菜单名称 + private String modelName; + //菜单父Id + private String parentModelCode; + //菜单父名称 + private String parentModelName; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuVO.java new file mode 100644 index 0000000..d8b8c98 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmMenuVO.java @@ -0,0 +1,13 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +@Data +public class DdmMenuVO { + //菜单id + private String modelId; + //菜单父Id + private String parentModelId; + //菜单名称 + private String modelName; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.java new file mode 100644 index 0000000..4b66bf5 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.java @@ -0,0 +1,38 @@ +package com.adc.da.sys.vo.ddm; + +import com.adc.da.sys.entity.RoleEO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + roles jsonArray   查询结果集 + roles. roleId String  必填 角色Id + roles. roleCode String  必填 角色编码 + roles.roleName String  必填 角色名称 + roles.parentRoleId String  可选 父角色Id + roles.parentRoleCode String 可选 父角色编码 + roles.parentRoleName String  可选 父角色名称 + roles. roleDesc String  可选 角色描述 + */ +@Data +public class DdmRoleCreateVO { + + @NotBlank(message = "角色编码不能为空") + private String roleCode; + @NotBlank(message = "角色名称不能为空") + private String roleName; + + private String parentRoleId; + + private String parentRoleCode; + + private String parentRoleName; + + /** + * 角色描述 + */ + private String roleDesc; + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.java new file mode 100644 index 0000000..be49329 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.java @@ -0,0 +1,12 @@ +package com.adc.da.sys.vo.ddm; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.List; + +@Data +public class DdmRoleMenuCreate { + @JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + List roleModels; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.java new file mode 100644 index 0000000..00e22e6 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.java @@ -0,0 +1,18 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class DdmRoleMenuCreateVO { + //菜单id + @NotBlank(message = "菜单id不能为空") + private String modelId; + //菜单父Id + @NotBlank(message = "菜单父id不能为空") + private String parentModelId; + //角色id + @NotBlank(message = "角色id不能为空") + private String roleId; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.java new file mode 100644 index 0000000..21b4b08 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.java @@ -0,0 +1,12 @@ +package com.adc.da.sys.vo.ddm; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.List; + +@Data +public class DdmRoleMenuDelete { + @JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + List roleModels; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.java new file mode 100644 index 0000000..417d6d4 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.java @@ -0,0 +1,10 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +@Data +public class DdmRoleUserQuery { + private String roleId; + private Integer pageNum; + private Integer pageSize; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleVO.java new file mode 100644 index 0000000..5f60ee2 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmRoleVO.java @@ -0,0 +1,53 @@ +package com.adc.da.sys.vo.ddm; + +import com.adc.da.sys.entity.MenuEO; +import com.adc.da.sys.entity.RoleEO; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + roles jsonArray   查询结果集 + roles. roleId String  必填 角色Id + roles. roleCode String  必填 角色编码 + roles.roleName String  必填 角色名称 + roles.parentRoleId String  可选 父角色Id + roles.parentRoleCode String 可选 父角色编码 + roles.parentRoleName String  可选 父角色名称 + roles. roleDesc String  可选 角色描述 + */ +@Data +public class DdmRoleVO { + + private String roleId; + + private String roleCode; + + private String roleName; + + private String parentRoleId; + + private String parentRoleCode; + + private String parentRoleName; + + /** + * 角色描述 + */ + private String roleDesc; + + public DdmRoleVO(){ + + } + + public DdmRoleVO(RoleEO roleEO) { + this.roleId = roleEO.getId(); + this.roleCode = roleEO.getId(); + this.roleName = roleEO.getName(); + this.parentRoleId = ""; + this.parentRoleCode = ""; + this.parentRoleName = ""; + this.roleDesc = roleEO.getRemarks(); + } +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserQueryVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserQueryVO.java new file mode 100644 index 0000000..978837e --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserQueryVO.java @@ -0,0 +1,14 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +@Data +public class DdmUserQueryVO { + + private String userAccount; + private String userName; + private Integer pageNum; + private Integer pageSize; + + +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.java new file mode 100644 index 0000000..e0d0264 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.java @@ -0,0 +1,12 @@ +package com.adc.da.sys.vo.ddm; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.List; + +@Data +public class DdmUserRoleAdd { + @JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + List userRoles; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleVO.java new file mode 100644 index 0000000..2df4bfa --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRoleVO.java @@ -0,0 +1,11 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +@Data +public class DdmUserRoleVO { + + private String userId; + + private String roleId; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.java new file mode 100644 index 0000000..0867853 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.java @@ -0,0 +1,12 @@ +package com.adc.da.sys.vo.ddm; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.List; + +@Data +public class DdmUserRolesDeleteVO { + @JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + List userRoles; +} diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserVO.java b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserVO.java new file mode 100644 index 0000000..db8cb40 --- /dev/null +++ b/adc-da-sys/src/main/java/com/adc/da/sys/vo/ddm/DdmUserVO.java @@ -0,0 +1,18 @@ +package com.adc.da.sys.vo.ddm; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + + +@Data +public class DdmUserVO { + + private String userId; + + private String userName; + + private String userAccount; + +} diff --git a/adc-da-sys/src/main/resources/city.json b/adc-da-sys/src/main/resources/city.json new file mode 100644 index 0000000..7c4f5b0 --- /dev/null +++ b/adc-da-sys/src/main/resources/city.json @@ -0,0 +1,1712 @@ +[ + { + "code":"1101", + "name":"市辖区", + "provinceCode":"11" + }, + { + "code":"1201", + "name":"市辖区", + "provinceCode":"12" + }, + { + "code":"1301", + "name":"石家庄市", + "provinceCode":"13" + }, + { + "code":"1302", + "name":"唐山市", + "provinceCode":"13" + }, + { + "code":"1303", + "name":"秦皇岛市", + "provinceCode":"13" + }, + { + "code":"1304", + "name":"邯郸市", + "provinceCode":"13" + }, + { + "code":"1305", + "name":"邢台市", + "provinceCode":"13" + }, + { + "code":"1306", + "name":"保定市", + "provinceCode":"13" + }, + { + "code":"1307", + "name":"张家口市", + "provinceCode":"13" + }, + { + "code":"1308", + "name":"承德市", + "provinceCode":"13" + }, + { + "code":"1309", + "name":"沧州市", + "provinceCode":"13" + }, + { + "code":"1310", + "name":"廊坊市", + "provinceCode":"13" + }, + { + "code":"1311", + "name":"衡水市", + "provinceCode":"13" + }, + { + "code":"1401", + "name":"太原市", + "provinceCode":"14" + }, + { + "code":"1402", + "name":"大同市", + "provinceCode":"14" + }, + { + "code":"1403", + "name":"阳泉市", + "provinceCode":"14" + }, + { + "code":"1404", + "name":"长治市", + "provinceCode":"14" + }, + { + "code":"1405", + "name":"晋城市", + "provinceCode":"14" + }, + { + "code":"1406", + "name":"朔州市", + "provinceCode":"14" + }, + { + "code":"1407", + "name":"晋中市", + "provinceCode":"14" + }, + { + "code":"1408", + "name":"运城市", + "provinceCode":"14" + }, + { + "code":"1409", + "name":"忻州市", + "provinceCode":"14" + }, + { + "code":"1410", + "name":"临汾市", + "provinceCode":"14" + }, + { + "code":"1411", + "name":"吕梁市", + "provinceCode":"14" + }, + { + "code":"1501", + "name":"呼和浩特市", + "provinceCode":"15" + }, + { + "code":"1502", + "name":"包头市", + "provinceCode":"15" + }, + { + "code":"1503", + "name":"乌海市", + "provinceCode":"15" + }, + { + "code":"1504", + "name":"赤峰市", + "provinceCode":"15" + }, + { + "code":"1505", + "name":"通辽市", + "provinceCode":"15" + }, + { + "code":"1506", + "name":"鄂尔多斯市", + "provinceCode":"15" + }, + { + "code":"1507", + "name":"呼伦贝尔市", + "provinceCode":"15" + }, + { + "code":"1508", + "name":"巴彦淖尔市", + "provinceCode":"15" + }, + { + "code":"1509", + "name":"乌兰察布市", + "provinceCode":"15" + }, + { + "code":"1522", + "name":"兴安盟", + "provinceCode":"15" + }, + { + "code":"1525", + "name":"锡林郭勒盟", + "provinceCode":"15" + }, + { + "code":"1529", + "name":"阿拉善盟", + "provinceCode":"15" + }, + { + "code":"2101", + "name":"沈阳市", + "provinceCode":"21" + }, + { + "code":"2102", + "name":"大连市", + "provinceCode":"21" + }, + { + "code":"2103", + "name":"鞍山市", + "provinceCode":"21" + }, + { + "code":"2104", + "name":"抚顺市", + "provinceCode":"21" + }, + { + "code":"2105", + "name":"本溪市", + "provinceCode":"21" + }, + { + "code":"2106", + "name":"丹东市", + "provinceCode":"21" + }, + { + "code":"2107", + "name":"锦州市", + "provinceCode":"21" + }, + { + "code":"2108", + "name":"营口市", + "provinceCode":"21" + }, + { + "code":"2109", + "name":"阜新市", + "provinceCode":"21" + }, + { + "code":"2110", + "name":"辽阳市", + "provinceCode":"21" + }, + { + "code":"2111", + "name":"盘锦市", + "provinceCode":"21" + }, + { + "code":"2112", + "name":"铁岭市", + "provinceCode":"21" + }, + { + "code":"2113", + "name":"朝阳市", + "provinceCode":"21" + }, + { + "code":"2114", + "name":"葫芦岛市", + "provinceCode":"21" + }, + { + "code":"2201", + "name":"长春市", + "provinceCode":"22" + }, + { + "code":"2202", + "name":"吉林市", + "provinceCode":"22" + }, + { + "code":"2203", + "name":"四平市", + "provinceCode":"22" + }, + { + "code":"2204", + "name":"辽源市", + "provinceCode":"22" + }, + { + "code":"2205", + "name":"通化市", + "provinceCode":"22" + }, + { + "code":"2206", + "name":"白山市", + "provinceCode":"22" + }, + { + "code":"2207", + "name":"松原市", + "provinceCode":"22" + }, + { + "code":"2208", + "name":"白城市", + "provinceCode":"22" + }, + { + "code":"2224", + "name":"延边朝鲜族自治州", + "provinceCode":"22" + }, + { + "code":"2301", + "name":"哈尔滨市", + "provinceCode":"23" + }, + { + "code":"2302", + "name":"齐齐哈尔市", + "provinceCode":"23" + }, + { + "code":"2303", + "name":"鸡西市", + "provinceCode":"23" + }, + { + "code":"2304", + "name":"鹤岗市", + "provinceCode":"23" + }, + { + "code":"2305", + "name":"双鸭山市", + "provinceCode":"23" + }, + { + "code":"2306", + "name":"大庆市", + "provinceCode":"23" + }, + { + "code":"2307", + "name":"伊春市", + "provinceCode":"23" + }, + { + "code":"2308", + "name":"佳木斯市", + "provinceCode":"23" + }, + { + "code":"2309", + "name":"七台河市", + "provinceCode":"23" + }, + { + "code":"2310", + "name":"牡丹江市", + "provinceCode":"23" + }, + { + "code":"2311", + "name":"黑河市", + "provinceCode":"23" + }, + { + "code":"2312", + "name":"绥化市", + "provinceCode":"23" + }, + { + "code":"2327", + "name":"大兴安岭地区", + "provinceCode":"23" + }, + { + "code":"3101", + "name":"市辖区", + "provinceCode":"31" + }, + { + "code":"3201", + "name":"南京市", + "provinceCode":"32" + }, + { + "code":"3202", + "name":"无锡市", + "provinceCode":"32" + }, + { + "code":"3203", + "name":"徐州市", + "provinceCode":"32" + }, + { + "code":"3204", + "name":"常州市", + "provinceCode":"32" + }, + { + "code":"3205", + "name":"苏州市", + "provinceCode":"32" + }, + { + "code":"3206", + "name":"南通市", + "provinceCode":"32" + }, + { + "code":"3207", + "name":"连云港市", + "provinceCode":"32" + }, + { + "code":"3208", + "name":"淮安市", + "provinceCode":"32" + }, + { + "code":"3209", + "name":"盐城市", + "provinceCode":"32" + }, + { + "code":"3210", + "name":"扬州市", + "provinceCode":"32" + }, + { + "code":"3211", + "name":"镇江市", + "provinceCode":"32" + }, + { + "code":"3212", + "name":"泰州市", + "provinceCode":"32" + }, + { + "code":"3213", + "name":"宿迁市", + "provinceCode":"32" + }, + { + "code":"3301", + "name":"杭州市", + "provinceCode":"33" + }, + { + "code":"3302", + "name":"宁波市", + "provinceCode":"33" + }, + { + "code":"3303", + "name":"温州市", + "provinceCode":"33" + }, + { + "code":"3304", + "name":"嘉兴市", + "provinceCode":"33" + }, + { + "code":"3305", + "name":"湖州市", + "provinceCode":"33" + }, + { + "code":"3306", + "name":"绍兴市", + "provinceCode":"33" + }, + { + "code":"3307", + "name":"金华市", + "provinceCode":"33" + }, + { + "code":"3308", + "name":"衢州市", + "provinceCode":"33" + }, + { + "code":"3309", + "name":"舟山市", + "provinceCode":"33" + }, + { + "code":"3310", + "name":"台州市", + "provinceCode":"33" + }, + { + "code":"3311", + "name":"丽水市", + "provinceCode":"33" + }, + { + "code":"3401", + "name":"合肥市", + "provinceCode":"34" + }, + { + "code":"3402", + "name":"芜湖市", + "provinceCode":"34" + }, + { + "code":"3403", + "name":"蚌埠市", + "provinceCode":"34" + }, + { + "code":"3404", + "name":"淮南市", + "provinceCode":"34" + }, + { + "code":"3405", + "name":"马鞍山市", + "provinceCode":"34" + }, + { + "code":"3406", + "name":"淮北市", + "provinceCode":"34" + }, + { + "code":"3407", + "name":"铜陵市", + "provinceCode":"34" + }, + { + "code":"3408", + "name":"安庆市", + "provinceCode":"34" + }, + { + "code":"3410", + "name":"黄山市", + "provinceCode":"34" + }, + { + "code":"3411", + "name":"滁州市", + "provinceCode":"34" + }, + { + "code":"3412", + "name":"阜阳市", + "provinceCode":"34" + }, + { + "code":"3413", + "name":"宿州市", + "provinceCode":"34" + }, + { + "code":"3415", + "name":"六安市", + "provinceCode":"34" + }, + { + "code":"3416", + "name":"亳州市", + "provinceCode":"34" + }, + { + "code":"3417", + "name":"池州市", + "provinceCode":"34" + }, + { + "code":"3418", + "name":"宣城市", + "provinceCode":"34" + }, + { + "code":"3501", + "name":"福州市", + "provinceCode":"35" + }, + { + "code":"3502", + "name":"厦门市", + "provinceCode":"35" + }, + { + "code":"3503", + "name":"莆田市", + "provinceCode":"35" + }, + { + "code":"3504", + "name":"三明市", + "provinceCode":"35" + }, + { + "code":"3505", + "name":"泉州市", + "provinceCode":"35" + }, + { + "code":"3506", + "name":"漳州市", + "provinceCode":"35" + }, + { + "code":"3507", + "name":"南平市", + "provinceCode":"35" + }, + { + "code":"3508", + "name":"龙岩市", + "provinceCode":"35" + }, + { + "code":"3509", + "name":"宁德市", + "provinceCode":"35" + }, + { + "code":"3601", + "name":"南昌市", + "provinceCode":"36" + }, + { + "code":"3602", + "name":"景德镇市", + "provinceCode":"36" + }, + { + "code":"3603", + "name":"萍乡市", + "provinceCode":"36" + }, + { + "code":"3604", + "name":"九江市", + "provinceCode":"36" + }, + { + "code":"3605", + "name":"新余市", + "provinceCode":"36" + }, + { + "code":"3606", + "name":"鹰潭市", + "provinceCode":"36" + }, + { + "code":"3607", + "name":"赣州市", + "provinceCode":"36" + }, + { + "code":"3608", + "name":"吉安市", + "provinceCode":"36" + }, + { + "code":"3609", + "name":"宜春市", + "provinceCode":"36" + }, + { + "code":"3610", + "name":"抚州市", + "provinceCode":"36" + }, + { + "code":"3611", + "name":"上饶市", + "provinceCode":"36" + }, + { + "code":"3701", + "name":"济南市", + "provinceCode":"37" + }, + { + "code":"3702", + "name":"青岛市", + "provinceCode":"37" + }, + { + "code":"3703", + "name":"淄博市", + "provinceCode":"37" + }, + { + "code":"3704", + "name":"枣庄市", + "provinceCode":"37" + }, + { + "code":"3705", + "name":"东营市", + "provinceCode":"37" + }, + { + "code":"3706", + "name":"烟台市", + "provinceCode":"37" + }, + { + "code":"3707", + "name":"潍坊市", + "provinceCode":"37" + }, + { + "code":"3708", + "name":"济宁市", + "provinceCode":"37" + }, + { + "code":"3709", + "name":"泰安市", + "provinceCode":"37" + }, + { + "code":"3710", + "name":"威海市", + "provinceCode":"37" + }, + { + "code":"3711", + "name":"日照市", + "provinceCode":"37" + }, + { + "code":"3713", + "name":"临沂市", + "provinceCode":"37" + }, + { + "code":"3714", + "name":"德州市", + "provinceCode":"37" + }, + { + "code":"3715", + "name":"聊城市", + "provinceCode":"37" + }, + { + "code":"3716", + "name":"滨州市", + "provinceCode":"37" + }, + { + "code":"3717", + "name":"菏泽市", + "provinceCode":"37" + }, + { + "code":"4101", + "name":"郑州市", + "provinceCode":"41" + }, + { + "code":"4102", + "name":"开封市", + "provinceCode":"41" + }, + { + "code":"4103", + "name":"洛阳市", + "provinceCode":"41" + }, + { + "code":"4104", + "name":"平顶山市", + "provinceCode":"41" + }, + { + "code":"4105", + "name":"安阳市", + "provinceCode":"41" + }, + { + "code":"4106", + "name":"鹤壁市", + "provinceCode":"41" + }, + { + "code":"4107", + "name":"新乡市", + "provinceCode":"41" + }, + { + "code":"4108", + "name":"焦作市", + "provinceCode":"41" + }, + { + "code":"4109", + "name":"濮阳市", + "provinceCode":"41" + }, + { + "code":"4110", + "name":"许昌市", + "provinceCode":"41" + }, + { + "code":"4111", + "name":"漯河市", + "provinceCode":"41" + }, + { + "code":"4112", + "name":"三门峡市", + "provinceCode":"41" + }, + { + "code":"4113", + "name":"南阳市", + "provinceCode":"41" + }, + { + "code":"4114", + "name":"商丘市", + "provinceCode":"41" + }, + { + "code":"4115", + "name":"信阳市", + "provinceCode":"41" + }, + { + "code":"4116", + "name":"周口市", + "provinceCode":"41" + }, + { + "code":"4117", + "name":"驻马店市", + "provinceCode":"41" + }, + { + "code":"4190", + "name":"省直辖县级行政区划", + "provinceCode":"41" + }, + { + "code":"4201", + "name":"武汉市", + "provinceCode":"42" + }, + { + "code":"4202", + "name":"黄石市", + "provinceCode":"42" + }, + { + "code":"4203", + "name":"十堰市", + "provinceCode":"42" + }, + { + "code":"4205", + "name":"宜昌市", + "provinceCode":"42" + }, + { + "code":"4206", + "name":"襄阳市", + "provinceCode":"42" + }, + { + "code":"4207", + "name":"鄂州市", + "provinceCode":"42" + }, + { + "code":"4208", + "name":"荆门市", + "provinceCode":"42" + }, + { + "code":"4209", + "name":"孝感市", + "provinceCode":"42" + }, + { + "code":"4210", + "name":"荆州市", + "provinceCode":"42" + }, + { + "code":"4211", + "name":"黄冈市", + "provinceCode":"42" + }, + { + "code":"4212", + "name":"咸宁市", + "provinceCode":"42" + }, + { + "code":"4213", + "name":"随州市", + "provinceCode":"42" + }, + { + "code":"4228", + "name":"恩施土家族苗族自治州", + "provinceCode":"42" + }, + { + "code":"4290", + "name":"省直辖县级行政区划", + "provinceCode":"42" + }, + { + "code":"4301", + "name":"长沙市", + "provinceCode":"43" + }, + { + "code":"4302", + "name":"株洲市", + "provinceCode":"43" + }, + { + "code":"4303", + "name":"湘潭市", + "provinceCode":"43" + }, + { + "code":"4304", + "name":"衡阳市", + "provinceCode":"43" + }, + { + "code":"4305", + "name":"邵阳市", + "provinceCode":"43" + }, + { + "code":"4306", + "name":"岳阳市", + "provinceCode":"43" + }, + { + "code":"4307", + "name":"常德市", + "provinceCode":"43" + }, + { + "code":"4308", + "name":"张家界市", + "provinceCode":"43" + }, + { + "code":"4309", + "name":"益阳市", + "provinceCode":"43" + }, + { + "code":"4310", + "name":"郴州市", + "provinceCode":"43" + }, + { + "code":"4311", + "name":"永州市", + "provinceCode":"43" + }, + { + "code":"4312", + "name":"怀化市", + "provinceCode":"43" + }, + { + "code":"4313", + "name":"娄底市", + "provinceCode":"43" + }, + { + "code":"4331", + "name":"湘西土家族苗族自治州", + "provinceCode":"43" + }, + { + "code":"4401", + "name":"广州市", + "provinceCode":"44" + }, + { + "code":"4402", + "name":"韶关市", + "provinceCode":"44" + }, + { + "code":"4403", + "name":"深圳市", + "provinceCode":"44" + }, + { + "code":"4404", + "name":"珠海市", + "provinceCode":"44" + }, + { + "code":"4405", + "name":"汕头市", + "provinceCode":"44" + }, + { + "code":"4406", + "name":"佛山市", + "provinceCode":"44" + }, + { + "code":"4407", + "name":"江门市", + "provinceCode":"44" + }, + { + "code":"4408", + "name":"湛江市", + "provinceCode":"44" + }, + { + "code":"4409", + "name":"茂名市", + "provinceCode":"44" + }, + { + "code":"4412", + "name":"肇庆市", + "provinceCode":"44" + }, + { + "code":"4413", + "name":"惠州市", + "provinceCode":"44" + }, + { + "code":"4414", + "name":"梅州市", + "provinceCode":"44" + }, + { + "code":"4415", + "name":"汕尾市", + "provinceCode":"44" + }, + { + "code":"4416", + "name":"河源市", + "provinceCode":"44" + }, + { + "code":"4417", + "name":"阳江市", + "provinceCode":"44" + }, + { + "code":"4418", + "name":"清远市", + "provinceCode":"44" + }, + { + "code":"4419", + "name":"东莞市", + "provinceCode":"44" + }, + { + "code":"4420", + "name":"中山市", + "provinceCode":"44" + }, + { + "code":"4451", + "name":"潮州市", + "provinceCode":"44" + }, + { + "code":"4452", + "name":"揭阳市", + "provinceCode":"44" + }, + { + "code":"4453", + "name":"云浮市", + "provinceCode":"44" + }, + { + "code":"4501", + "name":"南宁市", + "provinceCode":"45" + }, + { + "code":"4502", + "name":"柳州市", + "provinceCode":"45" + }, + { + "code":"4503", + "name":"桂林市", + "provinceCode":"45" + }, + { + "code":"4504", + "name":"梧州市", + "provinceCode":"45" + }, + { + "code":"4505", + "name":"北海市", + "provinceCode":"45" + }, + { + "code":"4506", + "name":"防城港市", + "provinceCode":"45" + }, + { + "code":"4507", + "name":"钦州市", + "provinceCode":"45" + }, + { + "code":"4508", + "name":"贵港市", + "provinceCode":"45" + }, + { + "code":"4509", + "name":"玉林市", + "provinceCode":"45" + }, + { + "code":"4510", + "name":"百色市", + "provinceCode":"45" + }, + { + "code":"4511", + "name":"贺州市", + "provinceCode":"45" + }, + { + "code":"4512", + "name":"河池市", + "provinceCode":"45" + }, + { + "code":"4513", + "name":"来宾市", + "provinceCode":"45" + }, + { + "code":"4514", + "name":"崇左市", + "provinceCode":"45" + }, + { + "code":"4601", + "name":"海口市", + "provinceCode":"46" + }, + { + "code":"4602", + "name":"三亚市", + "provinceCode":"46" + }, + { + "code":"4603", + "name":"三沙市", + "provinceCode":"46" + }, + { + "code":"4604", + "name":"儋州市", + "provinceCode":"46" + }, + { + "code":"4690", + "name":"省直辖县级行政区划", + "provinceCode":"46" + }, + { + "code":"5001", + "name":"市辖区", + "provinceCode":"50" + }, + { + "code":"5002", + "name":"县", + "provinceCode":"50" + }, + { + "code":"5101", + "name":"成都市", + "provinceCode":"51" + }, + { + "code":"5103", + "name":"自贡市", + "provinceCode":"51" + }, + { + "code":"5104", + "name":"攀枝花市", + "provinceCode":"51" + }, + { + "code":"5105", + "name":"泸州市", + "provinceCode":"51" + }, + { + "code":"5106", + "name":"德阳市", + "provinceCode":"51" + }, + { + "code":"5107", + "name":"绵阳市", + "provinceCode":"51" + }, + { + "code":"5108", + "name":"广元市", + "provinceCode":"51" + }, + { + "code":"5109", + "name":"遂宁市", + "provinceCode":"51" + }, + { + "code":"5110", + "name":"内江市", + "provinceCode":"51" + }, + { + "code":"5111", + "name":"乐山市", + "provinceCode":"51" + }, + { + "code":"5113", + "name":"南充市", + "provinceCode":"51" + }, + { + "code":"5114", + "name":"眉山市", + "provinceCode":"51" + }, + { + "code":"5115", + "name":"宜宾市", + "provinceCode":"51" + }, + { + "code":"5116", + "name":"广安市", + "provinceCode":"51" + }, + { + "code":"5117", + "name":"达州市", + "provinceCode":"51" + }, + { + "code":"5118", + "name":"雅安市", + "provinceCode":"51" + }, + { + "code":"5119", + "name":"巴中市", + "provinceCode":"51" + }, + { + "code":"5120", + "name":"资阳市", + "provinceCode":"51" + }, + { + "code":"5132", + "name":"阿坝藏族羌族自治州", + "provinceCode":"51" + }, + { + "code":"5133", + "name":"甘孜藏族自治州", + "provinceCode":"51" + }, + { + "code":"5134", + "name":"凉山彝族自治州", + "provinceCode":"51" + }, + { + "code":"5201", + "name":"贵阳市", + "provinceCode":"52" + }, + { + "code":"5202", + "name":"六盘水市", + "provinceCode":"52" + }, + { + "code":"5203", + "name":"遵义市", + "provinceCode":"52" + }, + { + "code":"5204", + "name":"安顺市", + "provinceCode":"52" + }, + { + "code":"5205", + "name":"毕节市", + "provinceCode":"52" + }, + { + "code":"5206", + "name":"铜仁市", + "provinceCode":"52" + }, + { + "code":"5223", + "name":"黔西南布依族苗族自治州", + "provinceCode":"52" + }, + { + "code":"5226", + "name":"黔东南苗族侗族自治州", + "provinceCode":"52" + }, + { + "code":"5227", + "name":"黔南布依族苗族自治州", + "provinceCode":"52" + }, + { + "code":"5301", + "name":"昆明市", + "provinceCode":"53" + }, + { + "code":"5303", + "name":"曲靖市", + "provinceCode":"53" + }, + { + "code":"5304", + "name":"玉溪市", + "provinceCode":"53" + }, + { + "code":"5305", + "name":"保山市", + "provinceCode":"53" + }, + { + "code":"5306", + "name":"昭通市", + "provinceCode":"53" + }, + { + "code":"5307", + "name":"丽江市", + "provinceCode":"53" + }, + { + "code":"5308", + "name":"普洱市", + "provinceCode":"53" + }, + { + "code":"5309", + "name":"临沧市", + "provinceCode":"53" + }, + { + "code":"5323", + "name":"楚雄彝族自治州", + "provinceCode":"53" + }, + { + "code":"5325", + "name":"红河哈尼族彝族自治州", + "provinceCode":"53" + }, + { + "code":"5326", + "name":"文山壮族苗族自治州", + "provinceCode":"53" + }, + { + "code":"5328", + "name":"西双版纳傣族自治州", + "provinceCode":"53" + }, + { + "code":"5329", + "name":"大理白族自治州", + "provinceCode":"53" + }, + { + "code":"5331", + "name":"德宏傣族景颇族自治州", + "provinceCode":"53" + }, + { + "code":"5333", + "name":"怒江傈僳族自治州", + "provinceCode":"53" + }, + { + "code":"5334", + "name":"迪庆藏族自治州", + "provinceCode":"53" + }, + { + "code":"5401", + "name":"拉萨市", + "provinceCode":"54" + }, + { + "code":"5402", + "name":"日喀则市", + "provinceCode":"54" + }, + { + "code":"5403", + "name":"昌都市", + "provinceCode":"54" + }, + { + "code":"5404", + "name":"林芝市", + "provinceCode":"54" + }, + { + "code":"5405", + "name":"山南市", + "provinceCode":"54" + }, + { + "code":"5406", + "name":"那曲市", + "provinceCode":"54" + }, + { + "code":"5425", + "name":"阿里地区", + "provinceCode":"54" + }, + { + "code":"6101", + "name":"西安市", + "provinceCode":"61" + }, + { + "code":"6102", + "name":"铜川市", + "provinceCode":"61" + }, + { + "code":"6103", + "name":"宝鸡市", + "provinceCode":"61" + }, + { + "code":"6104", + "name":"咸阳市", + "provinceCode":"61" + }, + { + "code":"6105", + "name":"渭南市", + "provinceCode":"61" + }, + { + "code":"6106", + "name":"延安市", + "provinceCode":"61" + }, + { + "code":"6107", + "name":"汉中市", + "provinceCode":"61" + }, + { + "code":"6108", + "name":"榆林市", + "provinceCode":"61" + }, + { + "code":"6109", + "name":"安康市", + "provinceCode":"61" + }, + { + "code":"6110", + "name":"商洛市", + "provinceCode":"61" + }, + { + "code":"6201", + "name":"兰州市", + "provinceCode":"62" + }, + { + "code":"6202", + "name":"嘉峪关市", + "provinceCode":"62" + }, + { + "code":"6203", + "name":"金昌市", + "provinceCode":"62" + }, + { + "code":"6204", + "name":"白银市", + "provinceCode":"62" + }, + { + "code":"6205", + "name":"天水市", + "provinceCode":"62" + }, + { + "code":"6206", + "name":"武威市", + "provinceCode":"62" + }, + { + "code":"6207", + "name":"张掖市", + "provinceCode":"62" + }, + { + "code":"6208", + "name":"平凉市", + "provinceCode":"62" + }, + { + "code":"6209", + "name":"酒泉市", + "provinceCode":"62" + }, + { + "code":"6210", + "name":"庆阳市", + "provinceCode":"62" + }, + { + "code":"6211", + "name":"定西市", + "provinceCode":"62" + }, + { + "code":"6212", + "name":"陇南市", + "provinceCode":"62" + }, + { + "code":"6229", + "name":"临夏回族自治州", + "provinceCode":"62" + }, + { + "code":"6230", + "name":"甘南藏族自治州", + "provinceCode":"62" + }, + { + "code":"6301", + "name":"西宁市", + "provinceCode":"63" + }, + { + "code":"6302", + "name":"海东市", + "provinceCode":"63" + }, + { + "code":"6322", + "name":"海北藏族自治州", + "provinceCode":"63" + }, + { + "code":"6323", + "name":"黄南藏族自治州", + "provinceCode":"63" + }, + { + "code":"6325", + "name":"海南藏族自治州", + "provinceCode":"63" + }, + { + "code":"6326", + "name":"果洛藏族自治州", + "provinceCode":"63" + }, + { + "code":"6327", + "name":"玉树藏族自治州", + "provinceCode":"63" + }, + { + "code":"6328", + "name":"海西蒙古族藏族自治州", + "provinceCode":"63" + }, + { + "code":"6401", + "name":"银川市", + "provinceCode":"64" + }, + { + "code":"6402", + "name":"石嘴山市", + "provinceCode":"64" + }, + { + "code":"6403", + "name":"吴忠市", + "provinceCode":"64" + }, + { + "code":"6404", + "name":"固原市", + "provinceCode":"64" + }, + { + "code":"6405", + "name":"中卫市", + "provinceCode":"64" + }, + { + "code":"6501", + "name":"乌鲁木齐市", + "provinceCode":"65" + }, + { + "code":"6502", + "name":"克拉玛依市", + "provinceCode":"65" + }, + { + "code":"6504", + "name":"吐鲁番市", + "provinceCode":"65" + }, + { + "code":"6505", + "name":"哈密市", + "provinceCode":"65" + }, + { + "code":"6523", + "name":"昌吉回族自治州", + "provinceCode":"65" + }, + { + "code":"6527", + "name":"博尔塔拉蒙古自治州", + "provinceCode":"65" + }, + { + "code":"6528", + "name":"巴音郭楞蒙古自治州", + "provinceCode":"65" + }, + { + "code":"6529", + "name":"阿克苏地区", + "provinceCode":"65" + }, + { + "code":"6530", + "name":"克孜勒苏柯尔克孜自治州", + "provinceCode":"65" + }, + { + "code":"6531", + "name":"喀什地区", + "provinceCode":"65" + }, + { + "code":"6532", + "name":"和田地区", + "provinceCode":"65" + }, + { + "code":"6540", + "name":"伊犁哈萨克自治州", + "provinceCode":"65" + }, + { + "code":"6542", + "name":"塔城地区", + "provinceCode":"65" + }, + { + "code":"6543", + "name":"阿勒泰地区", + "provinceCode":"65" + }, + { + "code":"6590", + "name":"自治区直辖县级行政区划", + "provinceCode":"65" + } +] \ No newline at end of file diff --git a/adc-da-sys/src/main/resources/dozer/dozer-mappings-ddm.xml b/adc-da-sys/src/main/resources/dozer/dozer-mappings-ddm.xml new file mode 100644 index 0000000..02aee34 --- /dev/null +++ b/adc-da-sys/src/main/resources/dozer/dozer-mappings-ddm.xml @@ -0,0 +1,57 @@ + + + + + + + + + com.adc.da.sys.entity.RoleEO + com.adc.da.sys.vo.ddm.DdmRoleVO + + + + id + rid + + + name + roleName + + + name + roleCode + + + remarks + rdesc + + + delFlag + enabled + + + menuEOIdList + menusstr + + + menuEOList + menus + + + + + + com.adc.da.sys.entity.MenuEO + com.adc.da.sys.vo.MenuVO + + + + com.adc.da.log.entity.LogEO + com.adc.da.log.vo.LogVO + + + diff --git a/adc-da-sys/src/main/resources/dozer/dozer-mappings-sys.xml b/adc-da-sys/src/main/resources/dozer/dozer-mappings-sys.xml new file mode 100644 index 0000000..4fc45a8 --- /dev/null +++ b/adc-da-sys/src/main/resources/dozer/dozer-mappings-sys.xml @@ -0,0 +1,53 @@ + + + + + + + + + com.adc.da.sys.entity.RoleEO + com.adc.da.sys.vo.RoleVO + + + + id + rid + + + name + rname + + + remarks + rdesc + + + delFlag + enabled + + + menuEOIdList + menusstr + + + menuEOList + menus + + + + + + com.adc.da.sys.entity.MenuEO + com.adc.da.sys.vo.MenuVO + + + + com.adc.da.log.entity.LogEO + com.adc.da.log.vo.LogVO + + + \ No newline at end of file diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/log/mysql/LogEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/log/mysql/LogEOMapper.xml new file mode 100644 index 0000000..e8d31af --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/log/mysql/LogEOMapper.xml @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + distinct ip_address, browser, start_time, end_time, usid, operate_time, method, description, class_name, account + + + + + where 1=1 + + + and ip_address ${ipAddressOperator} #{ipAddress} + + + and browser ${browserOperator} #{browser} + + + and start_time >= to_date(#{startTime1},'yyyy-mm-dd hh24:mi:ss') + + + and start_time <= to_date(#{startTime2},'yyyy-mm-dd hh24:mi:ss')+1 + + + and usid ${usidOperator} #{usid} + + + and operate_time ${operateTimeOperator} #{operateTime} + + + and operate_time >= #{operateTime1} + + + and operate_time <= #{operateTime2} + + + and method ${methodOperator} #{method} + + + and description ${descriptionOperator} #{description} + + + and class_name ${classNameOperator} #{className} + + + and account ${accountOperator} '%${account}%' + + + and id ${idOperator} #{id} + + + + + + + + insert into TS_LOG() + values (#{ipAddress}, #{browser}, #{startTime}, #{endTime}, #{usid}, #{operateTime}, #{method}, #{description}, + #{className}, #{account}, + #{id}) + + + insert into ts_mi_log + (id + ,account + ,user_name + ,access_page + ,department + ,oparate_date) + values( + #{id} + ,#{account} + ,#{userName} + ,#{accessPage} + ,#{department} + ,#{operateDate}) + + + + + + + + merge into TS_LOG a + using ( + select + #{ipAddress} as ipAddress, + #{startTime} as startTime, + #{endTime} as endTime, + #{usid} as usid, + #{method} as method, + #{description} as description, + #{className} as className, + #{account} as account, + #{id} as id + from dual )b + on (a.ip_address = b.ipAddress + + and + (to_date(to_char(b.startTime,'yyyy-mm-dd hh24-mi-ss'), 'yyyy-mm-dd hh24-mi-ss')-to_date( to_char(a.START_TIME,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss') )*24*60*60 + <='2' + and a.usid = b.usid + and a.method = b.method + and a.description = b.description + and a.class_name = b.className + and a.account = b.account) + + when not matched then + insert (ip_address,start_time,end_time,usid,method,description,class_name,account,id) + values (b.ipAddress,b.startTime,b.endTime,b.usid,b.method,b.description,b.className,b.account,b.id) + + + + + update TS_LOG + set ip_address = #{ipAddress}, + browser = #{browser}, + start_time = #{startTime}, + end_time = #{endTime}, + usid = #{usid}, + operate_time = #{operateTime}, + method = #{method}, + description = #{description}, + class_name = #{className}, + account = #{account} + where id = #{id} + + + + + update TS_LOG + + + ip_address = #{ipAddress}, + + + browser = #{browser}, + + + start_time = #{startTime}, + + + end_time = #{endTime}, + + + usid = #{usid}, + + + operate_time = #{operateTime}, + + + method = #{method}, + + + description = #{description}, + + + class_name = #{className}, + + + account = #{account}, + + + where id = #{id} + + + + + + + + delete from TS_LOG + where id = #{value} + + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MailEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MailEOMapper.xml new file mode 100644 index 0000000..2fb2d74 --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MailEOMapper.xml @@ -0,0 +1,18 @@ + + + + + insert into ts_mail(id + ,to_mail + ,cc_mail + ,subject + ,content + ,send_date) + values (#{id},#{toMail},#{ccMail}, #{subject}, #{content}, #{sendDate}) + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MenuEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MenuEOMapper.xml new file mode 100644 index 0000000..46e2c20 --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/MenuEOMapper.xml @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id, del_flag, name, parent_id, parent_ids, href, icon,iconHref,iconClick,iconClickHref, is_show, permission, remarks, sort, ext_info,is_url + + + + + + TS_MENU.id, TS_MENU.del_flag, TS_MENU.name, TS_MENU.parent_id, TS_MENU.parent_ids, TS_MENU.href, TS_MENU.icon, TS_MENU.is_show, TS_MENU.permission, TS_MENU.remarks, TS_MENU.sort, TS_MENU.ext_info + + + + where 1=1 + + + and id ${idOperator} #{id} + + + and del_flag ${delFlagOperator} #{delFlag} + + + and name ${nameOperator} #{name} + + + and parent_id ${parentIdOperator} #{parentId} + + + and parent_ids ${parentIdsOperator} #{parentIds} + + + and href ${hrefOperator} #{href} + + + and icon ${iconOperator} #{icon} + + + and is_show ${isShowOperator} #{isShow} + + + and permission ${permissionOperator} #{permission} + + + and remarks ${remarksOperator} #{remarks} + + + and sort ${sortOperator} #{sort} + + + + + + + insert into TS_MENU() + values (#{id}, #{delFlag}, #{name}, #{parentId}, #{parentIds}, #{href}, #{icon}, + #{iconHref},#{iconClick},#{iconClickHref},#{isShow}, #{permission}, #{remarks}, #{sort}, #{extInfo}) + + + + + insert into TS_MENU + + ext_info, + sort, + remarks, + permission, + is_show, + icon, + iconHref, + iconClick, + iconClickHref, + href, + parent_ids, + parent_id, + name, + del_flag, + id, + is_url, + + + #{extInfo}, + #{sort}, + #{remarks}, + #{permission}, + #{isShow}, + #{icon}, + #{iconHref}, + #{iconClick}, + #{iconClickHref}, + #{href}, + #{parentIds}, + #{parentId}, + #{name}, + #{delFlag}, + #{id}, + #{isUrl}, + + + + + + + UPDATE TS_MENU + SET del_flag = #{delFlag}, + NAME = #{name}, + parent_id = #{parentId}, + parent_ids = #{parentIds}, + href = #{href}, + icon = #{icon}, + iconHref = #{iconHref}, + iconClick = #{iconClick}, + iconClickHref = #{iconClickHref}, + is_show = #{isShow}, + PERMISSION = #{permission}, + remarks = #{remarks}, + SORT = #{sort} + WHERE ID = #{id} + + + + + update TS_MENU + + + ext_info = #{extInfo}, + + + del_flag = #{delFlag}, + + + name = #{name}, + + + parent_id = #{parentId}, + + + parent_ids = #{parentIds}, + + + href = #{href}, + + + icon = #{icon}, + + + iconHref = #{iconHref}, + + + iconClick = #{iconClick}, + + + iconClickHref = #{iconClickHref}, + + + is_show = #{isShow}, + + + permission = #{permission}, + + + remarks = #{remarks}, + + + sort = #{sort}, + + + is_url = #{isUrl}, + + + where id = #{id} + + + + + UPDATE TS_MENU set DEL_FLAG = ${@com.adc.da.util.constant.DeleteFlagEnum@DELETE.getValue()} + WHERE id in + + #{id} + + + + + UPDATE TS_MENU set DEL_FLAG = '1' + WHERE PARENT_ID=#{pId} + + + + + + + + + + DELETE FROM TR_ROLE_MENU where MENU_ID in + + #{id} + + or MENU_ID in ( + select ID from TS_MENU where + + PARENT_IDS like "%"#{id}"%" + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleEOMapper.xml new file mode 100644 index 0000000..63d55c6 --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleEOMapper.xml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, data_scope, del_flag, is_default, name, remarks, ext_info, extInfo2, extInfo3, extInfo4, extInfo5 + + + + r.*, m.id as m_id, + m.del_flag as m_delFlag, + m.name as m_name, + m.parent_id as m_parentId, + m.parent_ids as m_parentIds, + m.href as m_href, + m.icon as m_icon, + m.is_show as m_isShow, + m.permission as m_permission, + m.remarks as m_remarks, + m.sort as m_sort, + m.ext_info as m_extInfo + + + + + where 1=1 + + + and id ${idOperator} #{id} + + + and data_scope ${dataScopeOperator} #{dataScope} + + + and del_flag ${delFlagOperator} #{delFlag} + + + and is_default ${isDefaultOperator} #{isDefault} + + + and name ${nameOperator} #{name} + + + and remarks ${remarksOperator} #{remarks} + + + + + + + select SEQ_TS_ROLE.nextval as idfrom dual + + update TS_ROLE + set `del_flag`= 0 + where `id` = #{id} + + + + + + + + + + + update TS_ROLE + set del_Flag = 1 + where id = #{roleId} + + + + delete from TR_ROLE_MENU + where ROLE_ID = #{roleId} + + + + + + + + + + + + + + + + + + + + + insert into TR_ROLE_MENU(ROLE_ID,MENU_ID) values (#{roleId}, #{menuId}) + + + + delete from TR_ROLE_MENU + where role_id = #{roleId} and menu_id=#{menuId} + + + + + + + insert into TS_ROLE + + is_default, + del_flag, + data_scope, + id, + ext_info, + remarks, + name, + extInfo2, + extInfo3, + extInfo4, + extInfo5 + + + #{isDefault}, + #{delFlag}, + #{dataScope}, + #{id}, + #{extInfo}, + #{remarks}, + #{name}, + #{extInfo2}, + #{extInfo3}, + #{extInfo4}, + #{extInfo5} + + + + + + insert into TS_ROLE( + + ) + values (#{id}, #{dataScope}, #{delFlag}, #{isDefault}, #{name}, #{remarks}, #{extInfo}) + + + + + update TS_ROLE + set data_scope = #{dataScope}, + del_flag = #{delFlag}, + is_default = #{isDefault}, + name = #{name}, + remarks = #{remarks}, + extInfo = #{extInfo} + where id = #{id} + + + + + update TS_ROLE set + + + data_scope = #{dataScope}, + + + del_flag = #{delFlag}, + + + is_default = #{isDefault}, + + + name = #{name}, + + + remarks = #{remarks}, + + + EXT_INFO=#{extInfo}, + + + extInfo2 = #{extInfo2}, + + + extInfo3 = #{extInfo3}, + + + extInfo4 = #{extInfo4}, + + + extInfo5 = #{extInfo5}, + + + where id = #{id} + + + + + + + + delete from TS_ROLE + where id = #{value} + + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml new file mode 100644 index 0000000..59385e0 --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + insert into TR_ROLE_HOME values + + (#{rh.roleId},#{rh.menuId}) + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml new file mode 100644 index 0000000..2d1339e --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + role_id, menu_id + + + + + where 1=1 + + + and role_id ${roleIdOperator} #{roleId} + + + and menu_id ${menuIdOperator} #{menuId} + + + + + + + insert into TR_ROLE_MENU() + values (#{roleId, jdbcType=VARCHAR}, #{menuId, jdbcType=VARCHAR}) + + + + + insert into TR_ROLE_MENU + + role_id, + menu_id, + + + #{roleId, jdbcType=VARCHAR}, + #{menuId, jdbcType=VARCHAR}, + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml new file mode 100644 index 0000000..859a3ba --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + role_id, org_id + + + + + where 1=1 + + + and role_id ${roleIdOperator} #{roleId} + + + and org_id ${orgIdOperator} #{orgId} + + + + + + + insert into TR_ROLE_ORG() + values (#{roleId, jdbcType=VARCHAR}, #{orgId, jdbcType=VARCHAR}) + + + + + insert into TR_ROLE_ORG + + role_id, + org_id, + + + #{roleId, jdbcType=VARCHAR}, + #{orgId, jdbcType=VARCHAR}, + + + + + + + + + + + + + delete from TR_ROLE_ORG ro where ro.role_id = #{roleId} + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml new file mode 100644 index 0000000..24cd3b4 --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + u.*, r.id as id, + r.data_scope as dataScope, + r.del_flag as r_delFlag, + r.is_default as isDefault, + r.name as name, + r.remarks as remarks + + + + + + + + distinct(usid), account, del_flag, password,CELLPHONE_NUMBER, + EMAIL,CREATE_TIME + + + + + + insert into TS_USER(USID,ACCOUNT,DEL_FLAG,PASSWORD,USNAME,CELLPHONE_NUMBER,EMAIL,CREATE_TIME,UPDATE_TIME,ISUSE,DEPARTMENT,ISSELF) values + + (#{user.usid},#{user.account},#{user.delFlag},#{user.password},#{user.usname},#{user.cellPhoneNumber},#{user.email},#{user.createTime},#{user.updateTime},#{user.isUse},#{user.department},#{user.isSelf}) + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml new file mode 100644 index 0000000..e65157a --- /dev/null +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + user_id, role_id + + + + + where 1=1 + + + and `user_id` ${userIdOperator} #{userId} + + + and `role_id` ${roleIdOperator} #{roleId} + + + + + + + insert into TR_USER_ROLE() + values (#{userId}, #{roleId}) + + + + + update TR_USER_ROLE + set `role_id` = #{roleId} + where `user_id` = #{userId} + + + + + update TR_USER_ROLE + + + role_id = #{roleId}, + + + where user_id = #{userId} + + + + + + + + delete from TR_USER_ROLE + where user_id = #{value} + + + + + + + + + + + + + + insert into TR_USER_ROLE()values + + (#{ur.userId}, #{ur.roleId}) + + + + + diff --git a/adc-da-sys/src/main/resources/province.json b/adc-da-sys/src/main/resources/province.json new file mode 100644 index 0000000..16a5e63 --- /dev/null +++ b/adc-da-sys/src/main/resources/province.json @@ -0,0 +1,126 @@ +[ + { + "code":"11", + "name":"北京市" + }, + { + "code":"12", + "name":"天津市" + }, + { + "code":"13", + "name":"河北省" + }, + { + "code":"14", + "name":"山西省" + }, + { + "code":"15", + "name":"内蒙古自治区" + }, + { + "code":"21", + "name":"辽宁省" + }, + { + "code":"22", + "name":"吉林省" + }, + { + "code":"23", + "name":"黑龙江省" + }, + { + "code":"31", + "name":"上海市" + }, + { + "code":"32", + "name":"江苏省" + }, + { + "code":"33", + "name":"浙江省" + }, + { + "code":"34", + "name":"安徽省" + }, + { + "code":"35", + "name":"福建省" + }, + { + "code":"36", + "name":"江西省" + }, + { + "code":"37", + "name":"山东省" + }, + { + "code":"41", + "name":"河南省" + }, + { + "code":"42", + "name":"湖北省" + }, + { + "code":"43", + "name":"湖南省" + }, + { + "code":"44", + "name":"广东省" + }, + { + "code":"45", + "name":"广西壮族自治区" + }, + { + "code":"46", + "name":"海南省" + }, + { + "code":"50", + "name":"重庆市" + }, + { + "code":"51", + "name":"四川省" + }, + { + "code":"52", + "name":"贵州省" + }, + { + "code":"53", + "name":"云南省" + }, + { + "code":"54", + "name":"西藏自治区" + }, + { + "code":"61", + "name":"陕西省" + }, + { + "code":"62", + "name":"甘肃省" + }, + { + "code":"63", + "name":"青海省" + }, + { + "code":"64", + "name":"宁夏回族自治区" + }, + { + "code":"65", + "name":"新疆维吾尔自治区" + } +] \ No newline at end of file diff --git a/adc-da-sys/src/main/resources/template/用户导入模板.xlsx b/adc-da-sys/src/main/resources/template/用户导入模板.xlsx new file mode 100644 index 0000000..6ac697b Binary files /dev/null and b/adc-da-sys/src/main/resources/template/用户导入模板.xlsx differ diff --git a/adc-da-sys/target/classes/city.json b/adc-da-sys/target/classes/city.json new file mode 100644 index 0000000..7c4f5b0 --- /dev/null +++ b/adc-da-sys/target/classes/city.json @@ -0,0 +1,1712 @@ +[ + { + "code":"1101", + "name":"市辖区", + "provinceCode":"11" + }, + { + "code":"1201", + "name":"市辖区", + "provinceCode":"12" + }, + { + "code":"1301", + "name":"石家庄市", + "provinceCode":"13" + }, + { + "code":"1302", + "name":"唐山市", + "provinceCode":"13" + }, + { + "code":"1303", + "name":"秦皇岛市", + "provinceCode":"13" + }, + { + "code":"1304", + "name":"邯郸市", + "provinceCode":"13" + }, + { + "code":"1305", + "name":"邢台市", + "provinceCode":"13" + }, + { + "code":"1306", + "name":"保定市", + "provinceCode":"13" + }, + { + "code":"1307", + "name":"张家口市", + "provinceCode":"13" + }, + { + "code":"1308", + "name":"承德市", + "provinceCode":"13" + }, + { + "code":"1309", + "name":"沧州市", + "provinceCode":"13" + }, + { + "code":"1310", + "name":"廊坊市", + "provinceCode":"13" + }, + { + "code":"1311", + "name":"衡水市", + "provinceCode":"13" + }, + { + "code":"1401", + "name":"太原市", + "provinceCode":"14" + }, + { + "code":"1402", + "name":"大同市", + "provinceCode":"14" + }, + { + "code":"1403", + "name":"阳泉市", + "provinceCode":"14" + }, + { + "code":"1404", + "name":"长治市", + "provinceCode":"14" + }, + { + "code":"1405", + "name":"晋城市", + "provinceCode":"14" + }, + { + "code":"1406", + "name":"朔州市", + "provinceCode":"14" + }, + { + "code":"1407", + "name":"晋中市", + "provinceCode":"14" + }, + { + "code":"1408", + "name":"运城市", + "provinceCode":"14" + }, + { + "code":"1409", + "name":"忻州市", + "provinceCode":"14" + }, + { + "code":"1410", + "name":"临汾市", + "provinceCode":"14" + }, + { + "code":"1411", + "name":"吕梁市", + "provinceCode":"14" + }, + { + "code":"1501", + "name":"呼和浩特市", + "provinceCode":"15" + }, + { + "code":"1502", + "name":"包头市", + "provinceCode":"15" + }, + { + "code":"1503", + "name":"乌海市", + "provinceCode":"15" + }, + { + "code":"1504", + "name":"赤峰市", + "provinceCode":"15" + }, + { + "code":"1505", + "name":"通辽市", + "provinceCode":"15" + }, + { + "code":"1506", + "name":"鄂尔多斯市", + "provinceCode":"15" + }, + { + "code":"1507", + "name":"呼伦贝尔市", + "provinceCode":"15" + }, + { + "code":"1508", + "name":"巴彦淖尔市", + "provinceCode":"15" + }, + { + "code":"1509", + "name":"乌兰察布市", + "provinceCode":"15" + }, + { + "code":"1522", + "name":"兴安盟", + "provinceCode":"15" + }, + { + "code":"1525", + "name":"锡林郭勒盟", + "provinceCode":"15" + }, + { + "code":"1529", + "name":"阿拉善盟", + "provinceCode":"15" + }, + { + "code":"2101", + "name":"沈阳市", + "provinceCode":"21" + }, + { + "code":"2102", + "name":"大连市", + "provinceCode":"21" + }, + { + "code":"2103", + "name":"鞍山市", + "provinceCode":"21" + }, + { + "code":"2104", + "name":"抚顺市", + "provinceCode":"21" + }, + { + "code":"2105", + "name":"本溪市", + "provinceCode":"21" + }, + { + "code":"2106", + "name":"丹东市", + "provinceCode":"21" + }, + { + "code":"2107", + "name":"锦州市", + "provinceCode":"21" + }, + { + "code":"2108", + "name":"营口市", + "provinceCode":"21" + }, + { + "code":"2109", + "name":"阜新市", + "provinceCode":"21" + }, + { + "code":"2110", + "name":"辽阳市", + "provinceCode":"21" + }, + { + "code":"2111", + "name":"盘锦市", + "provinceCode":"21" + }, + { + "code":"2112", + "name":"铁岭市", + "provinceCode":"21" + }, + { + "code":"2113", + "name":"朝阳市", + "provinceCode":"21" + }, + { + "code":"2114", + "name":"葫芦岛市", + "provinceCode":"21" + }, + { + "code":"2201", + "name":"长春市", + "provinceCode":"22" + }, + { + "code":"2202", + "name":"吉林市", + "provinceCode":"22" + }, + { + "code":"2203", + "name":"四平市", + "provinceCode":"22" + }, + { + "code":"2204", + "name":"辽源市", + "provinceCode":"22" + }, + { + "code":"2205", + "name":"通化市", + "provinceCode":"22" + }, + { + "code":"2206", + "name":"白山市", + "provinceCode":"22" + }, + { + "code":"2207", + "name":"松原市", + "provinceCode":"22" + }, + { + "code":"2208", + "name":"白城市", + "provinceCode":"22" + }, + { + "code":"2224", + "name":"延边朝鲜族自治州", + "provinceCode":"22" + }, + { + "code":"2301", + "name":"哈尔滨市", + "provinceCode":"23" + }, + { + "code":"2302", + "name":"齐齐哈尔市", + "provinceCode":"23" + }, + { + "code":"2303", + "name":"鸡西市", + "provinceCode":"23" + }, + { + "code":"2304", + "name":"鹤岗市", + "provinceCode":"23" + }, + { + "code":"2305", + "name":"双鸭山市", + "provinceCode":"23" + }, + { + "code":"2306", + "name":"大庆市", + "provinceCode":"23" + }, + { + "code":"2307", + "name":"伊春市", + "provinceCode":"23" + }, + { + "code":"2308", + "name":"佳木斯市", + "provinceCode":"23" + }, + { + "code":"2309", + "name":"七台河市", + "provinceCode":"23" + }, + { + "code":"2310", + "name":"牡丹江市", + "provinceCode":"23" + }, + { + "code":"2311", + "name":"黑河市", + "provinceCode":"23" + }, + { + "code":"2312", + "name":"绥化市", + "provinceCode":"23" + }, + { + "code":"2327", + "name":"大兴安岭地区", + "provinceCode":"23" + }, + { + "code":"3101", + "name":"市辖区", + "provinceCode":"31" + }, + { + "code":"3201", + "name":"南京市", + "provinceCode":"32" + }, + { + "code":"3202", + "name":"无锡市", + "provinceCode":"32" + }, + { + "code":"3203", + "name":"徐州市", + "provinceCode":"32" + }, + { + "code":"3204", + "name":"常州市", + "provinceCode":"32" + }, + { + "code":"3205", + "name":"苏州市", + "provinceCode":"32" + }, + { + "code":"3206", + "name":"南通市", + "provinceCode":"32" + }, + { + "code":"3207", + "name":"连云港市", + "provinceCode":"32" + }, + { + "code":"3208", + "name":"淮安市", + "provinceCode":"32" + }, + { + "code":"3209", + "name":"盐城市", + "provinceCode":"32" + }, + { + "code":"3210", + "name":"扬州市", + "provinceCode":"32" + }, + { + "code":"3211", + "name":"镇江市", + "provinceCode":"32" + }, + { + "code":"3212", + "name":"泰州市", + "provinceCode":"32" + }, + { + "code":"3213", + "name":"宿迁市", + "provinceCode":"32" + }, + { + "code":"3301", + "name":"杭州市", + "provinceCode":"33" + }, + { + "code":"3302", + "name":"宁波市", + "provinceCode":"33" + }, + { + "code":"3303", + "name":"温州市", + "provinceCode":"33" + }, + { + "code":"3304", + "name":"嘉兴市", + "provinceCode":"33" + }, + { + "code":"3305", + "name":"湖州市", + "provinceCode":"33" + }, + { + "code":"3306", + "name":"绍兴市", + "provinceCode":"33" + }, + { + "code":"3307", + "name":"金华市", + "provinceCode":"33" + }, + { + "code":"3308", + "name":"衢州市", + "provinceCode":"33" + }, + { + "code":"3309", + "name":"舟山市", + "provinceCode":"33" + }, + { + "code":"3310", + "name":"台州市", + "provinceCode":"33" + }, + { + "code":"3311", + "name":"丽水市", + "provinceCode":"33" + }, + { + "code":"3401", + "name":"合肥市", + "provinceCode":"34" + }, + { + "code":"3402", + "name":"芜湖市", + "provinceCode":"34" + }, + { + "code":"3403", + "name":"蚌埠市", + "provinceCode":"34" + }, + { + "code":"3404", + "name":"淮南市", + "provinceCode":"34" + }, + { + "code":"3405", + "name":"马鞍山市", + "provinceCode":"34" + }, + { + "code":"3406", + "name":"淮北市", + "provinceCode":"34" + }, + { + "code":"3407", + "name":"铜陵市", + "provinceCode":"34" + }, + { + "code":"3408", + "name":"安庆市", + "provinceCode":"34" + }, + { + "code":"3410", + "name":"黄山市", + "provinceCode":"34" + }, + { + "code":"3411", + "name":"滁州市", + "provinceCode":"34" + }, + { + "code":"3412", + "name":"阜阳市", + "provinceCode":"34" + }, + { + "code":"3413", + "name":"宿州市", + "provinceCode":"34" + }, + { + "code":"3415", + "name":"六安市", + "provinceCode":"34" + }, + { + "code":"3416", + "name":"亳州市", + "provinceCode":"34" + }, + { + "code":"3417", + "name":"池州市", + "provinceCode":"34" + }, + { + "code":"3418", + "name":"宣城市", + "provinceCode":"34" + }, + { + "code":"3501", + "name":"福州市", + "provinceCode":"35" + }, + { + "code":"3502", + "name":"厦门市", + "provinceCode":"35" + }, + { + "code":"3503", + "name":"莆田市", + "provinceCode":"35" + }, + { + "code":"3504", + "name":"三明市", + "provinceCode":"35" + }, + { + "code":"3505", + "name":"泉州市", + "provinceCode":"35" + }, + { + "code":"3506", + "name":"漳州市", + "provinceCode":"35" + }, + { + "code":"3507", + "name":"南平市", + "provinceCode":"35" + }, + { + "code":"3508", + "name":"龙岩市", + "provinceCode":"35" + }, + { + "code":"3509", + "name":"宁德市", + "provinceCode":"35" + }, + { + "code":"3601", + "name":"南昌市", + "provinceCode":"36" + }, + { + "code":"3602", + "name":"景德镇市", + "provinceCode":"36" + }, + { + "code":"3603", + "name":"萍乡市", + "provinceCode":"36" + }, + { + "code":"3604", + "name":"九江市", + "provinceCode":"36" + }, + { + "code":"3605", + "name":"新余市", + "provinceCode":"36" + }, + { + "code":"3606", + "name":"鹰潭市", + "provinceCode":"36" + }, + { + "code":"3607", + "name":"赣州市", + "provinceCode":"36" + }, + { + "code":"3608", + "name":"吉安市", + "provinceCode":"36" + }, + { + "code":"3609", + "name":"宜春市", + "provinceCode":"36" + }, + { + "code":"3610", + "name":"抚州市", + "provinceCode":"36" + }, + { + "code":"3611", + "name":"上饶市", + "provinceCode":"36" + }, + { + "code":"3701", + "name":"济南市", + "provinceCode":"37" + }, + { + "code":"3702", + "name":"青岛市", + "provinceCode":"37" + }, + { + "code":"3703", + "name":"淄博市", + "provinceCode":"37" + }, + { + "code":"3704", + "name":"枣庄市", + "provinceCode":"37" + }, + { + "code":"3705", + "name":"东营市", + "provinceCode":"37" + }, + { + "code":"3706", + "name":"烟台市", + "provinceCode":"37" + }, + { + "code":"3707", + "name":"潍坊市", + "provinceCode":"37" + }, + { + "code":"3708", + "name":"济宁市", + "provinceCode":"37" + }, + { + "code":"3709", + "name":"泰安市", + "provinceCode":"37" + }, + { + "code":"3710", + "name":"威海市", + "provinceCode":"37" + }, + { + "code":"3711", + "name":"日照市", + "provinceCode":"37" + }, + { + "code":"3713", + "name":"临沂市", + "provinceCode":"37" + }, + { + "code":"3714", + "name":"德州市", + "provinceCode":"37" + }, + { + "code":"3715", + "name":"聊城市", + "provinceCode":"37" + }, + { + "code":"3716", + "name":"滨州市", + "provinceCode":"37" + }, + { + "code":"3717", + "name":"菏泽市", + "provinceCode":"37" + }, + { + "code":"4101", + "name":"郑州市", + "provinceCode":"41" + }, + { + "code":"4102", + "name":"开封市", + "provinceCode":"41" + }, + { + "code":"4103", + "name":"洛阳市", + "provinceCode":"41" + }, + { + "code":"4104", + "name":"平顶山市", + "provinceCode":"41" + }, + { + "code":"4105", + "name":"安阳市", + "provinceCode":"41" + }, + { + "code":"4106", + "name":"鹤壁市", + "provinceCode":"41" + }, + { + "code":"4107", + "name":"新乡市", + "provinceCode":"41" + }, + { + "code":"4108", + "name":"焦作市", + "provinceCode":"41" + }, + { + "code":"4109", + "name":"濮阳市", + "provinceCode":"41" + }, + { + "code":"4110", + "name":"许昌市", + "provinceCode":"41" + }, + { + "code":"4111", + "name":"漯河市", + "provinceCode":"41" + }, + { + "code":"4112", + "name":"三门峡市", + "provinceCode":"41" + }, + { + "code":"4113", + "name":"南阳市", + "provinceCode":"41" + }, + { + "code":"4114", + "name":"商丘市", + "provinceCode":"41" + }, + { + "code":"4115", + "name":"信阳市", + "provinceCode":"41" + }, + { + "code":"4116", + "name":"周口市", + "provinceCode":"41" + }, + { + "code":"4117", + "name":"驻马店市", + "provinceCode":"41" + }, + { + "code":"4190", + "name":"省直辖县级行政区划", + "provinceCode":"41" + }, + { + "code":"4201", + "name":"武汉市", + "provinceCode":"42" + }, + { + "code":"4202", + "name":"黄石市", + "provinceCode":"42" + }, + { + "code":"4203", + "name":"十堰市", + "provinceCode":"42" + }, + { + "code":"4205", + "name":"宜昌市", + "provinceCode":"42" + }, + { + "code":"4206", + "name":"襄阳市", + "provinceCode":"42" + }, + { + "code":"4207", + "name":"鄂州市", + "provinceCode":"42" + }, + { + "code":"4208", + "name":"荆门市", + "provinceCode":"42" + }, + { + "code":"4209", + "name":"孝感市", + "provinceCode":"42" + }, + { + "code":"4210", + "name":"荆州市", + "provinceCode":"42" + }, + { + "code":"4211", + "name":"黄冈市", + "provinceCode":"42" + }, + { + "code":"4212", + "name":"咸宁市", + "provinceCode":"42" + }, + { + "code":"4213", + "name":"随州市", + "provinceCode":"42" + }, + { + "code":"4228", + "name":"恩施土家族苗族自治州", + "provinceCode":"42" + }, + { + "code":"4290", + "name":"省直辖县级行政区划", + "provinceCode":"42" + }, + { + "code":"4301", + "name":"长沙市", + "provinceCode":"43" + }, + { + "code":"4302", + "name":"株洲市", + "provinceCode":"43" + }, + { + "code":"4303", + "name":"湘潭市", + "provinceCode":"43" + }, + { + "code":"4304", + "name":"衡阳市", + "provinceCode":"43" + }, + { + "code":"4305", + "name":"邵阳市", + "provinceCode":"43" + }, + { + "code":"4306", + "name":"岳阳市", + "provinceCode":"43" + }, + { + "code":"4307", + "name":"常德市", + "provinceCode":"43" + }, + { + "code":"4308", + "name":"张家界市", + "provinceCode":"43" + }, + { + "code":"4309", + "name":"益阳市", + "provinceCode":"43" + }, + { + "code":"4310", + "name":"郴州市", + "provinceCode":"43" + }, + { + "code":"4311", + "name":"永州市", + "provinceCode":"43" + }, + { + "code":"4312", + "name":"怀化市", + "provinceCode":"43" + }, + { + "code":"4313", + "name":"娄底市", + "provinceCode":"43" + }, + { + "code":"4331", + "name":"湘西土家族苗族自治州", + "provinceCode":"43" + }, + { + "code":"4401", + "name":"广州市", + "provinceCode":"44" + }, + { + "code":"4402", + "name":"韶关市", + "provinceCode":"44" + }, + { + "code":"4403", + "name":"深圳市", + "provinceCode":"44" + }, + { + "code":"4404", + "name":"珠海市", + "provinceCode":"44" + }, + { + "code":"4405", + "name":"汕头市", + "provinceCode":"44" + }, + { + "code":"4406", + "name":"佛山市", + "provinceCode":"44" + }, + { + "code":"4407", + "name":"江门市", + "provinceCode":"44" + }, + { + "code":"4408", + "name":"湛江市", + "provinceCode":"44" + }, + { + "code":"4409", + "name":"茂名市", + "provinceCode":"44" + }, + { + "code":"4412", + "name":"肇庆市", + "provinceCode":"44" + }, + { + "code":"4413", + "name":"惠州市", + "provinceCode":"44" + }, + { + "code":"4414", + "name":"梅州市", + "provinceCode":"44" + }, + { + "code":"4415", + "name":"汕尾市", + "provinceCode":"44" + }, + { + "code":"4416", + "name":"河源市", + "provinceCode":"44" + }, + { + "code":"4417", + "name":"阳江市", + "provinceCode":"44" + }, + { + "code":"4418", + "name":"清远市", + "provinceCode":"44" + }, + { + "code":"4419", + "name":"东莞市", + "provinceCode":"44" + }, + { + "code":"4420", + "name":"中山市", + "provinceCode":"44" + }, + { + "code":"4451", + "name":"潮州市", + "provinceCode":"44" + }, + { + "code":"4452", + "name":"揭阳市", + "provinceCode":"44" + }, + { + "code":"4453", + "name":"云浮市", + "provinceCode":"44" + }, + { + "code":"4501", + "name":"南宁市", + "provinceCode":"45" + }, + { + "code":"4502", + "name":"柳州市", + "provinceCode":"45" + }, + { + "code":"4503", + "name":"桂林市", + "provinceCode":"45" + }, + { + "code":"4504", + "name":"梧州市", + "provinceCode":"45" + }, + { + "code":"4505", + "name":"北海市", + "provinceCode":"45" + }, + { + "code":"4506", + "name":"防城港市", + "provinceCode":"45" + }, + { + "code":"4507", + "name":"钦州市", + "provinceCode":"45" + }, + { + "code":"4508", + "name":"贵港市", + "provinceCode":"45" + }, + { + "code":"4509", + "name":"玉林市", + "provinceCode":"45" + }, + { + "code":"4510", + "name":"百色市", + "provinceCode":"45" + }, + { + "code":"4511", + "name":"贺州市", + "provinceCode":"45" + }, + { + "code":"4512", + "name":"河池市", + "provinceCode":"45" + }, + { + "code":"4513", + "name":"来宾市", + "provinceCode":"45" + }, + { + "code":"4514", + "name":"崇左市", + "provinceCode":"45" + }, + { + "code":"4601", + "name":"海口市", + "provinceCode":"46" + }, + { + "code":"4602", + "name":"三亚市", + "provinceCode":"46" + }, + { + "code":"4603", + "name":"三沙市", + "provinceCode":"46" + }, + { + "code":"4604", + "name":"儋州市", + "provinceCode":"46" + }, + { + "code":"4690", + "name":"省直辖县级行政区划", + "provinceCode":"46" + }, + { + "code":"5001", + "name":"市辖区", + "provinceCode":"50" + }, + { + "code":"5002", + "name":"县", + "provinceCode":"50" + }, + { + "code":"5101", + "name":"成都市", + "provinceCode":"51" + }, + { + "code":"5103", + "name":"自贡市", + "provinceCode":"51" + }, + { + "code":"5104", + "name":"攀枝花市", + "provinceCode":"51" + }, + { + "code":"5105", + "name":"泸州市", + "provinceCode":"51" + }, + { + "code":"5106", + "name":"德阳市", + "provinceCode":"51" + }, + { + "code":"5107", + "name":"绵阳市", + "provinceCode":"51" + }, + { + "code":"5108", + "name":"广元市", + "provinceCode":"51" + }, + { + "code":"5109", + "name":"遂宁市", + "provinceCode":"51" + }, + { + "code":"5110", + "name":"内江市", + "provinceCode":"51" + }, + { + "code":"5111", + "name":"乐山市", + "provinceCode":"51" + }, + { + "code":"5113", + "name":"南充市", + "provinceCode":"51" + }, + { + "code":"5114", + "name":"眉山市", + "provinceCode":"51" + }, + { + "code":"5115", + "name":"宜宾市", + "provinceCode":"51" + }, + { + "code":"5116", + "name":"广安市", + "provinceCode":"51" + }, + { + "code":"5117", + "name":"达州市", + "provinceCode":"51" + }, + { + "code":"5118", + "name":"雅安市", + "provinceCode":"51" + }, + { + "code":"5119", + "name":"巴中市", + "provinceCode":"51" + }, + { + "code":"5120", + "name":"资阳市", + "provinceCode":"51" + }, + { + "code":"5132", + "name":"阿坝藏族羌族自治州", + "provinceCode":"51" + }, + { + "code":"5133", + "name":"甘孜藏族自治州", + "provinceCode":"51" + }, + { + "code":"5134", + "name":"凉山彝族自治州", + "provinceCode":"51" + }, + { + "code":"5201", + "name":"贵阳市", + "provinceCode":"52" + }, + { + "code":"5202", + "name":"六盘水市", + "provinceCode":"52" + }, + { + "code":"5203", + "name":"遵义市", + "provinceCode":"52" + }, + { + "code":"5204", + "name":"安顺市", + "provinceCode":"52" + }, + { + "code":"5205", + "name":"毕节市", + "provinceCode":"52" + }, + { + "code":"5206", + "name":"铜仁市", + "provinceCode":"52" + }, + { + "code":"5223", + "name":"黔西南布依族苗族自治州", + "provinceCode":"52" + }, + { + "code":"5226", + "name":"黔东南苗族侗族自治州", + "provinceCode":"52" + }, + { + "code":"5227", + "name":"黔南布依族苗族自治州", + "provinceCode":"52" + }, + { + "code":"5301", + "name":"昆明市", + "provinceCode":"53" + }, + { + "code":"5303", + "name":"曲靖市", + "provinceCode":"53" + }, + { + "code":"5304", + "name":"玉溪市", + "provinceCode":"53" + }, + { + "code":"5305", + "name":"保山市", + "provinceCode":"53" + }, + { + "code":"5306", + "name":"昭通市", + "provinceCode":"53" + }, + { + "code":"5307", + "name":"丽江市", + "provinceCode":"53" + }, + { + "code":"5308", + "name":"普洱市", + "provinceCode":"53" + }, + { + "code":"5309", + "name":"临沧市", + "provinceCode":"53" + }, + { + "code":"5323", + "name":"楚雄彝族自治州", + "provinceCode":"53" + }, + { + "code":"5325", + "name":"红河哈尼族彝族自治州", + "provinceCode":"53" + }, + { + "code":"5326", + "name":"文山壮族苗族自治州", + "provinceCode":"53" + }, + { + "code":"5328", + "name":"西双版纳傣族自治州", + "provinceCode":"53" + }, + { + "code":"5329", + "name":"大理白族自治州", + "provinceCode":"53" + }, + { + "code":"5331", + "name":"德宏傣族景颇族自治州", + "provinceCode":"53" + }, + { + "code":"5333", + "name":"怒江傈僳族自治州", + "provinceCode":"53" + }, + { + "code":"5334", + "name":"迪庆藏族自治州", + "provinceCode":"53" + }, + { + "code":"5401", + "name":"拉萨市", + "provinceCode":"54" + }, + { + "code":"5402", + "name":"日喀则市", + "provinceCode":"54" + }, + { + "code":"5403", + "name":"昌都市", + "provinceCode":"54" + }, + { + "code":"5404", + "name":"林芝市", + "provinceCode":"54" + }, + { + "code":"5405", + "name":"山南市", + "provinceCode":"54" + }, + { + "code":"5406", + "name":"那曲市", + "provinceCode":"54" + }, + { + "code":"5425", + "name":"阿里地区", + "provinceCode":"54" + }, + { + "code":"6101", + "name":"西安市", + "provinceCode":"61" + }, + { + "code":"6102", + "name":"铜川市", + "provinceCode":"61" + }, + { + "code":"6103", + "name":"宝鸡市", + "provinceCode":"61" + }, + { + "code":"6104", + "name":"咸阳市", + "provinceCode":"61" + }, + { + "code":"6105", + "name":"渭南市", + "provinceCode":"61" + }, + { + "code":"6106", + "name":"延安市", + "provinceCode":"61" + }, + { + "code":"6107", + "name":"汉中市", + "provinceCode":"61" + }, + { + "code":"6108", + "name":"榆林市", + "provinceCode":"61" + }, + { + "code":"6109", + "name":"安康市", + "provinceCode":"61" + }, + { + "code":"6110", + "name":"商洛市", + "provinceCode":"61" + }, + { + "code":"6201", + "name":"兰州市", + "provinceCode":"62" + }, + { + "code":"6202", + "name":"嘉峪关市", + "provinceCode":"62" + }, + { + "code":"6203", + "name":"金昌市", + "provinceCode":"62" + }, + { + "code":"6204", + "name":"白银市", + "provinceCode":"62" + }, + { + "code":"6205", + "name":"天水市", + "provinceCode":"62" + }, + { + "code":"6206", + "name":"武威市", + "provinceCode":"62" + }, + { + "code":"6207", + "name":"张掖市", + "provinceCode":"62" + }, + { + "code":"6208", + "name":"平凉市", + "provinceCode":"62" + }, + { + "code":"6209", + "name":"酒泉市", + "provinceCode":"62" + }, + { + "code":"6210", + "name":"庆阳市", + "provinceCode":"62" + }, + { + "code":"6211", + "name":"定西市", + "provinceCode":"62" + }, + { + "code":"6212", + "name":"陇南市", + "provinceCode":"62" + }, + { + "code":"6229", + "name":"临夏回族自治州", + "provinceCode":"62" + }, + { + "code":"6230", + "name":"甘南藏族自治州", + "provinceCode":"62" + }, + { + "code":"6301", + "name":"西宁市", + "provinceCode":"63" + }, + { + "code":"6302", + "name":"海东市", + "provinceCode":"63" + }, + { + "code":"6322", + "name":"海北藏族自治州", + "provinceCode":"63" + }, + { + "code":"6323", + "name":"黄南藏族自治州", + "provinceCode":"63" + }, + { + "code":"6325", + "name":"海南藏族自治州", + "provinceCode":"63" + }, + { + "code":"6326", + "name":"果洛藏族自治州", + "provinceCode":"63" + }, + { + "code":"6327", + "name":"玉树藏族自治州", + "provinceCode":"63" + }, + { + "code":"6328", + "name":"海西蒙古族藏族自治州", + "provinceCode":"63" + }, + { + "code":"6401", + "name":"银川市", + "provinceCode":"64" + }, + { + "code":"6402", + "name":"石嘴山市", + "provinceCode":"64" + }, + { + "code":"6403", + "name":"吴忠市", + "provinceCode":"64" + }, + { + "code":"6404", + "name":"固原市", + "provinceCode":"64" + }, + { + "code":"6405", + "name":"中卫市", + "provinceCode":"64" + }, + { + "code":"6501", + "name":"乌鲁木齐市", + "provinceCode":"65" + }, + { + "code":"6502", + "name":"克拉玛依市", + "provinceCode":"65" + }, + { + "code":"6504", + "name":"吐鲁番市", + "provinceCode":"65" + }, + { + "code":"6505", + "name":"哈密市", + "provinceCode":"65" + }, + { + "code":"6523", + "name":"昌吉回族自治州", + "provinceCode":"65" + }, + { + "code":"6527", + "name":"博尔塔拉蒙古自治州", + "provinceCode":"65" + }, + { + "code":"6528", + "name":"巴音郭楞蒙古自治州", + "provinceCode":"65" + }, + { + "code":"6529", + "name":"阿克苏地区", + "provinceCode":"65" + }, + { + "code":"6530", + "name":"克孜勒苏柯尔克孜自治州", + "provinceCode":"65" + }, + { + "code":"6531", + "name":"喀什地区", + "provinceCode":"65" + }, + { + "code":"6532", + "name":"和田地区", + "provinceCode":"65" + }, + { + "code":"6540", + "name":"伊犁哈萨克自治州", + "provinceCode":"65" + }, + { + "code":"6542", + "name":"塔城地区", + "provinceCode":"65" + }, + { + "code":"6543", + "name":"阿勒泰地区", + "provinceCode":"65" + }, + { + "code":"6590", + "name":"自治区直辖县级行政区划", + "provinceCode":"65" + } +] \ No newline at end of file diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialSaleDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialSaleDTO.class new file mode 100644 index 0000000..5dfb585 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialSaleDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialYieldDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialYieldDTO.class new file mode 100644 index 0000000..2d8d43e Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectCommercialYieldDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectNewEnergySaleDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectNewEnergySaleDTO.class new file mode 100644 index 0000000..14a927d Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectNewEnergySaleDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectPassengerSaleDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectPassengerSaleDTO.class new file mode 100644 index 0000000..fce658a Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectPassengerSaleDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectPolityDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectPolityDTO.class new file mode 100644 index 0000000..fe3b129 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectPolityDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectStockDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectStockDTO.class new file mode 100644 index 0000000..90b88bb Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectStockDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/SelectYieldDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/SelectYieldDTO.class new file mode 100644 index 0000000..e6b2e51 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/SelectYieldDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/dto/selectMacroscopicDTO.class b/adc-da-sys/target/classes/com/adc/da/dto/selectMacroscopicDTO.class new file mode 100644 index 0000000..397a793 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/dto/selectMacroscopicDTO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/annotation/BusinessLog.class b/adc-da-sys/target/classes/com/adc/da/log/annotation/BusinessLog.class new file mode 100644 index 0000000..d78fe18 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/annotation/BusinessLog.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/constant/LogConstants.class b/adc-da-sys/target/classes/com/adc/da/log/constant/LogConstants.class new file mode 100644 index 0000000..dab03a2 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/constant/LogConstants.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/controller/LogEOController.class b/adc-da-sys/target/classes/com/adc/da/log/controller/LogEOController.class new file mode 100644 index 0000000..7165786 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/controller/LogEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/dao/mysql/LogEODao.class b/adc-da-sys/target/classes/com/adc/da/log/dao/mysql/LogEODao.class new file mode 100644 index 0000000..7333f5b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/dao/mysql/LogEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/entity/LogEO.class b/adc-da-sys/target/classes/com/adc/da/log/entity/LogEO.class new file mode 100644 index 0000000..797ed6f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/entity/LogEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/entity/MiLogEO.class b/adc-da-sys/target/classes/com/adc/da/log/entity/MiLogEO.class new file mode 100644 index 0000000..d3a4f56 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/entity/MiLogEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/page/LogEOPage.class b/adc-da-sys/target/classes/com/adc/da/log/page/LogEOPage.class new file mode 100644 index 0000000..df186b9 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/page/LogEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/service/LogEOService.class b/adc-da-sys/target/classes/com/adc/da/log/service/LogEOService.class new file mode 100644 index 0000000..78e9296 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/service/LogEOService.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/log/vo/LogVO.class b/adc-da-sys/target/classes/com/adc/da/log/vo/LogVO.class new file mode 100644 index 0000000..c24757c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/log/vo/LogVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sync/vo/SyncVO.class b/adc-da-sys/target/classes/com/adc/da/sync/vo/SyncVO.class new file mode 100644 index 0000000..ab49832 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sync/vo/SyncVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/annotation/DataFilter.class b/adc-da-sys/target/classes/com/adc/da/sys/annotation/DataFilter.class new file mode 100644 index 0000000..11cf07b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/annotation/DataFilter.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/constant/IsBelongEnum.class b/adc-da-sys/target/classes/com/adc/da/sys/constant/IsBelongEnum.class new file mode 100644 index 0000000..6ac186a Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/constant/IsBelongEnum.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/MailController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/MailController.class new file mode 100644 index 0000000..7977f26 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/MailController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/MailTestController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/MailTestController.class new file mode 100644 index 0000000..199cfa5 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/MailTestController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/MenuEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/MenuEOController.class new file mode 100644 index 0000000..ebc333f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/MenuEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleEOController.class new file mode 100644 index 0000000..0690a5d Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleMenuEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleMenuEOController.class new file mode 100644 index 0000000..5d6dd91 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/RoleMenuEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class new file mode 100644 index 0000000..35eb9e8 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmMenuEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmMenuEOController.class new file mode 100644 index 0000000..500e8bb Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmMenuEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResponseMessage.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResponseMessage.class new file mode 100644 index 0000000..c1c4b57 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResponseMessage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResult.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResult.class new file mode 100644 index 0000000..d20552b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmResult.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmRoleEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmRoleEOController.class new file mode 100644 index 0000000..265e6c3 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmRoleEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmUserEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmUserEOController.class new file mode 100644 index 0000000..43c42ab Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/ddm/DdmUserEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MailEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MailEODao.class new file mode 100644 index 0000000..625a3e8 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MailEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MenuEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MenuEODao.class new file mode 100644 index 0000000..6824e69 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/MenuEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleEODao.class new file mode 100644 index 0000000..0341f9c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleHomeEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleHomeEODao.class new file mode 100644 index 0000000..dd5009f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleHomeEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleMenuEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleMenuEODao.class new file mode 100644 index 0000000..8deea70 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleMenuEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleOrgEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleOrgEODao.class new file mode 100644 index 0000000..d68e2d7 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/RoleOrgEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserEODao.class new file mode 100644 index 0000000..6bf402a Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserRoleEODao.class b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserRoleEODao.class new file mode 100644 index 0000000..57522fc Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/dao/mysql/UserRoleEODao.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/MailEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/MailEO.class new file mode 100644 index 0000000..f38b045 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/MailEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/MenuEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/MenuEO.class new file mode 100644 index 0000000..8f5bca5 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/MenuEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/OpenUserEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/OpenUserEO.class new file mode 100644 index 0000000..1cd53a6 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/OpenUserEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleEO.class new file mode 100644 index 0000000..def542a Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleHomeEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleHomeEO.class new file mode 100644 index 0000000..f0f027c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleHomeEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleMenuEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleMenuEO.class new file mode 100644 index 0000000..12b3e5b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleMenuEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleOrgEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleOrgEO.class new file mode 100644 index 0000000..48262dc Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/RoleOrgEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/UserEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/UserEO.class new file mode 100644 index 0000000..c203d81 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/UserEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/entity/UserRoleEO.class b/adc-da-sys/target/classes/com/adc/da/sys/entity/UserRoleEO.class new file mode 100644 index 0000000..696e18e Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/entity/UserRoleEO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/DicTypeEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/DicTypeEOPage.class new file mode 100644 index 0000000..5e77d81 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/DicTypeEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/DictionaryEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/DictionaryEOPage.class new file mode 100644 index 0000000..8a10e05 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/DictionaryEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/MenuEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/MenuEOPage.class new file mode 100644 index 0000000..e477553 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/MenuEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/OrgEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/OrgEOPage.class new file mode 100644 index 0000000..ef65d32 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/OrgEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/RoleEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleEOPage.class new file mode 100644 index 0000000..bf8c300 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/RoleMenuEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleMenuEOPage.class new file mode 100644 index 0000000..72aa5fd Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleMenuEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/RoleOrgEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleOrgEOPage.class new file mode 100644 index 0000000..f4ecd15 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/RoleOrgEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/UserEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/UserEOPage.class new file mode 100644 index 0000000..5cbf58d Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/UserEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/UserOrgEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/UserOrgEOPage.class new file mode 100644 index 0000000..9e1bef0 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/UserOrgEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/page/UserRoleEOPage.class b/adc-da-sys/target/classes/com/adc/da/sys/page/UserRoleEOPage.class new file mode 100644 index 0000000..585a81b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/page/UserRoleEOPage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/MenuEOService.class b/adc-da-sys/target/classes/com/adc/da/sys/service/MenuEOService.class new file mode 100644 index 0000000..6fe818b Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/MenuEOService.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class new file mode 100644 index 0000000..0653e65 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/RoleMenuEOService.class b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleMenuEOService.class new file mode 100644 index 0000000..796dd55 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleMenuEOService.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/UserEOServiceImpl.class b/adc-da-sys/target/classes/com/adc/da/sys/service/UserEOServiceImpl.class new file mode 100644 index 0000000..3fe4b4f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/UserEOServiceImpl.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/iservice/IUserEoService.class b/adc-da-sys/target/classes/com/adc/da/sys/service/iservice/IUserEoService.class new file mode 100644 index 0000000..50ee716 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/iservice/IUserEoService.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/CacheUtils.class b/adc-da-sys/target/classes/com/adc/da/sys/util/CacheUtils.class new file mode 100644 index 0000000..6e78331 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/CacheUtils.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/CompressUtil.class b/adc-da-sys/target/classes/com/adc/da/sys/util/CompressUtil.class new file mode 100644 index 0000000..b8bfd38 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/CompressUtil.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/DefaultConfigurer.class b/adc-da-sys/target/classes/com/adc/da/sys/util/DefaultConfigurer.class new file mode 100644 index 0000000..3e230e2 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/DefaultConfigurer.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/EncryptUtil.class b/adc-da-sys/target/classes/com/adc/da/sys/util/EncryptUtil.class new file mode 100644 index 0000000..0f7b1e1 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/EncryptUtil.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MailSenderInfo.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MailSenderInfo.class new file mode 100644 index 0000000..b6ce245 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MailSenderInfo.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils$1.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils$1.class new file mode 100644 index 0000000..aed3dde Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils$1.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils.class new file mode 100644 index 0000000..febe8f3 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MailTestUtils.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils$1.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils$1.class new file mode 100644 index 0000000..58c66bf Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils$1.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils.class new file mode 100644 index 0000000..ce781c5 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MailUtils.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/MyAuthenticator.class b/adc-da-sys/target/classes/com/adc/da/sys/util/MyAuthenticator.class new file mode 100644 index 0000000..553f65c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/MyAuthenticator.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/RSAUtil.class b/adc-da-sys/target/classes/com/adc/da/sys/util/RSAUtil.class new file mode 100644 index 0000000..fd5d5a0 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/RSAUtil.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/ReValidUtil.class b/adc-da-sys/target/classes/com/adc/da/sys/util/ReValidUtil.class new file mode 100644 index 0000000..69fdb9c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/ReValidUtil.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/util/SendEmailMessage.class b/adc-da-sys/target/classes/com/adc/da/sys/util/SendEmailMessage.class new file mode 100644 index 0000000..a482fd5 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/util/SendEmailMessage.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/LabelReturnVo.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/LabelReturnVo.class new file mode 100644 index 0000000..c889e91 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/LabelReturnVo.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/MenuVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/MenuVO.class new file mode 100644 index 0000000..6fda33f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/MenuVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ModuleVo.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ModuleVo.class new file mode 100644 index 0000000..09357f4 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ModuleVo.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/RoleVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/RoleVO.class new file mode 100644 index 0000000..43c1736 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/RoleVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/TreeVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/TreeVO.class new file mode 100644 index 0000000..0ac847e Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/TreeVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/UserImportVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserImportVO.class new file mode 100644 index 0000000..2b077e3 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserImportVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/UserRoleVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserRoleVO.class new file mode 100644 index 0000000..6ab860f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserRoleVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/UserVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserVO.class new file mode 100644 index 0000000..8354154 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/UserVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuListVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuListVO.class new file mode 100644 index 0000000..36e2c9c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuListVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuVO.class new file mode 100644 index 0000000..25aac9f Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmMenuVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.class new file mode 100644 index 0000000..92ae887 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleCreateVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.class new file mode 100644 index 0000000..7362035 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreate.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.class new file mode 100644 index 0000000..3546b45 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuCreateVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.class new file mode 100644 index 0000000..b63206c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleMenuDelete.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.class new file mode 100644 index 0000000..b6eff09 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleUserQuery.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleVO.class new file mode 100644 index 0000000..edc16c1 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmRoleVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserQueryVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserQueryVO.class new file mode 100644 index 0000000..03c8c55 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserQueryVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.class new file mode 100644 index 0000000..e4f8486 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleAdd.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleVO.class new file mode 100644 index 0000000..9a121ad Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRoleVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.class new file mode 100644 index 0000000..abaf662 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserRolesDeleteVO.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserVO.class b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserVO.class new file mode 100644 index 0000000..fd58e3a Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/vo/ddm/DdmUserVO.class differ diff --git a/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml b/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml new file mode 100644 index 0000000..02aee34 --- /dev/null +++ b/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml @@ -0,0 +1,57 @@ + + + + + + + + + com.adc.da.sys.entity.RoleEO + com.adc.da.sys.vo.ddm.DdmRoleVO + + + + id + rid + + + name + roleName + + + name + roleCode + + + remarks + rdesc + + + delFlag + enabled + + + menuEOIdList + menusstr + + + menuEOList + menus + + + + + + com.adc.da.sys.entity.MenuEO + com.adc.da.sys.vo.MenuVO + + + + com.adc.da.log.entity.LogEO + com.adc.da.log.vo.LogVO + + + diff --git a/adc-da-sys/target/classes/dozer/dozer-mappings-sys.xml b/adc-da-sys/target/classes/dozer/dozer-mappings-sys.xml new file mode 100644 index 0000000..4fc45a8 --- /dev/null +++ b/adc-da-sys/target/classes/dozer/dozer-mappings-sys.xml @@ -0,0 +1,53 @@ + + + + + + + + + com.adc.da.sys.entity.RoleEO + com.adc.da.sys.vo.RoleVO + + + + id + rid + + + name + rname + + + remarks + rdesc + + + delFlag + enabled + + + menuEOIdList + menusstr + + + menuEOList + menus + + + + + + com.adc.da.sys.entity.MenuEO + com.adc.da.sys.vo.MenuVO + + + + com.adc.da.log.entity.LogEO + com.adc.da.log.vo.LogVO + + + \ No newline at end of file diff --git a/adc-da-sys/target/classes/mybatis/mapper/log/mysql/LogEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/log/mysql/LogEOMapper.xml new file mode 100644 index 0000000..e8d31af --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/log/mysql/LogEOMapper.xml @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + distinct ip_address, browser, start_time, end_time, usid, operate_time, method, description, class_name, account + + + + + where 1=1 + + + and ip_address ${ipAddressOperator} #{ipAddress} + + + and browser ${browserOperator} #{browser} + + + and start_time >= to_date(#{startTime1},'yyyy-mm-dd hh24:mi:ss') + + + and start_time <= to_date(#{startTime2},'yyyy-mm-dd hh24:mi:ss')+1 + + + and usid ${usidOperator} #{usid} + + + and operate_time ${operateTimeOperator} #{operateTime} + + + and operate_time >= #{operateTime1} + + + and operate_time <= #{operateTime2} + + + and method ${methodOperator} #{method} + + + and description ${descriptionOperator} #{description} + + + and class_name ${classNameOperator} #{className} + + + and account ${accountOperator} '%${account}%' + + + and id ${idOperator} #{id} + + + + + + + + insert into TS_LOG() + values (#{ipAddress}, #{browser}, #{startTime}, #{endTime}, #{usid}, #{operateTime}, #{method}, #{description}, + #{className}, #{account}, + #{id}) + + + insert into ts_mi_log + (id + ,account + ,user_name + ,access_page + ,department + ,oparate_date) + values( + #{id} + ,#{account} + ,#{userName} + ,#{accessPage} + ,#{department} + ,#{operateDate}) + + + + + + + + merge into TS_LOG a + using ( + select + #{ipAddress} as ipAddress, + #{startTime} as startTime, + #{endTime} as endTime, + #{usid} as usid, + #{method} as method, + #{description} as description, + #{className} as className, + #{account} as account, + #{id} as id + from dual )b + on (a.ip_address = b.ipAddress + + and + (to_date(to_char(b.startTime,'yyyy-mm-dd hh24-mi-ss'), 'yyyy-mm-dd hh24-mi-ss')-to_date( to_char(a.START_TIME,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss') )*24*60*60 + <='2' + and a.usid = b.usid + and a.method = b.method + and a.description = b.description + and a.class_name = b.className + and a.account = b.account) + + when not matched then + insert (ip_address,start_time,end_time,usid,method,description,class_name,account,id) + values (b.ipAddress,b.startTime,b.endTime,b.usid,b.method,b.description,b.className,b.account,b.id) + + + + + update TS_LOG + set ip_address = #{ipAddress}, + browser = #{browser}, + start_time = #{startTime}, + end_time = #{endTime}, + usid = #{usid}, + operate_time = #{operateTime}, + method = #{method}, + description = #{description}, + class_name = #{className}, + account = #{account} + where id = #{id} + + + + + update TS_LOG + + + ip_address = #{ipAddress}, + + + browser = #{browser}, + + + start_time = #{startTime}, + + + end_time = #{endTime}, + + + usid = #{usid}, + + + operate_time = #{operateTime}, + + + method = #{method}, + + + description = #{description}, + + + class_name = #{className}, + + + account = #{account}, + + + where id = #{id} + + + + + + + + delete from TS_LOG + where id = #{value} + + + + + + + + + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MailEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MailEOMapper.xml new file mode 100644 index 0000000..2fb2d74 --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MailEOMapper.xml @@ -0,0 +1,18 @@ + + + + + insert into ts_mail(id + ,to_mail + ,cc_mail + ,subject + ,content + ,send_date) + values (#{id},#{toMail},#{ccMail}, #{subject}, #{content}, #{sendDate}) + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MenuEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MenuEOMapper.xml new file mode 100644 index 0000000..46e2c20 --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/MenuEOMapper.xml @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id, del_flag, name, parent_id, parent_ids, href, icon,iconHref,iconClick,iconClickHref, is_show, permission, remarks, sort, ext_info,is_url + + + + + + TS_MENU.id, TS_MENU.del_flag, TS_MENU.name, TS_MENU.parent_id, TS_MENU.parent_ids, TS_MENU.href, TS_MENU.icon, TS_MENU.is_show, TS_MENU.permission, TS_MENU.remarks, TS_MENU.sort, TS_MENU.ext_info + + + + where 1=1 + + + and id ${idOperator} #{id} + + + and del_flag ${delFlagOperator} #{delFlag} + + + and name ${nameOperator} #{name} + + + and parent_id ${parentIdOperator} #{parentId} + + + and parent_ids ${parentIdsOperator} #{parentIds} + + + and href ${hrefOperator} #{href} + + + and icon ${iconOperator} #{icon} + + + and is_show ${isShowOperator} #{isShow} + + + and permission ${permissionOperator} #{permission} + + + and remarks ${remarksOperator} #{remarks} + + + and sort ${sortOperator} #{sort} + + + + + + + insert into TS_MENU() + values (#{id}, #{delFlag}, #{name}, #{parentId}, #{parentIds}, #{href}, #{icon}, + #{iconHref},#{iconClick},#{iconClickHref},#{isShow}, #{permission}, #{remarks}, #{sort}, #{extInfo}) + + + + + insert into TS_MENU + + ext_info, + sort, + remarks, + permission, + is_show, + icon, + iconHref, + iconClick, + iconClickHref, + href, + parent_ids, + parent_id, + name, + del_flag, + id, + is_url, + + + #{extInfo}, + #{sort}, + #{remarks}, + #{permission}, + #{isShow}, + #{icon}, + #{iconHref}, + #{iconClick}, + #{iconClickHref}, + #{href}, + #{parentIds}, + #{parentId}, + #{name}, + #{delFlag}, + #{id}, + #{isUrl}, + + + + + + + UPDATE TS_MENU + SET del_flag = #{delFlag}, + NAME = #{name}, + parent_id = #{parentId}, + parent_ids = #{parentIds}, + href = #{href}, + icon = #{icon}, + iconHref = #{iconHref}, + iconClick = #{iconClick}, + iconClickHref = #{iconClickHref}, + is_show = #{isShow}, + PERMISSION = #{permission}, + remarks = #{remarks}, + SORT = #{sort} + WHERE ID = #{id} + + + + + update TS_MENU + + + ext_info = #{extInfo}, + + + del_flag = #{delFlag}, + + + name = #{name}, + + + parent_id = #{parentId}, + + + parent_ids = #{parentIds}, + + + href = #{href}, + + + icon = #{icon}, + + + iconHref = #{iconHref}, + + + iconClick = #{iconClick}, + + + iconClickHref = #{iconClickHref}, + + + is_show = #{isShow}, + + + permission = #{permission}, + + + remarks = #{remarks}, + + + sort = #{sort}, + + + is_url = #{isUrl}, + + + where id = #{id} + + + + + UPDATE TS_MENU set DEL_FLAG = ${@com.adc.da.util.constant.DeleteFlagEnum@DELETE.getValue()} + WHERE id in + + #{id} + + + + + UPDATE TS_MENU set DEL_FLAG = '1' + WHERE PARENT_ID=#{pId} + + + + + + + + + + DELETE FROM TR_ROLE_MENU where MENU_ID in + + #{id} + + or MENU_ID in ( + select ID from TS_MENU where + + PARENT_IDS like "%"#{id}"%" + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleEOMapper.xml new file mode 100644 index 0000000..63d55c6 --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleEOMapper.xml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, data_scope, del_flag, is_default, name, remarks, ext_info, extInfo2, extInfo3, extInfo4, extInfo5 + + + + r.*, m.id as m_id, + m.del_flag as m_delFlag, + m.name as m_name, + m.parent_id as m_parentId, + m.parent_ids as m_parentIds, + m.href as m_href, + m.icon as m_icon, + m.is_show as m_isShow, + m.permission as m_permission, + m.remarks as m_remarks, + m.sort as m_sort, + m.ext_info as m_extInfo + + + + + where 1=1 + + + and id ${idOperator} #{id} + + + and data_scope ${dataScopeOperator} #{dataScope} + + + and del_flag ${delFlagOperator} #{delFlag} + + + and is_default ${isDefaultOperator} #{isDefault} + + + and name ${nameOperator} #{name} + + + and remarks ${remarksOperator} #{remarks} + + + + + + + select SEQ_TS_ROLE.nextval as idfrom dual + + update TS_ROLE + set `del_flag`= 0 + where `id` = #{id} + + + + + + + + + + + update TS_ROLE + set del_Flag = 1 + where id = #{roleId} + + + + delete from TR_ROLE_MENU + where ROLE_ID = #{roleId} + + + + + + + + + + + + + + + + + + + + + insert into TR_ROLE_MENU(ROLE_ID,MENU_ID) values (#{roleId}, #{menuId}) + + + + delete from TR_ROLE_MENU + where role_id = #{roleId} and menu_id=#{menuId} + + + + + + + insert into TS_ROLE + + is_default, + del_flag, + data_scope, + id, + ext_info, + remarks, + name, + extInfo2, + extInfo3, + extInfo4, + extInfo5 + + + #{isDefault}, + #{delFlag}, + #{dataScope}, + #{id}, + #{extInfo}, + #{remarks}, + #{name}, + #{extInfo2}, + #{extInfo3}, + #{extInfo4}, + #{extInfo5} + + + + + + insert into TS_ROLE( + + ) + values (#{id}, #{dataScope}, #{delFlag}, #{isDefault}, #{name}, #{remarks}, #{extInfo}) + + + + + update TS_ROLE + set data_scope = #{dataScope}, + del_flag = #{delFlag}, + is_default = #{isDefault}, + name = #{name}, + remarks = #{remarks}, + extInfo = #{extInfo} + where id = #{id} + + + + + update TS_ROLE set + + + data_scope = #{dataScope}, + + + del_flag = #{delFlag}, + + + is_default = #{isDefault}, + + + name = #{name}, + + + remarks = #{remarks}, + + + EXT_INFO=#{extInfo}, + + + extInfo2 = #{extInfo2}, + + + extInfo3 = #{extInfo3}, + + + extInfo4 = #{extInfo4}, + + + extInfo5 = #{extInfo5}, + + + where id = #{id} + + + + + + + + delete from TS_ROLE + where id = #{value} + + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml new file mode 100644 index 0000000..59385e0 --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleHomeEOMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + insert into TR_ROLE_HOME values + + (#{rh.roleId},#{rh.menuId}) + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml new file mode 100644 index 0000000..2d1339e --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleMenuEOMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + role_id, menu_id + + + + + where 1=1 + + + and role_id ${roleIdOperator} #{roleId} + + + and menu_id ${menuIdOperator} #{menuId} + + + + + + + insert into TR_ROLE_MENU() + values (#{roleId, jdbcType=VARCHAR}, #{menuId, jdbcType=VARCHAR}) + + + + + insert into TR_ROLE_MENU + + role_id, + menu_id, + + + #{roleId, jdbcType=VARCHAR}, + #{menuId, jdbcType=VARCHAR}, + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml new file mode 100644 index 0000000..859a3ba --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/RoleOrgEOMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + role_id, org_id + + + + + where 1=1 + + + and role_id ${roleIdOperator} #{roleId} + + + and org_id ${orgIdOperator} #{orgId} + + + + + + + insert into TR_ROLE_ORG() + values (#{roleId, jdbcType=VARCHAR}, #{orgId, jdbcType=VARCHAR}) + + + + + insert into TR_ROLE_ORG + + role_id, + org_id, + + + #{roleId, jdbcType=VARCHAR}, + #{orgId, jdbcType=VARCHAR}, + + + + + + + + + + + + + delete from TR_ROLE_ORG ro where ro.role_id = #{roleId} + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserEOMapper.xml new file mode 100644 index 0000000..24cd3b4 --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserEOMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + u.*, r.id as id, + r.data_scope as dataScope, + r.del_flag as r_delFlag, + r.is_default as isDefault, + r.name as name, + r.remarks as remarks + + + + + + + + distinct(usid), account, del_flag, password,CELLPHONE_NUMBER, + EMAIL,CREATE_TIME + + + + + + insert into TS_USER(USID,ACCOUNT,DEL_FLAG,PASSWORD,USNAME,CELLPHONE_NUMBER,EMAIL,CREATE_TIME,UPDATE_TIME,ISUSE,DEPARTMENT,ISSELF) values + + (#{user.usid},#{user.account},#{user.delFlag},#{user.password},#{user.usname},#{user.cellPhoneNumber},#{user.email},#{user.createTime},#{user.updateTime},#{user.isUse},#{user.department},#{user.isSelf}) + + + + + + + + + + + + + + diff --git a/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml new file mode 100644 index 0000000..e65157a --- /dev/null +++ b/adc-da-sys/target/classes/mybatis/mapper/sys/mysql/UserRoleEOMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + user_id, role_id + + + + + where 1=1 + + + and `user_id` ${userIdOperator} #{userId} + + + and `role_id` ${roleIdOperator} #{roleId} + + + + + + + insert into TR_USER_ROLE() + values (#{userId}, #{roleId}) + + + + + update TR_USER_ROLE + set `role_id` = #{roleId} + where `user_id` = #{userId} + + + + + update TR_USER_ROLE + + + role_id = #{roleId}, + + + where user_id = #{userId} + + + + + + + + delete from TR_USER_ROLE + where user_id = #{value} + + + + + + + + + + + + + + insert into TR_USER_ROLE()values + + (#{ur.userId}, #{ur.roleId}) + + + + + diff --git a/adc-da-sys/target/classes/province.json b/adc-da-sys/target/classes/province.json new file mode 100644 index 0000000..16a5e63 --- /dev/null +++ b/adc-da-sys/target/classes/province.json @@ -0,0 +1,126 @@ +[ + { + "code":"11", + "name":"北京市" + }, + { + "code":"12", + "name":"天津市" + }, + { + "code":"13", + "name":"河北省" + }, + { + "code":"14", + "name":"山西省" + }, + { + "code":"15", + "name":"内蒙古自治区" + }, + { + "code":"21", + "name":"辽宁省" + }, + { + "code":"22", + "name":"吉林省" + }, + { + "code":"23", + "name":"黑龙江省" + }, + { + "code":"31", + "name":"上海市" + }, + { + "code":"32", + "name":"江苏省" + }, + { + "code":"33", + "name":"浙江省" + }, + { + "code":"34", + "name":"安徽省" + }, + { + "code":"35", + "name":"福建省" + }, + { + "code":"36", + "name":"江西省" + }, + { + "code":"37", + "name":"山东省" + }, + { + "code":"41", + "name":"河南省" + }, + { + "code":"42", + "name":"湖北省" + }, + { + "code":"43", + "name":"湖南省" + }, + { + "code":"44", + "name":"广东省" + }, + { + "code":"45", + "name":"广西壮族自治区" + }, + { + "code":"46", + "name":"海南省" + }, + { + "code":"50", + "name":"重庆市" + }, + { + "code":"51", + "name":"四川省" + }, + { + "code":"52", + "name":"贵州省" + }, + { + "code":"53", + "name":"云南省" + }, + { + "code":"54", + "name":"西藏自治区" + }, + { + "code":"61", + "name":"陕西省" + }, + { + "code":"62", + "name":"甘肃省" + }, + { + "code":"63", + "name":"青海省" + }, + { + "code":"64", + "name":"宁夏回族自治区" + }, + { + "code":"65", + "name":"新疆维吾尔自治区" + } +] \ No newline at end of file diff --git a/adc-da-sys/target/classes/template/用户导入模板.xlsx b/adc-da-sys/target/classes/template/用户导入模板.xlsx new file mode 100644 index 0000000..6ac697b Binary files /dev/null and b/adc-da-sys/target/classes/template/用户导入模板.xlsx differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5541403 --- /dev/null +++ b/pom.xml @@ -0,0 +1,569 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.1.5.RELEASE + + + + com.adc + ca-data + 2.5.0 + pom + + + UTF-8 + UTF-8 + 1.8 + 1.8 + 1.8 + 2.1.5.RELEASE + 4.12 + 1.2.9 + 1.7.21 + 1.8.5 + 2.12.5 + 1.9.13 + 3.2.0 + 12.1.0.1 + 8.0.13 + 6.1.0.jre7 + 3.5 + 2.5 + 1.10 + 1.10 + 2.4.6 + 1.4.0-RC2 + 8.5.37 + 3.16 + + + + adc-da-main + adc-da-login + adc-da-sys + adc-da-report + + + + + + + adc + http://60.247.58.121:8182/repository/public + + true + always + + + false + + + + snapshot + http://60.247.58.121:8182/repository/snapshots/ + + false + + + true + always + warn + + + + + + + thirdparty + Nexus Thirdparty Repository + http://60.247.58.121:8182/repository/thirdparty/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + org.springframework.boot + spring-boot-starter-actuator + ${spring.boot.version} + + + + org.springframework.boot + spring-boot-autoconfigure + ${spring.boot.version} + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-cache + ${spring.boot.version} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.mashape.unirest + unirest-java + 1.4.9 + + + + junit + junit + ${junit.version} + + + + org.mybatis + mybatis + 3.5.3 + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + + com.microsoft.sqlserver + mssql-jdbc + ${sqlserver.driver.version} + + + + com.oracle + ojdbc7 + ${oracle.driver.version} + + + + mysql + mysql-connector-java + ${mysql.driver.version} + + + + org.apache.logging.log4j + log4j-api + 2.16.0 + + + + org.apache.logging.log4j + log4j-to-slf4j + 2.16.0 + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + + org.dom4j + dom4j + 2.0.0 + + + + + commons-fileupload + commons-fileupload + 1.3.3 + + + + commons-lang + commons-lang + 2.6 + + + + commons-io + commons-io + 2.4 + + + + commons-collections + commons-collections + 3.2 + + + + commons-codec + commons-codec + 1.9 + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + + org.codehaus.jackson + jackson-core-asl + ${codehaus.jackson.version} + + + + org.codehaus.jackson + jackson-xc + ${codehaus.jackson.version} + + + + org.codehaus.jackson + jackson-jaxrs + ${codehaus.jackson.version} + + + + org.codehaus.jackson + jackson-mapper-asl + ${codehaus.jackson.version} + + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + + org.elasticsearch + elasticsearch + ${elasticsearch.version} + + + + org.jdom + jdom + 1.1 + + + + xom + xom + 1.2.5 + + + + javax.servlet + jstl + 1.2 + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + javax.servlet + servlet-api + 2.5 + + + + javax.servlet + jsp-api + 2.0 + + + + com.google.guava + guava + 20.0 + + + + net.sf.supercsv + super-csv + 2.4.0 + + + + com.typesafe + config + 1.2.1 + + + + org.codehaus.plexus + plexus-utils + 3.0.10 + + + + dom4j + dom4j + 1.6.1 + + + + com.alibaba + fastjson + ${fastjson.version} + + + + org.jacoco + org.jacoco.agent + 0.5.7.201204190339 + runtime + + + + + com.adc + adc-da-swagger + RELEASE + + + javax.mail + mailapi + + + + + + net.sf.dozer + dozer + 5.4.0 + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-log4j12 + + + + + + + org.apache.shiro + shiro-core + ${shiro.version} + + + org.apache.shiro + shiro-spring + ${shiro.version} + + + org.apache.shiro + shiro-web + ${shiro.version} + + + org.apache.shiro + shiro-ehcache + ${shiro.version} + + + + + org.projectlombok + lombok + 1.18.8 + + + + + org.apache.poi + poi + ${poi.version} + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + org.apache.poi + poi-ooxml-schemas + ${poi.version} + + + xerces + xercesImpl + + + + + + org.apache.poi + poi-scratchpad + ${poi.version} + + + + org.apache.poi + ooxml-schemas + 1.1 + + + + + cn.hutool + hutool-all + 4.5.11 + + + + org.springframework.boot + spring-boot-starter-data-redis + 2.1.5.RELEASE + + + + + + + + + + + local + + true + + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + + + d:/api + + docs + + + + + +