feat(migration): 接入 5 个 cnas 模块骨架,补迁 ruoyi-common/ruoyi-system 缺失文件
- 根 pom 注册 cnas-require/manage/device/process/personnel 并声明 poi-tl、
fastjson(v1 兼容包)、weixin-java-cp/common、aspose-words、itextpdf
- ruoyi-common 增 fastjson + 企业微信依赖;ruoyi-admin 声明 5 个 cnas 模块
- 补迁 ruoyi-common 25 个文件(InformationNotification、PersonalScope、
WxCpUtils、IfsApiUtils 等)与 ruoyi-system 13 个文件(通知/客户/部门
mapper+service+XML)
- 机械转换:javax.annotation→jakarta.annotation;Swagger2 注解→OpenAPI 3 @Schema
- 两处第三方依赖规避:去掉未使用的 org.jetbrains.annotations 导入,
IoUtils.copy→InputStream.transferTo
已核对 lims-xjxj 中存在 custom/department_lims/information_notification/user
表,mapper XML 表名一致。
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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>cnas-device</artifactId> |
| | | |
| | | <description> |
| | | CNAS è®¾å¤æ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MyBatis-Plus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Excel å·¥å
· --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- hutool å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- fastjson v1 API å
¼å®¹å
--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </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> |
| | | |
| | | <artifactId>cnas-manage</artifactId> |
| | | |
| | | <description> |
| | | CNAS ç®¡çæ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MyBatis-Plus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Excel å·¥å
· --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- hutool å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- word 转 pdf --> |
| | | <dependency> |
| | | <groupId>com.aspose</groupId> |
| | | <artifactId>aspose-words</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </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> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi</artifactId> |
| | | <version>3.9.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cnas-personnel</artifactId> |
| | | |
| | | <description> |
| | | CNAS äººåæ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!-- éç¨å·¥å
·--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- æ ¸å¿æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- ç³»ç»æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | </dependency> |
| | | |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MyBatis-Plus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Excel å·¥å
· --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </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> |
| | | |
| | | <artifactId>cnas-process</artifactId> |
| | | |
| | | <description> |
| | | CNAS è¿ç¨æ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-device</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MyBatis-Plus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Excel å·¥å
· --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- hutool å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- fastjson v1 API å
¼å®¹å
--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- word 转 pdf --> |
| | | <dependency> |
| | | <groupId>com.aspose</groupId> |
| | | <artifactId>aspose-words</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </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> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi</artifactId> |
| | | <version>3.9.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cnas-require</artifactId> |
| | | |
| | | <description> |
| | | CNAS è¦æ±æ¨¡å |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!-- éç¨å·¥å
·--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- æ ¸å¿æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- MyBatis-Plus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Excel å·¥å
· --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- hutool å·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- fastjson v1 API å
¼å®¹å
--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | <guava.version>33.6.0-jre</guava.version> |
| | | <commons.text.version>1.10.0</commons.text.version> |
| | | <swagger.annotations.version>2.2.52</swagger.annotations.version> |
| | | <poi.tl.version>1.12.2</poi.tl.version> |
| | | <fastjson.compat.version>2.0.23</fastjson.compat.version> |
| | | <weixin.version>4.1.0</weixin.version> |
| | | <aspose.words.version>15.12.0</aspose.words.version> |
| | | <itextpdf.version>5.0.6</itextpdf.version> |
| | | </properties> |
| | | |
| | | <!-- ä¾èµå£°æ --> |
| | |
| | | <artifactId>performance-server</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-require</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-manage</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-device</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-process</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-personnel</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- poi-tlï¼Word æ¥è¡¨æ¨¡æ¿å¡«å
--> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | <version>${poi.tl.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- fastjson v1 API å
¼å®¹å
ï¼ç± fastjson2 æä¾ com.alibaba.fastjson.*ï¼ --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>${fastjson.compat.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- ä¼ä¸å¾®ä¿¡ --> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-cp</artifactId> |
| | | <version>${weixin.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-common</artifactId> |
| | | <version>${weixin.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- word 转 pdf --> |
| | | <dependency> |
| | | <groupId>com.aspose</groupId> |
| | | <artifactId>aspose-words</artifactId> |
| | | <version>${aspose.words.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.itextpdf</groupId> |
| | | <artifactId>itextpdf</artifactId> |
| | | <version>${itextpdf.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | |
| | | <module>basic-server</module> |
| | | <module>inspect-server</module> |
| | | <module>performance-server</module> |
| | | <module>cnas-require</module> |
| | | <module>cnas-manage</module> |
| | | <module>cnas-device</module> |
| | | <module>cnas-process</module> |
| | | <module>cnas-personnel</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | |
| | | <artifactId>performance-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- CNAS è¦æ± --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-require</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- CNAS 管ç --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-manage</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- CNAS è®¾å¤ --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-device</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- CNAS è¿ç¨ --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-process</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- CNAS 人å --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>cnas-personnel</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | <artifactId>commons-text</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- fastjson v1 API å
¼å®¹å
ï¼IfsApiUtils çä½¿ç¨ com.alibaba.fastjson.*ï¼ --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- ä¼ä¸å¾®ä¿¡ï¼WxCpUtils 使ç¨ï¼ --> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-cp</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * ä»
çææé |
| | | * |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface PersonalScope { |
| | | |
| | | /** |
| | | * æéæ è¯åç§° |
| | | * @return |
| | | */ |
| | | String permsName(); |
| | | |
| | | /** |
| | | * 对象åç§° |
| | | * @return |
| | | */ |
| | | Class objectName(); |
| | | |
| | | /** |
| | | * åæ°åç§° |
| | | * @return |
| | | */ |
| | | String paramName(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/9/29 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "ifs") |
| | | @Data |
| | | public class IfsProperties { |
| | | |
| | | /** |
| | | * å |
| | | */ |
| | | private String contract; |
| | | |
| | | /** |
| | | * ç§é¥-get |
| | | */ |
| | | private String contractKeyGet; |
| | | |
| | | |
| | | /** |
| | | * ç§é¥-post |
| | | */ |
| | | private String contractKeyPost; |
| | | |
| | | /** |
| | | * 80 |
| | | */ |
| | | private String custorder; |
| | | |
| | | /** |
| | | * 8008 |
| | | */ |
| | | private String custorderPort; |
| | | |
| | | /** |
| | | * 8081 |
| | | */ |
| | | private String erpServices; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * 人äºç³»ç»api |
| | | * |
| | | * @Author zhuo |
| | | * @Date 2025/3/16 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "personnel") |
| | | @Data |
| | | public class PersonnelProperties { |
| | | /** |
| | | * æ£å¼å°å |
| | | * */ |
| | | private String code; |
| | | /** |
| | | * è£
å¤äººäºæ£å¼åº |
| | | * */ |
| | | private String appId; |
| | | private String appSecret; |
| | | |
| | | private String companies; |
| | | |
| | | private String simple; |
| | | |
| | | /** |
| | | * 人åå¯ç è·å |
| | | * */ |
| | | private String password; |
| | | |
| | | private String department; |
| | | |
| | | private String person; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "wechat") |
| | | @Data |
| | | public class WechatProperty { |
| | | |
| | | /** |
| | | * è£
å¤çµç¼ï¼æ¥æ£éç¥url |
| | | */ |
| | | private String examiningUrl; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/4/18 |
| | | */ |
| | | public class DeviceImpowerConstants { |
| | | |
| | | /** |
| | | * èå室维æ¤å
容 |
| | | */ |
| | | public static final String AGING_MAINTENANCE_CONTENT = "aging_maintenance_content"; |
| | | |
| | | /** |
| | | * çµæ§è½å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String ELECTRICAL_MAINTENANCE_CONTENT = "electrical_maintenance_content"; |
| | | |
| | | /** |
| | | * ç¯å¢å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String ENVIRONMENTAL_MAINTENANCE_CONTENT = "environmental_maintenance_content"; |
| | | |
| | | /** |
| | | * çç§å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String BURN_MAINTENANCE_CONTENT = "burn_maintenance_content"; |
| | | |
| | | /** |
| | | * æ··ç¼å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String MIXING_MAINTENANCE_CONTENT = "mixing_maintenance_content"; |
| | | |
| | | /** |
| | | * æ£æµä¸å¿çµæ§è½å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String CENTER_ELECTRICAL_MAINTENANCE_CONTENT = "center_electrical_maintenance_content"; |
| | | |
| | | /** |
| | | * ææ¸©äºç»´æ¤å
容 |
| | | */ |
| | | public static final String TEMPERATURE2_MAINTENANCE_CONTENT = "temperature2_maintenance_content"; |
| | | |
| | | |
| | | /** |
| | | * ææ¸©ä¸ç»´æ¤å
容 |
| | | */ |
| | | public static final String TEMPERATURE1_MAINTENANCE_CONTENT = "temperature1_maintenance_content"; |
| | | |
| | | /** |
| | | * åå¦å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String CHEMISTRY_MAINTENANCE_CONTENT = "chemistry_maintenance_content"; |
| | | |
| | | /** |
| | | * å¶æ ·å®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String SAMPLE_MAINTENANCE_CONTENT = "sample_maintenance_content"; |
| | | |
| | | |
| | | /** |
| | | * 使¸©å®éªå®¤ç»´æ¤å
容 |
| | | */ |
| | | public static final String HYPOTHERMIA_MAINTENANCE_CONTENT = "hypothermia_maintenance_content"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * åå
¸ç±»å |
| | | * |
| | | * @Author zhuo |
| | | * @Date 2025/2/25 |
| | | */ |
| | | public class DictDataConstants { |
| | | |
| | | // æ£éªç±»å(åææ) |
| | | public static final String CHECK_TYPE = "check_type"; |
| | | |
| | | // æ£éªç±»å(æå) |
| | | public static final String CHECK_TYPE1 = "check_type1"; |
| | | |
| | | // æ¥æ ·æ¹å¼ |
| | | public static final String FORM_TYPE = "form_type"; |
| | | |
| | | // æ ·åç¶æ |
| | | public static final String SAMPLE_STATUS_LIST = "sample_status_list"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * æ£éªç±»å |
| | | * |
| | | * @Author zhuo |
| | | * @Date 2024/8/11 |
| | | */ |
| | | public class InsOrderTypeConstants { |
| | | // æ£éªç±»å |
| | | public static final String SPOT_CHECK = "æ½æ£"; |
| | | // å§ææ£éª |
| | | public static final String CUSTOMER_ORDERED = "Customer-ordered test"; |
| | | // è¿åæ£éª |
| | | public static final String ENTER_THE_FACTORY = "è¿åæ£éª"; |
| | | // å£åº¦æ£éª |
| | | public static final String QUARTERLY_TEST = "Quarterly inspection"; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * èåè°åè·¯å¾ |
| | | * |
| | | * @Author zhuo |
| | | * @Date 2025/3/14 |
| | | */ |
| | | public class MenuJumpPathConstants { |
| | | |
| | | /** |
| | | * æ¥åç¼å¶ |
| | | */ |
| | | public static final String REPORT_PREPARATION = "ReportPreparation"; |
| | | |
| | | /** |
| | | * æ£éªä»»å¡å¤æ ¸ |
| | | */ |
| | | public static final String INSPECTION_REVIEW = "InspectionReview"; |
| | | |
| | | /** |
| | | * è´¨éçæ§ |
| | | */ |
| | | public static final String QUALITY_MONITOR = "EnsureResultsValidity"; |
| | | |
| | | /** |
| | | * è´¨éçç£ |
| | | */ |
| | | public static final String QUALITY_SUPERVISE = "QualityControlPlan"; |
| | | |
| | | /** |
| | | * 人å |
| | | */ |
| | | public static final String DEVICE = "Device"; |
| | | |
| | | /** |
| | | * è®¾å¤ |
| | | */ |
| | | public static final String PERSONNEL = "PersonnelInfo"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @TableName("custom") |
| | | public class Custom implements Serializable { |
| | | |
| | | @Schema(description = "主é®") |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String company; |
| | | |
| | | @Schema(description = "åä½å°å") |
| | | private String address; |
| | | |
| | | @Schema(description = "è系人") |
| | | private String contact; |
| | | |
| | | @Schema(description = "å·¥åå") |
| | | private String code; |
| | | |
| | | @Schema(description = "客æ·ç¼å·") |
| | | private String code2; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "åå»ºæ¥æ") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @Schema(description = "æ´æ°ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @Schema(description = "客æ·åä½EN") |
| | | private String companyEn; |
| | | |
| | | @Schema(description = "åä½å°åEN") |
| | | private String addressEn; |
| | | |
| | | @Schema(description = "å æ¥é¢åº¦") |
| | | private Integer num; |
| | | |
| | | @Schema(description = "åä½çµè¯") |
| | | private String phone; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class DepartmentDto { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Integer userId; |
| | | |
| | | private Integer fatherId; |
| | | |
| | | private List<DepartmentDto> children; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é¨é¨æç» |
| | | * @TableName department_lims |
| | | */ |
| | | @TableName(value ="department_lims") |
| | | @Data |
| | | public class DepartmentLims implements Serializable { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @Schema(description = "åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "ç¶çº§id") |
| | | private Integer fatherId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false) |
| | | private List<DepartmentLims> children; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¶æ¯éç¥ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-23 02:14:30 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("information_notification") |
| | | @Schema(description = "æ¶æ¯éç¥") |
| | | public class InformationNotification implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "主é®ID") |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @Schema(description = "å建人") |
| | | private String createUser; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "å建æ¶é´/åéæ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "å¾
åãæ¥æ¶ãå®¡æ ¸ãæ¹åãé¢è¦æéãéç¥å
Œ") |
| | | private String messageType; |
| | | |
| | | @Schema(description = "主é¢") |
| | | private String theme; |
| | | |
| | | @Schema(description = "å
容") |
| | | private String content; |
| | | |
| | | @Schema(description = "åé人Id") |
| | | private Integer senderId; |
| | | |
| | | @Schema(description = "æ¶ä»¶äºº") |
| | | private Integer consigneeId; |
| | | |
| | | @Schema(description = "æ¥çç¶æï¼å·²è¯»ï¼æªè¯»") |
| | | private Boolean viewStatus; |
| | | |
| | | @Schema(description = "æ¶æ¯ç¶æï¼æç»ãæ¥æ¶ï¼ï¼æ ¹æ®æ¶æ¯ç±»åå±ç¤ºï¼") |
| | | private Boolean messageStatus; |
| | | |
| | | @Schema(description = "跳转路å¾") |
| | | private String jumpPath; |
| | | |
| | | @Schema(description = "跳转Id") |
| | | private String jumpId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class InformationNotificationDto extends InformationNotification{ |
| | | private String senderUser; |
| | | |
| | | private String consigneeUser; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | public enum OrderType { |
| | | |
| | | RAW("åææ","01raw"), |
| | | WG("å¤è´æå","02wg"); |
| | | |
| | | private String label,value; |
| | | |
| | | public String getLabel() { |
| | | return label; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | OrderType(String label, String value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | public static boolean validateValue(String value){ |
| | | boolean flag = false; |
| | | for (OrderType orderType : OrderType.values()) { |
| | | if(StringUtils.isNotBlank(value)&&StringUtils.equals(orderType.getValue(),value)){ |
| | | flag = true; |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | public static String getLabelByValue(String value){ |
| | | for (OrderType orderType : OrderType.values()) { |
| | | if(validateValue(value)&&StringUtils.equals(orderType.getValue(), value)){ |
| | | return orderType.getLabel(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @Author: zhangxy |
| | | * @Date: 2021-05-24 16:29 |
| | | */ |
| | | @Component |
| | | public class ApplicationContextHolder implements ApplicationContextAware { |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext ctx) throws BeansException { |
| | | applicationContext = ctx; |
| | | } |
| | | |
| | | /** |
| | | * Get application context from everywhere |
| | | * |
| | | * @return |
| | | */ |
| | | public static ApplicationContext getApplicationContext() { |
| | | return applicationContext; |
| | | } |
| | | |
| | | /** |
| | | * Get bean by class |
| | | * |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> T getBean(Class<T> clazz) { |
| | | return applicationContext.getBean(clazz); |
| | | } |
| | | |
| | | /** |
| | | * Get bean by class name |
| | | * |
| | | * @param name |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getBean(String name) { |
| | | return (T) applicationContext.getBean(name); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.font.FontRenderContext; |
| | | import java.awt.geom.Rectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/9/28 |
| | | */ |
| | | public class DateImageUtil { |
| | | |
| | | /** |
| | | * çæ å½åæ¥æçç»å¸ |
| | | * @return |
| | | */ |
| | | public static InputStream createDateImage(LocalDateTime date) { |
| | | int width = 80; |
| | | int height = 20; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); |
| | | if (date == null) { |
| | | date = LocalDateTime.now(); |
| | | } |
| | | String s = date.format(formatter); |
| | | |
| | | Font font = new Font("Serif", Font.BOLD, 10); |
| | | // å建ä¸ä¸ªç»å¸ï¼èæ¯éæï¼ |
| | | BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | // è·åç»å¸çç»ç¬ |
| | | Graphics2D g2 = (Graphics2D) bi.getGraphics(); |
| | | // å¼å§ç»å¾ |
| | | g2.setComposite(AlphaComposite.Src); // ç¡®ä¿ç»å¾æ¶æ¯éæèæ¯ |
| | | g2.setBackground(new Color(0, 0, 0, 0)); // èæ¯è²ä¸ºéæ |
| | | g2.clearRect(0, 0, width, height); |
| | | g2.setPaint(new Color(0, 0, 0)); // 设置ç»å¶é¢è² |
| | | FontRenderContext context = g2.getFontRenderContext(); |
| | | Rectangle2D bounds = font.getStringBounds(s, context); |
| | | double x = (width - bounds.getWidth()) / 2; |
| | | double y = (height - bounds.getHeight()) / 2; |
| | | double ascent = -bounds.getY(); |
| | | double baseY = y + ascent; |
| | | g2.drawString(s, (int) x, (int) baseY); |
| | | g2.dispose(); // éæ¾ç»ç¬èµæº |
| | | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
| | | |
| | | try { |
| | | ImageIO.write(bi, "png", os); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return new ByteArrayInputStream(os.toByteArray()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.FileSystemUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.annotation.PostConstruct; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * ä¿åæä»¶å·¥å
· |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class FileSaveUtil { |
| | | |
| | | // åymlä¸çè·¯å¾ + / |
| | | private static String FILE_PATH; |
| | | |
| | | private static String WORD_URL_PATH; |
| | | |
| | | private static String[] ALLOWED; |
| | | |
| | | @Value("${file.path}") |
| | | private String file; |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | |
| | | @Value("${file.allowed}") |
| | | private String[] allowed; |
| | | |
| | | @PostConstruct |
| | | public void getFile() { |
| | | FILE_PATH = this.file; |
| | | } |
| | | |
| | | @PostConstruct |
| | | public void getWordUrl(){ |
| | | WORD_URL_PATH = this.wordUrl; |
| | | } |
| | | |
| | | @PostConstruct |
| | | public void getAllowed(){ |
| | | ALLOWED = this.allowed; |
| | | } |
| | | |
| | | /** |
| | | * å卿件䏻彿° |
| | | * @param file æä»¶äºè¿å¶æµ |
| | | * @return è¿åæä»¶åç§°ç¨äºå卿°æ®åº |
| | | */ |
| | | public static String StoreFile(MultipartFile file) { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | // çæéæºåç§°ï¼æ¶é´_éæº6使°å |
| | | String FileName = System.currentTimeMillis() + "_" + getNumber(6); |
| | | String suffix = null; |
| | | if (originalFilename != null) { |
| | | suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | // 妿åç¼åä¸éè¿æåºå¼å¸¸ |
| | | if (!isFileAllowed(suffix)){ |
| | | throw new RuntimeException(suffix); |
| | | } |
| | | } |
| | | // åç§°æ¼æ¥ |
| | | String fileName = FileName + suffix; |
| | | // è¿è¡åå¨ |
| | | try { |
| | | storeFileWithFileName(file.getBytes(), fileName); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | public static Boolean DeleteFile(String fileName) { |
| | | if (ObjectUtils.isEmpty(fileName)) { |
| | | return false; |
| | | } |
| | | return FileSystemUtils.deleteRecursively(new File(FILE_PATH + "/" + fileName)); |
| | | } |
| | | /** |
| | | * å卿件彿° |
| | | * @param content æä»¶äºè¿å¶æµ |
| | | * @param fileName æä»¶åç§° |
| | | */ |
| | | private static void storeFileWithFileName(byte[] content, String fileName) { |
| | | // åå¨è·¯å¾ |
| | | String path = FILE_PATH + File.separatorChar; |
| | | // ç®å½ä¸åå¨åå建 |
| | | File file = new File(path); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | // å¼å§åå¨ |
| | | try (FileOutputStream os = new FileOutputStream(path + fileName); |
| | | ByteArrayInputStream is = new ByteArrayInputStream(content)) { |
| | | is.transferTo(os); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("æä»¶å卿 ¼å¼å¼å¸¸"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 夿æä»¶æ¯å¦è¢«å
许ä¸ä¼ |
| | | * |
| | | * @param fileName æä»¶å |
| | | * @return å
许true, å¦åfalse |
| | | */ |
| | | private static boolean isFileAllowed(String fileName) { |
| | | // è·ååç¼å |
| | | String suffixName = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); |
| | | for (String allow : ALLOWED) { |
| | | if (allow.equals(suffixName)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * ä¿åæä»¶å°wordæä»¶å¤¹é |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public static String uploadWordFile(MultipartFile file) { |
| | | String urlString; |
| | | String pathName; |
| | | String path; |
| | | try { |
| | | String contentType = file.getContentType(); |
| | | if (contentType != null && contentType.startsWith("image/")) { |
| | | // æ¯å¾ç |
| | | path = FILE_PATH; |
| | | } else { |
| | | // æ¯æä»¶ |
| | | path = WORD_URL_PATH; |
| | | } |
| | | File realpath = new File(path); |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "-" + file.getOriginalFilename(); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | return pathName; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * è·åéæºæ°å |
| | | * @param n 使° |
| | | * @return è¿åéæºå¼ |
| | | */ |
| | | public static String getNumber(int n) { |
| | | char[] chars = "1234567890".toCharArray(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < n; i++) { |
| | | char c = chars[new Random().nextInt(chars.length)]; |
| | | sb.append(c); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.util.zip.GZIPInputStream; |
| | | import java.util.zip.GZIPOutputStream; |
| | | |
| | | /** |
| | | * å缩解åå·¥å
·ç±» |
| | | */ |
| | | public class GZipUtil { |
| | | |
| | | |
| | | /** |
| | | * å缩 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String compress(String str) { |
| | | if (str == null || str.trim().length() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | try (ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | GZIPOutputStream gzip = new GZIPOutputStream(out)) { |
| | | gzip.write(str.getBytes("utf-8")); |
| | | gzip.close(); |
| | | |
| | | return new String(out.toByteArray(), "iso-8859-1"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("æ°æ®å缩失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * è§£å |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String uncompress(String str) { |
| | | if (str == null || str.trim().length() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | try (ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes("iso-8859-1"))){ |
| | | GZIPInputStream ungzip = new GZIPInputStream(in); |
| | | byte[] buffer = new byte[1024]; |
| | | int n; |
| | | while ((n = ungzip.read(buffer)) >= 0) { |
| | | out.write(buffer, 0, n); |
| | | } |
| | | |
| | | return new String(out.toByteArray(), "utf-8"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("æ°æ®è§£å失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/9/28 |
| | | */ |
| | | public class LimsDateUtil { |
| | | |
| | | |
| | | /** |
| | | * æ¥ææ ¼å¼å°26巿份å ä¸ |
| | | * @param localDateTime |
| | | * @return |
| | | */ |
| | | public static String resetDate(LocalDateTime localDateTime) { |
| | | // è·åå½åæ¥ |
| | | int dayOfMonth = localDateTime.getDayOfMonth(); |
| | | |
| | | // 夿æ¯å¦æ¯26æ¥åä»¥ä¸ |
| | | if (dayOfMonth >= 26) { |
| | | // æä»½å 1 |
| | | localDateTime = localDateTime.plusMonths(1); |
| | | } |
| | | |
| | | // æ ¼å¼å为"yyMM"æ ¼å¼ |
| | | String formattedDate = DateUtil.format(localDateTime, "yyMM"); |
| | | return formattedDate; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | /** |
| | | * @author cxf |
| | | */ |
| | | public class Md5Util { |
| | | /** |
| | | * é»è®¤çå¯ç å符串ç»åï¼ç¨æ¥å°åèè½¬æ¢æ 16 è¿å¶è¡¨ç¤ºçå符 |
| | | */ |
| | | protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
| | | protected static MessageDigest messagedigest = null; |
| | | |
| | | static { |
| | | try { |
| | | messagedigest = MessageDigest.getInstance("MD5"); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public static String getFileMd5String(File file) throws IOException { |
| | | InputStream fis; |
| | | fis = new FileInputStream(file); |
| | | byte[] buffer = new byte[1024]; |
| | | int numRead = 0; |
| | | while ((numRead = fis.read(buffer)) > 0) { |
| | | messagedigest.update(buffer, 0, numRead); |
| | | } |
| | | fis.close(); |
| | | return bufferToHex(messagedigest.digest()); |
| | | } |
| | | |
| | | public static String getStringMd5(String str) { |
| | | byte[] buffer = str.getBytes(); |
| | | messagedigest.update(buffer); |
| | | return bufferToHex(messagedigest.digest()); |
| | | } |
| | | |
| | | public static String bufferToHex(byte bytes[]) { |
| | | return bufferToHex(bytes, 0, bytes.length); |
| | | } |
| | | |
| | | private static String bufferToHex(byte bytes[], int m, int n) { |
| | | StringBuffer stringbuffer = new StringBuffer(2 * n); |
| | | int k = m + n; |
| | | for (int l = m; l < k; l++) { |
| | | appendHexPair(bytes[l], stringbuffer); |
| | | } |
| | | return stringbuffer.toString(); |
| | | } |
| | | |
| | | private static void appendHexPair(byte bt, StringBuffer stringbuffer) { |
| | | // ååèä¸é« 4 ä½çæ°åè½¬æ¢ |
| | | char c0 = hexDigits[(bt & 0xf0) >> 4]; |
| | | // 为é»è¾å³ç§»ï¼å°ç¬¦å·ä½ä¸èµ·å³ç§»,æ¤å¤æªåç°ä¸¤ç§ç¬¦å·æä½ä¸å |
| | | // ååèä¸ä½ 4 ä½çæ°åè½¬æ¢ |
| | | char c1 = hexDigits[bt & 0xf]; |
| | | stringbuffer.append(c0); |
| | | stringbuffer.append(c1); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Random; |
| | | |
| | | @Component |
| | | public class MyUtil<T> { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.font.FontRenderContext; |
| | | import java.awt.geom.Rectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/5/7 |
| | | */ |
| | | public class SignatureImageUtil { |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸æå¯¼åºç¾åå¾ç |
| | | * @param text |
| | | * @return |
| | | * @throws IOException |
| | | * @throws FontFormatException |
| | | */ |
| | | public static InputStream saveImageToFile(String text){ |
| | | // è·ååä½åº |
| | | Font font = null; |
| | | try (InputStream is = new ClassPathResource("/ttf/signature.ttf").getInputStream()) { |
| | | font = Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(50f); |
| | | } catch (FontFormatException | IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | int width = 100; // å¾çç宽度 |
| | | int height = 50; // å¾ççé«åº¦ |
| | | |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | Graphics2D g2d = image.createGraphics(); |
| | | |
| | | g2d.setFont(font); |
| | | |
| | | // 设置æåé¢è²ä¸ºé»è² |
| | | g2d.setColor(Color.black); |
| | | |
| | | // 设置æåå¨å¾çä¸çä½ç½® |
| | | FontRenderContext context = g2d.getFontRenderContext(); |
| | | Rectangle2D bounds = font.getStringBounds(text, context); |
| | | double x = (width - bounds.getWidth()) / 2; |
| | | double y = (height - bounds.getHeight()) / 2; |
| | | double ascent = -bounds.getY(); |
| | | double baseY = y + ascent; |
| | | g2d.drawString(text, (int) x, (int) baseY); |
| | | g2d.dispose(); |
| | | |
| | | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
| | | |
| | | try { |
| | | ImageIO.write(image, "png", os); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return new ByteArrayInputStream(os.toByteArray()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; |
| | | import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl; |
| | | import me.chanjar.weixin.cp.bean.message.WxCpMessage; |
| | | import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult; |
| | | import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; |
| | | |
| | | import java.io.*; |
| | | import java.net.MalformedURLException; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: chenxiangfeng |
| | | * @Date: 2021/7/20 10:35 |
| | | */ |
| | | public class WxCpUtils { |
| | | |
| | | public static final String CORP_ID = "wwa423654b975441ac"; |
| | | public static final String CORP_SECRET = "snXq8qwA5tGu0YN1PlSDQqr6u9x3A0c_jQDmt8CN8Vs"; |
| | | public static final Integer AGENT_ID = 1000515; |
| | | |
| | | /** |
| | | * @param user ä¾ï¼ZT-033268|ZT-028629ï¼å¤ä¸ªä¸é´ç¨|éå¼ |
| | | * @param content ä¼ ææ¬å
容 |
| | | * @param imageFile å¾ç |
| | | * @throws Exception |
| | | */ |
| | | public static void inform(String user, String content, File imageFile) throws Exception { |
| | | WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl(); |
| | | // 注åçä¼ä¸ä¿¡æ¯ |
| | | config.setCorpId(CORP_ID); |
| | | config.setCorpSecret(CORP_SECRET); |
| | | |
| | | WxCpServiceImpl wxCpService = new WxCpServiceImpl(); |
| | | wxCpService.setWxCpConfigStorage(config); |
| | | |
| | | WxCpMessage message; |
| | | WxCpMessageSendResult result; |
| | | // åéææ¬ |
| | | if (StringUtils.isNotBlank(content)) { |
| | | message = WxCpMessage.TEXT() |
| | | .content(content) |
| | | // ç¨æ·id |
| | | .toUser(user) |
| | | // åºç¨id |
| | | .agentId(AGENT_ID) |
| | | .build(); |
| | | result = wxCpService.getMessageService().send(message); |
| | | } |
| | | // åéæä»¶ |
| | | if (imageFile != null) { |
| | | // è·åæä»¶id |
| | | WxMediaUploadResult imgResult = wxCpService.getMediaService().upload("file", imageFile); |
| | | message = WxCpMessage.IMAGE() |
| | | .mediaId(imgResult.getMediaId()) |
| | | // ç¨æ·id |
| | | .toUser(user) |
| | | // åºç¨id |
| | | .agentId(AGENT_ID) |
| | | .build(); |
| | | result = wxCpService.getMessageService().send(message); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¨éç¾¤æ¶æ¯ |
| | | * |
| | | * @param webHookList ä¼ä¸å¾®ä¿¡æºå¨äººå°å |
| | | * @param file å¾ç |
| | | * @throws Exception |
| | | */ |
| | | public static void informWebHook(List<String> webHookList, File file) throws Exception { |
| | | JSONObject json = new JSONObject(); |
| | | json.putOpt("msgtype", "image"); |
| | | JSONObject image = new JSONObject(); |
| | | image.putOpt("base64", getBase64(file)); |
| | | image.putOpt("md5", getMd5(file)); |
| | | json.putOpt("image", image); |
| | | |
| | | webHookList.stream().forEach(webHook -> { |
| | | String result = HttpRequest.post(webHook) |
| | | .header("Content-Type", "application/json") |
| | | .body(json.toString()) |
| | | .execute().body(); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æ¨éç¾¤æ¶æ¯ |
| | | * |
| | | * @param webHook ä¼ä¸å¾®ä¿¡æºå¨äººå°å |
| | | * @param content æ°æ® |
| | | * @throws Exception |
| | | */ |
| | | public static String informWebHook(String webHook, String content) { |
| | | return informWebHook(webHook, content,"text"); |
| | | } |
| | | |
| | | /** |
| | | * æ¨éç¾¤æ¶æ¯ |
| | | * |
| | | * @param webHook ä¼ä¸å¾®ä¿¡æºå¨äººå°å |
| | | * @param content æ°æ® |
| | | * @param msgType æ¶æ¯ç±»å |
| | | * @throws Exception |
| | | */ |
| | | public static String informWebHook(String webHook, String content,String msgType) { |
| | | JSONObject jsonObject = new JSONObject() |
| | | .accumulate("msgtype", msgType) |
| | | .accumulate(msgType, new JSONObject() |
| | | .accumulate("content", content)); |
| | | return HttpRequest.post(webHook).header("Content-Type", "application/json").body(jsonObject.toString()).execute().body(); |
| | | } |
| | | |
| | | public static String getMd5(File file) { |
| | | String name = ""; |
| | | try { |
| | | InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); |
| | | byte[] bytes = new byte[1024]; |
| | | int len = 0; |
| | | MessageDigest messagedigest = MessageDigest.getInstance("MD5"); |
| | | while ((len = inputStream.read(bytes)) > 0) { |
| | | messagedigest.update(bytes, 0, len); |
| | | } |
| | | name = Md5Util.bufferToHex(messagedigest.digest()); |
| | | inputStream.close(); |
| | | } catch (MalformedURLException e) { |
| | | } catch (IOException e) { |
| | | } catch (NoSuchAlgorithmException e) { |
| | | } |
| | | return name; |
| | | |
| | | } |
| | | |
| | | public static String getBase64(File file) { |
| | | FileInputStream inputStream = null; |
| | | String base64Str = ""; |
| | | try { |
| | | inputStream = new FileInputStream(file); |
| | | Base64.Encoder encoder = Base64.getEncoder(); |
| | | int available = inputStream.available(); |
| | | byte[] bytes = new byte[available]; |
| | | inputStream.read(bytes); |
| | | base64Str = encoder.encodeToString(bytes); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return base64Str; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.config.IfsProperties; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/9/29 |
| | | */ |
| | | @Slf4j |
| | | @AllArgsConstructor |
| | | @Component |
| | | public class IfsApiUtils { |
| | | |
| | | private IfsProperties ifsProperties; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢éè´è®¢åæªæ£éª |
| | | */ |
| | | public List<Map<String, Object>> getInventory(String inAttr) { |
| | | if (isDisabled()) { |
| | | return java.util.Collections.emptyList(); |
| | | } |
| | | String procedureName = "QUERY_POL_RECEIPT_STD"; |
| | | JSONObject stockMap = getJsonObject(procedureName, inAttr); |
| | | String body = ""; |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | Map map = objectMapper.readValue(body, Map.class); |
| | | List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() { |
| | | }); |
| | | log.info("è·åéè´è®¢å-->>" + maps); |
| | | return maps; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * ç»è®°éè´æ£éªç»æSTD |
| | | */ |
| | | public Result getProcurementResults(String inAttr) { |
| | | return getResult("REGIST_INSPECTION_RESULTS_STD", inAttr, ifsProperties.getCustorder(), "ç»è®°éè´æ£éªç»æ-->"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åæææ£éª-æ£éªåç§»åº |
| | | * |
| | | * @param inAttr |
| | | * @return |
| | | */ |
| | | public Result moveReceipt(String inAttr) { |
| | | return getResult("MOVE_RECEIPT_STD", inAttr, ifsProperties.getCustorder(), "æ£éªåç§»åº-->"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åæææ£éª-éè´æ¥æ¶æ´æ¹æ¹å· |
| | | * |
| | | * @param inAttr |
| | | * @return |
| | | */ |
| | | public Result updateMoveReceiptLot(String inAttr) { |
| | | return getResult("MODIFY_PURCH_RECEIPT_LOT_STD", inAttr, ifsProperties.getCustorder(), "ä¿®æ¹éè´è®¢åæ¹æ¬¡å·-->"); |
| | | } |
| | | |
| | | /** |
| | | * åºåç©ææ¹æ¬¡å±æ§æ°å¢ä¿®æ¹æ¥å£ |
| | | * |
| | | * @param inAttr |
| | | * @return |
| | | */ |
| | | public Result importPartLotAttr(String inAttr) { |
| | | return getResult("IMPORT_PART_LOT_ATTR_STD", inAttr, ifsProperties.getCustorder(), "åºåç©ææ¹æ¬¡å±æ§æ°å¢ä¿®æ¹æ¥å£-->"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åºåæ°æ® |
| | | * |
| | | * @param inAttr |
| | | * @return |
| | | */ |
| | | public Result getIfsStock(String inAttr) { |
| | | if (isDisabled()) { |
| | | return Result.success(java.util.Collections.singletonMap("LIST_INFO", java.util.Collections.emptyList())); |
| | | } |
| | | return getResult("QUERY_INVENTORY_INFO_STD", inAttr, ifsProperties.getCustorderPort(), "æ¥è¯¢åºåä¿¡æ¯-->"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * éç¨æ¥å£ |
| | | * @param procedureName æ¹æ³å |
| | | * @param inAttr ä¼ å |
| | | * @param url å°å |
| | | * @param image æ¶æ¯ |
| | | * @return |
| | | */ |
| | | private Result<?> getResult(String procedureName, String inAttr, String url, String image) { |
| | | if (isDisabled()) { |
| | | return Result.success(); |
| | | } |
| | | JSONObject stockMap = new JSONObject(); |
| | | stockMap.put("procedureName", procedureName); |
| | | stockMap.put("contract", ifsProperties.getContract()); |
| | | stockMap.put("contractKey", ifsProperties.getContractKeyPost()); |
| | | stockMap.put("userId", "lims_user"); |
| | | stockMap.put("inAttr", inAttr); |
| | | String body = ""; |
| | | log.info(image + body); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | Map map = objectMapper.readValue(body, Map.class); |
| | | String successFlag = map.get("SuccessFlag").toString(); |
| | | if (Integer.valueOf(successFlag) == 1) { |
| | | return Result.success(map); |
| | | } else { |
| | | return Result.fail(map.get("ErrorMsg").toString()); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | return Result.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæ·»å 请æ±ä¿¡æ¯ |
| | | * @param procedureName ç»æåç§° |
| | | * @param inAttr 请æ±åæ° |
| | | * @return |
| | | */ |
| | | private JSONObject getJsonObject(String procedureName, String inAttr) { |
| | | JSONObject stockMap = new JSONObject(); |
| | | stockMap.put("procedureName", procedureName); |
| | | stockMap.put("contract", ifsProperties.getContract()); |
| | | stockMap.put("contractKey", ifsProperties.getContractKeyPost()); |
| | | stockMap.put("userId", "lims_user"); |
| | | stockMap.put("inAttr", inAttr); |
| | | return stockMap; |
| | | } |
| | | |
| | | private boolean isDisabled() { |
| | | return true; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 请æ±åæ°ç¹æ®å符转ä¹å·¥å
·ç±» |
| | | * ç¨äºå¤çHTTP请æ±åæ°ä¸çç¹æ®å符ï¼é²æ¢XSSæ»å»ååæ°è§£æé误 |
| | | */ |
| | | public class ParameterEscaperUtil { |
| | | // ç¹æ®åç¬¦è½¬ä¹æ å°è¡¨ |
| | | private static final Map<Character, String> ESCAPE_MAP; |
| | | // 转ä¹å符å转æ å°è¡¨ |
| | | private static final Map<String, Character> UNESCAPE_MAP; |
| | | |
| | | static { |
| | | // åå§åè½¬ä¹æ å° |
| | | ESCAPE_MAP = new HashMap<>(); |
| | | ESCAPE_MAP.put('&', "&"); |
| | | ESCAPE_MAP.put('<', "<"); |
| | | ESCAPE_MAP.put('>', ">"); |
| | | ESCAPE_MAP.put('"', """); |
| | | ESCAPE_MAP.put('\'', "'"); |
| | | ESCAPE_MAP.put('/', "/"); |
| | | ESCAPE_MAP.put('\\', "\"); |
| | | ESCAPE_MAP.put(' ', "%20"); |
| | | ESCAPE_MAP.put('?', "%3F"); |
| | | ESCAPE_MAP.put('=', "%3D"); |
| | | ESCAPE_MAP.put('+', "%2B"); |
| | | ESCAPE_MAP.put('%', "%25"); |
| | | ESCAPE_MAP.put('#', "%23"); |
| | | ESCAPE_MAP.put(':', "%3A"); |
| | | ESCAPE_MAP.put(';', "%3B"); |
| | | |
| | | // åå§ååè½¬ä¹æ å° |
| | | UNESCAPE_MAP = new HashMap<>(); |
| | | for (Map.Entry<Character, String> entry : ESCAPE_MAP.entrySet()) { |
| | | UNESCAPE_MAP.put(entry.getValue(), entry.getKey()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转ä¹è¯·æ±åæ°ä¸çç¹æ®å符 |
| | | * @param input åå§è¾å
¥å符串 |
| | | * @return 转ä¹åçå符串 |
| | | */ |
| | | public static String escape(String input) { |
| | | if (input == null || input.isEmpty()) { |
| | | return input; |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (char c : input.toCharArray()) { |
| | | // 妿æ¯éè¦è½¬ä¹çå符ï¼å使ç¨è½¬ä¹åçå符串ï¼å¦åç´æ¥æ·»å |
| | | String escaped = ESCAPE_MAP.get(c); |
| | | sb.append(escaped != null ? escaped : c); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * å转ä¹è¯·æ±åæ°ä¸çç¹æ®å符 |
| | | * @param input 转ä¹åçå符串 |
| | | * @return åå§å符串 |
| | | */ |
| | | public static String unescape(String input) { |
| | | if (input == null || input.isEmpty()) { |
| | | return input; |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | int i = 0; |
| | | while (i < input.length()) { |
| | | boolean found = false; |
| | | // æ£æ¥æ¯å¦æ¯è½¬ä¹åºå |
| | | for (String escapeSeq : UNESCAPE_MAP.keySet()) { |
| | | if (input.startsWith(escapeSeq, i)) { |
| | | sb.append(UNESCAPE_MAP.get(escapeSeq)); |
| | | i += escapeSeq.length(); |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!found) { |
| | | sb.append(input.charAt(i)); |
| | | i++; |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.domain.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/2/20 |
| | | */ |
| | | @Data |
| | | public class SysRoleVo { |
| | | |
| | | @Schema(description = "æéæ è¯") |
| | | private String perms; |
| | | |
| | | @Schema(description = "èååç§°") |
| | | private String menuName; |
| | | |
| | | @Schema(description = "æ¯å¦ä»
çæ, 0: å¦, 1:æ¯") |
| | | private Integer isRersonal; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.domain.vo; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserVo extends User { |
| | | |
| | | @Schema(description = "é¨é¨id") |
| | | private Long departId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.common.core.domain.entity.Custom; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | public interface CustomMapper extends BaseMapper<Custom> { |
| | | |
| | | IPage<Custom> selectCustomPageList(IPage<Custom> page, @Param("ew") QueryWrapper<Custom> ew); |
| | | |
| | | int delCustomById(Integer id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.domain.entity.DepartmentDto; |
| | | import com.ruoyi.common.core.domain.entity.DepartmentLims; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author z1292 |
| | | * @description é对表ãdepartment_lims(é¨é¨æç»)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2024-05-22 14:08:17 |
| | | * @Entity com.yuanchu.mom.pojo.DepartmentLims |
| | | */ |
| | | public interface DepartmentLimsMapper extends BaseMapper<DepartmentLims> { |
| | | |
| | | //è·åé¨é¨æ |
| | | List<DepartmentDto> selectDepartment(); |
| | | |
| | | //æ ¹æ®é¨é¨id,æ¥è¯¢ä»çææåç±»id |
| | | List<Integer> selectSonById(Integer id); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotificationDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¶æ¯éç¥ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-23 02:14:30 |
| | | */ |
| | | public interface InformationNotificationMapper extends BaseMapper<InformationNotification> { |
| | | |
| | | IPage<InformationNotificationDto> getPage(Page page, String messageType, Integer userId); |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥-æ»å¨æ¥è¯¢ |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | IPage<InformationNotificationDto> msgRoll(Page page,@Param("userId") Integer userId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.entity.Custom; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãuser(ç¨æ·id)ãçæ°æ®åºæä½Service |
| | | * @createDate 2024å¹´3æ7æ¥09:21:59 |
| | | */ |
| | | public interface CustomService extends IService<Custom> { |
| | | |
| | | IPage<Custom> selectCustomPageList(IPage<Custom> page, Custom custom); |
| | | |
| | | int delCustomById(Long id); |
| | | |
| | | int addCustom(Custom custom); |
| | | |
| | | int upCustom(Custom custom); |
| | | |
| | | List<Custom> selectCustomEnum(); |
| | | |
| | | Custom getCustomId(String company); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotificationDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¶æ¯éç¥ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-23 02:14:30 |
| | | */ |
| | | public interface InformationNotificationService extends IService<InformationNotification> { |
| | | |
| | | IPage<InformationNotificationDto> getPage(Page page, String messageType); |
| | | |
| | | void markAllInformationReadOrDeleteAllReadMessages(Boolean isMarkAllInformationRead); |
| | | |
| | | Boolean checkForUnreadData(); |
| | | |
| | | void triggerModificationStatusToRead(Integer id); |
| | | |
| | | int addInformationNotification(InformationNotification informationNotification); |
| | | |
| | | Map<String, Object> getNumberFourTypesMessagesHomePage(); |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥-æ»å¨æ¥è¯¢ |
| | | * |
| | | * @return |
| | | */ |
| | | IPage<InformationNotificationDto> msgRoll(Page page); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.entity.Custom; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.system.mapper.CustomMapper; |
| | | import com.ruoyi.system.service.CustomService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãpower(ç¨æ·id)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2023-12-27 02:37:38 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> |
| | | implements CustomService { |
| | | |
| | | private CustomMapper customMapper; |
| | | |
| | | @Override |
| | | public IPage<Custom> selectCustomPageList(IPage<Custom> page, Custom custom) { |
| | | return customMapper.selectCustomPageList(page, QueryWrappers.queryWrappers(custom)); |
| | | } |
| | | |
| | | @Override |
| | | public int delCustomById(Long id) { |
| | | return customMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public int addCustom(Custom custom) { |
| | | return customMapper.insert(custom); |
| | | } |
| | | |
| | | @Override |
| | | public int upCustom(Custom custom) { |
| | | return customMapper.updateById(custom); |
| | | } |
| | | |
| | | @Override |
| | | public List<Custom> selectCustomEnum() { |
| | | return customMapper.selectList(Wrappers.<Custom>lambdaQuery().select(Custom::getId,Custom::getCompany)); |
| | | } |
| | | |
| | | @Override |
| | | public Custom getCustomId(String company) { |
| | | return customMapper.selectOne(Wrappers.<Custom>lambdaQuery().eq(Custom::getCompany, company).last("limit 1")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotificationDto; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.mapper.InformationNotificationMapper; |
| | | import com.ruoyi.system.service.InformationNotificationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import jakarta.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¶æ¯éç¥ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-23 02:14:30 |
| | | */ |
| | | @Service |
| | | public class InformationNotificationServiceImpl extends ServiceImpl<InformationNotificationMapper, InformationNotification> implements InformationNotificationService { |
| | | |
| | | @Override |
| | | public IPage<InformationNotificationDto> getPage(Page page, String messageType) { |
| | | return baseMapper.getPage(page, messageType, SecurityUtils.getUserId().intValue()); |
| | | } |
| | | |
| | | @Override |
| | | public void markAllInformationReadOrDeleteAllReadMessages(Boolean isMarkAllInformationRead) { |
| | | if (isMarkAllInformationRead) { |
| | | baseMapper.update(new InformationNotification(), Wrappers.<InformationNotification>lambdaUpdate() |
| | | .set(InformationNotification::getViewStatus, true) |
| | | .eq(InformationNotification::getConsigneeId, SecurityUtils.getUserId().intValue())); |
| | | } else { |
| | | baseMapper.delete(Wrappers.<InformationNotification>lambdaUpdate() |
| | | .eq(InformationNotification::getConsigneeId, SecurityUtils.getUserId().intValue()) |
| | | .eq(InformationNotification::getViewStatus, true)); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkForUnreadData() { |
| | | Map<String, Integer> map1 = null; |
| | | try { |
| | | List<InformationNotification> informationNotifications = baseMapper.selectList( |
| | | Wrappers.<InformationNotification>lambdaQuery() |
| | | .eq(InformationNotification::getConsigneeId, SecurityUtils.getUserId().intValue()) |
| | | .eq(InformationNotification::getViewStatus, false) |
| | | .last("limit 1")); |
| | | return !informationNotifications.isEmpty(); |
| | | } catch (Exception e) { |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void triggerModificationStatusToRead(Integer id) { |
| | | baseMapper.update(new InformationNotification(), Wrappers.<InformationNotification>lambdaUpdate() |
| | | .eq(InformationNotification::getId, id) |
| | | .set(InformationNotification::getViewStatus, true)); |
| | | } |
| | | |
| | | @Override |
| | | public int addInformationNotification(InformationNotification informationNotification) { |
| | | informationNotification.setViewStatus(false); |
| | | return baseMapper.insert(informationNotification); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getNumberFourTypesMessagesHomePage() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | int userId = SecurityUtils.getUserId().intValue(); |
| | | Long totalNumberOfMessages = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() |
| | | .eq(InformationNotification::getConsigneeId, userId)); |
| | | Long totalNumberOfReadMessages = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() |
| | | .eq(InformationNotification::getConsigneeId, userId) |
| | | .eq(InformationNotification::getViewStatus, true)); |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate sevenDaysAgo = today.minusDays(7); |
| | | Long totalNumberOfMessagesInThePastSevenDays = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() |
| | | .eq(InformationNotification::getConsigneeId, userId) |
| | | .between(InformationNotification::getCreateTime, today, sevenDaysAgo)); |
| | | long remainingToDo = totalNumberOfMessages - totalNumberOfReadMessages; |
| | | map.put("totalNumberOfMessages", totalNumberOfMessages); |
| | | map.put("remainingToDo", remainingToDo); |
| | | map.put("totalNumberOfReadMessages", totalNumberOfReadMessages); |
| | | map.put("totalNumberOfMessagesInThePastSevenDays", totalNumberOfMessagesInThePastSevenDays); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥-æ»å¨æ¥è¯¢ |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<InformationNotificationDto> msgRoll(Page page) { |
| | | return baseMapper.msgRoll(page,SecurityUtils.getUserId().intValue()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.system.mapper.CustomMapper"> |
| | | <update id="delCustomById"> |
| | | update user set is_custom = 0 |
| | | where id = #{id} |
| | | </update> |
| | | <select id="selectCustomPageList" resultType="com.ruoyi.common.core.domain.entity.Custom"> |
| | | select * from custom |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.DepartmentLimsMapper"> |
| | | |
| | | |
| | | <select id="selectDepartment" resultType="com.ruoyi.common.core.domain.entity.DepartmentDto"> |
| | | SELECT id, name, father_id |
| | | FROM department_lims |
| | | </select> |
| | | |
| | | <select id="selectSonById" resultType="java.lang.Integer"> |
| | | SELECT au.id |
| | | FROM (SELECT * FROM department_lims WHERE father_id IS NOT NULL) au, |
| | | (SELECT @father_id := #{id}) pd |
| | | WHERE FIND_IN_SET(father_id, @father_id) > 0 |
| | | AND @father_id := concat(@father_id, ',', id) |
| | | UNION |
| | | SELECT id |
| | | FROM department_lims |
| | | WHERE id = #{id} |
| | | ORDER BY id |
| | | </select> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.InformationNotificationMapper"> |
| | | |
| | | <select id="getPage" resultType="com.ruoyi.common.core.domain.entity.InformationNotificationDto"> |
| | | select i.*, u.name senderUser, u2.name consigneeUser |
| | | from information_notification i |
| | | left join user u on i.sender_id = u.id |
| | | left join user u2 on u2.id = i.consignee_id |
| | | where i.consignee_id = #{userId} |
| | | <if test="messageType != '' and messageType != null"> |
| | | and i.message_type = #{messageType} |
| | | </if> |
| | | order by i.create_time desc |
| | | </select> |
| | | |
| | | <select id="msgRoll" resultType="com.ruoyi.common.core.domain.entity.InformationNotificationDto"> |
| | | select i.*, u.name senderUser, u2.name consigneeUser |
| | | from information_notification i |
| | | left join user u on i.sender_id = u.id |
| | | left join user u2 on u2.id = i.consignee_id |
| | | where i.consignee_id = #{userId} |
| | | and i.view_status = false |
| | | order by i.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |