feat(cj): 接入江苏商贸职业学院产教融合后端,替换原有业务代码
- 引入若依 RuoYi 3.9.2 后端全部模块(ruoyi-admin/common/framework/generator/quartz/system)
- 含管理端 ruoyi-ui、数据库脚本 sql/、开发启动脚本与 doc 手册
- 移除原有 src/main 下的售后/账务等业务代码
Co-Authored-By: Claude <noreply@anthropic.com>
已删除1,059个文件
已添加665个文件
已修改5个文件
已重命名6个文件
| | |
| | | .idea
|
| | | *.iws
|
| | | *.iml
|
| | |
|
| | | ### vscode ###
|
| | | .vscode
|
| | | *.ipr
|
| | |
|
| | | ### JRebel ###
|
| | | rebel.xml
|
| | |
|
| | | ### NetBeans ###
|
| | | nbproject/private/
|
| | | build/*
|
| | |
| | |
|
| | | !*/build/*.java
|
| | | !*/build/*.html
|
| | | !*/build/*.xml |
| | | !*/build/*.xml
|
| | | |
| | | ###################################################################### |
| | | # 项ç®å®å
¨ï¼æ¥å¿ / ä¸ä¼ æä»¶ / æ¬å°å¯é¥ï¼å¿æäº¤ï¼ |
| | | ###################################################################### |
| | | ruoyi-admin/logs/ |
| | | uploadPath/ |
| | | /logs/ |
| | | *.log |
| | | D:/ruoyi/ |
| | | /tmp/ |
| | | *.key |
| | | *.pem |
| | |
| | | <p align="center">
|
| | | <img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
| | | </p>
|
| | | <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.9</h1>
|
| | | <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.9.2</h1>
|
| | | <h4 align="center">åºäºSpringBoot+Vueåå端å离çJavaå¿«éå¼åæ¡æ¶</h4>
|
| | | <p align="center">
|
| | | <a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
|
| | | <a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.9-brightgreen.svg"></a>
|
| | | <a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.9.2-brightgreen.svg"></a>
|
| | | <a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
| | | </p>
|
| | |
|
| | | ## å¹³å°ç®ä»
|
| | |
|
| | | * æ¬ä»åºä¸ºRuoYi-Vueçååºç¨çæ¬ï¼ä¿æåæ¥æ´æ°ã
|
| | | * é
å¥å端代ç å°å[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue/tree/master/ruoyi-ui)ï¼ææ¯æ ï¼[Vue2](https://cn.vuejs.org) + [Element](https://github.com/ElemeFE/element) + [Vue CLI](https://cli.vuejs.org/zh)ï¼ã
|
| | | * é
å¥å端代ç å°å[RuoYi-Vue3](https://gitcode.com/yangzongzhuan/RuoYi-Vue3)ï¼ææ¯æ ï¼[Vue3](https://v3.cn.vuejs.org) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev)ï¼ã
|
| | | * å端éç¨VueãElement UIã
|
| | | è¥ä¾æ¯ä¸å¥å
¨é¨å¼æºçå¿«éå¼åå¹³å°ï¼æ¯«æ ä¿çç»ä¸ªäººåä¼ä¸å
费使ç¨ã
|
| | |
|
| | | * å端éç¨VueãElementï¼æä¾ Vue2/Vue3/TS å¤çæ¬ï¼ã
|
| | | * å端éç¨Spring BootãSpring SecurityãRedis & Jwtã
|
| | | * æé认è¯ä½¿ç¨Jwtï¼æ¯æå¤ç»ç«¯è®¤è¯ç³»ç»ã
|
| | | * æ¯æå è½½å¨ææéèåï¼å¤æ¹å¼è½»æ¾æéæ§å¶ã
|
| | | * 髿çå¼åï¼ä½¿ç¨ä»£ç çæå¨å¯ä»¥ä¸é®çæåå端代ç ã
|
| | | * ä¸åç¦»çæ¬ï¼è¯·ç§»æ¥[RuoYi](https://gitee.com/y_project/RuoYi)ï¼å¾®æå¡çæ¬ï¼è¯·ç§»æ¥[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
| | | * åºäºJwtçToken认è¯ï¼æ¯æå¤ç»ç«¯ï¼WebãAppãå°ç¨åºï¼æ ç¼æ¥å
¥ã
|
| | | * æ¯æå è½½å¨ææéèåï¼å¤æ¹å¼è½»æ¾æéæ§å¶ï¼ç»ç²åº¦å°æé®çº§å«ã
|
| | | * å
置强大代ç çæå¨ï¼ä¸é®çæåå端代ç ï¼javaãvueãxmlãsqlï¼ï¼æ¯æ CRUD ä¸è½½ã
|
| | | * é¿éäºææ£åºï¼[ç¹æè¿å
¥](http://aly.ruoyi.vip)ï¼è
¾è®¯äºç§æåºï¼[ç¹æè¿å
¥](http://txy.ruoyi.vip)
|
| | |
|
| | | # çæ¬åæ¯
|
| | |
|
| | | RuoYi-Vue åç«¯é¡¹ç®æä¾ Spring Boot 2.x / 3.x / 4.x å¤çæ¬åæ¯çå¹¶è¡ç»´æ¤
|
| | |
|
| | | | åç§° | 说æ | å°å |
|
| | | | :---------------- | :------------------------ | :------------------------------------------------------ |
|
| | | | master é»è®¤åæ¯ | Spring Boot 4.x (JDK 17+) | https://gitee.com/y_project/RuoYi-Vue |
|
| | | | springboot3 忝 | Spring Boot 3.x (JDK 17+) | https://gitee.com/y_project/RuoYi-Vue/tree/springboot3 |
|
| | | | springboot2 忝 | Spring Boot 2.x (JDK 8+) | https://gitee.com/y_project/RuoYi-Vue/tree/springboot2 | |
| | |
|
| | | RuoYi-Vue åç«¯é¡¹ç®æä¾ Vue 2.x / 3.x / JavaScript / TypeScript çæ¬ï¼å坿··ç¨æé
|
| | |
|
| | | | 项ç®åç§° | **RuoYi-Vue2** | **RuoYi-Vue3** | **RuoYi-Vue3-TypeScript** |
|
| | | | :--- | :--- | :--- | :--- |
|
| | | | **åç«¯æ¡æ¶** | Vue 2 | Vue 3 | Vue 3 |
|
| | | | **èæ¬è¯è¨** | JavaScript | JavaScript | TypeScript |
|
| | | | **æå»ºå·¥å
·** | Vue CLI | Vite | Vite |
|
| | | | **UI ç»ä»¶åº** | Element UI | Element Plus | Element Plus |
|
| | | | **ç¶æç®¡ç** | Vuex | Pinia | Pinia |
|
| | | | **è·¯ç±ç®¡ç** | Vue Router 3 | Vue Router 4 | Vue Router 4 |
|
| | | | **æ ¸å¿ç¹ç¹** | 1. ææ¯æ ç»å
¸ç¨³å®<br>2. 社åºèµæä¸°å¯<br>3. å½åç»´æ¤éå¿å·²è½¬ç§» | 1. ç°ä»£åç«¯ææ¯æ <br>2. å¼åä½éªä¸æ§è½æ´ä¼<br>3. 宿¹ä¸»æ¨çæ´»è·çæ¬ | 1. ç±»åå æï¼åå°æ²éææ¬<br>2. å¼åæ¶ææç¤ºï¼æçæ´é«<br>3. å¤äººåä½ä¼ä¸çº§å¼åé¡¹ç® |
|
| | | | **ä»åºå°å** | [RuoYi-Vue2](https://gitcode.com/yangzongzhuan/RuoYi-Vue2) | [RuoYi-Vue3](https://gitcode.com/yangzongzhuan/RuoYi-Vue3) | [RuoYi-Vue3-TypeScript](https://gitcode.com/yangzongzhuan/RuoYi-Vue3/tree/typescript) |
|
| | |
|
| | | ## å
ç½®åè½
|
| | |
|
| | |
| | |
|
| | | ## è¥ä¾åå端å离交æµç¾¤
|
| | |
|
| | | QQç¾¤ï¼ [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XIzkm_mV2xTsUtFxo63bmicYoDBA6Ifm&authKey=dDW%2F4qsmw3x9govoZY9w%2FoWAoC4wbHqGal%2BbqLzoS6VBarU8EBptIgPKN%2FviyC8j&noverify=0&group_code=138988063) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=DkugnCg68PevlycJSKSwjhFqfIgrWWwR&authKey=pR1Pa5lPIeGF%2FFtIk6d%2FGB5qFi0EdvyErtpQXULzo03zbhopBHLWcuqdpwY241R%2F&noverify=0&group_code=151450850) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=F58bgRa-Dp-rsQJThiJqIYv8t4-lWfXh&authKey=UmUs4CVG5OPA1whvsa4uSespOvyd8%2FAr9olEGaWAfdLmfKQk%2FVBp2YU3u2xXXt76&noverify=0&group_code=224622315) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Nxb2EQ5qozWa218Wbs7zgBnjLSNk_tVT&authKey=obBKXj6SBKgrFTJZx0AqQnIYbNOvBB2kmgwWvGhzxR67RoRr84%2Bus5OadzMcdJl5&noverify=0&group_code=287842588) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=numtK1M_I4eVd2Gvg8qtbuL8JgX42qNh&authKey=giV9XWMaFZTY%2FqPlmWbkB9g3fi0Ev5CwEtT9Tgei0oUlFFCQLDp4ozWRiVIzubIm&noverify=0&group_code=187944233) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G6r5KGCaa3pqdbUSXNIgYloyb8e0_L0D&authKey=4w8tF1eGW7%2FedWn%2FHAypQksdrML%2BDHolQSx7094Agm7Luakj9EbfPnSTxSi2T1LQ&noverify=0&group_code=228578329) ç¹å»æé®å
¥ç¾¤ã |
| | | QQç¾¤ï¼ [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XIzkm_mV2xTsUtFxo63bmicYoDBA6Ifm&authKey=dDW%2F4qsmw3x9govoZY9w%2FoWAoC4wbHqGal%2BbqLzoS6VBarU8EBptIgPKN%2FviyC8j&noverify=0&group_code=138988063) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=DkugnCg68PevlycJSKSwjhFqfIgrWWwR&authKey=pR1Pa5lPIeGF%2FFtIk6d%2FGB5qFi0EdvyErtpQXULzo03zbhopBHLWcuqdpwY241R%2F&noverify=0&group_code=151450850) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=F58bgRa-Dp-rsQJThiJqIYv8t4-lWfXh&authKey=UmUs4CVG5OPA1whvsa4uSespOvyd8%2FAr9olEGaWAfdLmfKQk%2FVBp2YU3u2xXXt76&noverify=0&group_code=224622315) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Nxb2EQ5qozWa218Wbs7zgBnjLSNk_tVT&authKey=obBKXj6SBKgrFTJZx0AqQnIYbNOvBB2kmgwWvGhzxR67RoRr84%2Bus5OadzMcdJl5&noverify=0&group_code=287842588) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=numtK1M_I4eVd2Gvg8qtbuL8JgX42qNh&authKey=giV9XWMaFZTY%2FqPlmWbkB9g3fi0Ev5CwEtT9Tgei0oUlFFCQLDp4ozWRiVIzubIm&noverify=0&group_code=187944233) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G6r5KGCaa3pqdbUSXNIgYloyb8e0_L0D&authKey=4w8tF1eGW7%2FedWn%2FHAypQksdrML%2BDHolQSx7094Agm7Luakj9EbfPnSTxSi2T1LQ&noverify=0&group_code=228578329) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=GsOo-OLz53J8y_9TPoO6XXSGNRTgbFxA&authKey=R7Uy%2Feq%2BZsoKNqHvRKhiXpypW7DAogoWapOawUGHokJSBIBIre2%2FoiAZeZBSLuBc&noverify=0&group_code=191164766) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=PmYavuzsOthVqfdAPbo4uAeIbu7Ttjgc&authKey=p52l8%2FXa4PS1JcEmS3VccKSwOPJUZ1ZfQ69MEKzbrooNUljRtlKjvsXf04bxNp3G&noverify=0&group_code=174569686) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=M9y5NjAl44lAL_Vh2crmEehZU_PMU6KS&authKey=ZSDz8hEREWSaPuxQV3gEwqGIaGjfRNnkB4rJjf0IvXhrSUGSGwQFmBA%2Boe8HFxyl&noverify=0&group_code=127358632) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=UGnoqRcFRxUaX-JAUNrSDbPimKrllp4x&authKey=Bbzf8Bc0XaQhq5c4QOg46Uqngd%2FvtIixrLvCM1EkPf41diqKXKZqXVwAxHTxJ8R1&noverify=0&group_code=113071109) ç¹å»æé®å
¥ç¾¤ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ä¿¡æ¯] 使ç¨Jarå½ä»¤è¿è¡Webå·¥ç¨ã |
| | | echo. |
| | | |
| | | cd %~dp0 |
| | | cd ../ruoyi-admin/target |
| | | |
| | | set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m |
| | | |
| | | java -jar %JAVA_OPTS% ruoyi-admin.jar |
| | | |
| | | cd bin |
| | | pause |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #!/usr/bin/env bash |
| | | # ============================================================= |
| | | # 产æèåå®è·µæå¦ç®¡çå¹³å° ââ ç产å¯å¨èæ¬ |
| | | # ç¨æ³: ./start-prod.sh [profile] |
| | | # é»è®¤ profile: prod,druid |
| | | # ============================================================= |
| | | set -e |
| | | |
| | | PROFILE="${1:-prod,druid}" |
| | | JAR_DIR="$(cd "$(dirname "$0")/../ruoyi-admin/target" && pwd)" |
| | | JAR_FILE="${JAR_DIR}/ruoyi-admin.jar" |
| | | LOG_DIR="${LOG_DIR:-/var/log/ruoyi}" |
| | | PID_FILE="${PID_FILE:-/var/run/ruoyi-admin.pid}" |
| | | |
| | | # è¥ jar ä¸åå¨ï¼å
ç¨ maven æå
|
| | | if [ ! -f "$JAR_FILE" ]; then |
| | | echo "JAR not found: $JAR_FILE, building..." |
| | | cd "$(dirname "$0")/.." |
| | | mvn clean package -DskipTests -P "${PROFILE%%,*}" -q |
| | | fi |
| | | |
| | | mkdir -p "$LOG_DIR" |
| | | |
| | | echo "Starting ruoyi-admin with profile: $PROFILE" |
| | | nohup java -Xms512m -Xmx1024m \ |
| | | -Dfile.encoding=UTF-8 \ |
| | | -Dlog.path="$LOG_DIR" \ |
| | | -jar "$JAR_FILE" \ |
| | | --spring.profiles.active="$PROFILE" \ |
| | | > "${LOG_DIR}/startup.log" 2>&1 & |
| | | |
| | | PID=$! |
| | | echo "$PID" > "$PID_FILE" |
| | | echo "Started (PID=$PID). Log: ${LOG_DIR}/startup.log" |
| | | tail -f "${LOG_DIR}/startup.log" |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #!/usr/bin/env bash |
| | | # ============================================================= |
| | | # 产æèåå®è·µæå¦ç®¡çå¹³å° ââ çäº§åæ¢èæ¬ |
| | | # ç¨æ³: ./stop-prod.sh |
| | | # ============================================================= |
| | | set -e |
| | | |
| | | PID_FILE="${PID_FILE:-/var/run/ruoyi-admin.pid}" |
| | | |
| | | if [ -f "$PID_FILE" ]; then |
| | | PID=$(cat "$PID_FILE") |
| | | echo "Stopping ruoyi-admin (PID=$PID)..." |
| | | kill "$PID" 2>/dev/null || true |
| | | for i in $(seq 1 10); do |
| | | if ! kill -0 "$PID" 2>/dev/null; then break; fi |
| | | sleep 1 |
| | | done |
| | | kill -9 "$PID" 2>/dev/null || true |
| | | rm -f "$PID_FILE" |
| | | echo "Stopped." |
| | | else |
| | | # å°è¯ä»è¿ç¨åè¡¨æ¾ |
| | | PID=$(ps aux | grep 'ruoyi-admin.jar' | grep -v grep | awk '{print $2}') |
| | | if [ -n "$PID" ]; then |
| | | kill "$PID" 2>/dev/null && echo "Stopped (PID=$PID)" || echo "No process found" |
| | | else |
| | | echo "No running ruoyi-admin process found" |
| | | fi |
| | | fi |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | <project xmlns="http://maven.apache.org/POM/4.0.0"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
| | | <modelVersion>4.0.0</modelVersion>
|
| | |
|
| | | <modelVersion>4.0.0</modelVersion>
|
| | | |
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi</artifactId>
|
| | | <version>3.8.9</version>
|
| | | <packaging>jar</packaging>
|
| | | <version>3.9.2</version>
|
| | |
|
| | | <name>ruoyi</name>
|
| | | <url>http://www.ruoyi.vip</url>
|
| | | <description>è¥ä¾ç®¡çç³»ç»</description>
|
| | |
|
| | | <parent>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-parent</artifactId>
|
| | | <version>2.5.15</version>
|
| | | <relativePath />
|
| | | </parent>
|
| | |
|
| | | <description>产æèåå®è·µæå¦ç®¡çå¹³å°</description>
|
| | | |
| | | <properties>
|
| | | <ruoyi.version>3.9.2</ruoyi.version>
|
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
| | | <java.version>1.8</java.version>
|
| | | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
| | | <pagehelper.spring.boot.starter.version>1.4.7</pagehelper.spring.boot.starter.version>
|
| | | <fastjson.version>2.0.53</fastjson.version>
|
| | | <druid.version>1.2.23</druid.version>
|
| | | <commons.io.version>2.13.0</commons.io.version>
|
| | | <bitwalker.version>1.21</bitwalker.version>
|
| | | <jwt.version>0.9.1</jwt.version>
|
| | | <java.version>17</java.version>
|
| | | <spring-boot.version>4.1.0</spring-boot.version>
|
| | | <mybatis-spring-boot.version>4.1.0</mybatis-spring-boot.version>
|
| | | <druid.version>1.2.28</druid.version>
|
| | | <yauaa.version>8.2.0</yauaa.version>
|
| | | <kaptcha.version>2.3.3</kaptcha.version>
|
| | | <swagger.version>3.0.0</swagger.version>
|
| | | <poi.version>5.2.3</poi.version>
|
| | | <oshi.version>6.6.5</oshi.version>
|
| | | <pagehelper.boot.version>4.1.1</pagehelper.boot.version>
|
| | | <fastjson.version>2.0.64</fastjson.version>
|
| | | <oshi.version>7.4.4</oshi.version>
|
| | | <commons.io.version>2.22.0</commons.io.version>
|
| | | <poi.version>5.5.1</poi.version>
|
| | | <velocity.version>2.3</velocity.version>
|
| | | <!-- override dependency version -->
|
| | | <tomcat.version>9.0.102</tomcat.version>
|
| | | <minio.version>8.4.3</minio.version>
|
| | | <okhttp.version>4.9.0</okhttp.version>
|
| | | <logback.version>1.2.13</logback.version>
|
| | | <spring-security.version>5.7.12</spring-security.version>
|
| | | <spring-framework.version>5.3.39</spring-framework.version>
|
| | | <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
| | | <jwt.version>0.9.1</jwt.version>
|
| | | <jaxb-api.version>2.3.1</jaxb-api.version>
|
| | | <springdoc.version>3.1.0</springdoc.version>
|
| | | </properties>
|
| | |
|
| | | <dependencies>
|
| | | <!-- ruoyi-springboot2 / swagger knife4j é
ç½® -->
|
| | | <dependency>
|
| | | <groupId>com.github.xiaoymin</groupId>
|
| | | <artifactId>knife4j-spring-boot-starter</artifactId>
|
| | | <version>3.0.3</version>
|
| | | </dependency>
|
| | | <!-- ä¾èµå£°æ -->
|
| | | <dependencyManagement>
|
| | | <dependencies>
|
| | |
|
| | | <!-- SpringBoot æ ¸å¿å
-->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter</artifactId>
|
| | | </dependency>
|
| | | <!-- SpringBootçä¾èµé
ç½® -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-dependencies</artifactId>
|
| | | <version>${spring-boot.version}</version>
|
| | | <type>pom</type>
|
| | | <scope>import</scope>
|
| | | </dependency>
|
| | |
|
| | | <!-- SpringBoot æµè¯ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-test</artifactId>
|
| | | <scope>test</scope>
|
| | | </dependency>
|
| | | <!-- é¿éæ°æ®åºè¿æ¥æ± -->
|
| | | <dependency>
|
| | | <groupId>com.alibaba</groupId>
|
| | | <artifactId>druid-spring-boot-4-starter</artifactId>
|
| | | <version>${druid.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- SpringBoot æ¦æªå¨ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-aop</artifactId>
|
| | | </dependency>
|
| | | <!-- è§£æå®¢æ·ç«¯æä½ç³»ç»ãæµè§å¨ç -->
|
| | | <dependency>
|
| | | <groupId>nl.basjes.parse.useragent</groupId>
|
| | | <artifactId>yauaa</artifactId>
|
| | | <version>${yauaa.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- SpringBoot Webå®¹å¨ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-web</artifactId>
|
| | | </dependency>
|
| | | <!-- pagehelper å页æä»¶ -->
|
| | | <dependency>
|
| | | <groupId>com.github.pagehelper</groupId>
|
| | | <artifactId>pagehelper-spring-boot-starter</artifactId>
|
| | | <version>${pagehelper.boot.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- spring-boot-devtools -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-devtools</artifactId>
|
| | | <optional>true</optional> <!-- 表示ä¾èµä¸ä¼ä¼ é -->
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>org.mybatis.spring.boot</groupId>
|
| | | <artifactId>mybatis-spring-boot-starter</artifactId>
|
| | | <version>${mybatis-spring-boot.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- spring security å®å
¨è®¤è¯ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-security</artifactId>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>javax.xml.bind</groupId>
|
| | | <artifactId>jaxb-api</artifactId>
|
| | | <version>${jaxb-api.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- redis ç¼åæä½ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-data-redis</artifactId>
|
| | | </dependency>
|
| | | <!-- è·åç³»ç»ä¿¡æ¯ -->
|
| | | <dependency>
|
| | | <groupId>com.github.oshi</groupId>
|
| | | <artifactId>oshi-core</artifactId>
|
| | | <version>${oshi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- pool å¯¹è±¡æ± -->
|
| | | <dependency>
|
| | | <groupId>org.apache.commons</groupId>
|
| | | <artifactId>commons-pool2</artifactId>
|
| | | </dependency>
|
| | | <!-- spring-doc -->
|
| | | <dependency>
|
| | | <groupId>org.springdoc</groupId>
|
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
| | | <version>${springdoc.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- Mysql驱å¨å
-->
|
| | | <dependency>
|
| | | <groupId>mysql</groupId>
|
| | | <artifactId>mysql-connector-java</artifactId>
|
| | | <scope>runtime</scope>
|
| | | </dependency>
|
| | | <!-- io常ç¨å·¥å
·ç±» -->
|
| | | <dependency>
|
| | | <groupId>commons-io</groupId>
|
| | | <artifactId>commons-io</artifactId>
|
| | | <version>${commons.io.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- pagehelper å页æä»¶ -->
|
| | | <dependency>
|
| | | <groupId>com.github.pagehelper</groupId>
|
| | | <artifactId>pagehelper-spring-boot-starter</artifactId>
|
| | | <version>${pagehelper.spring.boot.starter.version}</version>
|
| | | </dependency>
|
| | | <!-- excelå·¥å
· -->
|
| | | <dependency>
|
| | | <groupId>org.apache.poi</groupId>
|
| | | <artifactId>poi-ooxml</artifactId>
|
| | | <version>${poi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- é¿éæ°æ®åºè¿æ¥æ± -->
|
| | | <dependency>
|
| | | <groupId>com.alibaba</groupId>
|
| | | <artifactId>druid-spring-boot-starter</artifactId>
|
| | | <version>${druid.version}</version>
|
| | | </dependency>
|
| | | <!-- velocity代ç çæä½¿ç¨æ¨¡æ¿ -->
|
| | | <dependency>
|
| | | <groupId>org.apache.velocity</groupId>
|
| | | <artifactId>velocity-engine-core</artifactId>
|
| | | <version>${velocity.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!--mybatis-plus-->
|
| | | <dependency>
|
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-boot-starter</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | | <!-- é¿éJSONè§£æå¨ -->
|
| | | <dependency>
|
| | | <groupId>com.alibaba.fastjson2</groupId>
|
| | | <artifactId>fastjson2</artifactId>
|
| | | <version>${fastjson.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!--mybatis-plus代ç çæå¨-->
|
| | | <dependency>
|
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-generator</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | | <!-- Tokençæä¸è§£æ-->
|
| | | <dependency>
|
| | | <groupId>io.jsonwebtoken</groupId>
|
| | | <artifactId>jjwt</artifactId>
|
| | | <version>${jwt.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- èªå®ä¹éªè¯æ³¨è§£ -->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-validation</artifactId>
|
| | | </dependency>
|
| | | <!-- éªè¯ç -->
|
| | | <dependency>
|
| | | <groupId>pro.fessional</groupId>
|
| | | <artifactId>kaptcha</artifactId>
|
| | | <version>${kaptcha.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- 常ç¨å·¥å
·ç±» -->
|
| | | <dependency>
|
| | | <groupId>org.apache.commons</groupId>
|
| | | <artifactId>commons-lang3</artifactId>
|
| | | </dependency>
|
| | | <!-- 宿¶ä»»å¡-->
|
| | | <dependency>
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi-quartz</artifactId>
|
| | | <version>${ruoyi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- io常ç¨å·¥å
·ç±» -->
|
| | | <dependency>
|
| | | <groupId>commons-io</groupId>
|
| | | <artifactId>commons-io</artifactId>
|
| | | <version>${commons.io.version}</version>
|
| | | </dependency>
|
| | | <!-- 代ç çæ-->
|
| | | <dependency>
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi-generator</artifactId>
|
| | | <version>${ruoyi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- è§£æå®¢æ·ç«¯æä½ç³»ç»ãæµè§å¨ç -->
|
| | | <dependency>
|
| | | <groupId>eu.bitwalker</groupId>
|
| | | <artifactId>UserAgentUtils</artifactId>
|
| | | <version>${bitwalker.version}</version>
|
| | | </dependency>
|
| | | <!-- æ ¸å¿æ¨¡å-->
|
| | | <dependency>
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi-framework</artifactId>
|
| | | <version>${ruoyi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- é¿éJSONè§£æå¨ -->
|
| | | <dependency>
|
| | | <groupId>com.alibaba.fastjson2</groupId>
|
| | | <artifactId>fastjson2</artifactId>
|
| | | <version>${fastjson.version}</version>
|
| | | </dependency>
|
| | | <!-- ç³»ç»æ¨¡å-->
|
| | | <dependency>
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi-system</artifactId>
|
| | | <version>${ruoyi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- Springæ¡æ¶åºæ¬çæ ¸å¿å·¥å
·-->
|
| | | <dependency>
|
| | | <groupId>org.springframework</groupId>
|
| | | <artifactId>spring-context-support</artifactId>
|
| | | </dependency>
|
| | | <!-- éç¨å·¥å
·-->
|
| | | <dependency>
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi-common</artifactId>
|
| | | <version>${ruoyi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- Tokençæä¸è§£æ-->
|
| | | <dependency>
|
| | | <groupId>io.jsonwebtoken</groupId>
|
| | | <artifactId>jjwt</artifactId>
|
| | | <version>${jwt.version}</version>
|
| | | </dependency>
|
| | | </dependencies>
|
| | | </dependencyManagement>
|
| | |
|
| | | <!-- Jaxb -->
|
| | | <dependency>
|
| | | <groupId>javax.xml.bind</groupId>
|
| | | <artifactId>jaxb-api</artifactId>
|
| | | </dependency>
|
| | | <modules>
|
| | | <module>ruoyi-admin</module>
|
| | | <module>ruoyi-framework</module>
|
| | | <module>ruoyi-system</module>
|
| | | <module>ruoyi-quartz</module>
|
| | | <module>ruoyi-generator</module>
|
| | | <module>ruoyi-common</module>
|
| | | </modules>
|
| | | <packaging>pom</packaging>
|
| | |
|
| | | <!-- Swagger3ä¾èµ -->
|
| | | <dependency>
|
| | | <groupId>io.springfox</groupId>
|
| | | <artifactId>springfox-boot-starter</artifactId>
|
| | | <version>${swagger.version}</version>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <groupId>io.swagger</groupId>
|
| | | <artifactId>swagger-models</artifactId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | |
|
| | | <!-- 鲿¢è¿å
¥swagger页颿¥ç±»å转æ¢éè¯¯ï¼æé¤3.0.0ä¸çå¼ç¨ï¼æå¨å¢å 1.6.2çæ¬ -->
|
| | | <dependency>
|
| | | <groupId>io.swagger</groupId>
|
| | | <artifactId>swagger-models</artifactId>
|
| | | <version>1.6.2</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- è·åç³»ç»ä¿¡æ¯ -->
|
| | | <dependency>
|
| | | <groupId>com.github.oshi</groupId>
|
| | | <artifactId>oshi-core</artifactId>
|
| | | <version>${oshi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- excelå·¥å
· -->
|
| | | <dependency>
|
| | | <groupId>org.apache.poi</groupId>
|
| | | <artifactId>poi-ooxml</artifactId>
|
| | | <version>${poi.version}</version>
|
| | | </dependency>
|
| | |
|
| | |
|
| | | <!-- velocity代ç çæä½¿ç¨æ¨¡æ¿ -->
|
| | | <dependency>
|
| | | <groupId>org.apache.velocity</groupId>
|
| | | <artifactId>velocity-engine-core</artifactId>
|
| | | <version>${velocity.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- 宿¶ä»»å¡ -->
|
| | | <dependency>
|
| | | <groupId>org.quartz-scheduler</groupId>
|
| | | <artifactId>quartz</artifactId>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <groupId>com.mchange</groupId>
|
| | | <artifactId>c3p0</artifactId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | |
|
| | | <!-- éªè¯ç -->
|
| | | <dependency>
|
| | | <groupId>pro.fessional</groupId>
|
| | | <artifactId>kaptcha</artifactId>
|
| | | <version>${kaptcha.version}</version>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <artifactId>servlet-api</artifactId>
|
| | | <groupId>javax.servlet</groupId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>org.projectlombok</groupId>
|
| | | <artifactId>lombok</artifactId>
|
| | | </dependency>
|
| | |
|
| | |
|
| | |
|
| | | <!-- minio -->
|
| | | <dependency>
|
| | | <groupId>io.minio</groupId>
|
| | | <artifactId>minio</artifactId>
|
| | | <version>${minio.version}</version>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <groupId>com.squareup.okhttp3</groupId>
|
| | | <artifactId>okhttp</artifactId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | |
|
| | | <!-- minioä¾èµokhttp ä¸ç¶æ¥é -->
|
| | | <dependency>
|
| | | <groupId>com.squareup.okhttp3</groupId>
|
| | | <artifactId>okhttp</artifactId>
|
| | | <version>${okhttp.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>com.deepoove</groupId>
|
| | | <artifactId>poi-tl</artifactId>
|
| | | <version>1.12.2</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>com.alibaba</groupId>
|
| | | <artifactId>easyexcel</artifactId>
|
| | | <version>4.0.3</version>
|
| | | </dependency>
|
| | | |
| | | <!-- Hutool æ ¸å¿å·¥å
·å
ï¼å
å«http模åï¼æ éåç¬å¼å
¥httpåå
ï¼ -->
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>5.3.7</version>
|
| | | </dependency>
|
| | |
|
| | | </dependencies>
|
| | |
|
| | | <build>
|
| | | <finalName>${project.artifactId}</finalName>
|
| | | <plugins>
|
| | | <plugin>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-maven-plugin</artifactId>
|
| | | <configuration>
|
| | | <fork>true</fork> <!-- å¦ææ²¡æè¯¥é
ç½®ï¼devtoolsä¸ä¼çæ -->
|
| | | </configuration>
|
| | | </plugin>
|
| | | <build>
|
| | | <plugins>
|
| | | <plugin>
|
| | | <groupId>org.apache.maven.plugins</groupId>
|
| | | <artifactId>maven-compiler-plugin</artifactId>
|
| | | <version>3.13.0</version>
|
| | | <configuration>
|
| | | <parameters>true</parameters>
|
| | | <source>${java.version}</source>
|
| | | <target>${java.version}</target>
|
| | | <encoding>${project.build.sourceEncoding}</encoding>
|
| | | </configuration>
|
| | | </plugin>
|
| | | <plugin>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-maven-plugin</artifactId>
|
| | | <version>${spring-boot.version}</version>
|
| | | </plugin>
|
| | | </plugins>
|
| | | </build>
|
| | | </build>
|
| | |
|
| | | <repositories>
|
| | | <repository>
|
| | | <id>public</id>
|
| | | <name>aliyun nexus</name>
|
| | | <url>https://maven.aliyun.com/repository/public</url>
|
| | | <releases>
|
| | | <enabled>true</enabled>
|
| | | </releases>
|
| | | </repository>
|
| | | </repositories>
|
| | | <repositories>
|
| | | <repository>
|
| | | <id>public</id>
|
| | | <name>aliyun nexus</name>
|
| | | <url>https://maven.aliyun.com/repository/public</url>
|
| | | <releases>
|
| | | <enabled>true</enabled>
|
| | | </releases>
|
| | | </repository>
|
| | | </repositories>
|
| | |
|
| | | <pluginRepositories>
|
| | | <pluginRepository>
|
| | | <id>public</id>
|
| | | <name>aliyun nexus</name>
|
| | | <url>https://maven.aliyun.com/repository/public</url>
|
| | | <releases>
|
| | | <enabled>true</enabled>
|
| | | </releases>
|
| | | <snapshots>
|
| | | <enabled>false</enabled>
|
| | | </snapshots>
|
| | | </pluginRepository>
|
| | | </pluginRepositories>
|
| | | <pluginRepositories>
|
| | | <pluginRepository>
|
| | | <id>public</id>
|
| | | <name>aliyun nexus</name>
|
| | | <url>https://maven.aliyun.com/repository/public</url>
|
| | | <releases>
|
| | | <enabled>true</enabled>
|
| | | </releases>
|
| | | <snapshots>
|
| | | <enabled>false</enabled>
|
| | | </snapshots>
|
| | | </pluginRepository>
|
| | | </pluginRepositories>
|
| | |
|
| | | </project>
|
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.9.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-admin</artifactId> |
| | | |
| | | <description> |
| | | webæå¡å
¥å£ |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示ä¾èµä¸ä¼ä¼ é --> |
| | | </dependency> |
| | | |
| | | <!-- spring-doc --> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱å¨å
--> |
| | | <dependency> |
| | | <groupId>com.mysql</groupId> |
| | | <artifactId>mysql-connector-j</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- æ ¸å¿æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 宿¶ä»»å¡--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 代ç çæ--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <addResources>true</addResources> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; |
| | | |
| | | /** |
| | | * å¯å¨ç¨åº |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| | | public class RuoYiApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | // System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(RuoYiApplication.class, args); |
| | | System.out.println("(â¥â â¿â )ï¾ï¾ 产æèåå®è·µæå¦ç®¡çå¹³å°å¯å¨æå á(´ڡ`á)ï¾ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | | " |(_ o _) / _( )_ .' \n" + |
| | | " | (_,_).' __ ___(_ o _)' \n" + |
| | | " | |\\ \\ | || |(_,_)' \n" + |
| | | " | | \\ `' /| `-' / \n" + |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * web容å¨ä¸è¿è¡é¨ç½² |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer |
| | | { |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) |
| | | { |
| | | return application.sources(RuoYiApplication.class); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | |
| | | /** |
| | | * ç³»ç»å¥åº·æ£æ¥æ¥å£ï¼æ 认è¯ï¼ç¨äºè´è½½åè¡¡/çæ§æ¢æ´»ï¼ |
| | | */ |
| | | @RestController |
| | | public class HealthController { |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | @Autowired |
| | | private Environment environment; |
| | | |
| | | @GetMapping("/api/health") |
| | | @Anonymous |
| | | public AjaxResult health() { |
| | | Map<String, Object> info = new HashMap<>(); |
| | | info.put("status", "UP"); |
| | | info.put("timestamp", new Date()); |
| | | |
| | | // æ°æ®åºæ£æ¥ |
| | | try { |
| | | jdbcTemplate.queryForObject("SELECT 1", Integer.class); |
| | | info.put("database", "UP"); |
| | | } catch (Exception e) { |
| | | info.put("database", "DOWN"); |
| | | info.put("dbError", e.getMessage()); |
| | | } |
| | | |
| | | // å
åä¿¡æ¯ |
| | | Runtime rt = Runtime.getRuntime(); |
| | | Map<String, Object> mem = new HashMap<>(); |
| | | mem.put("total", rt.totalMemory() / 1024 / 1024 + "MB"); |
| | | mem.put("free", rt.freeMemory() / 1024 / 1024 + "MB"); |
| | | mem.put("max", rt.maxMemory() / 1024 / 1024 + "MB"); |
| | | info.put("memory", mem); |
| | | |
| | | // ç³»ç»ä¿¡æ¯ |
| | | info.put("os", System.getProperty("os.name")); |
| | | info.put("java", System.getProperty("java.version")); |
| | | info.put("activeProfiles", String.join(",", environment.getActiveProfiles())); |
| | | |
| | | return AjaxResult.success(info); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import jakarta.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * éªè¯ç æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | /** |
| | | * çæéªè¯ç |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | ajax.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return ajax; |
| | | } |
| | | |
| | | // ä¿åéªè¯ç ä¿¡æ¯ |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | | |
| | | String capStr = null, code = null; |
| | | BufferedImage image = null; |
| | | |
| | | // çæéªè¯ç |
| | | String captchaType = RuoYiConfig.getCaptchaType(); |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(captchaType)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | |
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | // è½¬æ¢æµä¿¡æ¯ååº |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | | try |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", Base64.encode(os.toByteArray())); |
| | | return ajax; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.framework.config.ServerConfig; |
| | | |
| | | /** |
| | | * éç¨è¯·æ±å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/common") |
| | | public class CommonController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | private static final String FILE_DELIMITER = ","; |
| | | |
| | | /** |
| | | * éç¨ä¸è½½è¯·æ± |
| | | * |
| | | * @param fileName æä»¶åç§° |
| | | * @param delete æ¯å¦å é¤ |
| | | */ |
| | | @GetMapping("/download") |
| | | public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(fileName)) |
| | | { |
| | | throw new Exception(StringUtils.format("æä»¶åç§°({})éæ³ï¼ä¸å
许ä¸è½½ã ", fileName)); |
| | | } |
| | | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
| | | String filePath = RuoYiConfig.getDownloadPath() + fileName; |
| | | |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, realFileName); |
| | | FileUtils.writeBytes(filePath, response.getOutputStream()); |
| | | if (delete) |
| | | { |
| | | FileUtils.deleteFile(filePath); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("ä¸è½½æä»¶å¤±è´¥", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éç¨ä¸ä¼ 请æ±ï¼åä¸ªï¼ |
| | | */ |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // ä¸ä¼ æä»¶è·¯å¾ |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // ä¸ä¼ å¹¶è¿åæ°æä»¶åç§° |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("newFileName", FileUtils.getName(fileName)); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éç¨ä¸ä¼ 请æ±ï¼å¤ä¸ªï¼ |
| | | */ |
| | | @PostMapping("/uploads") |
| | | public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // ä¸ä¼ æä»¶è·¯å¾ |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | List<String> urls = new ArrayList<String>(); |
| | | List<String> fileNames = new ArrayList<String>(); |
| | | List<String> newFileNames = new ArrayList<String>(); |
| | | List<String> originalFilenames = new ArrayList<String>(); |
| | | for (MultipartFile file : files) |
| | | { |
| | | // ä¸ä¼ å¹¶è¿åæ°æä»¶åç§° |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | urls.add(url); |
| | | fileNames.add(fileName); |
| | | newFileNames.add(FileUtils.getName(fileName)); |
| | | originalFilenames.add(file.getOriginalFilename()); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("urls", StringUtils.join(urls, FILE_DELIMITER)); |
| | | ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMITER)); |
| | | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMITER)); |
| | | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMITER)); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¬å°èµæºéç¨ä¸è½½ |
| | | */ |
| | | @GetMapping("/download/resource") |
| | | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) |
| | | throws Exception |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(resource)) |
| | | { |
| | | throw new Exception(StringUtils.format("èµæºæä»¶({})éæ³ï¼ä¸å
许ä¸è½½ã ", resource)); |
| | | } |
| | | // æ¬å°èµæºè·¯å¾ |
| | | String localPath = RuoYiConfig.getProfile(); |
| | | // æ°æ®åºèµæºå°å |
| | | String downloadPath = localPath + FileUtils.stripPrefix(resource); |
| | | // ä¸è½½åç§° |
| | | String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, downloadName); |
| | | FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("ä¸è½½æä»¶å¤±è´¥", e); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.miniapp; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.text.SimpleDateFormat; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.domain.CjClass; |
| | | import com.ruoyi.system.domain.CjCollege; |
| | | import com.ruoyi.system.domain.CjMajor; |
| | | import com.ruoyi.system.domain.CjStudent; |
| | | import com.ruoyi.system.mapper.CjClassMapper; |
| | | import com.ruoyi.system.mapper.CjCollegeMapper; |
| | | import com.ruoyi.system.mapper.CjMajorMapper; |
| | | import com.ruoyi.system.mapper.CjStudentMapper; |
| | | import com.ruoyi.system.service.MiniappTokenService; |
| | | |
| | | /** |
| | | * å¦ç端账å·ä½ç³»æ¥å£ï¼å¾å½¢éªè¯ç / 注å(è±ååæ¿æ´») / ç»å½ / å¿è®°å¯ç (ä¸è¦ç´ èªå©éç½®) / ä¿®æ¹å¯ç ã |
| | | * |
| | | * 约å®ï¼ |
| | | * - è·¯å¾æå¨ /miniapp/** ä¸ï¼SecurityConfig å·²æ´ä½ permitAllï¼ç»å½ææ¥å£å¨æ¹æ³å
èªæ ¡éª tokenï¼ |
| | | * - ç»å½æ è¯ = å¦å· + å§åï¼å¦å·ä»
ç级å
å¯ä¸ï¼å§åæ¶æ§ä¹ï¼ä¸æ¢æ /miniapp/bind å£å¾ä¸è´ï¼ï¼ |
| | | * - 注åå³"è±ååæ¿æ´»"ï¼å¦ç须已å¨è±ååä¸å°æªè®¾ç½®å¯ç ï¼è±ååå·²ç»è®°ææºå·çï¼æ³¨åéææºå·æ ¡éªï¼é²äºè¦ç´ æ¢æ³¨ï¼ï¼ |
| | | * - 失败é宿 å¦å·+å§å ç»å计æ°ï¼åºå® 10 åéçªå£ï¼ï¼é¿å
è·¨çåå¦å·äºé䏿»åéï¼ |
| | | * - ä¼è¯ token ç»ä¸èµ° MiniappTokenServiceï¼å«ååç´¢å¼ï¼æ¯æéç½®/æ¹å¯/强å¶ä¸çº¿æ¶ä½åºå
¨é¨ä¼è¯ï¼ã |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/miniapp") |
| | | public class MiniappAccountController |
| | | { |
| | | /** ä¿®æ¹å¯ç æ¶åå¯ç é误计æ°ï¼æ studentIdï¼ */ |
| | | private static final String CHANGE_ERR_KEY = "miniapp_change_err:"; |
| | | private static final int PWD_ERR_MAX = 5; |
| | | private static final int RESET_ERR_MAX = 3; |
| | | private static final int CHANGE_ERR_MAX = 5; |
| | | /** å¯ç å¤æåº¦ï¼8-20 ä½ï¼è³å°å«åæ¯åæ°å */ |
| | | private static final String PWD_RULE_RE = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d!@#$%^&*_.\\-+=?]{8,20}$"; |
| | | private static final String PHONE_RE = "^1[3-9]\\d{9}$"; |
| | | private static final String FAIL_IDENTITY_MSG = "æ ¡éªå¤±è´¥ï¼è¯·æ ¸å¯¹å¦å·/å§å/ææºå·ï¼å¦æçé®è¯·èç³»ç级管ç人éç½®"; |
| | | private static final String MULTI_MATCH_MSG = "åå¨ç¸åå¦å·ä¸å§åçå¤åå¦çï¼è¯·èç³»ç级管çäººæ ¸å¯¹"; |
| | | |
| | | @Autowired private RedisCache redisCache; |
| | | @Autowired private CjStudentMapper studentMapper; |
| | | @Autowired private CjClassMapper classMapper; |
| | | @Autowired private CjMajorMapper majorMapper; |
| | | @Autowired private CjCollegeMapper collegeMapper; |
| | | @Autowired private MiniappTokenService tokenService; |
| | | @Autowired private MiniappCaptchaService captchaService; |
| | | |
| | | // ================================================================= |
| | | // 1. å¾å½¢éªè¯ç ï¼ä¸ç®¡çç«¯é£æ ¼ä¸è´ï¼key åç¼ç¬ç«ï¼ |
| | | // ================================================================= |
| | | @GetMapping("/captcha") |
| | | public AjaxResult captcha() |
| | | { |
| | | return captchaService.generate(); |
| | | } |
| | | |
| | | // ================================================================= |
| | | // 2. 注å = æ«ç级äºç»´ç èªå©å»ºæ¡£ï¼æåå³ç»å½ï¼ææºå·èªå¡«ï¼ä½æ¾åå¯ç éªè¯ææ®µï¼ |
| | | // ================================================================= |
| | | @PostMapping("/account/register") |
| | | public AjaxResult register(@RequestBody Map<String, String> body) |
| | | { |
| | | String bindCode = trim(body.get("bindCode")); |
| | | String classIdStr = trim(body.get("classId")); |
| | | String studentNo = trim(body.get("studentNo")); |
| | | String name = trim(body.get("name")); |
| | | String phone = trim(body.get("phone")); |
| | | String password = body.get("password"); |
| | | if (isEmpty(bindCode) && isEmpty(classIdStr)) return AjaxResult.error("è¯·éæ©æå¨ççº§ï¼ææ«æç级äºç»´ç è¿å
¥ï¼"); |
| | | if (isEmpty(studentNo) || isEmpty(name)) return AjaxResult.error("请è¾å
¥å¦å·åå§å"); |
| | | String capErr = captchaService.verify(body.get("code"), body.get("uuid")); |
| | | if (capErr != null) return AjaxResult.error(capErr); |
| | | String pwdErr = checkPwdRule(password, studentNo); |
| | | if (pwdErr != null) return AjaxResult.error(pwdErr); |
| | | if (isEmpty(phone) || !phone.matches(PHONE_RE)) return AjaxResult.error("è¯·å¡«åææºå·ï¼ç¨äºæ¾åå¯ç ï¼"); |
| | | |
| | | // ç级å®ä½ï¼æ«ç ä¼å
ï¼æªæ«ç åç¨å¦çèªéç classId |
| | | CjClass clazz; |
| | | if (!isEmpty(bindCode)) |
| | | { |
| | | clazz = findClassByBindCode(bindCode); |
| | | if (clazz == null) return AjaxResult.error("注åç æ ææå·²æ´æ¢ï¼è¯·åèå¸ç¡®è®¤æ¬çææ°äºç»´ç "); |
| | | } |
| | | else |
| | | { |
| | | Long classId; |
| | | try { classId = Long.valueOf(classIdStr); } |
| | | catch (NumberFormatException e) { return AjaxResult.error("æéççº§ä¸æ£ç¡®"); } |
| | | clazz = classMapper.selectCjClassByClassId(classId); |
| | | if (clazz == null) return AjaxResult.error("æéç级ä¸åå¨ï¼è¯·éæ°éæ©"); |
| | | } |
| | | if (!"0".equals(clazz.getStatus())) return AjaxResult.error("æ¬ç注åå·²æåï¼è¯·èç³»èå¸"); |
| | | |
| | | CjStudent exists = null; |
| | | List<CjStudent> matched = findRoster(studentNo, name); |
| | | if (matched.size() > 1) return AjaxResult.error(MULTI_MATCH_MSG); |
| | | if (!matched.isEmpty()) exists = matched.get(0); |
| | | if (exists != null && !isEmpty(studentMapper.selectPasswordByStudentId(exists.getStudentId()))) |
| | | { |
| | | return AjaxResult.error("该å¦å·å·²æ³¨åè¿ï¼è¯·ç´æ¥ç»å½ï¼å¿è®°å¯ç å¯ç¨âå¿è®°å¯ç âèªå©éç½®"); |
| | | } |
| | | |
| | | CjStudent student = exists; |
| | | if (student == null) |
| | | { |
| | | // å
¨æ°èªå©å»ºæ¡£ |
| | | student = new CjStudent(); |
| | | student.setClassId(clazz.getClassId()); |
| | | student.setStudentNo(studentNo); |
| | | student.setName(name); |
| | | student.setPhone(phone); |
| | | student.setStatus("0"); |
| | | student.setDelFlag("0"); |
| | | student.setCreateBy("self-register"); |
| | | try |
| | | { |
| | | studentMapper.insertCjStudent(student); |
| | | } |
| | | catch (org.springframework.dao.DuplicateKeyException e) |
| | | { |
| | | return AjaxResult.error("该å¦å·ä¸å§å已被注å"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // å½ä¸åéè®°å½ï¼å¦å岿°æ®ï¼ï¼æ¿æ´»å¹¶ææ¬æ¬¡éæ©ç级å½ä½ï¼ææºå·è¡¥é½ï¼å¤æ³¨çç |
| | | String trace = "[æ³¨åæ¿æ´» " + stamp() + "] ç级 â " + clazz.getClassName(); |
| | | CjStudent upd = new CjStudent(); |
| | | upd.setStudentId(student.getStudentId()); |
| | | upd.setClassId(clazz.getClassId()); |
| | | upd.setPhone(phone); |
| | | upd.setRemark(appendRemark(student.getRemark(), trace)); |
| | | upd.setUpdateBy("self-register"); |
| | | studentMapper.updateCjStudent(upd); |
| | | } |
| | | studentMapper.updateStudentPassword(student.getStudentId(), SecurityUtils.encryptPassword(password), "0", new Date()); |
| | | String token = tokenService.createSession(student.getStudentId()); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("token", token); |
| | | data.put("mustChange", false); |
| | | return AjaxResult.success("注åæå", data); |
| | | } |
| | | |
| | | /** |
| | | * å
¨é¨æ£å¸¸ç¶æç级ï¼ä¾æªæ«ç å¦çæ³¨åæ¶èªéï¼ï¼[{classId, label:'å¦é¢Â·ä¸ä¸Â·ç级'}] |
| | | */ |
| | | @GetMapping("/account/classes") |
| | | public AjaxResult classes() |
| | | { |
| | | List<CjClass> all = classMapper.selectCjClassList(new CjClass()); |
| | | Map<Long, CjMajor> majorMap = new LinkedHashMap<>(); |
| | | for (CjMajor m : majorMapper.selectCjMajorList(new CjMajor())) majorMap.put(m.getMajorId(), m); |
| | | Map<Long, CjCollege> collegeMap = new LinkedHashMap<>(); |
| | | for (CjCollege c : collegeMapper.selectCjCollegeList(new CjCollege())) collegeMap.put(c.getCollegeId(), c); |
| | | List<Map<String, Object>> out = new ArrayList<>(); |
| | | for (CjClass cl : all) |
| | | { |
| | | if (!"0".equals(cl.getStatus())) continue; |
| | | CjMajor m = majorMap.get(cl.getMajorId()); |
| | | CjCollege co = m == null ? null : collegeMap.get(m.getCollegeId()); |
| | | String label = ((co == null ? "" : co.getCollegeName() + "·") + (m == null ? "" : m.getMajorName() + "·") + cl.getClassName()); |
| | | Map<String, Object> row = new LinkedHashMap<>(); |
| | | row.put("classId", cl.getClassId()); |
| | | row.put("label", label); |
| | | out.add(row); |
| | | } |
| | | return AjaxResult.success(out); |
| | | } |
| | | |
| | | /** |
| | | * è§£ææ³¨åç â ç级信æ¯ï¼æ³¨å页å±ç¤º"ä½ æ£å¨å å
¥ï¼ÃÃå¦é¢ÃÃä¸ä¸ÃÃç"ï¼ |
| | | */ |
| | | @GetMapping("/account/resolve") |
| | | public AjaxResult resolve(@RequestParam("bindCode") String bindCode) |
| | | { |
| | | CjClass clazz = findClassByBindCode(trim(bindCode)); |
| | | if (clazz == null) return AjaxResult.error("äºç»´ç æ ææå·²æ´æ¢ï¼è¯·åèå¸ç¡®è®¤"); |
| | | if (!"0".equals(clazz.getStatus())) return AjaxResult.error("æ¬ç注åå·²æåï¼è¯·èç³»èå¸"); |
| | | Map<String, Object> out = new LinkedHashMap<>(); |
| | | out.put("classId", clazz.getClassId()); |
| | | out.put("className", clazz.getClassName()); |
| | | CjMajor m = clazz.getMajorId() == null ? null : majorMapper.selectCjMajorByMajorId(clazz.getMajorId()); |
| | | out.put("majorName", m == null ? "" : m.getMajorName()); |
| | | CjCollege co = (m == null || m.getCollegeId() == null) ? null : collegeMapper.selectCjCollegeByCollegeId(m.getCollegeId()); |
| | | out.put("collegeName", co == null ? "" : co.getCollegeName()); |
| | | return AjaxResult.success(out); |
| | | } |
| | | |
| | | /** |
| | | * éæ°ç»å®ç级ï¼ç»å½æï¼æ«æ°ç级ç ï¼ï¼å·²æäº¤è®°å½æå¿«ç
§ä¿çåç级å½å±ï¼æ¤å¤ä»
ç§»å¨å¦çå½åç级并çç |
| | | */ |
| | | @PostMapping("/account/rebind") |
| | | public AjaxResult rebind(@RequestBody Map<String, String> body, |
| | | @RequestHeader(value = "Authorization", required = false) String auth) |
| | | { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error(401, "æªç»å½æç»å½å·²è¿æ"); |
| | | CjStudent student = studentMapper.selectCjStudentByStudentId(sid); |
| | | if (student == null) return AjaxResult.error(401, "è´¦å·ä¸åå¨"); |
| | | CjClass target = findClassByBindCode(trim(body.get("bindCode"))); |
| | | if (target == null) return AjaxResult.error("äºç»´ç æ ææå·²æ´æ¢ï¼è¯·åèå¸ç¡®è®¤"); |
| | | if (!"0".equals(target.getStatus())) return AjaxResult.error("ç®æ ç级注åå·²æåï¼è¯·èç³»èå¸"); |
| | | if (target.getClassId().equals(student.getClassId())) return AjaxResult.error("ä½ å·²å¨è¯¥ççº§ï¼æ 鿢ç"); |
| | | |
| | | String oldClassName = ""; |
| | | if (student.getClassId() != null) |
| | | { |
| | | CjClass old = classMapper.selectCjClassByClassId(student.getClassId()); |
| | | oldClassName = old == null ? String.valueOf(student.getClassId()) : old.getClassName(); |
| | | } |
| | | String trace = "[æ¢ç " + stamp() + "] " + oldClassName + " â " + target.getClassName(); |
| | | CjStudent upd = new CjStudent(); |
| | | upd.setStudentId(sid); |
| | | upd.setClassId(target.getClassId()); |
| | | upd.setRemark(appendRemark(student.getRemark(), trace)); |
| | | upd.setUpdateBy("self-rebind"); |
| | | studentMapper.updateCjStudent(upd); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("className", target.getClassName()); |
| | | return AjaxResult.success("å·²æ¢çï¼æ¤åå·²æäº¤ç表åä»å½å±åç级", data); |
| | | } |
| | | |
| | | // ================================================================= |
| | | // 3. ç»å½ï¼å¦å· + å§å + å¯ç ï¼æåç¾å tokenï¼ |
| | | // ================================================================= |
| | | @PostMapping("/account/login") |
| | | public AjaxResult login(@RequestBody Map<String, String> body) |
| | | { |
| | | String studentNo = trim(body.get("studentNo")); |
| | | String name = trim(body.get("name")); |
| | | String password = body.get("password"); |
| | | if (isEmpty(studentNo) || isEmpty(name) || isEmpty(password)) |
| | | { |
| | | return AjaxResult.error("请填å宿´çç»å½ä¿¡æ¯"); |
| | | } |
| | | String capErr = captchaService.verify(body.get("code"), body.get("uuid")); |
| | | if (capErr != null) return AjaxResult.error(capErr); |
| | | |
| | | String lockKey = MiniappTokenService.pwdErrKey(studentNo, name); |
| | | if (captchaService.failCount(lockKey) >= PWD_ERR_MAX) |
| | | { |
| | | return AjaxResult.error("å¯ç é误次æ°è¿å¤ï¼è¯· 10 åéååè¯ï¼æä½¿ç¨âå¿è®°å¯ç â"); |
| | | } |
| | | List<CjStudent> matched = findRoster(studentNo, name); |
| | | if (matched.size() > 1) return AjaxResult.error(MULTI_MATCH_MSG); |
| | | if (matched.isEmpty()) |
| | | { |
| | | return AjaxResult.error("å¦å·æå§å䏿£ç¡®"); |
| | | } |
| | | CjStudent student = matched.get(0); |
| | | String stored = studentMapper.selectPasswordByStudentId(student.getStudentId()); |
| | | if (isEmpty(stored)) |
| | | { |
| | | return AjaxResult.error("该账å·å°æªæ³¨åï¼è¯·å
注å"); |
| | | } |
| | | if (!SecurityUtils.matchesPassword(password, stored)) |
| | | { |
| | | captchaService.incrFail(lockKey, PWD_ERR_MAX); |
| | | return AjaxResult.error("å¦å·ãå§åæå¯ç 䏿£ç¡®"); |
| | | } |
| | | if (!"0".equals(student.getStatus())) |
| | | { |
| | | return AjaxResult.error("ä½ çè´¦å·å·²åç¨ï¼è¯·èç³»ç级管ç人"); |
| | | } |
| | | captchaService.clearFail(lockKey); |
| | | studentMapper.updateStudentLoginDate(student.getStudentId(), new Date()); |
| | | String token = tokenService.createSession(student.getStudentId()); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("token", token); |
| | | data.put("mustChange", "1".equals(student.getPwdResetFlag())); |
| | | return AjaxResult.success("ç»å½æå", data); |
| | | } |
| | | |
| | | // ================================================================= |
| | | // 4. å¿è®°å¯ç = 身份ä¸è¦ç´ èªå©éç½®ï¼å¦å· + å§å + è±ååç»è®°ææºå·ï¼ |
| | | // ================================================================= |
| | | @PostMapping("/account/reset") |
| | | public AjaxResult reset(@RequestBody Map<String, String> body) |
| | | { |
| | | String studentNo = trim(body.get("studentNo")); |
| | | String name = trim(body.get("name")); |
| | | String phone = trim(body.get("phone")); |
| | | String newPassword = body.get("newPassword"); |
| | | if (isEmpty(studentNo) || isEmpty(name) || isEmpty(phone) || isEmpty(newPassword)) |
| | | { |
| | | return AjaxResult.error("请填å宿´çæ¾åä¿¡æ¯"); |
| | | } |
| | | String capErr = captchaService.verify(body.get("code"), body.get("uuid")); |
| | | if (capErr != null) return AjaxResult.error(capErr); |
| | | String lockKey = MiniappTokenService.resetErrKey(studentNo, name); |
| | | if (captchaService.failCount(lockKey) >= RESET_ERR_MAX) |
| | | { |
| | | return AjaxResult.error("èªå©éç½®å°è¯æ¬¡æ°è¿å¤ï¼è¯·èç³»ç级管ç人"); |
| | | } |
| | | String pwdErr = checkPwdRule(newPassword, studentNo); |
| | | if (pwdErr != null) return AjaxResult.error(pwdErr); |
| | | |
| | | List<CjStudent> matched = findRoster(studentNo, name); |
| | | if (matched.size() > 1) return AjaxResult.error(FAIL_IDENTITY_MSG); // 䏿³é²å¤å½ä¸ç»è |
| | | CjStudent student = matched.isEmpty() ? null : matched.get(0); |
| | | boolean ok = student != null && !isEmpty(student.getPhone()) && phone.equals(student.getPhone().trim()) |
| | | && "0".equals(student.getStatus()); |
| | | if (!ok) |
| | | { |
| | | captchaService.incrFail(lockKey, RESET_ERR_MAX); |
| | | return AjaxResult.error(FAIL_IDENTITY_MSG); |
| | | } |
| | | boolean firstActivate = isEmpty(studentMapper.selectPasswordByStudentId(student.getStudentId())); |
| | | studentMapper.updateStudentPassword(student.getStudentId(), SecurityUtils.encryptPassword(newPassword), "0", |
| | | firstActivate ? new Date() : null); |
| | | tokenService.invalidateAll(student.getStudentId()); |
| | | captchaService.clearFail(lockKey); |
| | | captchaService.clearFail(MiniappTokenService.pwdErrKey(studentNo, name)); |
| | | return AjaxResult.success("å¯ç éç½®æåï¼è¯·ä½¿ç¨æ°å¯ç ç»å½"); |
| | | } |
| | | |
| | | // ================================================================= |
| | | // 5. ä¿®æ¹å¯ç ï¼ç»å½æï¼ä½åºæ§ä¼è¯ãç¾åæ° tokenï¼å³âæ¹å¯è¸¢å
¶ä»è®¾å¤âï¼ |
| | | // ================================================================= |
| | | @PostMapping("/account/change") |
| | | public AjaxResult change(@RequestBody Map<String, String> body, |
| | | @RequestHeader(value = "Authorization", required = false) String auth) |
| | | { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error(401, "æªç»å½æç»å½å·²è¿æ"); |
| | | String oldPassword = body.get("oldPassword"); |
| | | String newPassword = body.get("newPassword"); |
| | | if (isEmpty(oldPassword) || isEmpty(newPassword)) |
| | | { |
| | | return AjaxResult.error("请填ååå¯ç 䏿°å¯ç "); |
| | | } |
| | | String changeLock = CHANGE_ERR_KEY + sid; |
| | | if (captchaService.failCount(changeLock) >= CHANGE_ERR_MAX) |
| | | { |
| | | return AjaxResult.error("åå¯ç é误次æ°è¿å¤ï¼è¯· 10 åéååè¯"); |
| | | } |
| | | CjStudent student = studentMapper.selectCjStudentByStudentId(sid); |
| | | if (student == null) return AjaxResult.error(401, "è´¦å·ä¸åå¨"); |
| | | String stored = studentMapper.selectPasswordByStudentId(sid); |
| | | if (isEmpty(stored) || !SecurityUtils.matchesPassword(oldPassword, stored)) |
| | | { |
| | | captchaService.incrFail(changeLock, CHANGE_ERR_MAX); |
| | | return AjaxResult.error("åå¯ç 䏿£ç¡®"); |
| | | } |
| | | if (oldPassword.equals(newPassword)) |
| | | { |
| | | return AjaxResult.error("æ°å¯ç ä¸è½ä¸åå¯ç ç¸å"); |
| | | } |
| | | String pwdErr = checkPwdRule(newPassword, student.getStudentNo()); |
| | | if (pwdErr != null) return AjaxResult.error(pwdErr); |
| | | |
| | | studentMapper.updateStudentPassword(sid, SecurityUtils.encryptPassword(newPassword), "0", null); |
| | | captchaService.clearFail(changeLock); |
| | | tokenService.invalidateAll(sid); |
| | | String token = tokenService.createSession(sid); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("token", token); |
| | | return AjaxResult.success("å¯ç ä¿®æ¹æåï¼å
¶ä»è®¾å¤å·²éåºç»å½", data); |
| | | } |
| | | |
| | | // ================================================================= |
| | | // ç§æå·¥å
· |
| | | // ================================================================= |
| | | |
| | | /** è±ååå¹é
ï¼æ å¦å·+å§åï¼ï¼è¿åå½ä¸å表ï¼å¯è½ 0/1/夿¡ï¼ï¼null = åé®å¤æ¡ä¸æ æ³ç±è°ç¨æ¹æ¶æ§ */ |
| | | private List<CjStudent> findRoster(String studentNo, String name) |
| | | { |
| | | CjStudent q = new CjStudent(); |
| | | q.setStudentNo(studentNo); |
| | | List<CjStudent> list = studentMapper.selectCjStudentList(q); |
| | | return list.stream().filter(s -> name.equals(s.getName())).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** ç级注åç â ç级ï¼å¤ç¨å»ºè¡¨é¢çç bind_code åï¼32 ä½éæºç ä¸å¯æä¸¾ï¼ */ |
| | | private CjClass findClassByBindCode(String bindCode) |
| | | { |
| | | if (isEmpty(bindCode)) return null; |
| | | CjClass q = new CjClass(); |
| | | q.setBindCode(bindCode); |
| | | List<CjClass> list = classMapper.selectCjClassList(q); |
| | | return list.isEmpty() ? null : list.get(0); |
| | | } |
| | | |
| | | /** ççæ¶é´æ³ */ |
| | | private String stamp() |
| | | { |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()); |
| | | } |
| | | |
| | | /** 夿³¨è¿½å æµæ°´ï¼éé¿ä¿æ¤ï¼remark å varchar(500)ï¼ */ |
| | | private String appendRemark(String old, String line) |
| | | { |
| | | String base = old == null ? "" : old; |
| | | String merged = base.isEmpty() ? line : base + "ï¼" + line; |
| | | return merged.length() > 500 ? merged.substring(merged.length() - 500) : merged; |
| | | } |
| | | |
| | | /** å¯ç è§åæ ¡éªï¼éè¿è¿å null */ |
| | | private String checkPwdRule(String password, String studentNo) |
| | | { |
| | | if (isEmpty(password)) return "请è¾å
¥å¯ç "; |
| | | if (!password.matches(PWD_RULE_RE)) return "å¯ç 须为 8-20 ä½ï¼ä¸åæ¶å
å«åæ¯åæ°å"; |
| | | if (password.equals(studentNo)) return "å¯ç ä¸è½ä¸å¦å·ç¸å"; |
| | | return null; |
| | | } |
| | | |
| | | /** ä¸ MiniappController ç¸åå£å¾ç token æ ¡éª */ |
| | | private Long resolveStudentId(String auth) |
| | | { |
| | | if (auth == null || !auth.startsWith("Bearer ")) return null; |
| | | Object val = redisCache.getCacheObject(MiniappTokenService.TOKEN_PREFIX + auth.substring(7)); |
| | | if (val instanceof Long) |
| | | { |
| | | Long sid = (Long) val; |
| | | return sid > 0 ? sid : null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String trim(String s) { return s == null ? null : s.trim(); } |
| | | private boolean isEmpty(String s) { return s == null || s.trim().isEmpty(); } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.miniapp; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.imageio.ImageIO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import jakarta.annotation.Resource; |
| | | |
| | | /** |
| | | * å¦ç端å¾å½¢éªè¯ç ï¼çæ + 䏿¬¡æ§æ¶è´¹æ ¡éªã |
| | | * ä¾ MiniappAccountControllerï¼ç»å½/注å/æ¾åï¼ä¸ MiniappControllerï¼ç»å®/弿¾ç»è®°ï¼å
±ç¨ï¼ |
| | | * å µæ»"æ éªè¯ç æä¸¾è±åå"çå¿åçç ´é¢ã |
| | | */ |
| | | @Service |
| | | public class MiniappCaptchaService |
| | | { |
| | | /** å¦ç端ç¬ç«éªè¯ç key åç¼ï¼ä¸ä¸ç®¡ç端 captcha_codes: äºä¸²ï¼ */ |
| | | public static final String CAPTCHA_KEY = "miniapp_captcha:"; |
| | | |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | @Autowired private RedisCache redisCache; |
| | | @Autowired private ISysConfigService configService; |
| | | |
| | | /** çæéªè¯ç ï¼è¿å { captchaEnabled, uuid, img }ï¼å¼å
³ä¸ç®¡ç端ä¸è´ */ |
| | | public AjaxResult generate() |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | ajax.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return ajax; |
| | | } |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String capStr; |
| | | String code; |
| | | BufferedImage image; |
| | | if ("math".equals(RuoYiConfig.getCaptchaType())) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | redisCache.setCacheObject(CAPTCHA_KEY + uuid, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | try (FastByteArrayOutputStream os = new FastByteArrayOutputStream()) |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", Base64.encode(os.toByteArray())); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error("éªè¯ç çæå¤±è´¥"); |
| | | } |
| | | return ajax; |
| | | } |
| | | |
| | | /** 䏿¬¡æ§æ ¡éªï¼éè¿è¿å nullï¼å¦åè¿åéè¯¯æ¶æ¯ï¼å
å key é²éæ¾ï¼ */ |
| | | public String verify(String code, String uuid) |
| | | { |
| | | if (!configService.selectCaptchaEnabled()) return null; |
| | | if (code == null || code.trim().isEmpty() || uuid == null || uuid.trim().isEmpty()) return "请è¾å
¥å¾å½¢éªè¯ç "; |
| | | String key = CAPTCHA_KEY + uuid; |
| | | Object expected = redisCache.getCacheObject(key); |
| | | if (expected == null) return "éªè¯ç 已失æï¼è¯·å·æ°åéè¯"; |
| | | redisCache.deleteObject(key); |
| | | if (!code.trim().equalsIgnoreCase(expected.toString())) return "éªè¯ç é误"; |
| | | return null; |
| | | } |
| | | |
| | | /** 失败计æ°ï¼åºå® 10 åéçªå£å
累计ï¼é¦æ¬¡å¤±è´¥è®¾å®çªå£ï¼åç»åªå¢éï¼ä¸æ»åç»å½ï¼ */ |
| | | public int incrFail(String key, int max) |
| | | { |
| | | long cnt = redisCache.redisTemplate.opsForValue().increment(key); |
| | | if (cnt == 1L) |
| | | { |
| | | redisCache.redisTemplate.expire(key, 10, TimeUnit.MINUTES); |
| | | } |
| | | return (int) cnt; |
| | | } |
| | | |
| | | public int failCount(String key) |
| | | { |
| | | Object v = redisCache.getCacheObject(key); |
| | | return v instanceof Number ? ((Number) v).intValue() : 0; |
| | | } |
| | | |
| | | public void clearFail(String key) |
| | | { |
| | | redisCache.deleteObject(key); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.miniapp; |
| | | |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.system.domain.CjClass; |
| | | import com.ruoyi.system.domain.CjCollege; |
| | | import com.ruoyi.system.domain.CjFillRecord; |
| | | import com.ruoyi.system.domain.CjFillTask; |
| | | import com.ruoyi.system.domain.CjMajor; |
| | | import com.ruoyi.system.domain.CjStudent; |
| | | import com.ruoyi.system.domain.CjStudentBind; |
| | | import com.ruoyi.system.mapper.CjClassMapper; |
| | | import com.ruoyi.system.mapper.CjCollegeMapper; |
| | | import com.ruoyi.system.mapper.CjFillRecordMapper; |
| | | import com.ruoyi.system.mapper.CjFillTaskMapper; |
| | | import com.ruoyi.system.mapper.CjMajorMapper; |
| | | import com.ruoyi.system.mapper.CjStudentBindMapper; |
| | | import com.ruoyi.system.mapper.CjStudentMapper; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.net.URI; |
| | | import java.net.http.HttpClient; |
| | | import java.net.http.HttpRequest; |
| | | import java.net.http.HttpResponse; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * å¦ç端ï¼å°ç¨åº/MiniAppï¼æ¥å£æ§å¶å¨ ââ 填表任å¡é©±å¨å¡«æ¥ |
| | | * ä¸ä¾èµ RuoYi æéä½ç³»ï¼ç¨ Redis èªå®ä¹ token ä¼è¯ã |
| | | * |
| | | * å¡«æ¥å¯¹è±¡ï¼å¡«è¡¨ä»»å¡(cj_fill_task)åå¸åå¨å¡«æ¥çªå£å
ãä¸è¯¥çç级å¨ä»»å¡èå´å
çä»»å¡ï¼ |
| | | * 表åæä»»å¡ form schema å¨ææ¸²æï¼è®°å½å cj_fill_recordï¼å¦çÃä»»å¡å¯ä¸ï¼0è稿/1å·²æäº¤ï¼ã |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/miniapp") |
| | | public class MiniappController { |
| | | |
| | | private static final String TOKEN_PREFIX = "miniapp:token:"; |
| | | /** æªç»å®ç»å½æ¶ï¼ä¸´æ¶æ openid åè¿éï¼ç»å®æ¥å£æ token 读åå¹¶çæ£è½åº */ |
| | | private static final String OPENID_PREFIX = "miniapp:openid:"; |
| | | private static final Logger log = LoggerFactory.getLogger(MiniappController.class); |
| | | private static final String PHONE_RE = "^1[3-9]\\d{9}$"; |
| | | /** ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç ï¼18ä½ï¼å¤§å忝+æ°åï¼ä¸å« I/O/Z/S/V */ |
| | | private static final String CREDIT_CODE_RE = "^[0-9A-HJ-NPQRTUWXY]{18}$"; |
| | | |
| | | @Value("${wechat.appid:}") private String wxAppid; |
| | | @Value("${wechat.secret:}") private String wxSecret; |
| | | |
| | | @Autowired private RedisCache redisCache; |
| | | @Autowired private CjStudentMapper studentMapper; |
| | | @Autowired private CjStudentBindMapper bindMapper; |
| | | @Autowired private CjClassMapper classMapper; |
| | | @Autowired private CjMajorMapper majorMapper; |
| | | @Autowired private CjCollegeMapper collegeMapper; |
| | | @Autowired private CjFillTaskMapper taskMapper; |
| | | @Autowired private CjFillRecordMapper recordMapper; |
| | | @Autowired private com.ruoyi.system.service.MiniappTokenService tokenService; |
| | | @Autowired private MiniappCaptchaService captchaService; |
| | | @Autowired private com.ruoyi.system.service.ISysDictTypeService dictTypeService; |
| | | |
| | | private final ObjectMapper om = new ObjectMapper(); |
| | | |
| | | /** ææ¡åå
¸ç±»åï¼dict_label=ç¨éé®åï¼dict_value=ææ¡æ£æï¼ï¼è§ skill/sql/15_cj_title_dict.sql */ |
| | | private static final String TITLE_DICT_TYPE = "cj_fill_title"; |
| | | |
| | | // ========== 0. ç«ç¹ææ¡ï¼åå
¸é©±å¨ï¼ç»å½/注å页æªç»å½ä¹è¦æ¾ç¤ºï¼æ
é /miniapp/** å¿åæ¾è¡ï¼ ========== |
| | | @GetMapping("/site-titles") |
| | | public AjaxResult siteTitles() { |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("platformTitle", dictText("平尿 é¢", "产æèåå®è·µæå¦ç®¡çå¹³å°")); |
| | | data.put("platformSubtitle", dictText("å¹³å°å¯æ é¢", "æ±èåè´¸èä¸å¦é¢ · å¦çå®è·µæå¦ä¿¡æ¯å¡«æ¥")); |
| | | data.put("loginSubtitle", dictText("ç»å½é¡µå¯æ é¢", "产æèåå®è·µæå¦ç®¡çå¹³å° Â· å¦çè´¦å·")); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | /** |
| | | * åææ¡åå
¸ä¸æä¸ªç¨éçæ£æï¼åå
¸é¡¹ç¼ºå¤±/被æ¸
空æ¶åéå
ç½®é»è®¤ï¼é¡µé¢ä¸ä¼ç©ºç½ã |
| | | * ç¨ selectDictDataByType èé DictUtilsï¼åè
ç¼åæªå½ä¸ä¼åæºæ°æ®åºå¹¶è¡¥ç¼åï¼ |
| | | * 线ä¸è·å® 15 å·èæ¬æ éé坿æå¨å·ç¼åå³å¯çæã |
| | | */ |
| | | private String dictText(String label, String fallback) { |
| | | try { |
| | | List<SysDictData> datas = dictTypeService.selectDictDataByType(TITLE_DICT_TYPE); |
| | | if (datas != null) { |
| | | for (SysDictData d : datas) { |
| | | if (label.equals(d.getDictLabel())) { |
| | | String v = d.getDictValue(); |
| | | if (v != null && !v.trim().isEmpty()) return v.trim(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.warn("è¯»åææ¡åå
¸å¤±è´¥ label={}ï¼åéé»è®¤ææ¡", label, e); |
| | | } |
| | | return fallback; |
| | | } |
| | | |
| | | // ========== 1. ç»å½ï¼openid ééå·²ä¸çº¿ï¼è±åååºé¤åç»ä¸èµ°è´¦å·å¯ç ä½ç³»ï¼ ========== |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody Map<String, String> params) { |
| | | return AjaxResult.error("该ééå·²åç¨ï¼è¯·éè¿ç级äºç»´ç 注å并使ç¨è´¦å·å¯ç ç»å½"); |
| | | } |
| | | |
| | | /** æ§å¾®ä¿¡ç»å½å®ç°ï¼ä¿ç代ç å¤å°ç¨åºä¸çº¿æ¶æ¹é ï¼æä¸æ¥æµéï¼ */ |
| | | private AjaxResult legacyWxLogin(Map<String, String> params) { |
| | | String code = params.getOrDefault("code", ""); |
| | | String openid; |
| | | if ("H5_DEV_CODE".equals(code) || code.isEmpty()) { |
| | | // æ§èè°æ¹å¼ï¼éæºï¼æ¯æ¬¡ä¸åï¼ä»
ç¨äºåè½è°è¯ï¼ |
| | | openid = "mock-openid-" + UUID.randomUUID().toString().substring(0, 8); |
| | | } else if (code.startsWith("H5_DEV_")) { |
| | | // H5 稳å®èè°ï¼åä¸ä¸ªâ设å¤ç âæ°¸è¿å¾å°åä¸ openid â ç»å®å¯è¢«è®°ä½ |
| | | openid = "h5mock-" + md5Hex(code); |
| | | } else { |
| | | openid = code2session(code); |
| | | if (openid == null) return AjaxResult.error("微信ç»å½å¤±è´¥ï¼è¯·ç¨åéè¯"); |
| | | } |
| | | CjStudentBind q = new CjStudentBind(); |
| | | q.setOpenidHash(openid); |
| | | List<CjStudentBind> list = bindMapper.selectCjStudentBindList(q); |
| | | if (!list.isEmpty()) { |
| | | String token = UUID.randomUUID().toString().replace("-", ""); |
| | | redisCache.setCacheObject(TOKEN_PREFIX + token, list.get(0).getStudentId(), 24, TimeUnit.HOURS); |
| | | tokenService.registerSession(list.get(0).getStudentId(), token); // ç»è®°ååç´¢å¼ï¼ä¾æ¹å¯/强å¶ä¸çº¿ä½åº |
| | | return AjaxResult.success("success", Map.of("token", token, "bound", true)); |
| | | } |
| | | String token = UUID.randomUUID().toString().replace("-", ""); |
| | | redisCache.setCacheObject(TOKEN_PREFIX + token, -1L, 30, TimeUnit.MINUTES); |
| | | // è®°ä½æ¬æ¬¡å¾®ä¿¡ openidï¼ä¾ç»å®æ¥å£ä½¿ç¨ï¼ä¿è¯â微信身份 â å¦å·âçæ£ç»å¨ä¸èµ· |
| | | redisCache.setCacheObject(OPENID_PREFIX + token, openid, 30, TimeUnit.MINUTES); |
| | | return AjaxResult.success("need_bind", Map.of("token", token, "bound", false)); |
| | | } |
| | | |
| | | // ========== 2. ç»å®å¦ç身份ï¼è±ååééå·²ä¸çº¿ï¼ä»
ä¿çæ¹æ³ä½å¤æ¥ï¼ ========== |
| | | @PostMapping("/bind") |
| | | public AjaxResult bind(@RequestBody Map<String, String> params, |
| | | @RequestHeader(value = "Authorization", required = false) String auth) { |
| | | return AjaxResult.error("该ééå·²åç¨ï¼è¯·éè¿ç级äºç»´ç 注å并使ç¨è´¦å·å¯ç ç»å½"); |
| | | } |
| | | |
| | | private AjaxResult legacyBind(Map<String, String> params, String auth) { |
| | | String studentNo = params.get("studentNo") == null ? null : params.get("studentNo").trim(); |
| | | String name = params.get("name") == null ? null : params.get("name").trim(); |
| | | if (studentNo == null || studentNo.isEmpty() || name == null || name.isEmpty()) return AjaxResult.error("请æä¾å¦å·åå§å"); |
| | | String capErr = captchaService.verify(params.get("code"), params.get("uuid")); |
| | | if (capErr != null) return AjaxResult.error(capErr); |
| | | |
| | | CjStudent qs = new CjStudent(); |
| | | qs.setStudentNo(studentNo); |
| | | List<CjStudent> students = studentMapper.selectCjStudentList(qs); |
| | | List<CjStudent> matched = new ArrayList<>(); |
| | | for (CjStudent s : students) { if (name.equals(s.getName())) matched.add(s); } |
| | | // ç»ä¸ææ¡ï¼ä¸åºå"å¦å·ä¸åå¨/å§åä¸å¹é
"ï¼é
åéªè¯ç å µä½æ 鍿§æä¸¾ |
| | | if (matched.isEmpty()) return AjaxResult.error("å¦å·æå§åä¸å¹é
ï¼è¯·æ ¸å¯¹æèç³»ç级管ç人"); |
| | | if (matched.size() > 1) return AjaxResult.error("åå¨ç¸åå¦å·ä¸å§åçå¤åå¦çï¼è¯·èç³»ç级管çäººæ ¸å¯¹"); |
| | | CjStudent student = matched.get(0); |
| | | if (!"0".equals(student.getStatus())) return AjaxResult.error("ä½ çè´¦å·å·²åç¨ï¼è¯·èç³»ç级管ç人"); |
| | | String existPwd = studentMapper.selectPasswordByStudentId(student.getStudentId()); |
| | | if (existPwd != null && !existPwd.isEmpty()) return AjaxResult.error("è´¦å·å·²æ¿æ´»ï¼è¯·ä½¿ç¨å¯ç ç»å½"); |
| | | |
| | | // ç»å®èº«ä»½ï¼ä¼å
ç¨âæ¬æ¬¡ç»å½âè®°å½ä¸æ¥ç微信 openidï¼çå®å¾®ä¿¡ï¼ï¼æ ç»å½ææ¶åéå mock |
| | | String openid = openidOfToken(auth); |
| | | if (openid == null) openid = params.getOrDefault("openid", "mock-openid-" + UUID.randomUUID().toString().substring(0, 8)); |
| | | |
| | | CjStudentBind qb = new CjStudentBind(); |
| | | qb.setStudentId(student.getStudentId()); |
| | | List<CjStudentBind> existsList = bindMapper.selectCjStudentBindList(qb); |
| | | CjStudentBind exists = existsList.isEmpty() ? null : existsList.get(0); |
| | | if (exists != null) { |
| | | exists.setOpenidHash(openid); |
| | | bindMapper.updateCjStudentBind(exists); |
| | | } else { |
| | | CjStudentBind bind = new CjStudentBind(); |
| | | bind.setStudentId(student.getStudentId()); |
| | | bind.setOpenidHash(openid); |
| | | bind.setBindChannel("1"); |
| | | bind.setStatus("0"); |
| | | bindMapper.insertCjStudentBind(bind); |
| | | } |
| | | String token = UUID.randomUUID().toString().replace("-", ""); |
| | | redisCache.setCacheObject(TOKEN_PREFIX + token, student.getStudentId(), 24, TimeUnit.HOURS); |
| | | tokenService.registerSession(student.getStudentId(), token); // ç»è®°ååç´¢å¼ï¼ä¾æ¹å¯/强å¶ä¸çº¿ä½åº |
| | | return AjaxResult.success("ç»å®æå", Map.of("token", token, "studentId", student.getStudentId())); |
| | | } |
| | | |
| | | // ========== 2.5 弿¾ç»è®°ééï¼å·²ä¸çº¿ï¼å¦çç»ä¸ç»ççº§ç æ³¨åï¼æ³¨åèªéç级走 /miniapp/account/classesï¼ ========== |
| | | |
| | | @GetMapping("/registerClasses") |
| | | public AjaxResult registerClasses() { |
| | | return AjaxResult.error("该ééå·²åç¨ï¼è¯·éè¿ç级äºç»´ç 注å并使ç¨è´¦å·å¯ç ç»å½"); |
| | | } |
| | | |
| | | /** æ§å¼æ¾ç»è®°ç级å表ï¼ä¿ç代ç 夿¥ï¼ä¸åæ¥æµéï¼ */ |
| | | private AjaxResult legacyRegisterClasses() { |
| | | java.util.Set<Long> openClassIds = new java.util.HashSet<>(); |
| | | CjFillTask q = new CjFillTask(); |
| | | q.setStatus("1"); |
| | | List<CjFillTask> tasks = taskMapper.selectCjFillTaskList(q); |
| | | if (tasks != null) { |
| | | for (CjFillTask t : tasks) { |
| | | if ("1".equals(t.getRangeMode())) { |
| | | openClassIds.addAll(scopeClassIds(t)); |
| | | } |
| | | } |
| | | } |
| | | List<Map<String, Object>> out = new ArrayList<>(); |
| | | if (!openClassIds.isEmpty()) { |
| | | // å
¨éç级/ä¸ä¸/å¦é¢ååç§°æ å° |
| | | Map<Long, CjClass> classMap = new LinkedHashMap<>(); |
| | | List<CjClass> allClasses = classMapper.selectCjClassList(new CjClass()); |
| | | if (allClasses != null) for (CjClass cl : allClasses) classMap.put(cl.getClassId(), cl); |
| | | Map<Long, CjMajor> majorMap = new LinkedHashMap<>(); |
| | | List<CjMajor> allMajors = majorMapper.selectCjMajorList(new CjMajor()); |
| | | if (allMajors != null) for (CjMajor m : allMajors) majorMap.put(m.getMajorId(), m); |
| | | Map<Long, CjCollege> collegeMap = new LinkedHashMap<>(); |
| | | List<CjCollege> allColleges = collegeMapper.selectCjCollegeList(new CjCollege()); |
| | | if (allColleges != null) for (CjCollege c : allColleges) collegeMap.put(c.getCollegeId(), c); |
| | | |
| | | for (CjClass cl : classMap.values()) { |
| | | if (!openClassIds.contains(cl.getClassId())) continue; |
| | | CjMajor m = majorMap.get(cl.getMajorId()); |
| | | CjCollege co = (m == null) ? null : collegeMap.get(m.getCollegeId()); |
| | | String label = (co == null ? "" : co.getCollegeName()) + "·" |
| | | + (m == null ? "" : m.getMajorName()) + "·" + cl.getClassName(); |
| | | Map<String, Object> row = new LinkedHashMap<>(); |
| | | row.put("classId", cl.getClassId()); |
| | | row.put("label", label); |
| | | out.add(row); |
| | | } |
| | | } |
| | | return AjaxResult.success(Map.of("classes", out)); |
| | | } |
| | | |
| | | /** |
| | | * èªç»è®°å»ºæ¡£ï¼å¼æ¾ç»è®°å·²ä¸çº¿ï¼æ³¨åç»ä¸èµ° /miniapp/account/register + ç级ç ï¼ |
| | | */ |
| | | @PostMapping("/register") |
| | | public AjaxResult register(@RequestBody Map<String, String> params) { |
| | | return AjaxResult.error("该ééå·²åç¨ï¼è¯·éè¿ç级äºç»´ç 注å"); |
| | | } |
| | | |
| | | private AjaxResult legacyOpenRegister(Map<String, String> params) { |
| | | String studentNo = params.get("studentNo"); |
| | | String name = params.get("name"); |
| | | String phone = params.get("phone"); |
| | | Long classId = params.get("classId") == null ? null : Long.valueOf(params.get("classId")); |
| | | if (classId == null || isEmpty(studentNo) || isEmpty(name)) { |
| | | return AjaxResult.error("è¯·å®æ´å¡«å ç级/å¦å·/å§å"); |
| | | } |
| | | String capErr = captchaService.verify(params.get("code"), params.get("uuid")); |
| | | if (capErr != null) return AjaxResult.error(capErr); |
| | | CjClass clazz = classId == null ? null : classMapper.selectCjClassByClassId(classId); |
| | | if (clazz == null) return AjaxResult.error("æéç级ä¸åå¨"); |
| | | |
| | | CjStudent dup = findByClassAndNo(classId, studentNo); |
| | | CjStudent student; |
| | | if (dup != null) { |
| | | if (!name.equals(dup.getName())) return AjaxResult.error("该çå·²åå¨è¯¥å¦å·ä¸å§åä¸ä¸è´ï¼è¯·æ ¸å¯¹"); |
| | | // 已设置ç»å½å¯ç çå¦çä¸è½åç»å¼æ¾ç»è®°å
坿¿ token |
| | | String dupPwd = studentMapper.selectPasswordByStudentId(dup.getStudentId()); |
| | | if (dupPwd != null && !dupPwd.isEmpty()) return AjaxResult.error("è´¦å·å·²æ¿æ´»ï¼è¯·ä½¿ç¨å¯ç ç»å½"); |
| | | student = dup; |
| | | } else { |
| | | CjStudent s = new CjStudent(); |
| | | s.setClassId(classId); |
| | | s.setStudentNo(studentNo.trim()); |
| | | s.setName(name.trim()); |
| | | s.setPhone(isEmpty(phone) ? null : phone.trim()); |
| | | s.setStatus("0"); |
| | | s.setDelFlag("0"); |
| | | studentMapper.insertCjStudent(s); |
| | | student = s; |
| | | } |
| | | |
| | | // åå
¥å¾®ä¿¡ç»å®å¹¶ä¸å token |
| | | CjStudentBind qb = new CjStudentBind(); |
| | | qb.setStudentId(student.getStudentId()); |
| | | List<CjStudentBind> existsList = bindMapper.selectCjStudentBindList(qb); |
| | | CjStudentBind exists = existsList.isEmpty() ? null : existsList.get(0); |
| | | String openid = "mock-openid-" + UUID.randomUUID().toString().substring(0, 8); |
| | | if (exists != null) { |
| | | exists.setOpenidHash(openid); |
| | | bindMapper.updateCjStudentBind(exists); |
| | | } else { |
| | | CjStudentBind bind = new CjStudentBind(); |
| | | bind.setStudentId(student.getStudentId()); |
| | | bind.setOpenidHash(openid); |
| | | bind.setBindChannel("1"); |
| | | bind.setStatus("0"); |
| | | bindMapper.insertCjStudentBind(bind); |
| | | } |
| | | String token = UUID.randomUUID().toString().replace("-", ""); |
| | | redisCache.setCacheObject(TOKEN_PREFIX + token, student.getStudentId(), 24, TimeUnit.HOURS); |
| | | tokenService.registerSession(student.getStudentId(), token); // ç»è®°ååç´¢å¼ï¼ä¾æ¹å¯/强å¶ä¸çº¿ä½åº |
| | | return AjaxResult.success("ç»è®°æå", Map.of("token", token, "studentId", student.getStudentId())); |
| | | } |
| | | |
| | | private CjStudent findByClassAndNo(Long classId, String studentNo) { |
| | | CjStudent q = new CjStudent(); |
| | | q.setClassId(classId); |
| | | q.setStudentNo(studentNo.trim()); |
| | | List<CjStudent> list = studentMapper.selectCjStudentList(q); |
| | | return list.isEmpty() ? null : list.get(0); |
| | | } |
| | | |
| | | private List<Long> scopeClassIds(CjFillTask task) { |
| | | List<Long> ids = new ArrayList<>(); |
| | | try { |
| | | Map<String, Object> root = om.readValue(task.getScopeJson(), new TypeReference<Map<String, Object>>() { }); |
| | | Object o = root.get("classIds"); |
| | | if (o instanceof List) { |
| | | for (Object it : (List<?>) o) ids.add(((Number) it).longValue()); |
| | | } |
| | | } catch (Exception ignore) { } |
| | | return ids; |
| | | } |
| | | |
| | | private boolean isEmpty(String s) { return s == null || s.trim().isEmpty(); } |
| | | |
| | | // ========== 3. æçä¿¡æ¯ï¼å«ç级/ä¸ä¸/å¦é¢ + è´¦å·ç¶æï¼ ========== |
| | | @GetMapping("/my-info") |
| | | public AjaxResult myInfo(@RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | Map<String, Object> ctx = studentContext(sid); |
| | | Object v = ctx.get("view"); |
| | | if (v instanceof Map) { |
| | | @SuppressWarnings("unchecked") |
| | | Map<String, Object> view = (Map<String, Object>) v; |
| | | CjStudent s = (CjStudent) ctx.get("student"); |
| | | String pwd = studentMapper.selectPasswordByStudentId(sid); |
| | | view.put("hasPassword", pwd != null && !pwd.isEmpty()); |
| | | view.put("mustChangePwd", s != null && "1".equals(s.getPwdResetFlag())); |
| | | } |
| | | return AjaxResult.success(v); |
| | | } |
| | | |
| | | // ========== 4. æå¯å¡«æ¥/已填æ¥çä»»å¡å表 ========== |
| | | @GetMapping("/tasks") |
| | | public AjaxResult tasks(@RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | Map<String, Object> ctx = studentContext(sid); |
| | | Long myClassId = (Long) ctx.get("classId"); |
| | | if (myClassId == null) return AjaxResult.error("æªæ¾å°ä½ çç级信æ¯ï¼è¯·èç³»èå¸"); |
| | | CjStudent student = (CjStudent) ctx.get("student"); |
| | | |
| | | CjFillTask q = new CjFillTask(); |
| | | q.setStatus("1"); // åªåå·²åå¸ä»»å¡ |
| | | List<CjFillTask> tasks = taskMapper.selectCjFillTaskList(q); |
| | | List<Map<String, Object>> out = new ArrayList<>(); |
| | | if (tasks != null) { |
| | | for (CjFillTask t : tasks) { |
| | | if (!inScope(t, myClassId)) continue; |
| | | boolean open = isOpen(t); |
| | | CjFillRecord rec = recordMapper.selectByTaskAndStudent(t.getTaskId(), sid); |
| | | // æªå¨æçå¡«æ¥çªå£ä¸æ²¡æè®°å½çä»»å¡ä¸å±ç¤º |
| | | if (!open && rec == null) continue; |
| | | Map<String, Object> m = new LinkedHashMap<>(); |
| | | m.put("taskId", t.getTaskId()); |
| | | m.put("taskName", t.getTaskName()); |
| | | m.put("schoolYear", t.getSchoolYear()); |
| | | m.put("semester", t.getSemester()); |
| | | m.put("fillStartDate", fmtDate(t.getFillStartDate())); |
| | | m.put("fillEndDate", fmtDate(t.getFillEndDate())); |
| | | m.put("needApprove", t.getNeedApprove()); |
| | | m.put("open", open); |
| | | m.put("recordStatus", rec == null ? null : rec.getStatus()); // 0è稿 1å·²æäº¤ |
| | | m.put("submitTime", rec == null ? null : fmtTime(rec.getSubmitTime())); |
| | | out.add(m); |
| | | } |
| | | } |
| | | out.sort((a, b) -> orBlank(a.get("fillEndDate")).compareTo(orBlank(b.get("fillEndDate")))); |
| | | return AjaxResult.success(Map.of("studentName", student.getName(), "studentNo", student.getStudentNo(), "tasks", out)); |
| | | } |
| | | |
| | | // ========== 5. ä»»å¡è¡¨åï¼schema + é¢å¡« + æçè®°å½ï¼ ========== |
| | | @GetMapping("/task/{taskId}") |
| | | public AjaxResult taskForm(@PathVariable("taskId") Long taskId, |
| | | @RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | CjFillTask task = taskMapper.selectCjFillTaskByTaskId(taskId); |
| | | if (task == null) return AjaxResult.error("ä»»å¡ä¸åå¨"); |
| | | Map<String, Object> ctx = studentContext(sid); |
| | | Long myClassId = (Long) ctx.get("classId"); |
| | | if (myClassId == null || !inScope(task, myClassId)) { |
| | | // æ¢çåå
许åçæ§ç级ä¸èªå·±çè®°å½ï¼è®°å½å¿«ç
§ä¿çåç级å½å±ï¼åªè¯»ï¼ |
| | | CjFillRecord mine = recordMapper.selectByTaskAndStudent(taskId, sid); |
| | | if (mine == null) return AjaxResult.error("该任å¡ä¸å¨ä½ çå¡«æ¥èå´"); |
| | | } |
| | | |
| | | Map<String, Object> form = new LinkedHashMap<>(); |
| | | fillPrefill(task, ctx, form); |
| | | |
| | | CjFillRecord rec = recordMapper.selectByTaskAndStudent(taskId, sid); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("taskId", task.getTaskId()); |
| | | data.put("taskName", task.getTaskName()); |
| | | data.put("schoolYear", task.getSchoolYear()); |
| | | data.put("semester", task.getSemester()); |
| | | data.put("termText", termText(task)); |
| | | data.put("taskStatus", task.getStatus()); |
| | | data.put("fillStartDate", fmtDate(task.getFillStartDate())); |
| | | data.put("fillEndDate", fmtDate(task.getFillEndDate())); |
| | | data.put("needApprove", task.getNeedApprove()); |
| | | data.put("open", isOpen(task)); |
| | | data.put("readonly", rec != null && "1".equals(rec.getStatus())); |
| | | data.put("recordStatus", rec == null ? null : rec.getStatus()); |
| | | data.put("submitTime", rec == null ? null : fmtTime(rec.getSubmitTime())); |
| | | // è稿/æäº¤å¼è¦çé¢å¡« |
| | | if (rec != null && rec.getFormData() != null) { |
| | | try { |
| | | Map<String, Object> saved = om.readValue(rec.getFormData(), new TypeReference<Map<String, Object>>() { }); |
| | | if (saved != null) form.putAll(saved); |
| | | } catch (Exception ignore) { } |
| | | } |
| | | data.put("form", form); |
| | | data.put("schema", parseSchema(task.getSchemaJson())); // {groups, attachments} |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | // ========== 6. ä¿åè稿 ========== |
| | | @PostMapping("/task/draft") |
| | | public AjaxResult saveDraft(@RequestBody Map<String, Object> body, |
| | | @RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | Long taskId = longOf(body.get("taskId")); |
| | | Map<String, Object> form = castMap(body.get("form")); |
| | | CjFillTask task = checkWritable(sid, taskId, form); |
| | | CjFillRecord rec = buildRecord(task, sid, form, "0", null); |
| | | rec.setRecordId(existingRecordId(taskId, sid)); |
| | | if (rec.getRecordId() == null) recordMapper.insertCjFillRecord(rec); |
| | | else recordMapper.updateCjFillRecord(rec); |
| | | return AjaxResult.success("è稿已ä¿å", Map.of("recordId", rec.getRecordId() == null ? 0L : rec.getRecordId())); |
| | | } |
| | | |
| | | // ========== 7. æ£å¼æäº¤ ========== |
| | | @PostMapping("/task/submit") |
| | | public AjaxResult submit(@RequestBody Map<String, Object> body, |
| | | @RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | Long taskId = longOf(body.get("taskId")); |
| | | Map<String, Object> form = castMap(body.get("form")); |
| | | CjFillTask task = checkWritable(sid, taskId, form); |
| | | String err = validateForm(task, form); |
| | | if (err != null) return AjaxResult.error(err); |
| | | CjFillRecord rec = buildRecord(task, sid, form, "1", new Date()); |
| | | rec.setRecordId(existingRecordId(taskId, sid)); |
| | | if (rec.getRecordId() == null) recordMapper.insertCjFillRecord(rec); |
| | | else recordMapper.updateCjFillRecord(rec); |
| | | return AjaxResult.success("æäº¤æå", Map.of("recordId", rec.getRecordId() == null ? 0L : rec.getRecordId())); |
| | | } |
| | | |
| | | // ========== 7.5 æä»¶ä¸ä¼ ï¼è¡¨åãæä»¶ä¸ä¼ ãåæ®µç¨ï¼å¾ç/PDF/Office ææç»ä¸å
¥å£ï¼ ========== |
| | | /** ä¸ä¼ å° profile/upload ä¸ï¼è¿åç¸å¯¹è·¯å¾ï¼/profile/upload/...ï¼ï¼GET /profile/** å·²å¿åæ¾è¡å¯åæ¾ */ |
| | | @PostMapping("/upload") |
| | | public AjaxResult upload(@RequestParam("file") MultipartFile file, |
| | | @RequestHeader(value = "Authorization", required = false) String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error(401, "æªç»å½æç»å½å·²è¿æ"); |
| | | if (file == null || file.isEmpty()) return AjaxResult.error("è¯·éæ©è¦ä¸ä¼ çæä»¶"); |
| | | // 表åéä»¶ç»ä¸éå¶ï¼å个æä»¶ä¸å¾å¤§äº 10MBï¼ä¸ spring.servlet.multipart.max-file-size ä¸è´ï¼ |
| | | if (file.getSize() > 10L * 1024 * 1024) return AjaxResult.error("æä»¶ä¸å¾å¤§äº 10MB"); |
| | | try { |
| | | String fileName = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file); |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("fileName", fileName); |
| | | data.put("originalName", file.getOriginalFilename()); |
| | | return AjaxResult.success(data); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("ä¸ä¼ 失败ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // ================================================================= |
| | | // ç§æå·¥å
· |
| | | // ================================================================= |
| | | |
| | | // ========== 8. æ¤åå·²æäº¤ï¼åå°èç¨¿å¯æ¹ï¼ ========== |
| | | @PostMapping("/task/withdraw") |
| | | public AjaxResult withdraw(@RequestBody Map<String, Object> body, |
| | | @RequestHeader("Authorization") String auth) { |
| | | Long sid = resolveStudentId(auth); |
| | | if (sid == null) return AjaxResult.error("æªç»å½"); |
| | | Long taskId = longOf(body.get("taskId")); |
| | | if (taskId == null) return AjaxResult.error("ç¼ºå° taskId"); |
| | | CjFillTask task = taskMapper.selectCjFillTaskByTaskId(taskId); |
| | | if (task == null) return AjaxResult.error("ä»»å¡ä¸åå¨"); |
| | | if (!"1".equals(task.getStatus()) || !isOpen(task)) { |
| | | return AjaxResult.error("ä»
å¨å¡«æ¥æ¶é´å
çä»»å¡å¯æ¤åï¼è¶
è¿æ¶é´è¯·èç³»ç级管ç人éå"); |
| | | } |
| | | CjFillRecord rec = recordMapper.selectByTaskAndStudent(taskId, sid); |
| | | if (rec == null || !"1".equals(rec.getStatus())) { |
| | | return AjaxResult.error("å½å没æå¯æ¤åçå·²æäº¤è®°å½"); |
| | | } |
| | | recordMapper.rollbackDraft(rec.getRecordId()); |
| | | return AjaxResult.success("å·²æ¤åï¼å¯ä¿®æ¹åéæ°æäº¤", Map.of("taskId", taskId)); |
| | | } |
| | | |
| | | /** æ£æ¥ä»»å¡å¯åï¼ä»»å¡åå¸/å¡«æ¥çªå£å
/èå´å
/æªæäº¤ */ |
| | | private CjFillTask checkWritable(Long sid, Long taskId, Map<String, Object> form) { |
| | | if (taskId == null) throw new ServiceException("ç¼ºå° taskId"); |
| | | CjFillTask task = taskMapper.selectCjFillTaskByTaskId(taskId); |
| | | if (task == null) throw new ServiceException("ä»»å¡ä¸åå¨"); |
| | | Map<String, Object> ctx = studentContext(sid); |
| | | Long myClassId = (Long) ctx.get("classId"); |
| | | if (myClassId == null || !inScope(task, myClassId)) throw new ServiceException("该任å¡ä¸å¨ä½ çå¡«æ¥èå´"); |
| | | if (!"1".equals(task.getStatus())) throw new ServiceException("任塿ªå叿已å
³é"); |
| | | if (!isOpen(task)) throw new ServiceException("ä¸å¨å¡«æ¥æ¶é´èå´å
"); |
| | | CjFillRecord existing = recordMapper.selectByTaskAndStudent(taskId, sid); |
| | | if (existing != null && "1".equals(existing.getStatus())) throw new ServiceException("å·²æäº¤ä¸å¯ä¿®æ¹"); |
| | | return task; |
| | | } |
| | | |
| | | private Long existingRecordId(Long taskId, Long sid) { |
| | | CjFillRecord r = recordMapper.selectByTaskAndStudent(taskId, sid); |
| | | return r == null ? null : r.getRecordId(); |
| | | } |
| | | |
| | | /** ç»è£
è®°å½ï¼å¦çå¿«ç
§ + form çæ¡ + isOutside æå¡ç«¯è®¡ç®ï¼ */ |
| | | private CjFillRecord buildRecord(CjFillTask task, Long sid, Map<String, Object> form, String status, Date submitTime) { |
| | | CjStudent s = studentMapper.selectCjStudentByStudentId(sid); |
| | | Map<String, Object> ctx = studentContext(sid); |
| | | String province = str(form.get("province")); |
| | | form.put("isOutside", computeOutside(task, province)); |
| | | |
| | | CjFillRecord rec = new CjFillRecord(); |
| | | rec.setTaskId(task.getTaskId()); |
| | | rec.setStudentId(sid); |
| | | rec.setStudentNo(s.getStudentNo()); |
| | | rec.setStudentName(s.getName()); |
| | | rec.setGenderText(genderText(s.getGender())); |
| | | rec.setPhone(s.getPhone()); |
| | | rec.setClassId((Long) ctx.get("classId")); |
| | | rec.setClassName((String) ctx.get("className")); |
| | | rec.setMajorName((String) ctx.get("majorName")); |
| | | rec.setCollegeName((String) ctx.get("collegeName")); |
| | | rec.setStatus(status); |
| | | rec.setSubmitTime(submitTime); |
| | | try { |
| | | rec.setFormData(om.writeValueAsString(form)); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("æ°æ®åºåå失败: " + e.getMessage()); |
| | | } |
| | | return rec; |
| | | } |
| | | |
| | | /** æå¡ç«¯æä»»å¡æé¤é计ç®âæ¯å¦å¤ç/å¢å¤âï¼ç»æ 1/0ï¼åå form */ |
| | | private String computeOutside(CjFillTask task, String province) { |
| | | if (province == null || province.trim().isEmpty()) return ""; |
| | | String exclude = task.getOutsideExclude(); |
| | | if (exclude != null) { |
| | | for (String s : exclude.split(",")) { |
| | | if (s.trim().equals(province.trim())) return "0"; |
| | | } |
| | | } |
| | | return "1"; |
| | | } |
| | | |
| | | /** 客æ·ç«¯æäº¤åçæå¡ç«¯æ ¡éªï¼å¿
å¡«/ææºå·/ä¿¡ç¨ä»£ç /æ°å¼åºé´ï¼ */ |
| | | private String validateForm(CjFillTask task, Map<String, Object> form) { |
| | | Map<String, Object> schema = parseSchema(task.getSchemaJson()); |
| | | Object groupsObj = schema.get("groups"); |
| | | if (!(groupsObj instanceof List)) return "表åé
置缺失"; |
| | | for (Object go : (List<?>) groupsObj) { |
| | | Map<String, Object> g = (Map<String, Object>) go; |
| | | Object fs = g.get("fields"); |
| | | if (!(fs instanceof List)) continue; |
| | | for (Object fo : (List<?>) fs) { |
| | | Map<String, Object> f = (Map<String, Object>) fo; |
| | | String type = str(f.get("type")); |
| | | boolean readonly = Boolean.TRUE.equals(f.get("readonly")) || "server".equals(str(f.get("auto"))) |
| | | || "roster".equals(str(f.get("auto"))) || "task".equals(str(f.get("auto"))); |
| | | if (readonly) continue; |
| | | String code = str(f.get("code")); |
| | | String label = str(f.get("label")); |
| | | // æä»¶ç±»å段ï¼å¾ç/PDF/Office ææç»ä¸ï¼ï¼å¼æ¯è·¯å¾æ°ç»ï¼å
¼å®¹éå·æ¼æ¥å符串ä¸åå² image ç±»åï¼ï¼åç¬æ ¡éª |
| | | if ("image".equals(type) || "file".equals(type)) { |
| | | List<String> files = fileList(form.get(code)); |
| | | if (Boolean.TRUE.equals(f.get("required")) && files.isEmpty()) return "请ä¸ä¼ ã" + label + "ã"; |
| | | int max = 9; |
| | | Object mc = f.get("maxCount"); |
| | | if (mc instanceof Number) max = ((Number) mc).intValue(); |
| | | else if (mc != null) { try { max = Integer.parseInt(mc.toString().trim()); } catch (NumberFormatException ignore) { } } |
| | | if (files.size() > max) return "ã" + label + "ãæå¤ä¸ä¼ " + max + " 个æä»¶"; |
| | | for (String p : files) { |
| | | if (!p.startsWith("/profile/upload/")) return "ã" + label + "ãå
å«éæ³æä»¶å°å"; |
| | | } |
| | | continue; |
| | | } |
| | | Object v = form.get(code); |
| | | String val = v == null ? "" : v.toString().trim(); |
| | | if (Boolean.TRUE.equals(f.get("required")) && val.isEmpty()) { |
| | | return "请填åã" + label + "ã"; |
| | | } |
| | | if (val.isEmpty()) continue; |
| | | if ("phone".equals(type) && !val.matches(PHONE_RE)) return "ã" + label + "ãæ ¼å¼ä¸æ£ç¡®ï¼11ä½å¤§éææºå·ï¼"; |
| | | if ("creditCode".equals(type) && !val.matches(CREDIT_CODE_RE)) return "ã" + label + "ã须为18ä½åæ³ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç "; |
| | | if ("number".equals(type)) { |
| | | try { |
| | | double d = Double.parseDouble(val); |
| | | if (f.get("min") != null && d < ((Number) f.get("min")).doubleValue()) return "ã" + label + "ãä¸è½å°äº " + f.get("min"); |
| | | if (f.get("max") != null && d > ((Number) f.get("max")).doubleValue()) return "ã" + label + "ãä¸è½å¤§äº " + f.get("max"); |
| | | } catch (NumberFormatException e) { |
| | | return "ã" + label + "ãå¿
é¡»æ¯æ°å"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** é¢å¡«ç³»ç»å¸¦åºå段ï¼roster/task/serverï¼ä¸ææºå· */ |
| | | private void fillPrefill(CjFillTask task, Map<String, Object> ctx, Map<String, Object> form) { |
| | | CjStudent s = (CjStudent) ctx.get("student"); |
| | | Map<String, Object> schema = parseSchema(task.getSchemaJson()); |
| | | Object groupsObj = schema.get("groups"); |
| | | if (groupsObj instanceof List) { |
| | | for (Object go : (List<?>) groupsObj) { |
| | | Map<String, Object> g = (Map<String, Object>) go; |
| | | Object fs = g.get("fields"); |
| | | if (!(fs instanceof List)) continue; |
| | | for (Object fo : (List<?>) fs) { |
| | | Map<String, Object> f = (Map<String, Object>) fo; |
| | | String code = str(f.get("code")); |
| | | String auto = str(f.get("auto")); |
| | | if ("roster".equals(auto)) { |
| | | String val = rosterValue(code, ctx); |
| | | if (val != null) form.put(code, val); |
| | | } else if ("task".equals(auto)) { |
| | | form.put(code, termText(task)); |
| | | } else if ("server".equals(auto)) { |
| | | form.put(code, ""); |
| | | } else if ("studentPhone".equals(code) && s.getPhone() != null && !s.getPhone().isEmpty()) { |
| | | form.putIfAbsent(code, s.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String rosterValue(String code, Map<String, Object> ctx) { |
| | | CjStudent s = (CjStudent) ctx.get("student"); |
| | | switch (code) { |
| | | case "collegeName": return (String) ctx.get("collegeName"); |
| | | case "majorName": return (String) ctx.get("majorName"); |
| | | case "className": return (String) ctx.get("className"); |
| | | case "studentName": return s.getName(); |
| | | case "studentNo": return s.getStudentNo(); |
| | | case "gender": return genderText(s.getGender()); |
| | | default: return null; |
| | | } |
| | | } |
| | | |
| | | private Map<String, Object> studentContext(Long sid) { |
| | | Map<String, Object> res = new LinkedHashMap<>(); |
| | | CjStudent s = studentMapper.selectCjStudentByStudentId(sid); |
| | | res.put("student", s); |
| | | if (s == null) return res; |
| | | Long cid = s.getClassId(); |
| | | CjClass cl = cid == null ? null : classMapper.selectCjClassByClassId(cid); |
| | | if (cl != null) { |
| | | res.put("classId", cl.getClassId()); |
| | | res.put("className", cl.getClassName()); |
| | | CjMajor m = cl.getMajorId() == null ? null : majorMapper.selectCjMajorByMajorId(cl.getMajorId()); |
| | | if (m != null) { |
| | | res.put("majorName", m.getMajorName()); |
| | | CjCollege col = m.getCollegeId() == null ? null : collegeMapper.selectCjCollegeByCollegeId(m.getCollegeId()); |
| | | res.put("collegeName", col == null ? "" : col.getCollegeName()); |
| | | } else { |
| | | res.put("majorName", ""); |
| | | res.put("collegeName", ""); |
| | | } |
| | | } |
| | | // å端 viewï¼å»éèª studentContext çç´æ¥åæ®µï¼ |
| | | Map<String, Object> view = new LinkedHashMap<>(); |
| | | view.put("studentId", s.getStudentId()); |
| | | view.put("studentNo", s.getStudentNo()); |
| | | view.put("name", s.getName()); |
| | | view.put("genderText", genderText(s.getGender())); |
| | | view.put("phone", s.getPhone()); |
| | | view.put("classId", res.get("classId")); |
| | | view.put("className", res.get("className")); |
| | | view.put("majorName", res.get("majorName")); |
| | | view.put("collegeName", res.get("collegeName")); |
| | | res.put("view", view); |
| | | return res; |
| | | } |
| | | |
| | | private boolean inScope(CjFillTask task, Long myClassId) { |
| | | String scope = task.getScopeJson(); |
| | | if (scope == null) return false; |
| | | try { |
| | | Map<String, Object> root = om.readValue(scope, new TypeReference<Map<String, Object>>() { }); |
| | | Object ids = root.get("classIds"); |
| | | if (ids instanceof List) { |
| | | for (Object o : (List<?>) ids) { |
| | | if (((Number) o).longValue() == myClassId.longValue()) return true; |
| | | } |
| | | } |
| | | } catch (Exception ignore) { } |
| | | return false; |
| | | } |
| | | |
| | | private boolean isOpen(CjFillTask task) { |
| | | if (!"1".equals(task.getStatus())) return false; |
| | | if (task.getFillStartDate() == null || task.getFillEndDate() == null) return false; |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate start = task.getFillStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate end = task.getFillEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | return !today.isBefore(start) && !today.isAfter(end); |
| | | } |
| | | |
| | | private Map<String, Object> parseSchema(String schemaJson) { |
| | | Map<String, Object> res = new LinkedHashMap<>(); |
| | | res.put("groups", new ArrayList<>()); |
| | | res.put("attachments", new ArrayList<>()); |
| | | if (schemaJson == null) return res; |
| | | try { |
| | | Map<String, Object> root = om.readValue(schemaJson, new TypeReference<Map<String, Object>>() { }); |
| | | if (root.get("groups") != null) res.put("groups", root.get("groups")); |
| | | if (root.get("attachments") != null) res.put("attachments", root.get("attachments")); |
| | | } catch (Exception ignore) { } |
| | | return res; |
| | | } |
| | | |
| | | private String termText(CjFillTask t) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (t.getSchoolYear() != null) sb.append(t.getSchoolYear()); |
| | | sb.append("å¦å¹´"); |
| | | if ("1".equals(t.getSemester())) sb.append("第ä¸å¦æ"); |
| | | else if ("2".equals(t.getSemester())) sb.append("第äºå¦æ"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String genderText(String code) { |
| | | if (code == null) return "æªç¥"; |
| | | switch (code.trim()) { |
| | | case "0": case "ç·": return "ç·"; |
| | | case "1": case "女": return "女"; |
| | | default: return "æªç¥"; |
| | | } |
| | | } |
| | | |
| | | private String orBlank(Object o) { return o == null ? "" : o.toString(); } |
| | | |
| | | /** H5 ç¨³å® openidï¼å¯¹è®¾å¤ç å MD5ï¼ä¿è¯å䏿µè§å¨èº«ä»½ä¸å */ |
| | | private String md5Hex(String s) { |
| | | try { |
| | | java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); |
| | | byte[] d = md.digest(s.getBytes(java.nio.charset.StandardCharsets.UTF_8)); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (byte b : d) { String h = Integer.toHexString(0xff & b); if (h.length() == 1) sb.append('0'); sb.append(h); } |
| | | return sb.toString(); |
| | | } catch (Exception e) { |
| | | return Integer.toHexString(s.hashCode()); |
| | | } |
| | | } |
| | | |
| | | private String fmtDate(Date d) { |
| | | if (d == null) return null; |
| | | java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(d); |
| | | } |
| | | private String fmtTime(Date d) { |
| | | if (d == null) return null; |
| | | java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | return sdf.format(d); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | private Map<String, Object> castMap(Object o) { |
| | | if (o instanceof Map) return (Map<String, Object>) o; |
| | | throw new ServiceException("form åæ°æ ¼å¼é误"); |
| | | } |
| | | private Long longOf(Object o) { |
| | | if (o == null) return null; |
| | | return Long.valueOf(o.toString()); |
| | | } |
| | | private String str(Object o) { return o == null ? null : o.toString(); } |
| | | |
| | | /** å¾ç/æä»¶å段çå¼ï¼è·¯å¾æ°ç»æéå·æ¼æ¥å符串 â é空路å¾å表 */ |
| | | private List<String> fileList(Object v) { |
| | | List<String> out = new ArrayList<>(); |
| | | if (v instanceof List) { |
| | | for (Object o : (List<?>) v) { |
| | | String s = str(o); |
| | | if (s != null && !s.trim().isEmpty()) out.add(s.trim()); |
| | | } |
| | | } else if (v != null) { |
| | | for (String s : v.toString().split(",")) { |
| | | if (!s.trim().isEmpty()) out.add(s.trim()); |
| | | } |
| | | } |
| | | return out; |
| | | } |
| | | |
| | | private String code2session(String code) { |
| | | try { |
| | | String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxAppid |
| | | + "&secret=" + wxSecret + "&js_code=" + code + "&grant_type=authorization_code"; |
| | | HttpClient client = HttpClient.newBuilder().connectTimeout(java.time.Duration.ofSeconds(5)).build(); |
| | | HttpResponse<String> resp = client.send(HttpRequest.newBuilder(URI.create(url)).GET().build(), |
| | | HttpResponse.BodyHandlers.ofString()); |
| | | Map<String, Object> json = om.readValue(resp.body(), Map.class); |
| | | if (json.get("openid") != null) return (String) json.get("openid"); |
| | | log.warn("code2session 失败: {}", json.get("errmsg")); |
| | | return null; |
| | | } catch (Exception e) { |
| | | log.error("è°ç¨å¾®ä¿¡ code2session å¼å¸¸", e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private Long resolveStudentId(String auth) { |
| | | if (auth == null || !auth.startsWith("Bearer ")) return null; |
| | | Object val = redisCache.getCacheObject(TOKEN_PREFIX + auth.substring(7)); |
| | | if (val instanceof Long) { |
| | | Long sid = (Long) val; |
| | | return sid > 0 ? sid : null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** ä»ç»å½æ token 读åâæªç»å®æ¶æåç openidâï¼ç¨äºç»å®æ¶å
³è微信身份 */ |
| | | private String openidOfToken(String auth) { |
| | | if (auth == null || !auth.startsWith("Bearer ")) return null; |
| | | Object val = redisCache.getCacheObject(OPENID_PREFIX + auth.substring(7)); |
| | | return val == null ? null : val.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysCache; |
| | | |
| | | /** |
| | | * ç¼åçæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController |
| | | { |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "ç¨æ·ä¿¡æ¯")); |
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "é
置信æ¯")); |
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "æ°æ®åå
¸")); |
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "éªè¯ç ")); |
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "é²éæäº¤")); |
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "éæµå¤ç")); |
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "å¯ç é误次æ°")); |
| | | } |
| | | |
| | | @SuppressWarnings("deprecation") |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | result.put("commandStats", pieList); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getNames") |
| | | public AjaxResult cache() |
| | | { |
| | | return AjaxResult.success(caches); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public AjaxResult getCacheKeys(@PathVariable String cacheName) |
| | | { |
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | return AjaxResult.success(new TreeSet<>(cacheKeys)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) |
| | | { |
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey); |
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); |
| | | return AjaxResult.success(sysCache); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public AjaxResult clearCacheName(@PathVariable String cacheName) |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public AjaxResult clearCacheKey(@PathVariable String cacheKey) |
| | | { |
| | | redisTemplate.delete(cacheKey); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheAll") |
| | | public AjaxResult clearCacheAll() |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys("*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | |
| | | /** |
| | | * æå¡å¨çæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController |
| | | { |
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')") |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | return AjaxResult.success(server); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.service.SysPasswordService; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®è®°å½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | public class SysLogininforController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysLogininforService logininforService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) |
| | | { |
| | | startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysLogininfor logininfor) |
| | | { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | util.exportExcel(response, list, "ç»å½æ¥å¿"); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public AjaxResult remove(@PathVariable Long[] infoIds) |
| | | { |
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | logininforService.cleanLogininfor(); |
| | | return success(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") |
| | | @Log(title = "è´¦æ·è§£é", businessType = BusinessType.OTHER) |
| | | @GetMapping("/unlock/{userName}") |
| | | public AjaxResult unlock(@PathVariable("userName") String userName) |
| | | { |
| | | passwordService.clearLoginRecordCache(userName); |
| | | return success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysOperLog; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | |
| | | /** |
| | | * æä½æ¥å¿è®°å½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysOperLog operLog) |
| | | { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | util.exportExcel(response, list, "æä½æ¥å¿"); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.DELETE) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/{operIds}") |
| | | public AjaxResult remove(@PathVariable Long[] operIds) |
| | | { |
| | | return toAjax(operLogService.deleteOperLogByIds(operIds)); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | | import com.ruoyi.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * å¨çº¿ç¨æ·çæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserOnlineService userOnlineService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | LoginUser user = redisCache.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | else |
| | | { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return getDataTable(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | | * 强éç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") |
| | | @Log(title = "å¨çº¿ç¨æ·", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public AjaxResult forceLogout(@PathVariable String tokenId) |
| | | { |
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); |
| | | return success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * åæ°é
ç½® ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * è·ååæ°é
ç½®å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "åæ°æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°é®åæ¥è¯¢åæ°å¼ |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("æ°å¢åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("ä¿®æ¹åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°åæ°ç¼å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * é¨é¨ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | /** |
| | | * è·åé¨é¨å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨åè¡¨ï¼æé¤èç¹ï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return success(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("æ°å¢é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | return toAjax(deptService.insertDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼ä¸çº§é¨é¨ä¸è½æ¯èªå·±"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return error("该é¨é¨å
嫿ªåç¨çåé¨é¨ï¼"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | return toAjax(deptService.updateDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åé¨é¨æåº |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "ä¿åé¨é¨æåº", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updateSort") |
| | | public AjaxResult updateSort(@RequestBody Map<String, String> params) |
| | | { |
| | | String[] deptIds = params.get("deptIds").split(","); |
| | | String[] orderNums = params.get("orderNums").split(","); |
| | | deptService.updateDeptSort(deptIds, orderNums); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return warn("åå¨ä¸çº§é¨é¨,ä¸å
许å é¤"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return warn("é¨é¨åå¨ç¨æ·,ä¸å
许å é¤"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | return toAjax(deptService.deleteDeptById(deptId)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictData dictData) |
| | | { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | util.exportExcel(response, list, "åå
¸æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åå
¸æ°æ®è¯¦ç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åæ¥è¯¢åå
¸æ°æ®ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public AjaxResult dictType(@PathVariable String dictType) |
| | | { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | return success(data); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictType dictType) |
| | | { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | util.exportExcel(response, list, "åå
¸ç±»å"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åå
¸ç±»åè¯¦ç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult getInfo(@PathVariable Long dictId) |
| | | { |
| | | return success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("æ°å¢åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("ä¿®æ¹åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult remove(@PathVariable Long[] dictIds) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°åå
¸ç¼å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸éæ©æ¡å表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return success(dictTypes); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * é¦é¡µ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysIndexController |
| | | { |
| | | /** ç³»ç»åºç¡é
ç½® */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | /** |
| | | * 访é®é¦é¡µï¼æç¤ºè¯ |
| | | */ |
| | | @RequestMapping("/") |
| | | public String index() |
| | | { |
| | | return StringUtils.format("欢è¿ä½¿ç¨{}åå°ç®¡çæ¡æ¶ï¼å½åçæ¬ï¼v{}ï¼è¯·éè¿å端å°å访é®ã", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |
| | | } |
| | | |
| | | /** |
| | | * è§£éå±å¹ |
| | | */ |
| | | @PostMapping("/unlockscreen") |
| | | public AjaxResult unlockScreen(@RequestBody Map<String, String> body) |
| | | { |
| | | String password = body.get("password"); |
| | | if (StringUtils.isEmpty(password)) |
| | | { |
| | | return AjaxResult.error("å¯ç ä¸è½ä¸ºç©º"); |
| | | } |
| | | String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | if (user == null) |
| | | { |
| | | return AjaxResult.error("æå¡å¨è¶
æ¶ï¼è¯·éæ°ç»å½"); |
| | | } |
| | | if (!SecurityUtils.matchesPassword(password, user.getPassword())) |
| | | { |
| | | return AjaxResult.error("å¯ç é误ï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | |
| | | return AjaxResult.success("è§£éæå"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * ç»å½éªè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * ç»å½æ¹æ³ |
| | | * |
| | | * @param loginBody ç»å½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // çæä»¤ç |
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, token); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @return ç¨æ·ä¿¡æ¯ |
| | | */ |
| | | @GetMapping("getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | // è§è²éå |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // æééå |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | if (!loginUser.getPermissions().equals(permissions)) |
| | | { |
| | | loginUser.setPermissions(permissions); |
| | | tokenService.refreshToken(loginUser); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | ajax.put("pwdChrtype", getSysAccountChrtype()); |
| | | ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate())); |
| | | ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * è·åè·¯ç±ä¿¡æ¯ |
| | | * |
| | | * @return è·¯ç±ä¿¡æ¯ |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | | } |
| | | |
| | | // è·åç¨æ·å¯ç èªå®ä¹é
ç½®è§å |
| | | public String getSysAccountChrtype() |
| | | { |
| | | return Convert.toStr(configService.selectConfigByKey("sys.account.chrtype"), "0"); |
| | | } |
| | | |
| | | // æ£æ¥åå§å¯ç æ¯å¦æéä¿®æ¹ |
| | | public boolean initPasswordIsModify(Date pwdUpdateDate) |
| | | { |
| | | Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); |
| | | return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null; |
| | | } |
| | | |
| | | // æ£æ¥å¯ç æ¯å¦è¿æ |
| | | public boolean passwordIsExpiration(Date pwdUpdateDate) |
| | | { |
| | | Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays")); |
| | | if (passwordValidateDays != null && passwordValidateDays > 0) |
| | | { |
| | | if (StringUtils.isNull(pwdUpdateDate)) |
| | | { |
| | | // 妿仿ªä¿®æ¹è¿åå§å¯ç ï¼ç´æ¥æéè¿æ |
| | | return true; |
| | | } |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * èåä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | /** |
| | | * è·åèåå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return success(menus); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®èåç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public AjaxResult getInfo(@PathVariable Long menuId) |
| | | { |
| | | return success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åèå䏿æ å表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return success(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | |
| | | /** |
| | | * å 载对åºè§è²èåå表æ |
| | | */ |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } |
| | | else if (!menuService.checkRouteConfigUnique(menu)) |
| | | { |
| | | return error("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼è·¯ç±åç§°æå°åå·²åå¨"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | | return toAjax(menuService.insertMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼ä¸çº§èåä¸è½éæ©èªå·±"); |
| | | } |
| | | else if (!menuService.checkRouteConfigUnique(menu)) |
| | | { |
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼è·¯ç±åç§°æå°åå·²åå¨"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | | return toAjax(menuService.updateMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åèåæåº |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "ä¿åèåæåº", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updateSort") |
| | | public AjaxResult updateSort(@RequestBody Map<String, String> params) |
| | | { |
| | | String[] menuIds = params.get("menuIds").split(","); |
| | | String[] orderNums = params.get("orderNums").split(","); |
| | | menuService.updateMenuSort(menuIds, orderNums); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return warn("åå¨åèå,ä¸å
许å é¤"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return warn("èåå·²åé
,ä¸å
许å é¤"); |
| | | } |
| | | return toAjax(menuService.deleteMenuById(menuId)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.service.ISysNoticeReadService; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * å
¬å ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | public class SysNoticeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysNoticeService noticeService; |
| | | |
| | | @Autowired |
| | | private ISysNoticeReadService noticeReadService; |
| | | |
| | | /** |
| | | * è·åéç¥å
¬åå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysNotice notice) |
| | | { |
| | | startPage(); |
| | | List<SysNotice> list = noticeService.selectNoticeList(notice); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®éç¥å
¬åç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{noticeId}") |
| | | public AjaxResult getInfo(@PathVariable Long noticeId) |
| | | { |
| | | return success(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢éç¥å
Œ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:add')") |
| | | @Log(title = "éç¥å
Œ", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setCreateBy(getUsername()); |
| | | return toAjax(noticeService.insertNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹éç¥å
Œ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:edit')") |
| | | @Log(title = "éç¥å
Œ", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | notice.setUpdateBy(getUsername()); |
| | | return toAjax(noticeService.updateNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * é¦é¡µé¡¶é¨å
¬åå表ï¼è¿åå
¨é¨æ£å¸¸å
¬åï¼å¸¦å½åç¨æ·å·²è¯»æ è®°ï¼æå¤5æ¡ï¼ |
| | | */ |
| | | @GetMapping("/listTop") |
| | | @ResponseBody |
| | | public AjaxResult listTop() |
| | | { |
| | | Long userId = getUserId(); |
| | | List<SysNotice> list = noticeReadService.selectNoticeListWithReadStatus(userId, 5); |
| | | long unreadCount = list.stream().filter(n -> !n.getIsRead()).count(); |
| | | AjaxResult result = AjaxResult.success(list); |
| | | result.put("unreadCount", unreadCount); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ è®°å
¬å已读 |
| | | */ |
| | | @PostMapping("/markRead") |
| | | @ResponseBody |
| | | public AjaxResult markRead(Long noticeId) |
| | | { |
| | | Long userId = getUserId(); |
| | | noticeReadService.markRead(noticeId, userId); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ 记已读 |
| | | */ |
| | | @PostMapping("/markReadAll") |
| | | @ResponseBody |
| | | public AjaxResult markReadAll(String ids) |
| | | { |
| | | Long userId = getUserId(); |
| | | Long[] noticeIds = Convert.toLongArray(ids); |
| | | noticeReadService.markReadBatch(userId, noticeIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * å·²è¯»ç¨æ·åè¡¨æ°æ® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:list')") |
| | | @GetMapping("/readUsers/list") |
| | | @ResponseBody |
| | | public TableDataInfo readUsersList(Long noticeId, String searchValue) |
| | | { |
| | | startPage(); |
| | | List<?> list = noticeReadService.selectReadUsersByNoticeId(noticeId, searchValue); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éç¥å
Œ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| | | @Log(title = "éç¥å
Œ", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) |
| | | { |
| | | noticeReadService.deleteByNoticeIds(noticeIds); |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * è·åå²ä½å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysPost post) |
| | | { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | util.exportExcel(response, list, "å²ä½æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å²ä½ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult getInfo(@PathVariable Long postId) |
| | | { |
| | | return success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | return toAjax(postService.insertPost(post)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | return toAjax(postService.updatePost(post)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult remove(@PathVariable Long[] postIds) |
| | | { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå²ä½éæ©æ¡å表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return success(posts); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * ä¸ªäººä¿¡æ¯ ä¸å¡å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * ä¸ªäººä¿¡æ¯ |
| | | */ |
| | | @GetMapping |
| | | public AjaxResult profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | AjaxResult ajax = AjaxResult.success(user); |
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ· |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult updateProfile(@RequestBody SysUser user) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser currentUser = loginUser.getUser(); |
| | | currentUser.setNickName(user.getNickName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return error("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return error("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | if (userService.updateUserProfile(currentUser) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·ä¿¡æ¯ |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("ä¿®æ¹ä¸ªäººä¿¡æ¯å¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * éç½®å¯ç |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(@RequestBody Map<String, String> params) |
| | | { |
| | | String oldPassword = params.get("oldPassword"); |
| | | String newPassword = params.get("newPassword"); |
| | | LoginUser loginUser = getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | SysUser user = userService.selectUserById(userId); |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | return error("ä¿®æ¹å¯ç å¤±è´¥ï¼æ§å¯ç é误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | return error("æ°å¯ç ä¸è½ä¸æ§å¯ç ç¸å"); |
| | | } |
| | | newPassword = SecurityUtils.encryptPassword(newPassword); |
| | | if (userService.resetUserPwd(userId, newPassword) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·å¯ç &å¯ç æåæ´æ°æ¶é´ |
| | | loginUser.getUser().setPwdUpdateDate(DateUtils.getNowDate()); |
| | | loginUser.getUser().setPassword(newPassword); |
| | | tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | return error("ä¿®æ¹å¯ç å¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * 头åä¸ä¼ |
| | | */ |
| | | @Log(title = "ç¨æ·å¤´å", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION, true); |
| | | if (userService.updateUserAvatar(loginUser.getUserId(), avatar)) |
| | | { |
| | | String oldAvatar = loginUser.getUser().getAvatar(); |
| | | if (StringUtils.isNotEmpty(oldAvatar)) |
| | | { |
| | | FileUtils.deleteFile(RuoYiConfig.getProfile() + FileUtils.stripPrefix(oldAvatar)); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("imgUrl", avatar); |
| | | // æ´æ°ç¼åç¨æ·å¤´å |
| | | loginUser.getUser().setAvatar(avatar); |
| | | tokenService.setLoginUser(loginUser); |
| | | return ajax; |
| | | } |
| | | } |
| | | return error("ä¸ä¼ å¾çå¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.RegisterBody; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysRegisterService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 注åéªè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysRegisterController extends BaseController |
| | | { |
| | | @Autowired |
| | | private SysRegisterService registerService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @PostMapping("/register") |
| | | public AjaxResult register(@RequestBody RegisterBody user) |
| | | { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) |
| | | { |
| | | return error("å½åç³»ç»æ²¡æå¼å¯æ³¨ååè½ï¼"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? success() : error(msg); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * è§è²ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysRole role) |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | util.exportExcel(response, list, "è§è²æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return success(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨"); |
| | | } |
| | | role.setCreateBy(getUsername()); |
| | | return toAjax(roleService.insertRole(role)); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | // å·æ°ææææè¯¥è§è²çå¨çº¿ç¨æ·æé |
| | | tokenService.refreshPermissionByRoleId(role.getRoleId(), permissionService); |
| | | return success(); |
| | | } |
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åæ°æ®æé |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return toAjax(roleService.authDataScope(role)); |
| | | } |
| | | |
| | | /** |
| | | * ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | role.setUpdateBy(getUsername()); |
| | | return toAjax(roleService.updateRoleStatus(role)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) |
| | | { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | | |
| | | /** |
| | | * è·åè§è²éæ©æ¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | return success(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åé
ç¨æ·è§è²å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æªåé
ç¨æ·è§è²å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶ææç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | return toAjax(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éåæ¶ææç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * æ¹ééæ©ç¨æ·ææ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * è·å对åºè§è²é¨é¨æ å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return ajax; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | public class SysUserController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * è·åç¨æ·å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.exportExcel(response, list, "ç¨æ·æ°æ®"); |
| | | } |
| | | |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | String operName = getUsername(); |
| | | String message = userService.importUser(userList, updateSupport, operName); |
| | | return success(message); |
| | | } |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.importTemplateExcel(response, "ç¨æ·æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping(value = { "/", "/{userId}" }) |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | if (StringUtils.isNotNull(userId)) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | ajax.put(AjaxResult.DATA_TAG, sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | | } |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | | ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) |
| | | { |
| | | deptService.checkDeptDataScope(user.getDeptId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | return toAjax(userService.insertUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | deptService.checkDeptDataScope(user.getDeptId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.updateUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | public AjaxResult remove(@PathVariable Long[] userIds) |
| | | { |
| | | if (ArrayUtils.contains(userIds, getUserId())) |
| | | { |
| | | return error("å½åç¨æ·ä¸è½å é¤"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | /** |
| | | * éç½®å¯ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | | |
| | | /** |
| | | * ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.updateUserStatus(user)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·ç¼å·è·åææè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·ææè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | roleService.checkRoleDataScope(roleIds); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * è·åé¨é¨æ å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) |
| | | { |
| | | return success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | 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.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | |
| | | /** |
| | | * swagger ç¨æ·æµè¯æ¹æ³ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Tag(name = "ç¨æ·ä¿¡æ¯ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/test/user") |
| | | public class TestController extends BaseController |
| | | { |
| | | private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); |
| | | { |
| | | users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); |
| | | users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); |
| | | } |
| | | |
| | | @Operation(summary = "è·åç¨æ·å表") |
| | | @GetMapping("/list") |
| | | public R<List<UserEntity>> userList() |
| | | { |
| | | List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); |
| | | return R.ok(userList); |
| | | } |
| | | |
| | | @Operation(summary = "è·åç¨æ·è¯¦ç»") |
| | | @GetMapping("/{userId}") |
| | | public R<UserEntity> getUser(@PathVariable(name = "userId") |
| | | Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | return R.ok(users.get(userId)); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("ç¨æ·ä¸åå¨"); |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "æ°å¢ç¨æ·") |
| | | @PostMapping("/save") |
| | | public R<String> save(UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("ç¨æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Operation(summary = "æ´æ°ç¨æ·") |
| | | @PutMapping("/update") |
| | | public R<String> update(@RequestBody |
| | | UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("ç¨æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (users.isEmpty() || !users.containsKey(user.getUserId())) |
| | | { |
| | | return R.fail("ç¨æ·ä¸åå¨"); |
| | | } |
| | | users.remove(user.getUserId()); |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ç¨æ·ä¿¡æ¯") |
| | | @DeleteMapping("/{userId}") |
| | | public R<String> delete(@PathVariable(name = "userId") |
| | | Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | users.remove(userId); |
| | | return R.ok(); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("ç¨æ·ä¸åå¨"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Schema(description = "ç¨æ·å®ä½") |
| | | class UserEntity |
| | | { |
| | | @Schema(title = "ç¨æ·ID") |
| | | private Integer userId; |
| | | |
| | | @Schema(title = "ç¨æ·åç§°") |
| | | private String username; |
| | | |
| | | @Schema(title = "ç¨æ·å¯ç ") |
| | | private String password; |
| | | |
| | | @Schema(title = "ç¨æ·ææº") |
| | | private String mobile; |
| | | |
| | | public UserEntity() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserEntity(Integer userId, String username, String password, String mobile) |
| | | { |
| | | this.userId = userId; |
| | | this.username = username; |
| | | this.password = password; |
| | | this.mobile = mobile; |
| | | } |
| | | |
| | | public Integer getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | 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 getMobile() |
| | | { |
| | | return mobile; |
| | | } |
| | | |
| | | public void setMobile(String mobile) |
| | | { |
| | | this.mobile = mobile; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import io.swagger.v3.oas.models.Components; |
| | | import io.swagger.v3.oas.models.OpenAPI; |
| | | import io.swagger.v3.oas.models.info.Contact; |
| | | import io.swagger.v3.oas.models.info.Info; |
| | | import io.swagger.v3.oas.models.security.SecurityRequirement; |
| | | import io.swagger.v3.oas.models.security.SecurityScheme; |
| | | |
| | | /** |
| | | * Swagger2çæ¥å£é
ç½® |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerConfig |
| | | { |
| | | /** ç³»ç»åºç¡é
ç½® */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * èªå®ä¹ç OpenAPI 对象 |
| | | */ |
| | | @Bean |
| | | public OpenAPI customOpenApi() |
| | | { |
| | | return new OpenAPI().components(new Components() |
| | | // 设置认è¯ç请æ±å¤´ |
| | | .addSecuritySchemes("apikey", securityScheme())) |
| | | .addSecurityItem(new SecurityRequirement().addList("apikey")) |
| | | .info(getApiInfo()); |
| | | } |
| | | |
| | | @Bean |
| | | public SecurityScheme securityScheme() |
| | | { |
| | | return new SecurityScheme() |
| | | .type(SecurityScheme.Type.APIKEY) |
| | | .name("Authorization") |
| | | .in(SecurityScheme.In.HEADER) |
| | | .scheme("Bearer"); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å æè¦ä¿¡æ¯ |
| | | */ |
| | | public Info getApiInfo() |
| | | { |
| | | return new Info() |
| | | // 设置æ é¢ |
| | | .title("æ é¢ï¼äº§æèåå®è·µæå¦ç®¡çå¹³å°_æ¥å£ææ¡£") |
| | | // æè¿° |
| | | .description("æè¿°ï¼ç¨äºç®¡çé墿ä¸å
¬å¸ç人åä¿¡æ¯,å
·ä½å
æ¬XXX,XXX模å...") |
| | | // ä½è
ä¿¡æ¯ |
| | | .contact(new Contact().name(ruoyiConfig.getName())) |
| | | // çæ¬ |
| | | .version("çæ¬å·:" + ruoyiConfig.getVersion()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å¼åç¯å¢é
ç½® |
| | | spring: |
| | | data: |
| | | # redis é
ç½®ï¼å¼åç¯å¢ï¼ |
| | | redis: |
| | | host: 192.168.197.128 |
| | | port: 6379 |
| | | password: sugaozhixing.cn |
| | | database: 0 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | min-idle: 0 |
| | | max-idle: 8 |
| | | max-active: 8 |
| | | max-wait: -1ms |
| | | |
| | | # æ¥å¿çº§å«ï¼å¼åç¯å¢ï¼ |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # æä»¶ä¸ä¼ è·¯å¾ï¼å¼åç¯å¢ Windowsï¼ |
| | | ruoyi: |
| | | profile: D:/ruoyi/uploadPath |
| | | addressEnabled: false |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°æ®æºé
ç½® |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://192.168.197.128:3306/cj_practice?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true |
| | | username: root |
| | | password: sugaozhixing.cn |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | | minIdle: 10 |
| | | # æå¤§è¿æ¥æ± æ°é |
| | | maxActive: 20 |
| | | # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ |
| | | maxWait: 60000 |
| | | # é
ç½®è¿æ¥è¶
æ¶æ¶é´ |
| | | connectTimeout: 30000 |
| | | # é
ç½®ç½ç»è¶
æ¶æ¶é´ |
| | | socketTimeout: 60000 |
| | | # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼å使¯æ¯«ç§ |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # æ
¢SQLè®°å½ |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç产ç¯å¢é
ç½® |
| | | spring: |
| | | data: |
| | | # redis é
ç½®ï¼ç产ç¯å¢ï¼ |
| | | redis: |
| | | host: 192.168.197.128 |
| | | port: 6379 |
| | | password: sugaozhixing.cn |
| | | database: 0 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | min-idle: 5 |
| | | max-idle: 20 |
| | | max-active: 50 |
| | | max-wait: 3000ms |
| | | |
| | | # æ¥å¿çº§å«ï¼ç产ç¯å¢ - åªè¾åºè¦ååéè¯¯ï¼ |
| | | logging: |
| | | level: |
| | | com.ruoyi: warn |
| | | org.springframework: error |
| | | |
| | | # æä»¶ä¸ä¼ è·¯å¾ï¼ç产ç¯å¢ Linuxï¼ |
| | | ruoyi: |
| | | profile: /home/ruoyi/uploadPath |
| | | addressEnabled: true |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | # åç§° |
| | | name: 产æèåå®è·µæå¦ç®¡çå¹³å° |
| | | # çæ¬ |
| | | version: 3.9.2 |
| | | # çæå¹´ä»½ |
| | | copyrightYear: 2026 |
| | | # æä»¶è·¯å¾ 示ä¾ï¼ Windowsé
ç½®D:/ruoyi/uploadPathï¼Linuxé
ç½® /home/ruoyi/uploadPathï¼ |
| | | profile: D:/ruoyi/uploadPath |
| | | # è·åipå°åå¼å
³ |
| | | addressEnabled: false |
| | | # éªè¯ç ç±»å math æ°åè®¡ç® char å符éªè¯ï¼ç产ç¯å¢å»ºè®® char é² OCRï¼ |
| | | captchaType: char |
| | | |
| | | # 微信å°ç¨åºé
ç½®ï¼ç产ç¯å¢å¡å¿
éè¿ç¯å¢åéè¦ç secretï¼å¿ææå
¥åº/æäº¤ï¼ |
| | | wechat: |
| | | # å°ç¨åº AppID |
| | | appid: wxc52c6347b57afd4b |
| | | # å°ç¨åº AppSecretï¼ææï¼ç产请ç¨ç¯å¢åé ${WECHAT_SECRET} è¦çï¼ |
| | | secret: 296c838c39e75521c4f6d2e293178c7a |
| | | |
| | | |
| | | # å¼åç¯å¢é
ç½® |
| | | server: |
| | | # æå¡å¨çHTTP端å£ï¼é»è®¤ä¸º8080 |
| | | port: 18080 |
| | | servlet: |
| | | # åºç¨ç访é®è·¯å¾ |
| | | context-path: / |
| | | tomcat: |
| | | # tomcatçURIç¼ç |
| | | uri-encoding: UTF-8 |
| | | # è¿æ¥æ°æ»¡åçæéæ°ï¼é»è®¤ä¸º100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcatæå¤§çº¿ç¨æ°ï¼é»è®¤ä¸º200 |
| | | max: 800 |
| | | # Tomcatå¯å¨åå§åççº¿ç¨æ°ï¼é»è®¤å¼10 |
| | | min-spare: 100 |
| | | |
| | | # æ¥å¿é
ç½® |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # ç¨æ·é
ç½® |
| | | user: |
| | | password: |
| | | # å¯ç æå¤§éè¯¯æ¬¡æ° |
| | | maxRetryCount: 5 |
| | | # å¯ç é宿¶é´ï¼é»è®¤10åéï¼ |
| | | lockTime: 10 |
| | | |
| | | # Springé
ç½® |
| | | spring: |
| | | # èµæºä¿¡æ¯ |
| | | messages: |
| | | # å½é
åèµæºæä»¶è·¯å¾ |
| | | basename: i18n/messages |
| | | profiles: |
| | | active: dev,druid |
| | | # æä»¶ä¸ä¼ |
| | | servlet: |
| | | multipart: |
| | | # å个æä»¶å¤§å° |
| | | max-file-size: 10MB |
| | | # 设置æ»ä¸ä¼ çæä»¶å¤§å° |
| | | max-request-size: 20MB |
| | | jackson: |
| | | time-zone: GMT+8 |
| | | date-format: yyyy-MM-dd HH:mm:ss |
| | | # æå¡æ¨¡å |
| | | devtools: |
| | | restart: |
| | | # çé¨ç½²å¼å
³ |
| | | enabled: true |
| | | data: |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | host: 192.168.197.128 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # å¯ç |
| | | password: sugaozhixing.cn |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # è¿æ¥æ± ä¸çæå°ç©ºé²è¿æ¥ |
| | | min-idle: 0 |
| | | # è¿æ¥æ± ä¸çæå¤§ç©ºé²è¿æ¥ |
| | | max-idle: 8 |
| | | # è¿æ¥æ± çæå¤§æ°æ®åºè¿æ¥æ° |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | | # 令çèªå®ä¹æ è¯ |
| | | header: Authorization |
| | | # 令çå¯é¥ï¼çäº§çº§éæºå¯é¥ï¼å¿æ³é²ï¼ |
| | | secret: 8Bz5rjBVpqaWsowwvo70YwL441TEnXxi0FmxQ0AhaA763OCh+XjvBnertoTA3MGRcDmstBgzBLEf2z4OW3Cq6w== |
| | | # ä»¤çæææï¼é»è®¤30åéï¼ |
| | | expireTime: 30 |
| | | |
| | | # MyBatisé
ç½® |
| | | mybatis: |
| | | # æç´¢æå®å
å«å |
| | | typeAliasesPackage: com.ruoyi.**.domain |
| | | # é
ç½®mapperçæ«æï¼æ¾å°ææçmapper.xmlæ å°æä»¶ |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # å è½½å
¨å±çé
ç½®æä»¶ |
| | | configLocation: classpath:mybatis/mybatis-config.xml |
| | | |
| | | # PageHelperå页æä»¶ |
| | | pagehelper: |
| | | helperDialect: mysql |
| | | supportMethodsArguments: true |
| | | params: count=countSql |
| | | |
| | | # Springdocé
ç½® |
| | | springdoc: |
| | | api-docs: |
| | | path: /v3/api-docs |
| | | swagger-ui: |
| | | enabled: true |
| | | path: /swagger-ui.html |
| | | tags-sorter: alpha |
| | | group-configs: |
| | | - group: 'default' |
| | | display-name: 'æµè¯æ¨¡å' |
| | | paths-to-match: '/**' |
| | | packages-to-scan: com.ruoyi.web.controller.tool |
| | | |
| | | # é²çé¾é
ç½® |
| | | referer: |
| | | # é²çé¾å¼å
³ |
| | | enabled: false |
| | | # å
许çååå表 |
| | | allowed-domains: localhost,127.0.0.1,ruoyi.vip,www.ruoyi.vip |
| | | |
| | | # 鲿¢XSSæ»å» |
| | | xss: |
| | | # è¿æ»¤å¼å
³ |
| | | enabled: true |
| | | # æé¤é¾æ¥ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | excludes: /system/notice |
| | | # å¹é
龿¥ |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | //////////////////////////////////////////////////////////////////// |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // ä½ç¥ä¿ä½ æ°¸ä¸å®æº æ°¸æ BUG // |
| | | //////////////////////////////////////////////////////////////////// |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #éè¯¯æ¶æ¯ |
| | | not.null=* å¿
须填å |
| | | user.jcaptcha.error=éªè¯ç é误 |
| | | user.jcaptcha.expire=éªè¯ç 已失æ |
| | | user.not.exists=ç¨æ·ä¸åå¨/å¯ç é误 |
| | | user.password.not.match=ç¨æ·ä¸åå¨/å¯ç é误 |
| | | user.password.retry.limit.count=å¯ç è¾å
¥é误{0}次 |
| | | user.password.retry.limit.exceed=å¯ç è¾å
¥é误{0}次ï¼å¸æ·éå®{1}åé |
| | | user.password.delete=对ä¸èµ·ï¼æ¨çè´¦å·å·²è¢«å é¤ |
| | | user.blocked=ç¨æ·å·²å°ç¦ï¼è¯·è系管çå |
| | | role.blocked=è§è²å·²å°ç¦ï¼è¯·è系管çå |
| | | login.blocked=å¾éæ¾ï¼è®¿é®IP已被åå
¥ç³»ç»é»åå |
| | | user.logout.success=éåºæå |
| | | |
| | | length.not.valid=é¿åº¦å¿
é¡»å¨{min}å°{max}个å符ä¹é´ |
| | | |
| | | user.username.not.valid=* 2å°20个æ±åãåæ¯ãæ°åæä¸åçº¿ç»æï¼ä¸å¿
须以鿰åå¼å¤´ |
| | | user.password.not.valid=* 5-50个å符 |
| | | |
| | | user.email.not.valid=é®ç®±æ ¼å¼é误 |
| | | user.mobile.phone.number.not.valid=ææºå·æ ¼å¼é误 |
| | | user.login.success=ç»å½æå |
| | | user.register.success=注åæå |
| | | user.notfound=è¯·éæ°ç»å½ |
| | | user.forcelogout=管çå强å¶éåºï¼è¯·éæ°ç»å½ |
| | | user.unknown.error=æªç¥é误ï¼è¯·éæ°ç»å½ |
| | | |
| | | ##æä»¶ä¸ä¼ æ¶æ¯ |
| | | upload.exceed.maxSize=ä¸ä¼ çæä»¶å¤§å°è¶
åºéå¶çæä»¶å¤§å°ï¼<br/>å
许çæä»¶æå¤§å¤§å°æ¯ï¼{0}MBï¼ |
| | | upload.filename.exceed.length=ä¸ä¼ çæä»¶åæé¿{0}个å符 |
| | | |
| | | ##æé |
| | | no.permission=æ¨æ²¡ææ°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| | | no.create.permission=æ¨æ²¡æåå»ºæ°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| | | no.update.permission=æ¨æ²¡æä¿®æ¹æ°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| | | no.delete.permission=æ¨æ²¡æå 餿°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| | | no.export.permission=æ¨æ²¡æå¯¼åºæ°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| | | no.view.permission=æ¨æ²¡ææ¥çæ°æ®çæéï¼è¯·è系管çåæ·»å æé [{0}] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- æ¥å¿åæ¾è·¯å¾ --> |
| | | <property name="log.path" value="/home/ruoyi/logs" /> |
| | | <!-- æ¥å¿è¾åºæ ¼å¼ --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- æ§å¶å°è¾åº --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- ç³»ç»æ¥å¿è¾åº --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | | <!-- å¾ªç¯æ¿çï¼åºäºæ¶é´å建æ¥å¿æä»¶ --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- æ¥å¿æä»¶åæ ¼å¼ --> |
| | | <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- æ¥å¿æå¤§çåå² 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- è¿æ»¤ççº§å« --> |
| | | <level>INFO</level> |
| | | <!-- å¹é
æ¶çæä½ï¼æ¥æ¶ï¼è®°å½ï¼ --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- ä¸å¹é
æ¶çæä½ï¼æç»ï¼ä¸è®°å½ï¼ --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- å¾ªç¯æ¿çï¼åºäºæ¶é´å建æ¥å¿æä»¶ --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- æ¥å¿æä»¶åæ ¼å¼ --> |
| | | <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- æ¥å¿æå¤§çåå² 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- è¿æ»¤ççº§å« --> |
| | | <level>ERROR</level> |
| | | <!-- å¹é
æ¶çæä½ï¼æ¥æ¶ï¼è®°å½ï¼ --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- ä¸å¹é
æ¶çæä½ï¼æç»ï¼ä¸è®°å½ï¼ --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- ç¨æ·è®¿é®æ¥å¿è¾åº --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- æå¤©åæ» daily --> |
| | | <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- æ¥å¿æå¤§çåå² 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- ç³»ç»æ¨¡åæ¥å¿çº§å«æ§å¶ --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Springæ¥å¿çº§å«æ§å¶ --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--ç³»ç»æä½æ¥å¿--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | <!--ç³»ç»ç¨æ·æä½æ¥å¿--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration |
| | | PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | <!-- å
¨å±åæ° --> |
| | | <settings> |
| | | <!-- 使å
¨å±çæ å°å¨å¯ç¨æç¦ç¨ç¼å --> |
| | | <setting name="cacheEnabled" value="true" /> |
| | | <!-- å
许JDBC æ¯æèªå¨çæä¸»é® --> |
| | | <setting name="useGeneratedKeys" value="true" /> |
| | | <!-- é
ç½®é»è®¤çæ§è¡å¨.SIMPLEå°±æ¯æ®éæ§è¡å¨;REUSEæ§è¡å¨ä¼éç¨é¢å¤çè¯å¥(prepared statements);BATCHæ§è¡å¨å°éç¨è¯å¥å¹¶æ§è¡æ¹éæ´æ° --> |
| | | <setting name="defaultExecutorType" value="SIMPLE" /> |
| | | <!-- æå® MyBatis æç¨æ¥å¿çå
·ä½å®ç° --> |
| | | <setting name="logImpl" value="SLF4J" /> |
| | | <!-- 使ç¨é©¼å³°å½åæ³è½¬æ¢å段 --> |
| | | <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> |
| | | </settings> |
| | | |
| | | </configuration> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.9.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>ruoyi-common</artifactId> |
| | | |
| | | <description> |
| | | commonéç¨å·¥å
· |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- Springæ¡æ¶åºæ¬çæ ¸å¿å·¥å
· --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringWeb模å --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-web</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- spring security å®å
¨è®¤è¯ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- pagehelper å页æä»¶ --> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- èªå®ä¹éªè¯æ³¨è§£ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | |
| | | <!--常ç¨å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- JSONå·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>tools.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- é¿éJSONè§£æå¨ --> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- io常ç¨å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- excelå·¥å
· --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Tokençæä¸è§£æ--> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Jaxb --> |
| | | <dependency> |
| | | <groupId>javax.xml.bind</groupId> |
| | | <artifactId>jaxb-api</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- redis ç¼åæä½ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-cache</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- pool å¯¹è±¡æ± --> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- è§£æå®¢æ·ç«¯æä½ç³»ç»ãæµè§å¨ç --> |
| | | <dependency> |
| | | <groupId>nl.basjes.parse.useragent</groupId> |
| | | <artifactId>yauaa</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- servletå
--> |
| | | <dependency> |
| | | <groupId>jakarta.servlet</groupId> |
| | | <artifactId>jakarta.servlet-api</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * å¿å访é®ä¸é´ææ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface Anonymous |
| | | { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * æ°æ®æéè¿æ»¤æ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface DataScope |
| | | { |
| | | /** |
| | | * ç¨æ·è¡¨çå«å |
| | | */ |
| | | public String userAlias() default ""; |
| | | |
| | | /** |
| | | * é¨é¨è¡¨çå«å |
| | | */ |
| | | public String deptAlias() default ""; |
| | | |
| | | /** |
| | | * ç¨æ·å段å |
| | | */ |
| | | public String userField() default "user_id"; |
| | | |
| | | /** |
| | | * é¨é¨å段å |
| | | */ |
| | | public String deptField() default "dept_id"; |
| | | |
| | | /** |
| | | * æéå符ï¼ç¨äºå¤ä¸ªè§è²å¹é
符åè¦æ±çæéï¼é»è®¤æ ¹æ®æé注解@ssè·åï¼å¤ä¸ªæéç¨éå·åé弿¥ |
| | | */ |
| | | public String permission() default ""; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Inherited; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.ruoyi.common.enums.DataSourceType; |
| | | |
| | | /** |
| | | * èªå®ä¹å¤æ°æ®æºåæ¢æ³¨è§£ |
| | | * |
| | | * ä¼å
级ï¼å
æ¹æ³ï¼åç±»ï¼å¦ææ¹æ³è¦çäºç±»ä¸çæ°æ®æºç±»åï¼ä»¥æ¹æ³ç为åï¼å¦å以类ä¸ç为å |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | @Inherited |
| | | public @interface DataSource |
| | | { |
| | | /** |
| | | * åæ¢æ°æ®æºåç§° |
| | | */ |
| | | public DataSourceType value() default DataSourceType.MASTER; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import java.math.BigDecimal; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.IndexedColors; |
| | | import com.ruoyi.common.utils.poi.ExcelHandlerAdapter; |
| | | |
| | | /** |
| | | * èªå®ä¹å¯¼åºExcelæ°æ®æ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.FIELD) |
| | | public @interface Excel |
| | | { |
| | | /** |
| | | * å¯¼åºæ¶å¨excelä¸æåº |
| | | */ |
| | | public int sort() default Integer.MAX_VALUE; |
| | | |
| | | /** |
| | | * 导åºå°Excelä¸çåå. |
| | | */ |
| | | public String name() default ""; |
| | | |
| | | /** |
| | | * æ¥ææ ¼å¼, å¦: yyyy-MM-dd |
| | | */ |
| | | public String dateFormat() default ""; |
| | | |
| | | /** |
| | | * 妿æ¯åå
¸ç±»åï¼è¯·è®¾ç½®åå
¸çtypeå¼ (å¦: sys_user_sex) |
| | | */ |
| | | public String dictType() default ""; |
| | | |
| | | /** |
| | | * 读åå
å®¹è½¬è¡¨è¾¾å¼ (å¦: 0=ç·,1=女,2=æªç¥) |
| | | */ |
| | | public String readConverterExp() default ""; |
| | | |
| | | /** |
| | | * åé符ï¼è¯»åå符串ç»å
容 |
| | | */ |
| | | public String separator() default ","; |
| | | |
| | | /** |
| | | * BigDecimal 精度 é»è®¤:-1(é»è®¤ä¸å¼å¯BigDecimalæ ¼å¼å) |
| | | */ |
| | | public int scale() default -1; |
| | | |
| | | /** |
| | | * BigDecimal èå
¥è§å é»è®¤:BigDecimal.ROUND_HALF_EVEN |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; |
| | | |
| | | /** |
| | | * å¯¼åºæ¶å¨excel䏿¯ä¸ªåçé«åº¦ |
| | | */ |
| | | public double height() default 14; |
| | | |
| | | /** |
| | | * å¯¼åºæ¶å¨excel䏿¯ä¸ªåç宽度 |
| | | */ |
| | | public double width() default 16; |
| | | |
| | | /** |
| | | * æååç¼,å¦% 90 åæ90% |
| | | */ |
| | | public String suffix() default ""; |
| | | |
| | | /** |
| | | * å½å¼ä¸ºç©ºæ¶,åæ®µçé»è®¤å¼ |
| | | */ |
| | | public String defaultValue() default ""; |
| | | |
| | | /** |
| | | * æç¤ºä¿¡æ¯ |
| | | */ |
| | | public String prompt() default ""; |
| | | |
| | | /** |
| | | * æ¯å¦å
许å
容æ¢è¡ |
| | | */ |
| | | public boolean wrapText() default false; |
| | | |
| | | /** |
| | | * 设置åªè½éæ©ä¸è½è¾å
¥çåå
容. |
| | | */ |
| | | public String[] combo() default {}; |
| | | |
| | | /** |
| | | * æ¯å¦ä»åå
¸è¯»æ°æ®å°combo,é»è®¤ä¸è¯»å,å¦è¯»åéè¦è®¾ç½®dictType注解. |
| | | */ |
| | | public boolean comboReadDict() default false; |
| | | |
| | | /** |
| | | * æ¯å¦éè¦çºµååå¹¶åå
æ ¼,åºå¯¹éæ±:嫿listéååå
æ ¼) |
| | | */ |
| | | public boolean needMerge() default false; |
| | | |
| | | /** |
| | | * æ¯å¦å¯¼åºæ°æ®,åºå¯¹éæ±:ææ¶æä»¬éè¦å¯¼åºä¸ä»½æ¨¡æ¿,è¿æ¯æ é¢éè¦ä½å
容éè¦ç¨æ·æå·¥å¡«å. |
| | | */ |
| | | public boolean isExport() default true; |
| | | |
| | | /** |
| | | * å¦ä¸ä¸ªç±»ä¸ç屿§åç§°,æ¯æå¤çº§è·å,以尿°ç¹éå¼ |
| | | */ |
| | | public String targetAttr() default ""; |
| | | |
| | | /** |
| | | * æ¯å¦èªå¨ç»è®¡æ°æ®,卿å追å ä¸è¡ç»è®¡æ°æ®æ»å |
| | | */ |
| | | public boolean isStatistics() default false; |
| | | |
| | | /** |
| | | * 导åºç±»åï¼0æ°å 1å符串 2å¾çï¼ |
| | | */ |
| | | public ColumnType cellType() default ColumnType.STRING; |
| | | |
| | | /** |
| | | * 导åºåå¤´èæ¯é¢è² |
| | | */ |
| | | public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; |
| | | |
| | | /** |
| | | * 导åºå头åä½é¢è² |
| | | */ |
| | | public IndexedColors headerColor() default IndexedColors.WHITE; |
| | | |
| | | /** |
| | | * 导åºåå
æ ¼èæ¯é¢è² |
| | | */ |
| | | public IndexedColors backgroundColor() default IndexedColors.WHITE; |
| | | |
| | | /** |
| | | * 导åºåå
æ ¼åä½é¢è² |
| | | */ |
| | | public IndexedColors color() default IndexedColors.BLACK; |
| | | |
| | | /** |
| | | * 导åºåæ®µå¯¹é½æ¹å¼ |
| | | */ |
| | | public HorizontalAlignment align() default HorizontalAlignment.CENTER; |
| | | |
| | | /** |
| | | * èªå®ä¹æ°æ®å¤çå¨ |
| | | */ |
| | | public Class<?> handler() default ExcelHandlerAdapter.class; |
| | | |
| | | /** |
| | | * èªå®ä¹æ°æ®å¤çå¨åæ° |
| | | */ |
| | | public String[] args() default {}; |
| | | |
| | | /** |
| | | * åæ®µç±»åï¼0ï¼å¯¼åºå¯¼å
¥ï¼1ï¼ä»
导åºï¼2ï¼ä»
导å
¥ï¼ |
| | | */ |
| | | Type type() default Type.ALL; |
| | | |
| | | public enum Type |
| | | { |
| | | ALL(0), EXPORT(1), IMPORT(2); |
| | | private final int value; |
| | | |
| | | Type(int value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int value() |
| | | { |
| | | return this.value; |
| | | } |
| | | } |
| | | |
| | | public enum ColumnType |
| | | { |
| | | NUMERIC(0), STRING(1), IMAGE(2), TEXT(3); |
| | | private final int value; |
| | | |
| | | ColumnType(int value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int value() |
| | | { |
| | | return this.value; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * Excel注解é |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.FIELD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface Excels |
| | | { |
| | | public Excel[] value(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.OperatorType; |
| | | |
| | | /** |
| | | * èªå®ä¹æä½æ¥å¿è®°å½æ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @Target({ ElementType.PARAMETER, ElementType.METHOD }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface Log |
| | | { |
| | | /** |
| | | * 模å |
| | | */ |
| | | public String title() default ""; |
| | | |
| | | /** |
| | | * åè½ |
| | | */ |
| | | public BusinessType businessType() default BusinessType.OTHER; |
| | | |
| | | /** |
| | | * æä½äººç±»å« |
| | | */ |
| | | public OperatorType operatorType() default OperatorType.MANAGE; |
| | | |
| | | /** |
| | | * æ¯å¦ä¿å请æ±çåæ° |
| | | */ |
| | | public boolean isSaveRequestData() default true; |
| | | |
| | | /** |
| | | * æ¯å¦ä¿åååºçåæ° |
| | | */ |
| | | public boolean isSaveResponseData() default true; |
| | | |
| | | /** |
| | | * æé¤æå®ç请æ±åæ° |
| | | */ |
| | | public String[] excludeParamNames() default {}; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.enums.LimitType; |
| | | |
| | | /** |
| | | * éæµæ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface RateLimiter |
| | | { |
| | | /** |
| | | * éæµkey |
| | | */ |
| | | public String key() default CacheConstants.RATE_LIMIT_KEY; |
| | | |
| | | /** |
| | | * éæµæ¶é´,åä½ç§ |
| | | */ |
| | | public int time() default 60; |
| | | |
| | | /** |
| | | * éæµæ¬¡æ° |
| | | */ |
| | | public int count() default 100; |
| | | |
| | | /** |
| | | * éæµç±»å |
| | | */ |
| | | public LimitType limitType() default LimitType.DEFAULT; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Inherited; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * èªå®ä¹æ³¨è§£é²æ¢è¡¨åéå¤æäº¤ |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @Inherited |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface RepeatSubmit |
| | | { |
| | | /** |
| | | * é´éæ¶é´(ms)ï¼å°äºæ¤æ¶é´è§ä¸ºéå¤æäº¤ |
| | | */ |
| | | public int interval() default 5000; |
| | | |
| | | /** |
| | | * æç¤ºæ¶æ¯ |
| | | */ |
| | | public String message() default "ä¸å
许éå¤æäº¤ï¼è¯·ç¨ååè¯"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; |
| | | import tools.jackson.databind.annotation.JsonSerialize; |
| | | import com.ruoyi.common.config.serializer.SensitiveJsonSerializer; |
| | | import com.ruoyi.common.enums.DesensitizedType; |
| | | |
| | | /** |
| | | * æ°æ®è±ææ³¨è§£ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ ElementType.FIELD, ElementType.METHOD }) |
| | | @JacksonAnnotationsInside |
| | | @JsonSerialize(using = SensitiveJsonSerializer.class) |
| | | public @interface Sensitive |
| | | { |
| | | DesensitizedType desensitizedType(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 读å项ç®ç¸å
³é
ç½® |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = "ruoyi") |
| | | public class RuoYiConfig |
| | | { |
| | | /** 项ç®åç§° */ |
| | | private String name; |
| | | |
| | | /** çæ¬ */ |
| | | private String version; |
| | | |
| | | /** çæå¹´ä»½ */ |
| | | private String copyrightYear; |
| | | |
| | | /** ä¸ä¼ è·¯å¾ */ |
| | | private static String profile; |
| | | |
| | | /** è·åå°åå¼å
³ */ |
| | | private static boolean addressEnabled; |
| | | |
| | | /** éªè¯ç ç±»å */ |
| | | private static String captchaType; |
| | | |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getVersion() |
| | | { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) |
| | | { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getCopyrightYear() |
| | | { |
| | | return copyrightYear; |
| | | } |
| | | |
| | | public void setCopyrightYear(String copyrightYear) |
| | | { |
| | | this.copyrightYear = copyrightYear; |
| | | } |
| | | |
| | | public static String getProfile() |
| | | { |
| | | return profile; |
| | | } |
| | | |
| | | public void setProfile(String profile) |
| | | { |
| | | RuoYiConfig.profile = profile; |
| | | } |
| | | |
| | | public static boolean isAddressEnabled() |
| | | { |
| | | return addressEnabled; |
| | | } |
| | | |
| | | public void setAddressEnabled(boolean addressEnabled) |
| | | { |
| | | RuoYiConfig.addressEnabled = addressEnabled; |
| | | } |
| | | |
| | | public static String getCaptchaType() { |
| | | return captchaType; |
| | | } |
| | | |
| | | public void setCaptchaType(String captchaType) { |
| | | RuoYiConfig.captchaType = captchaType; |
| | | } |
| | | |
| | | /** |
| | | * è·å导å
¥ä¸ä¼ è·¯å¾ |
| | | */ |
| | | public static String getImportPath() |
| | | { |
| | | return getProfile() + "/import"; |
| | | } |
| | | |
| | | /** |
| | | * è·å头åä¸ä¼ è·¯å¾ |
| | | */ |
| | | public static String getAvatarPath() |
| | | { |
| | | return getProfile() + "/avatar"; |
| | | } |
| | | |
| | | /** |
| | | * è·åä¸è½½è·¯å¾ |
| | | */ |
| | | public static String getDownloadPath() |
| | | { |
| | | return getProfile() + "/download/"; |
| | | } |
| | | |
| | | /** |
| | | * è·åä¸ä¼ è·¯å¾ |
| | | */ |
| | | public static String getUploadPath() |
| | | { |
| | | return getProfile() + "/upload"; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config.serializer; |
| | | |
| | | import java.util.Objects; |
| | | import tools.jackson.core.JacksonException; |
| | | import tools.jackson.core.JsonGenerator; |
| | | import tools.jackson.databind.BeanProperty; |
| | | import tools.jackson.databind.DatabindException; |
| | | import tools.jackson.databind.SerializationContext; |
| | | import tools.jackson.databind.ValueSerializer; |
| | | import tools.jackson.databind.ser.std.StdSerializer; |
| | | import com.ruoyi.common.annotation.Sensitive; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.DesensitizedType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | |
| | | /** |
| | | * æ°æ®è±æåºååè¿æ»¤ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SensitiveJsonSerializer extends StdSerializer<String> |
| | | { |
| | | private final DesensitizedType desensitizedType; |
| | | |
| | | public SensitiveJsonSerializer() |
| | | { |
| | | super(String.class); |
| | | this.desensitizedType = null; |
| | | } |
| | | |
| | | public SensitiveJsonSerializer(DesensitizedType desensitizedType) |
| | | { |
| | | super(String.class); |
| | | this.desensitizedType = desensitizedType; |
| | | } |
| | | |
| | | @Override |
| | | public void serialize(String value, JsonGenerator gen, SerializationContext ctxt) throws JacksonException |
| | | { |
| | | if (desensitizedType != null && desensitization()) |
| | | { |
| | | gen.writeString(desensitizedType.desensitizer().apply(value)); |
| | | } |
| | | else |
| | | { |
| | | gen.writeString(value); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ValueSerializer<?> createContextual(SerializationContext ctxt, BeanProperty property) throws DatabindException |
| | | { |
| | | Sensitive annotation = property.getAnnotation(Sensitive.class); |
| | | if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass())) |
| | | { |
| | | return new SensitiveJsonSerializer(annotation.desensitizedType()); |
| | | } |
| | | return ctxt.findValueSerializer(property.getType()); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦éè¦è±æå¤ç |
| | | */ |
| | | private boolean desensitization() |
| | | { |
| | | try |
| | | { |
| | | LoginUser securityUser = SecurityUtils.getLoginUser(); |
| | | // 管çåä¸è±æ |
| | | return !securityUser.getUser().isAdmin(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * ç¼åçkey 常é |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CacheConstants |
| | | { |
| | | /** |
| | | * ç»å½ç¨æ· redis key |
| | | */ |
| | | public static final String LOGIN_TOKEN_KEY = "login_tokens:"; |
| | | |
| | | /** |
| | | * éªè¯ç redis key |
| | | */ |
| | | public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; |
| | | |
| | | /** |
| | | * åæ°ç®¡ç cache key |
| | | */ |
| | | public static final String SYS_CONFIG_KEY = "sys_config:"; |
| | | |
| | | /** |
| | | * åå
¸ç®¡ç cache key |
| | | */ |
| | | public static final String SYS_DICT_KEY = "sys_dict:"; |
| | | |
| | | /** |
| | | * é²éæäº¤ redis key |
| | | */ |
| | | public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; |
| | | |
| | | /** |
| | | * éæµ redis key |
| | | */ |
| | | public static final String RATE_LIMIT_KEY = "rate_limit:"; |
| | | |
| | | /** |
| | | * ç»å½è´¦æ·å¯ç éè¯¯æ¬¡æ° redis key |
| | | */ |
| | | public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | import java.util.Locale; |
| | | import io.jsonwebtoken.Claims; |
| | | |
| | | /** |
| | | * éç¨å¸¸éä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Constants |
| | | { |
| | | /** |
| | | * UTF-8 å符é |
| | | */ |
| | | public static final String UTF8 = "UTF-8"; |
| | | |
| | | /** |
| | | * GBK å符é |
| | | */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** |
| | | * ç³»ç»è¯è¨ |
| | | */ |
| | | public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE; |
| | | |
| | | /** |
| | | * www主å |
| | | */ |
| | | public static final String WWW = "www."; |
| | | |
| | | /** |
| | | * httpè¯·æ± |
| | | */ |
| | | public static final String HTTP = "http://"; |
| | | |
| | | /** |
| | | * httpsè¯·æ± |
| | | */ |
| | | public static final String HTTPS = "https://"; |
| | | |
| | | /** |
| | | * éç¨æåæ è¯ |
| | | */ |
| | | public static final String SUCCESS = "0"; |
| | | |
| | | /** |
| | | * éç¨å¤±è´¥æ è¯ |
| | | */ |
| | | public static final String FAIL = "1"; |
| | | |
| | | /** |
| | | * ç»å½æå |
| | | */ |
| | | public static final String LOGIN_SUCCESS = "Success"; |
| | | |
| | | /** |
| | | * 注é |
| | | */ |
| | | public static final String LOGOUT = "Logout"; |
| | | |
| | | /** |
| | | * 注å |
| | | */ |
| | | public static final String REGISTER = "Register"; |
| | | |
| | | /** |
| | | * ç»å½å¤±è´¥ |
| | | */ |
| | | public static final String LOGIN_FAIL = "Error"; |
| | | |
| | | /** |
| | | * æææéæ è¯ |
| | | */ |
| | | public static final String ALL_PERMISSION = "*:*:*"; |
| | | |
| | | /** |
| | | * 管çåè§è²æéæ è¯ |
| | | */ |
| | | public static final String SUPER_ADMIN = "admin"; |
| | | |
| | | /** |
| | | * è§è²æéåé符 |
| | | */ |
| | | public static final String ROLE_DELIMITER = ","; |
| | | |
| | | /** |
| | | * æéæ è¯åé符 |
| | | */ |
| | | public static final String PERMISSION_DELIMITER = ","; |
| | | |
| | | /** |
| | | * éªè¯ç æææï¼åéï¼ |
| | | */ |
| | | public static final Integer CAPTCHA_EXPIRATION = 2; |
| | | |
| | | /** |
| | | * 令ç |
| | | */ |
| | | public static final String TOKEN = "token"; |
| | | |
| | | /** |
| | | * 令çåç¼ |
| | | */ |
| | | public static final String TOKEN_PREFIX = "Bearer "; |
| | | |
| | | /** |
| | | * 令çåç¼ |
| | | */ |
| | | public static final String LOGIN_USER_KEY = "login_user_key"; |
| | | |
| | | /** |
| | | * ç¨æ·ID |
| | | */ |
| | | public static final String JWT_USERID = "userid"; |
| | | |
| | | /** |
| | | * ç¨æ·åç§° |
| | | */ |
| | | public static final String JWT_USERNAME = Claims.SUBJECT; |
| | | |
| | | /** |
| | | * ç¨æ·å¤´å |
| | | */ |
| | | public static final String JWT_AVATAR = "avatar"; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | public static final String JWT_CREATED = "created"; |
| | | |
| | | /** |
| | | * ç¨æ·æé |
| | | */ |
| | | public static final String JWT_AUTHORITIES = "authorities"; |
| | | |
| | | /** |
| | | * èµæºæ å°è·¯å¾ åç¼ |
| | | */ |
| | | public static final String RESOURCE_PREFIX = "/profile"; |
| | | |
| | | /** |
| | | * RMI è¿ç¨æ¹æ³è°ç¨ |
| | | */ |
| | | public static final String LOOKUP_RMI = "rmi:"; |
| | | |
| | | /** |
| | | * LDAP è¿ç¨æ¹æ³è°ç¨ |
| | | */ |
| | | public static final String LOOKUP_LDAP = "ldap:"; |
| | | |
| | | /** |
| | | * LDAPS è¿ç¨æ¹æ³è°ç¨ |
| | | */ |
| | | public static final String LOOKUP_LDAPS = "ldaps:"; |
| | | |
| | | /** |
| | | * èªå¨è¯å«json对象ç½ååé
ç½®ï¼ä»
å
许解æçå
åï¼èå´è¶å°è¶å®å
¨ï¼ |
| | | */ |
| | | public static final String[] JSON_WHITELIST_STR = { "com.ruoyi" }; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ç½ååé
ç½®ï¼ä»
å
许访é®çå
åï¼å¦å
¶ä»éè¦å¯ä»¥èªè¡æ·»å ï¼ |
| | | */ |
| | | public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" }; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è¿è§çå符 |
| | | */ |
| | | public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", |
| | | "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" }; |
| | | |
| | | /** |
| | | * é¨é¨ç¸å
³å¸¸é |
| | | */ |
| | | public static class Dept |
| | | { |
| | | /** |
| | | * å
¨é¨æ°æ®æé |
| | | */ |
| | | public static final String DATA_SCOPE_ALL = "1"; |
| | | |
| | | /** |
| | | * èªå®æ°æ®æé |
| | | */ |
| | | public static final String DATA_SCOPE_CUSTOM = "2"; |
| | | |
| | | /** |
| | | * é¨é¨æ°æ®æé |
| | | */ |
| | | public static final String DATA_SCOPE_DEPT = "3"; |
| | | |
| | | /** |
| | | * é¨é¨å以䏿°æ®æé |
| | | */ |
| | | public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; |
| | | |
| | | /** |
| | | * ä»
æ¬äººæ°æ®æé |
| | | */ |
| | | public static final String DATA_SCOPE_SELF = "5"; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * 代ç çæéç¨å¸¸é |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class GenConstants |
| | | { |
| | | /** å表ï¼å¢å æ¹æ¥ï¼ */ |
| | | public static final String TPL_CRUD = "crud"; |
| | | |
| | | /** æ 表ï¼å¢å æ¹æ¥ï¼ */ |
| | | public static final String TPL_TREE = "tree"; |
| | | |
| | | /** 主å表ï¼å¢å æ¹æ¥ï¼ */ |
| | | public static final String TPL_SUB = "sub"; |
| | | |
| | | /** æ ç¼ç åæ®µ */ |
| | | public static final String TREE_CODE = "treeCode"; |
| | | |
| | | /** æ ç¶ç¼ç åæ®µ */ |
| | | public static final String TREE_PARENT_CODE = "treeParentCode"; |
| | | |
| | | /** æ åç§°åæ®µ */ |
| | | public static final String TREE_NAME = "treeName"; |
| | | |
| | | /** ä¸çº§èåIDåæ®µ */ |
| | | public static final String PARENT_MENU_ID = "parentMenuId"; |
| | | |
| | | /** ä¸çº§èååç§°åæ®µ */ |
| | | public static final String PARENT_MENU_NAME = "parentMenuName"; |
| | | |
| | | /** çæè¯¦æ
页å¼å
³ */ |
| | | public static final String GEN_VIEW = "genView"; |
| | | |
| | | /** æ°æ®åºå符串类å */ |
| | | public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; |
| | | |
| | | /** æ°æ®åºææ¬ç±»å */ |
| | | public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; |
| | | |
| | | /** æ°æ®åºæ¶é´ç±»å */ |
| | | public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; |
| | | |
| | | /** æ°æ®åºæ°åç±»å */ |
| | | public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", |
| | | "bit", "bigint", "float", "double", "decimal" }; |
| | | |
| | | /** 页é¢ä¸éè¦ç¼è¾å段 */ |
| | | public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; |
| | | |
| | | /** 页é¢ä¸éè¦æ¾ç¤ºçåè¡¨åæ®µ */ |
| | | public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", |
| | | "update_time" }; |
| | | |
| | | /** 页é¢ä¸éè¦æ¥è¯¢å段 */ |
| | | public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", |
| | | "update_time", "remark" }; |
| | | |
| | | /** Entityåºç±»å段 */ |
| | | public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; |
| | | |
| | | /** Treeåºç±»å段 */ |
| | | public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; |
| | | |
| | | /** ææ¬æ¡ */ |
| | | public static final String HTML_INPUT = "input"; |
| | | |
| | | /** ææ¬å */ |
| | | public static final String HTML_TEXTAREA = "textarea"; |
| | | |
| | | /** ä¸ææ¡ */ |
| | | public static final String HTML_SELECT = "select"; |
| | | |
| | | /** åéæ¡ */ |
| | | public static final String HTML_RADIO = "radio"; |
| | | |
| | | /** å¤éæ¡ */ |
| | | public static final String HTML_CHECKBOX = "checkbox"; |
| | | |
| | | /** æ¥ææ§ä»¶ */ |
| | | public static final String HTML_DATETIME = "datetime"; |
| | | |
| | | /** å¾çä¸ä¼ æ§ä»¶ */ |
| | | public static final String HTML_IMAGE_UPLOAD = "imageUpload"; |
| | | |
| | | /** æä»¶ä¸ä¼ æ§ä»¶ */ |
| | | public static final String HTML_FILE_UPLOAD = "fileUpload"; |
| | | |
| | | /** å¯ææ¬æ§ä»¶ */ |
| | | public static final String HTML_EDITOR = "editor"; |
| | | |
| | | /** å符串类å */ |
| | | public static final String TYPE_STRING = "String"; |
| | | |
| | | /** æ´å */ |
| | | public static final String TYPE_INTEGER = "Integer"; |
| | | |
| | | /** é¿æ´å */ |
| | | public static final String TYPE_LONG = "Long"; |
| | | |
| | | /** æµ®ç¹å */ |
| | | public static final String TYPE_DOUBLE = "Double"; |
| | | |
| | | /** é«ç²¾åº¦è®¡ç®ç±»å */ |
| | | public static final String TYPE_BIGDECIMAL = "BigDecimal"; |
| | | |
| | | /** æ¶é´ç±»å */ |
| | | public static final String TYPE_DATE = "Date"; |
| | | |
| | | /** æ¨¡ç³æ¥è¯¢ */ |
| | | public static final String QUERY_LIKE = "LIKE"; |
| | | |
| | | /** ç¸çæ¥è¯¢ */ |
| | | public static final String QUERY_EQ = "EQ"; |
| | | |
| | | /** éè¦ */ |
| | | public static final String REQUIRE = "1"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * è¿åç¶æç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpStatus |
| | | { |
| | | /** |
| | | * æä½æå |
| | | */ |
| | | public static final int SUCCESS = 200; |
| | | |
| | | /** |
| | | * 对象å建æå |
| | | */ |
| | | public static final int CREATED = 201; |
| | | |
| | | /** |
| | | * 请æ±å·²ç»è¢«æ¥å |
| | | */ |
| | | public static final int ACCEPTED = 202; |
| | | |
| | | /** |
| | | * æä½å·²ç»æ§è¡æåï¼ä½æ¯æ²¡æè¿åæ°æ® |
| | | */ |
| | | public static final int NO_CONTENT = 204; |
| | | |
| | | /** |
| | | * èµæºå·²è¢«ç§»é¤ |
| | | */ |
| | | public static final int MOVED_PERM = 301; |
| | | |
| | | /** |
| | | * éå®å |
| | | */ |
| | | public static final int SEE_OTHER = 303; |
| | | |
| | | /** |
| | | * èµæºæ²¡æè¢«ä¿®æ¹ |
| | | */ |
| | | public static final int NOT_MODIFIED = 304; |
| | | |
| | | /** |
| | | * åæ°å表é误ï¼ç¼ºå°ï¼æ ¼å¼ä¸å¹é
ï¼ |
| | | */ |
| | | public static final int BAD_REQUEST = 400; |
| | | |
| | | /** |
| | | * æªææ |
| | | */ |
| | | public static final int UNAUTHORIZED = 401; |
| | | |
| | | /** |
| | | * 访é®åéï¼ææè¿æ |
| | | */ |
| | | public static final int FORBIDDEN = 403; |
| | | |
| | | /** |
| | | * èµæºï¼æå¡æªæ¾å° |
| | | */ |
| | | public static final int NOT_FOUND = 404; |
| | | |
| | | /** |
| | | * ä¸å
许çhttpæ¹æ³ |
| | | */ |
| | | public static final int BAD_METHOD = 405; |
| | | |
| | | /** |
| | | * èµæºå²çªï¼æè
èµæºè¢«é |
| | | */ |
| | | public static final int CONFLICT = 409; |
| | | |
| | | /** |
| | | * 䏿¯æçæ°æ®ï¼åªä½ç±»å |
| | | */ |
| | | public static final int UNSUPPORTED_TYPE = 415; |
| | | |
| | | /** |
| | | * ç³»ç»å
é¨é误 |
| | | */ |
| | | public static final int ERROR = 500; |
| | | |
| | | /** |
| | | * æ¥å£æªå®ç° |
| | | */ |
| | | public static final int NOT_IMPLEMENTED = 501; |
| | | |
| | | /** |
| | | * ç³»ç»è¦åæ¶æ¯ |
| | | */ |
| | | public static final int WARN = 601; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * ä»»å¡è°åº¦éç¨å¸¸é |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ScheduleConstants |
| | | { |
| | | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; |
| | | |
| | | /** æ§è¡ç®æ key */ |
| | | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; |
| | | |
| | | /** é»è®¤ */ |
| | | public static final String MISFIRE_DEFAULT = "0"; |
| | | |
| | | /** ç«å³è§¦åæ§è¡ */ |
| | | public static final String MISFIRE_IGNORE_MISFIRES = "1"; |
| | | |
| | | /** 触å䏿¬¡æ§è¡ */ |
| | | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; |
| | | |
| | | /** ä¸è§¦åç«å³æ§è¡ */ |
| | | public static final String MISFIRE_DO_NOTHING = "3"; |
| | | |
| | | public enum Status |
| | | { |
| | | /** |
| | | * æ£å¸¸ |
| | | */ |
| | | NORMAL("0"), |
| | | /** |
| | | * æå |
| | | */ |
| | | PAUSE("1"); |
| | | |
| | | private String value; |
| | | |
| | | private Status(String value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() |
| | | { |
| | | return value; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * ç¨æ·å¸¸éä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserConstants |
| | | { |
| | | /** |
| | | * å¹³å°å
ç³»ç»ç¨æ·çå¯ä¸æ å¿ |
| | | */ |
| | | public static final String SYS_USER = "SYS_USER"; |
| | | |
| | | /** æ£å¸¸ç¶æ */ |
| | | public static final String NORMAL = "0"; |
| | | |
| | | /** å¼å¸¸ç¶æ */ |
| | | public static final String EXCEPTION = "1"; |
| | | |
| | | /** ç¨æ·å°ç¦ç¶æ */ |
| | | public static final String USER_DISABLE = "1"; |
| | | |
| | | /** è§è²æ£å¸¸ç¶æ */ |
| | | public static final String ROLE_NORMAL = "0"; |
| | | |
| | | /** è§è²å°ç¦ç¶æ */ |
| | | public static final String ROLE_DISABLE = "1"; |
| | | |
| | | /** é¨é¨æ£å¸¸ç¶æ */ |
| | | public static final String DEPT_NORMAL = "0"; |
| | | |
| | | /** é¨é¨åç¨ç¶æ */ |
| | | public static final String DEPT_DISABLE = "1"; |
| | | |
| | | /** åå
¸æ£å¸¸ç¶æ */ |
| | | public static final String DICT_NORMAL = "0"; |
| | | |
| | | /** æ¯å¦ä¸ºç³»ç»é»è®¤ï¼æ¯ï¼ */ |
| | | public static final String YES = "Y"; |
| | | |
| | | /** æ¯å¦èåå¤é¾ï¼æ¯ï¼ */ |
| | | public static final String YES_FRAME = "0"; |
| | | |
| | | /** æ¯å¦èåå¤é¾ï¼å¦ï¼ */ |
| | | public static final String NO_FRAME = "1"; |
| | | |
| | | /** èåç±»åï¼ç®å½ï¼ */ |
| | | public static final String TYPE_DIR = "M"; |
| | | |
| | | /** èåç±»åï¼èåï¼ */ |
| | | public static final String TYPE_MENU = "C"; |
| | | |
| | | /** èåç±»åï¼æé®ï¼ */ |
| | | public static final String TYPE_BUTTON = "F"; |
| | | |
| | | /** Layoutç»ä»¶æ è¯ */ |
| | | public final static String LAYOUT = "Layout"; |
| | | |
| | | /** ParentViewç»ä»¶æ è¯ */ |
| | | public final static String PARENT_VIEW = "ParentView"; |
| | | |
| | | /** InnerLinkç»ä»¶æ è¯ */ |
| | | public final static String INNER_LINK = "InnerLink"; |
| | | |
| | | /** æ ¡éªæ¯å¦å¯ä¸çè¿åæ è¯ */ |
| | | public final static boolean UNIQUE = true; |
| | | public final static boolean NOT_UNIQUE = false; |
| | | |
| | | /** |
| | | * ç¨æ·åé¿åº¦éå¶ |
| | | */ |
| | | public static final int USERNAME_MIN_LENGTH = 2; |
| | | public static final int USERNAME_MAX_LENGTH = 20; |
| | | |
| | | /** |
| | | * å¯ç é¿åº¦éå¶ |
| | | */ |
| | | public static final int PASSWORD_MIN_LENGTH = 5; |
| | | public static final int PASSWORD_MAX_LENGTH = 20; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.controller; |
| | | |
| | | import java.beans.PropertyEditorSupport; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.WebDataBinder; |
| | | import org.springframework.web.bind.annotation.InitBinder; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.PageDomain; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.page.TableSupport; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.sql.SqlUtil; |
| | | |
| | | /** |
| | | * webå±éç¨æ°æ®å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseController |
| | | { |
| | | protected final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | /** |
| | | * å°åå°ä¼ éè¿æ¥çæ¥ææ ¼å¼çå符串ï¼èªå¨è½¬å为Dateç±»å |
| | | */ |
| | | @InitBinder |
| | | public void initBinder(WebDataBinder binder) |
| | | { |
| | | // Date ç±»åè½¬æ¢ |
| | | binder.registerCustomEditor(Date.class, new PropertyEditorSupport() |
| | | { |
| | | @Override |
| | | public void setAsText(String text) |
| | | { |
| | | setValue(DateUtils.parseDate(text)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 设置请æ±åé¡µæ°æ® |
| | | */ |
| | | protected void startPage() |
| | | { |
| | | PageUtils.startPage(); |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®è¯·æ±æåºæ°æ® |
| | | */ |
| | | protected void startOrderBy() |
| | | { |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) |
| | | { |
| | | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
| | | PageHelper.orderBy(orderBy); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¸
çå页ç线ç¨åé |
| | | */ |
| | | protected void clearPage() |
| | | { |
| | | PageUtils.clearPage(); |
| | | } |
| | | |
| | | /** |
| | | * ååºè¯·æ±åé¡µæ°æ® |
| | | */ |
| | | @SuppressWarnings({ "rawtypes", "unchecked" }) |
| | | protected TableDataInfo getDataTable(List<?> list) |
| | | { |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | rspData.setCode(HttpStatus.SUCCESS); |
| | | rspData.setMsg("æ¥è¯¢æå"); |
| | | rspData.setRows(list); |
| | | rspData.setTotal(new PageInfo(list).getTotal()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |
| | | * è¿åæå |
| | | */ |
| | | public AjaxResult success() |
| | | { |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * è¿åå¤±è´¥æ¶æ¯ |
| | | */ |
| | | public AjaxResult error() |
| | | { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ¶æ¯ |
| | | */ |
| | | public AjaxResult success(String message) |
| | | { |
| | | return AjaxResult.success(message); |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ¶æ¯ |
| | | */ |
| | | public AjaxResult success(Object data) |
| | | { |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | /** |
| | | * è¿åå¤±è´¥æ¶æ¯ |
| | | */ |
| | | public AjaxResult error(String message) |
| | | { |
| | | return AjaxResult.error(message); |
| | | } |
| | | |
| | | /** |
| | | * è¿åè¦åæ¶æ¯ |
| | | */ |
| | | public AjaxResult warn(String message) |
| | | { |
| | | return AjaxResult.warn(message); |
| | | } |
| | | |
| | | /** |
| | | * ååºè¿åç»æ |
| | | * |
| | | * @param rows å½±åè¡æ° |
| | | * @return æä½ç»æ |
| | | */ |
| | | protected AjaxResult toAjax(int rows) |
| | | { |
| | | return rows > 0 ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | | * ååºè¿åç»æ |
| | | * |
| | | * @param result ç»æ |
| | | * @return æä½ç»æ |
| | | */ |
| | | protected AjaxResult toAjax(boolean result) |
| | | { |
| | | return result ? success() : error(); |
| | | } |
| | | |
| | | /** |
| | | * 页é¢è·³è½¬ |
| | | */ |
| | | public String redirect(String url) |
| | | { |
| | | return StringUtils.format("redirect:{}", url); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·ç¼åä¿¡æ¯ |
| | | */ |
| | | public LoginUser getLoginUser() |
| | | { |
| | | return SecurityUtils.getLoginUser(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç»å½ç¨æ·id |
| | | */ |
| | | public Long getUserId() |
| | | { |
| | | return getLoginUser().getUserId(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç»å½é¨é¨id |
| | | */ |
| | | public Long getDeptId() |
| | | { |
| | | return getLoginUser().getDeptId(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç»å½ç¨æ·å |
| | | */ |
| | | public String getUsername() |
| | | { |
| | | return getLoginUser().getUsername(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Objects; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * æä½æ¶æ¯æé |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class AjaxResult extends HashMap<String, Object> |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ç¶æç */ |
| | | public static final String CODE_TAG = "code"; |
| | | |
| | | /** è¿åå
容 */ |
| | | public static final String MSG_TAG = "msg"; |
| | | |
| | | /** æ°æ®å¯¹è±¡ */ |
| | | public static final String DATA_TAG = "data"; |
| | | |
| | | /** |
| | | * åå§åä¸ä¸ªæ°å建ç AjaxResult 对象ï¼ä½¿å
¶è¡¨ç¤ºä¸ä¸ªç©ºæ¶æ¯ã |
| | | */ |
| | | public AjaxResult() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * åå§åä¸ä¸ªæ°å建ç AjaxResult 对象 |
| | | * |
| | | * @param code ç¶æç |
| | | * @param msg è¿åå
容 |
| | | */ |
| | | public AjaxResult(int code, String msg) |
| | | { |
| | | super.put(CODE_TAG, code); |
| | | super.put(MSG_TAG, msg); |
| | | } |
| | | |
| | | /** |
| | | * åå§åä¸ä¸ªæ°å建ç AjaxResult 对象 |
| | | * |
| | | * @param code ç¶æç |
| | | * @param msg è¿åå
容 |
| | | * @param data æ°æ®å¯¹è±¡ |
| | | */ |
| | | public AjaxResult(int code, String msg, Object data) |
| | | { |
| | | super.put(CODE_TAG, code); |
| | | super.put(MSG_TAG, msg); |
| | | if (StringUtils.isNotNull(data)) |
| | | { |
| | | super.put(DATA_TAG, data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ¶æ¯ |
| | | * |
| | | * @return æåæ¶æ¯ |
| | | */ |
| | | public static AjaxResult success() |
| | | { |
| | | return AjaxResult.success("æä½æå"); |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ°æ® |
| | | * |
| | | * @return æåæ¶æ¯ |
| | | */ |
| | | public static AjaxResult success(Object data) |
| | | { |
| | | return AjaxResult.success("æä½æå", data); |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @return æåæ¶æ¯ |
| | | */ |
| | | public static AjaxResult success(String msg) |
| | | { |
| | | return AjaxResult.success(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * è¿åæåæ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @param data æ°æ®å¯¹è±¡ |
| | | * @return æåæ¶æ¯ |
| | | */ |
| | | public static AjaxResult success(String msg, Object data) |
| | | { |
| | | return new AjaxResult(HttpStatus.SUCCESS, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * è¿åè¦åæ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @return è¦åæ¶æ¯ |
| | | */ |
| | | public static AjaxResult warn(String msg) |
| | | { |
| | | return AjaxResult.warn(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * è¿åè¦åæ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @param data æ°æ®å¯¹è±¡ |
| | | * @return è¦åæ¶æ¯ |
| | | */ |
| | | public static AjaxResult warn(String msg, Object data) |
| | | { |
| | | return new AjaxResult(HttpStatus.WARN, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * è¿åéè¯¯æ¶æ¯ |
| | | * |
| | | * @return éè¯¯æ¶æ¯ |
| | | */ |
| | | public static AjaxResult error() |
| | | { |
| | | return AjaxResult.error("æä½å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | | * è¿åéè¯¯æ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @return éè¯¯æ¶æ¯ |
| | | */ |
| | | public static AjaxResult error(String msg) |
| | | { |
| | | return AjaxResult.error(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * è¿åéè¯¯æ¶æ¯ |
| | | * |
| | | * @param msg è¿åå
容 |
| | | * @param data æ°æ®å¯¹è±¡ |
| | | * @return éè¯¯æ¶æ¯ |
| | | */ |
| | | public static AjaxResult error(String msg, Object data) |
| | | { |
| | | return new AjaxResult(HttpStatus.ERROR, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * è¿åéè¯¯æ¶æ¯ |
| | | * |
| | | * @param code ç¶æç |
| | | * @param msg è¿åå
容 |
| | | * @return éè¯¯æ¶æ¯ |
| | | */ |
| | | public static AjaxResult error(int code, String msg) |
| | | { |
| | | return new AjaxResult(code, msg, null); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºæåæ¶æ¯ |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public boolean isSuccess() |
| | | { |
| | | return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG)); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºè¦åæ¶æ¯ |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public boolean isWarn() |
| | | { |
| | | return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG)); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºéè¯¯æ¶æ¯ |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public boolean isError() |
| | | { |
| | | return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG)); |
| | | } |
| | | |
| | | /** |
| | | * æ¹ä¾¿é¾å¼è°ç¨ |
| | | * |
| | | * @param key é® |
| | | * @param value å¼ |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public AjaxResult put(String key, Object value) |
| | | { |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | |
| | | /** |
| | | * Entityåºç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseEntity implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** æç´¢å¼ */ |
| | | @JsonIgnore |
| | | private String searchValue; |
| | | |
| | | /** å建è
*/ |
| | | private String createBy; |
| | | |
| | | /** å建æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** æ´æ°è
*/ |
| | | private String updateBy; |
| | | |
| | | /** æ´æ°æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** 夿³¨ */ |
| | | private String remark; |
| | | |
| | | /** 请æ±åæ° */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private Map<String, Object> params; |
| | | |
| | | public String getSearchValue() |
| | | { |
| | | return searchValue; |
| | | } |
| | | |
| | | public void setSearchValue(String searchValue) |
| | | { |
| | | this.searchValue = searchValue; |
| | | } |
| | | |
| | | public String getCreateBy() |
| | | { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) |
| | | { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public Date getCreateTime() |
| | | { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) |
| | | { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getUpdateBy() |
| | | { |
| | | return updateBy; |
| | | } |
| | | |
| | | public void setUpdateBy(String updateBy) |
| | | { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | public Date getUpdateTime() |
| | | { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) |
| | | { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getRemark() |
| | | { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) |
| | | { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Map<String, Object> getParams() |
| | | { |
| | | if (params == null) |
| | | { |
| | | params = new HashMap<>(); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(Map<String, Object> params) |
| | | { |
| | | this.params = params; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | |
| | | /** |
| | | * ååºä¿¡æ¯ä¸»ä½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class R<T> implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** æå */ |
| | | public static final int SUCCESS = HttpStatus.SUCCESS; |
| | | |
| | | /** 失败 */ |
| | | public static final int FAIL = HttpStatus.ERROR; |
| | | |
| | | private int code; |
| | | |
| | | private String msg; |
| | | |
| | | private T data; |
| | | |
| | | public static <T> R<T> ok() |
| | | { |
| | | return restResult(null, SUCCESS, "æä½æå"); |
| | | } |
| | | |
| | | public static <T> R<T> ok(T data) |
| | | { |
| | | return restResult(data, SUCCESS, "æä½æå"); |
| | | } |
| | | |
| | | public static <T> R<T> ok(T data, String msg) |
| | | { |
| | | return restResult(data, SUCCESS, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail() |
| | | { |
| | | return restResult(null, FAIL, "æä½å¤±è´¥"); |
| | | } |
| | | |
| | | public static <T> R<T> fail(String msg) |
| | | { |
| | | return restResult(null, FAIL, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail(T data) |
| | | { |
| | | return restResult(data, FAIL, "æä½å¤±è´¥"); |
| | | } |
| | | |
| | | public static <T> R<T> fail(T data, String msg) |
| | | { |
| | | return restResult(data, FAIL, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail(int code, String msg) |
| | | { |
| | | return restResult(null, code, msg); |
| | | } |
| | | |
| | | private static <T> R<T> restResult(T data, int code, String msg) |
| | | { |
| | | R<T> apiResult = new R<>(); |
| | | apiResult.setCode(code); |
| | | apiResult.setData(data); |
| | | apiResult.setMsg(msg); |
| | | return apiResult; |
| | | } |
| | | |
| | | public int getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) |
| | | { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() |
| | | { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) |
| | | { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public T getData() |
| | | { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(T data) |
| | | { |
| | | this.data = data; |
| | | } |
| | | |
| | | public static <T> Boolean isError(R<T> ret) |
| | | { |
| | | return !isSuccess(ret); |
| | | } |
| | | |
| | | public static <T> Boolean isSuccess(R<T> ret) |
| | | { |
| | | return R.SUCCESS == ret.getCode(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Treeåºç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TreeEntity extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ç¶èååç§° */ |
| | | private String parentName; |
| | | |
| | | /** ç¶èåID */ |
| | | private Long parentId; |
| | | |
| | | /** æ¾ç¤ºé¡ºåº */ |
| | | private Integer orderNum; |
| | | |
| | | /** ç¥çº§å表 */ |
| | | private String ancestors; |
| | | |
| | | /** åé¨é¨ */ |
| | | private List<?> children = new ArrayList<>(); |
| | | |
| | | public String getParentName() |
| | | { |
| | | return parentName; |
| | | } |
| | | |
| | | public void setParentName(String parentName) |
| | | { |
| | | this.parentName = parentName; |
| | | } |
| | | |
| | | public Long getParentId() |
| | | { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) |
| | | { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public Integer getOrderNum() |
| | | { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) |
| | | { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public String getAncestors() |
| | | { |
| | | return ancestors; |
| | | } |
| | | |
| | | public void setAncestors(String ancestors) |
| | | { |
| | | this.ancestors = ancestors; |
| | | } |
| | | |
| | | public List<?> getChildren() |
| | | { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<?> children) |
| | | { |
| | | this.children = children; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * Treeselectæ ç»æå®ä½ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TreeSelect implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** èç¹ID */ |
| | | private Long id; |
| | | |
| | | /** èç¹åç§° */ |
| | | private String label; |
| | | |
| | | /** èç¹ç¦ç¨ */ |
| | | private boolean disabled = false; |
| | | |
| | | /** åèç¹ */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private List<TreeSelect> children; |
| | | |
| | | public TreeSelect() |
| | | { |
| | | |
| | | } |
| | | |
| | | public TreeSelect(SysDept dept) |
| | | { |
| | | this.id = dept.getDeptId(); |
| | | this.label = dept.getDeptName(); |
| | | this.disabled = StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()); |
| | | this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public TreeSelect(SysMenu menu) |
| | | { |
| | | this.id = menu.getMenuId(); |
| | | this.label = menu.getMenuName(); |
| | | this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLabel() |
| | | { |
| | | return label; |
| | | } |
| | | |
| | | public void setLabel(String label) |
| | | { |
| | | this.label = label; |
| | | } |
| | | |
| | | public boolean isDisabled() |
| | | { |
| | | return disabled; |
| | | } |
| | | |
| | | public void setDisabled(boolean disabled) |
| | | { |
| | | this.disabled = disabled; |
| | | } |
| | | |
| | | public List<TreeSelect> getChildren() |
| | | { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<TreeSelect> children) |
| | | { |
| | | this.children = children; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.validation.constraints.Email; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * é¨é¨è¡¨ sys_dept |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysDept extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** é¨é¨ID */ |
| | | private Long deptId; |
| | | |
| | | /** ç¶é¨é¨ID */ |
| | | private Long parentId; |
| | | |
| | | /** ç¥çº§å表 */ |
| | | private String ancestors; |
| | | |
| | | /** é¨é¨åç§° */ |
| | | private String deptName; |
| | | |
| | | /** æ¾ç¤ºé¡ºåº */ |
| | | private Integer orderNum; |
| | | |
| | | /** è´è´£äºº */ |
| | | private String leader; |
| | | |
| | | /** èç³»çµè¯ */ |
| | | private String phone; |
| | | |
| | | /** é®ç®± */ |
| | | private String email; |
| | | |
| | | /** é¨é¨ç¶æ:0æ£å¸¸,1åç¨ */ |
| | | private String status; |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** ç¶é¨é¨åç§° */ |
| | | private String parentName; |
| | | |
| | | /** åé¨é¨ */ |
| | | private List<SysDept> children = new ArrayList<SysDept>(); |
| | | |
| | | public Long getDeptId() |
| | | { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Long deptId) |
| | | { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public Long getParentId() |
| | | { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) |
| | | { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getAncestors() |
| | | { |
| | | return ancestors; |
| | | } |
| | | |
| | | public void setAncestors(String ancestors) |
| | | { |
| | | this.ancestors = ancestors; |
| | | } |
| | | |
| | | @NotBlank(message = "é¨é¨åç§°ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 30, message = "é¨é¨åç§°é¿åº¦ä¸è½è¶
è¿30个å符") |
| | | public String getDeptName() |
| | | { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) |
| | | { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | @NotNull(message = "æ¾ç¤ºé¡ºåºä¸è½ä¸ºç©º") |
| | | public Integer getOrderNum() |
| | | { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) |
| | | { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public String getLeader() |
| | | { |
| | | return leader; |
| | | } |
| | | |
| | | public void setLeader(String leader) |
| | | { |
| | | this.leader = leader; |
| | | } |
| | | |
| | | @Size(min = 0, max = 11, message = "èç³»çµè¯é¿åº¦ä¸è½è¶
è¿11个å符") |
| | | public String getPhone() |
| | | { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) |
| | | { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | @Email(message = "é®ç®±æ ¼å¼ä¸æ£ç¡®") |
| | | @Size(min = 0, max = 50, message = "é®ç®±é¿åº¦ä¸è½è¶
è¿50个å符") |
| | | public String getEmail() |
| | | { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) |
| | | { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getParentName() |
| | | { |
| | | return parentName; |
| | | } |
| | | |
| | | public void setParentName(String parentName) |
| | | { |
| | | this.parentName = parentName; |
| | | } |
| | | |
| | | public List<SysDept> getChildren() |
| | | { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<SysDept> children) |
| | | { |
| | | this.children = children; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("deptId", getDeptId()) |
| | | .append("parentId", getParentId()) |
| | | .append("ancestors", getAncestors()) |
| | | .append("deptName", getDeptName()) |
| | | .append("orderNum", getOrderNum()) |
| | | .append("leader", getLeader()) |
| | | .append("phone", getPhone()) |
| | | .append("email", getEmail()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * åå
¸æ°æ®è¡¨ sys_dict_data |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysDictData extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** åå
¸ç¼ç */ |
| | | @Excel(name = "åå
¸ç¼ç ", cellType = ColumnType.NUMERIC) |
| | | private Long dictCode; |
| | | |
| | | /** åå
¸æåº */ |
| | | @Excel(name = "åå
¸æåº", cellType = ColumnType.NUMERIC) |
| | | private Long dictSort; |
| | | |
| | | /** åå
¸æ ç¾ */ |
| | | @Excel(name = "åå
¸æ ç¾") |
| | | private String dictLabel; |
| | | |
| | | /** åå
¸é®å¼ */ |
| | | @Excel(name = "åå
¸é®å¼") |
| | | private String dictValue; |
| | | |
| | | /** åå
¸ç±»å */ |
| | | @Excel(name = "åå
¸ç±»å") |
| | | private String dictType; |
| | | |
| | | /** æ ·å¼å±æ§ï¼å
¶ä»æ ·å¼æ©å±ï¼ */ |
| | | private String cssClass; |
| | | |
| | | /** è¡¨æ ¼åå
¸æ ·å¼ */ |
| | | private String listClass; |
| | | |
| | | /** æ¯å¦é»è®¤ï¼Yæ¯ Nå¦ï¼ */ |
| | | @Excel(name = "æ¯å¦é»è®¤", readConverterExp = "Y=æ¯,N=å¦") |
| | | private String isDefault; |
| | | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | public Long getDictCode() |
| | | { |
| | | return dictCode; |
| | | } |
| | | |
| | | public void setDictCode(Long dictCode) |
| | | { |
| | | this.dictCode = dictCode; |
| | | } |
| | | |
| | | public Long getDictSort() |
| | | { |
| | | return dictSort; |
| | | } |
| | | |
| | | public void setDictSort(Long dictSort) |
| | | { |
| | | this.dictSort = dictSort; |
| | | } |
| | | |
| | | @NotBlank(message = "åå
¸æ ç¾ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "åå
¸æ ç¾é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getDictLabel() |
| | | { |
| | | return dictLabel; |
| | | } |
| | | |
| | | public void setDictLabel(String dictLabel) |
| | | { |
| | | this.dictLabel = dictLabel; |
| | | } |
| | | |
| | | @NotBlank(message = "åå
¸é®å¼ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "åå
¸é®å¼é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getDictValue() |
| | | { |
| | | return dictValue; |
| | | } |
| | | |
| | | public void setDictValue(String dictValue) |
| | | { |
| | | this.dictValue = dictValue; |
| | | } |
| | | |
| | | @NotBlank(message = "åå
¸ç±»åä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "åå
¸ç±»åé¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getDictType() |
| | | { |
| | | return dictType; |
| | | } |
| | | |
| | | public void setDictType(String dictType) |
| | | { |
| | | this.dictType = dictType; |
| | | } |
| | | |
| | | @Size(min = 0, max = 100, message = "æ ·å¼å±æ§é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getCssClass() |
| | | { |
| | | return cssClass; |
| | | } |
| | | |
| | | public void setCssClass(String cssClass) |
| | | { |
| | | this.cssClass = cssClass; |
| | | } |
| | | |
| | | public String getListClass() |
| | | { |
| | | return listClass; |
| | | } |
| | | |
| | | public void setListClass(String listClass) |
| | | { |
| | | this.listClass = listClass; |
| | | } |
| | | |
| | | public boolean getDefault() |
| | | { |
| | | return UserConstants.YES.equals(this.isDefault); |
| | | } |
| | | |
| | | public String getIsDefault() |
| | | { |
| | | return isDefault; |
| | | } |
| | | |
| | | public void setIsDefault(String isDefault) |
| | | { |
| | | this.isDefault = isDefault; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("dictCode", getDictCode()) |
| | | .append("dictSort", getDictSort()) |
| | | .append("dictLabel", getDictLabel()) |
| | | .append("dictValue", getDictValue()) |
| | | .append("dictType", getDictType()) |
| | | .append("cssClass", getCssClass()) |
| | | .append("listClass", getListClass()) |
| | | .append("isDefault", getIsDefault()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.Pattern; |
| | | import jakarta.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * åå
¸ç±»å表 sys_dict_type |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysDictType extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** åå
¸ä¸»é® */ |
| | | @Excel(name = "åå
¸ä¸»é®", cellType = ColumnType.NUMERIC) |
| | | private Long dictId; |
| | | |
| | | /** åå
¸åç§° */ |
| | | @Excel(name = "åå
¸åç§°") |
| | | private String dictName; |
| | | |
| | | /** åå
¸ç±»å */ |
| | | @Excel(name = "åå
¸ç±»å") |
| | | private String dictType; |
| | | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | public Long getDictId() |
| | | { |
| | | return dictId; |
| | | } |
| | | |
| | | public void setDictId(Long dictId) |
| | | { |
| | | this.dictId = dictId; |
| | | } |
| | | |
| | | @NotBlank(message = "åå
¸åç§°ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "åå
¸ç±»ååç§°é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getDictName() |
| | | { |
| | | return dictName; |
| | | } |
| | | |
| | | public void setDictName(String dictName) |
| | | { |
| | | this.dictName = dictName; |
| | | } |
| | | |
| | | @NotBlank(message = "åå
¸ç±»åä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "åå
¸ç±»åç±»åé¿åº¦ä¸è½è¶
è¿100个å符") |
| | | @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "åå
¸ç±»åå¿
须以忝å¼å¤´ï¼ä¸åªè½ä¸ºï¼å°ååæ¯ï¼æ°åï¼ä¸æ»çº¿ï¼") |
| | | public String getDictType() |
| | | { |
| | | return dictType; |
| | | } |
| | | |
| | | public void setDictType(String dictType) |
| | | { |
| | | this.dictType = dictType; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("dictId", getDictId()) |
| | | .append("dictName", getDictName()) |
| | | .append("dictType", getDictType()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * èåæé表 sys_menu |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysMenu extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** èåID */ |
| | | private Long menuId; |
| | | |
| | | /** èååç§° */ |
| | | private String menuName; |
| | | |
| | | /** ç¶èååç§° */ |
| | | private String parentName; |
| | | |
| | | /** ç¶èåID */ |
| | | private Long parentId; |
| | | |
| | | /** æ¾ç¤ºé¡ºåº */ |
| | | private Integer orderNum; |
| | | |
| | | /** è·¯ç±å°å */ |
| | | private String path; |
| | | |
| | | /** ç»ä»¶è·¯å¾ */ |
| | | private String component; |
| | | |
| | | /** è·¯ç±åæ° */ |
| | | private String query; |
| | | |
| | | /** è·¯ç±åç§°ï¼é»è®¤åè·¯ç±å°åç¸åçé©¼å³°æ ¼å¼ï¼æ³¨æï¼å 为vue3çæ¬çrouterä¼å é¤åç§°ç¸åè·¯ç±ï¼ä¸ºé¿å
ååçå²çªï¼ç¹æ®æ
åµå¯ä»¥èªå®ä¹ï¼ */ |
| | | private String routeName; |
| | | |
| | | /** æ¯å¦ä¸ºå¤é¾ï¼0æ¯ 1å¦ï¼ */ |
| | | private String isFrame; |
| | | |
| | | /** æ¯å¦ç¼åï¼0ç¼å 1ä¸ç¼åï¼ */ |
| | | private String isCache; |
| | | |
| | | /** ç±»åï¼Mç®å½ Cèå Fæé®ï¼ */ |
| | | private String menuType; |
| | | |
| | | /** æ¾ç¤ºç¶æï¼0æ¾ç¤º 1éèï¼ */ |
| | | private String visible; |
| | | |
| | | /** èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | private String status; |
| | | |
| | | /** æéå符串 */ |
| | | private String perms; |
| | | |
| | | /** èå徿 */ |
| | | private String icon; |
| | | |
| | | /** åèå */ |
| | | private List<SysMenu> children = new ArrayList<SysMenu>(); |
| | | |
| | | public Long getMenuId() |
| | | { |
| | | return menuId; |
| | | } |
| | | |
| | | public void setMenuId(Long menuId) |
| | | { |
| | | this.menuId = menuId; |
| | | } |
| | | |
| | | @NotBlank(message = "èååç§°ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 50, message = "èååç§°é¿åº¦ä¸è½è¶
è¿50个å符") |
| | | public String getMenuName() |
| | | { |
| | | return menuName; |
| | | } |
| | | |
| | | public void setMenuName(String menuName) |
| | | { |
| | | this.menuName = menuName; |
| | | } |
| | | |
| | | public String getParentName() |
| | | { |
| | | return parentName; |
| | | } |
| | | |
| | | public void setParentName(String parentName) |
| | | { |
| | | this.parentName = parentName; |
| | | } |
| | | |
| | | public Long getParentId() |
| | | { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) |
| | | { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | @NotNull(message = "æ¾ç¤ºé¡ºåºä¸è½ä¸ºç©º") |
| | | public Integer getOrderNum() |
| | | { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) |
| | | { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | @Size(min = 0, max = 200, message = "è·¯ç±å°åä¸è½è¶
è¿200个å符") |
| | | public String getPath() |
| | | { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) |
| | | { |
| | | this.path = path; |
| | | } |
| | | |
| | | @Size(min = 0, max = 200, message = "ç»ä»¶è·¯å¾ä¸è½è¶
è¿255个å符") |
| | | public String getComponent() |
| | | { |
| | | return component; |
| | | } |
| | | |
| | | public void setComponent(String component) |
| | | { |
| | | this.component = component; |
| | | } |
| | | |
| | | public String getQuery() |
| | | { |
| | | return query; |
| | | } |
| | | |
| | | public void setQuery(String query) |
| | | { |
| | | this.query = query; |
| | | } |
| | | |
| | | public String getRouteName() |
| | | { |
| | | return routeName; |
| | | } |
| | | |
| | | public void setRouteName(String routeName) |
| | | { |
| | | this.routeName = routeName; |
| | | } |
| | | |
| | | public String getIsFrame() |
| | | { |
| | | return isFrame; |
| | | } |
| | | |
| | | public void setIsFrame(String isFrame) |
| | | { |
| | | this.isFrame = isFrame; |
| | | } |
| | | |
| | | public String getIsCache() |
| | | { |
| | | return isCache; |
| | | } |
| | | |
| | | public void setIsCache(String isCache) |
| | | { |
| | | this.isCache = isCache; |
| | | } |
| | | |
| | | @NotBlank(message = "èåç±»åä¸è½ä¸ºç©º") |
| | | public String getMenuType() |
| | | { |
| | | return menuType; |
| | | } |
| | | |
| | | public void setMenuType(String menuType) |
| | | { |
| | | this.menuType = menuType; |
| | | } |
| | | |
| | | public String getVisible() |
| | | { |
| | | return visible; |
| | | } |
| | | |
| | | public void setVisible(String visible) |
| | | { |
| | | this.visible = visible; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Size(min = 0, max = 100, message = "æéæ è¯é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getPerms() |
| | | { |
| | | return perms; |
| | | } |
| | | |
| | | public void setPerms(String perms) |
| | | { |
| | | this.perms = perms; |
| | | } |
| | | |
| | | public String getIcon() |
| | | { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) |
| | | { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public List<SysMenu> getChildren() |
| | | { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<SysMenu> children) |
| | | { |
| | | this.children = children; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("menuId", getMenuId()) |
| | | .append("menuName", getMenuName()) |
| | | .append("parentId", getParentId()) |
| | | .append("orderNum", getOrderNum()) |
| | | .append("path", getPath()) |
| | | .append("component", getComponent()) |
| | | .append("query", getQuery()) |
| | | .append("routeName", getRouteName()) |
| | | .append("isFrame", getIsFrame()) |
| | | .append("IsCache", getIsCache()) |
| | | .append("menuType", getMenuType()) |
| | | .append("visible", getVisible()) |
| | | .append("status ", getStatus()) |
| | | .append("perms", getPerms()) |
| | | .append("icon", getIcon()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import java.util.Set; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * è§è²è¡¨ sys_role |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysRole extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** è§è²ID */ |
| | | @Excel(name = "è§è²åºå·", cellType = ColumnType.NUMERIC) |
| | | private Long roleId; |
| | | |
| | | /** è§è²åç§° */ |
| | | @Excel(name = "è§è²åç§°") |
| | | private String roleName; |
| | | |
| | | /** è§è²æé */ |
| | | @Excel(name = "è§è²æé") |
| | | private String roleKey; |
| | | |
| | | /** è§è²æåº */ |
| | | @Excel(name = "è§è²æåº") |
| | | private Integer roleSort; |
| | | |
| | | /** æ°æ®èå´ï¼1ï¼æææ°æ®æéï¼2ï¼èªå®ä¹æ°æ®æéï¼3ï¼æ¬é¨é¨æ°æ®æéï¼4ï¼æ¬é¨é¨å以䏿°æ®æéï¼5ï¼ä»
æ¬äººæ°æ®æéï¼ */ |
| | | @Excel(name = "æ°æ®èå´", readConverterExp = "1=æææ°æ®æé,2=èªå®ä¹æ°æ®æé,3=æ¬é¨é¨æ°æ®æé,4=æ¬é¨é¨å以䏿°æ®æé,5=ä»
æ¬äººæ°æ®æé") |
| | | private String dataScope; |
| | | |
| | | /** èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤ºï¼ 0ï¼ç¶åä¸äºç¸å
³èæ¾ç¤º 1ï¼ç¶åäºç¸å
³èæ¾ç¤ºï¼ */ |
| | | private boolean menuCheckStrictly; |
| | | |
| | | /** é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤ºï¼0ï¼ç¶åä¸äºç¸å
³èæ¾ç¤º 1ï¼ç¶åäºç¸å
³èæ¾ç¤º ï¼ */ |
| | | private boolean deptCheckStrictly; |
| | | |
| | | /** è§è²ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "è§è²ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** ç¨æ·æ¯å¦å卿¤è§è²æ è¯ é»è®¤ä¸åå¨ */ |
| | | private boolean flag = false; |
| | | |
| | | /** èåç» */ |
| | | private Long[] menuIds; |
| | | |
| | | /** é¨é¨ç»ï¼æ°æ®æéï¼ */ |
| | | private Long[] deptIds; |
| | | |
| | | /** è§è²èåæé */ |
| | | private Set<String> permissions; |
| | | |
| | | public SysRole() |
| | | { |
| | | |
| | | } |
| | | |
| | | public SysRole(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public boolean isAdmin() |
| | | { |
| | | return isAdmin(this.roleId); |
| | | } |
| | | |
| | | public static boolean isAdmin(Long roleId) |
| | | { |
| | | return roleId != null && 1L == roleId; |
| | | } |
| | | |
| | | @NotBlank(message = "è§è²åç§°ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 30, message = "è§è²åç§°é¿åº¦ä¸è½è¶
è¿30个å符") |
| | | public String getRoleName() |
| | | { |
| | | return roleName; |
| | | } |
| | | |
| | | public void setRoleName(String roleName) |
| | | { |
| | | this.roleName = roleName; |
| | | } |
| | | |
| | | @NotBlank(message = "æéå符ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 100, message = "æéå符é¿åº¦ä¸è½è¶
è¿100个å符") |
| | | public String getRoleKey() |
| | | { |
| | | return roleKey; |
| | | } |
| | | |
| | | public void setRoleKey(String roleKey) |
| | | { |
| | | this.roleKey = roleKey; |
| | | } |
| | | |
| | | @NotNull(message = "æ¾ç¤ºé¡ºåºä¸è½ä¸ºç©º") |
| | | public Integer getRoleSort() |
| | | { |
| | | return roleSort; |
| | | } |
| | | |
| | | public void setRoleSort(Integer roleSort) |
| | | { |
| | | this.roleSort = roleSort; |
| | | } |
| | | |
| | | public String getDataScope() |
| | | { |
| | | return dataScope; |
| | | } |
| | | |
| | | public void setDataScope(String dataScope) |
| | | { |
| | | this.dataScope = dataScope; |
| | | } |
| | | |
| | | public boolean isMenuCheckStrictly() |
| | | { |
| | | return menuCheckStrictly; |
| | | } |
| | | |
| | | public void setMenuCheckStrictly(boolean menuCheckStrictly) |
| | | { |
| | | this.menuCheckStrictly = menuCheckStrictly; |
| | | } |
| | | |
| | | public boolean isDeptCheckStrictly() |
| | | { |
| | | return deptCheckStrictly; |
| | | } |
| | | |
| | | public void setDeptCheckStrictly(boolean deptCheckStrictly) |
| | | { |
| | | this.deptCheckStrictly = deptCheckStrictly; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public boolean isFlag() |
| | | { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(boolean flag) |
| | | { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | public Long[] getMenuIds() |
| | | { |
| | | return menuIds; |
| | | } |
| | | |
| | | public void setMenuIds(Long[] menuIds) |
| | | { |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | public Long[] getDeptIds() |
| | | { |
| | | return deptIds; |
| | | } |
| | | |
| | | public void setDeptIds(Long[] deptIds) |
| | | { |
| | | this.deptIds = deptIds; |
| | | } |
| | | |
| | | public Set<String> getPermissions() |
| | | { |
| | | return permissions; |
| | | } |
| | | |
| | | public void setPermissions(Set<String> permissions) |
| | | { |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("roleId", getRoleId()) |
| | | .append("roleName", getRoleName()) |
| | | .append("roleKey", getRoleKey()) |
| | | .append("roleSort", getRoleSort()) |
| | | .append("dataScope", getDataScope()) |
| | | .append("menuCheckStrictly", isMenuCheckStrictly()) |
| | | .append("deptCheckStrictly", isDeptCheckStrictly()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import jakarta.validation.constraints.*; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.annotation.Excel.Type; |
| | | import com.ruoyi.common.annotation.Excels; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.xss.Xss; |
| | | |
| | | /** |
| | | * ç¨æ·å¯¹è±¡ sys_user |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysUser extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ç¨æ·ID */ |
| | | @Excel(name = "ç¨æ·åºå·", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "ç¨æ·ç¼å·") |
| | | private Long userId; |
| | | |
| | | /** é¨é¨ID */ |
| | | @Excel(name = "é¨é¨ç¼å·", type = Type.IMPORT) |
| | | private Long deptId; |
| | | |
| | | /** ç¨æ·è´¦å· */ |
| | | @Excel(name = "ç»å½åç§°") |
| | | private String userName; |
| | | |
| | | /** ç¨æ·æµç§° */ |
| | | @Excel(name = "ç¨æ·åç§°") |
| | | private String nickName; |
| | | |
| | | /** ç¨æ·é®ç®± */ |
| | | @Excel(name = "ç¨æ·é®ç®±") |
| | | private String email; |
| | | |
| | | /** ææºå·ç */ |
| | | @Excel(name = "ææºå·ç ", cellType = ColumnType.TEXT) |
| | | private String phonenumber; |
| | | |
| | | /** ç¨æ·æ§å« */ |
| | | @Excel(name = "ç¨æ·æ§å«", readConverterExp = "0=ç·,1=女,2=æªç¥") |
| | | private String sex; |
| | | |
| | | /** ç¨æ·å¤´å */ |
| | | private String avatar; |
| | | |
| | | /** å¯ç */ |
| | | private String password; |
| | | |
| | | /** è´¦å·ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "è´¦å·ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** æåç»å½IP */ |
| | | @Excel(name = "æåç»å½IP", type = Type.EXPORT) |
| | | private String loginIp; |
| | | |
| | | /** æåç»å½æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "æåç»å½æ¶é´", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | private Date loginDate; |
| | | |
| | | /** å¯ç æåæ´æ°æ¶é´ */ |
| | | private Date pwdUpdateDate; |
| | | |
| | | /** é¨é¨å¯¹è±¡ */ |
| | | @Excels({ |
| | | @Excel(name = "é¨é¨åç§°", targetAttr = "deptName", type = Type.EXPORT), |
| | | @Excel(name = "é¨é¨è´è´£äºº", targetAttr = "leader", type = Type.EXPORT) |
| | | }) |
| | | private SysDept dept; |
| | | |
| | | /** è§è²å¯¹è±¡ */ |
| | | private List<SysRole> roles; |
| | | |
| | | /** è§è²ç» */ |
| | | private Long[] roleIds; |
| | | |
| | | /** å²ä½ç» */ |
| | | private Long[] postIds; |
| | | |
| | | /** è§è²ID */ |
| | | private Long roleId; |
| | | |
| | | public SysUser() |
| | | { |
| | | |
| | | } |
| | | |
| | | public SysUser(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Long getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public boolean isAdmin() |
| | | { |
| | | return SecurityUtils.isAdmin(this.userId); |
| | | } |
| | | |
| | | public Long getDeptId() |
| | | { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Long deptId) |
| | | { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | @Xss(message = "ç¨æ·æµç§°ä¸è½å
å«èæ¬å符") |
| | | @Size(min = 0, max = 30, message = "ç¨æ·æµç§°é¿åº¦ä¸è½è¶
è¿30个å符") |
| | | public String getNickName() |
| | | { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) |
| | | { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | @Xss(message = "ç¨æ·è´¦å·ä¸è½å
å«èæ¬å符") |
| | | @NotBlank(message = "ç¨æ·è´¦å·ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 30, message = "ç¨æ·è´¦å·é¿åº¦ä¸è½è¶
è¿30个å符") |
| | | public String getUserName() |
| | | { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | @Email(message = "é®ç®±æ ¼å¼ä¸æ£ç¡®") |
| | | @Size(min = 0, max = 50, message = "é®ç®±é¿åº¦ä¸è½è¶
è¿50个å符") |
| | | public String getEmail() |
| | | { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) |
| | | { |
| | | this.email = email; |
| | | } |
| | | |
| | | @Size(min = 0, max = 11, message = "ææºå·ç é¿åº¦ä¸è½è¶
è¿11个å符") |
| | | public String getPhonenumber() |
| | | { |
| | | return phonenumber; |
| | | } |
| | | |
| | | public void setPhonenumber(String phonenumber) |
| | | { |
| | | this.phonenumber = phonenumber; |
| | | } |
| | | |
| | | public String getSex() |
| | | { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(String sex) |
| | | { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getAvatar() |
| | | { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) |
| | | { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getLoginIp() |
| | | { |
| | | return loginIp; |
| | | } |
| | | |
| | | public void setLoginIp(String loginIp) |
| | | { |
| | | this.loginIp = loginIp; |
| | | } |
| | | |
| | | public Date getLoginDate() |
| | | { |
| | | return loginDate; |
| | | } |
| | | |
| | | public void setLoginDate(Date loginDate) |
| | | { |
| | | this.loginDate = loginDate; |
| | | } |
| | | |
| | | public Date getPwdUpdateDate() |
| | | { |
| | | return pwdUpdateDate; |
| | | } |
| | | |
| | | public void setPwdUpdateDate(Date pwdUpdateDate) |
| | | { |
| | | this.pwdUpdateDate = pwdUpdateDate; |
| | | } |
| | | |
| | | public SysDept getDept() |
| | | { |
| | | return dept; |
| | | } |
| | | |
| | | public void setDept(SysDept dept) |
| | | { |
| | | this.dept = dept; |
| | | } |
| | | |
| | | public List<SysRole> getRoles() |
| | | { |
| | | return roles; |
| | | } |
| | | |
| | | public void setRoles(List<SysRole> roles) |
| | | { |
| | | this.roles = roles; |
| | | } |
| | | |
| | | public Long[] getRoleIds() |
| | | { |
| | | return roleIds; |
| | | } |
| | | |
| | | public void setRoleIds(Long[] roleIds) |
| | | { |
| | | this.roleIds = roleIds; |
| | | } |
| | | |
| | | public Long[] getPostIds() |
| | | { |
| | | return postIds; |
| | | } |
| | | |
| | | public void setPostIds(Long[] postIds) |
| | | { |
| | | this.postIds = postIds; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("userId", getUserId()) |
| | | .append("deptId", getDeptId()) |
| | | .append("userName", getUserName()) |
| | | .append("nickName", getNickName()) |
| | | .append("email", getEmail()) |
| | | .append("phonenumber", getPhonenumber()) |
| | | .append("sex", getSex()) |
| | | .append("avatar", getAvatar()) |
| | | .append("password", getPassword()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("loginIp", getLoginIp()) |
| | | .append("loginDate", getLoginDate()) |
| | | .append("pwdUpdateDate", getPwdUpdateDate()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .append("dept", getDept()) |
| | | .toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.model; |
| | | |
| | | /** |
| | | * ç¨æ·ç»å½å¯¹è±¡ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LoginBody |
| | | { |
| | | /** |
| | | * ç¨æ·å |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * éªè¯ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * å¯ä¸æ è¯ |
| | | */ |
| | | private String uuid; |
| | | |
| | | 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 getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) |
| | | { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getUuid() |
| | | { |
| | | return uuid; |
| | | } |
| | | |
| | | public void setUuid(String uuid) |
| | | { |
| | | this.uuid = uuid; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.model; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | |
| | | /** |
| | | * ç»å½ç¨æ·èº«ä»½æé |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LoginUser implements UserDetails |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ç¨æ·ID |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ä¸æ è¯ |
| | | */ |
| | | private String token; |
| | | |
| | | /** |
| | | * ç»å½æ¶é´ |
| | | */ |
| | | private Long loginTime; |
| | | |
| | | /** |
| | | * è¿ææ¶é´ |
| | | */ |
| | | private Long expireTime; |
| | | |
| | | /** |
| | | * ç»å½IPå°å |
| | | */ |
| | | private String ipaddr; |
| | | |
| | | /** |
| | | * ç»å½å°ç¹ |
| | | */ |
| | | private String loginLocation; |
| | | |
| | | /** |
| | | * æµè§å¨ç±»å |
| | | */ |
| | | private String browser; |
| | | |
| | | /** |
| | | * æä½ç³»ç» |
| | | */ |
| | | private String os; |
| | | |
| | | /** |
| | | * æéå表 |
| | | */ |
| | | private Set<String> permissions; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | | */ |
| | | private SysUser user; |
| | | |
| | | public LoginUser() |
| | | { |
| | | } |
| | | |
| | | public LoginUser(SysUser user, Set<String> permissions) |
| | | { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptId = deptId; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public Long getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Long getDeptId() |
| | | { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Long deptId) |
| | | { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public String getToken() |
| | | { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) |
| | | { |
| | | this.token = token; |
| | | } |
| | | |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public String getPassword() |
| | | { |
| | | return user.getPassword(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() |
| | | { |
| | | return user.getUserName(); |
| | | } |
| | | |
| | | /** |
| | | * è´¦æ·æ¯å¦æªè¿æ,è¿ææ æ³éªè¯ |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isAccountNonExpired() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æå®ç¨æ·æ¯å¦è§£é,éå®çç¨æ·æ æ³è¿è¡èº«ä»½éªè¯ |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isAccountNonLocked() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æç¤ºæ¯å¦å·²è¿æçç¨æ·çåæ®(å¯ç ),è¿æç忮鲿¢è®¤è¯ |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isCredentialsNonExpired() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦å¯ç¨ ,ç¦ç¨çç¨æ·ä¸è½èº«ä»½éªè¯ |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isEnabled() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | public Long getLoginTime() |
| | | { |
| | | return loginTime; |
| | | } |
| | | |
| | | public void setLoginTime(Long loginTime) |
| | | { |
| | | this.loginTime = loginTime; |
| | | } |
| | | |
| | | public String getIpaddr() |
| | | { |
| | | return ipaddr; |
| | | } |
| | | |
| | | public void setIpaddr(String ipaddr) |
| | | { |
| | | this.ipaddr = ipaddr; |
| | | } |
| | | |
| | | public String getLoginLocation() |
| | | { |
| | | return loginLocation; |
| | | } |
| | | |
| | | public void setLoginLocation(String loginLocation) |
| | | { |
| | | this.loginLocation = loginLocation; |
| | | } |
| | | |
| | | public String getBrowser() |
| | | { |
| | | return browser; |
| | | } |
| | | |
| | | public void setBrowser(String browser) |
| | | { |
| | | this.browser = browser; |
| | | } |
| | | |
| | | public String getOs() |
| | | { |
| | | return os; |
| | | } |
| | | |
| | | public void setOs(String os) |
| | | { |
| | | this.os = os; |
| | | } |
| | | |
| | | public Long getExpireTime() |
| | | { |
| | | return expireTime; |
| | | } |
| | | |
| | | public void setExpireTime(Long expireTime) |
| | | { |
| | | this.expireTime = expireTime; |
| | | } |
| | | |
| | | public Set<String> getPermissions() |
| | | { |
| | | return permissions; |
| | | } |
| | | |
| | | public void setPermissions(Set<String> permissions) |
| | | { |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public SysUser getUser() |
| | | { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(SysUser user) |
| | | { |
| | | this.user = user; |
| | | } |
| | | |
| | | @Override |
| | | @JSONField(serialize = false) |
| | | public Collection<? extends GrantedAuthority> getAuthorities() |
| | | { |
| | | if (permissions == null || permissions.isEmpty()) |
| | | { |
| | | return Collections.emptyList(); |
| | | } |
| | | return permissions.stream() |
| | | .filter(Objects::nonNull) |
| | | .map(SimpleGrantedAuthority::new) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.model; |
| | | |
| | | /** |
| | | * ç¨æ·æ³¨å对象 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RegisterBody extends LoginBody |
| | | { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.page; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * åé¡µæ°æ® |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PageDomain |
| | | { |
| | | /** å½åè®°å½èµ·å§ç´¢å¼ */ |
| | | private Integer pageNum; |
| | | |
| | | /** æ¯é¡µæ¾ç¤ºè®°å½æ° */ |
| | | private Integer pageSize; |
| | | |
| | | /** æåºå */ |
| | | private String orderByColumn; |
| | | |
| | | /** æåºçæ¹ådescæè
asc */ |
| | | private String isAsc = "asc"; |
| | | |
| | | /** å页忰åçå */ |
| | | private Boolean reasonable = true; |
| | | |
| | | public String getOrderBy() |
| | | { |
| | | if (StringUtils.isEmpty(orderByColumn)) |
| | | { |
| | | return ""; |
| | | } |
| | | return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; |
| | | } |
| | | |
| | | public Integer getPageNum() |
| | | { |
| | | return pageNum; |
| | | } |
| | | |
| | | public void setPageNum(Integer pageNum) |
| | | { |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public Integer getPageSize() |
| | | { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) |
| | | { |
| | | this.pageSize = pageSize; |
| | | } |
| | | |
| | | public String getOrderByColumn() |
| | | { |
| | | return orderByColumn; |
| | | } |
| | | |
| | | public void setOrderByColumn(String orderByColumn) |
| | | { |
| | | this.orderByColumn = orderByColumn; |
| | | } |
| | | |
| | | public String getIsAsc() |
| | | { |
| | | return isAsc; |
| | | } |
| | | |
| | | public void setIsAsc(String isAsc) |
| | | { |
| | | if (StringUtils.isNotEmpty(isAsc)) |
| | | { |
| | | // å
¼å®¹å端æåºç±»å |
| | | if ("ascending".equals(isAsc)) |
| | | { |
| | | isAsc = "asc"; |
| | | } |
| | | else if ("descending".equals(isAsc)) |
| | | { |
| | | isAsc = "desc"; |
| | | } |
| | | this.isAsc = isAsc; |
| | | } |
| | | } |
| | | |
| | | public Boolean getReasonable() |
| | | { |
| | | if (StringUtils.isNull(reasonable)) |
| | | { |
| | | return Boolean.TRUE; |
| | | } |
| | | return reasonable; |
| | | } |
| | | |
| | | public void setReasonable(Boolean reasonable) |
| | | { |
| | | this.reasonable = reasonable; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.page; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è¡¨æ ¼åé¡µæ°æ®å¯¹è±¡ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TableDataInfo implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** æ»è®°å½æ° */ |
| | | private long total; |
| | | |
| | | /** åè¡¨æ°æ® */ |
| | | private List<?> rows; |
| | | |
| | | /** æ¶æ¯ç¶æç */ |
| | | private int code; |
| | | |
| | | /** æ¶æ¯å
容 */ |
| | | private String msg; |
| | | |
| | | /** |
| | | * è¡¨æ ¼æ°æ®å¯¹è±¡ |
| | | */ |
| | | public TableDataInfo() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * å页 |
| | | * |
| | | * @param list åè¡¨æ°æ® |
| | | * @param total æ»è®°å½æ° |
| | | */ |
| | | public TableDataInfo(List<?> list, long total) |
| | | { |
| | | this.rows = list; |
| | | this.total = total; |
| | | } |
| | | |
| | | public long getTotal() |
| | | { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(long total) |
| | | { |
| | | this.total = total; |
| | | } |
| | | |
| | | public List<?> getRows() |
| | | { |
| | | return rows; |
| | | } |
| | | |
| | | public void setRows(List<?> rows) |
| | | { |
| | | this.rows = rows; |
| | | } |
| | | |
| | | public int getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) |
| | | { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() |
| | | { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) |
| | | { |
| | | this.msg = msg; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.page; |
| | | |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | |
| | | /** |
| | | * è¡¨æ ¼æ°æ®å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TableSupport |
| | | { |
| | | /** |
| | | * å½åè®°å½èµ·å§ç´¢å¼ |
| | | */ |
| | | public static final String PAGE_NUM = "pageNum"; |
| | | |
| | | /** |
| | | * æ¯é¡µæ¾ç¤ºè®°å½æ° |
| | | */ |
| | | public static final String PAGE_SIZE = "pageSize"; |
| | | |
| | | /** |
| | | * æåºå |
| | | */ |
| | | public static final String ORDER_BY_COLUMN = "orderByColumn"; |
| | | |
| | | /** |
| | | * æåºçæ¹å "desc" æè
"asc". |
| | | */ |
| | | public static final String IS_ASC = "isAsc"; |
| | | |
| | | /** |
| | | * å页忰åçå |
| | | */ |
| | | public static final String REASONABLE = "reasonable"; |
| | | |
| | | /** |
| | | * å°è£
å页对象 |
| | | */ |
| | | public static PageDomain getPageDomain() |
| | | { |
| | | PageDomain pageDomain = new PageDomain(); |
| | | pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1)); |
| | | pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10)); |
| | | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); |
| | | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); |
| | | pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); |
| | | return pageDomain; |
| | | } |
| | | |
| | | public static PageDomain buildPageRequest() |
| | | { |
| | | return getPageDomain(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.redis; |
| | | |
| | | import java.time.Duration; |
| | | import java.util.Collection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.BoundSetOperations; |
| | | import org.springframework.data.redis.core.HashOperations; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * spring redis å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | **/ |
| | | @SuppressWarnings(value = { "unchecked", "rawtypes" }) |
| | | @Component |
| | | public class RedisCache |
| | | { |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * ç¼ååºæ¬ç对象ï¼IntegerãStringãå®ä½ç±»ç |
| | | * |
| | | * @param key ç¼åçé®å¼ |
| | | * @param value ç¼åçå¼ |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | } |
| | | |
| | | /** |
| | | * ç¼ååºæ¬ç对象ï¼IntegerãStringãå®ä½ç±»ç |
| | | * |
| | | * @param key ç¼åçé®å¼ |
| | | * @param value ç¼åçå¼ |
| | | * @param timeout æ¶é´ |
| | | * @param timeUnit æ¶é´é¢ç²åº¦ |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value, Duration.of(timeout, timeUnit.toChronoUnit())); |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æææ¶é´ |
| | | * |
| | | * @param key Redisé® |
| | | * @param timeout è¶
æ¶æ¶é´ |
| | | * @return true=设置æåï¼false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout) |
| | | { |
| | | return expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æææ¶é´ |
| | | * |
| | | * @param key Redisé® |
| | | * @param timeout è¶
æ¶æ¶é´ |
| | | * @param unit æ¶é´åä½ |
| | | * @return true=设置æåï¼false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit) |
| | | { |
| | | return redisTemplate.expire(key, Duration.of(timeout, unit.toChronoUnit())); |
| | | } |
| | | |
| | | /** |
| | | * è·åæææ¶é´ |
| | | * |
| | | * @param key Redisé® |
| | | * @return æææ¶é´ |
| | | */ |
| | | public long getExpire(final String key) |
| | | { |
| | | return redisTemplate.getExpire(key); |
| | | } |
| | | |
| | | /** |
| | | * 夿 keyæ¯å¦åå¨ |
| | | * |
| | | * @param key é® |
| | | * @return true åå¨ falseä¸åå¨ |
| | | */ |
| | | public Boolean hasKey(String key) |
| | | { |
| | | return redisTemplate.hasKey(key); |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçåºæ¬å¯¹è±¡ã |
| | | * |
| | | * @param key ç¼åé®å¼ |
| | | * @return ç¼åé®å¼å¯¹åºçæ°æ® |
| | | */ |
| | | public <T> T getCacheObject(final String key) |
| | | { |
| | | ValueOperations<String, T> operation = redisTemplate.opsForValue(); |
| | | return operation.get(key); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å个对象 |
| | | * |
| | | * @param key |
| | | */ |
| | | public boolean deleteObject(final String key) |
| | | { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éå对象 |
| | | * |
| | | * @param collection å¤ä¸ªå¯¹è±¡ |
| | | * @return |
| | | */ |
| | | public boolean deleteObject(final Collection collection) |
| | | { |
| | | return redisTemplate.delete(collection) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ç¼åListæ°æ® |
| | | * |
| | | * @param key ç¼åçé®å¼ |
| | | * @param dataList å¾
ç¼åçListæ°æ® |
| | | * @return ç¼åç对象 |
| | | */ |
| | | public <T> long setCacheList(final String key, final List<T> dataList) |
| | | { |
| | | Long count = redisTemplate.opsForList().rightPushAll(key, dataList); |
| | | return count == null ? 0 : count; |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçlist对象 |
| | | * |
| | | * @param key ç¼åçé®å¼ |
| | | * @return ç¼åé®å¼å¯¹åºçæ°æ® |
| | | */ |
| | | public <T> List<T> getCacheList(final String key) |
| | | { |
| | | return redisTemplate.opsForList().range(key, 0, -1); |
| | | } |
| | | |
| | | /** |
| | | * ç¼åSet |
| | | * |
| | | * @param key ç¼åé®å¼ |
| | | * @param dataSet ç¼åçæ°æ® |
| | | * @return ç¼åæ°æ®ç对象 |
| | | */ |
| | | public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) |
| | | { |
| | | BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); |
| | | Iterator<T> it = dataSet.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | setOperation.add(it.next()); |
| | | } |
| | | return setOperation; |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçset |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Set<T> getCacheSet(final String key) |
| | | { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } |
| | | |
| | | /** |
| | | * ç¼åMap |
| | | * |
| | | * @param key |
| | | * @param dataMap |
| | | */ |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap) |
| | | { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçMap |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Map<String, T> getCacheMap(final String key) |
| | | { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * å¾Hashä¸åå
¥æ°æ® |
| | | * |
| | | * @param key Redisé® |
| | | * @param hKey Hashé® |
| | | * @param value å¼ |
| | | */ |
| | | public <T> void setCacheMapValue(final String key, final String hKey, final T value) |
| | | { |
| | | redisTemplate.opsForHash().put(key, hKey, value); |
| | | } |
| | | |
| | | /** |
| | | * è·åHashä¸çæ°æ® |
| | | * |
| | | * @param key Redisé® |
| | | * @param hKey Hashé® |
| | | * @return Hashä¸ç对象 |
| | | */ |
| | | public <T> T getCacheMapValue(final String key, final String hKey) |
| | | { |
| | | HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); |
| | | return opsForHash.get(key, hKey); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¤ä¸ªHashä¸çæ°æ® |
| | | * |
| | | * @param key Redisé® |
| | | * @param hKeys Hashé®éå |
| | | * @return Hash对象éå |
| | | */ |
| | | public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) |
| | | { |
| | | return redisTemplate.opsForHash().multiGet(key, hKeys); |
| | | } |
| | | |
| | | /** |
| | | * å é¤Hashä¸çææ¡æ°æ® |
| | | * |
| | | * @param key Redisé® |
| | | * @param hKey Hashé® |
| | | * @return æ¯å¦æå |
| | | */ |
| | | public boolean deleteCacheMapValue(final String key, final String hKey) |
| | | { |
| | | return redisTemplate.opsForHash().delete(key, hKey) > 0; |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçåºæ¬å¯¹è±¡å表 |
| | | * |
| | | * @param pattern å符串åç¼ |
| | | * @return 对象å表 |
| | | */ |
| | | public Collection<String> keys(final String pattern) |
| | | { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.text; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * å符éå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CharsetKit |
| | | { |
| | | /** ISO-8859-1 */ |
| | | public static final String ISO_8859_1 = "ISO-8859-1"; |
| | | /** UTF-8 */ |
| | | public static final String UTF_8 = "UTF-8"; |
| | | /** GBK */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** ISO-8859-1 */ |
| | | public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); |
| | | /** UTF-8 */ |
| | | public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); |
| | | /** GBK */ |
| | | public static final Charset CHARSET_GBK = Charset.forName(GBK); |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºCharset对象 |
| | | * |
| | | * @param charset å符éï¼ä¸ºç©ºåè¿åé»è®¤å符é |
| | | * @return Charset |
| | | */ |
| | | public static Charset charset(String charset) |
| | | { |
| | | return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢å符串çå符éç¼ç |
| | | * |
| | | * @param source å符串 |
| | | * @param srcCharset æºå符éï¼é»è®¤ISO-8859-1 |
| | | * @param destCharset ç®æ å符éï¼é»è®¤UTF-8 |
| | | * @return 转æ¢åçå符é |
| | | */ |
| | | public static String convert(String source, String srcCharset, String destCharset) |
| | | { |
| | | return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢å符串çå符éç¼ç |
| | | * |
| | | * @param source å符串 |
| | | * @param srcCharset æºå符éï¼é»è®¤ISO-8859-1 |
| | | * @param destCharset ç®æ å符éï¼é»è®¤UTF-8 |
| | | * @return 转æ¢åçå符é |
| | | */ |
| | | public static String convert(String source, Charset srcCharset, Charset destCharset) |
| | | { |
| | | if (null == srcCharset) |
| | | { |
| | | srcCharset = StandardCharsets.ISO_8859_1; |
| | | } |
| | | |
| | | if (null == destCharset) |
| | | { |
| | | destCharset = StandardCharsets.UTF_8; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) |
| | | { |
| | | return source; |
| | | } |
| | | return new String(source.getBytes(srcCharset), destCharset); |
| | | } |
| | | |
| | | /** |
| | | * @return ç³»ç»å符éç¼ç |
| | | */ |
| | | public static String systemCharset() |
| | | { |
| | | return Charset.defaultCharset().name(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.text; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.text.NumberFormat; |
| | | import java.util.Set; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * ç±»å转æ¢å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Convert |
| | | { |
| | | /** |
| | | * 转æ¢ä¸ºå符串<br> |
| | | * 妿ç»å®çå¼ä¸ºnullï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static String toStr(Object value, String defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof String) |
| | | { |
| | | return (String) value; |
| | | } |
| | | return value.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºå符串<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static String toStr(Object value) |
| | | { |
| | | return toStr(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºå符<br> |
| | | * 妿ç»å®çå¼ä¸ºnullï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Character toChar(Object value, Character defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Character) |
| | | { |
| | | return (Character) value; |
| | | } |
| | | |
| | | final String valueStr = toStr(value, null); |
| | | return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºå符<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Character toChar(Object value) |
| | | { |
| | | return toChar(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºbyte<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Byte toByte(Object value, Byte defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Byte) |
| | | { |
| | | return (Byte) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).byteValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Byte.parseByte(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºbyte<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Byte toByte(Object value) |
| | | { |
| | | return toByte(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºShort<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Short toShort(Object value, Short defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Short) |
| | | { |
| | | return (Short) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).shortValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Short.parseShort(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºShort<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Short toShort(Object value) |
| | | { |
| | | return toShort(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºNumber<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Number toNumber(Object value, Number defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return (Number) value; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return NumberFormat.getInstance().parse(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºNumber<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Number toNumber(Object value) |
| | | { |
| | | return toNumber(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºint<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Integer toInt(Object value, Integer defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return (Integer) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).intValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Integer.parseInt(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºint<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Integer toInt(Object value) |
| | | { |
| | | return toInt(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºIntegeræ°ç»<br> |
| | | * |
| | | * @param str 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Integer[] toIntArray(String str) |
| | | { |
| | | return toIntArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºLongæ°ç»<br> |
| | | * |
| | | * @param str 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Long[] toLongArray(String str) |
| | | { |
| | | return toLongArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºIntegeræ°ç»<br> |
| | | * |
| | | * @param split åé符 |
| | | * @param split 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Integer[] toIntArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Integer[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Integer[] ints = new Integer[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Integer v = toInt(arr[i], 0); |
| | | ints[i] = v; |
| | | } |
| | | return ints; |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºLongæ°ç»<br> |
| | | * |
| | | * @param split åé符 |
| | | * @param str 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Long[] toLongArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Long[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Long[] longs = new Long[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Long v = toLong(arr[i], null); |
| | | longs[i] = v; |
| | | } |
| | | return longs; |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºStringæ°ç»<br> |
| | | * |
| | | * @param str 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static String[] toStrArray(String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new String[] {}; |
| | | } |
| | | return toStrArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºStringæ°ç»<br> |
| | | * |
| | | * @param split åé符 |
| | | * @param split 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static String[] toStrArray(String split, String str) |
| | | { |
| | | return str.split(split); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºlong<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Long toLong(Object value, Long defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return (Long) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).longValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // æ¯æç§å¦è®¡æ°æ³ |
| | | return new BigDecimal(valueStr.trim()).longValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºlong<br> |
| | | * 妿ç»å®çå¼ä¸º<code>null</code>ï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Long toLong(Object value) |
| | | { |
| | | return toLong(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºdouble<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Double toDouble(Object value, Double defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return (Double) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).doubleValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // æ¯æç§å¦è®¡æ°æ³ |
| | | return new BigDecimal(valueStr.trim()).doubleValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºdouble<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Double toDouble(Object value) |
| | | { |
| | | return toDouble(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºFloat<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Float toFloat(Object value, Float defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Float) |
| | | { |
| | | return (Float) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).floatValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Float.parseFloat(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºFloat<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Float toFloat(Object value) |
| | | { |
| | | return toFloat(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºboolean<br> |
| | | * Stringæ¯æçå¼ä¸ºï¼trueãfalseãyesãokãnoã1ã0ãæ¯ãå¦, 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Boolean toBool(Object value, Boolean defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Boolean) |
| | | { |
| | | return (Boolean) value; |
| | | } |
| | | String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | valueStr = valueStr.trim().toLowerCase(); |
| | | switch (valueStr) |
| | | { |
| | | case "true": |
| | | case "yes": |
| | | case "ok": |
| | | case "1": |
| | | case "æ¯": |
| | | return true; |
| | | case "false": |
| | | case "no": |
| | | case "0": |
| | | case "å¦": |
| | | return false; |
| | | default: |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºboolean<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static Boolean toBool(Object value) |
| | | { |
| | | return toBool(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºEnum对象<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * |
| | | * @param clazz EnumçClass |
| | | * @param value å¼ |
| | | * @param defaultValue é»è®¤å¼ |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (clazz.isAssignableFrom(value.getClass())) |
| | | { |
| | | @SuppressWarnings("unchecked") |
| | | E myE = (E) value; |
| | | return myE; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Enum.valueOf(clazz, valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºEnum对象<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * |
| | | * @param clazz EnumçClass |
| | | * @param value å¼ |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) |
| | | { |
| | | return toEnum(clazz, value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºBigInteger<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static BigInteger toBigInteger(Object value, BigInteger defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigInteger) |
| | | { |
| | | return (BigInteger) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return BigInteger.valueOf((Long) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigInteger(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºBigInteger<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<code>null</code><br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static BigInteger toBigInteger(Object value) |
| | | { |
| | | return toBigInteger(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºBigDecimal<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @param defaultValue 转æ¢é误æ¶çé»è®¤å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigDecimal) |
| | | { |
| | | return (BigDecimal) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return new BigDecimal((Long) value); |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return BigDecimal.valueOf((Double) value); |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return new BigDecimal((Integer) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigDecimal(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºBigDecimal<br> |
| | | * 妿ç»å®çå¼ä¸ºç©ºï¼æè
转æ¢å¤±è´¥ï¼è¿åé»è®¤å¼<br> |
| | | * 转æ¢å¤±è´¥ä¸ä¼æ¥é |
| | | * |
| | | * @param value 被转æ¢çå¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value) |
| | | { |
| | | return toBigDecimal(value, null); |
| | | } |
| | | |
| | | /** |
| | | * å°å¯¹è±¡è½¬ä¸ºå符串<br> |
| | | * 1ãByteæ°ç»åByteBufferä¼è¢«è½¬æ¢ä¸ºå¯¹åºåç¬¦ä¸²çæ°ç» 2ã对象æ°ç»ä¼è°ç¨Arrays.toStringæ¹æ³ |
| | | * |
| | | * @param obj 对象 |
| | | * @return å符串 |
| | | */ |
| | | public static String utf8Str(Object obj) |
| | | { |
| | | return str(obj, CharsetKit.CHARSET_UTF_8); |
| | | } |
| | | |
| | | /** |
| | | * å°å¯¹è±¡è½¬ä¸ºå符串<br> |
| | | * 1ãByteæ°ç»åByteBufferä¼è¢«è½¬æ¢ä¸ºå¯¹åºåç¬¦ä¸²çæ°ç» 2ã对象æ°ç»ä¼è°ç¨Arrays.toStringæ¹æ³ |
| | | * |
| | | * @param obj 对象 |
| | | * @param charsetName å符é |
| | | * @return å符串 |
| | | */ |
| | | public static String str(Object obj, String charsetName) |
| | | { |
| | | return str(obj, Charset.forName(charsetName)); |
| | | } |
| | | |
| | | /** |
| | | * å°å¯¹è±¡è½¬ä¸ºå符串<br> |
| | | * 1ãByteæ°ç»åByteBufferä¼è¢«è½¬æ¢ä¸ºå¯¹åºåç¬¦ä¸²çæ°ç» 2ã对象æ°ç»ä¼è°ç¨Arrays.toStringæ¹æ³ |
| | | * |
| | | * @param obj 对象 |
| | | * @param charset å符é |
| | | * @return å符串 |
| | | */ |
| | | public static String str(Object obj, Charset charset) |
| | | { |
| | | if (null == obj) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (obj instanceof String) |
| | | { |
| | | return (String) obj; |
| | | } |
| | | else if (obj instanceof byte[] || obj instanceof Byte[]) |
| | | { |
| | | if (obj instanceof byte[]) |
| | | { |
| | | return str((byte[]) obj, charset); |
| | | } |
| | | else |
| | | { |
| | | Byte[] bytes = (Byte[]) obj; |
| | | int length = bytes.length; |
| | | byte[] dest = new byte[length]; |
| | | for (int i = 0; i < length; i++) |
| | | { |
| | | dest[i] = bytes[i]; |
| | | } |
| | | return str(dest, charset); |
| | | } |
| | | } |
| | | else if (obj instanceof ByteBuffer) |
| | | { |
| | | return str((ByteBuffer) obj, charset); |
| | | } |
| | | return obj.toString(); |
| | | } |
| | | |
| | | /** |
| | | * å°byteæ°ç»è½¬ä¸ºå符串 |
| | | * |
| | | * @param bytes byteæ°ç» |
| | | * @param charset å符é |
| | | * @return å符串 |
| | | */ |
| | | public static String str(byte[] bytes, String charset) |
| | | { |
| | | return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * è§£ç åèç |
| | | * |
| | | * @param data å符串 |
| | | * @param charset å符éï¼å¦ææ¤å段为空ï¼åè§£ç çç»æåå³äºå¹³å° |
| | | * @return è§£ç åçå符串 |
| | | */ |
| | | public static String str(byte[] data, Charset charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) |
| | | { |
| | | return new String(data); |
| | | } |
| | | return new String(data, charset); |
| | | } |
| | | |
| | | /** |
| | | * å°ç¼ç çbyteBufferæ°æ®è½¬æ¢ä¸ºå符串 |
| | | * |
| | | * @param data æ°æ® |
| | | * @param charset å符éï¼å¦æä¸ºç©ºä½¿ç¨å½åç³»ç»å符é |
| | | * @return å符串 |
| | | */ |
| | | public static String str(ByteBuffer data, String charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | return str(data, Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * å°ç¼ç çbyteBufferæ°æ®è½¬æ¢ä¸ºå符串 |
| | | * |
| | | * @param data æ°æ® |
| | | * @param charset å符éï¼å¦æä¸ºç©ºä½¿ç¨å½åç³»ç»å符é |
| | | * @return å符串 |
| | | */ |
| | | public static String str(ByteBuffer data, Charset charset) |
| | | { |
| | | if (null == charset) |
| | | { |
| | | charset = Charset.defaultCharset(); |
| | | } |
| | | return charset.decode(data).toString(); |
| | | } |
| | | |
| | | // ----------------------------------------------------------------------- å
¨è§åè§è½¬æ¢ |
| | | /** |
| | | * åè§è½¬å
¨è§ |
| | | * |
| | | * @param input String. |
| | | * @return å
¨è§å符串. |
| | | */ |
| | | public static String toSBC(String input) |
| | | { |
| | | return toSBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * åè§è½¬å
¨è§ |
| | | * |
| | | * @param input String |
| | | * @param notConvertSet 䏿¿æ¢çå符éå |
| | | * @return å
¨è§å符串. |
| | | */ |
| | | public static String toSBC(String input, Set<Character> notConvertSet) |
| | | { |
| | | char[] c = input.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // è·³è¿ä¸æ¿æ¢çå符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == ' ') |
| | | { |
| | | c[i] = '\u3000'; |
| | | } |
| | | else if (c[i] < '\177') |
| | | { |
| | | c[i] = (char) (c[i] + 65248); |
| | | |
| | | } |
| | | } |
| | | return new String(c); |
| | | } |
| | | |
| | | /** |
| | | * å
¨è§è½¬åè§ |
| | | * |
| | | * @param input String. |
| | | * @return åè§å符串 |
| | | */ |
| | | public static String toDBC(String input) |
| | | { |
| | | return toDBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ¢å
¨è§ä¸ºåè§ |
| | | * |
| | | * @param text ææ¬ |
| | | * @param notConvertSet 䏿¿æ¢çå符éå |
| | | * @return æ¿æ¢åçå符 |
| | | */ |
| | | public static String toDBC(String text, Set<Character> notConvertSet) |
| | | { |
| | | char[] c = text.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // è·³è¿ä¸æ¿æ¢çå符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == '\u3000') |
| | | { |
| | | c[i] = ' '; |
| | | } |
| | | else if (c[i] > '\uFF00' && c[i] < '\uFF5F') |
| | | { |
| | | c[i] = (char) (c[i] - 65248); |
| | | } |
| | | } |
| | | return new String(c); |
| | | } |
| | | |
| | | /** |
| | | * æ°åéé¢å¤§åè½¬æ¢ å
åä¸ªå®æ´çç¶åå°å¦é¶æ¾æ¿æ¢æé¶ |
| | | * |
| | | * @param n æ°å |
| | | * @return 䏿大忰å |
| | | */ |
| | | public static String digitUppercase(double n) |
| | | { |
| | | String[] fraction = { "è§", "å" }; |
| | | String[] digit = { "é¶", "壹", "è´°", "å", "è", "ä¼", "é", "æ", "æ", "ç" }; |
| | | String[][] unit = { { "å
", "ä¸", "亿" }, { "", "æ¾", "ä½°", "ä»" } }; |
| | | |
| | | String head = n < 0 ? "è´" : ""; |
| | | n = Math.abs(n); |
| | | |
| | | String s = ""; |
| | | for (int i = 0; i < fraction.length; i++) |
| | | { |
| | | // ä¼ådouble计ç®ç²¾åº¦ä¸¢å¤±é®é¢ |
| | | BigDecimal nNum = new BigDecimal(n); |
| | | BigDecimal decimal = new BigDecimal(10); |
| | | BigDecimal scale = nNum.multiply(decimal).setScale(2, RoundingMode.HALF_EVEN); |
| | | double d = scale.doubleValue(); |
| | | s += (digit[(int) (Math.floor(d * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(é¶.)+", ""); |
| | | } |
| | | if (s.length() < 1) |
| | | { |
| | | s = "æ´"; |
| | | } |
| | | int integerPart = (int) Math.floor(n); |
| | | |
| | | for (int i = 0; i < unit[0].length && integerPart > 0; i++) |
| | | { |
| | | String p = ""; |
| | | for (int j = 0; j < unit[1].length && n > 0; j++) |
| | | { |
| | | p = digit[integerPart % 10] + unit[1][j] + p; |
| | | integerPart = integerPart / 10; |
| | | } |
| | | s = p.replaceAll("(é¶.)*é¶$", "").replaceAll("^$", "é¶") + unit[0][i] + s; |
| | | } |
| | | return head + s.replaceAll("(é¶.)*é¶å
", "å
").replaceFirst("(é¶.)+", "").replaceAll("(é¶.)+", "é¶").replaceAll("^æ´$", "é¶å
æ´"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.text; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * åç¬¦ä¸²æ ¼å¼å |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class StrFormatter |
| | | { |
| | | public static final String EMPTY_JSON = "{}"; |
| | | public static final char C_BACKSLASH = '\\'; |
| | | public static final char C_DELIM_START = '{'; |
| | | public static final char C_DELIM_END = '}'; |
| | | |
| | | /** |
| | | * æ ¼å¼åå符串<br> |
| | | * æ¤æ¹æ³åªæ¯ç®åå°å ä½ç¬¦ {} æç
§é¡ºåºæ¿æ¢ä¸ºåæ°<br> |
| | | * 妿æ³è¾åº {} ä½¿ç¨ \\è½¬ä¹ { å³å¯ï¼å¦ææ³è¾åº {} ä¹åç \ 使ç¨å转ä¹ç¬¦ \\\\ å³å¯<br> |
| | | * ä¾ï¼<br> |
| | | * é常使ç¨ï¼format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转ä¹{}ï¼ format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转ä¹\ï¼ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param strPattern åç¬¦ä¸²æ¨¡æ¿ |
| | | * @param argArray åæ°å表 |
| | | * @return ç»æ |
| | | */ |
| | | public static String format(final String strPattern, final Object... argArray) |
| | | { |
| | | if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) |
| | | { |
| | | return strPattern; |
| | | } |
| | | final int strPatternLength = strPattern.length(); |
| | | |
| | | // åå§åå®ä¹å¥½çé¿åº¦ä»¥è·å¾æ´å¥½çæ§è½ |
| | | StringBuilder sbuf = new StringBuilder(strPatternLength + 50); |
| | | |
| | | int handledPosition = 0; |
| | | int delimIndex;// å ä½ç¬¦æå¨ä½ç½® |
| | | for (int argIndex = 0; argIndex < argArray.length; argIndex++) |
| | | { |
| | | delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); |
| | | if (delimIndex == -1) |
| | | { |
| | | if (handledPosition == 0) |
| | | { |
| | | return strPattern; |
| | | } |
| | | else |
| | | { // å符串模æ¿å©ä½é¨åä¸åå
å«å ä½ç¬¦ï¼å å
¥å©ä½é¨ååè¿åç»æ |
| | | sbuf.append(strPattern, handledPosition, strPatternLength); |
| | | return sbuf.toString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) |
| | | { |
| | | if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) |
| | | { |
| | | // 转ä¹ç¬¦ä¹åè¿æä¸ä¸ªè½¬ä¹ç¬¦ï¼å ä½ç¬¦ä¾æ§ææ |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | else |
| | | { |
| | | // å ä½ç¬¦è¢«è½¬ä¹ |
| | | argIndex--; |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(C_DELIM_START); |
| | | handledPosition = delimIndex + 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // æ£å¸¸å ä½ç¬¦ |
| | | sbuf.append(strPattern, handledPosition, delimIndex); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | } |
| | | } |
| | | // å å
¥æåä¸ä¸ªå ä½ç¬¦åææçå符 |
| | | sbuf.append(strPattern, handledPosition, strPattern.length()); |
| | | |
| | | return sbuf.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * æä½ç¶æ |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | public enum BusinessStatus |
| | | { |
| | | /** |
| | | * æå |
| | | */ |
| | | SUCCESS, |
| | | |
| | | /** |
| | | * 失败 |
| | | */ |
| | | FAIL, |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * ä¸å¡æä½ç±»å |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum BusinessType |
| | | { |
| | | /** |
| | | * å
¶å® |
| | | */ |
| | | OTHER, |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | */ |
| | | INSERT, |
| | | |
| | | /** |
| | | * ä¿®æ¹ |
| | | */ |
| | | UPDATE, |
| | | |
| | | /** |
| | | * å é¤ |
| | | */ |
| | | DELETE, |
| | | |
| | | /** |
| | | * ææ |
| | | */ |
| | | GRANT, |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | */ |
| | | EXPORT, |
| | | |
| | | /** |
| | | * 导å
¥ |
| | | */ |
| | | IMPORT, |
| | | |
| | | /** |
| | | * 强é |
| | | */ |
| | | FORCE, |
| | | |
| | | /** |
| | | * çæä»£ç |
| | | */ |
| | | GENCODE, |
| | | |
| | | /** |
| | | * æ¸
ç©ºæ°æ® |
| | | */ |
| | | CLEAN, |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * æ°æ®æº |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum DataSourceType |
| | | { |
| | | /** |
| | | * ä¸»åº |
| | | */ |
| | | MASTER, |
| | | |
| | | /** |
| | | * ä»åº |
| | | */ |
| | | SLAVE |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import java.util.function.Function; |
| | | import com.ruoyi.common.utils.DesensitizedUtil; |
| | | |
| | | /** |
| | | * è±æç±»å |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum DesensitizedType |
| | | { |
| | | /** |
| | | * å§åï¼ç¬¬2使巿¿æ¢ |
| | | */ |
| | | USERNAME(s -> s.replaceAll("(\\S)\\S(\\S*)", "$1*$2")), |
| | | |
| | | /** |
| | | * å¯ç ï¼å
¨é¨å符é½ç¨*ä»£æ¿ |
| | | */ |
| | | PASSWORD(DesensitizedUtil::password), |
| | | |
| | | /** |
| | | * 身份è¯ï¼ä¸é´10使巿¿æ¢ |
| | | */ |
| | | ID_CARD(s -> s.replaceAll("(\\d{4})\\d{10}(\\d{3}[Xx]|\\d{4})", "$1** **** ****$2")), |
| | | |
| | | /** |
| | | * ææºå·ï¼ä¸é´4使巿¿æ¢ |
| | | */ |
| | | PHONE(s -> s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")), |
| | | |
| | | /** |
| | | * çµåé®ç®±ï¼ä»
æ¾ç¤ºç¬¬ä¸ä¸ªåæ¯å@åé¢çå°åæ¾ç¤ºï¼å
¶ä»æå·æ¿æ¢ |
| | | */ |
| | | EMAIL(s -> s.replaceAll("(^.)[^@]*(@.*$)", "$1****$2")), |
| | | |
| | | /** |
| | | * é¶è¡å¡å·ï¼ä¿çæå4ä½ï¼å
¶ä»æå·æ¿æ¢ |
| | | */ |
| | | BANK_CARD(s -> s.replaceAll("\\d{15}(\\d{3})", "**** **** **** **** $1")), |
| | | |
| | | /** |
| | | * 车çå·ç ï¼å
嫿®é车è¾ãæ°è½æºè½¦è¾ |
| | | */ |
| | | CAR_LICENSE(DesensitizedUtil::carLicense); |
| | | |
| | | private final Function<String, String> desensitizer; |
| | | |
| | | DesensitizedType(Function<String, String> desensitizer) |
| | | { |
| | | this.desensitizer = desensitizer; |
| | | } |
| | | |
| | | public Function<String, String> desensitizer() |
| | | { |
| | | return desensitizer; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import org.jspecify.annotations.Nullable; |
| | | |
| | | /** |
| | | * è¯·æ±æ¹å¼ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum HttpMethod |
| | | { |
| | | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; |
| | | |
| | | private static final Map<String, HttpMethod> mappings = new HashMap<>(16); |
| | | |
| | | static |
| | | { |
| | | for (HttpMethod httpMethod : values()) |
| | | { |
| | | mappings.put(httpMethod.name(), httpMethod); |
| | | } |
| | | } |
| | | |
| | | @Nullable |
| | | public static HttpMethod resolve(@Nullable String method) |
| | | { |
| | | return (method != null ? mappings.get(method) : null); |
| | | } |
| | | |
| | | public boolean matches(String method) |
| | | { |
| | | return (this == resolve(method)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * éæµç±»å |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | |
| | | public enum LimitType |
| | | { |
| | | /** |
| | | * é»è®¤çç¥å
¨å±éæµ |
| | | */ |
| | | DEFAULT, |
| | | |
| | | /** |
| | | * æ ¹æ®è¯·æ±è
IPè¿è¡éæµ |
| | | */ |
| | | IP |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * æä½äººç±»å« |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum OperatorType |
| | | { |
| | | /** |
| | | * å
¶å® |
| | | */ |
| | | OTHER, |
| | | |
| | | /** |
| | | * åå°ç¨æ· |
| | | */ |
| | | MANAGE, |
| | | |
| | | /** |
| | | * ææºç«¯ç¨æ· |
| | | */ |
| | | MOBILE |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | /** |
| | | * ç¨æ·ç¶æ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum UserStatus |
| | | { |
| | | OK("0", "æ£å¸¸"), DISABLE("1", "åç¨"), DELETED("2", "å é¤"); |
| | | |
| | | private final String code; |
| | | private final String info; |
| | | |
| | | UserStatus(String code, String info) |
| | | { |
| | | this.code = code; |
| | | this.info = info; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public String getInfo() |
| | | { |
| | | return info; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception; |
| | | |
| | | /** |
| | | * æ¼ç¤ºæ¨¡å¼å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DemoModeException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public DemoModeException() |
| | | { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception; |
| | | |
| | | /** |
| | | * å
¨å±å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class GlobalException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * é误æç¤º |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * é误æç»ï¼å
é¨è°è¯é误 |
| | | * |
| | | * å {@link CommonResult#getDetailMessage()} ä¸è´ç设计 |
| | | */ |
| | | private String detailMessage; |
| | | |
| | | /** |
| | | * 空æé æ¹æ³ï¼é¿å
ååºååé®é¢ |
| | | */ |
| | | public GlobalException() |
| | | { |
| | | } |
| | | |
| | | public GlobalException(String message) |
| | | { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getDetailMessage() |
| | | { |
| | | return detailMessage; |
| | | } |
| | | |
| | | public GlobalException setDetailMessage(String detailMessage) |
| | | { |
| | | this.detailMessage = detailMessage; |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | return message; |
| | | } |
| | | |
| | | public GlobalException setMessage(String message) |
| | | { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception; |
| | | |
| | | /** |
| | | * ä¸å¡å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public final class ServiceException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * é误ç |
| | | */ |
| | | private Integer code; |
| | | |
| | | /** |
| | | * é误æç¤º |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * é误æç»ï¼å
é¨è°è¯é误 |
| | | * |
| | | * å {@link CommonResult#getDetailMessage()} ä¸è´ç设计 |
| | | */ |
| | | private String detailMessage; |
| | | |
| | | /** |
| | | * 空æé æ¹æ³ï¼é¿å
ååºååé®é¢ |
| | | */ |
| | | public ServiceException() |
| | | { |
| | | } |
| | | |
| | | public ServiceException(String message) |
| | | { |
| | | this.message = message; |
| | | } |
| | | |
| | | public ServiceException(String message, Integer code) |
| | | { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getDetailMessage() |
| | | { |
| | | return detailMessage; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | return message; |
| | | } |
| | | |
| | | public Integer getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public ServiceException setMessage(String message) |
| | | { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceException setDetailMessage(String detailMessage) |
| | | { |
| | | this.detailMessage = detailMessage; |
| | | return this; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception; |
| | | |
| | | /** |
| | | * å·¥å
·ç±»å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UtilException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 8247610319171014183L; |
| | | |
| | | public UtilException(Throwable e) |
| | | { |
| | | super(e.getMessage(), e); |
| | | } |
| | | |
| | | public UtilException(String message) |
| | | { |
| | | super(message); |
| | | } |
| | | |
| | | public UtilException(String message, Throwable throwable) |
| | | { |
| | | super(message, throwable); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.base; |
| | | |
| | | import com.ruoyi.common.utils.MessageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * åºç¡å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æå±æ¨¡å |
| | | */ |
| | | private String module; |
| | | |
| | | /** |
| | | * é误ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * é误ç 对åºçåæ° |
| | | */ |
| | | private Object[] args; |
| | | |
| | | /** |
| | | * éè¯¯æ¶æ¯ |
| | | */ |
| | | private String defaultMessage; |
| | | |
| | | public BaseException(String module, String code, Object[] args, String defaultMessage) |
| | | { |
| | | this.module = module; |
| | | this.code = code; |
| | | this.args = args; |
| | | this.defaultMessage = defaultMessage; |
| | | } |
| | | |
| | | public BaseException(String module, String code, Object[] args) |
| | | { |
| | | this(module, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String module, String defaultMessage) |
| | | { |
| | | this(module, null, null, defaultMessage); |
| | | } |
| | | |
| | | public BaseException(String code, Object[] args) |
| | | { |
| | | this(null, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String defaultMessage) |
| | | { |
| | | this(null, null, null, defaultMessage); |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | String message = null; |
| | | if (!StringUtils.isEmpty(code)) |
| | | { |
| | | message = MessageUtils.message(code, args); |
| | | } |
| | | if (message == null) |
| | | { |
| | | message = defaultMessage; |
| | | } |
| | | return message; |
| | | } |
| | | |
| | | public String getModule() |
| | | { |
| | | return module; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public Object[] getArgs() |
| | | { |
| | | return args; |
| | | } |
| | | |
| | | public String getDefaultMessage() |
| | | { |
| | | return defaultMessage; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.file; |
| | | |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | |
| | | /** |
| | | * æä»¶ä¿¡æ¯å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileException(String code, Object[] args) |
| | | { |
| | | super("file", code, args, null); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.file; |
| | | |
| | | /** |
| | | * æä»¶åç§°è¶
é¿éå¶å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileNameLengthLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileNameLengthLimitExceededException(int defaultFileNameLength) |
| | | { |
| | | super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.file; |
| | | |
| | | /** |
| | | * æä»¶å大å°éå¶å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileSizeLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileSizeLimitExceededException(long defaultMaxSize) |
| | | { |
| | | super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.file; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ æ ææ©å±åå¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class InvalidExtensionException extends FileUploadException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String[] allowedExtension; |
| | | private String extension; |
| | | private String filename; |
| | | |
| | | public InvalidExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super("æä»¶[" + filename + "]åç¼[" + extension + "]䏿£ç¡®ï¼è¯·ä¸ä¼ " + Arrays.toString(allowedExtension) + "æ ¼å¼"); |
| | | this.allowedExtension = allowedExtension; |
| | | this.extension = extension; |
| | | this.filename = filename; |
| | | } |
| | | |
| | | public String[] getAllowedExtension() |
| | | { |
| | | return allowedExtension; |
| | | } |
| | | |
| | | public String getExtension() |
| | | { |
| | | return extension; |
| | | } |
| | | |
| | | public String getFilename() |
| | | { |
| | | return filename; |
| | | } |
| | | |
| | | public static class InvalidImageExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidFlashExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidMediaExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidVideoExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.job; |
| | | |
| | | /** |
| | | * 计åçç¥å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TaskException extends Exception |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Code code; |
| | | |
| | | public TaskException(String msg, Code code) |
| | | { |
| | | this(msg, code, null); |
| | | } |
| | | |
| | | public TaskException(String msg, Code code, Exception nestedEx) |
| | | { |
| | | super(msg, nestedEx); |
| | | this.code = code; |
| | | } |
| | | |
| | | public Code getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public enum Code |
| | | { |
| | | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.user; |
| | | |
| | | /** |
| | | * éªè¯ç é误å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CaptchaException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaException() |
| | | { |
| | | super("user.jcaptcha.error", null); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.user; |
| | | |
| | | /** |
| | | * éªè¯ç 失æå¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CaptchaExpireException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaExpireException() |
| | | { |
| | | super("user.jcaptcha.expire", null); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.user; |
| | | |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserException(String code, Object[] args) |
| | | { |
| | | super("user", code, args, null); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.user; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç 䏿£ç¡®æä¸ç¬¦åè§èå¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserPasswordNotMatchException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordNotMatchException() |
| | | { |
| | | super("user.password.not.match", null); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.user; |
| | | |
| | | /** |
| | | * ç¨æ·é误æå¤§æ¬¡æ°å¼å¸¸ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserPasswordRetryLimitExceedException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) |
| | | { |
| | | super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; |
| | | |
| | | /** |
| | | * æé¤JSONææå±æ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PropertyPreExcludeFilter extends SimplePropertyPreFilter |
| | | { |
| | | public PropertyPreExcludeFilter() |
| | | { |
| | | } |
| | | |
| | | public PropertyPreExcludeFilter addExcludes(String... filters) |
| | | { |
| | | for (int i = 0; i < filters.length; i++) |
| | | { |
| | | this.getExcludes().add(filters[i]); |
| | | } |
| | | return this; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import jakarta.servlet.Filter; |
| | | import jakarta.servlet.FilterChain; |
| | | import jakarta.servlet.FilterConfig; |
| | | import jakarta.servlet.ServletException; |
| | | import jakarta.servlet.ServletRequest; |
| | | import jakarta.servlet.ServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * é²çé¾è¿æ»¤å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RefererFilter implements Filter |
| | | { |
| | | /** |
| | | * å
许çååå表 |
| | | */ |
| | | public List<String> allowedDomains; |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | String domains = filterConfig.getInitParameter("allowedDomains"); |
| | | this.allowedDomains = Arrays.asList(domains.split(",")); |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | HttpServletRequest req = (HttpServletRequest) request; |
| | | HttpServletResponse resp = (HttpServletResponse) response; |
| | | |
| | | String referer = req.getHeader("Referer"); |
| | | |
| | | // 妿Refererä¸ºç©ºï¼æç»è®¿é® |
| | | if (referer == null || referer.isEmpty()) |
| | | { |
| | | resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Access denied: Referer header is required"); |
| | | return; |
| | | } |
| | | |
| | | // æ£æ¥Refereræ¯å¦å¨å
许çåååè¡¨ä¸ |
| | | boolean allowed = false; |
| | | for (String domain : allowedDomains) |
| | | { |
| | | if (referer.contains(domain)) |
| | | { |
| | | allowed = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // æ ¹æ®æ£æ¥ç»æå³å®æ¯å¦æ¾è¡ |
| | | if (allowed) |
| | | { |
| | | chain.doFilter(request, response); |
| | | } |
| | | else |
| | | { |
| | | resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Access denied: Referer '" + referer + "' is not allowed"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import jakarta.servlet.Filter; |
| | | import jakarta.servlet.FilterChain; |
| | | import jakarta.servlet.FilterConfig; |
| | | import jakarta.servlet.ServletException; |
| | | import jakarta.servlet.ServletRequest; |
| | | import jakarta.servlet.ServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import org.springframework.http.MediaType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * Repeatable è¿æ»¤å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatableFilter implements Filter |
| | | { |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | ServletRequest requestWrapper = null; |
| | | if (request instanceof HttpServletRequest |
| | | && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) |
| | | { |
| | | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); |
| | | } |
| | | if (null == requestWrapper) |
| | | { |
| | | chain.doFilter(request, response); |
| | | } |
| | | else |
| | | { |
| | | chain.doFilter(requestWrapper, response); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import jakarta.servlet.ReadListener; |
| | | import jakarta.servlet.ServletInputStream; |
| | | import jakarta.servlet.ServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletRequestWrapper; |
| | | import com.ruoyi.common.utils.http.HttpHelper; |
| | | import com.ruoyi.common.constant.Constants; |
| | | |
| | | /** |
| | | * æå»ºå¯éå¤è¯»åinputStreamçrequest |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper |
| | | { |
| | | private final byte[] body; |
| | | |
| | | public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException |
| | | { |
| | | super(request); |
| | | request.setCharacterEncoding(Constants.UTF8); |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | |
| | | body = HttpHelper.getBodyString(request).getBytes(Constants.UTF8); |
| | | } |
| | | |
| | | @Override |
| | | public BufferedReader getReader() throws IOException |
| | | { |
| | | return new BufferedReader(new InputStreamReader(getInputStream())); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() throws IOException |
| | | { |
| | | final ByteArrayInputStream bais = new ByteArrayInputStream(body); |
| | | return new ServletInputStream() |
| | | { |
| | | @Override |
| | | public int read() throws IOException |
| | | { |
| | | return bais.read(); |
| | | } |
| | | |
| | | @Override |
| | | public int available() throws IOException |
| | | { |
| | | return body.length; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFinished() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener readListener) |
| | | { |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.servlet.Filter; |
| | | import jakarta.servlet.FilterChain; |
| | | import jakarta.servlet.FilterConfig; |
| | | import jakarta.servlet.ServletException; |
| | | import jakarta.servlet.ServletRequest; |
| | | import jakarta.servlet.ServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.enums.HttpMethod; |
| | | |
| | | /** |
| | | * 鲿¢XSSæ»å»çè¿æ»¤å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class XssFilter implements Filter |
| | | { |
| | | /** |
| | | * æé¤é¾æ¥ |
| | | */ |
| | | public List<String> excludes = new ArrayList<>(); |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | String tempExcludes = filterConfig.getInitParameter("excludes"); |
| | | if (StringUtils.isNotEmpty(tempExcludes)) |
| | | { |
| | | String[] urls = tempExcludes.split(","); |
| | | for (String url : urls) |
| | | { |
| | | excludes.add(url); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | HttpServletRequest req = (HttpServletRequest) request; |
| | | HttpServletResponse resp = (HttpServletResponse) response; |
| | | if (handleExcludeURL(req, resp)) |
| | | { |
| | | chain.doFilter(request, response); |
| | | return; |
| | | } |
| | | XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); |
| | | chain.doFilter(xssRequest, response); |
| | | } |
| | | |
| | | private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) |
| | | { |
| | | String url = request.getServletPath(); |
| | | String method = request.getMethod(); |
| | | // GET DELETE ä¸è¿æ»¤ |
| | | if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) |
| | | { |
| | | return true; |
| | | } |
| | | return StringUtils.matches(url, excludes); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import jakarta.servlet.ReadListener; |
| | | import jakarta.servlet.ServletInputStream; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletRequestWrapper; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.html.EscapeUtil; |
| | | |
| | | /** |
| | | * XSSè¿æ»¤å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper |
| | | { |
| | | /** |
| | | * @param request |
| | | */ |
| | | public XssHttpServletRequestWrapper(HttpServletRequest request) |
| | | { |
| | | super(request); |
| | | } |
| | | |
| | | @Override |
| | | public String[] getParameterValues(String name) |
| | | { |
| | | String[] values = super.getParameterValues(name); |
| | | if (values != null) |
| | | { |
| | | int length = values.length; |
| | | String[] escapesValues = new String[length]; |
| | | for (int i = 0; i < length; i++) |
| | | { |
| | | // é²xssæ»å»åè¿æ»¤ååç©ºæ ¼ |
| | | escapesValues[i] = EscapeUtil.clean(values[i]).trim(); |
| | | } |
| | | return escapesValues; |
| | | } |
| | | return super.getParameterValues(name); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() throws IOException |
| | | { |
| | | // éjsonç±»åï¼ç´æ¥è¿å |
| | | if (!isJsonRequest()) |
| | | { |
| | | return super.getInputStream(); |
| | | } |
| | | |
| | | // 为空ï¼ç´æ¥è¿å |
| | | String json = IOUtils.toString(super.getInputStream(), "utf-8"); |
| | | if (StringUtils.isEmpty(json)) |
| | | { |
| | | return super.getInputStream(); |
| | | } |
| | | |
| | | // xssè¿æ»¤ |
| | | json = EscapeUtil.clean(json).trim(); |
| | | byte[] jsonBytes = json.getBytes("utf-8"); |
| | | final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); |
| | | return new ServletInputStream() |
| | | { |
| | | @Override |
| | | public boolean isFinished() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int available() throws IOException |
| | | { |
| | | return jsonBytes.length; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener readListener) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public int read() throws IOException |
| | | { |
| | | return bis.read(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æ¯Jsonè¯·æ± |
| | | * |
| | | * @param request |
| | | */ |
| | | public boolean isJsonRequest() |
| | | { |
| | | String header = super.getHeader(HttpHeaders.CONTENT_TYPE); |
| | | return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * ç²¾ç¡®çæµ®ç¹æ°è¿ç® |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Arith |
| | | { |
| | | |
| | | /** é»è®¤é¤æ³è¿ç®ç²¾åº¦ */ |
| | | private static final int DEF_DIV_SCALE = 10; |
| | | |
| | | /** è¿ä¸ªç±»ä¸è½å®ä¾å */ |
| | | private Arith() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * æä¾ç²¾ç¡®çå æ³è¿ç®ã |
| | | * @param v1 è¢«å æ° |
| | | * @param v2 å æ° |
| | | * @return ä¸¤ä¸ªåæ°çå |
| | | */ |
| | | public static double add(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.add(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * æä¾ç²¾ç¡®çåæ³è¿ç®ã |
| | | * @param v1 è¢«åæ° |
| | | * @param v2 åæ° |
| | | * @return ä¸¤ä¸ªåæ°çå·® |
| | | */ |
| | | public static double sub(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.subtract(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * æä¾ç²¾ç¡®ç乿³è¿ç®ã |
| | | * @param v1 è¢«ä¹æ° |
| | | * @param v2 乿° |
| | | * @return ä¸¤ä¸ªåæ°ç积 |
| | | */ |
| | | public static double mul(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.multiply(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * æä¾ï¼ç¸å¯¹ï¼ç²¾ç¡®ç餿³è¿ç®ï¼å½åçé¤ä¸å°½çæ
嵿¶ï¼ç²¾ç¡®å° |
| | | * å°æ°ç¹ä»¥å10ä½ï¼ä»¥åçæ°ååèäºå
¥ã |
| | | * @param v1 è¢«é¤æ° |
| | | * @param v2 餿° |
| | | * @return ä¸¤ä¸ªåæ°çå |
| | | */ |
| | | public static double div(double v1, double v2) |
| | | { |
| | | return div(v1, v2, DEF_DIV_SCALE); |
| | | } |
| | | |
| | | /** |
| | | * æä¾ï¼ç¸å¯¹ï¼ç²¾ç¡®ç餿³è¿ç®ãå½åçé¤ä¸å°½çæ
嵿¶ï¼ç±scaleåæ°æ |
| | | * å®ç²¾åº¦ï¼ä»¥åçæ°ååèäºå
¥ã |
| | | * @param v1 è¢«é¤æ° |
| | | * @param v2 餿° |
| | | * @param scale 表示表示éè¦ç²¾ç¡®å°å°æ°ç¹ä»¥åå ä½ã |
| | | * @return ä¸¤ä¸ªåæ°çå |
| | | */ |
| | | public static double div(double v1, double v2, int scale) |
| | | { |
| | | if (scale < 0) |
| | | { |
| | | throw new IllegalArgumentException( |
| | | "The scale must be a positive integer or zero"); |
| | | } |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | if (b1.compareTo(BigDecimal.ZERO) == 0) |
| | | { |
| | | return BigDecimal.ZERO.doubleValue(); |
| | | } |
| | | return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * æä¾ç²¾ç¡®çå°æ°ä½åèäºå
¥å¤çã |
| | | * @param v éè¦åèäºå
¥çæ°å |
| | | * @param scale å°æ°ç¹åä¿çå ä½ |
| | | * @return åèäºå
¥åçç»æ |
| | | */ |
| | | public static double round(double v, int scale) |
| | | { |
| | | if (scale < 0) |
| | | { |
| | | throw new IllegalArgumentException( |
| | | "The scale must be a positive integer or zero"); |
| | | } |
| | | BigDecimal b = new BigDecimal(Double.toString(v)); |
| | | return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.lang.management.ManagementFactory; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.util.Date; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | |
| | | /** |
| | | * æ¶é´å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public class DateUtils extends org.apache.commons.lang3.time.DateUtils |
| | | { |
| | | public static String YYYY = "yyyy"; |
| | | |
| | | public static String YYYY_MM = "yyyy-MM"; |
| | | |
| | | public static String YYYY_MM_DD = "yyyy-MM-dd"; |
| | | |
| | | public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; |
| | | |
| | | public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | private static String[] parsePatterns = { |
| | | "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", |
| | | "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", |
| | | "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; |
| | | |
| | | /** |
| | | * è·åå½åDate忥æ |
| | | * |
| | | * @return Date() å½åæ¥æ |
| | | */ |
| | | public static Date getNowDate() |
| | | { |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¥æ, é»è®¤æ ¼å¼ä¸ºyyyy-MM-dd |
| | | * |
| | | * @return String |
| | | */ |
| | | public static String getDate() |
| | | { |
| | | return dateTimeNow(YYYY_MM_DD); |
| | | } |
| | | |
| | | public static final String getTime() |
| | | { |
| | | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
| | | } |
| | | |
| | | public static final String dateTimeNow() |
| | | { |
| | | return dateTimeNow(YYYYMMDDHHMMSS); |
| | | } |
| | | |
| | | public static final String dateTimeNow(final String format) |
| | | { |
| | | return parseDateToStr(format, new Date()); |
| | | } |
| | | |
| | | public static final String dateTime(final Date date) |
| | | { |
| | | return parseDateToStr(YYYY_MM_DD, date); |
| | | } |
| | | |
| | | public static final String parseDateToStr(final String format, final Date date) |
| | | { |
| | | return new SimpleDateFormat(format).format(date); |
| | | } |
| | | |
| | | public static final Date dateTime(final String format, final String ts) |
| | | { |
| | | try |
| | | { |
| | | return new SimpleDateFormat(format).parse(ts); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦2018/08/08 |
| | | */ |
| | | public static final String datePath() |
| | | { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyy/MM/dd"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦20180808 |
| | | */ |
| | | public static final String dateTime() |
| | | { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyyMMdd"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æåå符串转åä¸ºæ¥æ æ ¼å¼ |
| | | */ |
| | | public static Date parseDate(Object str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return null; |
| | | } |
| | | try |
| | | { |
| | | return parseDate(str.toString(), parsePatterns); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæå¡å¨å¯å¨æ¶é´ |
| | | */ |
| | | public static Date getServerStartDate() |
| | | { |
| | | long time = ManagementFactory.getRuntimeMXBean().getStartTime(); |
| | | return new Date(time); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ç¸å·®å¤©æ° |
| | | */ |
| | | public static int differentDaysByMillisecond(Date date1, Date date2) |
| | | { |
| | | return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¶é´å·® |
| | | * |
| | | * @param endDate æåæ¶é´ |
| | | * @param startTime å¼å§æ¶é´ |
| | | * @return æ¶é´å·®ï¼å¤©/å°æ¶/åéï¼ |
| | | */ |
| | | public static String timeDistance(Date endDate, Date startTime) |
| | | { |
| | | long nd = 1000 * 24 * 60 * 60; |
| | | long nh = 1000 * 60 * 60; |
| | | long nm = 1000 * 60; |
| | | // long ns = 1000; |
| | | // è·å¾ä¸¤ä¸ªæ¶é´çæ¯«ç§æ¶é´å·®å¼ |
| | | long diff = endDate.getTime() - startTime.getTime(); |
| | | // 计ç®å·®å¤å°å¤© |
| | | long day = diff / nd; |
| | | // 计ç®å·®å¤å°å°æ¶ |
| | | long hour = diff % nd / nh; |
| | | // 计ç®å·®å¤å°åé |
| | | long min = diff % nd % nh / nm; |
| | | // 计ç®å·®å¤å°ç§//è¾åºç»æ |
| | | // long sec = diff % nd % nh % nm / ns; |
| | | return day + "天" + hour + "å°æ¶" + min + "åé"; |
| | | } |
| | | |
| | | /** |
| | | * å¢å LocalDateTime ==> Date |
| | | */ |
| | | public static Date toDate(LocalDateTime temporalAccessor) |
| | | { |
| | | ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * å¢å LocalDate ==> Date |
| | | */ |
| | | public static Date toDate(LocalDate temporalAccessor) |
| | | { |
| | | LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); |
| | | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | |
| | | /** |
| | | * åå
¸å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DictUtils |
| | | { |
| | | /** |
| | | * åé符 |
| | | */ |
| | | public static final String SEPARATOR = ","; |
| | | |
| | | /** |
| | | * 设置åå
¸ç¼å |
| | | * |
| | | * @param key åæ°é® |
| | | * @param dictDatas åå
¸æ°æ®å表 |
| | | */ |
| | | public static void setDictCache(String key, List<SysDictData> dictDatas) |
| | | { |
| | | SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸ç¼å |
| | | * |
| | | * @param key åæ°é® |
| | | * @return dictDatas åå
¸æ°æ®å表 |
| | | */ |
| | | public static List<SysDictData> getDictCache(String key) |
| | | { |
| | | JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); |
| | | if (StringUtils.isNotNull(arrayCache)) |
| | | { |
| | | return arrayCache.toList(SysDictData.class); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸å¼è·ååå
¸æ ç¾ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictValue åå
¸å¼ |
| | | * @return åå
¸æ ç¾ |
| | | */ |
| | | public static String getDictLabel(String dictType, String dictValue) |
| | | { |
| | | if (StringUtils.isEmpty(dictValue)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | return getDictLabel(dictType, dictValue, SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸æ ç¾è·ååå
¸å¼ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictLabel åå
¸æ ç¾ |
| | | * @return åå
¸å¼ |
| | | */ |
| | | public static String getDictValue(String dictType, String dictLabel) |
| | | { |
| | | if (StringUtils.isEmpty(dictLabel)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | return getDictValue(dictType, dictLabel, SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸å¼è·ååå
¸æ ç¾ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictValue åå
¸å¼ |
| | | * @param separator åé符 |
| | | * @return åå
¸æ ç¾ |
| | | */ |
| | | public static String getDictLabel(String dictType, String dictValue, String separator) |
| | | { |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | if (StringUtils.isNull(datas) || StringUtils.isEmpty(dictValue)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | Map<String, String> dictMap = datas.stream().collect(HashMap::new, (map, dict) -> map.put(dict.getDictValue(), dict.getDictLabel()), Map::putAll); |
| | | if (!StringUtils.contains(dictValue, separator)) |
| | | { |
| | | return dictMap.getOrDefault(dictValue, StringUtils.EMPTY); |
| | | } |
| | | StringBuilder labelBuilder = new StringBuilder(); |
| | | for (String seperatedValue : dictValue.split(separator)) |
| | | { |
| | | if (dictMap.containsKey(seperatedValue)) |
| | | { |
| | | labelBuilder.append(dictMap.get(seperatedValue)).append(separator); |
| | | } |
| | | } |
| | | return StringUtils.removeEnd(labelBuilder.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸æ ç¾è·ååå
¸å¼ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictLabel åå
¸æ ç¾ |
| | | * @param separator åé符 |
| | | * @return åå
¸å¼ |
| | | */ |
| | | public static String getDictValue(String dictType, String dictLabel, String separator) |
| | | { |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | if (StringUtils.isNull(datas) || StringUtils.isEmpty(dictLabel)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | Map<String, String> dictMap = datas.stream().collect(HashMap::new, (map, dict) -> map.put(dict.getDictLabel(), dict.getDictValue()), Map::putAll); |
| | | if (!StringUtils.contains(dictLabel, separator)) |
| | | { |
| | | return dictMap.getOrDefault(dictLabel, StringUtils.EMPTY); |
| | | } |
| | | StringBuilder valueBuilder = new StringBuilder(); |
| | | for (String seperatedValue : dictLabel.split(separator)) |
| | | { |
| | | if (dictMap.containsKey(seperatedValue)) |
| | | { |
| | | valueBuilder.append(dictMap.get(seperatedValue)).append(separator); |
| | | } |
| | | } |
| | | return StringUtils.removeEnd(valueBuilder.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åè·ååå
¸ææå¼ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @return åå
¸å¼ |
| | | */ |
| | | public static String getDictValues(String dictType) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | if (StringUtils.isNull(datas)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | for (SysDictData dict : datas) |
| | | { |
| | | propertyString.append(dict.getDictValue()).append(SEPARATOR); |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åè·ååå
¸æææ ç¾ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @return åå
¸å¼ |
| | | */ |
| | | public static String getDictLabels(String dictType) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | if (StringUtils.isNull(datas)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | for (SysDictData dict : datas) |
| | | { |
| | | propertyString.append(dict.getDictLabel()).append(SEPARATOR); |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * å 餿å®åå
¸ç¼å |
| | | * |
| | | * @param key åå
¸é® |
| | | */ |
| | | public static void removeDictCache(String key) |
| | | { |
| | | SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
空åå
¸ç¼å |
| | | */ |
| | | public static void clearDictCache() |
| | | { |
| | | Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*"); |
| | | SpringUtils.getBean(RedisCache.class).deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey åæ°é® |
| | | * @return ç¼åé®key |
| | | */ |
| | | public static String getCacheKey(String configKey) |
| | | { |
| | | return CacheConstants.SYS_DICT_KEY + configKey; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | |
| | | /** |
| | | * é误信æ¯å¤çç±»ã |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExceptionUtil |
| | | { |
| | | /** |
| | | * è·åexceptionç详ç»é误信æ¯ã |
| | | */ |
| | | public static String getExceptionMessage(Throwable e) |
| | | { |
| | | StringWriter sw = new StringWriter(); |
| | | e.printStackTrace(new PrintWriter(sw, true)); |
| | | return sw.toString(); |
| | | } |
| | | |
| | | public static String getRootErrorMessage(Exception e) |
| | | { |
| | | Throwable root = ExceptionUtils.getRootCause(e); |
| | | root = (root == null ? e : root); |
| | | if (root == null) |
| | | { |
| | | return ""; |
| | | } |
| | | String msg = root.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | return "null"; |
| | | } |
| | | return StringUtils.defaultString(msg); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | /** |
| | | * å¤çå¹¶è®°å½æ¥å¿æä»¶ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LogUtils |
| | | { |
| | | public static String getBlock(Object msg) |
| | | { |
| | | if (msg == null) |
| | | { |
| | | msg = ""; |
| | | } |
| | | return "[" + msg.toString() + "]"; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | |
| | | /** |
| | | * è·åi18nèµæºæä»¶ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MessageUtils |
| | | { |
| | | /** |
| | | * æ ¹æ®æ¶æ¯é®ååæ° è·åæ¶æ¯ å§æç»spring messageSource |
| | | * |
| | | * @param code æ¶æ¯é® |
| | | * @param args åæ° |
| | | * @return è·åå½é
åç¿»è¯å¼ |
| | | */ |
| | | public static String message(String code, Object... args) |
| | | { |
| | | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); |
| | | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.ruoyi.common.core.page.PageDomain; |
| | | import com.ruoyi.common.core.page.TableSupport; |
| | | import com.ruoyi.common.utils.sql.SqlUtil; |
| | | |
| | | /** |
| | | * å页工å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PageUtils extends PageHelper |
| | | { |
| | | /** |
| | | * 设置请æ±åé¡µæ°æ® |
| | | */ |
| | | public static void startPage() |
| | | { |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | Integer pageNum = pageDomain.getPageNum(); |
| | | Integer pageSize = pageDomain.getPageSize(); |
| | | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
| | | Boolean reasonable = pageDomain.getReasonable(); |
| | | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
çå页ç线ç¨åé |
| | | */ |
| | | public static void clearPage() |
| | | { |
| | | PageHelper.clearPage(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.util.PatternMatchUtils; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | |
| | | /** |
| | | * å®å
¨æå¡å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SecurityUtils |
| | | { |
| | | |
| | | /** |
| | | * ç¨æ·ID |
| | | **/ |
| | | public static Long getUserId() |
| | | { |
| | | try |
| | | { |
| | | return getLoginUser().getUserId(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new ServiceException("è·åç¨æ·IDå¼å¸¸", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åé¨é¨ID |
| | | **/ |
| | | public static Long getDeptId() |
| | | { |
| | | try |
| | | { |
| | | return getLoginUser().getDeptId(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new ServiceException("è·åé¨é¨IDå¼å¸¸", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·è´¦æ· |
| | | **/ |
| | | public static String getUsername() |
| | | { |
| | | try |
| | | { |
| | | return getLoginUser().getUsername(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new ServiceException("è·åç¨æ·è´¦æ·å¼å¸¸", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ· |
| | | **/ |
| | | public static LoginUser getLoginUser() |
| | | { |
| | | try |
| | | { |
| | | return (LoginUser) getAuthentication().getPrincipal(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new ServiceException("è·åç¨æ·ä¿¡æ¯å¼å¸¸", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åAuthentication |
| | | */ |
| | | public static Authentication getAuthentication() |
| | | { |
| | | return SecurityContextHolder.getContext().getAuthentication(); |
| | | } |
| | | |
| | | /** |
| | | * çæBCryptPasswordEncoderå¯ç |
| | | * |
| | | * @param password å¯ç |
| | | * @return å å¯å符串 |
| | | */ |
| | | public static String encryptPassword(String password) |
| | | { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.encode(password); |
| | | } |
| | | |
| | | /** |
| | | * 夿å¯ç æ¯å¦ç¸å |
| | | * |
| | | * @param rawPassword çå®å¯ç |
| | | * @param encodedPassword å å¯åå符 |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) |
| | | { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.matches(rawPassword, encodedPassword); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç®¡çå |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean isAdmin() |
| | | { |
| | | return isAdmin(getUserId()); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç®¡çå |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean isAdmin(Long userId) |
| | | { |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | | /** |
| | | * éªè¯ç¨æ·æ¯å¦å
·å¤ææé |
| | | * |
| | | * @param permission æéå符串 |
| | | * @return ç¨æ·æ¯å¦å
·å¤ææé |
| | | */ |
| | | public static boolean hasPermi(String permission) |
| | | { |
| | | return hasPermi(getLoginUser().getPermissions(), permission); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦å
嫿é |
| | | * |
| | | * @param authorities æéå表 |
| | | * @param permission æéå符串 |
| | | * @return ç¨æ·æ¯å¦å
·å¤ææé |
| | | */ |
| | | public static boolean hasPermi(Collection<String> authorities, String permission) |
| | | { |
| | | return authorities.stream().filter(StringUtils::hasText) |
| | | .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); |
| | | } |
| | | |
| | | /** |
| | | * éªè¯ç¨æ·æ¯å¦æ¥ææä¸ªè§è² |
| | | * |
| | | * @param role è§è²æ è¯ |
| | | * @return ç¨æ·æ¯å¦å
·å¤æè§è² |
| | | */ |
| | | public static boolean hasRole(String role) |
| | | { |
| | | List<SysRole> roleList = getLoginUser().getUser().getRoles(); |
| | | Collection<String> roles = roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toSet()); |
| | | return hasRole(roles, role); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦å
å«è§è² |
| | | * |
| | | * @param roles è§è²å表 |
| | | * @param role è§è² |
| | | * @return ç¨æ·æ¯å¦å
·å¤æè§è²æé |
| | | */ |
| | | public static boolean hasRole(Collection<String> roles, String role) |
| | | { |
| | | return roles.stream().filter(StringUtils::hasText) |
| | | .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import jakarta.servlet.ServletRequest; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpSession; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | |
| | | /** |
| | | * 客æ·ç«¯å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ServletUtils |
| | | { |
| | | /** |
| | | * è·åStringåæ° |
| | | */ |
| | | public static String getParameter(String name) |
| | | { |
| | | return getRequest().getParameter(name); |
| | | } |
| | | |
| | | /** |
| | | * è·åStringåæ° |
| | | */ |
| | | public static String getParameter(String name, String defaultValue) |
| | | { |
| | | return Convert.toStr(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·åIntegeråæ° |
| | | */ |
| | | public static Integer getParameterToInt(String name) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * è·åIntegeråæ° |
| | | */ |
| | | public static Integer getParameterToInt(String name, Integer defaultValue) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·åBooleanåæ° |
| | | */ |
| | | public static Boolean getParameterToBool(String name) |
| | | { |
| | | return Convert.toBool(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * è·åBooleanåæ° |
| | | */ |
| | | public static Boolean getParameterToBool(String name, Boolean defaultValue) |
| | | { |
| | | return Convert.toBool(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ææè¯·æ±åæ° |
| | | * |
| | | * @param request 请æ±å¯¹è±¡{@link ServletRequest} |
| | | * @return Map |
| | | */ |
| | | public static Map<String, String[]> getParams(ServletRequest request) |
| | | { |
| | | final Map<String, String[]> map = request.getParameterMap(); |
| | | return Collections.unmodifiableMap(map); |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ææè¯·æ±åæ° |
| | | * |
| | | * @param request 请æ±å¯¹è±¡{@link ServletRequest} |
| | | * @return Map |
| | | */ |
| | | public static Map<String, String> getParamMap(ServletRequest request) |
| | | { |
| | | Map<String, String> params = new HashMap<>(); |
| | | for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) |
| | | { |
| | | params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | /** |
| | | * è·årequest |
| | | */ |
| | | public static HttpServletRequest getRequest() |
| | | { |
| | | return getRequestAttributes().getRequest(); |
| | | } |
| | | |
| | | /** |
| | | * è·åresponse |
| | | */ |
| | | public static HttpServletResponse getResponse() |
| | | { |
| | | return getRequestAttributes().getResponse(); |
| | | } |
| | | |
| | | /** |
| | | * è·åsession |
| | | */ |
| | | public static HttpSession getSession() |
| | | { |
| | | return getRequest().getSession(); |
| | | } |
| | | |
| | | public static ServletRequestAttributes getRequestAttributes() |
| | | { |
| | | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | | return (ServletRequestAttributes) attributes; |
| | | } |
| | | |
| | | /** |
| | | * å°å符串渲æå°å®¢æ·ç«¯ |
| | | * |
| | | * @param response 渲æå¯¹è±¡ |
| | | * @param string å¾
渲æçå符串 |
| | | */ |
| | | public static void renderString(HttpServletResponse response, String string) |
| | | { |
| | | try |
| | | { |
| | | response.setStatus(200); |
| | | response.setContentType("application/json"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.getWriter().print(string); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æ¯Ajax弿¥è¯·æ± |
| | | * |
| | | * @param request |
| | | */ |
| | | public static boolean isAjaxRequest(HttpServletRequest request) |
| | | { |
| | | String accept = request.getHeader("accept"); |
| | | if (accept != null && accept.contains("application/json")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String xRequestedWith = request.getHeader("X-Requested-With"); |
| | | if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String uri = request.getRequestURI(); |
| | | if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String ajax = request.getParameter("__ajax"); |
| | | return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); |
| | | } |
| | | |
| | | /** |
| | | * å
容ç¼ç |
| | | * |
| | | * @param str å
容 |
| | | * @return ç¼ç åçå
容 |
| | | */ |
| | | public static String urlEncode(String str) |
| | | { |
| | | try |
| | | { |
| | | return URLEncoder.encode(str, Constants.UTF8); |
| | | } |
| | | catch (UnsupportedEncodingException e) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
容解ç |
| | | * |
| | | * @param str å
容 |
| | | * @return è§£ç åçå
容 |
| | | */ |
| | | public static String urlDecode(String str) |
| | | { |
| | | try |
| | | { |
| | | return URLDecoder.decode(str, Constants.UTF8); |
| | | } |
| | | catch (UnsupportedEncodingException e) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import org.apache.commons.lang3.Strings; |
| | | import org.springframework.util.AntPathMatcher; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.text.StrFormatter; |
| | | |
| | | /** |
| | | * å符串工å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public class StringUtils extends org.apache.commons.lang3.StringUtils |
| | | { |
| | | /** 空å符串 */ |
| | | private static final String NULLSTR = ""; |
| | | |
| | | /** ä¸å线 */ |
| | | private static final char SEPARATOR = '_'; |
| | | |
| | | /** æå· */ |
| | | private static final char ASTERISK = '*'; |
| | | |
| | | /** |
| | | * è·ååæ°ä¸ä¸ºç©ºå¼ |
| | | * |
| | | * @param value defaultValue è¦å¤æçvalue |
| | | * @return value è¿åå¼ |
| | | */ |
| | | public static <T> T nvl(T value, T defaultValue) |
| | | { |
| | | return value != null ? value : defaultValue; |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªCollectionæ¯å¦ä¸ºç©ºï¼ å
å«Listï¼Setï¼Queue |
| | | * |
| | | * @param coll è¦å¤æçCollection |
| | | * @return trueï¼ä¸ºç©º falseï¼é空 |
| | | */ |
| | | public static boolean isEmpty(Collection<?> coll) |
| | | { |
| | | return isNull(coll) || coll.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªCollectionæ¯å¦é空ï¼å
å«Listï¼Setï¼Queue |
| | | * |
| | | * @param coll è¦å¤æçCollection |
| | | * @return trueï¼é空 falseï¼ç©º |
| | | */ |
| | | public static boolean isNotEmpty(Collection<?> coll) |
| | | { |
| | | return !isEmpty(coll); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå¯¹è±¡æ°ç»æ¯å¦ä¸ºç©º |
| | | * |
| | | * @param objects è¦å¤æç对象æ°ç» |
| | | ** @return trueï¼ä¸ºç©º falseï¼é空 |
| | | */ |
| | | public static boolean isEmpty(Object[] objects) |
| | | { |
| | | return isNull(objects) || (objects.length == 0); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå¯¹è±¡æ°ç»æ¯å¦é空 |
| | | * |
| | | * @param objects è¦å¤æç对象æ°ç» |
| | | * @return trueï¼é空 falseï¼ç©º |
| | | */ |
| | | public static boolean isNotEmpty(Object[] objects) |
| | | { |
| | | return !isEmpty(objects); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªMapæ¯å¦ä¸ºç©º |
| | | * |
| | | * @param map è¦å¤æçMap |
| | | * @return trueï¼ä¸ºç©º falseï¼é空 |
| | | */ |
| | | public static boolean isEmpty(Map<?, ?> map) |
| | | { |
| | | return isNull(map) || map.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªMapæ¯å¦ä¸ºç©º |
| | | * |
| | | * @param map è¦å¤æçMap |
| | | * @return trueï¼é空 falseï¼ç©º |
| | | */ |
| | | public static boolean isNotEmpty(Map<?, ?> map) |
| | | { |
| | | return !isEmpty(map); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå符串æ¯å¦ä¸ºç©ºä¸² |
| | | * |
| | | * @param str String |
| | | * @return trueï¼ä¸ºç©º falseï¼é空 |
| | | */ |
| | | public static boolean isEmpty(String str) |
| | | { |
| | | return isNull(str) || NULLSTR.equals(str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå符串æ¯å¦ä¸ºé空串 |
| | | * |
| | | * @param str String |
| | | * @return trueï¼é空串 falseï¼ç©ºä¸² |
| | | */ |
| | | public static boolean isNotEmpty(String str) |
| | | { |
| | | return !isEmpty(str); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå¯¹è±¡æ¯å¦ä¸ºç©º |
| | | * |
| | | * @param object Object |
| | | * @return trueï¼ä¸ºç©º falseï¼é空 |
| | | */ |
| | | public static boolean isNull(Object object) |
| | | { |
| | | return object == null; |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå¯¹è±¡æ¯å¦é空 |
| | | * |
| | | * @param object Object |
| | | * @return trueï¼é空 falseï¼ç©º |
| | | */ |
| | | public static boolean isNotNull(Object object) |
| | | { |
| | | return !isNull(object); |
| | | } |
| | | |
| | | /** |
| | | * * 夿ä¸ä¸ªå¯¹è±¡æ¯å¦æ¯æ°ç»ç±»åï¼Javaåºæ¬åå«çæ°ç»ï¼ |
| | | * |
| | | * @param object 对象 |
| | | * @return trueï¼æ¯æ°ç» falseï¼ä¸æ¯æ°ç» |
| | | */ |
| | | public static boolean isArray(Object object) |
| | | { |
| | | return isNotNull(object) && object.getClass().isArray(); |
| | | } |
| | | |
| | | /** |
| | | * å»ç©ºæ ¼ |
| | | */ |
| | | public static String trim(String str) |
| | | { |
| | | return (str == null ? "" : str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ¢æå®å符串çæå®åºé´å
å符为"*" |
| | | * |
| | | * @param str å符串 |
| | | * @param startInclude å¼å§ä½ç½®ï¼å
å«ï¼ |
| | | * @param endExclude ç»æä½ç½®ï¼ä¸å
å«ï¼ |
| | | * @return æ¿æ¢åçå符串 |
| | | */ |
| | | public static String hide(CharSequence str, int startInclude, int endExclude) |
| | | { |
| | | if (isEmpty(str)) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | final int strLength = str.length(); |
| | | if (startInclude > strLength) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | if (endExclude > strLength) |
| | | { |
| | | endExclude = strLength; |
| | | } |
| | | if (startInclude > endExclude) |
| | | { |
| | | // å¦æèµ·å§ä½ç½®å¤§äºç»æä½ç½®ï¼ä¸æ¿æ¢ |
| | | return NULLSTR; |
| | | } |
| | | final char[] chars = new char[strLength]; |
| | | for (int i = 0; i < strLength; i++) |
| | | { |
| | | if (i >= startInclude && i < endExclude) |
| | | { |
| | | chars[i] = ASTERISK; |
| | | } |
| | | else |
| | | { |
| | | chars[i] = str.charAt(i); |
| | | } |
| | | } |
| | | return new String(chars); |
| | | } |
| | | |
| | | /** |
| | | * æªåå符串 |
| | | * |
| | | * @param str å符串 |
| | | * @param start å¼å§ |
| | | * @return ç»æ |
| | | */ |
| | | public static String substring(final String str, int start) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (start > str.length()) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | return str.substring(start); |
| | | } |
| | | |
| | | /** |
| | | * æªåå符串 |
| | | * |
| | | * @param str å符串 |
| | | * @param start å¼å§ |
| | | * @param end ç»æ |
| | | * @return ç»æ |
| | | */ |
| | | public static String substring(final String str, int start, int end) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (end < 0) |
| | | { |
| | | end = str.length() + end; |
| | | } |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (end > str.length()) |
| | | { |
| | | end = str.length(); |
| | | } |
| | | |
| | | if (start > end) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (end < 0) |
| | | { |
| | | end = 0; |
| | | } |
| | | |
| | | return str.substring(start, end); |
| | | } |
| | | |
| | | /** |
| | | * å¨åç¬¦ä¸²ä¸æ¥æ¾ç¬¬ä¸ä¸ªåºç°ç `open` åæåä¸ä¸ªåºç°ç `close` ä¹é´çåå符串 |
| | | * |
| | | * @param str è¦æªåçå符串 |
| | | * @param open èµ·å§å符串 |
| | | * @param close ç»æå符串 |
| | | * @return æªåç»æ |
| | | */ |
| | | public static String substringBetweenLast(final String str, final String open, final String close) |
| | | { |
| | | if (isEmpty(str) || isEmpty(open) || isEmpty(close)) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | final int start = str.indexOf(open); |
| | | if (start != INDEX_NOT_FOUND) |
| | | { |
| | | final int end = str.lastIndexOf(close); |
| | | if (end != INDEX_NOT_FOUND) |
| | | { |
| | | return str.substring(start + open.length(), end); |
| | | } |
| | | } |
| | | return NULLSTR; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºç©ºï¼å¹¶ä¸ä¸æ¯ç©ºç½å符 |
| | | * |
| | | * @param str è¦å¤æçvalue |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean hasText(String str) |
| | | { |
| | | return (str != null && !str.isEmpty() && containsText(str)); |
| | | } |
| | | |
| | | private static boolean containsText(CharSequence str) |
| | | { |
| | | int strLen = str.length(); |
| | | for (int i = 0; i < strLen; i++) |
| | | { |
| | | if (!Character.isWhitespace(str.charAt(i))) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åææ¬, {} 表示å ä½ç¬¦<br> |
| | | * æ¤æ¹æ³åªæ¯ç®åå°å ä½ç¬¦ {} æç
§é¡ºåºæ¿æ¢ä¸ºåæ°<br> |
| | | * 妿æ³è¾åº {} ä½¿ç¨ \\è½¬ä¹ { å³å¯ï¼å¦ææ³è¾åº {} ä¹åç \ 使ç¨å转ä¹ç¬¦ \\\\ å³å¯<br> |
| | | * ä¾ï¼<br> |
| | | * é常使ç¨ï¼format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转ä¹{}ï¼ format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转ä¹\ï¼ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param template ææ¬æ¨¡æ¿ï¼è¢«æ¿æ¢çé¨åç¨ {} 表示 |
| | | * @param params åæ°å¼ |
| | | * @return æ ¼å¼ååçææ¬ |
| | | */ |
| | | public static String format(String template, Object... params) |
| | | { |
| | | if (isEmpty(params) || isEmpty(template)) |
| | | { |
| | | return template; |
| | | } |
| | | return StrFormatter.format(template, params); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºhttp(s)://å¼å¤´ |
| | | * |
| | | * @param link 龿¥ |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean ishttp(String link) |
| | | { |
| | | return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS); |
| | | } |
| | | |
| | | /** |
| | | * å符串转set |
| | | * |
| | | * @param str å符串 |
| | | * @param sep åé符 |
| | | * @return setéå |
| | | */ |
| | | public static final Set<String> str2Set(String str, String sep) |
| | | { |
| | | return new HashSet<String>(str2List(str, sep, true, false)); |
| | | } |
| | | |
| | | /** |
| | | * å符串转list |
| | | * |
| | | * @param str å符串 |
| | | * @param sep åé符 |
| | | * @return listéå |
| | | */ |
| | | public static final List<String> str2List(String str, String sep) |
| | | { |
| | | return str2List(str, sep, true, false); |
| | | } |
| | | |
| | | /** |
| | | * å符串转list |
| | | * |
| | | * @param str å符串 |
| | | * @param sep åé符 |
| | | * @param filterBlank è¿æ»¤çº¯ç©ºç½ |
| | | * @param trim 廿é¦å°¾ç©ºç½ |
| | | * @return listéå |
| | | */ |
| | | public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) |
| | | { |
| | | List<String> list = new ArrayList<String>(); |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return list; |
| | | } |
| | | |
| | | // è¿æ»¤ç©ºç½å符串 |
| | | if (filterBlank && StringUtils.isBlank(str)) |
| | | { |
| | | return list; |
| | | } |
| | | String[] split = str.split(sep); |
| | | for (String string : split) |
| | | { |
| | | if (filterBlank && StringUtils.isBlank(string)) |
| | | { |
| | | continue; |
| | | } |
| | | if (trim) |
| | | { |
| | | string = string.trim(); |
| | | } |
| | | list.add(string); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥åå符串æ¯å¦åå¨ |
| | | * |
| | | * @param seq æ£æ¥çå符串 |
| | | * @param searchSeq æ¥æ¾çå符串 |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean contains(final CharSequence seq, final CharSequence searchSeq) |
| | | { |
| | | return Strings.CS.contains(seq, searchSeq); |
| | | } |
| | | |
| | | /** |
| | | * 夿ç»å®çcollectionåè¡¨ä¸æ¯å¦å
嫿°ç»array 夿ç»å®çæ°ç»array䏿¯å¦å
å«ç»å®çå
ç´ value |
| | | * |
| | | * @param collection ç»å®çéå |
| | | * @param array ç»å®çæ°ç» |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean containsAny(Collection<String> collection, String... array) |
| | | { |
| | | if (isEmpty(collection) || isEmpty(array)) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | for (String str : array) |
| | | { |
| | | if (collection.contains(str)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦å
å«ç»å®æ°ç»ä¸çä»»æä¸ä¸ªã |
| | | * |
| | | * @param cs è¦å¤æçå符串 |
| | | * @param searchCharSequences è¦å¤æçæ°ç» |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean containsAny(final CharSequence cs, final CharSequence... searchCharSequences) |
| | | { |
| | | return Strings.CS.containsAny(cs, searchCharSequences); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾æå®å符串æ¯å¦å
嫿å®å符串å表ä¸çä»»æä¸ä¸ªåç¬¦ä¸²åæ¶ä¸²å¿½ç¥å¤§å°å |
| | | * |
| | | * @param cs æå®å符串 |
| | | * @param searchCharSequences éè¦æ£æ¥çå符串æ°ç» |
| | | * @return æ¯å¦å
å«ä»»æä¸ä¸ªå符串 |
| | | */ |
| | | public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) |
| | | { |
| | | if (isEmpty(cs) || isEmpty(searchCharSequences)) |
| | | { |
| | | return false; |
| | | } |
| | | for (CharSequence testStr : searchCharSequences) |
| | | { |
| | | if (containsIgnoreCase(cs, testStr)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥æ¯å¦å
å«è¦æç´¢çå符串ï¼å¿½ç¥å¤§å°å |
| | | * |
| | | * @param str è¦æ£æ¥çå符串 |
| | | * @param searchStr è¦æ¥æ¾çå符串 |
| | | * @return 妿å
å«è¦æç´¢çå符串ï¼å¿½ç¥å¤§å°åï¼åè¿åtrueï¼å¦æä¸å
嫿è¿åfalse |
| | | */ |
| | | public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) |
| | | { |
| | | return Strings.CI.contains(str, searchStr); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥å符串æ¯å¦ä»¥ä»»æåç¼å¼å§ |
| | | * |
| | | * @param sequence è¦æ£æ¥çå符串 |
| | | * @param searchStrings åºå大å°åçå符串åç¼æ°ç» |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean startsWithAny(final CharSequence sequence, final CharSequence... searchStrings) |
| | | { |
| | | return Strings.CS.startsWithAny(sequence, searchStrings); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åºå大å°åå°æ£æ¥ä¸ä¸ªå符串æ¯å¦ä»¥æå®åç¼å¼å¤´ã |
| | | * |
| | | * @param str å¾
æ£æ¥çå符串 |
| | | * @param è¦æ¥æ¾çåç¼ |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean startsWithIgnoreCase(final CharSequence str, final CharSequence prefix) |
| | | { |
| | | return Strings.CI.startsWith(str, prefix); |
| | | } |
| | | |
| | | /** |
| | | * æ¯è¾ä¸¤ä¸ªå符串æ¯å¦ç¸å |
| | | * |
| | | * @param cs1 第ä¸ä¸ªå符串 |
| | | * @param cs2 第äºä¸ªå符串 |
| | | * @return 妿ç»å®å¯¹è±¡ä¸å符串ç¸çï¼åè¿å trueï¼å¦åè¿å false |
| | | */ |
| | | public static boolean equals(final CharSequence cs1, final CharSequence cs2) |
| | | { |
| | | return Strings.CS.equals(cs1, cs2); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ¢åç¬¦ä¸²ä¸ææå¹é
çå符 |
| | | * |
| | | * @param text è¦æç´¢åæ¿æ¢çææ¬ |
| | | * @param searchString è¦æç´¢çå符串 |
| | | * @param replacement ç¨äºæ¿æ¢çå符串 |
| | | * @return å¤çå®æææ¿æ¢åçææ¬ |
| | | */ |
| | | public static String replace(final String text, final String searchString, final String replacement) |
| | | { |
| | | return Strings.CS.replace(text, searchString, replacement); |
| | | } |
| | | |
| | | /** |
| | | * ä»
å½åå符串ä½äºæºå符串æ«å°¾æ¶æå°å
¶ç§»é¤ï¼å¦åè¿åæºå符串ã |
| | | * @param str è¦æç´¢çæºå符串 |
| | | * @param remove è¦æç´¢å¹¶ç§»é¤çå符串 |
| | | * @return 妿æ¾å°å¹¶ç§»é¤äºå符串ï¼åè¿åç§»é¤åçåå符串 |
| | | */ |
| | | public static String removeEnd(final String str, final String remove) |
| | | { |
| | | return Strings.CS.removeEnd(str, remove); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾åç¬¦ä¸²é¦æ¬¡åºç°ä½ç½®çç´¢å¼ |
| | | * |
| | | * @param seq è¦æ£æ¥çå符串 |
| | | * @param searchSeq è¦æ¥æ¾çå符串 |
| | | * @return è¿åæå®å符å¨å符串ä¸ç¬¬ä¸æ¬¡åºç°å¤çç´¢å¼ï¼å¦ææ¤åç¬¦ä¸²ä¸æ²¡æè¿æ ·çå符ï¼åè¿å -1 |
| | | */ |
| | | public static int indexOf(final CharSequence seq, final CharSequence searchSeq) |
| | | { |
| | | return Strings.CS.indexOf(seq, searchSeq); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥å符串æ¯å¦ä»¥æå®çåç¼ç»å°¾ |
| | | * |
| | | * @param str è¦æ£æ¥çå符 |
| | | * @param suffix è¦æ£æ¥çåç¼ |
| | | * @return è¥åæ°ä¸è¯¥å符串æ«å°¾ç¸ç¬¦ true;å¦å false |
| | | */ |
| | | public static boolean endsWith(final CharSequence str, final CharSequence suffix) |
| | | { |
| | | return Strings.CS.endsWith(str, suffix); |
| | | } |
| | | |
| | | /** |
| | | * å°ç»å®çåç¬¦ä¸²ä¸æ°ç»è¿è¡æ¯è¾ |
| | | * |
| | | * @param string è¦æ¯è¾çå符串 |
| | | * @param searchStrings å符串æ°ç» |
| | | * @return 妿å符串çäºï¼åºå大å°åï¼{@code searchStrings}ä¸çä»»æå
¶ä»å
ç´ ï¼åè¿åtrueï¼å¦æ{@code searchStrings}为nullæä¸å
å«å¹é
项ï¼åè¿åfalse |
| | | */ |
| | | public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) |
| | | { |
| | | return Strings.CS.equalsAny(string, searchStrings); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥ä¸ä¸ªå符串æ¯å¦ä»¥ä»»ææä¾çåºå大å°åçåç¼ç»å°¾ã |
| | | * |
| | | * @param sequence è¦æ£æ¥çå符串 |
| | | * @param searchStrings è¦æ¥æ¾çåºå大å°åçå符串æ°ç» |
| | | * @return 妿è¾å
¥åæ°{@code sequence}为null䏿ªæä¾ä»»ä½{@code searchStrings}ï¼æè
è¾å
¥{@code sequence}以任ææä¾çåºå大å°åç{@code searchStrings}ç»å°¾ï¼åè¿å{@code true}ã |
| | | */ |
| | | public static boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings) |
| | | { |
| | | return Strings.CS.endsWithAny(sequence, searchStrings); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åºå大å°åå°æ£æ¥å符åºåæ¯å¦ä»¥æå®çåç¼ç»å°¾ |
| | | * |
| | | * @param str è¦æ£æ¥çå符åºå |
| | | * @param suffix è¦æ¥æ¾çåç¼ |
| | | * @return 妿å符åºå以该åç¼ç»å°¾ï¼ä¸åºå大å°åï¼ï¼æä¸¤è
å为{@code null}ï¼åè¿å{@code true} |
| | | */ |
| | | public static boolean endsWithIgnoreCase(final CharSequence str, final CharSequence suffix) |
| | | { |
| | | return Strings.CI.endsWith(str, suffix); |
| | | } |
| | | |
| | | /** |
| | | * æå®èå´å
æ¥æ¾å符串,忽ç¥å¤§å°å |
| | | * |
| | | * @param str è¦æ£æ¥çå符串 |
| | | * @param searchStr è¦æ¥æ¾çå符串 |
| | | * @return æç´¢å符串ç第ä¸ä¸ªç´¢å¼ï¼å¦ææªæ¾å°å¹é
项åè¿å -1 |
| | | */ |
| | | public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) |
| | | { |
| | | return Strings.CI.indexOf(str, searchStr); |
| | | } |
| | | |
| | | /** |
| | | * Compares given {@code string} to a CharSequences vararg of {@code searchStrings}, |
| | | * returning {@code true} if the {@code string} is equal to any of the {@code searchStrings}, ignoring case. |
| | | * |
| | | * @param string to compare, may be {@code null}. |
| | | * @param searchStrings a vararg of strings, may be {@code null}. |
| | | * @return {@code true} if the string is equal (case-insensitive) to any other element of {@code searchStrings}; |
| | | */ |
| | | public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence... searchStrings) |
| | | { |
| | | return Strings.CI.equalsAny(string, searchStrings); |
| | | } |
| | | |
| | | /** |
| | | * 驼峰转ä¸å线å½å |
| | | */ |
| | | public static String toUnderScoreCase(String str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return null; |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | // åç½®å符æ¯å¦å¤§å |
| | | boolean preCharIsUpperCase = true; |
| | | // å½åå符æ¯å¦å¤§å |
| | | boolean curreCharIsUpperCase = true; |
| | | // ä¸ä¸å符æ¯å¦å¤§å |
| | | boolean nexteCharIsUpperCase = true; |
| | | for (int i = 0; i < str.length(); i++) |
| | | { |
| | | char c = str.charAt(i); |
| | | if (i > 0) |
| | | { |
| | | preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); |
| | | } |
| | | else |
| | | { |
| | | preCharIsUpperCase = false; |
| | | } |
| | | |
| | | curreCharIsUpperCase = Character.isUpperCase(c); |
| | | |
| | | if (i < (str.length() - 1)) |
| | | { |
| | | nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); |
| | | } |
| | | |
| | | if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦å
å«å符串 |
| | | * |
| | | * @param str éªè¯å符串 |
| | | * @param strs åç¬¦ä¸²ç» |
| | | * @return å
å«è¿åtrue |
| | | */ |
| | | public static boolean inStringIgnoreCase(String str, String... strs) |
| | | { |
| | | if (str != null && strs != null) |
| | | { |
| | | for (String s : strs) |
| | | { |
| | | if (str.equalsIgnoreCase(trim(s))) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * å 餿åä¸ä¸ªå符串 |
| | | * |
| | | * @param str è¾å
¥å符串 |
| | | * @param spit 以ä»ä¹ç±»åç»å°¾ç |
| | | * @return æªååçå符串 |
| | | */ |
| | | public static String lastStringDel(String str, String spit) |
| | | { |
| | | if (!StringUtils.isEmpty(str) && str.endsWith(spit)) |
| | | { |
| | | return str.subSequence(0, str.length() - 1).toString(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * å°ä¸åçº¿å¤§åæ¹å¼å½åçå符串转æ¢ä¸ºé©¼å³°å¼ãå¦æè½¬æ¢åçä¸åçº¿å¤§åæ¹å¼å½åçå符串为空ï¼åè¿å空å符串ã ä¾å¦ï¼HELLO_WORLD->HelloWorld |
| | | * |
| | | * @param name 转æ¢åçä¸åçº¿å¤§åæ¹å¼å½åçå符串 |
| | | * @return 转æ¢åç驼峰å¼å½åçå符串 |
| | | */ |
| | | public static String convertToCamelCase(String name) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | // å¿«éæ£æ¥ |
| | | if (name == null || name.isEmpty()) |
| | | { |
| | | // 没å¿
è¦è½¬æ¢ |
| | | return ""; |
| | | } |
| | | else if (!name.contains("_")) |
| | | { |
| | | // ä¸å«ä¸å线ï¼ä»
å°é¦åæ¯å¤§å |
| | | return name.substring(0, 1).toUpperCase() + name.substring(1); |
| | | } |
| | | // ç¨ä¸å线å°åå§å符串åå² |
| | | String[] camels = name.split("_"); |
| | | for (String camel : camels) |
| | | { |
| | | // è·³è¿åå§å符串ä¸å¼å¤´ãç»å°¾ç䏿¢çº¿æåéä¸å线 |
| | | if (camel.isEmpty()) |
| | | { |
| | | continue; |
| | | } |
| | | // é¦åæ¯å¤§å |
| | | result.append(camel.substring(0, 1).toUpperCase()); |
| | | result.append(camel.substring(1).toLowerCase()); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 驼峰å¼å½åæ³ |
| | | * ä¾å¦ï¼user_name->userName |
| | | */ |
| | | public static String toCamelCase(String s) |
| | | { |
| | | if (s == null) |
| | | { |
| | | return null; |
| | | } |
| | | if (s.indexOf(SEPARATOR) == -1) |
| | | { |
| | | return s; |
| | | } |
| | | s = s.toLowerCase(); |
| | | StringBuilder sb = new StringBuilder(s.length()); |
| | | boolean upperCase = false; |
| | | for (int i = 0; i < s.length(); i++) |
| | | { |
| | | char c = s.charAt(i); |
| | | |
| | | if (c == SEPARATOR) |
| | | { |
| | | upperCase = true; |
| | | } |
| | | else if (upperCase) |
| | | { |
| | | sb.append(Character.toUpperCase(c)); |
| | | upperCase = false; |
| | | } |
| | | else |
| | | { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾æå®å符串æ¯å¦å¹é
æå®å符串å表ä¸çä»»æä¸ä¸ªå符串 |
| | | * |
| | | * @param str æå®å符串 |
| | | * @param strs éè¦æ£æ¥çå符串æ°ç» |
| | | * @return æ¯å¦å¹é
|
| | | */ |
| | | public static boolean matches(String str, List<String> strs) |
| | | { |
| | | if (isEmpty(str) || isEmpty(strs)) |
| | | { |
| | | return false; |
| | | } |
| | | for (String pattern : strs) |
| | | { |
| | | if (isMatch(pattern, str)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 夿urlæ¯å¦ä¸è§åé
ç½®: |
| | | * ? 表示å个å符; |
| | | * * 表示ä¸å±è·¯å¾å
çä»»æå符串ï¼ä¸å¯è·¨å±çº§; |
| | | * ** 表示任æå±è·¯å¾; |
| | | * |
| | | * @param pattern å¹é
è§å |
| | | * @param url éè¦å¹é
çurl |
| | | * @return |
| | | */ |
| | | public static boolean isMatch(String pattern, String url) |
| | | { |
| | | AntPathMatcher matcher = new AntPathMatcher(); |
| | | return matcher.match(pattern, url); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T cast(Object obj) |
| | | { |
| | | return (T) obj; |
| | | } |
| | | |
| | | /** |
| | | * æ°å左边补é½0ï¼ä½¿ä¹è¾¾å°æå®é¿åº¦ã注æï¼å¦ææ°å转æ¢ä¸ºå符串åï¼é¿åº¦å¤§äºsizeï¼ååªä¿ç æåsize个å符ã |
| | | * |
| | | * @param num æ°å对象 |
| | | * @param size å符串æå®é¿åº¦ |
| | | * @return è¿åæ°åçåç¬¦ä¸²æ ¼å¼ï¼è¯¥å符串为æå®é¿åº¦ã |
| | | */ |
| | | public static final String padl(final Number num, final int size) |
| | | { |
| | | return padl(num.toString(), size, '0'); |
| | | } |
| | | |
| | | /** |
| | | * å符串左补é½ã妿åå§å符串sé¿åº¦å¤§äºsizeï¼ååªä¿çæåsize个å符ã |
| | | * |
| | | * @param s åå§å符串 |
| | | * @param size å符串æå®é¿åº¦ |
| | | * @param c ç¨äºè¡¥é½çå符 |
| | | * @return è¿åæå®é¿åº¦çå符串ï¼ç±ååç¬¦ä¸²å·¦è¡¥é½ææªåå¾å°ã |
| | | */ |
| | | public static final String padl(final String s, final int size, final char c) |
| | | { |
| | | final StringBuilder sb = new StringBuilder(size); |
| | | if (s != null) |
| | | { |
| | | final int len = s.length(); |
| | | if (s.length() <= size) |
| | | { |
| | | for (int i = size - len; i > 0; i--) |
| | | { |
| | | sb.append(c); |
| | | } |
| | | sb.append(s); |
| | | } |
| | | else |
| | | { |
| | | return s.substring(len - size, len); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = size; i > 0; i--) |
| | | { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.util.concurrent.CancellationException; |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Future; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * 线ç¨ç¸å
³å·¥å
·ç±». |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Threads |
| | | { |
| | | private static final Logger logger = LoggerFactory.getLogger(Threads.class); |
| | | |
| | | /** |
| | | * sleepçå¾
,åä½ä¸ºæ¯«ç§ |
| | | */ |
| | | public static void sleep(long milliseconds) |
| | | { |
| | | try |
| | | { |
| | | Thread.sleep(milliseconds); |
| | | } |
| | | catch (InterruptedException e) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ¢çº¿ç¨æ± |
| | | * å
使ç¨shutdown, åæ¢æ¥æ¶æ°ä»»å¡å¹¶å°è¯å®æææå·²åå¨ä»»å¡. |
| | | * 妿è¶
æ¶, åè°ç¨shutdownNow, åæ¶å¨workQueueä¸Pendingçä»»å¡,并䏿ææé»å¡å½æ°. |
| | | * 妿ä»ç¶è¶
æï¼åå¼·å¶éåº. |
| | | * å¦å¯¹å¨shutdownæ¶çº¿ç¨æ¬èº«è¢«è°ç¨ä¸æåäºå¤ç. |
| | | */ |
| | | public static void shutdownAndAwaitTermination(ExecutorService pool) |
| | | { |
| | | if (pool != null && !pool.isShutdown()) |
| | | { |
| | | pool.shutdown(); |
| | | try |
| | | { |
| | | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) |
| | | { |
| | | pool.shutdownNow(); |
| | | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) |
| | | { |
| | | logger.info("Pool did not terminate"); |
| | | } |
| | | } |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | pool.shutdownNow(); |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå°çº¿ç¨å¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | public static void printException(Runnable r, Throwable t) |
| | | { |
| | | if (t == null && r instanceof Future<?>) |
| | | { |
| | | try |
| | | { |
| | | Future<?> future = (Future<?>) r; |
| | | if (future.isDone()) |
| | | { |
| | | future.get(); |
| | | } |
| | | } |
| | | catch (CancellationException ce) |
| | | { |
| | | t = ce; |
| | | } |
| | | catch (ExecutionException ee) |
| | | { |
| | | t = ee.getCause(); |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | if (t != null) |
| | | { |
| | | logger.error(t.getMessage(), t); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.bean; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * Bean å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BeanUtils extends org.springframework.beans.BeanUtils |
| | | { |
| | | /** Beanæ¹æ³åä¸å±æ§åå¼å§ç䏿 */ |
| | | private static final int BEAN_METHOD_PROP_INDEX = 3; |
| | | |
| | | /** * å¹é
getteræ¹æ³çæ£åè¡¨è¾¾å¼ */ |
| | | private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); |
| | | |
| | | /** * å¹é
setteræ¹æ³çæ£åè¡¨è¾¾å¼ */ |
| | | private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); |
| | | |
| | | /** |
| | | * Bean屿§å¤å¶å·¥å
·æ¹æ³ã |
| | | * |
| | | * @param dest ç®æ 对象 |
| | | * @param src æºå¯¹è±¡ |
| | | */ |
| | | public static void copyBeanProp(Object dest, Object src) |
| | | { |
| | | try |
| | | { |
| | | copyProperties(src, dest); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çsetteræ¹æ³ã |
| | | * |
| | | * @param obj 对象 |
| | | * @return 对象çsetteræ¹æ³å表 |
| | | */ |
| | | public static List<Method> getSetterMethods(Object obj) |
| | | { |
| | | // setteræ¹æ³å表 |
| | | List<Method> setterMethods = new ArrayList<Method>(); |
| | | |
| | | // è·åæææ¹æ³ |
| | | Method[] methods = obj.getClass().getMethods(); |
| | | |
| | | // æ¥æ¾setteræ¹æ³ |
| | | |
| | | for (Method method : methods) |
| | | { |
| | | Matcher m = SET_PATTERN.matcher(method.getName()); |
| | | if (m.matches() && (method.getParameterTypes().length == 1)) |
| | | { |
| | | setterMethods.add(method); |
| | | } |
| | | } |
| | | // è¿åsetteræ¹æ³å表 |
| | | return setterMethods; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çgetteræ¹æ³ã |
| | | * |
| | | * @param obj 对象 |
| | | * @return 对象çgetteræ¹æ³å表 |
| | | */ |
| | | |
| | | public static List<Method> getGetterMethods(Object obj) |
| | | { |
| | | // getteræ¹æ³å表 |
| | | List<Method> getterMethods = new ArrayList<Method>(); |
| | | // è·åæææ¹æ³ |
| | | Method[] methods = obj.getClass().getMethods(); |
| | | // æ¥æ¾getteræ¹æ³ |
| | | for (Method method : methods) |
| | | { |
| | | Matcher m = GET_PATTERN.matcher(method.getName()); |
| | | if (m.matches() && (method.getParameterTypes().length == 0)) |
| | | { |
| | | getterMethods.add(method); |
| | | } |
| | | } |
| | | // è¿ågetteræ¹æ³å表 |
| | | return getterMethods; |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥Beanæ¹æ³åä¸ç屿§åæ¯å¦ç¸çã<br> |
| | | * å¦getName()åsetName()屿§å䏿 ·ï¼getName()åsetAge()屿§åä¸ä¸æ ·ã |
| | | * |
| | | * @param m1 æ¹æ³å1 |
| | | * @param m2 æ¹æ³å2 |
| | | * @return 屿§å䏿 ·è¿åtrueï¼å¦åè¿åfalse |
| | | */ |
| | | |
| | | public static boolean isMethodPropEquals(String m1, String m2) |
| | | { |
| | | return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.bean; |
| | | |
| | | import java.util.Set; |
| | | import jakarta.validation.ConstraintViolation; |
| | | import jakarta.validation.ConstraintViolationException; |
| | | import jakarta.validation.Validator; |
| | | |
| | | /** |
| | | * beanå¯¹è±¡å±æ§éªè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BeanValidators |
| | | { |
| | | public static void validateWithException(Validator validator, Object object, Class<?>... groups) |
| | | throws ConstraintViolationException |
| | | { |
| | | Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups); |
| | | if (!constraintViolations.isEmpty()) |
| | | { |
| | | throw new ConstraintViolationException(constraintViolations); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.file; |
| | | |
| | | import java.io.File; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * æä»¶ç±»åå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileTypeUtils |
| | | { |
| | | /** |
| | | * è·åæä»¶ç±»å |
| | | * <p> |
| | | * ä¾å¦: ruoyi.txt, è¿å: txt |
| | | * |
| | | * @param file æä»¶å |
| | | * @return åç¼ï¼ä¸å«".") |
| | | */ |
| | | public static String getFileType(File file) |
| | | { |
| | | if (null == file) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | return getFileType(file.getName()); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶ç±»å |
| | | * <p> |
| | | * ä¾å¦: ruoyi.txt, è¿å: txt |
| | | * |
| | | * @param fileName æä»¶å |
| | | * @return åç¼ï¼ä¸å«".") |
| | | */ |
| | | public static String getFileType(String fileName) |
| | | { |
| | | int separatorIndex = fileName.lastIndexOf("."); |
| | | if (separatorIndex < 0) |
| | | { |
| | | return ""; |
| | | } |
| | | return fileName.substring(separatorIndex + 1).toLowerCase(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶ç±»å |
| | | * |
| | | * @param photoByte æä»¶åèç |
| | | * @return åç¼ï¼ä¸å«".") |
| | | */ |
| | | public static String getFileExtendName(byte[] photoByte) |
| | | { |
| | | String strFileExtendName = "JPG"; |
| | | if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) |
| | | && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) |
| | | { |
| | | strFileExtendName = "GIF"; |
| | | } |
| | | else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) |
| | | { |
| | | strFileExtendName = "JPG"; |
| | | } |
| | | else if ((photoByte[0] == 66) && (photoByte[1] == 77)) |
| | | { |
| | | strFileExtendName = "BMP"; |
| | | } |
| | | else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) |
| | | { |
| | | strFileExtendName = "PNG"; |
| | | } |
| | | return strFileExtendName; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.file; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.file.Paths; |
| | | import java.util.Objects; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; |
| | | import com.ruoyi.common.exception.file.FileSizeLimitExceededException; |
| | | import com.ruoyi.common.exception.file.InvalidExtensionException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.utils.uuid.Seq; |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileUploadUtils |
| | | { |
| | | /** |
| | | * é»è®¤å¤§å° 50M |
| | | */ |
| | | public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; |
| | | |
| | | /** |
| | | * é»è®¤çæä»¶åæå¤§é¿åº¦ 100 |
| | | */ |
| | | public static final int DEFAULT_FILE_NAME_LENGTH = 100; |
| | | |
| | | /** |
| | | * é»è®¤ä¸ä¼ çå°å |
| | | */ |
| | | private static String defaultBaseDir = RuoYiConfig.getProfile(); |
| | | |
| | | public static void setDefaultBaseDir(String defaultBaseDir) |
| | | { |
| | | FileUploadUtils.defaultBaseDir = defaultBaseDir; |
| | | } |
| | | |
| | | public static String getDefaultBaseDir() |
| | | { |
| | | return defaultBaseDir; |
| | | } |
| | | |
| | | /** |
| | | * 以é»è®¤é
ç½®è¿è¡æä»¶ä¸ä¼ |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return æä»¶åç§° |
| | | * @throws Exception |
| | | */ |
| | | public static final String upload(MultipartFile file) throws IOException |
| | | { |
| | | try |
| | | { |
| | | return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new IOException(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æä»¶è·¯å¾ä¸ä¼ |
| | | * |
| | | * @param baseDir ç¸å¯¹åºç¨çåºç®å½ |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return æä»¶åç§° |
| | | * @throws IOException |
| | | */ |
| | | public static final String upload(String baseDir, MultipartFile file) throws IOException |
| | | { |
| | | try |
| | | { |
| | | return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new IOException(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ |
| | | * |
| | | * @param baseDir ç¸å¯¹åºç¨çåºç®å½ |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @param allowedExtension ä¸ä¼ æä»¶ç±»å |
| | | * @return è¿åä¸ä¼ æåçæä»¶å |
| | | * @throws FileSizeLimitExceededException 妿è¶
åºæå¤§å¤§å° |
| | | * @throws FileNameLengthLimitExceededException æä»¶åå¤ªé¿ |
| | | * @throws IOException æ¯å¦è¯»åæä»¶åºéæ¶ |
| | | * @throws InvalidExtensionException æä»¶æ ¡éªå¼å¸¸ |
| | | */ |
| | | public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) |
| | | throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, |
| | | InvalidExtensionException |
| | | { |
| | | return upload(baseDir, file, allowedExtension, false); |
| | | } |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ |
| | | * |
| | | * @param baseDir ç¸å¯¹åºç¨çåºç®å½ |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @param useCustomNaming ç³»ç»èªå®ä¹æä»¶å |
| | | * @param allowedExtension ä¸ä¼ æä»¶ç±»å |
| | | * @return è¿åä¸ä¼ æåçæä»¶å |
| | | * @throws FileSizeLimitExceededException 妿è¶
åºæå¤§å¤§å° |
| | | * @throws FileNameLengthLimitExceededException æä»¶åå¤ªé¿ |
| | | * @throws IOException æ¯å¦è¯»åæä»¶åºéæ¶ |
| | | * @throws InvalidExtensionException æä»¶æ ¡éªå¼å¸¸ |
| | | */ |
| | | public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension, boolean useCustomNaming) |
| | | throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, |
| | | InvalidExtensionException |
| | | { |
| | | int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length(); |
| | | if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) |
| | | { |
| | | throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); |
| | | } |
| | | |
| | | assertAllowed(file, allowedExtension); |
| | | |
| | | String fileName = useCustomNaming ? uuidFilename(file) : extractFilename(file); |
| | | |
| | | String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); |
| | | file.transferTo(Paths.get(absPath)); |
| | | return getPathFileName(baseDir, fileName); |
| | | } |
| | | |
| | | /** |
| | | * ç¼ç æä»¶å(æ¥ææ ¼å¼ç®å½ + åæä»¶å + åºåå¼ + åç¼) |
| | | */ |
| | | public static final String extractFilename(MultipartFile file) |
| | | { |
| | | return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); |
| | | } |
| | | |
| | | /** |
| | | * ç¼ç¼ç æä»¶å(æ¥ææ ¼å¼ç®å½ + UUID + åç¼) |
| | | */ |
| | | public static final String uuidFilename(MultipartFile file) |
| | | { |
| | | return StringUtils.format("{}/{}.{}", DateUtils.datePath(), IdUtils.fastSimpleUUID(), getExtension(file)); |
| | | } |
| | | |
| | | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException |
| | | { |
| | | File desc = new File(uploadDir + File.separator + fileName); |
| | | |
| | | if (!desc.exists()) |
| | | { |
| | | if (!desc.getParentFile().exists()) |
| | | { |
| | | desc.getParentFile().mkdirs(); |
| | | } |
| | | } |
| | | return desc; |
| | | } |
| | | |
| | | public static final String getPathFileName(String uploadDir, String fileName) throws IOException |
| | | { |
| | | int dirLastIndex = RuoYiConfig.getProfile().length() + 1; |
| | | String currentDir = StringUtils.substring(uploadDir, dirLastIndex); |
| | | return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; |
| | | } |
| | | |
| | | /** |
| | | * æä»¶å¤§å°æ ¡éª |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return |
| | | * @throws FileSizeLimitExceededException 妿è¶
åºæå¤§å¤§å° |
| | | * @throws InvalidExtensionException |
| | | */ |
| | | public static final void assertAllowed(MultipartFile file, String[] allowedExtension) |
| | | throws FileSizeLimitExceededException, InvalidExtensionException |
| | | { |
| | | long size = file.getSize(); |
| | | if (size > DEFAULT_MAX_SIZE) |
| | | { |
| | | throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); |
| | | } |
| | | |
| | | String fileName = file.getOriginalFilename(); |
| | | String extension = getExtension(file); |
| | | if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) |
| | | { |
| | | if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else |
| | | { |
| | | throw new InvalidExtensionException(allowedExtension, extension, fileName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 夿MIMEç±»åæ¯å¦æ¯å
许çMIMEç±»å |
| | | * |
| | | * @param extension |
| | | * @param allowedExtension |
| | | * @return |
| | | */ |
| | | public static final boolean isAllowedExtension(String extension, String[] allowedExtension) |
| | | { |
| | | for (String str : allowedExtension) |
| | | { |
| | | if (str.equalsIgnoreCase(extension)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶åçåç¼ |
| | | * |
| | | * @param file 表åæä»¶ |
| | | * @return åç¼å |
| | | */ |
| | | public static final String getExtension(MultipartFile file) |
| | | { |
| | | String extension = FilenameUtils.getExtension(file.getOriginalFilename()); |
| | | if (StringUtils.isEmpty(extension)) |
| | | { |
| | | extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType())); |
| | | } |
| | | return extension; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.file; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | |
| | | /** |
| | | * æä»¶å¤çå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileUtils |
| | | { |
| | | public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; |
| | | |
| | | /** |
| | | * è¾åºæå®æä»¶çbyteæ°ç» |
| | | * |
| | | * @param filePath æä»¶è·¯å¾ |
| | | * @param os è¾åºæµ |
| | | * @return |
| | | */ |
| | | public static void writeBytes(String filePath, OutputStream os) throws IOException |
| | | { |
| | | FileInputStream fis = null; |
| | | try |
| | | { |
| | | File file = new File(filePath); |
| | | if (!file.exists()) |
| | | { |
| | | throw new FileNotFoundException(filePath); |
| | | } |
| | | fis = new FileInputStream(file); |
| | | byte[] b = new byte[1024]; |
| | | int length; |
| | | while ((length = fis.read(b)) > 0) |
| | | { |
| | | os.write(b, 0, length); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | throw e; |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.close(os); |
| | | IOUtils.close(fis); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ°æ®å°æä»¶ä¸ |
| | | * |
| | | * @param data æ°æ® |
| | | * @return ç®æ æä»¶ |
| | | * @throws IOException IOå¼å¸¸ |
| | | */ |
| | | public static String writeImportBytes(byte[] data) throws IOException |
| | | { |
| | | return writeBytes(data, RuoYiConfig.getImportPath()); |
| | | } |
| | | |
| | | /** |
| | | * åæ°æ®å°æä»¶ä¸ |
| | | * |
| | | * @param data æ°æ® |
| | | * @param uploadDir ç®æ æä»¶ |
| | | * @return ç®æ æä»¶ |
| | | * @throws IOException IOå¼å¸¸ |
| | | */ |
| | | public static String writeBytes(byte[] data, String uploadDir) throws IOException |
| | | { |
| | | FileOutputStream fos = null; |
| | | String pathName = ""; |
| | | try |
| | | { |
| | | String extension = getFileExtendName(data); |
| | | pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; |
| | | File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName); |
| | | fos = new FileOutputStream(file); |
| | | fos.write(data); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.close(fos); |
| | | } |
| | | return FileUploadUtils.getPathFileName(uploadDir, pathName); |
| | | } |
| | | |
| | | /** |
| | | * ç§»é¤è·¯å¾ä¸ç请æ±åç¼ç段 |
| | | * |
| | | * @param filePath æä»¶è·¯å¾ |
| | | * @return ç§»é¤åçæä»¶è·¯å¾ |
| | | */ |
| | | public static String stripPrefix(String filePath) |
| | | { |
| | | return StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX); |
| | | } |
| | | |
| | | /** |
| | | * å 餿件 |
| | | * |
| | | * @param filePath æä»¶ |
| | | * @return |
| | | */ |
| | | public static boolean deleteFile(String filePath) |
| | | { |
| | | boolean flag = false; |
| | | File file = new File(filePath); |
| | | // è·¯å¾ä¸ºæä»¶ä¸ä¸ä¸ºç©ºåè¿è¡å é¤ |
| | | if (file.isFile() && file.exists()) |
| | | { |
| | | flag = file.delete(); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * æä»¶åç§°éªè¯ |
| | | * |
| | | * @param filename æä»¶åç§° |
| | | * @return true æ£å¸¸ false éæ³ |
| | | */ |
| | | public static boolean isValidFilename(String filename) |
| | | { |
| | | return filename.matches(FILENAME_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥æä»¶æ¯å¦å¯ä¸è½½ |
| | | * |
| | | * @param resource éè¦ä¸è½½çæä»¶ |
| | | * @return true æ£å¸¸ false éæ³ |
| | | */ |
| | | public static boolean checkAllowDownload(String resource) |
| | | { |
| | | // ç¦æ¢ç®å½ä¸è·³çº§å« |
| | | if (StringUtils.contains(resource, "..")) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | // æ£æ¥å
许ä¸è½½çæä»¶è§å |
| | | if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | // ä¸å¨å
许ä¸è½½çæä»¶è§å |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æä»¶åéæ°ç¼ç |
| | | * |
| | | * @param request 请æ±å¯¹è±¡ |
| | | * @param fileName æä»¶å |
| | | * @return ç¼ç åçæä»¶å |
| | | */ |
| | | public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException |
| | | { |
| | | final String agent = request.getHeader("USER-AGENT"); |
| | | String filename = fileName; |
| | | if (agent.contains("MSIE")) |
| | | { |
| | | // IEæµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | filename = filename.replace("+", " "); |
| | | } |
| | | else if (agent.contains("Firefox")) |
| | | { |
| | | // ç«çæµè§å¨ |
| | | filename = new String(fileName.getBytes(), "ISO8859-1"); |
| | | } |
| | | else if (agent.contains("Chrome")) |
| | | { |
| | | // googleæµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | } |
| | | else |
| | | { |
| | | // å
¶å®æµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | } |
| | | return filename; |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æä»¶åéæ°ç¼ç |
| | | * |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param realFileName ç宿件å |
| | | */ |
| | | public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException |
| | | { |
| | | String percentEncodedFileName = percentEncode(realFileName); |
| | | |
| | | StringBuilder contentDispositionValue = new StringBuilder(); |
| | | contentDispositionValue.append("attachment; filename=") |
| | | .append(percentEncodedFileName) |
| | | .append(";") |
| | | .append("filename*=") |
| | | .append("utf-8''") |
| | | .append(percentEncodedFileName); |
| | | |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); |
| | | response.setHeader("Content-disposition", contentDispositionValue.toString()); |
| | | response.setHeader("download-filename", percentEncodedFileName); |
| | | } |
| | | |
| | | /** |
| | | * ç¾åå·ç¼ç å·¥å
·æ¹æ³ |
| | | * |
| | | * @param s éè¦ç¾åå·ç¼ç çå符串 |
| | | * @return ç¾åå·ç¼ç åçå符串 |
| | | */ |
| | | public static String percentEncode(String s) throws UnsupportedEncodingException |
| | | { |
| | | String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); |
| | | return encode.replaceAll("\\+", "%20"); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¾ååç¼ |
| | | * |
| | | * @param photoByte å¾åæ°æ® |
| | | * @return åç¼å |
| | | */ |
| | | public static String getFileExtendName(byte[] photoByte) |
| | | { |
| | | String strFileExtendName = "jpg"; |
| | | if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) |
| | | && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) |
| | | { |
| | | strFileExtendName = "gif"; |
| | | } |
| | | else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) |
| | | { |
| | | strFileExtendName = "jpg"; |
| | | } |
| | | else if ((photoByte[0] == 66) && (photoByte[1] == 77)) |
| | | { |
| | | strFileExtendName = "bmp"; |
| | | } |
| | | else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) |
| | | { |
| | | strFileExtendName = "png"; |
| | | } |
| | | return strFileExtendName; |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶åç§° /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png |
| | | * |
| | | * @param fileName è·¯å¾åç§° |
| | | * @return 没ææä»¶è·¯å¾çåç§° |
| | | */ |
| | | public static String getName(String fileName) |
| | | { |
| | | if (fileName == null) |
| | | { |
| | | return null; |
| | | } |
| | | int lastUnixPos = fileName.lastIndexOf('/'); |
| | | int lastWindowsPos = fileName.lastIndexOf('\\'); |
| | | int index = Math.max(lastUnixPos, lastWindowsPos); |
| | | return fileName.substring(index + 1); |
| | | } |
| | | |
| | | /** |
| | | * è·åä¸å¸¦åç¼æä»¶åç§° /profile/upload/2022/04/16/ruoyi.png -- ruoyi |
| | | * |
| | | * @param fileName è·¯å¾åç§° |
| | | * @return 没ææä»¶è·¯å¾ååç¼çåç§° |
| | | */ |
| | | public static String getNameNotSuffix(String fileName) |
| | | { |
| | | if (fileName == null) |
| | | { |
| | | return null; |
| | | } |
| | | String baseName = FilenameUtils.getBaseName(fileName); |
| | | return baseName; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.file; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.Arrays; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * å¾çå¤çå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ImageUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ImageUtils.class); |
| | | |
| | | public static byte[] getImage(String imagePath) |
| | | { |
| | | InputStream is = getFile(imagePath); |
| | | try |
| | | { |
| | | return IOUtils.toByteArray(is); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("å¾çå è½½å¼å¸¸ {}", e); |
| | | return null; |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(is); |
| | | } |
| | | } |
| | | |
| | | public static InputStream getFile(String imagePath) |
| | | { |
| | | try |
| | | { |
| | | byte[] result = readFile(imagePath); |
| | | result = Arrays.copyOf(result, result.length); |
| | | return new ByteArrayInputStream(result); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è·åå¾çå¼å¸¸ {}", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 读åæä»¶ä¸ºåèæ°æ® |
| | | * |
| | | * @param url å°å |
| | | * @return åèæ°æ® |
| | | */ |
| | | public static byte[] readFile(String url) |
| | | { |
| | | InputStream in = null; |
| | | try |
| | | { |
| | | if (url.startsWith("http")) |
| | | { |
| | | // ç½ç»å°å |
| | | URL urlObj = new URL(url); |
| | | URLConnection urlConnection = urlObj.openConnection(); |
| | | urlConnection.setConnectTimeout(30 * 1000); |
| | | urlConnection.setReadTimeout(60 * 1000); |
| | | urlConnection.setDoInput(true); |
| | | in = urlConnection.getInputStream(); |
| | | } |
| | | else |
| | | { |
| | | // æ¬æºå°å |
| | | String localPath = RuoYiConfig.getProfile(); |
| | | String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX); |
| | | in = new FileInputStream(downloadPath); |
| | | } |
| | | return IOUtils.toByteArray(in); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è·åæä»¶è·¯å¾å¼å¸¸ {}", e); |
| | | return null; |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(in); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.file; |
| | | |
| | | /** |
| | | * åªä½ç±»åå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MimeTypeUtils |
| | | { |
| | | public static final String IMAGE_PNG = "image/png"; |
| | | |
| | | public static final String IMAGE_JPG = "image/jpg"; |
| | | |
| | | public static final String IMAGE_JPEG = "image/jpeg"; |
| | | |
| | | public static final String IMAGE_BMP = "image/bmp"; |
| | | |
| | | public static final String IMAGE_GIF = "image/gif"; |
| | | |
| | | public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; |
| | | |
| | | public static final String[] FLASH_EXTENSION = { "swf", "flv" }; |
| | | |
| | | public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", |
| | | "asf", "rm", "rmvb" }; |
| | | |
| | | public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; |
| | | |
| | | public static final String[] DEFAULT_ALLOWED_EXTENSION = { |
| | | // å¾ç |
| | | "bmp", "gif", "jpg", "jpeg", "png", |
| | | // word excelï¼è±åå导å
¥/导åºéè¦ï¼ |
| | | "doc", "docx", "xls", "xlsx", "txt", |
| | | // pdfï¼ä¸æ¹åè®®/ç¥æ
ä¹¦æ«æä»¶ï¼ |
| | | "pdf" }; |
| | | |
| | | public static String getExtension(String prefix) |
| | | { |
| | | switch (prefix) |
| | | { |
| | | case IMAGE_PNG: |
| | | return "png"; |
| | | case IMAGE_JPG: |
| | | return "jpg"; |
| | | case IMAGE_JPEG: |
| | | return "jpeg"; |
| | | case IMAGE_BMP: |
| | | return "bmp"; |
| | | case IMAGE_GIF: |
| | | return "gif"; |
| | | default: |
| | | return ""; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.html; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 转ä¹åå转ä¹å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class EscapeUtil |
| | | { |
| | | public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; |
| | | |
| | | private static final char[][] TEXT = new char[64][]; |
| | | |
| | | static |
| | | { |
| | | for (int i = 0; i < 64; i++) |
| | | { |
| | | TEXT[i] = new char[] { (char) i }; |
| | | } |
| | | |
| | | // special HTML characters |
| | | TEXT['\''] = "'".toCharArray(); // åå¼å· |
| | | TEXT['"'] = """.toCharArray(); // åå¼å· |
| | | TEXT['&'] = "&".toCharArray(); // &符 |
| | | TEXT['<'] = "<".toCharArray(); // å°äºå· |
| | | TEXT['>'] = ">".toCharArray(); // 大äºå· |
| | | } |
| | | |
| | | /** |
| | | * è½¬ä¹ææ¬ä¸çHTMLå符为å®å
¨çå符 |
| | | * |
| | | * @param text 被转ä¹çææ¬ |
| | | * @return 转ä¹åçææ¬ |
| | | */ |
| | | public static String escape(String text) |
| | | { |
| | | return encode(text); |
| | | } |
| | | |
| | | /** |
| | | * è¿å被转ä¹çHTMLç¹æ®å符 |
| | | * |
| | | * @param content å
å«è½¬ä¹ç¬¦çHTMLå
容 |
| | | * @return 转æ¢åçå符串 |
| | | */ |
| | | public static String unescape(String content) |
| | | { |
| | | return decode(content); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
餿æHTMLæ ç¾ï¼ä½æ¯ä¸å 餿 ç¾å
çå
容 |
| | | * |
| | | * @param content ææ¬ |
| | | * @return æ¸
餿 ç¾åçææ¬ |
| | | */ |
| | | public static String clean(String content) |
| | | { |
| | | return new HTMLFilter().filter(content); |
| | | } |
| | | |
| | | /** |
| | | * Escapeç¼ç |
| | | * |
| | | * @param text 被ç¼ç çææ¬ |
| | | * @return ç¼ç åçå符 |
| | | */ |
| | | private static String encode(String text) |
| | | { |
| | | if (StringUtils.isEmpty(text)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | final StringBuilder tmp = new StringBuilder(text.length() * 6); |
| | | char c; |
| | | for (int i = 0; i < text.length(); i++) |
| | | { |
| | | c = text.charAt(i); |
| | | if (c < 256) |
| | | { |
| | | tmp.append("%"); |
| | | if (c < 16) |
| | | { |
| | | tmp.append("0"); |
| | | } |
| | | tmp.append(Integer.toString(c, 16)); |
| | | } |
| | | else |
| | | { |
| | | tmp.append("%u"); |
| | | if (c <= 0xfff) |
| | | { |
| | | // issue#I49JU8@Gitee |
| | | tmp.append("0"); |
| | | } |
| | | tmp.append(Integer.toString(c, 16)); |
| | | } |
| | | } |
| | | return tmp.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Escapeè§£ç |
| | | * |
| | | * @param content 被转ä¹çå
容 |
| | | * @return è§£ç åçå符串 |
| | | */ |
| | | public static String decode(String content) |
| | | { |
| | | if (StringUtils.isEmpty(content)) |
| | | { |
| | | return content; |
| | | } |
| | | |
| | | StringBuilder tmp = new StringBuilder(content.length()); |
| | | int lastPos = 0, pos = 0; |
| | | char ch; |
| | | while (lastPos < content.length()) |
| | | { |
| | | pos = content.indexOf("%", lastPos); |
| | | if (pos == lastPos) |
| | | { |
| | | if (content.charAt(pos + 1) == 'u') |
| | | { |
| | | ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); |
| | | tmp.append(ch); |
| | | lastPos = pos + 6; |
| | | } |
| | | else |
| | | { |
| | | ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); |
| | | tmp.append(ch); |
| | | lastPos = pos + 3; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (pos == -1) |
| | | { |
| | | tmp.append(content.substring(lastPos)); |
| | | lastPos = content.length(); |
| | | } |
| | | else |
| | | { |
| | | tmp.append(content.substring(lastPos, pos)); |
| | | lastPos = pos; |
| | | } |
| | | } |
| | | } |
| | | return tmp.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) |
| | | { |
| | | String html = "<script>alert(1);</script>"; |
| | | String escape = EscapeUtil.escape(html); |
| | | // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; |
| | | // String html = "<123"; |
| | | // String html = "123>"; |
| | | System.out.println("clean: " + EscapeUtil.clean(html)); |
| | | System.out.println("escape: " + escape); |
| | | System.out.println("unescape: " + EscapeUtil.unescape(escape)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.html; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentMap; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * HTMLè¿æ»¤å¨ï¼ç¨äºå»é¤XSSæ¼æ´éæ£ã |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public final class HTMLFilter |
| | | { |
| | | /** |
| | | * regex flag union representing /si modifiers in php |
| | | **/ |
| | | private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; |
| | | private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL); |
| | | private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); |
| | | private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); |
| | | private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); |
| | | private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); |
| | | private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); |
| | | private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); |
| | | private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); |
| | | private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); |
| | | private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); |
| | | private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); |
| | | private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); |
| | | private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); |
| | | private static final Pattern P_END_ARROW = Pattern.compile("^>"); |
| | | private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); |
| | | private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); |
| | | private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); |
| | | private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); |
| | | private static final Pattern P_AMP = Pattern.compile("&"); |
| | | private static final Pattern P_QUOTE = Pattern.compile("\""); |
| | | private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); |
| | | private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); |
| | | private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); |
| | | |
| | | // @xxx could grow large... maybe use sesat's ReferenceMap |
| | | private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); |
| | | private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * set of allowed html elements, along with allowed attributes for each element |
| | | **/ |
| | | private final Map<String, List<String>> vAllowed; |
| | | /** |
| | | * counts of open tags for each (allowable) html element |
| | | **/ |
| | | private final Map<String, Integer> vTagCounts = new HashMap<>(); |
| | | |
| | | /** |
| | | * html elements which must always be self-closing (e.g. "<img />") |
| | | **/ |
| | | private final String[] vSelfClosingTags; |
| | | /** |
| | | * html elements which must always have separate opening and closing tags (e.g. "<b></b>") |
| | | **/ |
| | | private final String[] vNeedClosingTags; |
| | | /** |
| | | * set of disallowed html elements |
| | | **/ |
| | | private final String[] vDisallowed; |
| | | /** |
| | | * attributes which should be checked for valid protocols |
| | | **/ |
| | | private final String[] vProtocolAtts; |
| | | /** |
| | | * allowed protocols |
| | | **/ |
| | | private final String[] vAllowedProtocols; |
| | | /** |
| | | * tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") |
| | | **/ |
| | | private final String[] vRemoveBlanks; |
| | | /** |
| | | * entities allowed within html markup |
| | | **/ |
| | | private final String[] vAllowedEntities; |
| | | /** |
| | | * flag determining whether comments are allowed in input String. |
| | | */ |
| | | private final boolean stripComment; |
| | | private final boolean encodeQuotes; |
| | | /** |
| | | * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "<b text </b>" |
| | | * becomes "<b> text </b>"). If set to false, unbalanced angle brackets will be html escaped. |
| | | */ |
| | | private final boolean alwaysMakeTags; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | public HTMLFilter() |
| | | { |
| | | vAllowed = new HashMap<>(); |
| | | |
| | | final ArrayList<String> a_atts = new ArrayList<>(); |
| | | a_atts.add("href"); |
| | | a_atts.add("target"); |
| | | vAllowed.put("a", a_atts); |
| | | |
| | | final ArrayList<String> img_atts = new ArrayList<>(); |
| | | img_atts.add("src"); |
| | | img_atts.add("width"); |
| | | img_atts.add("height"); |
| | | img_atts.add("alt"); |
| | | vAllowed.put("img", img_atts); |
| | | |
| | | final ArrayList<String> no_atts = new ArrayList<>(); |
| | | vAllowed.put("b", no_atts); |
| | | vAllowed.put("strong", no_atts); |
| | | vAllowed.put("i", no_atts); |
| | | vAllowed.put("em", no_atts); |
| | | |
| | | vSelfClosingTags = new String[] { "img" }; |
| | | vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; |
| | | vDisallowed = new String[] {}; |
| | | vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. |
| | | vProtocolAtts = new String[] { "src", "href" }; |
| | | vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; |
| | | vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; |
| | | stripComment = true; |
| | | encodeQuotes = true; |
| | | alwaysMakeTags = false; |
| | | } |
| | | |
| | | /** |
| | | * Map-parameter configurable constructor. |
| | | * |
| | | * @param conf map containing configuration. keys match field names. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public HTMLFilter(final Map<String, Object> conf) |
| | | { |
| | | |
| | | assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; |
| | | assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; |
| | | assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; |
| | | assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; |
| | | assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; |
| | | assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; |
| | | assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; |
| | | assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; |
| | | |
| | | vAllowed = Collections.unmodifiableMap((HashMap<String, List<String>>) conf.get("vAllowed")); |
| | | vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); |
| | | vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); |
| | | vDisallowed = (String[]) conf.get("vDisallowed"); |
| | | vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); |
| | | vProtocolAtts = (String[]) conf.get("vProtocolAtts"); |
| | | vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); |
| | | vAllowedEntities = (String[]) conf.get("vAllowedEntities"); |
| | | stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; |
| | | encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; |
| | | alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; |
| | | } |
| | | |
| | | private void reset() |
| | | { |
| | | vTagCounts.clear(); |
| | | } |
| | | |
| | | // --------------------------------------------------------------- |
| | | // my versions of some PHP library functions |
| | | public static String chr(final int decimal) |
| | | { |
| | | return String.valueOf((char) decimal); |
| | | } |
| | | |
| | | public static String htmlSpecialChars(final String s) |
| | | { |
| | | String result = s; |
| | | result = regexReplace(P_AMP, "&", result); |
| | | result = regexReplace(P_QUOTE, """, result); |
| | | result = regexReplace(P_LEFT_ARROW, "<", result); |
| | | result = regexReplace(P_RIGHT_ARROW, ">", result); |
| | | return result; |
| | | } |
| | | |
| | | // --------------------------------------------------------------- |
| | | |
| | | /** |
| | | * given a user submitted input String, filter out any invalid or restricted html. |
| | | * |
| | | * @param input text (i.e. submitted by a user) than may contain html |
| | | * @return "clean" version of input, with only valid, whitelisted html elements allowed |
| | | */ |
| | | public String filter(final String input) |
| | | { |
| | | reset(); |
| | | String s = input; |
| | | |
| | | s = escapeComments(s); |
| | | |
| | | s = balanceHTML(s); |
| | | |
| | | s = checkTags(s); |
| | | |
| | | s = processRemoveBlanks(s); |
| | | |
| | | // s = validateEntities(s); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | public boolean isAlwaysMakeTags() |
| | | { |
| | | return alwaysMakeTags; |
| | | } |
| | | |
| | | public boolean isStripComments() |
| | | { |
| | | return stripComment; |
| | | } |
| | | |
| | | private String escapeComments(final String s) |
| | | { |
| | | final Matcher m = P_COMMENTS.matcher(s); |
| | | final StringBuffer buf = new StringBuffer(); |
| | | if (m.find()) |
| | | { |
| | | final String match = m.group(1); // (.*?) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->")); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | return buf.toString(); |
| | | } |
| | | |
| | | private String balanceHTML(String s) |
| | | { |
| | | if (alwaysMakeTags) |
| | | { |
| | | // |
| | | // try and form html |
| | | // |
| | | s = regexReplace(P_END_ARROW, "", s); |
| | | // ä¸è¿½å ç»ææ ç¾ |
| | | s = regexReplace(P_BODY_TO_END, "<$1>", s); |
| | | s = regexReplace(P_XML_CONTENT, "$1<$2", s); |
| | | |
| | | } |
| | | else |
| | | { |
| | | // |
| | | // escape stray brackets |
| | | // |
| | | s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); |
| | | s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); |
| | | |
| | | // |
| | | // the last regexp causes '<>' entities to appear |
| | | // (we need to do a lookahead assertion so that the last bracket can |
| | | // be used in the next pass of the regexp) |
| | | // |
| | | s = regexReplace(P_BOTH_ARROWS, "", s); |
| | | } |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String checkTags(String s) |
| | | { |
| | | Matcher m = P_TAGS.matcher(s); |
| | | |
| | | final StringBuffer buf = new StringBuffer(); |
| | | while (m.find()) |
| | | { |
| | | String replaceStr = m.group(1); |
| | | replaceStr = processTag(replaceStr); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | // these get tallied in processTag |
| | | // (remember to reset before subsequent calls to filter method) |
| | | final StringBuilder sBuilder = new StringBuilder(buf.toString()); |
| | | for (String key : vTagCounts.keySet()) |
| | | { |
| | | for (int ii = 0; ii < vTagCounts.get(key); ii++) |
| | | { |
| | | sBuilder.append("</").append(key).append(">"); |
| | | } |
| | | } |
| | | s = sBuilder.toString(); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String processRemoveBlanks(final String s) |
| | | { |
| | | String result = s; |
| | | for (String tag : vRemoveBlanks) |
| | | { |
| | | if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) |
| | | { |
| | | P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">")); |
| | | } |
| | | result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); |
| | | if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) |
| | | { |
| | | P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); |
| | | } |
| | | result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) |
| | | { |
| | | Matcher m = regex_pattern.matcher(s); |
| | | return m.replaceAll(replacement); |
| | | } |
| | | |
| | | private String processTag(final String s) |
| | | { |
| | | // ending tags |
| | | Matcher m = P_END_TAG.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String name = m.group(1).toLowerCase(); |
| | | if (allowed(name)) |
| | | { |
| | | if (!inArray(name, vSelfClosingTags)) |
| | | { |
| | | if (vTagCounts.containsKey(name)) |
| | | { |
| | | vTagCounts.put(name, vTagCounts.get(name) - 1); |
| | | return "</" + name + ">"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // starting tags |
| | | m = P_START_TAG.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String name = m.group(1).toLowerCase(); |
| | | final String body = m.group(2); |
| | | String ending = m.group(3); |
| | | |
| | | // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); |
| | | if (allowed(name)) |
| | | { |
| | | final StringBuilder params = new StringBuilder(); |
| | | |
| | | final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); |
| | | final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); |
| | | final List<String> paramNames = new ArrayList<>(); |
| | | final List<String> paramValues = new ArrayList<>(); |
| | | while (m2.find()) |
| | | { |
| | | paramNames.add(m2.group(1)); // ([a-z0-9]+) |
| | | paramValues.add(m2.group(3)); // (.*?) |
| | | } |
| | | while (m3.find()) |
| | | { |
| | | paramNames.add(m3.group(1)); // ([a-z0-9]+) |
| | | paramValues.add(m3.group(3)); // ([^\"\\s']+) |
| | | } |
| | | |
| | | String paramName, paramValue; |
| | | for (int ii = 0; ii < paramNames.size(); ii++) |
| | | { |
| | | paramName = paramNames.get(ii).toLowerCase(); |
| | | paramValue = paramValues.get(ii); |
| | | |
| | | // debug( "paramName='" + paramName + "'" ); |
| | | // debug( "paramValue='" + paramValue + "'" ); |
| | | // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); |
| | | |
| | | if (allowedAttribute(name, paramName)) |
| | | { |
| | | if (inArray(paramName, vProtocolAtts)) |
| | | { |
| | | paramValue = processParamProtocol(paramValue); |
| | | } |
| | | params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\\\""); |
| | | } |
| | | } |
| | | |
| | | if (inArray(name, vSelfClosingTags)) |
| | | { |
| | | ending = " /"; |
| | | } |
| | | |
| | | if (inArray(name, vNeedClosingTags)) |
| | | { |
| | | ending = ""; |
| | | } |
| | | |
| | | if (ending == null || ending.length() < 1) |
| | | { |
| | | if (vTagCounts.containsKey(name)) |
| | | { |
| | | vTagCounts.put(name, vTagCounts.get(name) + 1); |
| | | } |
| | | else |
| | | { |
| | | vTagCounts.put(name, 1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ending = " /"; |
| | | } |
| | | return "<" + name + params + ending + ">"; |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | // comments |
| | | m = P_COMMENT.matcher(s); |
| | | if (!stripComment && m.find()) |
| | | { |
| | | return "<" + m.group() + ">"; |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | private String processParamProtocol(String s) |
| | | { |
| | | s = decodeEntities(s); |
| | | final Matcher m = P_PROTOCOL.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String protocol = m.group(1); |
| | | if (!inArray(protocol, vAllowedProtocols)) |
| | | { |
| | | // bad protocol, turn into local anchor link instead |
| | | s = "#" + s.substring(protocol.length() + 1); |
| | | if (s.startsWith("#//")) |
| | | { |
| | | s = "#" + s.substring(3); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String decodeEntities(String s) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | |
| | | Matcher m = P_ENTITY.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.decode(match).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | buf = new StringBuffer(); |
| | | m = P_ENTITY_UNICODE.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.valueOf(match, 16).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | buf = new StringBuffer(); |
| | | m = P_ENCODE.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.valueOf(match, 16).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | s = validateEntities(s); |
| | | return s; |
| | | } |
| | | |
| | | private String validateEntities(final String s) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | |
| | | // validate entities throughout the string |
| | | Matcher m = P_VALID_ENTITIES.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String one = m.group(1); // ([^&;]*) |
| | | final String two = m.group(2); // (?=(;|&|$)) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | return encodeQuotes(buf.toString()); |
| | | } |
| | | |
| | | private String encodeQuotes(final String s) |
| | | { |
| | | if (encodeQuotes) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | Matcher m = P_VALID_QUOTES.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String one = m.group(1); // (>|^) |
| | | final String two = m.group(2); // ([^<]+?) |
| | | final String three = m.group(3); // (<|$) |
| | | // 䏿¿æ¢åå¼å·ä¸º"ï¼é²æ¢jsonæ ¼å¼æ æ regexReplace(P_QUOTE, """, two) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); |
| | | } |
| | | m.appendTail(buf); |
| | | return buf.toString(); |
| | | } |
| | | else |
| | | { |
| | | return s; |
| | | } |
| | | } |
| | | |
| | | private String checkEntity(final String preamble, final String term) |
| | | { |
| | | |
| | | return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; |
| | | } |
| | | |
| | | private boolean isValidEntity(final String entity) |
| | | { |
| | | return inArray(entity, vAllowedEntities); |
| | | } |
| | | |
| | | private static boolean inArray(final String s, final String[] array) |
| | | { |
| | | for (String item : array) |
| | | { |
| | | if (item != null && item.equals(s)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private boolean allowed(final String name) |
| | | { |
| | | return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); |
| | | } |
| | | |
| | | private boolean allowedAttribute(final String name, final String paramName) |
| | | { |
| | | return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.nio.charset.StandardCharsets; |
| | | import jakarta.servlet.ServletRequest; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * éç¨httpå·¥å
·å°è£
|
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpHelper |
| | | { |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); |
| | | |
| | | public static String getBodyString(ServletRequest request) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | BufferedReader reader = null; |
| | | try (InputStream inputStream = request.getInputStream()) |
| | | { |
| | | reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); |
| | | String line = ""; |
| | | while ((line = reader.readLine()) != null) |
| | | { |
| | | sb.append(line); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.warn("getBodyStringåºç°é®é¢ï¼"); |
| | | } |
| | | finally |
| | | { |
| | | if (reader != null) |
| | | { |
| | | try |
| | | { |
| | | reader.close(); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.error(ExceptionUtils.getMessage(e)); |
| | | } |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintWriter; |
| | | import java.net.ConnectException; |
| | | import java.net.SocketTimeoutException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.cert.X509Certificate; |
| | | import javax.net.ssl.HostnameVerifier; |
| | | import javax.net.ssl.HttpsURLConnection; |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.SSLSession; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509TrustManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.springframework.http.MediaType; |
| | | |
| | | /** |
| | | * éç¨httpåéæ¹æ³ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); |
| | | |
| | | /** |
| | | * åæå® URL åéGETæ¹æ³çè¯·æ± |
| | | * |
| | | * @param url åé请æ±ç URL |
| | | * @return æä»£è¡¨è¿ç¨èµæºçååºç»æ |
| | | */ |
| | | public static String sendGet(String url) |
| | | { |
| | | return sendGet(url, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * åæå® URL åéGETæ¹æ³çè¯·æ± |
| | | * |
| | | * @param url åé请æ±ç URL |
| | | * @param param 请æ±åæ°ï¼è¯·æ±åæ°åºè¯¥æ¯ name1=value1&name2=value2 çå½¢å¼ã |
| | | * @return æä»£è¡¨è¿ç¨èµæºçååºç»æ |
| | | */ |
| | | public static String sendGet(String url, String param) |
| | | { |
| | | return sendGet(url, param, Constants.UTF8); |
| | | } |
| | | |
| | | /** |
| | | * åæå® URL åéGETæ¹æ³çè¯·æ± |
| | | * |
| | | * @param url åé请æ±ç URL |
| | | * @param param 请æ±åæ°ï¼è¯·æ±åæ°åºè¯¥æ¯ name1=value1&name2=value2 çå½¢å¼ã |
| | | * @param contentType ç¼ç ç±»å |
| | | * @return æä»£è¡¨è¿ç¨èµæºçååºç»æ |
| | | */ |
| | | public static String sendGet(String url, String param, String contentType) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | BufferedReader in = null; |
| | | try |
| | | { |
| | | String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; |
| | | log.info("sendGet - {}", urlNameString); |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection connection = realUrl.openConnection(); |
| | | connection.setRequestProperty("accept", "*/*"); |
| | | connection.setRequestProperty("connection", "Keep-Alive"); |
| | | connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"); |
| | | connection.connect(); |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è°ç¨HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.error("è°ç¨in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * åæå® URL åéPOSTæ¹æ³çè¯·æ± |
| | | * |
| | | * @param url åé请æ±ç URL |
| | | * @param param 请æ±åæ°ï¼è¯·æ±åæ°åºè¯¥æ¯ name1=value1&name2=value2 çå½¢å¼ã |
| | | * @return æä»£è¡¨è¿ç¨èµæºçååºç»æ |
| | | */ |
| | | public static String sendPost(String url, String param) |
| | | { |
| | | return sendPost(url, param, MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | } |
| | | |
| | | /** |
| | | * åæå® URL åéPOSTæ¹æ³çè¯·æ± |
| | | * |
| | | * @param url åé请æ±ç URL |
| | | * @param param 请æ±åæ° |
| | | * @param contentType å
容类å |
| | | * @return æä»£è¡¨è¿ç¨èµæºçååºç»æ |
| | | */ |
| | | public static String sendPost(String url, String param, String contentType) |
| | | { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | StringBuilder result = new StringBuilder(); |
| | | try |
| | | { |
| | | log.info("sendPost - {}", url); |
| | | URL realUrl = new URL(url); |
| | | URLConnection conn = realUrl.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("Content-Type", contentType); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | out.print(param); |
| | | out.flush(); |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è°ç¨HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (out != null) |
| | | { |
| | | out.close(); |
| | | } |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (IOException ex) |
| | | { |
| | | log.error("è°ç¨in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String sendSSLPost(String url, String param) |
| | | { |
| | | return sendSSLPost(url, param, MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | } |
| | | |
| | | public static String sendSSLPost(String url, String param, String contentType) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | String urlNameString = url + "?" + param; |
| | | try |
| | | { |
| | | log.info("sendSSLPost - {}", urlNameString); |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
| | | URL console = new URL(urlNameString); |
| | | HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("Content-Type", contentType); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | |
| | | conn.setSSLSocketFactory(sc.getSocketFactory()); |
| | | conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); |
| | | conn.connect(); |
| | | InputStream is = conn.getInputStream(); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(is)); |
| | | String ret = ""; |
| | | while ((ret = br.readLine()) != null) |
| | | { |
| | | if (ret != null && !"".equals(ret.trim())) |
| | | { |
| | | result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); |
| | | } |
| | | } |
| | | log.info("recv - {}", result); |
| | | conn.disconnect(); |
| | | br.close(); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("è°ç¨HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è°ç¨HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | private static class TrustAnyTrustManager implements X509TrustManager |
| | | { |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[] {}; |
| | | } |
| | | } |
| | | |
| | | private static class TrustAnyHostnameVerifier implements HostnameVerifier |
| | | { |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import nl.basjes.parse.useragent.UserAgent; |
| | | import nl.basjes.parse.useragent.UserAgentAnalyzer; |
| | | |
| | | /** |
| | | * UserAgentè§£æå·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserAgentUtils |
| | | { |
| | | public static final String UNKNOWN = ""; |
| | | |
| | | // æµè§å¨æ£åè¡¨è¾¾å¼æ¨¡å¼ |
| | | private static final Pattern CHROME_PATTERN = Pattern.compile("Chrome/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern FIREFOX_PATTERN = Pattern.compile("Firefox/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern EDGE_PATTERN = Pattern.compile("Edg(?:e)?/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern SAFARI_PATTERN = Pattern.compile("Version/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern OPERA_PATTERN = Pattern.compile("Opera/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern IE_PATTERN = Pattern.compile("(?:MSIE |Trident/.*rv:)(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern SAMSUNG_PATTERN = Pattern.compile("SamsungBrowser/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern UC_PATTERN = Pattern.compile("UCBrowser/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern QQ_PATTERN = Pattern.compile("QQBrowser/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern WECHAT_PATTERN = Pattern.compile("MicroMessenger/(\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern BAIDU_PATTERN = Pattern.compile("baidubrowser/(\\d+)(?:\\.\\d+)*"); |
| | | |
| | | // æä½ç³»ç»æ£åè¡¨è¾¾å¼æ¨¡å¼ |
| | | private static final Pattern WINDOWS_PATTERN = Pattern.compile("Windows NT (\\d+\\.\\d+)"); |
| | | private static final Pattern MACOS_PATTERN = Pattern.compile("Mac OS X (\\d+[_\\d]*)"); |
| | | private static final Pattern ANDROID_PATTERN = Pattern.compile("Android (\\d+)(?:\\.\\d+)*"); |
| | | private static final Pattern IOS_PATTERN = Pattern.compile("OS[\\s_](\\d+)(?:_\\d+)*"); |
| | | private static final Pattern LINUX_PATTERN = Pattern.compile("Linux"); |
| | | private static final Pattern CHROMEOS_PATTERN = Pattern.compile("CrOS"); |
| | | |
| | | private static final UserAgentAnalyzer userAgentAnalyzer = UserAgentAnalyzer |
| | | .newBuilder().hideMatcherLoadStats() |
| | | .withCache(5000) |
| | | .showMinimalVersion() |
| | | .withField(UserAgent.AGENT_NAME_VERSION) |
| | | .withField(UserAgent.OPERATING_SYSTEM_NAME_VERSION) |
| | | .build(); |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯æµè§å¨ |
| | | */ |
| | | public static String getBrowser(String userAgent) |
| | | { |
| | | UserAgent.ImmutableUserAgent iua = userAgentAnalyzer.parse(userAgent); |
| | | String agentNameVersion = iua.get(UserAgent.AGENT_NAME_VERSION).getValue(); |
| | | if (StringUtils.isBlank(agentNameVersion) || agentNameVersion.contains("??")) |
| | | { |
| | | return formatBrowser(userAgent); |
| | | } |
| | | return agentNameVersion; |
| | | } |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯æä½ç³»ç» |
| | | */ |
| | | public static String getOperatingSystem(String userAgent) |
| | | { |
| | | UserAgent.ImmutableUserAgent iua = userAgentAnalyzer.parse(userAgent); |
| | | String operatingSystemNameVersion = iua.get(UserAgent.OPERATING_SYSTEM_NAME_VERSION).getValue(); |
| | | if (StringUtils.isBlank(operatingSystemNameVersion) || operatingSystemNameVersion.contains("??")) |
| | | { |
| | | return formatOperatingSystem(userAgent); |
| | | } |
| | | return operatingSystemNameVersion; |
| | | } |
| | | |
| | | /** |
| | | * å
¨é¢æµè§å¨æ£æµ |
| | | */ |
| | | private static String formatBrowser(String browser) |
| | | { |
| | | // Chromeç³»åæµè§å¨ |
| | | Matcher chromeMatcher = CHROME_PATTERN.matcher(browser); |
| | | if (chromeMatcher.find() && (browser.contains("Chrome") || browser.contains("CriOS"))) |
| | | { |
| | | return "Chrome" + chromeMatcher.group(1); |
| | | } |
| | | // Firefox |
| | | Matcher firefoxMatcher = FIREFOX_PATTERN.matcher(browser); |
| | | if (firefoxMatcher.find()) |
| | | { |
| | | return "Firefox" + firefoxMatcher.group(1); |
| | | } |
| | | // Edgeæµè§å¨ |
| | | Matcher edgeMatcher = EDGE_PATTERN.matcher(browser); |
| | | if (edgeMatcher.find()) |
| | | { |
| | | return "Edge" + edgeMatcher.group(1); |
| | | } |
| | | // Safariæµè§å¨ï¼éæé¤Chromeï¼ |
| | | Matcher safariMatcher = SAFARI_PATTERN.matcher(browser); |
| | | if (safariMatcher.find() && !browser.contains("Chrome")) |
| | | { |
| | | return "Safari" + safariMatcher.group(1); |
| | | } |
| | | // 微信å
ç½®æµè§å¨ |
| | | Matcher wechatMatcher = WECHAT_PATTERN.matcher(browser); |
| | | if (wechatMatcher.find()) |
| | | { |
| | | return "WeChat" + wechatMatcher.group(1); |
| | | } |
| | | // UCæµè§å¨ |
| | | Matcher ucMatcher = UC_PATTERN.matcher(browser); |
| | | if (ucMatcher.find()) |
| | | { |
| | | return "UC Browser" + ucMatcher.group(1); |
| | | } |
| | | // QQæµè§å¨ |
| | | Matcher qqMatcher = QQ_PATTERN.matcher(browser); |
| | | if (qqMatcher.find()) |
| | | { |
| | | return "QQ Browser" + qqMatcher.group(1); |
| | | } |
| | | // ç¾åº¦æµè§å¨ |
| | | Matcher baiduMatcher = BAIDU_PATTERN.matcher(browser); |
| | | if (baiduMatcher.find()) |
| | | { |
| | | return "Baidu Browser" + baiduMatcher.group(1); |
| | | } |
| | | // Samsungæµè§å¨ |
| | | Matcher samsungMatcher = SAMSUNG_PATTERN.matcher(browser); |
| | | if (samsungMatcher.find()) |
| | | { |
| | | return "Samsung Browser" + samsungMatcher.group(1); |
| | | } |
| | | // Operaæµè§å¨ |
| | | Matcher operaMatcher = OPERA_PATTERN.matcher(browser); |
| | | if (operaMatcher.find()) |
| | | { |
| | | return "Opera" + operaMatcher.group(1); |
| | | } |
| | | // IEæµè§å¨ |
| | | Matcher ieMatcher = IE_PATTERN.matcher(browser); |
| | | if (ieMatcher.find()) |
| | | { |
| | | return "Internet Explorer" + ieMatcher.group(1); |
| | | } |
| | | return UNKNOWN; |
| | | } |
| | | |
| | | /** |
| | | * æ£æµæä½ç³»ç» |
| | | */ |
| | | private static String formatOperatingSystem(String operatingSystem) |
| | | { |
| | | // Windowsç³»ç» |
| | | Matcher windowsMatcher = WINDOWS_PATTERN.matcher(operatingSystem); |
| | | if (windowsMatcher.find()) |
| | | { |
| | | return "Windows" + getWindowsVersionDisplay(windowsMatcher.group(1)); |
| | | } |
| | | // macOSç³»ç» |
| | | Matcher macMatcher = MACOS_PATTERN.matcher(operatingSystem); |
| | | if (macMatcher.find()) |
| | | { |
| | | String version = macMatcher.group(1).replace("_", "."); |
| | | return "macOS" + extractMajorVersion(version); |
| | | } |
| | | // Androidç³»ç» |
| | | Matcher androidMatcher = ANDROID_PATTERN.matcher(operatingSystem); |
| | | if (androidMatcher.find()) |
| | | { |
| | | return "Android" + extractMajorVersion(androidMatcher.group(1)); |
| | | } |
| | | // iOSç³»ç» |
| | | Matcher iosMatcher = IOS_PATTERN.matcher(operatingSystem); |
| | | if (iosMatcher.find() && (operatingSystem.contains("iPhone") || operatingSystem.contains("iPad"))) |
| | | { |
| | | return "iOS" + extractMajorVersion(iosMatcher.group(1)); |
| | | } |
| | | // Linuxç³»ç» |
| | | if (LINUX_PATTERN.matcher(operatingSystem).find() && !operatingSystem.contains("Android")) |
| | | { |
| | | return "Linux"; |
| | | } |
| | | // Chrome OS |
| | | if (CHROMEOS_PATTERN.matcher(operatingSystem).find()) |
| | | { |
| | | return "Chrome OS"; |
| | | } |
| | | return UNKNOWN; |
| | | } |
| | | |
| | | /** |
| | | * æåä¼åçä¸»çæ¬å· |
| | | */ |
| | | private static String extractMajorVersion(String fullVersion) |
| | | { |
| | | if (StringUtils.isEmpty(fullVersion)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | try |
| | | { |
| | | // æ¸
ççæ¬å·ä¸çéæ°åå符 |
| | | String cleanVersion = fullVersion.replaceAll("[^0-9.]", ""); |
| | | String[] parts = cleanVersion.split("\\."); |
| | | if (parts.length > 0) |
| | | { |
| | | String firstPart = parts[0]; |
| | | if (firstPart.matches("\\d+")) |
| | | { |
| | | int version = Integer.parseInt(firstPart); |
| | | |
| | | // å¤çä¸ä½æ°çæ¬å·ï¼å¦142 -> 14ï¼ |
| | | if (version >= 100) |
| | | { |
| | | return String.valueOf(version / 10); |
| | | } |
| | | return firstPart; |
| | | } |
| | | } |
| | | } |
| | | catch (NumberFormatException e) |
| | | { |
| | | // çæ¬å·è§£æå¤±è´¥ï¼è¿ååå§å¼ |
| | | } |
| | | return fullVersion; |
| | | } |
| | | |
| | | /** |
| | | * Windowsçæ¬å·æ¾ç¤ºä¼å |
| | | */ |
| | | private static String getWindowsVersionDisplay(String version) |
| | | { |
| | | switch (version) |
| | | { |
| | | case "10.0": |
| | | return "10"; |
| | | case "6.3": |
| | | return "8.1"; |
| | | case "6.2": |
| | | return "8"; |
| | | case "6.1": |
| | | return "7"; |
| | | case "6.0": |
| | | return "Vista"; |
| | | case "5.1": |
| | | return "XP"; |
| | | case "5.0": |
| | | return "2000"; |
| | | default: |
| | | return extractMajorVersion(version); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.ip; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | |
| | | /** |
| | | * è·åå°åç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class AddressUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); |
| | | |
| | | // IPå°åæ¥è¯¢ |
| | | public static final String IP_URL = "https://whois.pconline.com.cn/ipJson.jsp"; |
| | | |
| | | // æªç¥å°å |
| | | public static final String UNKNOWN = "XX XX"; |
| | | |
| | | public static String getRealAddressByIP(String ip) |
| | | { |
| | | // å
ç½ä¸æ¥è¯¢ |
| | | if (IpUtils.internalIp(ip)) |
| | | { |
| | | return "å
ç½IP"; |
| | | } |
| | | if (RuoYiConfig.isAddressEnabled()) |
| | | { |
| | | try |
| | | { |
| | | String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); |
| | | if (StringUtils.isEmpty(rspStr)) |
| | | { |
| | | log.error("è·åå°çä½ç½®å¼å¸¸ {}", ip); |
| | | return UNKNOWN; |
| | | } |
| | | JSONObject obj = JSON.parseObject(rspStr); |
| | | String region = obj.getString("pro"); |
| | | String city = obj.getString("city"); |
| | | return String.format("%s %s", region, city); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è·åå°çä½ç½®å¼å¸¸ {}", ip); |
| | | } |
| | | } |
| | | return UNKNOWN; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.ip; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * è·åIPæ¹æ³ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class IpUtils |
| | | { |
| | | public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)"; |
| | | // å¹é
ip |
| | | public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; |
| | | public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))"; |
| | | // å¹é
ç½æ®µ |
| | | public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")"; |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯IP |
| | | * |
| | | * @return IPå°å |
| | | */ |
| | | public static String getIpAddr() |
| | | { |
| | | return getIpAddr(ServletUtils.getRequest()); |
| | | } |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯IP |
| | | * |
| | | * @param request 请æ±å¯¹è±¡ |
| | | * @return IPå°å |
| | | */ |
| | | public static String getIpAddr(HttpServletRequest request) |
| | | { |
| | | if (request == null) |
| | | { |
| | | return "unknown"; |
| | | } |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Forwarded-For"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | |
| | | return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥æ¯å¦ä¸ºå
é¨IPå°å |
| | | * |
| | | * @param ip IPå°å |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean internalIp(String ip) |
| | | { |
| | | byte[] addr = textToNumericFormatV4(ip); |
| | | return internalIp(addr) || "127.0.0.1".equals(ip); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥æ¯å¦ä¸ºå
é¨IPå°å |
| | | * |
| | | * @param addr byteå°å |
| | | * @return ç»æ |
| | | */ |
| | | private static boolean internalIp(byte[] addr) |
| | | { |
| | | if (StringUtils.isNull(addr) || addr.length < 2) |
| | | { |
| | | return true; |
| | | } |
| | | final byte b0 = addr[0]; |
| | | final byte b1 = addr[1]; |
| | | // 10.x.x.x/8 |
| | | final byte SECTION_1 = 0x0A; |
| | | // 172.16.x.x/12 |
| | | final byte SECTION_2 = (byte) 0xAC; |
| | | final byte SECTION_3 = (byte) 0x10; |
| | | final byte SECTION_4 = (byte) 0x1F; |
| | | // 192.168.x.x/16 |
| | | final byte SECTION_5 = (byte) 0xC0; |
| | | final byte SECTION_6 = (byte) 0xA8; |
| | | switch (b0) |
| | | { |
| | | case SECTION_1: |
| | | return true; |
| | | case SECTION_2: |
| | | if (b1 >= SECTION_3 && b1 <= SECTION_4) |
| | | { |
| | | return true; |
| | | } |
| | | case SECTION_5: |
| | | switch (b1) |
| | | { |
| | | case SECTION_6: |
| | | return true; |
| | | } |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°IPv4å°åè½¬æ¢æåè |
| | | * |
| | | * @param text IPv4å°å |
| | | * @return byte åè |
| | | */ |
| | | public static byte[] textToNumericFormatV4(String text) |
| | | { |
| | | if (text.length() == 0) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | byte[] bytes = new byte[4]; |
| | | String[] elements = text.split("\\.", -1); |
| | | try |
| | | { |
| | | long l; |
| | | int i; |
| | | switch (elements.length) |
| | | { |
| | | case 1: |
| | | l = Long.parseLong(elements[0]); |
| | | if ((l < 0L) || (l > 4294967295L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l >> 24 & 0xFF); |
| | | bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 2: |
| | | l = Integer.parseInt(elements[0]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l & 0xFF); |
| | | l = Integer.parseInt(elements[1]); |
| | | if ((l < 0L) || (l > 16777215L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[1] = (byte) (int) (l >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 3: |
| | | for (i = 0; i < 2; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | l = Integer.parseInt(elements[2]); |
| | | if ((l < 0L) || (l > 65535L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[2] = (byte) (int) (l >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 4: |
| | | for (i = 0; i < 4; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | break; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | catch (NumberFormatException e) |
| | | { |
| | | return null; |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * è·åIPå°å |
| | | * |
| | | * @return æ¬å°IPå°å |
| | | */ |
| | | public static String getHostIp() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostAddress(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "127.0.0.1"; |
| | | } |
| | | |
| | | /** |
| | | * è·å主æºå |
| | | * |
| | | * @return æ¬å°ä¸»æºå |
| | | */ |
| | | public static String getHostName() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostName(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "æªç¥"; |
| | | } |
| | | |
| | | /** |
| | | * ä»å¤çº§åå代çä¸è·å¾ç¬¬ä¸ä¸ªéunknown IPå°å |
| | | * |
| | | * @param ip è·å¾çIPå°å |
| | | * @return 第ä¸ä¸ªéunknown IPå°å |
| | | */ |
| | | public static String getMultistageReverseProxyIp(String ip) |
| | | { |
| | | // å¤çº§ååä»£çæ£æµ |
| | | if (ip != null && ip.indexOf(",") > 0) |
| | | { |
| | | final String[] ips = ip.trim().split(","); |
| | | for (String subIp : ips) |
| | | { |
| | | if (false == isUnknown(subIp)) |
| | | { |
| | | ip = subIp; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.substring(ip, 0, 255); |
| | | } |
| | | |
| | | /** |
| | | * æ£æµç»å®å符串æ¯å¦ä¸ºæªç¥ï¼å¤ç¨äºæ£æµHTTP请æ±ç¸å
³ |
| | | * |
| | | * @param checkString è¢«æ£æµçå符串 |
| | | * @return æ¯å¦æªç¥ |
| | | */ |
| | | public static boolean isUnknown(String checkString) |
| | | { |
| | | return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºIP |
| | | */ |
| | | public static boolean isIP(String ip) |
| | | { |
| | | return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºIPï¼æ *为é´éçéé
符å°å |
| | | */ |
| | | public static boolean isIpWildCard(String ip) |
| | | { |
| | | return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD); |
| | | } |
| | | |
| | | /** |
| | | * æ£æµåæ°æ¯å¦å¨ipéé
符é |
| | | */ |
| | | public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip) |
| | | { |
| | | String[] s1 = ipWildCard.split("\\."); |
| | | String[] s2 = ip.split("\\."); |
| | | boolean isMatchedSeg = true; |
| | | for (int i = 0; i < s1.length && !s1[i].equals("*"); i++) |
| | | { |
| | | if (!s1[i].equals(s2[i])) |
| | | { |
| | | isMatchedSeg = false; |
| | | break; |
| | | } |
| | | } |
| | | return isMatchedSeg; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç¹å®æ ¼å¼å¦:â10.10.10.1-10.10.10.99âçip段å符串 |
| | | */ |
| | | public static boolean isIPSegment(String ipSeg) |
| | | { |
| | | return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG); |
| | | } |
| | | |
| | | /** |
| | | * 夿ipæ¯å¦å¨æå®ç½æ®µä¸ |
| | | */ |
| | | public static boolean ipIsInNetNoCheck(String iparea, String ip) |
| | | { |
| | | int idx = iparea.indexOf('-'); |
| | | String[] sips = iparea.substring(0, idx).split("\\."); |
| | | String[] sipe = iparea.substring(idx + 1).split("\\."); |
| | | String[] sipt = ip.split("\\."); |
| | | long ips = 0L, ipe = 0L, ipt = 0L; |
| | | for (int i = 0; i < 4; ++i) |
| | | { |
| | | ips = ips << 8 | Integer.parseInt(sips[i]); |
| | | ipe = ipe << 8 | Integer.parseInt(sipe[i]); |
| | | ipt = ipt << 8 | Integer.parseInt(sipt[i]); |
| | | } |
| | | if (ips > ipe) |
| | | { |
| | | long t = ips; |
| | | ips = ipe; |
| | | ipe = t; |
| | | } |
| | | return ips <= ipt && ipt <= ipe; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªipæ¯å¦ç¬¦åè¿æ»¤ä¸²è§å |
| | | * |
| | | * @param filter è¿æ»¤IPå表,æ¯æåç¼'*'éé
,æ¯æç½æ®µå¦:`10.10.10.1-10.10.10.99` |
| | | * @param ip æ ¡éªIPå°å |
| | | * @return boolean ç»æ |
| | | */ |
| | | public static boolean isMatchedIp(String filter, String ip) |
| | | { |
| | | if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip)) |
| | | { |
| | | return false; |
| | | } |
| | | String[] ips = filter.split(";"); |
| | | for (String iStr : ips) |
| | | { |
| | | if (isIP(iStr) && iStr.equals(ip)) |
| | | { |
| | | return true; |
| | | } |
| | | else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip)) |
| | | { |
| | | return true; |
| | | } |
| | | else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.poi; |
| | | |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | |
| | | /** |
| | | * Excelæ°æ®æ ¼å¼å¤çéé
å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ExcelHandlerAdapter |
| | | { |
| | | /** |
| | | * æ ¼å¼å |
| | | * |
| | | * @param value åå
æ ¼æ°æ®å¼ |
| | | * @param args excel注解argsåæ°ç» |
| | | * @param cell åå
æ ¼å¯¹è±¡ |
| | | * @param wb å·¥ä½ç°¿å¯¹è±¡ |
| | | * |
| | | * @return å¤çåçå¼ |
| | | */ |
| | | Object format(Object value, String[] args, Cell cell, Workbook wb); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.poi; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¤ Sheet å¯¼åºæ¶çæ°æ®ä¿¡æ¯ |
| | | * |
| | | * 使ç¨ç¤ºä¾ï¼ |
| | | * <pre> |
| | | * List<ExcelSheet<?>> sheets = new ArrayList<>(); |
| | | * sheets.add(new ExcelSheet<>("åæ°æ°æ®", configList, Config.class, "åæ°ä¿¡æ¯")); |
| | | * sheets.add(new ExcelSheet<>("å²ä½æ°æ®", postList, Post.class, "å²ä½ä¿¡æ¯")); |
| | | * return ExcelUtil.exportMultiSheet(sheets); |
| | | * </pre> |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExcelSheet<T> |
| | | { |
| | | /** Sheet åç§° */ |
| | | private String sheetName; |
| | | |
| | | /** å¯¼åºæ°æ®éå */ |
| | | private List<T> list; |
| | | |
| | | /** æ°æ®å¯¹åºçå®ä½ Class */ |
| | | private Class<T> clazz; |
| | | |
| | | /** Sheet é¡¶é¨å¤§æ é¢ï¼å¯ä¸ºç©ºï¼ */ |
| | | private String title; |
| | | |
| | | public ExcelSheet(String sheetName, List<T> list, Class<T> clazz) |
| | | { |
| | | this(sheetName, list, clazz, ""); |
| | | } |
| | | |
| | | public ExcelSheet(String sheetName, List<T> list, Class<T> clazz, String title) |
| | | { |
| | | this.sheetName = sheetName; |
| | | this.list = list != null ? list : new ArrayList<>(); |
| | | this.clazz = clazz; |
| | | this.title = title != null ? title : ""; |
| | | } |
| | | |
| | | public String getSheetName() |
| | | { |
| | | return sheetName; |
| | | } |
| | | |
| | | public List<T> getList() |
| | | { |
| | | return list; |
| | | } |
| | | |
| | | public Class<T> getClazz() |
| | | { |
| | | return clazz; |
| | | } |
| | | |
| | | public String getTitle() |
| | | { |
| | | return title; |
| | | } |
| | | |
| | | public void setSheetName(String sheetName) |
| | | { |
| | | this.sheetName = sheetName; |
| | | } |
| | | |
| | | public void setList(List<T> list) |
| | | { |
| | | this.list = list; |
| | | } |
| | | |
| | | public void setClazz(Class<T> clazz) |
| | | { |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | public void setTitle(String title) |
| | | { |
| | | this.title = title; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.poi; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.ParameterizedType; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.apache.commons.lang3.RegExUtils; |
| | | import org.apache.commons.lang3.reflect.FieldUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFClientAnchor; |
| | | import org.apache.poi.hssf.usermodel.HSSFPicture; |
| | | import org.apache.poi.hssf.usermodel.HSSFPictureData; |
| | | import org.apache.poi.hssf.usermodel.HSSFShape; |
| | | import org.apache.poi.hssf.usermodel.HSSFSheet; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ooxml.POIXMLDocumentPart; |
| | | import org.apache.poi.ss.usermodel.BorderStyle; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.CellStyle; |
| | | import org.apache.poi.ss.usermodel.CellType; |
| | | import org.apache.poi.ss.usermodel.ClientAnchor; |
| | | import org.apache.poi.ss.usermodel.DataFormat; |
| | | import org.apache.poi.ss.usermodel.DataValidation; |
| | | import org.apache.poi.ss.usermodel.DataValidationConstraint; |
| | | import org.apache.poi.ss.usermodel.DataValidationHelper; |
| | | import org.apache.poi.ss.usermodel.DateUtil; |
| | | import org.apache.poi.ss.usermodel.Drawing; |
| | | import org.apache.poi.ss.usermodel.FillPatternType; |
| | | import org.apache.poi.ss.usermodel.Font; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.IndexedColors; |
| | | import org.apache.poi.ss.usermodel.Name; |
| | | import org.apache.poi.ss.usermodel.PictureData; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.VerticalAlignment; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.apache.poi.ss.util.CellRangeAddress; |
| | | import org.apache.poi.ss.util.CellRangeAddressList; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFClientAnchor; |
| | | import org.apache.poi.xssf.usermodel.XSSFDataValidation; |
| | | import org.apache.poi.xssf.usermodel.XSSFDrawing; |
| | | import org.apache.poi.xssf.usermodel.XSSFPicture; |
| | | import org.apache.poi.xssf.usermodel.XSSFShape; |
| | | import org.apache.poi.xssf.usermodel.XSSFSheet; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.annotation.Excel.Type; |
| | | import com.ruoyi.common.annotation.Excels; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.exception.UtilException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileTypeUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.common.utils.file.ImageUtils; |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | |
| | | /** |
| | | * Excelç¸å
³å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExcelUtil<T> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); |
| | | |
| | | public static final String SEPARATOR = ","; |
| | | |
| | | public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; |
| | | |
| | | public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; |
| | | |
| | | /** |
| | | * ç¨äºdictType屿§æ°æ®åå¨ï¼é¿å
é夿¥ç¼å |
| | | */ |
| | | public Map<String, String> sysDictMap = new HashMap<String, String>(); |
| | | |
| | | /** |
| | | * åå
æ ¼æ ·å¼ç¼å |
| | | */ |
| | | private Map<String, CellStyle> cellStyleCache = new HashMap<String, CellStyle>(); |
| | | |
| | | /** |
| | | * Excel sheetæå¤§è¡æ°ï¼é»è®¤65536 |
| | | */ |
| | | public static final int sheetSize = 65536; |
| | | |
| | | /** |
| | | * å·¥ä½è¡¨åç§° |
| | | */ |
| | | private String sheetName; |
| | | |
| | | /** |
| | | * 导åºç±»åï¼EXPORT:å¯¼åºæ°æ®ï¼IMPORTï¼å¯¼å
¥æ¨¡æ¿ï¼ |
| | | */ |
| | | private Type type; |
| | | |
| | | /** |
| | | * å·¥ä½è对象 |
| | | */ |
| | | private Workbook wb; |
| | | |
| | | /** |
| | | * å·¥ä½è¡¨å¯¹è±¡ |
| | | */ |
| | | private Sheet sheet; |
| | | |
| | | /** |
| | | * æ ·å¼å表 |
| | | */ |
| | | private Map<String, CellStyle> styles; |
| | | |
| | | /** |
| | | * 导å
¥å¯¼åºæ°æ®å表 |
| | | */ |
| | | private List<T> list; |
| | | |
| | | /** |
| | | * 注解å表 |
| | | */ |
| | | private List<Object[]> fields; |
| | | |
| | | /** |
| | | * å½åè¡å· |
| | | */ |
| | | private int rownum; |
| | | |
| | | /** |
| | | * æ é¢ |
| | | */ |
| | | private String title; |
| | | |
| | | /** |
| | | * æå¤§é«åº¦ |
| | | */ |
| | | private short maxHeight; |
| | | |
| | | /** |
| | | * åå¹¶åæåè¡æ° |
| | | */ |
| | | private int subMergedLastRowNum = 0; |
| | | |
| | | /** |
| | | * åå¹¶åå¼å§è¡æ° |
| | | */ |
| | | private int subMergedFirstRowNum = 1; |
| | | |
| | | /** |
| | | * 对象çååè¡¨æ¹æ³ |
| | | */ |
| | | private Map<String, Method> subMethods; |
| | | |
| | | /** |
| | | * 对象çååè¡¨å±æ§ |
| | | */ |
| | | private Map<String, List<Field>> subFieldsMap; |
| | | |
| | | /** |
| | | * ç»è®¡å表 |
| | | */ |
| | | private Map<Integer, Double> statistics = new HashMap<Integer, Double>(); |
| | | |
| | | /** |
| | | * å®ä½å¯¹è±¡ |
| | | */ |
| | | public Class<T> clazz; |
| | | |
| | | /** |
| | | * éè¦æ¾ç¤ºå屿§ |
| | | */ |
| | | public String[] includeFields; |
| | | |
| | | /** |
| | | * éè¦æé¤å屿§ |
| | | */ |
| | | public String[] excludeFields; |
| | | |
| | | public ExcelUtil(Class<T> clazz) |
| | | { |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | /** |
| | | * ä»
å¨Excel䏿¾ç¤ºå屿§ |
| | | * |
| | | * @param fields å屿§å 示ä¾[å个"name"/å¤ä¸ª"id","name"] |
| | | */ |
| | | public void showColumn(String... fields) |
| | | { |
| | | this.includeFields = fields; |
| | | } |
| | | |
| | | /** |
| | | * éèExcelä¸å屿§ |
| | | * |
| | | * @param fields å屿§å 示ä¾[å个"name"/å¤ä¸ª"id","name"] |
| | | */ |
| | | public void hideColumn(String... fields) |
| | | { |
| | | this.excludeFields = fields; |
| | | } |
| | | |
| | | public void init(List<T> list, String sheetName, String title, Type type) |
| | | { |
| | | if (list == null) |
| | | { |
| | | list = new ArrayList<T>(); |
| | | } |
| | | this.list = list; |
| | | this.sheetName = sheetName; |
| | | this.type = type; |
| | | this.title = title; |
| | | createExcelField(); |
| | | createWorkbook(); |
| | | createTitle(); |
| | | createSubHead(); |
| | | } |
| | | |
| | | /** |
| | | * å建excel第ä¸è¡æ é¢ |
| | | */ |
| | | public void createTitle() |
| | | { |
| | | if (StringUtils.isNotEmpty(title)) |
| | | { |
| | | int titleLastCol = this.fields.size() - 1; |
| | | if (isSubList()) |
| | | { |
| | | for (List<Field> currentSubFields : subFieldsMap.values()) |
| | | { |
| | | titleLastCol = titleLastCol + currentSubFields.size() - 1; |
| | | } |
| | | } |
| | | Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0); |
| | | titleRow.setHeightInPoints(30); |
| | | Cell titleCell = titleRow.createCell(0); |
| | | titleCell.setCellStyle(styles.get("title")); |
| | | titleCell.setCellValue(title); |
| | | sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), 0, titleLastCol)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建对象çåå表åç§° |
| | | */ |
| | | public void createSubHead() |
| | | { |
| | | if (isSubList()) |
| | | { |
| | | Row subRow = sheet.createRow(rownum); |
| | | int column = 0; |
| | | for (Object[] objects : fields) |
| | | { |
| | | Field field = (Field) objects[0]; |
| | | Excel attr = (Excel) objects[1]; |
| | | CellStyle cellStyle = styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())); |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | Cell cell = subRow.createCell(column); |
| | | cell.setCellValue(attr.name()); |
| | | cell.setCellStyle(cellStyle); |
| | | int subFieldSize = subFieldsMap != null ? subFieldsMap.get(field.getName()).size() : 0; |
| | | if (subFieldSize > 1) |
| | | { |
| | | CellRangeAddress cellAddress = new CellRangeAddress(rownum, rownum, column, column + subFieldSize - 1); |
| | | sheet.addMergedRegion(cellAddress); |
| | | } |
| | | column += subFieldSize; |
| | | } |
| | | else |
| | | { |
| | | Cell cell = subRow.createCell(column++); |
| | | cell.setCellValue(attr.name()); |
| | | cell.setCellStyle(cellStyle); |
| | | } |
| | | } |
| | | rownum++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 对excel表åé»è®¤ç¬¬ä¸ä¸ªç´¢å¼åè½¬æ¢ælist |
| | | * |
| | | * @param is è¾å
¥æµ |
| | | * @return 转æ¢åéå |
| | | */ |
| | | public List<T> importExcel(InputStream is) |
| | | { |
| | | return importExcel(is, 0); |
| | | } |
| | | |
| | | /** |
| | | * 对excel表åé»è®¤ç¬¬ä¸ä¸ªç´¢å¼åè½¬æ¢ælist |
| | | * |
| | | * @param is è¾å
¥æµ |
| | | * @param titleNum æ é¢å ç¨è¡æ° |
| | | * @return 转æ¢åéå |
| | | */ |
| | | public List<T> importExcel(InputStream is, int titleNum) |
| | | { |
| | | List<T> list = null; |
| | | try |
| | | { |
| | | list = importExcel(StringUtils.EMPTY, is, titleNum); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("导å
¥Excelå¼å¸¸{}", e.getMessage()); |
| | | throw new UtilException(e.getMessage()); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(is); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 对excel表åæå®è¡¨æ ¼ç´¢å¼åè½¬æ¢ælist |
| | | * |
| | | * @param sheetName è¡¨æ ¼ç´¢å¼å |
| | | * @param titleNum æ é¢å ç¨è¡æ° |
| | | * @param is è¾å
¥æµ |
| | | * @return 转æ¢åéå |
| | | */ |
| | | public List<T> importExcel(String sheetName, InputStream is, int titleNum) throws Exception |
| | | { |
| | | this.type = Type.IMPORT; |
| | | this.wb = WorkbookFactory.create(is); |
| | | List<T> list = new ArrayList<T>(); |
| | | // 妿æå®sheetå,ååæå®sheetä¸çå
容 å¦åé»è®¤æå第1个sheet |
| | | Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0); |
| | | if (sheet == null) |
| | | { |
| | | throw new IOException("æä»¶sheetä¸åå¨"); |
| | | } |
| | | boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook); |
| | | Map<String, List<PictureData>> pictures = null; |
| | | if (isXSSFWorkbook) |
| | | { |
| | | pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb); |
| | | } |
| | | else |
| | | { |
| | | pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb); |
| | | } |
| | | // è·åæåä¸ä¸ªé空è¡çè¡ä¸æ ï¼æ¯å¦æ»è¡æ°ä¸ºnï¼åè¿åç为n-1 |
| | | int rows = sheet.getLastRowNum(); |
| | | if (rows > 0) |
| | | { |
| | | // å®ä¹ä¸ä¸ªmapç¨äºåæ¾excelåçåºå·åfield. |
| | | Map<String, Integer> cellMap = new HashMap<String, Integer>(); |
| | | // è·å表头 |
| | | Row heard = sheet.getRow(titleNum); |
| | | if (heard == null) |
| | | { |
| | | throw new UtilException("æä»¶æ é¢è¡ä¸ºç©ºï¼è¯·æ£æ¥Excelæä»¶æ ¼å¼"); |
| | | } |
| | | for (int i = 0; i < heard.getLastCellNum(); i++) |
| | | { |
| | | Cell cell = heard.getCell(i); |
| | | if (StringUtils.isNotNull(cell)) |
| | | { |
| | | String value = this.getCellValue(heard, i).toString(); |
| | | cellMap.put(value, i); |
| | | } |
| | | } |
| | | // ææ°æ®æ¶æå¤ç å¾å°ç±»çææfield. |
| | | List<Object[]> fields = this.getFields(); |
| | | Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>(); |
| | | for (Object[] objects : fields) |
| | | { |
| | | Excel attr = (Excel) objects[1]; |
| | | Integer column = cellMap.get(attr.name()); |
| | | if (column != null) |
| | | { |
| | | fieldsMap.put(column, objects); |
| | | } |
| | | } |
| | | for (int i = titleNum + 1; i <= rows; i++) |
| | | { |
| | | // ä»ç¬¬2è¡å¼å§åæ°æ®,é»è®¤ç¬¬ä¸è¡æ¯è¡¨å¤´. |
| | | Row row = sheet.getRow(i); |
| | | // 夿å½åè¡æ¯å¦æ¯ç©ºè¡ |
| | | if (isRowEmpty(row)) |
| | | { |
| | | continue; |
| | | } |
| | | T entity = null; |
| | | for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet()) |
| | | { |
| | | Object val = this.getCellValue(row, entry.getKey()); |
| | | |
| | | // 妿ä¸åå¨å®ä¾åæ°å»º. |
| | | entity = (entity == null ? clazz.getDeclaredConstructor().newInstance() : entity); |
| | | // ä»mapä¸å¾å°å¯¹åºåçfield. |
| | | Field field = (Field) entry.getValue()[0]; |
| | | Excel attr = (Excel) entry.getValue()[1]; |
| | | // åå¾ç±»å,å¹¶æ ¹æ®å¯¹è±¡ç±»å设置å¼. |
| | | Class<?> fieldType = field.getType(); |
| | | if (String.class == fieldType) |
| | | { |
| | | String s = Convert.toStr(val); |
| | | if (s.matches("^\\d+\\.0$")) |
| | | { |
| | | val = StringUtils.substringBefore(s, ".0"); |
| | | } |
| | | else |
| | | { |
| | | String dateFormat = field.getAnnotation(Excel.class).dateFormat(); |
| | | if (StringUtils.isNotEmpty(dateFormat)) |
| | | { |
| | | val = parseDateToStr(dateFormat, val); |
| | | } |
| | | else |
| | | { |
| | | val = Convert.toStr(val); |
| | | } |
| | | } |
| | | } |
| | | else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) |
| | | { |
| | | val = Convert.toInt(val); |
| | | } |
| | | else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) |
| | | { |
| | | val = Convert.toLong(val); |
| | | } |
| | | else if (Double.TYPE == fieldType || Double.class == fieldType) |
| | | { |
| | | val = Convert.toDouble(val); |
| | | } |
| | | else if (Float.TYPE == fieldType || Float.class == fieldType) |
| | | { |
| | | val = Convert.toFloat(val); |
| | | } |
| | | else if (BigDecimal.class == fieldType) |
| | | { |
| | | val = Convert.toBigDecimal(val); |
| | | } |
| | | else if (Date.class == fieldType) |
| | | { |
| | | if (val instanceof String) |
| | | { |
| | | val = DateUtils.parseDate(val); |
| | | } |
| | | else if (val instanceof Double) |
| | | { |
| | | val = DateUtil.getJavaDate((Double) val); |
| | | } |
| | | } |
| | | else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) |
| | | { |
| | | val = Convert.toBool(val, false); |
| | | } |
| | | if (StringUtils.isNotNull(fieldType)) |
| | | { |
| | | String propertyName = field.getName(); |
| | | if (StringUtils.isNotEmpty(attr.targetAttr())) |
| | | { |
| | | propertyName = field.getName() + "." + attr.targetAttr(); |
| | | } |
| | | if (StringUtils.isNotEmpty(attr.readConverterExp())) |
| | | { |
| | | val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); |
| | | } |
| | | else if (StringUtils.isNotEmpty(attr.dictType())) |
| | | { |
| | | if (!sysDictMap.containsKey(attr.dictType() + val)) |
| | | { |
| | | String dictValue = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator()); |
| | | sysDictMap.put(attr.dictType() + val, dictValue); |
| | | } |
| | | val = sysDictMap.get(attr.dictType() + val); |
| | | } |
| | | else if (!attr.handler().equals(ExcelHandlerAdapter.class)) |
| | | { |
| | | val = dataFormatHandlerAdapter(val, attr, null); |
| | | } |
| | | else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures)) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | List<PictureData> images = pictures.get(row.getRowNum() + "_" + entry.getKey()); |
| | | for (PictureData picture : images) |
| | | { |
| | | byte[] data = picture.getData(); |
| | | String fileName = FileUtils.writeImportBytes(data); |
| | | propertyString.append(fileName).append(SEPARATOR); |
| | | } |
| | | val = StringUtils.stripEnd(propertyString.toString(), SEPARATOR); |
| | | } |
| | | ReflectUtils.invokeSetter(entity, propertyName, val); |
| | | } |
| | | } |
| | | list.add(entity); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param list å¯¼åºæ°æ®éå |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @return ç»æ |
| | | */ |
| | | public AjaxResult exportExcel(List<T> list, String sheetName) |
| | | { |
| | | return exportExcel(list, sheetName, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param list å¯¼åºæ°æ®éå |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @param title æ é¢ |
| | | * @return ç»æ |
| | | */ |
| | | public AjaxResult exportExcel(List<T> list, String sheetName, String title) |
| | | { |
| | | this.init(list, sheetName, title, Type.EXPORT); |
| | | return exportExcel(); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param response è¿åæ°æ® |
| | | * @param list å¯¼åºæ°æ®éå |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @return ç»æ |
| | | */ |
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) |
| | | { |
| | | exportExcel(response, list, sheetName, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param response è¿åæ°æ® |
| | | * @param list å¯¼åºæ°æ®éå |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @param title æ é¢ |
| | | * @return ç»æ |
| | | */ |
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) |
| | | { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | this.init(list, sheetName, title, Type.EXPORT); |
| | | exportExcel(response); |
| | | } |
| | | |
| | | /** |
| | | * å¤ Sheet å¯¼åº ââ å°å¤ä¸ªä¸åç±»åçæ°æ®éååå
¥åä¸ Excelï¼ç´æ¥è¾åºå° HttpServletResponse |
| | | * |
| | | * @param response HTTP ååº |
| | | * @param sheets Sheet æè¿°å表 |
| | | */ |
| | | public static void exportMultiSheet(HttpServletResponse response, List<ExcelSheet<?>> sheets) |
| | | { |
| | | if (sheets == null || sheets.isEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | SXSSFWorkbook wb = buildWorkbook(sheets); |
| | | try |
| | | { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | wb.write(response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("å¤Sheet导åºExcelå¼å¸¸{}", e.getMessage()); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(wb); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤ Sheet å¯¼åº ââ å°å¤ä¸ªä¸åç±»åçæ°æ®éååå
¥åä¸ Excelï¼çææä»¶å¹¶è¿åä¸è½½å°å |
| | | * |
| | | * @param sheets Sheet æè¿°å表 |
| | | * @return AjaxResultï¼å«æä»¶ä¸è½½å°åï¼ |
| | | */ |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | public static AjaxResult exportMultiSheet(List<ExcelSheet<?>> sheets) |
| | | { |
| | | if (sheets == null || sheets.isEmpty()) |
| | | { |
| | | return AjaxResult.error("å¯¼åºæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | SXSSFWorkbook wb = buildWorkbook(sheets); |
| | | OutputStream out = null; |
| | | try |
| | | { |
| | | ExcelUtil firstUtil = new ExcelUtil(sheets.get(0).getClazz()); |
| | | String filename = firstUtil.encodingFilename(sheets.get(0).getSheetName()); |
| | | out = new FileOutputStream(firstUtil.getAbsoluteFile(filename)); |
| | | wb.write(out); |
| | | return AjaxResult.success(filename); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("å¤Sheet导åºExcelå¼å¸¸{}", e.getMessage()); |
| | | throw new UtilException("导åºExcel失败ï¼è¯·èç³»ç½ç«ç®¡çåï¼"); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(wb); |
| | | IOUtils.closeQuietly(out); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå¤ Sheet Workbook ââ å建 SXSSFWorkbook å¹¶å°ææ Sheet æ°æ®åå
¥ |
| | | * |
| | | * @param sheets Sheet æè¿°å表 |
| | | * @return å·²åå
¥ææ Sheet æ°æ®ç SXSSFWorkbook |
| | | */ |
| | | @SuppressWarnings({ "rawtypes", "unchecked" }) |
| | | private static SXSSFWorkbook buildWorkbook(List<ExcelSheet<?>> sheets) |
| | | { |
| | | SXSSFWorkbook wb = new SXSSFWorkbook(500); |
| | | for (ExcelSheet<?> excelSheet : sheets) |
| | | { |
| | | ExcelUtil util = new ExcelUtil(excelSheet.getClazz()); |
| | | util.initWithWorkbook(wb, excelSheet.getList(), excelSheet.getSheetName(), excelSheet.getTitle()); |
| | | util.writeSheet(); |
| | | } |
| | | return wb; |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨å¤é¨ä¼ å
¥ç Workbook åå§åï¼å¤ Sheet 导åºä¸ç¨ï¼ |
| | | * ä¸ init() çåºå«ï¼ä¸æ°å»º Workbookï¼èæ¯å¨å·²æ wb ä¸è¿½å æ° Sheet |
| | | * |
| | | * @param wb å·²æå·¥ä½ç°¿ |
| | | * @param list æ°æ®éå |
| | | * @param sheetName Sheet åç§° |
| | | * @param title 大æ é¢ï¼å¯ä¸ºç©ºï¼ |
| | | */ |
| | | public void initWithWorkbook(SXSSFWorkbook wb, List<T> list, String sheetName, String title) |
| | | { |
| | | if (list == null) |
| | | { |
| | | list = new ArrayList<T>(); |
| | | } |
| | | this.list = list; |
| | | this.sheetName = sheetName; |
| | | this.title = title != null ? title : ""; |
| | | this.type = Type.EXPORT; |
| | | this.rownum = 0; |
| | | this.wb = wb; |
| | | this.sheet = wb.createSheet(sheetName); |
| | | createExcelField(); |
| | | this.styles = createStyles(wb); |
| | | createTitle(); |
| | | createSubHead(); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @return ç»æ |
| | | */ |
| | | public AjaxResult importTemplateExcel(String sheetName) |
| | | { |
| | | return importTemplateExcel(sheetName, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @param title æ é¢ |
| | | * @return ç»æ |
| | | */ |
| | | public AjaxResult importTemplateExcel(String sheetName, String title) |
| | | { |
| | | this.init(null, sheetName, title, Type.IMPORT); |
| | | return exportExcel(); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @return ç»æ |
| | | */ |
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName) |
| | | { |
| | | importTemplateExcel(response, sheetName, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @param sheetName å·¥ä½è¡¨çåç§° |
| | | * @param title æ é¢ |
| | | * @return ç»æ |
| | | */ |
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) |
| | | { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | this.init(null, sheetName, title, Type.IMPORT); |
| | | exportExcel(response); |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public void exportExcel(HttpServletResponse response) |
| | | { |
| | | try |
| | | { |
| | | writeSheet(); |
| | | wb.write(response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("导åºExcelå¼å¸¸{}", e.getMessage()); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(wb); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public AjaxResult exportExcel() |
| | | { |
| | | OutputStream out = null; |
| | | try |
| | | { |
| | | writeSheet(); |
| | | String filename = encodingFilename(sheetName); |
| | | out = new FileOutputStream(getAbsoluteFile(filename)); |
| | | wb.write(out); |
| | | return AjaxResult.success(filename); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("导åºExcelå¼å¸¸{}", e.getMessage()); |
| | | throw new UtilException("导åºExcel失败ï¼è¯·èç³»ç½ç«ç®¡çåï¼"); |
| | | } |
| | | finally |
| | | { |
| | | IOUtils.closeQuietly(wb); |
| | | IOUtils.closeQuietly(out); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建åå
¥æ°æ®å°Sheet |
| | | */ |
| | | public void writeSheet() |
| | | { |
| | | // ååºä¸å
±æå¤å°ä¸ªsheet. |
| | | int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize)); |
| | | for (int index = 0; index < sheetNo; index++) |
| | | { |
| | | createSheet(sheetNo, index); |
| | | |
| | | // 产çä¸è¡ |
| | | Row row = sheet.createRow(rownum); |
| | | int column = 0; |
| | | // åå
¥åä¸ªåæ®µçå头åç§° |
| | | for (Object[] os : fields) |
| | | { |
| | | Field field = (Field) os[0]; |
| | | Excel excel = (Excel) os[1]; |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | List<Field> currentSubFields = subFieldsMap.get(field.getName()); |
| | | for (Field subField : currentSubFields) |
| | | { |
| | | Excel subExcel = subField.getAnnotation(Excel.class); |
| | | this.createHeadCell(subExcel, row, column++); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | this.createHeadCell(excel, row, column++); |
| | | } |
| | | } |
| | | if (Type.EXPORT.equals(type)) |
| | | { |
| | | fillExcelData(index); |
| | | addStatisticsRow(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¡«å
excelæ°æ® |
| | | * |
| | | * @param index åºå· |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public void fillExcelData(int index) |
| | | { |
| | | int startNo = index * sheetSize; |
| | | int endNo = Math.min(startNo + sheetSize, list.size()); |
| | | int currentRowNum = rownum + 1; // 仿 é¢è¡åå¼å§ |
| | | |
| | | for (int i = startNo; i < endNo; i++) |
| | | { |
| | | Row row = sheet.createRow(currentRowNum); |
| | | T vo = (T) list.get(i); |
| | | int column = 0; |
| | | int maxSubListSize = getCurrentMaxSubListSize(vo); |
| | | for (Object[] os : fields) |
| | | { |
| | | Field field = (Field) os[0]; |
| | | Excel excel = (Excel) os[1]; |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | try |
| | | { |
| | | Collection<?> subList = (Collection<?>) getTargetValue(vo, field, excel); |
| | | List<Field> currentSubFields = subFieldsMap.get(field.getName()); |
| | | if (subList != null && !subList.isEmpty()) |
| | | { |
| | | int subIndex = 0; |
| | | for (Object subVo : subList) |
| | | { |
| | | Row subRow = sheet.getRow(currentRowNum + subIndex); |
| | | if (subRow == null) |
| | | { |
| | | subRow = sheet.createRow(currentRowNum + subIndex); |
| | | } |
| | | |
| | | int subColumn = column; |
| | | for (Field subField : currentSubFields) |
| | | { |
| | | Excel subExcel = subField.getAnnotation(Excel.class); |
| | | addCell(subExcel, subRow, (T) subVo, subField, subColumn++); |
| | | } |
| | | subIndex++; |
| | | } |
| | | } |
| | | column += currentSubFields.size(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("å¡«å
éåæ°æ®å¤±è´¥", e); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // å建åå
æ ¼å¹¶è®¾ç½®å¼ |
| | | addCell(excel, row, vo, field, column); |
| | | if (maxSubListSize > 1 && excel.needMerge()) |
| | | { |
| | | sheet.addMergedRegion(new CellRangeAddress(currentRowNum, currentRowNum + maxSubListSize - 1, column, column)); |
| | | } |
| | | column++; |
| | | } |
| | | } |
| | | currentRowNum += maxSubListSize; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·ååå表æå¤§æ° |
| | | */ |
| | | private int getCurrentMaxSubListSize(T vo) |
| | | { |
| | | int maxSubListSize = 1; |
| | | for (Object[] os : fields) |
| | | { |
| | | Field field = (Field) os[0]; |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | try |
| | | { |
| | | Collection<?> subList = (Collection<?>) getTargetValue(vo, field, (Excel) os[1]); |
| | | if (subList != null && !subList.isEmpty()) |
| | | { |
| | | maxSubListSize = Math.max(maxSubListSize, subList.size()); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è·åéå大å°å¤±è´¥", e); |
| | | } |
| | | } |
| | | } |
| | | return maxSubListSize; |
| | | } |
| | | |
| | | /** |
| | | * åå»ºè¡¨æ ¼æ ·å¼ |
| | | * |
| | | * @param wb å·¥ä½è对象 |
| | | * @return æ ·å¼å表 |
| | | */ |
| | | private Map<String, CellStyle> createStyles(Workbook wb) |
| | | { |
| | | // åå
¥åæ¡è®°å½,æ¯æ¡è®°å½å¯¹åºexcel表ä¸çä¸è¡ |
| | | Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | Font titleFont = wb.createFont(); |
| | | titleFont.setFontName("Arial"); |
| | | titleFont.setFontHeightInPoints((short) 16); |
| | | titleFont.setBold(true); |
| | | style.setFont(titleFont); |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | styles.put("title", style); |
| | | |
| | | style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | Font dataFont = wb.createFont(); |
| | | dataFont.setFontName("Arial"); |
| | | dataFont.setFontHeightInPoints((short) 10); |
| | | style.setFont(dataFont); |
| | | styles.put("data", style); |
| | | |
| | | style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setDataFormat(dataFormat.getFormat("######0.00")); |
| | | Font totalFont = wb.createFont(); |
| | | totalFont.setFontName("Arial"); |
| | | totalFont.setFontHeightInPoints((short) 10); |
| | | style.setFont(totalFont); |
| | | styles.put("total", style); |
| | | |
| | | styles.putAll(annotationHeaderStyles(wb, styles)); |
| | | |
| | | styles.putAll(annotationDataStyles(wb)); |
| | | |
| | | return styles; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®Excel注解åå»ºè¡¨æ ¼å¤´æ ·å¼ |
| | | * |
| | | * @param wb å·¥ä½è对象 |
| | | * @return èªå®ä¹æ ·å¼å表 |
| | | */ |
| | | private Map<String, CellStyle> annotationHeaderStyles(Workbook wb, Map<String, CellStyle> styles) |
| | | { |
| | | Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>(); |
| | | for (Object[] os : fields) |
| | | { |
| | | Excel excel = (Excel) os[1]; |
| | | String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor()); |
| | | if (!headerStyles.containsKey(key)) |
| | | { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.cloneStyleFrom(styles.get("data")); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setFillForegroundColor(excel.headerBackgroundColor().getIndex()); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | Font headerFont = wb.createFont(); |
| | | headerFont.setFontName("Arial"); |
| | | headerFont.setFontHeightInPoints((short) 10); |
| | | headerFont.setBold(true); |
| | | headerFont.setColor(excel.headerColor().getIndex()); |
| | | style.setFont(headerFont); |
| | | // è®¾ç½®è¡¨æ ¼å¤´åå
æ ¼ææ¬å½¢å¼ |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | headerStyles.put(key, style); |
| | | } |
| | | } |
| | | return headerStyles; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®Excel注解åå»ºè¡¨æ ¼åæ ·å¼ |
| | | * |
| | | * @param wb å·¥ä½è对象 |
| | | * @return èªå®ä¹æ ·å¼å表 |
| | | */ |
| | | private Map<String, CellStyle> annotationDataStyles(Workbook wb) |
| | | { |
| | | Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); |
| | | for (Object[] os : fields) |
| | | { |
| | | Field field = (Field) os[0]; |
| | | Excel excel = (Excel) os[1]; |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | ParameterizedType pt = (ParameterizedType) field.getGenericType(); |
| | | Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0]; |
| | | List<Field> subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class); |
| | | for (Field subField : subFields) |
| | | { |
| | | Excel subExcel = subField.getAnnotation(Excel.class); |
| | | annotationDataStyles(styles, subField, subExcel); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | annotationDataStyles(styles, field, excel); |
| | | } |
| | | } |
| | | return styles; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®Excel注解åå»ºè¡¨æ ¼åæ ·å¼ |
| | | * |
| | | * @param styles èªå®ä¹æ ·å¼å表 |
| | | * @param field 屿§åä¿¡æ¯ |
| | | * @param excel æ³¨è§£ä¿¡æ¯ |
| | | */ |
| | | public void annotationDataStyles(Map<String, CellStyle> styles, Field field, Excel excel) |
| | | { |
| | | String key = StringUtils.format("data_{}_{}_{}_{}_{}", excel.align(), excel.color(), excel.backgroundColor(), excel.cellType(), excel.wrapText()); |
| | | if (!styles.containsKey(key)) |
| | | { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.setAlignment(excel.align()); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | style.setFillForegroundColor(excel.backgroundColor().getIndex()); |
| | | style.setWrapText(excel.wrapText()); |
| | | Font dataFont = wb.createFont(); |
| | | dataFont.setFontName("Arial"); |
| | | dataFont.setFontHeightInPoints((short) 10); |
| | | dataFont.setColor(excel.color().getIndex()); |
| | | style.setFont(dataFont); |
| | | if (ColumnType.TEXT == excel.cellType()) |
| | | { |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | } |
| | | styles.put(key, style); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建åå
æ ¼ |
| | | */ |
| | | public Cell createHeadCell(Excel attr, Row row, int column) |
| | | { |
| | | // å建å |
| | | Cell cell = row.createCell(column); |
| | | // åå
¥åä¿¡æ¯ |
| | | cell.setCellValue(attr.name()); |
| | | setDataValidation(attr, row, column); |
| | | cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); |
| | | if (isSubList()) |
| | | { |
| | | // å¡«å
é»è®¤æ ·å¼ï¼é²æ¢åå¹¶åå
æ ¼æ ·å¼å¤±æ |
| | | sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText()))); |
| | | if (attr.needMerge()) |
| | | { |
| | | sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column)); |
| | | } |
| | | } |
| | | return cell; |
| | | } |
| | | |
| | | /** |
| | | * 设置åå
æ ¼ä¿¡æ¯ |
| | | * |
| | | * @param value åå
æ ¼å¼ |
| | | * @param attr 注解ç¸å
³ |
| | | * @param cell åå
æ ¼ä¿¡æ¯ |
| | | */ |
| | | public void setCellVo(Object value, Excel attr, Cell cell) |
| | | { |
| | | if (ColumnType.STRING == attr.cellType() || ColumnType.TEXT == attr.cellType()) |
| | | { |
| | | String cellValue = Convert.toStr(value); |
| | | // 对äºä»»ä½ä»¥è¡¨è¾¾å¼è§¦åå符 =-+@å¼å¤´çåå
æ ¼ï¼ç´æ¥ä½¿ç¨tabå符ä½ä¸ºåç¼ï¼é²æ¢CSV注å
¥ã |
| | | if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) |
| | | { |
| | | cellValue = RegExUtils.replaceFirst(cellValue, FORMULA_REGEX_STR, "\t$0"); |
| | | } |
| | | if (value instanceof Collection && StringUtils.equals("[]", cellValue)) |
| | | { |
| | | cellValue = StringUtils.EMPTY; |
| | | } |
| | | cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix()); |
| | | } |
| | | else if (ColumnType.NUMERIC == attr.cellType()) |
| | | { |
| | | if (StringUtils.isNotNull(value)) |
| | | { |
| | | cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); |
| | | } |
| | | } |
| | | else if (ColumnType.IMAGE == attr.cellType()) |
| | | { |
| | | ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1); |
| | | String propertyValue = Convert.toStr(value); |
| | | if (StringUtils.isNotEmpty(propertyValue)) |
| | | { |
| | | List<String> imagePaths = StringUtils.str2List(propertyValue, SEPARATOR); |
| | | for (String imagePath : imagePaths) |
| | | { |
| | | byte[] data = ImageUtils.getImage(imagePath); |
| | | getDrawingPatriarch(cell.getSheet()).createPicture(anchor, cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åç»å¸ |
| | | */ |
| | | public static Drawing<?> getDrawingPatriarch(Sheet sheet) |
| | | { |
| | | if (sheet.getDrawingPatriarch() == null) |
| | | { |
| | | sheet.createDrawingPatriarch(); |
| | | } |
| | | return sheet.getDrawingPatriarch(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¾çç±»å,设置å¾çæå
¥ç±»å |
| | | */ |
| | | public int getImageType(byte[] value) |
| | | { |
| | | String type = FileTypeUtils.getFileExtendName(value); |
| | | if ("JPG".equalsIgnoreCase(type)) |
| | | { |
| | | return Workbook.PICTURE_TYPE_JPEG; |
| | | } |
| | | else if ("PNG".equalsIgnoreCase(type)) |
| | | { |
| | | return Workbook.PICTURE_TYPE_PNG; |
| | | } |
| | | return Workbook.PICTURE_TYPE_JPEG; |
| | | } |
| | | |
| | | /** |
| | | * åå»ºè¡¨æ ¼æ ·å¼ |
| | | */ |
| | | public void setDataValidation(Excel attr, Row row, int column) |
| | | { |
| | | if (attr.name().indexOf("注ï¼") >= 0) |
| | | { |
| | | sheet.setColumnWidth(column, 6000); |
| | | } |
| | | else |
| | | { |
| | | // 设置å宽 |
| | | sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); |
| | | } |
| | | if (StringUtils.isNotEmpty(attr.prompt()) || attr.combo().length > 0 || attr.comboReadDict()) |
| | | { |
| | | String[] comboArray = attr.combo(); |
| | | if (attr.comboReadDict()) |
| | | { |
| | | if (!sysDictMap.containsKey("combo_" + attr.dictType())) |
| | | { |
| | | String labels = DictUtils.getDictLabels(attr.dictType()); |
| | | sysDictMap.put("combo_" + attr.dictType(), labels); |
| | | } |
| | | String val = sysDictMap.get("combo_" + attr.dictType()); |
| | | comboArray = StringUtils.split(val, DictUtils.SEPARATOR); |
| | | } |
| | | if (comboArray.length > 15 || StringUtils.join(comboArray).length() > 255) |
| | | { |
| | | // 妿䏿æ°å¤§äº15æå符串é¿åº¦å¤§äº255ï¼å使ç¨ä¸ä¸ªæ°sheetåå¨ï¼é¿å
çæç模æ¿ä¸æå¼è·åä¸å° |
| | | setXSSFValidationWithHidden(sheet, comboArray, attr.prompt(), 1, 100, column, column); |
| | | } |
| | | else |
| | | { |
| | | // æç¤ºä¿¡æ¯æåªè½éæ©ä¸è½è¾å
¥çåå
容. |
| | | setPromptOrValidation(sheet, comboArray, attr.prompt(), 1, 100, column, column); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åå
æ ¼ |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public Cell addCell(Excel attr, Row row, T vo, Field field, int column) |
| | | { |
| | | Cell cell = null; |
| | | try |
| | | { |
| | | // 设置è¡é« |
| | | row.setHeight(maxHeight); |
| | | // æ ¹æ®Excelä¸è®¾ç½®æ
åµå³å®æ¯å¦å¯¼åº,æäºæ
åµéè¦ä¿æä¸ºç©º,å¸æç¨æ·å¡«åè¿ä¸å. |
| | | if (attr.isExport()) |
| | | { |
| | | // å建cell |
| | | cell = row.createCell(column); |
| | | if (isSubListValue(vo) && getListCellValue(vo) > 1 && attr.needMerge()) |
| | | { |
| | | if (subMergedLastRowNum >= subMergedFirstRowNum) |
| | | { |
| | | sheet.addMergedRegion(new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column)); |
| | | } |
| | | } |
| | | cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText()))); |
| | | |
| | | // ç¨äºè¯»å对象ä¸ç屿§ |
| | | Object value = getTargetValue(vo, field, attr); |
| | | String dateFormat = attr.dateFormat(); |
| | | String readConverterExp = attr.readConverterExp(); |
| | | String separator = attr.separator(); |
| | | String dictType = attr.dictType(); |
| | | if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) |
| | | { |
| | | cell.setCellStyle(createCellStyle(cell.getCellStyle(), dateFormat)); |
| | | cell.setCellValue(parseDateToStr(dateFormat, value)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) |
| | | { |
| | | cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) |
| | | { |
| | | if (!sysDictMap.containsKey(dictType + value)) |
| | | { |
| | | String lable = convertDictByExp(Convert.toStr(value), dictType, separator); |
| | | sysDictMap.put(dictType + value, lable); |
| | | } |
| | | cell.setCellValue(sysDictMap.get(dictType + value)); |
| | | } |
| | | else if (value instanceof BigDecimal && -1 != attr.scale()) |
| | | { |
| | | cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue()); |
| | | } |
| | | else if (!attr.handler().equals(ExcelHandlerAdapter.class)) |
| | | { |
| | | cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell)); |
| | | } |
| | | else |
| | | { |
| | | // 设置åç±»å |
| | | setCellVo(value, attr, cell); |
| | | } |
| | | addStatisticsData(column, Convert.toStr(value), attr); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("导åºExcel失败{}", e); |
| | | } |
| | | return cell; |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨èªå®ä¹æ ¼å¼ï¼åæ¶é¿å
æ ·å¼æ±¡æ |
| | | * |
| | | * @param cellStyle 仿¤æ ·å¼å¤å¶ |
| | | * @param format æ ¼å¼å¹é
çå符串 |
| | | * @return æ ¼å¼ååCellStyle对象 |
| | | */ |
| | | private CellStyle createCellStyle(CellStyle cellStyle, String format) |
| | | { |
| | | String key = cellStyle.getIndex() + "|" + format; |
| | | CellStyle cached = cellStyleCache.get(key); |
| | | if (cached != null) |
| | | { |
| | | return cached; |
| | | } |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.cloneStyleFrom(cellStyle); |
| | | style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format)); |
| | | cellStyleCache.put(key, style); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * 设置 POI XSSFSheet åå
æ ¼æç¤ºæéæ©æ¡ |
| | | * |
| | | * @param sheet 表å |
| | | * @param textlist ä¸ææ¡æ¾ç¤ºçå
容 |
| | | * @param promptContent æç¤ºå
容 |
| | | * @param firstRow å¼å§è¡ |
| | | * @param endRow ç»æè¡ |
| | | * @param firstCol å¼å§å |
| | | * @param endCol ç»æå |
| | | */ |
| | | public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, |
| | | int firstCol, int endCol) |
| | | { |
| | | DataValidationHelper helper = sheet.getDataValidationHelper(); |
| | | DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1"); |
| | | CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); |
| | | DataValidation dataValidation = helper.createValidation(constraint, regions); |
| | | if (StringUtils.isNotEmpty(promptContent)) |
| | | { |
| | | // å¦æè®¾ç½®äºæç¤ºä¿¡æ¯åé¼ æ æ¾ä¸å»æç¤º |
| | | dataValidation.createPromptBox("", promptContent); |
| | | dataValidation.setShowPromptBox(true); |
| | | } |
| | | // å¤çExcelå
¼å®¹æ§é®é¢ |
| | | if (dataValidation instanceof XSSFDataValidation) |
| | | { |
| | | dataValidation.setSuppressDropDownArrow(true); |
| | | dataValidation.setShowErrorBox(true); |
| | | } |
| | | else |
| | | { |
| | | dataValidation.setSuppressDropDownArrow(false); |
| | | } |
| | | sheet.addValidationData(dataValidation); |
| | | } |
| | | |
| | | /** |
| | | * 设置æäºåçå¼åªè½è¾å
¥é¢å¶çæ°æ®,æ¾ç¤ºä¸ææ¡ï¼å
¼å®¹è¶
åºä¸å®æ°éç䏿æ¡ï¼. |
| | | * |
| | | * @param sheet è¦è®¾ç½®çsheet. |
| | | * @param textlist ä¸ææ¡æ¾ç¤ºçå
容 |
| | | * @param promptContent æç¤ºå
容 |
| | | * @param firstRow å¼å§è¡ |
| | | * @param endRow ç»æè¡ |
| | | * @param firstCol å¼å§å |
| | | * @param endCol ç»æå |
| | | */ |
| | | public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) |
| | | { |
| | | String hideSheetName = "combo_" + firstCol + "_" + endCol; |
| | | Sheet hideSheet = null; |
| | | String hideSheetDataName = hideSheetName + "_data"; |
| | | Name name = wb.getName(hideSheetDataName); |
| | | if (name != null) |
| | | { |
| | | // åç§°å·²åå¨ï¼å°è¯ä»åç§°çå¼ç¨ä¸æ¾å°sheetåç§° |
| | | String refersToFormula = name.getRefersToFormula(); |
| | | if (StringUtils.isNotEmpty(refersToFormula) && refersToFormula.contains("!")) |
| | | { |
| | | String sheetNameFromFormula = refersToFormula.substring(0, refersToFormula.indexOf("!")); |
| | | hideSheet = wb.getSheet(sheetNameFromFormula); |
| | | } |
| | | } |
| | | |
| | | if (hideSheet == null) |
| | | { |
| | | hideSheet = wb.createSheet(hideSheetName); // ç¨äºåå¨ ä¸æèåæ°æ® |
| | | for (int i = 0; i < textlist.length; i++) |
| | | { |
| | | hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]); |
| | | } |
| | | // å建åç§°ï¼å¯è¢«å
¶ä»åå
æ ¼å¼ç¨ |
| | | name = wb.createName(); |
| | | name.setNameName(hideSheetDataName); |
| | | name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length); |
| | | } |
| | | |
| | | DataValidationHelper helper = sheet.getDataValidationHelper(); |
| | | // å è½½ä¸æå表å
容 |
| | | DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetDataName); |
| | | // è®¾ç½®æ°æ®æææ§å è½½å¨åªä¸ªåå
æ ¼ä¸,åä¸ªåæ°å嫿¯ï¼èµ·å§è¡ãç»æ¢è¡ãèµ·å§åãç»æ¢å |
| | | CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); |
| | | // æ°æ®æææ§å¯¹è±¡ |
| | | DataValidation dataValidation = helper.createValidation(constraint, regions); |
| | | if (StringUtils.isNotEmpty(promptContent)) |
| | | { |
| | | // å¦æè®¾ç½®äºæç¤ºä¿¡æ¯åé¼ æ æ¾ä¸å»æç¤º |
| | | dataValidation.createPromptBox("", promptContent); |
| | | dataValidation.setShowPromptBox(true); |
| | | } |
| | | // å¤çExcelå
¼å®¹æ§é®é¢ |
| | | if (dataValidation instanceof XSSFDataValidation) |
| | | { |
| | | dataValidation.setSuppressDropDownArrow(true); |
| | | dataValidation.setShowErrorBox(true); |
| | | } |
| | | else |
| | | { |
| | | dataValidation.setSuppressDropDownArrow(false); |
| | | } |
| | | |
| | | sheet.addValidationData(dataValidation); |
| | | // 设置hiddenSheetéè |
| | | wb.setSheetHidden(wb.getSheetIndex(hideSheet), true); |
| | | } |
| | | |
| | | /** |
| | | * è§£æå¯¼åºå¼ 0=ç·,1=女,2=æªç¥ |
| | | * |
| | | * @param propertyValue åæ°å¼ |
| | | * @param converterExp ç¿»è¯æ³¨è§£ |
| | | * @param separator åé符 |
| | | * @return è§£æåå¼ |
| | | */ |
| | | public static String convertByExp(String propertyValue, String converterExp, String separator) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | String[] convertSource = converterExp.split(SEPARATOR); |
| | | for (String item : convertSource) |
| | | { |
| | | String[] itemArray = item.split("="); |
| | | if (StringUtils.containsAny(propertyValue, separator)) |
| | | { |
| | | for (String value : propertyValue.split(separator)) |
| | | { |
| | | if (itemArray[0].equals(value)) |
| | | { |
| | | propertyString.append(itemArray[1] + separator); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (itemArray[0].equals(propertyValue)) |
| | | { |
| | | return itemArray[1]; |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * ååè§£æå¼ ç·=0,女=1,æªç¥=2 |
| | | * |
| | | * @param propertyValue åæ°å¼ |
| | | * @param converterExp ç¿»è¯æ³¨è§£ |
| | | * @param separator åé符 |
| | | * @return è§£æåå¼ |
| | | */ |
| | | public static String reverseByExp(String propertyValue, String converterExp, String separator) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | String[] convertSource = converterExp.split(SEPARATOR); |
| | | for (String item : convertSource) |
| | | { |
| | | String[] itemArray = item.split("="); |
| | | if (StringUtils.containsAny(propertyValue, separator)) |
| | | { |
| | | for (String value : propertyValue.split(separator)) |
| | | { |
| | | if (itemArray[1].equals(value)) |
| | | { |
| | | propertyString.append(itemArray[0] + separator); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (itemArray[1].equals(propertyValue)) |
| | | { |
| | | return itemArray[0]; |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * è§£æåå
¸å¼ |
| | | * |
| | | * @param dictValue åå
¸å¼ |
| | | * @param dictType åå
¸ç±»å |
| | | * @param separator åé符 |
| | | * @return åå
¸æ ç¾ |
| | | */ |
| | | public static String convertDictByExp(String dictValue, String dictType, String separator) |
| | | { |
| | | return DictUtils.getDictLabel(dictType, dictValue, separator); |
| | | } |
| | | |
| | | /** |
| | | * ååè§£æå¼åå
¸å¼ |
| | | * |
| | | * @param dictLabel åå
¸æ ç¾ |
| | | * @param dictType åå
¸ç±»å |
| | | * @param separator åé符 |
| | | * @return åå
¸å¼ |
| | | */ |
| | | public static String reverseDictByExp(String dictLabel, String dictType, String separator) |
| | | { |
| | | return DictUtils.getDictValue(dictType, dictLabel, separator); |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¤çå¨ |
| | | * |
| | | * @param value æ°æ®å¼ |
| | | * @param excel æ°æ®æ³¨è§£ |
| | | * @return |
| | | */ |
| | | public String dataFormatHandlerAdapter(Object value, Excel excel, Cell cell) |
| | | { |
| | | try |
| | | { |
| | | Object instance = excel.handler().getDeclaredConstructor().newInstance(); |
| | | Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class }); |
| | | value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("ä¸è½æ ¼å¼åæ°æ® " + excel.handler(), e.getMessage()); |
| | | } |
| | | return Convert.toStr(value); |
| | | } |
| | | |
| | | /** |
| | | * å计ç»è®¡ä¿¡æ¯ |
| | | */ |
| | | private void addStatisticsData(Integer index, String text, Excel entity) |
| | | { |
| | | if (entity != null && entity.isStatistics()) |
| | | { |
| | | Double temp = 0D; |
| | | if (!statistics.containsKey(index)) |
| | | { |
| | | statistics.put(index, temp); |
| | | } |
| | | try |
| | | { |
| | | temp = Double.valueOf(text); |
| | | } |
| | | catch (NumberFormatException e) |
| | | { |
| | | } |
| | | statistics.put(index, statistics.get(index) + temp); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建ç»è®¡è¡ |
| | | */ |
| | | public void addStatisticsRow() |
| | | { |
| | | if (statistics.size() > 0) |
| | | { |
| | | Row row = sheet.createRow(sheet.getLastRowNum() + 1); |
| | | Set<Integer> keys = statistics.keySet(); |
| | | Cell cell = row.createCell(0); |
| | | cell.setCellStyle(styles.get("total")); |
| | | cell.setCellValue("å计"); |
| | | |
| | | for (Integer key : keys) |
| | | { |
| | | cell = row.createCell(key); |
| | | cell.setCellStyle(styles.get("total")); |
| | | cell.setCellValue(statistics.get(key)); |
| | | } |
| | | statistics.clear(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç¼ç æä»¶å |
| | | */ |
| | | public String encodingFilename(String filename) |
| | | { |
| | | return UUID.randomUUID() + "_" + filename + ".xlsx"; |
| | | } |
| | | |
| | | /** |
| | | * è·åä¸è½½è·¯å¾ |
| | | * |
| | | * @param filename æä»¶åç§° |
| | | */ |
| | | public String getAbsoluteFile(String filename) |
| | | { |
| | | String downloadPath = RuoYiConfig.getDownloadPath() + filename; |
| | | File desc = new File(downloadPath); |
| | | if (!desc.getParentFile().exists()) |
| | | { |
| | | desc.getParentFile().mkdirs(); |
| | | } |
| | | return downloadPath; |
| | | } |
| | | |
| | | /** |
| | | * è·åbeanä¸ç屿§å¼ |
| | | * |
| | | * @param vo å®ä½å¯¹è±¡ |
| | | * @param field åæ®µ |
| | | * @param excel 注解 |
| | | * @return æç»ç屿§å¼ |
| | | * @throws Exception |
| | | */ |
| | | private Object getTargetValue(T vo, Field field, Excel excel) throws Exception |
| | | { |
| | | field.setAccessible(true); |
| | | Object o = field.get(vo); |
| | | if (StringUtils.isNotEmpty(excel.targetAttr())) |
| | | { |
| | | String target = excel.targetAttr(); |
| | | if (target.contains(".")) |
| | | { |
| | | String[] targets = target.split("[.]"); |
| | | for (String name : targets) |
| | | { |
| | | o = getValue(o, name); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | o = getValue(o, target); |
| | | } |
| | | } |
| | | return o; |
| | | } |
| | | |
| | | /** |
| | | * 以类ç屿§çgetæ¹æ³æ¹æ³å½¢å¼è·åå¼ |
| | | * |
| | | * @param o |
| | | * @param name |
| | | * @return value |
| | | * @throws Exception |
| | | */ |
| | | private Object getValue(Object o, String name) throws Exception |
| | | { |
| | | if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) |
| | | { |
| | | Class<?> clazz = o.getClass(); |
| | | Field field = clazz.getDeclaredField(name); |
| | | field.setAccessible(true); |
| | | o = field.get(o); |
| | | } |
| | | return o; |
| | | } |
| | | |
| | | /** |
| | | * å¾å°ææå®ä¹å段 |
| | | */ |
| | | private void createExcelField() |
| | | { |
| | | this.fields = getFields(); |
| | | this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); |
| | | this.maxHeight = getRowHeight(); |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ®µæ³¨è§£ä¿¡æ¯ |
| | | */ |
| | | public List<Object[]> getFields() |
| | | { |
| | | List<Object[]> fields = new ArrayList<Object[]>(); |
| | | List<Field> tempFields = new ArrayList<>(); |
| | | subFieldsMap = new HashMap<>(); |
| | | subMethods = new HashMap<>(); |
| | | tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); |
| | | tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); |
| | | if (StringUtils.isNotEmpty(includeFields)) |
| | | { |
| | | for (Field field : tempFields) |
| | | { |
| | | if (ArrayUtils.contains(this.includeFields, field.getName()) || field.isAnnotationPresent(Excels.class)) |
| | | { |
| | | addField(fields, field); |
| | | } |
| | | } |
| | | } |
| | | else if (StringUtils.isNotEmpty(excludeFields)) |
| | | { |
| | | for (Field field : tempFields) |
| | | { |
| | | if (!ArrayUtils.contains(this.excludeFields, field.getName())) |
| | | { |
| | | addField(fields, field); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (Field field : tempFields) |
| | | { |
| | | addField(fields, field); |
| | | } |
| | | } |
| | | return fields; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åæ®µä¿¡æ¯ |
| | | */ |
| | | public void addField(List<Object[]> fields, Field field) |
| | | { |
| | | // åæ³¨è§£ |
| | | if (field.isAnnotationPresent(Excel.class)) |
| | | { |
| | | Excel attr = field.getAnnotation(Excel.class); |
| | | if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) |
| | | { |
| | | fields.add(new Object[] { field, attr }); |
| | | } |
| | | if (Collection.class.isAssignableFrom(field.getType())) |
| | | { |
| | | String fieldName = field.getName(); |
| | | subMethods.put(fieldName, getSubMethod(fieldName, clazz)); |
| | | ParameterizedType pt = (ParameterizedType) field.getGenericType(); |
| | | Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0]; |
| | | subFieldsMap.put(fieldName, FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class)); |
| | | } |
| | | } |
| | | |
| | | // 夿³¨è§£ |
| | | if (field.isAnnotationPresent(Excels.class)) |
| | | { |
| | | Excels attrs = field.getAnnotation(Excels.class); |
| | | Excel[] excels = attrs.value(); |
| | | for (Excel attr : excels) |
| | | { |
| | | if (StringUtils.isNotEmpty(includeFields)) |
| | | { |
| | | if (ArrayUtils.contains(this.includeFields, field.getName() + "." + attr.targetAttr()) |
| | | && (attr != null && (attr.type() == Type.ALL || attr.type() == type))) |
| | | { |
| | | fields.add(new Object[] { field, attr }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!ArrayUtils.contains(this.excludeFields, field.getName() + "." + attr.targetAttr()) |
| | | && (attr != null && (attr.type() == Type.ALL || attr.type() == type))) |
| | | { |
| | | fields.add(new Object[] { field, attr }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ³¨è§£è·åæå¤§è¡é« |
| | | */ |
| | | public short getRowHeight() |
| | | { |
| | | double maxHeight = 0; |
| | | for (Object[] os : this.fields) |
| | | { |
| | | Excel excel = (Excel) os[1]; |
| | | maxHeight = Math.max(maxHeight, excel.height()); |
| | | } |
| | | return (short) (maxHeight * 20); |
| | | } |
| | | |
| | | /** |
| | | * å建ä¸ä¸ªå·¥ä½ç°¿ |
| | | */ |
| | | public void createWorkbook() |
| | | { |
| | | this.wb = new SXSSFWorkbook(500); |
| | | this.sheet = wb.createSheet(); |
| | | wb.setSheetName(0, sheetName); |
| | | this.styles = createStyles(wb); |
| | | } |
| | | |
| | | /** |
| | | * å建工ä½è¡¨ |
| | | * |
| | | * @param sheetNo sheetæ°é |
| | | * @param index åºå· |
| | | */ |
| | | public void createSheet(int sheetNo, int index) |
| | | { |
| | | // 设置工ä½è¡¨çåç§°. |
| | | if (sheetNo > 1 && index > 0) |
| | | { |
| | | this.sheet = wb.createSheet(); |
| | | this.createTitle(); |
| | | int actualIndex = wb.getSheetIndex(this.sheet); |
| | | wb.setSheetName(actualIndex, sheetName + index); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
æ ¼å¼ |
| | | * |
| | | * @param row è·åçè¡ |
| | | * @param column è·ååå
æ ¼åå· |
| | | * @return åå
æ ¼å¼ |
| | | */ |
| | | public Object getCellValue(Row row, int column) |
| | | { |
| | | if (row == null) |
| | | { |
| | | return row; |
| | | } |
| | | Object val = ""; |
| | | try |
| | | { |
| | | Cell cell = row.getCell(column); |
| | | if (StringUtils.isNotNull(cell)) |
| | | { |
| | | if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) |
| | | { |
| | | val = cell.getNumericCellValue(); |
| | | if (DateUtil.isCellDateFormatted(cell)) |
| | | { |
| | | val = DateUtil.getJavaDate((Double) val); // POI Excel æ¥ææ ¼å¼è½¬æ¢ |
| | | } |
| | | else |
| | | { |
| | | if ((Double) val % 1 != 0) |
| | | { |
| | | val = new BigDecimal(val.toString()); |
| | | } |
| | | else |
| | | { |
| | | val = new DecimalFormat("0").format(val); |
| | | } |
| | | } |
| | | } |
| | | else if (cell.getCellType() == CellType.STRING) |
| | | { |
| | | val = cell.getStringCellValue(); |
| | | } |
| | | else if (cell.getCellType() == CellType.BOOLEAN) |
| | | { |
| | | val = cell.getBooleanCellValue(); |
| | | } |
| | | else if (cell.getCellType() == CellType.ERROR) |
| | | { |
| | | val = cell.getErrorCellValue(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return val; |
| | | } |
| | | return val; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦æ¯ç©ºè¡ |
| | | * |
| | | * @param row 夿çè¡ |
| | | * @return |
| | | */ |
| | | private boolean isRowEmpty(Row row) |
| | | { |
| | | if (row == null) |
| | | { |
| | | return true; |
| | | } |
| | | for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) |
| | | { |
| | | Cell cell = row.getCell(i); |
| | | if (cell != null && cell.getCellType() != CellType.BLANK) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * è·åExcel2003å¾ç |
| | | * |
| | | * @param sheet å½åsheet对象 |
| | | * @param workbook å·¥ä½ç°¿å¯¹è±¡ |
| | | * @return Map key:å¾çåå
æ ¼ç´¢å¼ï¼1_1ï¼Stringï¼value:å¾çæµPictureData |
| | | */ |
| | | public static Map<String, List<PictureData>> getSheetPictures03(HSSFSheet sheet, HSSFWorkbook workbook) |
| | | { |
| | | Map<String, List<PictureData>> sheetIndexPicMap = new HashMap<>(); |
| | | List<HSSFPictureData> pictures = workbook.getAllPictures(); |
| | | if (!pictures.isEmpty() && sheet.getDrawingPatriarch() != null) |
| | | { |
| | | for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) |
| | | { |
| | | if (shape instanceof HSSFPicture) |
| | | { |
| | | HSSFPicture pic = (HSSFPicture) shape; |
| | | HSSFClientAnchor anchor = (HSSFClientAnchor) pic.getAnchor(); |
| | | String picIndex = anchor.getRow1() + "_" + anchor.getCol1(); |
| | | sheetIndexPicMap.computeIfAbsent(picIndex, k -> new ArrayList<>()).add(pic.getPictureData()); |
| | | } |
| | | } |
| | | } |
| | | return sheetIndexPicMap; |
| | | } |
| | | |
| | | /** |
| | | * è·åExcel2007å¾ç |
| | | * |
| | | * @param sheet å½åsheet对象 |
| | | * @param workbook å·¥ä½ç°¿å¯¹è±¡ |
| | | * @return Map key:å¾çåå
æ ¼ç´¢å¼ï¼1_1ï¼Stringï¼value:å¾çæµPictureData |
| | | */ |
| | | public static Map<String, List<PictureData>> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) |
| | | { |
| | | Map<String, List<PictureData>> sheetIndexPicMap = new HashMap<>(); |
| | | for (POIXMLDocumentPart dr : sheet.getRelations()) |
| | | { |
| | | if (dr instanceof XSSFDrawing) |
| | | { |
| | | XSSFDrawing drawing = (XSSFDrawing) dr; |
| | | for (XSSFShape shape : drawing.getShapes()) |
| | | { |
| | | if (shape instanceof XSSFPicture) |
| | | { |
| | | XSSFPicture pic = (XSSFPicture) shape; |
| | | XSSFClientAnchor anchor = pic.getPreferredSize(); |
| | | CTMarker ctMarker = anchor.getFrom(); |
| | | String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol(); |
| | | sheetIndexPicMap.computeIfAbsent(picIndex, k -> new ArrayList<>()).add(pic.getPictureData()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return sheetIndexPicMap; |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åä¸åç±»åçæ¥æå¯¹è±¡ |
| | | * |
| | | * @param dateFormat æ¥ææ ¼å¼ |
| | | * @param val è¢«æ ¼å¼åçæ¥æå¯¹è±¡ |
| | | * @return æ ¼å¼ååçæ¥æå符 |
| | | */ |
| | | public String parseDateToStr(String dateFormat, Object val) |
| | | { |
| | | if (val == null) |
| | | { |
| | | return ""; |
| | | } |
| | | String str; |
| | | if (val instanceof Date) |
| | | { |
| | | str = DateUtils.parseDateToStr(dateFormat, (Date) val); |
| | | } |
| | | else if (val instanceof LocalDateTime) |
| | | { |
| | | str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val)); |
| | | } |
| | | else if (val instanceof LocalDate) |
| | | { |
| | | str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val)); |
| | | } |
| | | else |
| | | { |
| | | str = val.toString(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æå¯¹è±¡çåå表 |
| | | */ |
| | | public boolean isSubList() |
| | | { |
| | | return !StringUtils.isEmpty(subFieldsMap); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æå¯¹è±¡çåå表ï¼éåä¸ä¸ºç©º |
| | | */ |
| | | public boolean isSubListValue(T vo) |
| | | { |
| | | return !StringUtils.isEmpty(subFieldsMap) && getListCellValue(vo) > 0; |
| | | } |
| | | |
| | | /** |
| | | * è·åéåçå¼ |
| | | */ |
| | | public int getListCellValue(Object obj) |
| | | { |
| | | Collection<?> value; |
| | | int max = 0; |
| | | try |
| | | { |
| | | for (String s : subMethods.keySet()) |
| | | { |
| | | value = (Collection<?>) subMethods.get(s).invoke(obj); |
| | | if (value.size() > max) |
| | | { |
| | | max = value.size(); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return 0; |
| | | } |
| | | return max; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çååè¡¨æ¹æ³ |
| | | * |
| | | * @param name åç§° |
| | | * @param pojoClass 类对象 |
| | | * @return ååè¡¨æ¹æ³ |
| | | */ |
| | | public Method getSubMethod(String name, Class<?> pojoClass) |
| | | { |
| | | StringBuffer getMethodName = new StringBuffer("get"); |
| | | getMethodName.append(name.substring(0, 1).toUpperCase()); |
| | | getMethodName.append(name.substring(1)); |
| | | Method method = null; |
| | | try |
| | | { |
| | | method = pojoClass.getMethod(getMethodName.toString(), new Class[] {}); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("è·å对象å¼å¸¸{}", e.getMessage()); |
| | | } |
| | | return method; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.reflect; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Modifier; |
| | | import java.lang.reflect.ParameterizedType; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import org.apache.commons.lang3.Validate; |
| | | import org.apache.poi.ss.usermodel.DateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * åå°å·¥å
·ç±». æä¾è°ç¨getter/setteræ¹æ³, 访é®ç§æåé, è°ç¨ç§ææ¹æ³, è·åæ³åç±»åClass, 被AOPè¿ççå®ç±»çå·¥å
·å½æ°. |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | public class ReflectUtils |
| | | { |
| | | private static final String SETTER_PREFIX = "set"; |
| | | |
| | | private static final String GETTER_PREFIX = "get"; |
| | | |
| | | private static final String CGLIB_CLASS_SEPARATOR = "$$"; |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); |
| | | |
| | | /** |
| | | * è°ç¨Getteræ¹æ³. |
| | | * æ¯æå¤çº§ï¼å¦ï¼å¯¹è±¡å.对象å.æ¹æ³ |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <E> E invokeGetter(Object obj, String propertyName) |
| | | { |
| | | Object object = obj; |
| | | for (String name : StringUtils.split(propertyName, ".")) |
| | | { |
| | | String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); |
| | | object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); |
| | | } |
| | | return (E) object; |
| | | } |
| | | |
| | | /** |
| | | * è°ç¨Setteræ¹æ³, ä»
å¹é
æ¹æ³åã |
| | | * æ¯æå¤çº§ï¼å¦ï¼å¯¹è±¡å.对象å.æ¹æ³ |
| | | */ |
| | | public static <E> void invokeSetter(Object obj, String propertyName, E value) |
| | | { |
| | | Object object = obj; |
| | | String[] names = StringUtils.split(propertyName, "."); |
| | | for (int i = 0; i < names.length; i++) |
| | | { |
| | | if (i < names.length - 1) |
| | | { |
| | | String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); |
| | | object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); |
| | | } |
| | | else |
| | | { |
| | | String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); |
| | | invokeMethodByName(object, setterMethodName, new Object[] { value }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç´æ¥è¯»åå¯¹è±¡å±æ§å¼, æ è§private/protected修饰符, ä¸ç»è¿getter彿°. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <E> E getFieldValue(final Object obj, final String fieldName) |
| | | { |
| | | Field field = getAccessibleField(obj, fieldName); |
| | | if (field == null) |
| | | { |
| | | logger.debug("å¨ [" + obj.getClass() + "] ä¸ï¼æ²¡ææ¾å° [" + fieldName + "] åæ®µ "); |
| | | return null; |
| | | } |
| | | E result = null; |
| | | try |
| | | { |
| | | result = (E) field.get(obj); |
| | | } |
| | | catch (IllegalAccessException e) |
| | | { |
| | | logger.error("ä¸å¯è½æåºçå¼å¸¸{}", e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ç´æ¥è®¾ç½®å¯¹è±¡å±æ§å¼, æ è§private/protected修饰符, ä¸ç»è¿setter彿°. |
| | | */ |
| | | public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) |
| | | { |
| | | Field field = getAccessibleField(obj, fieldName); |
| | | if (field == null) |
| | | { |
| | | // throw new IllegalArgumentException("å¨ [" + obj.getClass() + "] ä¸ï¼æ²¡ææ¾å° [" + fieldName + "] åæ®µ "); |
| | | logger.debug("å¨ [" + obj.getClass() + "] ä¸ï¼æ²¡ææ¾å° [" + fieldName + "] åæ®µ "); |
| | | return; |
| | | } |
| | | try |
| | | { |
| | | field.set(obj, value); |
| | | } |
| | | catch (IllegalAccessException e) |
| | | { |
| | | logger.error("ä¸å¯è½æåºçå¼å¸¸: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç´æ¥è°ç¨å¯¹è±¡æ¹æ³, æ è§private/protected修饰符. |
| | | * ç¨äºä¸æ¬¡æ§è°ç¨çæ
åµï¼å¦ååºä½¿ç¨getAccessibleMethod()彿°è·å¾Methodååå¤è°ç¨. |
| | | * åæ¶å¹é
æ¹æ³å+åæ°ç±»åï¼ |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes, |
| | | final Object[] args) |
| | | { |
| | | if (obj == null || methodName == null) |
| | | { |
| | | return null; |
| | | } |
| | | Method method = getAccessibleMethod(obj, methodName, parameterTypes); |
| | | if (method == null) |
| | | { |
| | | logger.debug("å¨ [" + obj.getClass() + "] ä¸ï¼æ²¡ææ¾å° [" + methodName + "] æ¹æ³ "); |
| | | return null; |
| | | } |
| | | try |
| | | { |
| | | return (E) method.invoke(obj, args); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; |
| | | throw convertReflectionExceptionToUnchecked(msg, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç´æ¥è°ç¨å¯¹è±¡æ¹æ³, æ è§private/protectedä¿®é¥°ç¬¦ï¼ |
| | | * ç¨äºä¸æ¬¡æ§è°ç¨çæ
åµï¼å¦ååºä½¿ç¨getAccessibleMethodByName()彿°è·å¾Methodååå¤è°ç¨. |
| | | * åªå¹é
彿°åï¼å¦ææå¤ä¸ªåå彿°è°ç¨ç¬¬ä¸ä¸ªã |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) |
| | | { |
| | | Method method = getAccessibleMethodByName(obj, methodName, args.length); |
| | | if (method == null) |
| | | { |
| | | // å¦æä¸ºç©ºä¸æ¥éï¼ç´æ¥è¿å空ã |
| | | logger.debug("å¨ [" + obj.getClass() + "] ä¸ï¼æ²¡ææ¾å° [" + methodName + "] æ¹æ³ "); |
| | | return null; |
| | | } |
| | | try |
| | | { |
| | | // ç±»å转æ¢ï¼å°åæ°æ°æ®ç±»å转æ¢ä¸ºç®æ æ¹æ³åæ°ç±»åï¼ |
| | | Class<?>[] cs = method.getParameterTypes(); |
| | | for (int i = 0; i < cs.length; i++) |
| | | { |
| | | if (args[i] != null && !args[i].getClass().equals(cs[i])) |
| | | { |
| | | if (cs[i] == String.class) |
| | | { |
| | | args[i] = Convert.toStr(args[i]); |
| | | if (StringUtils.endsWith((String) args[i], ".0")) |
| | | { |
| | | args[i] = StringUtils.substringBefore((String) args[i], ".0"); |
| | | } |
| | | } |
| | | else if (cs[i] == Integer.class) |
| | | { |
| | | args[i] = Convert.toInt(args[i]); |
| | | } |
| | | else if (cs[i] == Long.class) |
| | | { |
| | | args[i] = Convert.toLong(args[i]); |
| | | } |
| | | else if (cs[i] == Double.class) |
| | | { |
| | | args[i] = Convert.toDouble(args[i]); |
| | | } |
| | | else if (cs[i] == Float.class) |
| | | { |
| | | args[i] = Convert.toFloat(args[i]); |
| | | } |
| | | else if (cs[i] == Date.class) |
| | | { |
| | | if (args[i] instanceof String) |
| | | { |
| | | args[i] = DateUtils.parseDate(args[i]); |
| | | } |
| | | else |
| | | { |
| | | args[i] = DateUtil.getJavaDate((Double) args[i]); |
| | | } |
| | | } |
| | | else if (cs[i] == boolean.class || cs[i] == Boolean.class) |
| | | { |
| | | args[i] = Convert.toBool(args[i]); |
| | | } |
| | | } |
| | | } |
| | | return (E) method.invoke(obj, args); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; |
| | | throw convertReflectionExceptionToUnchecked(msg, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 循ç¯åä¸è½¬å, è·å对象çDeclaredField, 并强å¶è®¾ç½®ä¸ºå¯è®¿é®. |
| | | * å¦åä¸è½¬åå°Object仿 æ³æ¾å°, è¿ånull. |
| | | */ |
| | | public static Field getAccessibleField(final Object obj, final String fieldName) |
| | | { |
| | | // ä¸ºç©ºä¸æ¥éãç´æ¥è¿å null |
| | | if (obj == null) |
| | | { |
| | | return null; |
| | | } |
| | | Validate.notBlank(fieldName, "fieldName can't be blank"); |
| | | for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) |
| | | { |
| | | try |
| | | { |
| | | Field field = superClass.getDeclaredField(fieldName); |
| | | makeAccessible(field); |
| | | return field; |
| | | } |
| | | catch (NoSuchFieldException e) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 循ç¯åä¸è½¬å, è·å对象çDeclaredMethod,并强å¶è®¾ç½®ä¸ºå¯è®¿é®. |
| | | * å¦åä¸è½¬åå°Object仿 æ³æ¾å°, è¿ånull. |
| | | * å¹é
彿°å+åæ°ç±»åã |
| | | * ç¨äºæ¹æ³éè¦è¢«å¤æ¬¡è°ç¨çæ
åµ. å
ä½¿ç¨æ¬å½æ°å
åå¾Method,ç¶åè°ç¨Method.invoke(Object obj, Object... args) |
| | | */ |
| | | public static Method getAccessibleMethod(final Object obj, final String methodName, |
| | | final Class<?>... parameterTypes) |
| | | { |
| | | // ä¸ºç©ºä¸æ¥éãç´æ¥è¿å null |
| | | if (obj == null) |
| | | { |
| | | return null; |
| | | } |
| | | Validate.notBlank(methodName, "methodName can't be blank"); |
| | | for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) |
| | | { |
| | | try |
| | | { |
| | | Method method = searchType.getDeclaredMethod(methodName, parameterTypes); |
| | | makeAccessible(method); |
| | | return method; |
| | | } |
| | | catch (NoSuchMethodException e) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 循ç¯åä¸è½¬å, è·å对象çDeclaredMethod,并强å¶è®¾ç½®ä¸ºå¯è®¿é®. |
| | | * å¦åä¸è½¬åå°Object仿 æ³æ¾å°, è¿ånull. |
| | | * åªå¹é
彿°åã |
| | | * ç¨äºæ¹æ³éè¦è¢«å¤æ¬¡è°ç¨çæ
åµ. å
ä½¿ç¨æ¬å½æ°å
åå¾Method,ç¶åè°ç¨Method.invoke(Object obj, Object... args) |
| | | */ |
| | | public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) |
| | | { |
| | | // ä¸ºç©ºä¸æ¥éãç´æ¥è¿å null |
| | | if (obj == null) |
| | | { |
| | | return null; |
| | | } |
| | | Validate.notBlank(methodName, "methodName can't be blank"); |
| | | for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) |
| | | { |
| | | Method[] methods = searchType.getDeclaredMethods(); |
| | | for (Method method : methods) |
| | | { |
| | | if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) |
| | | { |
| | | makeAccessible(method); |
| | | return method; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æ¹åprivate/protectedçæ¹æ³ä¸ºpublicï¼å°½éä¸è°ç¨å®é
æ¹å¨çè¯å¥ï¼é¿å
JDKçSecurityManageræ±æ¨ã |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public static void makeAccessible(Method method) |
| | | { |
| | | if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) |
| | | && !method.isAccessible()) |
| | | { |
| | | method.setAccessible(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¹åprivate/protectedçæååé为publicï¼å°½éä¸è°ç¨å®é
æ¹å¨çè¯å¥ï¼é¿å
JDKçSecurityManageræ±æ¨ã |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public static void makeAccessible(Field field) |
| | | { |
| | | if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) |
| | | || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) |
| | | { |
| | | field.setAccessible(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éè¿åå°, è·å¾Classå®ä¹ä¸å£°æçæ³ååæ°çç±»å, æ³¨ææ³åå¿
é¡»å®ä¹å¨ç¶ç±»å¤ |
| | | * 妿 æ³æ¾å°, è¿åObject.class. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> Class<T> getClassGenricType(final Class clazz) |
| | | { |
| | | return getClassGenricType(clazz, 0); |
| | | } |
| | | |
| | | /** |
| | | * éè¿åå°, è·å¾Classå®ä¹ä¸å£°æçç¶ç±»çæ³ååæ°çç±»å. |
| | | * 妿 æ³æ¾å°, è¿åObject.class. |
| | | */ |
| | | public static Class getClassGenricType(final Class clazz, final int index) |
| | | { |
| | | Type genType = clazz.getGenericSuperclass(); |
| | | |
| | | if (!(genType instanceof ParameterizedType)) |
| | | { |
| | | logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); |
| | | return Object.class; |
| | | } |
| | | |
| | | Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); |
| | | |
| | | if (index >= params.length || index < 0) |
| | | { |
| | | logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " |
| | | + params.length); |
| | | return Object.class; |
| | | } |
| | | if (!(params[index] instanceof Class)) |
| | | { |
| | | logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); |
| | | return Object.class; |
| | | } |
| | | |
| | | return (Class) params[index]; |
| | | } |
| | | |
| | | public static Class<?> getUserClass(Object instance) |
| | | { |
| | | if (instance == null) |
| | | { |
| | | throw new RuntimeException("Instance must not be null"); |
| | | } |
| | | Class clazz = instance.getClass(); |
| | | if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) |
| | | { |
| | | Class<?> superClass = clazz.getSuperclass(); |
| | | if (superClass != null && !Object.class.equals(superClass)) |
| | | { |
| | | return superClass; |
| | | } |
| | | } |
| | | return clazz; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å°åå°æ¶çchecked exception转æ¢ä¸ºunchecked exception. |
| | | */ |
| | | public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) |
| | | { |
| | | if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException |
| | | || e instanceof NoSuchMethodException) |
| | | { |
| | | return new IllegalArgumentException(msg, e); |
| | | } |
| | | else if (e instanceof InvocationTargetException) |
| | | { |
| | | return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); |
| | | } |
| | | return new RuntimeException(msg, e); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.sign; |
| | | |
| | | /** |
| | | * Base64å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public final class Base64 |
| | | { |
| | | static private final int BASELENGTH = 128; |
| | | static private final int LOOKUPLENGTH = 64; |
| | | static private final int TWENTYFOURBITGROUP = 24; |
| | | static private final int EIGHTBIT = 8; |
| | | static private final int SIXTEENBIT = 16; |
| | | static private final int FOURBYTE = 4; |
| | | static private final int SIGN = -128; |
| | | static private final char PAD = '='; |
| | | static final private byte[] base64Alphabet = new byte[BASELENGTH]; |
| | | static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; |
| | | |
| | | static |
| | | { |
| | | for (int i = 0; i < BASELENGTH; ++i) |
| | | { |
| | | base64Alphabet[i] = -1; |
| | | } |
| | | for (int i = 'Z'; i >= 'A'; i--) |
| | | { |
| | | base64Alphabet[i] = (byte) (i - 'A'); |
| | | } |
| | | for (int i = 'z'; i >= 'a'; i--) |
| | | { |
| | | base64Alphabet[i] = (byte) (i - 'a' + 26); |
| | | } |
| | | |
| | | for (int i = '9'; i >= '0'; i--) |
| | | { |
| | | base64Alphabet[i] = (byte) (i - '0' + 52); |
| | | } |
| | | |
| | | base64Alphabet['+'] = 62; |
| | | base64Alphabet['/'] = 63; |
| | | |
| | | for (int i = 0; i <= 25; i++) |
| | | { |
| | | lookUpBase64Alphabet[i] = (char) ('A' + i); |
| | | } |
| | | |
| | | for (int i = 26, j = 0; i <= 51; i++, j++) |
| | | { |
| | | lookUpBase64Alphabet[i] = (char) ('a' + j); |
| | | } |
| | | |
| | | for (int i = 52, j = 0; i <= 61; i++, j++) |
| | | { |
| | | lookUpBase64Alphabet[i] = (char) ('0' + j); |
| | | } |
| | | lookUpBase64Alphabet[62] = (char) '+'; |
| | | lookUpBase64Alphabet[63] = (char) '/'; |
| | | } |
| | | |
| | | private static boolean isWhiteSpace(char octect) |
| | | { |
| | | return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); |
| | | } |
| | | |
| | | private static boolean isPad(char octect) |
| | | { |
| | | return (octect == PAD); |
| | | } |
| | | |
| | | private static boolean isData(char octect) |
| | | { |
| | | return (octect < BASELENGTH && base64Alphabet[octect] != -1); |
| | | } |
| | | |
| | | /** |
| | | * Encodes hex octects into Base64 |
| | | * |
| | | * @param binaryData Array containing binaryData |
| | | * @return Encoded Base64 array |
| | | */ |
| | | public static String encode(byte[] binaryData) |
| | | { |
| | | if (binaryData == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | int lengthDataBits = binaryData.length * EIGHTBIT; |
| | | if (lengthDataBits == 0) |
| | | { |
| | | return ""; |
| | | } |
| | | |
| | | int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; |
| | | int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; |
| | | int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; |
| | | char encodedData[] = null; |
| | | |
| | | encodedData = new char[numberQuartet * 4]; |
| | | |
| | | byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; |
| | | |
| | | int encodedIndex = 0; |
| | | int dataIndex = 0; |
| | | |
| | | for (int i = 0; i < numberTriplets; i++) |
| | | { |
| | | b1 = binaryData[dataIndex++]; |
| | | b2 = binaryData[dataIndex++]; |
| | | b3 = binaryData[dataIndex++]; |
| | | |
| | | l = (byte) (b2 & 0x0f); |
| | | k = (byte) (b1 & 0x03); |
| | | |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); |
| | | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); |
| | | byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); |
| | | |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; |
| | | } |
| | | |
| | | // form integral number of 6-bit groups |
| | | if (fewerThan24bits == EIGHTBIT) |
| | | { |
| | | b1 = binaryData[dataIndex]; |
| | | k = (byte) (b1 & 0x03); |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; |
| | | encodedData[encodedIndex++] = PAD; |
| | | encodedData[encodedIndex++] = PAD; |
| | | } |
| | | else if (fewerThan24bits == SIXTEENBIT) |
| | | { |
| | | b1 = binaryData[dataIndex]; |
| | | b2 = binaryData[dataIndex + 1]; |
| | | l = (byte) (b2 & 0x0f); |
| | | k = (byte) (b1 & 0x03); |
| | | |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); |
| | | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); |
| | | |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; |
| | | encodedData[encodedIndex++] = PAD; |
| | | } |
| | | return new String(encodedData); |
| | | } |
| | | |
| | | /** |
| | | * Decodes Base64 data into octects |
| | | * |
| | | * @param encoded string containing Base64 data |
| | | * @return Array containind decoded data. |
| | | */ |
| | | public static byte[] decode(String encoded) |
| | | { |
| | | if (encoded == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | char[] base64Data = encoded.toCharArray(); |
| | | // remove white spaces |
| | | int len = removeWhiteSpace(base64Data); |
| | | |
| | | if (len % FOURBYTE != 0) |
| | | { |
| | | return null;// should be divisible by four |
| | | } |
| | | |
| | | int numberQuadruple = (len / FOURBYTE); |
| | | |
| | | if (numberQuadruple == 0) |
| | | { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | byte decodedData[] = null; |
| | | byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; |
| | | char d1 = 0, d2 = 0, d3 = 0, d4 = 0; |
| | | |
| | | int i = 0; |
| | | int encodedIndex = 0; |
| | | int dataIndex = 0; |
| | | decodedData = new byte[(numberQuadruple) * 3]; |
| | | |
| | | for (; i < numberQuadruple - 1; i++) |
| | | { |
| | | |
| | | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) |
| | | || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) |
| | | { |
| | | return null; |
| | | } // if found "no data" just return null |
| | | |
| | | b1 = base64Alphabet[d1]; |
| | | b2 = base64Alphabet[d2]; |
| | | b3 = base64Alphabet[d3]; |
| | | b4 = base64Alphabet[d4]; |
| | | |
| | | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); |
| | | } |
| | | |
| | | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) |
| | | { |
| | | return null;// if found "no data" just return null |
| | | } |
| | | |
| | | b1 = base64Alphabet[d1]; |
| | | b2 = base64Alphabet[d2]; |
| | | |
| | | d3 = base64Data[dataIndex++]; |
| | | d4 = base64Data[dataIndex++]; |
| | | if (!isData((d3)) || !isData((d4))) |
| | | {// Check if they are PAD characters |
| | | if (isPad(d3) && isPad(d4)) |
| | | { |
| | | if ((b2 & 0xf) != 0)// last 4 bits should be zero |
| | | { |
| | | return null; |
| | | } |
| | | byte[] tmp = new byte[i * 3 + 1]; |
| | | System.arraycopy(decodedData, 0, tmp, 0, i * 3); |
| | | tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); |
| | | return tmp; |
| | | } |
| | | else if (!isPad(d3) && isPad(d4)) |
| | | { |
| | | b3 = base64Alphabet[d3]; |
| | | if ((b3 & 0x3) != 0)// last 2 bits should be zero |
| | | { |
| | | return null; |
| | | } |
| | | byte[] tmp = new byte[i * 3 + 2]; |
| | | System.arraycopy(decodedData, 0, tmp, 0, i * 3); |
| | | tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | return tmp; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { // No PAD e.g 3cQl |
| | | b3 = base64Alphabet[d3]; |
| | | b4 = base64Alphabet[d4]; |
| | | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); |
| | | |
| | | } |
| | | return decodedData; |
| | | } |
| | | |
| | | /** |
| | | * remove WhiteSpace from MIME containing encoded Base64 data. |
| | | * |
| | | * @param data the byte array of base64 data (with WS) |
| | | * @return the new length |
| | | */ |
| | | private static int removeWhiteSpace(char[] data) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | // count characters that's not whitespace |
| | | int newSize = 0; |
| | | int len = data.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | if (!isWhiteSpace(data[i])) |
| | | { |
| | | data[newSize++] = data[i]; |
| | | } |
| | | } |
| | | return newSize; |
| | | } |
| | | } |
| ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
ruoyi-framework/pom.xml
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java
ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java
ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
ruoyi-generator/pom.xml
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
ruoyi-generator/src/main/resources/generator.yml
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
ruoyi-generator/src/main/resources/vm/java/service.java.vm
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm
ruoyi-generator/src/main/resources/vm/js/api.js.vm
ruoyi-generator/src/main/resources/vm/sql/sql.vm
ruoyi-generator/src/main/resources/vm/ts/api.ts.vm
ruoyi-generator/src/main/resources/vm/ts/index.ts.vm
ruoyi-generator/src/main/resources/vm/ts/type.ts.vm
ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3/view.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3ts/index-tree.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3ts/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/v3ts/view.vue.vm
ruoyi-generator/src/main/resources/vm/vue/view.vue.vm
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
ruoyi-quartz/pom.xml
ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
ruoyi-system/pom.xml
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjClassController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjCollegeController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjFillTaskController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjFormConfigController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjMajorController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjStudentBindController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjStudentController.java
ruoyi-system/src/main/java/com/ruoyi/system/controller/CjWorkbenchController.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjClass.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjCollege.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjFillRecord.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjFillTask.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjFormConfig.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjMajor.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjStudent.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/CjStudentBind.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNoticeRead.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjClassMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjCollegeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjFillRecordMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjFillTaskMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjFormConfigMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjMajorMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjStudentBindMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CjStudentMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeReadMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjClassService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjCollegeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjFillTaskService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjFormConfigService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjMajorService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjStudentBindService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ICjStudentService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeReadService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/MiniappTokenService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjClassServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjCollegeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjFillTaskServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjFormConfigServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjMajorServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjStudentBindServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CjStudentServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeReadServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
ruoyi-system/src/main/resources/form/builtinDefault.json
ruoyi-system/src/main/resources/mapper/system/CjClassMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjCollegeMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjFillRecordMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjFillTaskMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjFormConfigMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjMajorMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjStudentBindMapper.xml
ruoyi-system/src/main/resources/mapper/system/CjStudentMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysNoticeReadMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
ruoyi-ui/.env.development
ruoyi-ui/.env.production
ruoyi-ui/.env.staging
ruoyi-ui/.github/FUNDING.yml
ruoyi-ui/.gitignore
ruoyi-ui/LICENSE
ruoyi-ui/README.md
ruoyi-ui/bin/build.bat
ruoyi-ui/bin/package.bat
ruoyi-ui/bin/run-web.bat
ruoyi-ui/html/ie.html
ruoyi-ui/index.html
ruoyi-ui/package.json
ruoyi-ui/public/favicon.ico
ruoyi-ui/src/App.vue
ruoyi-ui/src/api/login.js
ruoyi-ui/src/api/menu.js
ruoyi-ui/src/api/monitor/cache.js
ruoyi-ui/src/api/monitor/job.js
ruoyi-ui/src/api/monitor/jobLog.js
ruoyi-ui/src/api/monitor/logininfor.js
ruoyi-ui/src/api/monitor/online.js
ruoyi-ui/src/api/monitor/operlog.js
ruoyi-ui/src/api/monitor/server.js
ruoyi-ui/src/api/system/class.js
ruoyi-ui/src/api/system/college.js
ruoyi-ui/src/api/system/config.js
ruoyi-ui/src/api/system/dept.js
ruoyi-ui/src/api/system/dict/data.js
ruoyi-ui/src/api/system/dict/type.js
ruoyi-ui/src/api/system/formConfig.js
ruoyi-ui/src/api/system/formTask.js
ruoyi-ui/src/api/system/major.js
ruoyi-ui/src/api/system/menu.js
ruoyi-ui/src/api/system/notice.js
ruoyi-ui/src/api/system/post.js
ruoyi-ui/src/api/system/role.js
ruoyi-ui/src/api/system/student.js
ruoyi-ui/src/api/system/user.js
ruoyi-ui/src/api/system/workbench.js
ruoyi-ui/src/api/tool/gen.js
ruoyi-ui/src/assets/401_images/401.gif
ruoyi-ui/src/assets/404_images/404.png
ruoyi-ui/src/assets/404_images/404_cloud.png
ruoyi-ui/src/assets/icons/svg/404.svg
ruoyi-ui/src/assets/icons/svg/bell.svg
ruoyi-ui/src/assets/icons/svg/bug.svg
ruoyi-ui/src/assets/icons/svg/build.svg
ruoyi-ui/src/assets/icons/svg/button.svg
ruoyi-ui/src/assets/icons/svg/cascader.svg
ruoyi-ui/src/assets/icons/svg/chart.svg
ruoyi-ui/src/assets/icons/svg/checkbox.svg
ruoyi-ui/src/assets/icons/svg/clipboard.svg
ruoyi-ui/src/assets/icons/svg/code.svg
ruoyi-ui/src/assets/icons/svg/color.svg
ruoyi-ui/src/assets/icons/svg/component.svg
ruoyi-ui/src/assets/icons/svg/dashboard.svg
ruoyi-ui/src/assets/icons/svg/date-range.svg
ruoyi-ui/src/assets/icons/svg/date.svg
ruoyi-ui/src/assets/icons/svg/dict.svg
ruoyi-ui/src/assets/icons/svg/documentation.svg
ruoyi-ui/src/assets/icons/svg/download.svg
ruoyi-ui/src/assets/icons/svg/drag.svg
ruoyi-ui/src/assets/icons/svg/druid.svg
ruoyi-ui/src/assets/icons/svg/edit.svg
ruoyi-ui/src/assets/icons/svg/education.svg
ruoyi-ui/src/assets/icons/svg/email.svg
ruoyi-ui/src/assets/icons/svg/enter.svg
ruoyi-ui/src/assets/icons/svg/example.svg
ruoyi-ui/src/assets/icons/svg/excel.svg
ruoyi-ui/src/assets/icons/svg/exit-fullscreen.svg
ruoyi-ui/src/assets/icons/svg/eye-open.svg
ruoyi-ui/src/assets/icons/svg/eye.svg
ruoyi-ui/src/assets/icons/svg/form.svg
ruoyi-ui/src/assets/icons/svg/fullscreen.svg
ruoyi-ui/src/assets/icons/svg/github.svg
ruoyi-ui/src/assets/icons/svg/guide.svg
ruoyi-ui/src/assets/icons/svg/icon.svg
ruoyi-ui/src/assets/icons/svg/input.svg
ruoyi-ui/src/assets/icons/svg/international.svg
ruoyi-ui/src/assets/icons/svg/job.svg
ruoyi-ui/src/assets/icons/svg/language.svg
ruoyi-ui/src/assets/icons/svg/link.svg
ruoyi-ui/src/assets/icons/svg/list.svg
ruoyi-ui/src/assets/icons/svg/lock.svg
ruoyi-ui/src/assets/icons/svg/log.svg
ruoyi-ui/src/assets/icons/svg/logininfor.svg
ruoyi-ui/src/assets/icons/svg/message.svg
ruoyi-ui/src/assets/icons/svg/money.svg
ruoyi-ui/src/assets/icons/svg/monitor.svg
ruoyi-ui/src/assets/icons/svg/moon.svg
ruoyi-ui/src/assets/icons/svg/more-up.svg
ruoyi-ui/src/assets/icons/svg/nested.svg
ruoyi-ui/src/assets/icons/svg/number.svg
ruoyi-ui/src/assets/icons/svg/online.svg
ruoyi-ui/src/assets/icons/svg/password.svg
ruoyi-ui/src/assets/icons/svg/pdf.svg
ruoyi-ui/src/assets/icons/svg/people.svg
ruoyi-ui/src/assets/icons/svg/peoples.svg
ruoyi-ui/src/assets/icons/svg/phone.svg
ruoyi-ui/src/assets/icons/svg/post.svg
ruoyi-ui/src/assets/icons/svg/qq.svg
ruoyi-ui/src/assets/icons/svg/question.svg
ruoyi-ui/src/assets/icons/svg/radio.svg
ruoyi-ui/src/assets/icons/svg/rate.svg
ruoyi-ui/src/assets/icons/svg/redis-list.svg
ruoyi-ui/src/assets/icons/svg/redis.svg
ruoyi-ui/src/assets/icons/svg/row.svg
ruoyi-ui/src/assets/icons/svg/search.svg
ruoyi-ui/src/assets/icons/svg/select.svg
ruoyi-ui/src/assets/icons/svg/server.svg
ruoyi-ui/src/assets/icons/svg/shopping.svg
ruoyi-ui/src/assets/icons/svg/size.svg
ruoyi-ui/src/assets/icons/svg/skill.svg
ruoyi-ui/src/assets/icons/svg/slider.svg
ruoyi-ui/src/assets/icons/svg/star.svg
ruoyi-ui/src/assets/icons/svg/sunny.svg
ruoyi-ui/src/assets/icons/svg/swagger.svg
ruoyi-ui/src/assets/icons/svg/switch.svg
ruoyi-ui/src/assets/icons/svg/system.svg
ruoyi-ui/src/assets/icons/svg/tab.svg
ruoyi-ui/src/assets/icons/svg/table.svg
ruoyi-ui/src/assets/icons/svg/textarea.svg
ruoyi-ui/src/assets/icons/svg/theme.svg
ruoyi-ui/src/assets/icons/svg/time-range.svg
ruoyi-ui/src/assets/icons/svg/time.svg
ruoyi-ui/src/assets/icons/svg/tool.svg
ruoyi-ui/src/assets/icons/svg/tree-table.svg
ruoyi-ui/src/assets/icons/svg/tree.svg
ruoyi-ui/src/assets/icons/svg/upload.svg
ruoyi-ui/src/assets/icons/svg/user.svg
ruoyi-ui/src/assets/icons/svg/validCode.svg
ruoyi-ui/src/assets/icons/svg/wechat.svg
ruoyi-ui/src/assets/icons/svg/zip.svg
ruoyi-ui/src/assets/images/brand/logo-navy.png
ruoyi-ui/src/assets/images/brand/logo-white.png
ruoyi-ui/src/assets/images/dark.svg
ruoyi-ui/src/assets/images/light.svg
ruoyi-ui/src/assets/images/login-background.jpg
ruoyi-ui/src/assets/images/pay.png
ruoyi-ui/src/assets/images/profile.jpg
ruoyi-ui/src/assets/logo/logo-white.png
ruoyi-ui/src/assets/logo/logo.png
ruoyi-ui/src/assets/styles/btn.scss
ruoyi-ui/src/assets/styles/element-ui.scss
ruoyi-ui/src/assets/styles/index.scss
ruoyi-ui/src/assets/styles/mixin.scss
ruoyi-ui/src/assets/styles/ruoyi.scss
ruoyi-ui/src/assets/styles/sidebar.scss
ruoyi-ui/src/assets/styles/transition.scss
ruoyi-ui/src/assets/styles/variables.module.scss
ruoyi-ui/src/components/Breadcrumb/index.vue
ruoyi-ui/src/components/Crontab/day.vue
ruoyi-ui/src/components/Crontab/hour.vue
ruoyi-ui/src/components/Crontab/index.vue
ruoyi-ui/src/components/Crontab/min.vue
ruoyi-ui/src/components/Crontab/month.vue
ruoyi-ui/src/components/Crontab/result.vue
ruoyi-ui/src/components/Crontab/second.vue
ruoyi-ui/src/components/Crontab/week.vue
ruoyi-ui/src/components/Crontab/year.vue
ruoyi-ui/src/components/DictTag/index.vue
ruoyi-ui/src/components/Editor/index.vue
ruoyi-ui/src/components/ExcelImportDialog/index.vue
ruoyi-ui/src/components/FileUpload/index.vue
ruoyi-ui/src/components/Hamburger/index.vue
ruoyi-ui/src/components/HeaderSearch/index.vue
ruoyi-ui/src/components/IconSelect/index.vue
ruoyi-ui/src/components/IconSelect/requireIcons.js
ruoyi-ui/src/components/ImagePreview/index.vue
ruoyi-ui/src/components/ImageUpload/index.vue
ruoyi-ui/src/components/Pagination/index.vue
ruoyi-ui/src/components/ParentView/index.vue
ruoyi-ui/src/components/RightToolbar/index.vue
ruoyi-ui/src/components/RuoYi/Doc/index.vue
ruoyi-ui/src/components/RuoYi/Git/index.vue
ruoyi-ui/src/components/Screenfull/index.vue
ruoyi-ui/src/components/SizeSelect/index.vue
ruoyi-ui/src/components/SvgIcon/index.vue
ruoyi-ui/src/components/SvgIcon/svgicon.js
ruoyi-ui/src/components/TreePanel/index.vue
ruoyi-ui/src/components/iFrame/index.vue
ruoyi-ui/src/directive/common/copyText.js
ruoyi-ui/src/directive/index.js
ruoyi-ui/src/directive/permission/hasPermi.js
ruoyi-ui/src/directive/permission/hasRole.js
ruoyi-ui/src/layout/components/AppMain.vue
ruoyi-ui/src/layout/components/Copyright/index.vue
ruoyi-ui/src/layout/components/HeaderNotice/DetailView.vue
ruoyi-ui/src/layout/components/HeaderNotice/index.vue
ruoyi-ui/src/layout/components/IframeToggle/index.vue
ruoyi-ui/src/layout/components/InnerLink/index.vue
ruoyi-ui/src/layout/components/Navbar.vue
ruoyi-ui/src/layout/components/Settings/index.vue
ruoyi-ui/src/layout/components/Sidebar/Link.vue
ruoyi-ui/src/layout/components/Sidebar/Logo.vue
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
ruoyi-ui/src/layout/components/Sidebar/index.vue
ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue
ruoyi-ui/src/layout/components/TagsView/index.vue
ruoyi-ui/src/layout/components/TopBar/index.vue
ruoyi-ui/src/layout/components/TopNav/index.vue
ruoyi-ui/src/layout/components/index.js
ruoyi-ui/src/layout/index.vue
ruoyi-ui/src/main.js
ruoyi-ui/src/permission.js
ruoyi-ui/src/plugins/auth.js
ruoyi-ui/src/plugins/cache.js
ruoyi-ui/src/plugins/download.js
ruoyi-ui/src/plugins/index.js
ruoyi-ui/src/plugins/modal.js
ruoyi-ui/src/plugins/tab.js
ruoyi-ui/src/router/index.js
ruoyi-ui/src/settings.js
ruoyi-ui/src/store/index.js
ruoyi-ui/src/store/modules/app.js
ruoyi-ui/src/store/modules/dict.js
ruoyi-ui/src/store/modules/lock.js
ruoyi-ui/src/store/modules/permission.js
ruoyi-ui/src/store/modules/settings.js
ruoyi-ui/src/store/modules/tagsView.js
ruoyi-ui/src/store/modules/user.js
ruoyi-ui/src/utils/auth.js
ruoyi-ui/src/utils/dict.js
ruoyi-ui/src/utils/dynamicTitle.js
ruoyi-ui/src/utils/errorCode.js
ruoyi-ui/src/utils/generator/config.js
ruoyi-ui/src/utils/generator/css.js
ruoyi-ui/src/utils/generator/drawingDefault.js
ruoyi-ui/src/utils/generator/html.js
ruoyi-ui/src/utils/generator/icon.json
ruoyi-ui/src/utils/generator/js.js
ruoyi-ui/src/utils/generator/render.js
ruoyi-ui/src/utils/index.js
ruoyi-ui/src/utils/jsencrypt.js
ruoyi-ui/src/utils/passwordRule.js
ruoyi-ui/src/utils/permission.js
ruoyi-ui/src/utils/qrcode-lite.js
ruoyi-ui/src/utils/region.js
ruoyi-ui/src/utils/request.js
ruoyi-ui/src/utils/ruoyi.js
ruoyi-ui/src/utils/scroll-to.js
ruoyi-ui/src/utils/theme.js
ruoyi-ui/src/utils/validate.js
ruoyi-ui/src/views/error/401.vue
ruoyi-ui/src/views/error/404.vue
ruoyi-ui/src/views/index.vue
ruoyi-ui/src/views/lock.vue
ruoyi-ui/src/views/login.vue
ruoyi-ui/src/views/monitor/logininfor/index.vue
ruoyi-ui/src/views/redirect/index.vue
ruoyi-ui/src/views/system/class/index.vue
ruoyi-ui/src/views/system/college/index.vue
ruoyi-ui/src/views/system/config/index.vue
ruoyi-ui/src/views/system/dept/index.vue
ruoyi-ui/src/views/system/dict/data.vue
ruoyi-ui/src/views/system/dict/detail.vue
ruoyi-ui/src/views/system/dict/index.vue
ruoyi-ui/src/views/system/fillData/index.vue
ruoyi-ui/src/views/system/formConfig/index.vue
ruoyi-ui/src/views/system/formTask/index.vue
ruoyi-ui/src/views/system/major/index.vue
ruoyi-ui/src/views/system/menu/index.vue
ruoyi-ui/src/views/system/notice/ReadUsers.vue
ruoyi-ui/src/views/system/notice/index.vue
ruoyi-ui/src/views/system/post/index.vue
ruoyi-ui/src/views/system/role/authUser.vue
ruoyi-ui/src/views/system/role/index.vue
ruoyi-ui/src/views/system/role/selectUser.vue
ruoyi-ui/src/views/system/student/index.vue
ruoyi-ui/src/views/system/user/authRole.vue
ruoyi-ui/src/views/system/user/index.vue
ruoyi-ui/src/views/system/user/profile/index.vue
ruoyi-ui/src/views/system/user/profile/resetPwd.vue
ruoyi-ui/src/views/system/user/profile/userAvatar.vue
ruoyi-ui/src/views/system/user/profile/userInfo.vue
ruoyi-ui/src/views/system/user/view.vue
ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
ruoyi-ui/src/views/tool/gen/createTable.vue
ruoyi-ui/src/views/tool/gen/editTable.vue
ruoyi-ui/src/views/tool/gen/genInfoForm.vue
ruoyi-ui/src/views/tool/gen/importTable.vue
ruoyi-ui/src/views/tool/gen/index.vue
ruoyi-ui/vite.config.js
ruoyi-ui/vite/plugins/auto-import.js
ruoyi-ui/vite/plugins/compression.js
ruoyi-ui/vite/plugins/index.js
ruoyi-ui/vite/plugins/setup-extend.js
ruoyi-ui/vite/plugins/svg-icon.js
ry.bat
ry.sh
sql/quartz.sql
sql/ry_20260417.sql
src/main/java/com/ruoyi/RuoYiApplication.java (已删除)
src/main/java/com/ruoyi/RuoYiServletInitializer.java (已删除)
src/main/java/com/ruoyi/account/controller/AccountExpenseController.java (已删除)
src/main/java/com/ruoyi/account/controller/AccountFileController.java (已删除)
src/main/java/com/ruoyi/account/controller/AccountIncomeController.java (已删除)
src/main/java/com/ruoyi/account/dto/AccountDto.java (已删除)
src/main/java/com/ruoyi/account/dto/AccountDto2.java (已删除)
src/main/java/com/ruoyi/account/dto/AccountDto3.java (已删除)
src/main/java/com/ruoyi/account/mapper/AccountExpenseMapper.java (已删除)
src/main/java/com/ruoyi/account/mapper/AccountFileMapper.java (已删除)
src/main/java/com/ruoyi/account/mapper/AccountIncomeMapper.java (已删除)
src/main/java/com/ruoyi/account/pojo/AccountExpense.java (已删除)
src/main/java/com/ruoyi/account/pojo/AccountFile.java (已删除)
src/main/java/com/ruoyi/account/pojo/AccountIncome.java (已删除)
src/main/java/com/ruoyi/account/service/AccountExpenseService.java (已删除)
src/main/java/com/ruoyi/account/service/AccountFileService.java (已删除)
src/main/java/com/ruoyi/account/service/AccountIncomeService.java (已删除)
src/main/java/com/ruoyi/account/service/impl/AccountExpenseServiceImpl.java (已删除)
src/main/java/com/ruoyi/account/service/impl/AccountFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceDto.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java (已删除)
src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java (已删除)
src/main/java/com/ruoyi/api/Api.java (已删除)
src/main/java/com/ruoyi/api/ScheduledApi.java (已删除)
src/main/java/com/ruoyi/api/dto/ApiProperties.java (已删除)
src/main/java/com/ruoyi/api/dto/DataRequest.java (已删除)
src/main/java/com/ruoyi/api/dto/ElectricityDto.java (已删除)
src/main/java/com/ruoyi/api/dto/LoggingDto.java (已删除)
src/main/java/com/ruoyi/approve/controller/ApproveNodeController.java (已删除)
src/main/java/com/ruoyi/approve/controller/ApproveProcessController.java (已删除)
src/main/java/com/ruoyi/approve/controller/HolidaySettingsController.java (已删除)
src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java (已删除)
src/main/java/com/ruoyi/approve/controller/NotificationManagementController.java (已删除)
src/main/java/com/ruoyi/approve/controller/RpaProcessAutomationController.java (已删除)
src/main/java/com/ruoyi/approve/mapper/AnnualLeaveSettingMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/ApproveLogMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/ApproveNodeMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/ApproveProcessMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/FileSharingMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/HolidaySettingsMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/KnowledgeBaseMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/NotificationManagementMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/OnlineMeetingMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/OvertimeSettingMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/RpaProcessAutomationMapper.java (已删除)
src/main/java/com/ruoyi/approve/mapper/WorkingHoursSettingMapper.java (已删除)
src/main/java/com/ruoyi/approve/pojo/AnnualLeaveSetting.java (已删除)
src/main/java/com/ruoyi/approve/pojo/ApproveLog.java (已删除)
src/main/java/com/ruoyi/approve/pojo/ApproveNode.java (已删除)
src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java (已删除)
src/main/java/com/ruoyi/approve/pojo/FileSharing.java (已删除)
src/main/java/com/ruoyi/approve/pojo/HolidaySettings.java (已删除)
src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java (已删除)
src/main/java/com/ruoyi/approve/pojo/NotificationManagement.java (已删除)
src/main/java/com/ruoyi/approve/pojo/OnlineMeeting.java (已删除)
src/main/java/com/ruoyi/approve/pojo/OvertimeSetting.java (已删除)
src/main/java/com/ruoyi/approve/pojo/RpaProcessAutomation.java (已删除)
src/main/java/com/ruoyi/approve/pojo/WorkingHoursSetting.java (已删除)
src/main/java/com/ruoyi/approve/service/HolidaySettingsService.java (已删除)
src/main/java/com/ruoyi/approve/service/IApproveNodeService.java (已删除)
src/main/java/com/ruoyi/approve/service/IApproveProcessService.java (已删除)
src/main/java/com/ruoyi/approve/service/KnowledgeBaseService.java (已删除)
src/main/java/com/ruoyi/approve/service/NotificationManagementService.java (已删除)
src/main/java/com/ruoyi/approve/service/RpaProcessAutomationService.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/HolidaySettingsServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/KnowledgeBaseServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/NotificationManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/service/impl/RpaProcessAutomationServiceImpl.java (已删除)
src/main/java/com/ruoyi/approve/utils/DailyRedisCounter.java (已删除)
src/main/java/com/ruoyi/approve/utils/ListToStringTypeHandler.java (已删除)
src/main/java/com/ruoyi/approve/utils/StartAndEndDateDto.java (已删除)
src/main/java/com/ruoyi/approve/vo/ApproveGetAndUpdateVo.java (已删除)
src/main/java/com/ruoyi/approve/vo/ApproveProcessVO.java (已删除)
src/main/java/com/ruoyi/basic/controller/CustomerController.java (已删除)
src/main/java/com/ruoyi/basic/controller/ProductController.java (已删除)
src/main/java/com/ruoyi/basic/controller/SupplierManageController.java (已删除)
src/main/java/com/ruoyi/basic/dto/ProductDto.java (已删除)
src/main/java/com/ruoyi/basic/dto/ProductModelDto.java (已删除)
src/main/java/com/ruoyi/basic/dto/ProductTreeDto.java (已删除)
src/main/java/com/ruoyi/basic/dto/StorageBlobDTO.java (已删除)
src/main/java/com/ruoyi/basic/dto/SupplierManageDto.java (已删除)
src/main/java/com/ruoyi/basic/excel/SupplierManageExcelDto.java (已删除)
src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java (已删除)
src/main/java/com/ruoyi/basic/mapper/ProductMapper.java (已删除)
src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java (已删除)
src/main/java/com/ruoyi/basic/mapper/StorageAttachmentMapper.java (已删除)
src/main/java/com/ruoyi/basic/mapper/StorageBlobMapper.java (已删除)
src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java (已删除)
src/main/java/com/ruoyi/basic/pojo/Customer.java (已删除)
src/main/java/com/ruoyi/basic/pojo/Product.java (已删除)
src/main/java/com/ruoyi/basic/pojo/ProductModel.java (已删除)
src/main/java/com/ruoyi/basic/pojo/StorageAttachment.java (已删除)
src/main/java/com/ruoyi/basic/pojo/StorageBlob.java (已删除)
src/main/java/com/ruoyi/basic/pojo/SupplierManage.java (已删除)
src/main/java/com/ruoyi/basic/service/ICustomerService.java (已删除)
src/main/java/com/ruoyi/basic/service/IProductModelService.java (已删除)
src/main/java/com/ruoyi/basic/service/IProductService.java (已删除)
src/main/java/com/ruoyi/basic/service/ISupplierService.java (已删除)
src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java (已删除)
src/main/java/com/ruoyi/basic/service/StorageBlobService.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java (已删除)
src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/DutyPlanController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/MeetingController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/NoticeController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/RulesRegulationsManagementController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/controller/StaffContactsPersonalController.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/DutyPlanDTO.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/MeetSummaryDto.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/MeetUseDto.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/MeetingItem.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/MeetingSimpleDto.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/NoticeDTO.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/RulesRegulationsManagementDTO.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/dto/StaffContactsPersonalDTO.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/DutyPlanMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/MeetApplicationMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/MeetDraftMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/MeetingMinutesMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/MeetingRoomMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/NoticeMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/ReadingStatusMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/RulesRegulationsManagementMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/SealApplicationManagementMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/mapper/StaffContactsPersonalMapper.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/DutyPlan.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/MeetApplication.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/MeetDraft.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/MeetingMinutes.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/MeetingRoom.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/Notice.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/ReadingStatus.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/RulesRegulationsManagement.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/SealApplicationManagement.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/pojo/StaffContactsPersonal.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/DutyPlanService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/MeetingService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/NoticeService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/RulesRegulationsManagementService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/SealApplicationManagementService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/StaffContactsPersonalService.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/DutyPlanServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/RulesRegulationsManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/service/impl/StaffContactsPersonalServiceImpl.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingApplicationVo.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingDraftVo.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingRoomVo.java (已删除)
src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java (已删除)
src/main/java/com/ruoyi/common/config/IgnoreTableConfig.java (已删除)
src/main/java/com/ruoyi/common/config/MinioConfig.java (已删除)
src/main/java/com/ruoyi/common/config/MyBaseMapper.java (已删除)
src/main/java/com/ruoyi/common/config/MybatisHandler.java (已删除)
src/main/java/com/ruoyi/common/config/TomcatConfig.java (已删除)
src/main/java/com/ruoyi/common/constant/CacheConstants.java (已删除)
src/main/java/com/ruoyi/common/constant/Constants.java (已删除)
src/main/java/com/ruoyi/common/constant/GenConstants.java (已删除)
src/main/java/com/ruoyi/common/constant/HttpStatus.java (已删除)
src/main/java/com/ruoyi/common/constant/ScheduleConstants.java (已删除)
src/main/java/com/ruoyi/common/constant/StorageAttachmentConstants.java (已删除)
src/main/java/com/ruoyi/common/constant/UserConstants.java (已删除)
src/main/java/com/ruoyi/common/core/text/CharsetKit.java (已删除)
src/main/java/com/ruoyi/common/core/text/Convert.java (已删除)
src/main/java/com/ruoyi/common/core/text/StrFormatter.java (已删除)
src/main/java/com/ruoyi/common/enums/FileNameType.java (已删除)
src/main/java/com/ruoyi/common/enums/HttpMethod.java (已删除)
src/main/java/com/ruoyi/common/enums/SalesLedgerType.java (已删除)
src/main/java/com/ruoyi/common/enums/StorageAttachmentRecordType.java (已删除)
src/main/java/com/ruoyi/common/enums/UserStatus.java (已删除)
src/main/java/com/ruoyi/common/exception/DemoModeException.java (已删除)
src/main/java/com/ruoyi/common/exception/GlobalException.java (已删除)
src/main/java/com/ruoyi/common/exception/ServiceException.java (已删除)
src/main/java/com/ruoyi/common/exception/UtilException.java (已删除)
src/main/java/com/ruoyi/common/exception/base/BaseException.java (已删除)
src/main/java/com/ruoyi/common/exception/file/FileException.java (已删除)
src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java (已删除)
src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java (已删除)
src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java (已删除)
src/main/java/com/ruoyi/common/exception/job/TaskException.java (已删除)
src/main/java/com/ruoyi/common/exception/user/CaptchaException.java (已删除)
src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java (已删除)
src/main/java/com/ruoyi/common/exception/user/UserException.java (已删除)
src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java (已删除)
src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java (已删除)
src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java (已删除)
src/main/java/com/ruoyi/common/filter/RepeatableFilter.java (已删除)
src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java (已删除)
src/main/java/com/ruoyi/common/filter/XssFilter.java (已删除)
src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java (已删除)
src/main/java/com/ruoyi/common/handler/CustomTenantLineHandler.java (已删除)
src/main/java/com/ruoyi/common/utils/Arith.java (已删除)
src/main/java/com/ruoyi/common/utils/DateUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/DictUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/ExceptionUtil.java (已删除)
src/main/java/com/ruoyi/common/utils/HackLoopTableRenderPolicy.java (已删除)
src/main/java/com/ruoyi/common/utils/LogUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/MessageUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/MinioUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/OrderUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/PageUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/SecurityUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/ServletUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/StringUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/Threads.java (已删除)
src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/ConfigurableMergeStrategy.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/CustomCellStyleHandler.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/ExcelClassField.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/ExcelExport.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/ExcelImport.java (已删除)
src/main/java/com/ruoyi/common/utils/excel/ExcelUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/file/FileUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/file/ImageUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java (已删除)
src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java (已删除)
src/main/java/com/ruoyi/common/utils/http/HttpHelper.java (已删除)
src/main/java/com/ruoyi/common/utils/http/HttpUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/ip/IpUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/job/AbstractQuartzJob.java (已删除)
src/main/java/com/ruoyi/common/utils/job/CronUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/job/JobInvokeUtil.java (已删除)
src/main/java/com/ruoyi/common/utils/job/QuartzDisallowConcurrentExecution.java (已删除)
src/main/java/com/ruoyi/common/utils/job/QuartzJobExecution.java (已删除)
src/main/java/com/ruoyi/common/utils/job/ScheduleUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java (已删除)
src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java (已删除)
src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/sign/Base64.java (已删除)
src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java (已删除)
src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java (已删除)
src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java (已删除)
src/main/java/com/ruoyi/common/utils/uuid/Seq.java (已删除)
src/main/java/com/ruoyi/common/utils/uuid/UUID.java (已删除)
src/main/java/com/ruoyi/common/vo/FileVo.java (已删除)
src/main/java/com/ruoyi/common/xss/Xss.java (已删除)
src/main/java/com/ruoyi/common/xss/XssValidator.java (已删除)
src/main/java/com/ruoyi/compensationperformance/controller/CompensationPerformanceController.java (已删除)
src/main/java/com/ruoyi/compensationperformance/mapper/CompensationPerformanceMapper.java (已删除)
src/main/java/com/ruoyi/compensationperformance/pojo/CompensationPerformance.java (已删除)
src/main/java/com/ruoyi/compensationperformance/service/CompensationPerformanceService.java (已删除)
src/main/java/com/ruoyi/compensationperformance/service/impl/CompensationPerformanceServiceImpl.java (已删除)
src/main/java/com/ruoyi/customervisits/controller/CustomerVisitsController.java (已删除)
src/main/java/com/ruoyi/customervisits/mapper/CustomerVisitsMapper.java (已删除)
src/main/java/com/ruoyi/customervisits/pojo/CustomerVisits.java (已删除)
src/main/java/com/ruoyi/customervisits/service/CustomerVisitsService.java (已删除)
src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/controller/DeviceDefectRecordController.java (已删除)
src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java (已删除)
src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java (已删除)
src/main/java/com/ruoyi/device/controller/DeviceMaintenanceFileController.java (已删除)
src/main/java/com/ruoyi/device/controller/DeviceRepairController.java (已删除)
src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java (已删除)
src/main/java/com/ruoyi/device/dto/DeviceDefectRecordDto.java (已删除)
src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java (已删除)
src/main/java/com/ruoyi/device/dto/DeviceMaintenanceDto.java (已删除)
src/main/java/com/ruoyi/device/dto/DeviceMonthlyRepairTableDTO.java (已删除)
src/main/java/com/ruoyi/device/dto/DeviceRepairDto.java (已删除)
src/main/java/com/ruoyi/device/dto/RepairAmountGroupDTO.java (已删除)
src/main/java/com/ruoyi/device/execl/DeviceLedgerExeclDto.java (已删除)
src/main/java/com/ruoyi/device/execl/DeviceMaintenanceExeclDto.java (已删除)
src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java (已删除)
src/main/java/com/ruoyi/device/mapper/DeviceDefectRecordMapper.java (已删除)
src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java (已删除)
src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceFileMapper.java (已删除)
src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java (已删除)
src/main/java/com/ruoyi/device/mapper/DeviceRepairMapper.java (已删除)
src/main/java/com/ruoyi/device/mapper/MaintenanceTaskMapper.java (已删除)
src/main/java/com/ruoyi/device/pojo/DeviceDefectRecord.java (已删除)
src/main/java/com/ruoyi/device/pojo/DeviceLedger.java (已删除)
src/main/java/com/ruoyi/device/pojo/DeviceMaintenance.java (已删除)
src/main/java/com/ruoyi/device/pojo/DeviceMaintenanceFile.java (已删除)
src/main/java/com/ruoyi/device/pojo/DeviceRepair.java (已删除)
src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java (已删除)
src/main/java/com/ruoyi/device/service/DeviceDefectRecordService.java (已删除)
src/main/java/com/ruoyi/device/service/DeviceMaintenanceFileService.java (已删除)
src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java (已删除)
src/main/java/com/ruoyi/device/service/IDeviceMaintenanceService.java (已删除)
src/main/java/com/ruoyi/device/service/IDeviceRepairService.java (已删除)
src/main/java/com/ruoyi/device/service/MaintenanceTaskService.java (已删除)
src/main/java/com/ruoyi/device/service/impl/DeviceDefectRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java (已删除)
src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java (已删除)
src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskScheduler.java (已删除)
src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java (已删除)
src/main/java/com/ruoyi/dto/DateQueryDto.java (已删除)
src/main/java/com/ruoyi/dto/MapDto.java (已删除)
src/main/java/com/ruoyi/dto/PageDto.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/controller/ElectricityConsumptionAreaController.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/controller/EnergyPeriodController.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/controller/EquipmentEnergyConsumptionController.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/dto/ElectricityConsumptionAreaTreeDto.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/dto/EquipmentEnergyConsumptionDto.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/mapper/ElectricityConsumptionAreaMapper.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/mapper/EnergyPeriodMapper.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/mapper/EquipmentEnergyConsumptionMapper.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/pojo/ElectricityConsumptionArea.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/pojo/EnergyPeriod.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/pojo/EquipmentEnergyConsumption.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/ElectricityConsumptionAreaService.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/EnergyPeriodService.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/EquipmentEnergyConsumptionService.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/impl/ElectricityConsumptionAreaServiceImpl.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/impl/EnergyPeriodServiceImpl.java (已删除)
src/main/java/com/ruoyi/equipmentenergyconsumption/service/impl/EquipmentEnergyConsumptionServiceImpl.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/LogAspect.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Anonymous.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataScope.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Excel.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Excels.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Log.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/RateLimiter.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Sensitive.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessStatus.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessType.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/DataSourceType.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/DesensitizedType.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/LimitType.java (已删除)
src/main/java/com/ruoyi/framework/aspectj/lang/enums/OperatorType.java (已删除)
src/main/java/com/ruoyi/framework/config/ApplicationConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/CaptchaConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/DruidConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java (已删除)
src/main/java/com/ruoyi/framework/config/FilterConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/GenConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java (已删除)
src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/RedisConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/ResourcesConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/RuoYiConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/ScheduleConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/SecurityConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/SensitiveJsonSerializer.java (已删除)
src/main/java/com/ruoyi/framework/config/ServerConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/SwaggerConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java (已删除)
src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java (已删除)
src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java (已删除)
src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java (已删除)
src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java (已删除)
src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java (已删除)
src/main/java/com/ruoyi/framework/interceptor/annotation/RepeatSubmit.java (已删除)
src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java (已删除)
src/main/java/com/ruoyi/framework/manager/AsyncManager.java (已删除)
src/main/java/com/ruoyi/framework/manager/ShutdownManager.java (已删除)
src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java (已删除)
src/main/java/com/ruoyi/framework/redis/RedisCache.java (已删除)
src/main/java/com/ruoyi/framework/security/LoginBody.java (已删除)
src/main/java/com/ruoyi/framework/security/LoginUser.java (已删除)
src/main/java/com/ruoyi/framework/security/RegisterBody.java (已删除)
src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java (已删除)
src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java (已删除)
src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java (已删除)
src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java (已删除)
src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java (已删除)
src/main/java/com/ruoyi/framework/security/service/PermissionService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/SysLoginService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/SysPasswordService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/SysPermissionService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/SysRegisterService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/TokenService.java (已删除)
src/main/java/com/ruoyi/framework/security/service/UserDetailsServiceImpl.java (已删除)
src/main/java/com/ruoyi/framework/task/RyTask.java (已删除)
src/main/java/com/ruoyi/framework/web/controller/BaseController.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/MinioResult.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/R.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/Server.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/TreeEntity.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/TreeSelect.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/server/Mem.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/server/Sys.java (已删除)
src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java (已删除)
src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java (已删除)
src/main/java/com/ruoyi/framework/web/page/PageDomain.java (已删除)
src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java (已删除)
src/main/java/com/ruoyi/framework/web/page/TableSupport.java (已删除)
src/main/java/com/ruoyi/home/controller/HomeController.java (已删除)
src/main/java/com/ruoyi/home/dto/AnalysisCustomerContractAmountsDto.java (已删除)
src/main/java/com/ruoyi/home/dto/HomeBusinessDto.java (已删除)
src/main/java/com/ruoyi/home/dto/QualityStatisticsDto.java (已删除)
src/main/java/com/ruoyi/home/dto/QualityStatisticsItem.java (已删除)
src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java (已删除)
src/main/java/com/ruoyi/home/service/HomeService.java (已删除)
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java (已删除)
src/main/java/com/ruoyi/inspectiontask/StorageAttachmentRecordType.java (已删除)
src/main/java/com/ruoyi/inspectiontask/controller/InspectionTaskController.java (已删除)
src/main/java/com/ruoyi/inspectiontask/controller/QrCodeController.java (已删除)
src/main/java/com/ruoyi/inspectiontask/controller/QrCodeScanRecordController.java (已删除)
src/main/java/com/ruoyi/inspectiontask/controller/TimingTaskController.java (已删除)
src/main/java/com/ruoyi/inspectiontask/dto/InspectionTaskDto.java (已删除)
src/main/java/com/ruoyi/inspectiontask/dto/QrCodeDto.java (已删除)
src/main/java/com/ruoyi/inspectiontask/dto/QrCodeScanRecordDto.java (已删除)
src/main/java/com/ruoyi/inspectiontask/dto/TimingTaskDto.java (已删除)
src/main/java/com/ruoyi/inspectiontask/mapper/InspectionTaskMapper.java (已删除)
src/main/java/com/ruoyi/inspectiontask/mapper/QrCodeMapper.java (已删除)
src/main/java/com/ruoyi/inspectiontask/mapper/QrCodeScanRecordMapper.java (已删除)
src/main/java/com/ruoyi/inspectiontask/mapper/TimingTaskMapper.java (已删除)
src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java (已删除)
src/main/java/com/ruoyi/inspectiontask/pojo/QrCode.java (已删除)
src/main/java/com/ruoyi/inspectiontask/pojo/QrCodeScanRecord.java (已删除)
src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/InspectionTaskService.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/QrCodeScanRecordService.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/QrCodeService.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/TimingTaskService.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeServiceImpl.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/QuartzConfig.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/SpringContextHolder.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskScheduler.java (已删除)
src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java (已删除)
src/main/java/com/ruoyi/lavorissue/controller/LavorIssueController.java (已删除)
src/main/java/com/ruoyi/lavorissue/dto/StatisticsLaborIssue.java (已删除)
src/main/java/com/ruoyi/lavorissue/mapper/LavorIssueMapper.java (已删除)
src/main/java/com/ruoyi/lavorissue/pojo/LaborIssue.java (已删除)
src/main/java/com/ruoyi/lavorissue/service/LavorIssueService.java (已删除)
src/main/java/com/ruoyi/lavorissue/service/impl/LavorIssueServiceImpl.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/controller/MeasuringInstrumentLedgerController.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/controller/MeasuringInstrumentLedgerRecordController.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/controller/SparePartsController.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/dto/MeasuringInstrumentLedgerDto.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/dto/SparePartsDto.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/mapper/MeasuringInstrumentLedgerMapper.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/mapper/MeasuringInstrumentLedgerRecordMapper.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/mapper/SparePartsMapper.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/pojo/MeasuringInstrumentLedger.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/pojo/MeasuringInstrumentLedgerRecord.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/pojo/SpareParts.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/MeasuringInstrumentLedgerRecordService.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/MeasuringInstrumentLedgerService.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/SparePartsService.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/SparePartsServiceImpl.java (已删除)
src/main/java/com/ruoyi/oA/controller/OaProjectController.java (已删除)
src/main/java/com/ruoyi/oA/controller/OaProjectPhaseController.java (已删除)
src/main/java/com/ruoyi/oA/controller/OaProjectPhaseTaskController.java (已删除)
src/main/java/com/ruoyi/oA/dto/OaProjectDto.java (已删除)
src/main/java/com/ruoyi/oA/dto/OaProjectPhaseDto.java (已删除)
src/main/java/com/ruoyi/oA/mapper/OaProjectMapper.java (已删除)
src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseMapper.java (已删除)
src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseTaskMapper.java (已删除)
src/main/java/com/ruoyi/oA/pojo/OaProject.java (已删除)
src/main/java/com/ruoyi/oA/pojo/OaProjectPhase.java (已删除)
src/main/java/com/ruoyi/oA/pojo/OaProjectPhaseTask.java (已删除)
src/main/java/com/ruoyi/oA/service/OaProjectPhaseService.java (已删除)
src/main/java/com/ruoyi/oA/service/OaProjectPhaseTaskService.java (已删除)
src/main/java/com/ruoyi/oA/service/OaProjectService.java (已删除)
src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseServiceImpl.java (已删除)
src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseTaskServiceImpl.java (已删除)
src/main/java/com/ruoyi/oA/service/impl/OaProjectServiceImpl.java (已删除)
src/main/java/com/ruoyi/officesupplies/controller/OfficeSuppliesController.java (已删除)
src/main/java/com/ruoyi/officesupplies/mapper/OfficeSuppliesMapper.java (已删除)
src/main/java/com/ruoyi/officesupplies/pojo/OfficeSupplies.java (已删除)
src/main/java/com/ruoyi/officesupplies/service/OfficeSuppliesService.java (已删除)
src/main/java/com/ruoyi/officesupplies/service/impl/OfficeSuppliesServiceImpl.java (已删除)
src/main/java/com/ruoyi/other/controller/TempFileController.java (已删除)
src/main/java/com/ruoyi/other/mapper/TempFileMapper.java (已删除)
src/main/java/com/ruoyi/other/pojo/TempFile.java (已删除)
src/main/java/com/ruoyi/other/service/TempFileService.java (已删除)
src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/GasTankWarningController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/InboundManagementController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementPlanController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementPriceManagementController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/Details.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementAddDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementManagementUpdateDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutAdd.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutPageDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementUpdateDto.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/GasTankWarningMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/InboundManagementMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementPlanMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementPriceManagementMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/GasTankWarning.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/InboundManagement.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/ProcurementPlan.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/ProcurementPriceManagement.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/ProcurementRecordOut.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/ProcurementRecordStorage.java (已删除)
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/GasTankWarningService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/InboundManagementService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/ProcurementPlanService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/ProcurementPriceManagementService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/GasTankWarningServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/InboundManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementPlanServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementPriceManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java (已删除)
src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java (已删除)
src/main/java/com/ruoyi/production/controller/SalesLedgerWorkController.java (已删除)
src/main/java/com/ruoyi/production/dto/DaiDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProcessSchedulingDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionDispatchAddDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionReportDto.java (已删除)
src/main/java/com/ruoyi/production/dto/SalesLedgerProductDto.java (已删除)
src/main/java/com/ruoyi/production/dto/SalesLedgerProductionAccountingDto.java (已删除)
src/main/java/com/ruoyi/production/dto/SalesLedgerSchedulingDto.java (已删除)
src/main/java/com/ruoyi/production/dto/SalesLedgerSchedulingProcessDto.java (已删除)
src/main/java/com/ruoyi/production/dto/SalesLedgerWorkDto.java (已删除)
src/main/java/com/ruoyi/production/mapper/SalesLedgerProductionAccountingMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/SalesLedgerSchedulingMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/SalesLedgerWorkMapper.java (已删除)
src/main/java/com/ruoyi/production/pojo/SalesLedgerProductionAccounting.java (已删除)
src/main/java/com/ruoyi/production/pojo/SalesLedgerScheduling.java (已删除)
src/main/java/com/ruoyi/production/pojo/SalesLedgerWork.java (已删除)
src/main/java/com/ruoyi/production/service/SalesLedgerProductionAccountingService.java (已删除)
src/main/java/com/ruoyi/production/service/SalesLedgerSchedulingService.java (已删除)
src/main/java/com/ruoyi/production/service/SalesLedgerWorkService.java (已删除)
src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/SalesLedgerSchedulingServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/SalesLedgerWorkServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/common/CaptchaController.java (已删除)
src/main/java/com/ruoyi/project/common/CommonController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/CacheController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/ServerController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java (已删除)
src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysCache.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysJob.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysJobLog.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysLogininfor.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysOperLog.java (已删除)
src/main/java/com/ruoyi/project/monitor/domain/SysUserOnline.java (已删除)
src/main/java/com/ruoyi/project/monitor/mapper/SysJobLogMapper.java (已删除)
src/main/java/com/ruoyi/project/monitor/mapper/SysJobMapper.java (已删除)
src/main/java/com/ruoyi/project/monitor/mapper/SysLogininforMapper.java (已删除)
src/main/java/com/ruoyi/project/monitor/mapper/SysOperLogMapper.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/ISysJobLogService.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/ISysJobService.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/ISysLogininforService.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/ISysOperLogService.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/impl/SysJobLogServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/impl/SysJobServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/impl/SysLogininforServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/monitor/service/impl/SysOperLogServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysConfigController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysDeptController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysIndexController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysLoginController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysMenuController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysPostController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysProfileController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysRoleController.java (已删除)
src/main/java/com/ruoyi/project/system/controller/SysUserController.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysConfig.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysDept.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysDictData.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysDictType.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysMenu.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysNotice.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysPost.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysRole.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysRoleDept.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysRoleMenu.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysUser.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysUserDept.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysUserPost.java (已删除)
src/main/java/com/ruoyi/project/system/domain/SysUserRole.java (已删除)
src/main/java/com/ruoyi/project/system/domain/vo/MetaVo.java (已删除)
src/main/java/com/ruoyi/project/system/domain/vo/RouterVo.java (已删除)
src/main/java/com/ruoyi/project/system/domain/vo/SysUserDeptVo.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysConfigMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysDeptMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysDictDataMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysDictTypeMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysMenuMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysNoticeMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysPostMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysRoleDeptMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysRoleMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysRoleMenuMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysUserPostMapper.java (已删除)
src/main/java/com/ruoyi/project/system/mapper/SysUserRoleMapper.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysConfigService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysDeptService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysDictDataService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysDictTypeService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysMenuService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysNoticeService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysPostService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysRoleService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysUserDeptService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysUserOnlineService.java (已删除)
src/main/java/com/ruoyi/project/system/service/ISysUserService.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysConfigServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysDictDataServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysDictTypeServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysMenuServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysRoleServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysUserDeptServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysUserOnlineServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java (已删除)
src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java (已删除)
src/main/java/com/ruoyi/project/tool/swagger/TestController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/InvoicePurchaseController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/PaymentRegistrationController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java (已删除)
src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseReportDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PaymentHistoryRecordVo.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PaymentLedgerDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PaymentRegistrationDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/ProductRecordDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/TicketRegistrationDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/VatDto.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/InvoicePurchaseMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/PaymentRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/ProductRecordMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/TicketRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/InvoicePurchase.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java (已删除)
src/main/java/com/ruoyi/purchase/service/IInvoicePurchaseService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IPaymentRegistrationService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IProductRecordService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java (已删除)
src/main/java/com/ruoyi/purchase/service/ITicketRegistrationService.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/InvoicePurchaseServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/quality/controller/QualityInspectController.java (已删除)
src/main/java/com/ruoyi/quality/controller/QualityInspectFileController.java (已删除)
src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java (已删除)
src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java (已删除)
src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java (已删除)
src/main/java/com/ruoyi/quality/dto/QualityInspectDto.java (已删除)
src/main/java/com/ruoyi/quality/mapper/QualityInspectFileMapper.java (已删除)
src/main/java/com/ruoyi/quality/mapper/QualityInspectMapper.java (已删除)
src/main/java/com/ruoyi/quality/mapper/QualityInspectParamMapper.java (已删除)
src/main/java/com/ruoyi/quality/mapper/QualityTestStandardMapper.java (已删除)
src/main/java/com/ruoyi/quality/mapper/QualityUnqualifiedMapper.java (已删除)
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java (已删除)
src/main/java/com/ruoyi/quality/pojo/QualityInspectFile.java (已删除)
src/main/java/com/ruoyi/quality/pojo/QualityInspectParam.java (已删除)
src/main/java/com/ruoyi/quality/pojo/QualityTestStandard.java (已删除)
src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java (已删除)
src/main/java/com/ruoyi/quality/service/IQualityInspectFileService.java (已删除)
src/main/java/com/ruoyi/quality/service/IQualityInspectParamService.java (已删除)
src/main/java/com/ruoyi/quality/service/IQualityInspectService.java (已删除)
src/main/java/com/ruoyi/quality/service/IQualityTestStandardService.java (已删除)
src/main/java/com/ruoyi/quality/service/IQualityUnqualifiedService.java (已删除)
src/main/java/com/ruoyi/quality/service/impl/QualityInspectFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/quality/service/impl/QualityInspectParamServiceImpl.java (已删除)
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java (已删除)
src/main/java/com/ruoyi/quality/service/impl/QualityTestStandardServiceImpl.java (已删除)
src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/controller/CommonFileController.java (已删除)
src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java (已删除)
src/main/java/com/ruoyi/sales/controller/InvoiceRegistrationController.java (已删除)
src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java (已删除)
src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java (已删除)
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java (已删除)
src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java (已删除)
src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java (已删除)
src/main/java/com/ruoyi/sales/controller/SalespersonManagementController.java (已删除)
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java (已删除)
src/main/java/com/ruoyi/sales/dto/CustomerInteractionDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationProductDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/MonthlyAmountDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentExeclDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentRecordDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java (已删除)
src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java (已删除)
src/main/java/com/ruoyi/sales/excel/InvoiceRegisAndProductExcelDto.java (已删除)
src/main/java/com/ruoyi/sales/mapper/CommonFileMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerFileMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationProductMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/PaymentShippingMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalesQuotationMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalesQuotationProductMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalespersonManagementMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java (已删除)
src/main/java/com/ruoyi/sales/pojo/CommonFile.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceLedger.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceLedgerFile.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceRegistration.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceRegistrationProduct.java (已删除)
src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java (已删除)
src/main/java/com/ruoyi/sales/pojo/PurchaseLedgerFile.java (已删除)
src/main/java/com/ruoyi/sales/pojo/ReceiptPayment.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalespersonManagement.java (已删除)
src/main/java/com/ruoyi/sales/pojo/ShippingInfo.java (已删除)
src/main/java/com/ruoyi/sales/service/ICommonFileService.java (已删除)
src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java (已删除)
src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java (已删除)
src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java (已删除)
src/main/java/com/ruoyi/sales/service/InvoiceRegistrationService.java (已删除)
src/main/java/com/ruoyi/sales/service/PaymentShippingService.java (已删除)
src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java (已删除)
src/main/java/com/ruoyi/sales/service/SalesQuotationProductService.java (已删除)
src/main/java/com/ruoyi/sales/service/SalesQuotationService.java (已删除)
src/main/java/com/ruoyi/sales/service/SalespersonManagementService.java (已删除)
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/InvoiceRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/PaymentShippingServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationProductServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalespersonManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/vo/SalesLedgerProductVo.java (已删除)
src/main/java/com/ruoyi/sales/vo/ShippingInfoVo.java (已删除)
src/main/java/com/ruoyi/staff/controller/HolidayApplicationController.java (已删除)
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceRecordsController.java (已删除)
src/main/java/com/ruoyi/staff/controller/StaffJoinLeaveRecordController.java (已删除)
src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java (已删除)
src/main/java/com/ruoyi/staff/controller/StaffSchedulingController.java (已删除)
src/main/java/com/ruoyi/staff/dto/SaveStaffSchedulingDto.java (已删除)
src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java (已删除)
src/main/java/com/ruoyi/staff/dto/StaffSchedulingDto.java (已删除)
src/main/java/com/ruoyi/staff/mapper/HolidayApplicationMapper.java (已删除)
src/main/java/com/ruoyi/staff/mapper/PersonalAttendanceRecordsMapper.java (已删除)
src/main/java/com/ruoyi/staff/mapper/StaffJoinLeaveRecordMapper.java (已删除)
src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java (已删除)
src/main/java/com/ruoyi/staff/mapper/StaffSchedulingMapper.java (已删除)
src/main/java/com/ruoyi/staff/pojo/HolidayApplication.java (已删除)
src/main/java/com/ruoyi/staff/pojo/PersonalAttendanceRecords.java (已删除)
src/main/java/com/ruoyi/staff/pojo/StaffJoinLeaveRecord.java (已删除)
src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java (已删除)
src/main/java/com/ruoyi/staff/pojo/StaffScheduling.java (已删除)
src/main/java/com/ruoyi/staff/service/HolidayApplicationService.java (已删除)
src/main/java/com/ruoyi/staff/service/IStaffJoinLeaveRecordService.java (已删除)
src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java (已删除)
src/main/java/com/ruoyi/staff/service/PersonalAttendanceRecordsService.java (已删除)
src/main/java/com/ruoyi/staff/service/StaffSchedulingService.java (已删除)
src/main/java/com/ruoyi/staff/service/impl/HolidayApplicationServiceImpl.java (已删除)
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java (已删除)
src/main/java/com/ruoyi/staff/service/impl/StaffJoinLeaveRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java (已删除)
src/main/java/com/ruoyi/staff/service/impl/StaffSchedulingServiceImpl.java (已删除)
src/main/java/com/ruoyi/staff/vo/SearchSchedulingVo.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/DocumentClassificationController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/DocumentationBorrowManagementController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/DocumentationController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java (已删除)
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesRowcolController.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/DocumentClassificationDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/DocumentClassificationTreeDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/DocumentationBorrowManagementDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/DocumentationDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/DocumentationReturnManagementDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/ReturnExportDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/WarehouseDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/WarehouseGoodsShelvesDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/WarehouseGoodsShelvesRowcolDto.java (已删除)
src/main/java/com/ruoyi/warehouse/dto/WarehouseTreeDto.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/DocumentClassificationMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/DocumentationBorrowManagementMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/DocumentationReturnManagementMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/WarehouseGoodsShelvesMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/WarehouseGoodsShelvesRowcolMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/mapper/WarehouseMapper.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/DocumentClassification.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/Documentation.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/DocumentationBorrowManagement.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/DocumentationFile.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/DocumentationReturnManagement.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/Warehouse.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/WarehouseGoodsShelves.java (已删除)
src/main/java/com/ruoyi/warehouse/pojo/WarehouseGoodsShelvesRowcol.java (已删除)
src/main/java/com/ruoyi/warehouse/service/DocumentClassificationService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/DocumentationBorrowManagementService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/DocumentationService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/WarehouseGoodsShelvesRowcolService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/WarehouseGoodsShelvesService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/WarehouseService.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/DocumentClassificationServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/DocumentationBorrowManagementServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/DocumentationFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/DocumentationServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesRowcolServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java (已删除)
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseServiceImpl.java (已删除)
src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java (已删除)
src/main/java/com/ruoyi/waterrecord/mapper/WaterRecordMapper.java (已删除)
src/main/java/com/ruoyi/waterrecord/pojo/WaterRecord.java (已删除)
src/main/java/com/ruoyi/waterrecord/service/WaterRecordService.java (已删除)
src/main/java/com/ruoyi/waterrecord/service/impl/WaterRecordServiceImpl.java (已删除)
src/main/resources/application-aynm.yml (已删除)
src/main/resources/application-bdsm.yml (已删除)
src/main/resources/application-bhmy.yml (已删除)
src/main/resources/application-cjny.yml (已删除)
src/main/resources/application-cmny.yml (已删除)
src/main/resources/application-demo.yml (已删除)
src/main/resources/application-dev.yml (已删除)
src/main/resources/application-dhdc.yml (已删除)
src/main/resources/application-druid.yml (已删除)
src/main/resources/application-dzys.yml (已删除)
src/main/resources/application-hbkj.yml (已删除)
src/main/resources/application-hbxm.yml (已删除)
src/main/resources/application-hckx.yml (已删除)
src/main/resources/application-hcmy.yml (已删除)
src/main/resources/application-hhkj.yml (已删除)
src/main/resources/application-hsmy.yml (已删除)
src/main/resources/application-hsxny.yml (已删除)
src/main/resources/application-hxgy.yml (已删除)
src/main/resources/application-hxsj.yml (已删除)
src/main/resources/application-hysn.yml (已删除)
src/main/resources/application-jjxm.yml (已删除)
src/main/resources/application-jlsn.yml (已删除)
src/main/resources/application-jmsl.yml (已删除)
src/main/resources/application-jsmy.yml (已删除)
src/main/resources/application-jsyny.yml (已删除)
src/main/resources/application-jyhj.yml (已删除)
src/main/resources/application-khl.yml (已删除)
src/main/resources/application-mkzs.yml (已删除)
src/main/resources/application-mqsp.yml (已删除)
src/main/resources/application-mxsc.yml (已删除)
src/main/resources/application-nydl.yml (已删除)
src/main/resources/application-phmk.yml (已删除)
src/main/resources/application-prod.yml (已删除)
src/main/resources/application-qlmc.yml (已删除)
src/main/resources/application-rzny.yml (已删除)
src/main/resources/application-test.yml (已删除)
src/main/resources/application-test1.yml (已删除)
src/main/resources/application-tjxm.yml (已删除)
src/main/resources/application-trsw.yml (已删除)
src/main/resources/application-tymk.yml (已删除)
src/main/resources/application-wdsy.yml (已删除)
src/main/resources/application-xyhb.yml (已删除)
src/main/resources/application-zjyj.yml (已删除)
src/main/resources/application-zqhx.yml (已删除)
src/main/resources/application-zyrq.yml (已删除)
src/main/resources/application-zyrqCopy.yml (已删除)
src/main/resources/application.yml (已删除)
src/main/resources/banner.txt (已删除)
src/main/resources/i18n/messages.properties (已删除)
src/main/resources/logback.xml (已删除)
src/main/resources/mapper/account/AccountExpenseMapper.xml (已删除)
src/main/resources/mapper/account/AccountFileMapper.xml (已删除)
src/main/resources/mapper/account/AccountIncomeMapper.xml (已删除)
src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml (已删除)
src/main/resources/mapper/approve/AnnualLeaveSettingMapper.xml (已删除)
src/main/resources/mapper/approve/ApproveLogMapper.xml (已删除)
src/main/resources/mapper/approve/ApproveNodeMapper.xml (已删除)
src/main/resources/mapper/approve/ApproveProcessMapper.xml (已删除)
src/main/resources/mapper/approve/FileSharingMapper.xml (已删除)
src/main/resources/mapper/approve/HolidaySettingsMapper.xml (已删除)
src/main/resources/mapper/approve/KnowledgeBaseMapper.xml (已删除)
src/main/resources/mapper/approve/NotificationManagementMapper.xml (已删除)
src/main/resources/mapper/approve/OnlineMeetingMapper.xml (已删除)
src/main/resources/mapper/approve/OvertimeSettingMapper.xml (已删除)
src/main/resources/mapper/approve/RpaProcessAutomationMapper.xml (已删除)
src/main/resources/mapper/approve/WorkingHoursSettingMapper.xml (已删除)
src/main/resources/mapper/basic/StorageAttachmentMapper.xml (已删除)
src/main/resources/mapper/basic/StorageBlobMapper.xml (已删除)
src/main/resources/mapper/basic/SupplierManageMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/DutyPlanMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/MeetApplicationMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/MeetDraftMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/MeetingMinutesMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/MeetingRoomMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/ReadingStatusMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml (已删除)
src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml (已删除)
src/main/resources/mapper/compensationperformance/CompensationPerformanceMapper.xml (已删除)
src/main/resources/mapper/customervisits/CustomerVisitsMapper.xml (已删除)
src/main/resources/mapper/device/DeviceDefectRecordMapper.xml (已删除)
src/main/resources/mapper/device/DeviceLedgerMapper.xml (已删除)
src/main/resources/mapper/device/DeviceMaintenanceMapper.xml (已删除)
src/main/resources/mapper/device/DeviceRepairMapper.xml (已删除)
src/main/resources/mapper/equipmentenergyconsumption/EnergyPeriodMapper.xml (已删除)
src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml (已删除)
src/main/resources/mapper/equipmentenergyconsumption/electricityConsumptionAreaMapper.xml (已删除)
src/main/resources/mapper/inspectiontask/TimingTaskMapper.xml (已删除)
src/main/resources/mapper/lavorissue/LavorIssueMapper.xml (已删除)
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml (已删除)
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml (已删除)
src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml (已删除)
src/main/resources/mapper/monitor/SysLogininforMapper.xml (已删除)
src/main/resources/mapper/monitor/SysOperLogMapper.xml (已删除)
src/main/resources/mapper/oA/OaProjectMapper.xml (已删除)
src/main/resources/mapper/oA/OaProjectPhaseMapper.xml (已删除)
src/main/resources/mapper/oA/OaProjectPhaseTaskMapper.xml (已删除)
src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/GasTankWarningMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/ProcurementPlanMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/ProcurementPriceManagementMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml (已删除)
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml (已删除)
src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml (已删除)
src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml (已删除)
src/main/resources/mapper/production/SalesLedgerWorkMapper.xml (已删除)
src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml (已删除)
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml (已删除)
src/main/resources/mapper/purchase/ProductRecordMapper.xml (已删除)
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml (已删除)
src/main/resources/mapper/quality/QualityInspectFileMapper.xml (已删除)
src/main/resources/mapper/quality/QualityInspectMapper.xml (已删除)
src/main/resources/mapper/quality/QualityInspectParamMapper.xml (已删除)
src/main/resources/mapper/quality/QualityTestStandardMapper.xml (已删除)
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml (已删除)
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml (已删除)
src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml (已删除)
src/main/resources/mapper/sales/InvoiceRegistrationProductMapper.xml (已删除)
src/main/resources/mapper/sales/PaymentShippingMapper.xml (已删除)
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml (已删除)
src/main/resources/mapper/sales/SalesLedgerMapper.xml (已删除)
src/main/resources/mapper/sales/SalesQuotationMapper.xml (已删除)
src/main/resources/mapper/sales/SalesQuotationProductMapper.xml (已删除)
src/main/resources/mapper/sales/SalespersonManagementMapper.xml (已删除)
src/main/resources/mapper/sales/ShippingInfoMapper.xml (已删除)
src/main/resources/mapper/staff/HolidayApplicationMapper.xml (已删除)
src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml (已删除)
src/main/resources/mapper/staff/StaffJoinLeaveRecordMapper.xml (已删除)
src/main/resources/mapper/staff/StaffOnJobMapper.xml (已删除)
src/main/resources/mapper/staff/StaffSchedulingMapper.xml (已删除)
src/main/resources/mapper/system/SysConfigMapper.xml (已删除)
src/main/resources/mapper/system/SysDeptMapper.xml (已删除)
src/main/resources/mapper/system/SysDictDataMapper.xml (已删除)
src/main/resources/mapper/system/SysDictTypeMapper.xml (已删除)
src/main/resources/mapper/system/SysJobLogMapper.xml (已删除)
src/main/resources/mapper/system/SysJobMapper.xml (已删除)
src/main/resources/mapper/system/SysMenuMapper.xml (已删除)
src/main/resources/mapper/system/SysNoticeMapper.xml (已删除)
src/main/resources/mapper/system/SysPostMapper.xml (已删除)
src/main/resources/mapper/system/SysRoleDeptMapper.xml (已删除)
src/main/resources/mapper/system/SysRoleMapper.xml (已删除)
src/main/resources/mapper/system/SysRoleMenuMapper.xml (已删除)
src/main/resources/mapper/system/SysUserDeptMapper.xml (已删除)
src/main/resources/mapper/system/SysUserMapper.xml (已删除)
src/main/resources/mapper/system/SysUserPostMapper.xml (已删除)
src/main/resources/mapper/system/SysUserRoleMapper.xml (已删除)
src/main/resources/mapper/tool/GenTableColumnMapper.xml (已删除)
src/main/resources/mapper/tool/GenTableMapper.xml (已删除)
src/main/resources/mapper/warehouse/DocumentClassificationMapper.xml (已删除)
src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml (已删除)
src/main/resources/mapper/warehouse/DocumentationFileMapper.xml (已删除)
src/main/resources/mapper/warehouse/DocumentationMapper.xml (已删除)
src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml (已删除)
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml (已删除)
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml (已删除)
src/main/resources/mapper/warehouse/WarehouseMapper.xml (已删除)
src/main/resources/mapper/waterrecord/WaterRecordMapper.xml (已删除)
src/main/resources/mybatis/mybatis-config.xml (已删除)
src/main/resources/static/report-template.docx (已删除)
src/main/resources/vm/java/controller.java.vm (已删除)
src/main/resources/vm/java/domain.java.vm (已删除)
src/main/resources/vm/java/mapper.java.vm (已删除)
src/main/resources/vm/java/service.java.vm (已删除)
src/main/resources/vm/java/serviceImpl.java.vm (已删除)
src/main/resources/vm/java/sub-domain.java.vm (已删除)
src/main/resources/vm/js/api.js.vm (已删除)
src/main/resources/vm/sql/sql.vm (已删除)
src/main/resources/vm/vue/index-tree.vue.vm (已删除)
src/main/resources/vm/vue/index.vue.vm (已删除)
src/main/resources/vm/vue/v3/index-tree.vue.vm (已删除)
src/main/resources/vm/vue/v3/index.vue.vm (已删除)
src/main/resources/vm/xml/mapper.xml.vm (已删除)
start-dev.cmd |