已添加272个文件
已修改733个文件
已删除109个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | root = true |
| | | |
| | | [*] |
| | | charset = utf-8 |
| | | end_of_line = lf |
| | | insert_final_newline = true |
| | | trim_trailing_whitespace = true |
| | | |
| | | [*.{java,xml,yml,yaml,md,properties,sql,js,ts,vue,html,css,scss,json}] |
| | | charset = utf-8 |
| | | |
| | | [*.md] |
| | | trim_trailing_whitespace = false |
| | |
| | | !gradle/wrapper/gradle-wrapper.jar
|
| | |
|
| | | target/
|
| | | /${project.build.directory}/
|
| | | !.mvn/wrapper/maven-wrapper.jar
|
| | |
|
| | | ######################################################################
|
| | |
| | |
|
| | | !*/build/*.java
|
| | | !*/build/*.html
|
| | | !*/build/*.xml |
| | | !*/build/*.xml
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç¼ç ä¸ä¸æå¤çè§å |
| | | |
| | | æ¬é¡¹ç®åç»ææä»£ç ä¿®æ¹å¿
é¡»éµå®ä»¥ä¸è§åï¼ |
| | | |
| | | 1. æ°å»ºæä»¶ç»ä¸ä½¿ç¨ `UTF-8` ç¼ç ï¼ä¸ä¸å¸¦ `BOM`ã |
| | | 2. ä¿®æ¹å·²ææä»¶åï¼å
æ£æ¥åæä»¶ç¼ç ï¼å¦æä¸æ¯ `UTF-8`ï¼é»è®¤å
ä¿æåç¼ç ï¼é¿å
æä¸æååã |
| | | 3. 䏿å
容å¿
é¡»ç´æ¥ä¿çï¼ä¸å
è®¸è½¬ä¹æ `\\uXXXX`ã |
| | | 4. è¾åºãæäº¤ãçæä»£ç æ¶ä¸å¾åºç°ä¹±ç ï¼å¦æç»ç«¯æ¾ç¤ºå¼å¸¸ï¼å¿
é¡»å
æ ¡éªæä»¶çå®åèç¼ç ï¼åç»§ç»ä¿®æ¹ã |
| | | 5. æ¶åæ¹éæ¿æ¢æ¶ï¼åªè½å¨ç¡®è®¤ç¼ç å®å
¨åæ§è¡ï¼ä¸è½ä¸ºäºæ¹éè¿ç§»æä¸æå
容æ¹åã |
| | | |
| | | æ¨èåæ³ï¼ |
| | | |
| | | - ä¼å
ä¾èµé¡¹ç®æ ¹ç®å½ `.editorconfig`ã |
| | | - ä¿®æ¹åå
确认æä»¶ç¼ç ï¼å鿩坹åºçååæ¹å¼ã |
| | | - 对å
å«å¤§éä¸ææ³¨éãå符串çæä»¶ï¼ä¼å
å°èå´ä¿®æ¹å¹¶åæ¶ç¼è¯éªè¯ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # æä»¶ä¸ä¼ åè½è¯´æ |
| | | |
| | | æ¬ææ¡£åºäºä»¥ä¸ä»£ç æ´çï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/basic/utils/FileUtil.java` |
| | | - `src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java` |
| | | - `src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java` |
| | | - `src/main/java/com/ruoyi/project/common/CommonController.java` |
| | | - `src/main/java/com/ruoyi/basic/controller/StorageAttachmentController.java` |
| | | |
| | | ç¨äºè¯´ææ¬é¡¹ç®ä¸æä»¶ä¸ä¼ ãéä»¶ç»å®ãæä»¶é¢è§/ä¸è½½çæ´ä½è®¾è®¡ï¼ä»¥å `FileUtil` 䏿¯ä¸ªæ¹æ³çä½ç¨ã |
| | | |
| | | ## 1. æ´ä½è®¾è®¡ |
| | | |
| | | æ¬é¡¹ç®çæä»¶ä½ç³»åæä¸¤å±ï¼ |
| | | |
| | | - `storage_blob`ï¼åæä»¶å®ä½ä¿¡æ¯ |
| | | - åå§æä»¶å |
| | | - å¯ä¸æä»¶å `uidFilename` |
| | | - æä»¶è·¯å¾ `path` |
| | | - æä»¶å¤§å° `byteSize` |
| | | - æä»¶ç±»å `contentType` |
| | | - å
Œ
±è®¿é®æ è¯ `resourceKey` |
| | | - `storage_attachment`ï¼åæä»¶åä¸å¡è®°å½çå
³èå
³ç³» |
| | | - `application`ï¼æä»¶ç¨é |
| | | - `recordType`ï¼ä¸å¡è®°å½ç±»å |
| | | - `recordId`ï¼ä¸å¡è®°å½ä¸»é® |
| | | - `storageBlobId`ï¼å
³èçæä»¶ä¸»è¡¨ id |
| | | |
| | | å¯ä»¥çè§£ä¸ºï¼ |
| | | |
| | | - `storage_blob` è´è´£âæä»¶æ¬èº«â |
| | | - `storage_attachment` è´è´£âæä»¶æå¨åªæ¡ä¸å¡æ°æ®ä¸â |
| | | |
| | | ## 2. ä¸ä¼ æµç¨ |
| | | |
| | | ### 2.1 æ®éä¸ä¼ |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `POST /common/upload` |
| | | |
| | | æ§å¶å¨ä½ç½®ï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/project/common/CommonController.java` |
| | | |
| | | å
¥åï¼ |
| | | |
| | | - 表ååæ®µåï¼`files` |
| | | - ç±»åï¼`List<MultipartFile>` |
| | | |
| | | 代ç é»è¾ï¼ |
| | | |
| | | 1. å端å
è°ç¨ `/common/upload` |
| | | 2. `CommonController.upload()` è°ç¨ `storageBlobService.upload(files, false)` |
| | | 3. æå¡å±ä¿åæä»¶å
æ°æ®å° `storage_blob` |
| | | 4. è¿å `StorageBlobVO` å表ï¼éé¢é常ä¼å¸¦ï¼ |
| | | - æä»¶ id |
| | | - åå§æä»¶å |
| | | - å¯ä¸æä»¶å |
| | | - é¢è§å°å `previewURL` |
| | | - ä¸è½½å°å `downloadURL` |
| | | |
| | | 说æï¼ |
| | | |
| | | - æ¤æ¶åªæ¯âä¸ä¼ äºæä»¶â |
| | | - è¿æ²¡æåå
·ä½ä¸å¡åæ®å»ºç«å
³ç³» |
| | | |
| | | ### 2.2 å
Œ
±ä¸ä¼ |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `POST /common/public/upload` |
| | | |
| | | 代ç é»è¾ï¼ |
| | | |
| | | - `CommonController.publicUpload()` è°ç¨ `storageBlobService.upload(files, true)` |
| | | |
| | | 说æï¼ |
| | | |
| | | - 该æ¥å£ä¸ä¼ çæä»¶èµ°âå
Œ
±æä»¶âæ¨¡å¼ |
| | | - æ§å¶å¨æ³¨éå·²æç¡®è¯´æï¼æ°¸ä¹
ææï¼æ
ç¨ |
| | | - å¯¹åº URL æå»ºæ¶ï¼å¯è½èµ° `publicKey` åæ°ï¼è䏿¯ä¸´æ¶ `token` |
| | | |
| | | ## 3. éä»¶ç»å®æµç¨ |
| | | |
| | | ä¸ä¼ 宿åï¼å¦æéè¦ææä»¶ç»å®å°ææ¡ä¸å¡è®°å½ï¼éè¦åè°ç¨éä»¶æ¥å£ã |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `POST /storageAttachment/add` |
| | | |
| | | æ§å¶å¨ä½ç½®ï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/basic/controller/StorageAttachmentController.java` |
| | | |
| | | æ ¸å¿è¯·æ±å¯¹è±¡ï¼ |
| | | |
| | | - `StorageAttachmentDTO` |
| | | |
| | | å
¶ä¸ç»§æ¿äº `StorageAttachment`ï¼å¹¶é¢å¤å
å«ï¼ |
| | | |
| | | - `storageBlobDTOs`ï¼å¾
ç»å®çæä»¶å表 |
| | | |
| | | 常ç¨å段å«ä¹ï¼ |
| | | |
| | | - `application`ï¼æä»¶ç¨é |
| | | - `recordType`ï¼ä¸å¡ç±»å |
| | | - `recordId`ï¼ä¸å¡ä¸»é® |
| | | - `storageBlobDTOs[].id`ï¼ä¸ä¼ æååè¿åçæä»¶ id |
| | | |
| | | 示ä¾è¯·æ±ä½ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "application": "file", |
| | | "recordType": "common_file", |
| | | "recordId": 1001, |
| | | "storageBlobDTOs": [ |
| | | { |
| | | "id": 12, |
| | | "application": "file" |
| | | }, |
| | | { |
| | | "id": 13, |
| | | "application": "file" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ç»å®é»è¾è¯´æï¼ |
| | | |
| | | 1. å
ä¸ä¼ æä»¶ï¼æ¿å° `storage_blob.id` |
| | | 2. åè°ç¨ `/storageAttachment/add` |
| | | 3. æå¡å±æç»ä¼éè¿ `FileUtil` ä¿å `storage_attachment` |
| | | 4. åç»å³å¯æä¸å¡è®°å½æ¥è¯¢åºè¯¥è®°å½ä¸çéä»¶ |
| | | |
| | | ## 4. æ¥è¯¢ä¸å é¤éä»¶ |
| | | |
| | | ### 4.1 æ¥è¯¢éä»¶å表 |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `GET /storageAttachment/list` |
| | | |
| | | 说æï¼ |
| | | |
| | | - æ `StorageAttachmentDTO` ä¸çæ¡ä»¶æ¥è¯¢ |
| | | - å¸¸è§æ¡ä»¶æ¯ `application`ã`recordType`ã`recordId` |
| | | - è¿åç»ææ¬è´¨ä¸æ¯åä¸å¡è®°å½å
³èåçæä»¶å表 |
| | | |
| | | ### 4.2 å é¤éä»¶ |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `DELETE /storageAttachment/delete` |
| | | |
| | | 请æ±ä½ï¼ |
| | | |
| | | - `List<Long> ids` |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¿éç `ids` æ¯éä»¶å
³è表 idï¼ä¸è¬æ¯ `storage_attachment.id` |
| | | - å 餿¶é常ä¸ä»
ä¼å å
³èå
³ç³»ï¼ä¹ä¼è¿ä¸æ¥å é¤å¯¹åºæä»¶è®°å½ |
| | | |
| | | ## 5. é¢è§ä¸ä¸è½½æµç¨ |
| | | |
| | | ### 5.1 ä¸è½½æ¥å£ |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `GET /common/download/{fileName}` |
| | | |
| | | æ¯æä¸¤ç§è®¿é®æ¹å¼ï¼ |
| | | |
| | | - 临æ¶é¾æ¥ï¼`token` |
| | | - å
Œ
±é¾æ¥ï¼`publicKey` |
| | | |
| | | 代ç é»è¾ï¼ |
| | | |
| | | 1. å¦æè¯·æ±éæ `publicKey`ï¼èµ° `storageBlobService.getPublicFile(fileName, publicKey)` |
| | | 2. å¦åèµ° `storageBlobService.getFileByToken(fileName, token)` |
| | | 3. åå°å®é
æä»¶åï¼è°ç¨ `fileUtil.compressFile(file)` åå¾çå缩å¤ç |
| | | 4. 设置ä¸è½½ååºå¤´ï¼è¾åºæä»¶æµ |
| | | |
| | | ### 5.2 é¢è§æ¥å£ |
| | | |
| | | æ¥å£ï¼ |
| | | |
| | | - `GET /common/preview/{fileName}` |
| | | |
| | | æ¯æä¸¤ç§è®¿é®æ¹å¼ï¼ |
| | | |
| | | - 临æ¶é¾æ¥ï¼`token` |
| | | - å
Œ
±é¾æ¥ï¼`publicKey` |
| | | |
| | | 代ç é»è¾ï¼ |
| | | |
| | | 1. æ ¡éª `token` æ `publicKey` |
| | | 2. è·åæä»¶ |
| | | 3. è°ç¨ `fileUtil.compressFile(file)` |
| | | 4. æ ¹æ®æä»¶å
容类åè¿å inline é¢è§ |
| | | |
| | | ## 6. æä¸¾å«ä¹ |
| | | |
| | | ### 6.1 `ApplicationTypeEnum` |
| | | |
| | | ä½ç½®ï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java` |
| | | |
| | | å½åå®ä¹å¼ï¼ |
| | | |
| | | | æä¸¾ | type | 说æ | |
| | | |---|---|---| |
| | | | `IMAGE` | `image` | å¾çç±»æä»¶ | |
| | | | `FILE` | `file` | æ®éæä»¶ | |
| | | | `AFTER_FILE` | `after_file` | å®åç¸å
³æä»¶ | |
| | | | `BEFORE_FILE` | `before_file` | å®å/åç½®ç¸å
³æä»¶ | |
| | | | `APK` | `apk` | å®è£
å
æä»¶ | |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - ç¨äºåºåå䏿¡ä¸å¡è®°å½ä¸ï¼ä¸åç¨éçæä»¶ |
| | | - `FileUtil` çå¾å¤æ¥è¯¢ãå é¤ãä¿åæ¹æ³é½ä¼ç¨å°è¯¥å段 |
| | | |
| | | ### 6.2 `RecordTypeEnum` |
| | | |
| | | ä½ç½®ï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - ç¨äºæ è®°æä»¶å±äºåªç±»ä¸å¡è®°å½ |
| | | - ä¾å¦è´¨æ£ãéè´ã客æ·ãå®åãå°è´¦ãéç¥ã设å¤ç模å |
| | | - ä¸ä¼ 宿åï¼éä»¶æç»éè¿ `recordType + recordId` åä¸å¡æ°æ®å
³è |
| | | |
| | | 说æï¼ |
| | | |
| | | - 该æä¸¾å¼å¾å¤ï¼ææ¡£ä¸é个å±å¼ |
| | | - å®é
ä½¿ç¨æ¶å¿
é¡»ä¼ ä»£ç ä¸å·²å®ä¹ç `type` å¼ |
| | | - å¦ï¼ |
| | | - `common_file` |
| | | - `after_sales_service` |
| | | - `quality_inspect` |
| | | - `product` |
| | | - `notice` |
| | | |
| | | ## 7. `FileUtil` æ¹æ³è¯´æ |
| | | |
| | | `FileUtil` æ¯æ¬å¥æä»¶ä¸ä¼ ä½ç³»çæ ¸å¿å·¥å
·ç±»ï¼ä¸»è¦è´è´£ï¼ |
| | | |
| | | - æä»¶ä¸ä¸å¡è®°å½ç»å® |
| | | - æä»¶ä¸éä»¶å é¤ |
| | | - éä»¶æ¥è¯¢ |
| | | - é¢è§/ä¸è½½å°åçæ |
| | | - token ä½¿ç¨æ¬¡æ°æ§å¶ |
| | | - å¾çå缩 |
| | | |
| | | ä¸é¢æåè½åç»è¯´ææ¯ä¸ªæ¹æ³ã |
| | | |
| | | ### 7.1 ä¿åéä»¶å
³ç³» |
| | | |
| | | #### 1. `saveStorageAttachment(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, List<StorageBlobDTO> storageBlobDTOS)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æâæä»¶ç¨é + è®°å½ç±»å + è®°å½ idâä¿åéä»¶å
³ç³» |
| | | |
| | | é»è¾ï¼ |
| | | |
| | | 1. æ ¡éª `application`ã`recordType`ã`recordId` |
| | | 2. å
å é¤è¿ç»ä¸å¡è®°å½ä¸çæ§éä»¶ |
| | | 3. ææ°ç `storageBlobDTOS` 转æ `storage_attachment` è®°å½åæ¹éæå
¥ |
| | | |
| | | éç¨åºæ¯ï¼ |
| | | |
| | | - ææ¡ä¸å¡æ°æ®éæ°ä¿åéä»¶ï¼æ§éä»¶æ´ä½æ¿æ¢ææ°éä»¶ |
| | | |
| | | #### 2. `saveStorageAttachmentByRecordTypeAndRecordId(String application, RecordTypeEnum recordType, Long recordId, List<StorageBlobDTO> storageBlobDTOS)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ `recordType + recordId` ä¿åéä»¶å
³ç³»ï¼`application` 坿å®ï¼ä¹å¯ä»æ¯ä¸ªæä»¶å¯¹è±¡é读å |
| | | |
| | | é»è¾ç¹ç¹ï¼ |
| | | |
| | | - 妿 `application == null`ï¼ä¼æ ¹æ® `storageBlobDTO.application` åå«å 餿§å
³ç³» |
| | | - 妿éä»¶å表为空ï¼ä¼ç´æ¥å é¤è¯¥ä¸å¡è®°å½çéä»¶å
³ç³» |
| | | - æå
¥æ¶ä¼èªå¨åå¡« `application` |
| | | |
| | | éç¨åºæ¯ï¼ |
| | | |
| | | - 䏿¬¡æäº¤éå¯è½å
å«å¤ç§ç¨éçéä»¶ |
| | | - æè
è°ç¨æ¹ä¸æ¹ä¾¿ç´æ¥ä¼ æä¸¾ç±»å |
| | | |
| | | ### 7.2 å é¤æä»¶ä¸»è¡¨ `storage_blob` |
| | | |
| | | #### 3. `deleteStorageBlobs(List<Long> storageBlobIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - ææä»¶ä¸»è¡¨ id æ¹éå é¤æä»¶è®°å½ |
| | | |
| | | #### 4. `deleteStorageBlobsByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - å
æ ¹æ®éä»¶å
³è id æ¥å° `storageBlobId` |
| | | - åå é¤å¯¹åºçæä»¶ä¸»è¡¨è®°å½ |
| | | |
| | | #### 5. `deleteStorageBlobsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum application, RecordTypeEnum recordType, List<Long> recordIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®ç¨éãè®°å½ç±»åãå¤ä¸ªä¸å¡ idï¼æ¹éå é¤å¯¹åºçæä»¶ä¸»è¡¨è®°å½ |
| | | |
| | | éç¨åºæ¯ï¼ |
| | | |
| | | - æ¹éå é¤æç±»ä¸å¡æ°æ®æ¶ï¼åæ¶æ¸
çéä»¶ |
| | | |
| | | #### 6. `deleteStorageBlobsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ® `recordType + recordId` å é¤è¯¥ä¸å¡è®°å½ä¸æææä»¶ä¸»è¡¨è®°å½ |
| | | |
| | | ### 7.3 å é¤éä»¶å
³ç³» `storage_attachment` |
| | | |
| | | #### 7. `deleteStorageAttachmentsByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - å
å é¤é件对åºçæä»¶ä¸»è¡¨è®°å½ |
| | | - åå é¤éä»¶å
³ç³»è¡¨è®°å½ |
| | | |
| | | #### 8. `deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - å 餿å®ç¨éãæå®ä¸å¡è®°å½ä¸çéä»¶å
³ç³» |
| | | |
| | | ç¹ç¹ï¼ |
| | | |
| | | - ä¼å
å blobï¼åå attachment |
| | | |
| | | #### 9. `deleteStorageAttachmentsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - å 餿å®ä¸å¡è®°å½ä¸å
¨é¨éä»¶å
³ç³»ï¼ä¸åºåç¨é |
| | | |
| | | #### 10. `deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum application, RecordTypeEnum recordType, List<Long> recordIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æå¤ä¸ªä¸å¡ id æ¹éå é¤éä»¶å
³ç³» |
| | | |
| | | ### 7.4 æ¥è¯¢éä»¶å
³ç³» |
| | | |
| | | #### 11. `getStorageAttachmentsByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id æ¥è¯¢ `storage_attachment` è®°å½ |
| | | |
| | | #### 12. `getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æç¨éãä¸å¡ç±»åãä¸å¡ id æ¥è¯¢éä»¶å
³ç³» |
| | | |
| | | #### 13. `getStorageAttachmentsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç±»åãä¸å¡ id æ¥è¯¢éä»¶å
³ç³» |
| | | |
| | | ### 7.5 æ¥è¯¢æä»¶ä¿¡æ¯ `StorageBlobVO` |
| | | |
| | | #### 14. `getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(StorageAttachmentDTO storageAttachmentDTO)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - éè¿ `StorageAttachmentDTO` æ¡ä»¶æ¥è¯¢æä»¶å表 |
| | | |
| | | ç¹ç¹ï¼ |
| | | |
| | | - `application` å¯é |
| | | - æç»è¿åçæ¯å¸¦é¢è§/ä¸è½½å°åç `StorageBlobVO` |
| | | |
| | | #### 15. `getStorageBlobVOsByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id æ¥è¯¢æä»¶å表 |
| | | |
| | | ç¹ç¹ï¼ |
| | | |
| | | - ä¼èªå¨æå»ºï¼ |
| | | - `previewURL` |
| | | - `downloadURL` |
| | | - `storageAttachmentId` |
| | | |
| | | #### 16. `getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æç¨éãä¸å¡ç±»åãä¸å¡ id æ¥è¯¢æä»¶å表 |
| | | |
| | | #### 17. `getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç±»åãä¸å¡ id æ¥è¯¢æä»¶å表 |
| | | |
| | | #### 18. `getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - å第 16 ä¸ªæ¹æ³ç±»ä¼¼ï¼ä½å¯ä»¥èªå®ä¹é¾æ¥è¿ææ¶é´ |
| | | |
| | | 说æï¼ |
| | | |
| | | - `expired` å使¯åé |
| | | - è¿åçé¢è§/ä¸è½½å°å伿è¿ä¸ªæ¶é´çæç¾å |
| | | |
| | | #### 19. `getStorageBlobVOsByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id æ¥è¯¢æä»¶å表ï¼å¹¶èªå®ä¹é¾æ¥è¿ææ¶é´ |
| | | |
| | | ### 7.6 æ¥è¯¢éä»¶è§å¾ `StorageAttachmentVO` |
| | | |
| | | #### 20. `getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ¥è¯¢éä»¶è§å¾å¯¹è±¡ |
| | | |
| | | ç¹ç¹ï¼ |
| | | |
| | | - æ¯æ¡éä»¶è®°å½éä¼åµå¥èªå·±ç `storageBlobVOS` |
| | | |
| | | #### 21. `getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id æ¥è¯¢éä»¶è§å¾ï¼å¹¶èªå®ä¹é¾æ¥è¿ææ¶é´ |
| | | |
| | | #### 22. `getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦æ¥è¯¢éä»¶è§å¾ |
| | | |
| | | #### 23. `getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦æ¥è¯¢éä»¶è§å¾ï¼å¹¶èªå®ä¹é¾æ¥è¿ææ¶é´ |
| | | |
| | | ### 7.7 ä»
è·åé¢è§å°å |
| | | |
| | | #### 24. `getFilePreviewURLByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id å表ï¼è¿åé¢è§å°åå表 |
| | | |
| | | #### 25. `getFilePreviewURLByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id å表ï¼è¿å带èªå®ä¹è¿ææ¶é´çé¢è§å°åå表 |
| | | |
| | | #### 26. `getFilePreviewURLByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦è¿åé¢è§å°åå表 |
| | | |
| | | #### 27. `getFilePreviewURLByApplicationAndRecordTypeAndRecordIdAndExpired(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦è¿å带èªå®ä¹è¿ææ¶é´çé¢è§å°åå表 |
| | | |
| | | ### 7.8 ä»
è·åä¸è½½å°å |
| | | |
| | | #### 28. `getFileDownloadURLByStorageAttachmentIds(List<Long> storageAttachmentIds)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id å表ï¼è¿åä¸è½½å°åå表 |
| | | |
| | | #### 29. `getFileDownloadURLByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¹æ®éä»¶å
³ç³» id å表ï¼è¿å带èªå®ä¹è¿ææ¶é´çä¸è½½å°åå表 |
| | | |
| | | #### 30. `getFileDownloadURLByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦è¿åä¸è½½å°åå表 |
| | | |
| | | #### 31. `getFileDownloadURLByApplicationAndRecordTypeAndRecordIdAndExpired(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æä¸å¡ç»´åº¦è¿å带èªå®ä¹è¿ææ¶é´çä¸è½½å°åå表 |
| | | |
| | | ### 7.9 æå»ºç¾å URL |
| | | |
| | | #### 32. `buildSignedPreviewUrl(StorageBlobVO storageBlob)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - 使ç¨ç³»ç»é»è®¤è¿ææ¶é´ï¼çæé¢è§é¾æ¥ |
| | | |
| | | å®é
è°ç¨ï¼ |
| | | |
| | | - å
é¨çä»·äºè°ç¨ `buildSignedUrl(storageBlob, "/preview/", properties.getExpired())` |
| | | |
| | | #### 33. `buildSignedDownloadUrl(StorageBlobVO storageBlob)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - 使ç¨ç³»ç»é»è®¤è¿ææ¶é´ï¼çæä¸è½½é¾æ¥ |
| | | |
| | | å®é
è°ç¨ï¼ |
| | | |
| | | - å
é¨çä»·äºè°ç¨ `buildSignedUrl(storageBlob, "/download/", properties.getExpired())` |
| | | |
| | | #### 34. `buildSignedUrl(StorageBlobVO storageBlob, String actionPath, BigDecimal expired)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æå»ºç»ä¸ç带ç¾åé¢è§/ä¸è½½å°å |
| | | |
| | | æ¯æï¼ |
| | | |
| | | - `actionPath = "/preview/"` |
| | | - `actionPath = "/download/"` |
| | | |
| | | æ ¸å¿é»è¾ï¼ |
| | | |
| | | 1. æ ¡éªè·¯å¾åæ°åæä»¶ä¿¡æ¯ |
| | | 2. æ¼æ¥åºç¡è®¿é®å°å |
| | | 3. 妿 `expired == -1`ï¼ä¸çæ tokenï¼ç´æ¥èµ° `publicKey` |
| | | 4. å¦åçæå¸¦è¿ææ¶é´ç JWT token |
| | | 5. æ token çä½¿ç¨æ¬¡æ°ä¿¡æ¯åå
¥ Redis |
| | | 6. è¿åæç» URL |
| | | |
| | | éè¦è¯´æï¼ |
| | | |
| | | - `expired` åä½ä¸ºåé |
| | | - é»è®¤è¿ææ¶é´ä¸º 120 åé |
| | | - éæ°¸ä¹
龿¥ä¼åâè¿ææ¶é´ + ä½¿ç¨æ¬¡æ°éå¶âåéæ§å¶ |
| | | |
| | | ### 7.10 token ä½¿ç¨æ§å¶ |
| | | |
| | | #### 35. `cacheTokenUsage(String token, long expiredMillis)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ token ä½¿ç¨æ¬¡æ°åå§åå° Redis |
| | | |
| | | ç¹ç¹ï¼ |
| | | |
| | | - åå§å¼åå
¥ä¸º `0` |
| | | - TTL ä¸ token è¿ææ¶é´ä¿æä¸è´ |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¿æ¯ç§ææ¹æ³ï¼ä¾ `buildSignedUrl()` å
é¨è°ç¨ |
| | | |
| | | #### 36. `buildTokenUsageKey(String token)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - ç»ä¸çæ Redis key |
| | | |
| | | æ ¼å¼ï¼ |
| | | |
| | | - `file:token:usage:{token}` |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¿æ¯ç§ææ¹æ³ |
| | | |
| | | #### 37. `validateTokenUsage(String token)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - æ ¡éª token æ¯å¦è¿è½ç»§ç»ä½¿ç¨ |
| | | |
| | | æ ¸å¿é»è¾ï¼ |
| | | |
| | | 1. ä» Redis 读åå½åä½¿ç¨æ¬¡æ° |
| | | 2. å¦ææ²¡æå¼ï¼è®¤ä¸ºé¾æ¥å·²è¿ææå·²å¤±æ |
| | | 3. å¦æè¾¾å°ä¸éï¼ç«å³å é¤ Redis è®°å½å¹¶æ¥é |
| | | 4. å¦åèªå¢ä¸æ¬¡ä½¿ç¨æ¬¡æ° |
| | | 5. 妿èªå¢åè¾¾å°ä¸éï¼åå é¤ Redis è®°å½ |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¯¥æ¹æ³é常ä¼å¨å®é
è®¿é®æä»¶æ¶ç±æå¡å±è°ç¨ |
| | | |
| | | #### 38. `resolveLimit()` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - è§£æ token å¯ä½¿ç¨æ¬¡æ°ä¸é |
| | | |
| | | è§åï¼ |
| | | |
| | | - `properties.getUseLimit() <= 0` æ¶ï¼é»è®¤è¿å `10` |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¿æ¯ç§ææ¹æ³ |
| | | |
| | | ### 7.11 è·¯å¾ä¸å缩 |
| | | |
| | | #### 39. `buildRelativePath()` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - çææä»¶åå¨ç¸å¯¹è·¯å¾ |
| | | |
| | | æ ¼å¼ï¼ |
| | | |
| | | - `yyyy/MMdd` |
| | | |
| | | ä¾å¦ï¼ |
| | | |
| | | - `2026/0430` |
| | | |
| | | ç¨éï¼ |
| | | |
| | | - ä¸è¬ç¨äºææ¥æåç®å½ä¿åä¸ä¼ æä»¶ |
| | | |
| | | #### 40. `compressFile(File file)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - 对å¾çè¿è¡å缩ï¼éå¾çæä¸æ»¡è¶³æ¡ä»¶æ¶è¿ååæä»¶ |
| | | |
| | | å缩æ¡ä»¶ï¼ |
| | | |
| | | 1. å¼å¯äº `properties.getCompress()` |
| | | 2. æä»¶æ¯å¾ç |
| | | 3. æä»¶å¤§å°å¤§äº `properties.getNeedCompressSize()` |
| | | |
| | | å¤çé»è¾ï¼ |
| | | |
| | | 1. ç®æ æä»¶å为 `thumb_åæä»¶å` |
| | | 2. 妿å缩æä»¶å·²åå¨ï¼ç´æ¥å¤ç¨ |
| | | 3. ä½¿ç¨ `Thumbnailator` æå尺寸å缩ç»è´¨ |
| | | 4. 妿å缩失败ï¼é级è¿ååæä»¶ |
| | | |
| | | 说æï¼ |
| | | |
| | | - å½åä¸è½½åé¢è§æ¥å£é½ä¼è°ç¨è¿ä¸ªæ¹æ³ |
| | | |
| | | #### 41. `isImage(String fileName)` |
| | | |
| | | ä½ç¨ï¼ |
| | | |
| | | - ç®å夿æä»¶æ¯å¦æ¯å¾ç |
| | | |
| | | æ¯æåç¼ï¼ |
| | | |
| | | - `jpg` |
| | | - `jpeg` |
| | | - `png` |
| | | |
| | | 说æï¼ |
| | | |
| | | - è¿æ¯ç§ææ¹æ³ï¼ä¾ `compressFile()` ä½¿ç¨ |
| | | |
| | | ## 8. æ¨è使ç¨é¡ºåº |
| | | |
| | | ä¸å¡ä¸æå¸¸è§çæ¥å
¥é¡ºåºå¦ä¸ï¼ |
| | | |
| | | 1. å端ä¸ä¼ æä»¶å° `/common/upload` |
| | | 2. æ¿å°è¿åç»æä¸çæä»¶ id |
| | | 3. ä¸å¡ä¿åæ¶è°ç¨ `/storageAttachment/add` |
| | | 4. ä¼ å
¥ `application + recordType + recordId + storageBlobDTOs` |
| | | 5. åç»é¡µé¢åæ¾æ¶æä¸å¡æ¡ä»¶è°ç¨éä»¶æ¥è¯¢ |
| | | 6. å端使ç¨è¿åç `previewURL` æ `downloadURL` |
| | | |
| | | ## 9. å¸¸è§æ³¨æç¹ |
| | | |
| | | ### 9.1 å
ä¸ä¼ ï¼åç»å® |
| | | |
| | | - `/common/upload` åªè´è´£æä»¶å
¥åº |
| | | - `/storageAttachment/add` ææ¯åä¸å¡æ°æ®å»ºç«å
³ç³» |
| | | |
| | | ### 9.2 `application` å¾éè¦ |
| | | |
| | | - å䏿¡ `recordId` ä¸å¯è½æå¤ç»ä¸åç¨ééä»¶ |
| | | - å é¤åæ¥è¯¢æ¶ï¼ç»å¸¸ä¾èµ `application` |
| | | |
| | | ### 9.3 ä¸è½½é¾æ¥ä¸æ¯æ°¸ä¹
ææ |
| | | |
| | | - æ®é龿¥ä¸è¬éè¿ JWT token æ§å¶ |
| | | - åæ¶åè¿ææ¶é´åä½¿ç¨æ¬¡æ°éå¶ |
| | | |
| | | ### 9.4 å
Œ
±æä»¶è¦æ
ç¨ |
| | | |
| | | - `public/upload` ä¸ä¼ çæä»¶å¯èµ°æ°¸ä¹
å
¬å¼è®¿é® |
| | | - éåå
¬å¼èµæºï¼ä¸éåæææä»¶ |
| | | |
| | | ### 9.5 å¾çé¢è§/ä¸è½½å¯è½è¿åå缩æä»¶ |
| | | |
| | | - å½åæ§å¶å¨å¨ä¸è½½åé¢è§åé½ä¼è°ç¨ `compressFile()` |
| | | - 大å¾å¨è®¿é®æ¶å¯è½ä½¿ç¨å缩åç坿¬ |
| | | |
| | | ## 10. ä¸å¥è¯æ»ç» |
| | | |
| | | æ¬é¡¹ç®çæä»¶ä¸ä¼ æ¹æ¡æ¯â䏤鶿®µæ¨¡åâï¼ |
| | | |
| | | - 第ä¸é¶æ®µä¸ä¼ æä»¶ï¼çæ `storage_blob` |
| | | - 第äºé¶æ®µç»å®ä¸å¡ï¼çæ `storage_attachment` |
| | | |
| | | è `FileUtil` åè´è´£æâä¸ä¼ åçæä»¶âåæâ坿¥è¯¢ãå¯é¢è§ãå¯ä¸è½½ãå¯å é¤ã坿§æ¶æâç宿´éä»¶è½åã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | CREATE TABLE IF NOT EXISTS `ai_chat_session` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `memory_id` varchar(64) NOT NULL COMMENT 'ä¼è¯ID', |
| | | `user_id` bigint NOT NULL COMMENT 'ç¨æ·ID', |
| | | `tenant_id` bigint DEFAULT NULL COMMENT 'ç§æ·ID', |
| | | `title` varchar(128) DEFAULT NULL COMMENT 'ä¼è¯æ é¢', |
| | | `last_message` varchar(512) DEFAULT NULL COMMENT 'æå䏿¡æ¶æ¯', |
| | | `message_count` int NOT NULL DEFAULT 0 COMMENT 'æ¶æ¯æ°é', |
| | | `last_chat_time` datetime DEFAULT NULL COMMENT 'æåè天æ¶é´', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_ai_chat_session_memory_id` (`memory_id`), |
| | | KEY `idx_ai_chat_session_user_tenant` (`user_id`, `tenant_id`), |
| | | KEY `idx_ai_chat_session_last_chat_time` (`last_chat_time`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='AIåå²ä¼è¯å
æ°æ®è¡¨'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | alter table sys_user |
| | | add ai_enabled tinyint(1) not null default 0 comment 'æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç¨æ· AI åè½å段å端èè°è¯´æ |
| | | |
| | | ## èæ¯ |
| | | |
| | | å端已å¨ç¨æ·è¡¨å¢å éèåæ®µ `ai_enabled`ï¼ç¨äºæ è¯ç¨æ·æ¯å¦å¼é AI åè½ã |
| | | è¯¥åæ®µä¸å¼æ¾ç»ç¨æ·èµæç»´æ¤æ¥å£ï¼ä¸éè¿ç¨æ·ç¼è¾é¡µé¢ä¸å/ååï¼ã |
| | | |
| | | ## åæ®µå®ä¹ |
| | | |
| | | | åæ®µ | ç±»å | é»è®¤å¼ | 说æ | |
| | | | --- | --- | --- | --- | |
| | | | ai_enabled | tinyint(1) | 0 | æ¯å¦å¼é AI åè½ï¼`0`=æªå¼éï¼`1`=å·²å¼é | |
| | | |
| | | ## èè°æ¥å£ |
| | | |
| | | ç»å½åè°ç¨ï¼ |
| | | |
| | | ```http |
| | | GET /getInfo |
| | | ``` |
| | | |
| | | è¿å䏿°å¢é¡¶å±å段 `aiEnabled`ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "user": { |
| | | "userId": 1, |
| | | "userName": "admin" |
| | | }, |
| | | "aiEnabled": 1, |
| | | "roles": [ |
| | | "admin" |
| | | ], |
| | | "permissions": [ |
| | | "*:*:*" |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## å端使ç¨å»ºè®® |
| | | |
| | | 1. ç»å½æååæç°ææµç¨è°ç¨ `/getInfo`ã |
| | | 2. ä»ååºé¡¶å±è¯»å `aiEnabled`ã |
| | | 3. å¤å®é»è¾å»ºè®®ï¼ |
| | | - `aiEnabled === 1`ï¼å±ç¤º/æ¾å¼ AI ç¸å
³å
¥å£ã |
| | | - å
¶ä»å¼ï¼`0`ã`null`ã`undefined`ï¼ï¼ææªå¼éå¤çã |
| | | |
| | | ## ç¼å说æ |
| | | |
| | | - `aiEnabled` å·²æ¾å
¥ç»å½ç¼å对象ï¼`LoginUser`ï¼å¹¶é token çå½å¨æç®¡çã |
| | | - ç¼å key åç¼ï¼`login_tokens:`ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | drop table if exists customer_user; |
| | | create table customer_user |
| | | ( |
| | | id bigint auto_increment |
| | | primary key, |
| | | customer_id bigint not null default 0 comment '客æ·id', |
| | | user_id bigint not null default 0 comment 'ç¨æ·id', |
| | | create_time datetime null comment 'å½å
¥æ¶é´', |
| | | tenant_id bigint not null default 0 comment 'ç§æ·id' |
| | | ); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç¼ç ä¸é²ä¹±ç è§è |
| | | |
| | | æ¬é¡¹ç®ç»ä¸éç¨ä»¥ä¸è§åï¼é¿å
䏿乱ç åç¼ç å²çªï¼ |
| | | |
| | | ## å¿
é¡»éµå® |
| | | |
| | | 1. æ°å»ºæä»¶ç»ä¸ä½¿ç¨ `UTF-8` ç¼ç ï¼ä¸ä¸å¸¦ `BOM` |
| | | 2. ä¿®æ¹å·²ææä»¶åå
æ£æ¥åæä»¶ç¼ç |
| | | 3. å¦ææ§æä»¶ä¸æ¯ `UTF-8`ï¼é»è®¤å
ä¿æåç¼ç ï¼é¿å
æä¸æåå |
| | | 4. 䏿å
å®¹ç´æ¥ä¿çï¼ä¸è¦è½¬ä¹æ `\uXXXX` |
| | | 5. è¾åºãçæãæ¹éæ¿æ¢æ¶ä¸å¾åºç°ä¹±ç |
| | | 6. 妿ç»ç«¯æ¾ç¤ºå¼å¸¸ï¼å
æ ¡éªæä»¶çå®åèåç¼ç ï¼åç»§ç»ä¿®æ¹ |
| | | |
| | | ## æ¨èåæ³ |
| | | |
| | | - ä¼å
éµå¾ªé¡¹ç®æ ¹ç®å½ `.editorconfig` |
| | | - 对å
å«å¤§éä¸ææ³¨éãå符串çæä»¶ï¼ä¼å
å°èå´ä¿®æ¹ |
| | | - æ¹éæ¿æ¢åå
åç¼ç æ½æ ·æ£æ¥ï¼åæ§è¡æ¹éä¿®æ¹ |
| | | - æ¯æ¬¡æ¶å䏿å
å®¹çæ¹éæ¹å¨åï¼åæ¶ç¼è¯ææ£æ¥ diff |
| | | |
| | | ## 项ç®å
对åºä½ç½® |
| | | |
| | | - ç¼è¾å¨é»è®¤è§åï¼`/.editorconfig` |
| | | - AI ä¸åä½çº¦æï¼`/AGENTS.md` |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # éè´æºè½ä½å¤æä»¶åæå端èè°è¯´æ |
| | | |
| | | ## æµç¨è¯´æ |
| | | |
| | | å端已æ°å¢éè´æºè½ä½å¤æä»¶åæç¡®è®¤æµç¨ï¼ |
| | | |
| | | 1. å端ä¸ä¼ å¤ä¸ªéè´ç¸å
³æä»¶ï¼å¹¶éå¸¦ç¨æ·è¦æ±ã |
| | | 2. å端æåæä»¶å
容ï¼äº¤ç»éè´æºè½ä½åæã |
| | | 3. æºè½ä½è¿åå¾
客æ·ç¡®è®¤çç»æå JSONã |
| | | 4. å端å±ç¤ºæè¦ãé£é©ãç¼ºå¤±åæ®µåå¾
å¤çæ°æ®ã |
| | | 5. 客æ·ç¡®è®¤æè¡¥å
æ°æ®åï¼å端è°ç¨ç¡®è®¤æ¥å£ã |
| | | 6. åç«¯æ ¹æ®ç¡®è®¤åçæ°æ®æ§è¡å¯¹åºéè´ä¸å¡å¤çã |
| | | |
| | | åææ¥å£ä¸ä¼è½åºï¼åªæç¡®è®¤æ¥å£ä¼æ§è¡ä¸å¡å¤çã |
| | | |
| | | ## æ¥å£ 1ï¼éè´å¤æä»¶åæ |
| | | |
| | | ```http |
| | | POST /purchase-ai/analyze-files |
| | | Content-Type: multipart/form-data |
| | | ``` |
| | | |
| | | 请æ±åæ°ï¼ |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | | --- | --- | --- | --- | |
| | | | files | file[] | æ¯ | 夿件ä¸ä¼ åæ®µï¼å段åå¿
é¡»æ¯ `files` | |
| | | | message | string | å¦ | ç¨æ·è¦æ±ï¼ä¾å¦ï¼è¯·æ ¹æ®è¿äºéè´åååæç»æ´çéè´å°è´¦æ°æ® | |
| | | | memoryId | string | å¦ | ä¼è¯ IDï¼ä¸ä¼ æ¶å端ä¼èªå¨çæå
é¨ä¼è¯ | |
| | | |
| | | è¿åï¼ |
| | | |
| | | ```http |
| | | Content-Type: text/stream;charset=utf-8 |
| | | ``` |
| | | |
| | | å端éè¦æ¼æ¥å®æ´æµå¼ææ¬ååæ§è¡ `JSON.parse`ã |
| | | |
| | | è¿å JSON ç»æç¤ºä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "success": true, |
| | | "businessType": "purchase_ledger", |
| | | "action": "confirm_required", |
| | | "description": "å·²æ ¹æ®æä»¶æ´çåºéè´å°è´¦è稿ï¼è¯·ç¡®è®¤ã", |
| | | "confidence": 0.86, |
| | | "missingFields": [], |
| | | "warnings": [], |
| | | "payload": {}, |
| | | "preview": [] |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | | åæ®µ | 说æ | |
| | | | --- | --- | |
| | | | success | æ¯å¦åææå | |
| | | | businessType | ä¸å¡ç±»åï¼`purchase_ledger`ã`payment_registration`ã`purchase_return_order`ã`unknown` | |
| | | | action | åºå®ä¸º `confirm_required` | |
| | | | description | ä¸æè¯´æ | |
| | | | confidence | 置信度ï¼0 å° 1 | |
| | | | missingFields | ç¼ºå¤±åæ®µï¼å端éè¦æç¤ºç¨æ·è¡¥å
| |
| | | | warnings | é£é©æç¤º | |
| | | | payload | å¾
客æ·ç¡®è®¤å¹¶æäº¤ç»ç¡®è®¤æ¥å£çæ°æ® | |
| | | | preview | ç»å®¢æ·ç¡®è®¤ç¨ç䏿æè¦ | |
| | | |
| | | ## æ¥å£ 2ï¼ç¡®è®¤å¹¶æ§è¡ä¸å¡å¤ç |
| | | |
| | | ```http |
| | | POST /purchase-ai/analyze-files/confirm |
| | | Content-Type: application/json |
| | | ``` |
| | | |
| | | 请æ±ä½ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "businessType": "purchase_ledger", |
| | | "payload": { |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | å½åæ¯æç `businessType`ï¼ |
| | | |
| | | | businessType | 说æ | å端å¤ç | |
| | | | --- | --- | --- | |
| | | | purchase_ledger | éè´å°è´¦ | è°ç¨éè´å°è´¦æ°å¢/ç¼è¾ | |
| | | | payment_registration | 仿¬¾ç»è®° | è°ç¨ä»æ¬¾ç»è®°æ°å¢ | |
| | | | purchase_return_order | éè´éè´§å | è°ç¨éè´éè´§åæ°å¢ | |
| | | |
| | | 确认æ¥å£è¿åæ®é `AjaxResult`ã |
| | | |
| | | ## éè´å°è´¦ Payload çº¦å® |
| | | |
| | | éè´å°è´¦ç¡®è®¤æ¨è使ç¨ä¸¤ä¸ªéåï¼ |
| | | |
| | | ```json |
| | | { |
| | | "businessType": "purchase_ledger", |
| | | "payload": { |
| | | "purchaseLedgers": [] |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | åæ®µçº¦å®ï¼ |
| | | |
| | | - `purchaseLedgers` æ¾éè´è®¢å/éè´å°è´¦ä¸»è¡¨æ°æ®ï¼å段åå¿
é¡»ä¸ `PurchaseLedgerDto` ä¿æä¸è´ã |
| | | - 产åæç»æ¾å¨æ¯æ¡ `purchaseLedgers[i].productData` ä¸ï¼å¯¹åº `PurchaseLedgerDto` ç `private List<SalesLedgerProduct> productData;`ã |
| | | - é¡¶å± `payload.productData` ä»
ä½ä¸ºæ§æ ¼å¼å
¼å®¹ï¼ä¸å»ºè®®å端继ç»ä½¿ç¨ã |
| | | - æä»¶ä¸çâéè´åå·âå°±æ¯âéè´ååå·âï¼å端å¯ä»¥ç»ä¸æ å°æ `purchaseContractNumber`ã |
| | | - æä»¶ä¸çâéå®åå·âå°±æ¯âéå®ååå·âï¼å端å¯ä»¥ç»ä¸æ å°æ `salesContractNo`ã |
| | | - æ¥æåæ®µç»ä¸ä½¿ç¨ `yyyy-MM-dd`ï¼ä¾å¦ `2026-04-30`ï¼ä¸è¦æäº¤ `4/30/26`ã`2026/4/30`ã`2026å¹´4æ30æ¥` æå¸¦æ¶åç§çæ ¼å¼ã |
| | | - éè´å°è´¦ä¸éè¦åç«¯ä¼ å®¡æ¹äººï¼ä¸è¦æäº¤ `approveUserIds`ã`approverId`ã |
| | | - `missingFields` é¢å客æ·å±ç¤ºï¼åªæ¾ä¸æç¼ºå¤±é¡¹ï¼ä¾å¦ `ä¾åºååç§°`ã`å«ç¨åä»·`ï¼ä¸è¦å±ç¤ºè±æå段åã |
| | | - éè´å°è´¦ä¸å¡å¿
å¡«ï¼éè´ååå·ãä¾åºååç§°æä¾åºåIDã |
| | | - 产åæç»ä¸å¡å¿
å¡«ï¼äº§ååç§°ãè§æ ¼åå·ãåä½ãæ°éãå«ç¨åä»·ãå«ç¨æ»ä»·ï¼å¦æåªæå«ç¨æ»ä»·åæ°éï¼å端ä¼èªå¨è®¡ç®å«ç¨åä»·ï¼å¦æåªæå«ç¨åä»·åæ°éï¼å端ä¼èªå¨è®¡ç®å«ç¨æ»ä»·ã |
| | | - 产åæç»å¯éè¿ `purchaseContractNumber`ã`purchaseContractNo`ã`éè´ååå·`ã`éè´åå·`ã`éè´è®¢åå·` å
³è对åºéè´è®¢åï¼ä¹å¯éè¿ `salesContractNo`ã`salesContractNumber`ã`éå®ååå·`ã`éå®åå·`ã`éå®è®¢åå·` è¾
å©å¹é
ã |
| | | |
| | | `purchaseLedgers` åæ¡è®°å½å
许使ç¨ç `PurchaseLedgerDto` åæ®µï¼ |
| | | |
| | | ```text |
| | | entryDateStart, entryDateEnd, id, purchaseContractNumber, |
| | | supplierId, supplierName, isWhite, recorderId, recorderName, salesContractNo, |
| | | salesContractNoId, projectName, entryDate, executionDate, remarks, |
| | | attachmentMaterials, createdAt, updatedAt, salesLedgerId, hasChildren, Type, |
| | | productData, tempFileIds, SalesLedgerFiles, phoneNumber, businessPersonId, |
| | | productId, productModelId, invoiceNumber, invoiceAmount, ticketRegistrationId, |
| | | contractAmount, receiptPaymentAmount, unReceiptPaymentAmount, type, |
| | | paymentMethod, approvalStatus, templateName |
| | | ``` |
| | | |
| | | 示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "purchaseLedgers": [ |
| | | { |
| | | "purchaseContractNumber": "CG-2026-001", |
| | | "supplierName": "åé示ä¾ä¾åºå", |
| | | "salesContractNo": "XS-2026-001", |
| | | "projectName": "示ä¾é¡¹ç®", |
| | | "entryDate": "2026-04-30", |
| | | "executionDate": "2026-04-30", |
| | | "contractAmount": 120000, |
| | | "remarks": "ç±æä»¶åæçæï¼å¾
确认", |
| | | "productData": [ |
| | | { |
| | | "productCategory": "示ä¾äº§å", |
| | | "specificationModel": "åå·A", |
| | | "unit": "ä»¶", |
| | | "quantity": 10, |
| | | "taxInclusiveUnitPrice": 12000, |
| | | "taxInclusiveTotalPrice": 120000, |
| | | "type": 2 |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## å端å¤ç建议 |
| | | |
| | | 1. ç¨æ·éæ©å¤ä¸ªæä»¶ï¼å¡«ååæè¦æ±ã |
| | | 2. ä½¿ç¨ `multipart/form-data` è°ç¨ `/purchase-ai/analyze-files`ã |
| | | 3. æ¼æ¥æµå¼è¿åææ¬ã |
| | | 4. 坹宿´ææ¬æ§è¡ `JSON.parse`ã |
| | | 5. å±ç¤º `preview`ã`warnings`ã`missingFields` å `payload`ã |
| | | 6. 妿 `missingFields` ä¸ä¸ºç©ºï¼å¼å¯¼ç¨æ·è¡¥å
æç¼è¾ `payload`ã |
| | | 7. ç¨æ·ç¡®è®¤åï¼å° `businessType` å确认åç `payload` æäº¤å° `/purchase-ai/analyze-files/confirm`ã |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - æä»¶ä¸ä¼ åæ®µåå¿
é¡»æ¯ `files`ã |
| | | - åææ¥å£åªçæå¾
ç¡®è®¤æ°æ®ï¼ä¸ä¼æ§è¡ä¸å¡è½åºã |
| | | - 确认æ¥å£æä¼æ§è¡ä¸å¡å¤çã |
| | | - 妿 `payload` 缺å°å¿
è¦ä¸å¡ IDï¼ç¡®è®¤æ¥å£å¯è½è¿åä¸å¡æ ¡éªé误ã |
| | | - å端éè¦æ `missingFields` æç¡®å±ç¤ºç»ç¨æ·ã |
| | | - AI è¿åå
容æåæ³ JSON å¤çï¼ä¸è¦ææ®éèªç¶è¯è¨å±ç¤ºã |
| | |
| | | <parent>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-parent</artifactId>
|
| | | <version>2.5.15</version>
|
| | | <version>3.5.13</version>
|
| | | <relativePath/>
|
| | | </parent>
|
| | |
|
| | | <properties>
|
| | | <maven.compiler.source>25</maven.compiler.source>
|
| | | <maven.compiler.target>25</maven.compiler.target>
|
| | | <maven.compiler.release>25</maven.compiler.release>
|
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
| | | <java.version>1.8</java.version>
|
| | | <java.version>25</java.version>
|
| | | <lombok.version>1.18.44</lombok.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>
|
| | | <pagehelper.spring.boot.starter.version>2.1.1</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>
|
| | | <jwt.version>0.13.0</jwt.version>
|
| | | <kaptcha.version>2.3.3</kaptcha.version>
|
| | | <swagger.version>3.0.0</swagger.version>
|
| | | <knife4j.version>4.5.0</knife4j.version>
|
| | | <springdoc.version>2.8.17</springdoc.version>
|
| | | <swagger.annotations.version>1.6.15</swagger.annotations.version>
|
| | | <poi.version>5.2.3</poi.version>
|
| | | <oshi.version>6.6.5</oshi.version>
|
| | | <velocity.version>2.3</velocity.version>
|
| | | <!-- override dependency version -->
|
| | | <tomcat.version>9.0.102</tomcat.version>
|
| | | <!-- <tomcat.version>9.0.102</tomcat.version>-->
|
| | | <minio.version>8.4.3</minio.version>
|
| | | <okhttp.version>4.9.0</okhttp.version>
|
| | | <hutool.version>5.8.18</hutool.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>
|
| | | <hutool.version>5.8.43</hutool.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.16</mybatis-plus.version>
|
| | | <getui-sdk.version>1.0.7.0</getui-sdk.version>
|
| | | <jsqlparser.version>4.9</jsqlparser.version>
|
| | | <thumbnailator.version>0.4.20</thumbnailator.version>
|
| | | <langchain4j.version>1.0.0-beta3</langchain4j.version>
|
| | | </properties>
|
| | |
|
| | | <dependencyManagement>
|
| | | <dependencies>
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-bom</artifactId>
|
| | | <version>${langchain4j.version}</version>
|
| | | <type>pom</type>
|
| | | <scope>import</scope>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-community-bom</artifactId>
|
| | | <version>${langchain4j.version}</version>
|
| | | <type>pom</type>
|
| | | <scope>import</scope>
|
| | | </dependency>
|
| | | </dependencies>
|
| | | </dependencyManagement>
|
| | |
|
| | | <dependencies>
|
| | | <!-- ruoyi-springboot2 / swagger knife4j é
ç½® -->
|
| | | <dependency>
|
| | | <groupId>com.github.xiaoymin</groupId>
|
| | | <artifactId>knife4j-spring-boot-starter</artifactId>
|
| | | <version>3.0.3</version>
|
| | | <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
| | | <version>${knife4j.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>org.springdoc</groupId>
|
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
| | | <version>${springdoc.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- SpringBoot æ ¸å¿å
-->
|
| | |
| | | <artifactId>spring-boot-starter-data-redis</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <!-- pool å¯¹è±¡æ± -->
|
| | | <dependency>
|
| | | <groupId>org.apache.commons</groupId>
|
| | | <artifactId>commons-pool2</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-spring-boot-starter</artifactId>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-pinecone</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-open-ai-spring-boot-starter</artifactId>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-reactor</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-ollama-spring-boot-starter</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-community-dashscope-spring-boot-starter</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>dev.langchain4j</groupId>
|
| | | <artifactId>langchain4j-mcp</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <!-- Mysql驱å¨å
-->
|
| | |
| | | <groupId>mysql</groupId>
|
| | | <artifactId>mysql-connector-java</artifactId>
|
| | | <scope>runtime</scope>
|
| | | <version>8.0.33</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- FreeMarker 模æ¿å¼æï¼å¤çåéå ä½ç¬¦ -->
|
| | | <dependency>
|
| | | <groupId>org.freemarker</groupId>
|
| | | <artifactId>freemarker</artifactId>
|
| | | <version>2.3.32</version>
|
| | | <version>2.3.33</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- pagehelper å页æä»¶ -->
|
| | |
| | | <!-- é¿éæ°æ®åºè¿æ¥æ± -->
|
| | | <dependency>
|
| | | <groupId>com.alibaba</groupId>
|
| | | <artifactId>druid-spring-boot-starter</artifactId>
|
| | | <artifactId>druid-spring-boot-3-starter</artifactId>
|
| | | <version>${druid.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>org.mybatis</groupId>
|
| | | <artifactId>mybatis</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!--mybatis-plus-->
|
| | | <dependency>
|
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-boot-starter</artifactId>
|
| | | <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-jsqlparser</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | |
|
| | |
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-generator</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>com.github.jsqlparser</groupId>
|
| | | <artifactId>jsqlparser</artifactId>
|
| | | <version>${jsqlparser.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- èªå®ä¹éªè¯æ³¨è§£ -->
|
| | |
| | | <!-- Tokençæä¸è§£æ-->
|
| | | <dependency>
|
| | | <groupId>io.jsonwebtoken</groupId>
|
| | | <artifactId>jjwt</artifactId>
|
| | | <artifactId>jjwt-api</artifactId>
|
| | | <version>${jwt.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>io.jsonwebtoken</groupId>
|
| | | <artifactId>jjwt-impl</artifactId>
|
| | | <version>${jwt.version}</version>
|
| | | <scope>runtime</scope>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>io.jsonwebtoken</groupId>
|
| | | <artifactId>jjwt-jackson</artifactId>
|
| | | <version>${jwt.version}</version>
|
| | | <scope>runtime</scope>
|
| | | </dependency>
|
| | |
|
| | | <!-- Jaxb -->
|
| | | <dependency>
|
| | | <groupId>javax.xml.bind</groupId>
|
| | | <artifactId>jaxb-api</artifactId>
|
| | | <groupId>jakarta.xml.bind</groupId>
|
| | | <artifactId>jakarta.xml.bind-api</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <!-- 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>
|
| | | <groupId>io.swagger</groupId>
|
| | | <artifactId>swagger-annotations</artifactId>
|
| | | <version>${swagger.annotations.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- 鲿¢è¿å
¥swagger页颿¥ç±»å转æ¢éè¯¯ï¼æé¤3.0.0ä¸çå¼ç¨ï¼æå¨å¢å 1.6.2çæ¬ -->
|
| | | <dependency>
|
| | | <groupId>io.swagger</groupId>
|
| | | <artifactId>swagger-models</artifactId>
|
| | | <version>1.6.2</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- è·åç³»ç»ä¿¡æ¯ -->
|
| | | <dependency>
|
| | |
| | | <dependency>
|
| | | <groupId>org.projectlombok</groupId>
|
| | | <artifactId>lombok</artifactId>
|
| | | <version>${lombok.version}</version>
|
| | | </dependency>
|
| | |
|
| | |
|
| | |
| | | <version>${getui-sdk.version}</version>
|
| | | <scope>compile</scope>
|
| | | </dependency>
|
| | | |
| | |
|
| | | <!--hutoolå·¥å
·å
-->
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>${hutool.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>5.8.43</version>
|
| | | </dependency>
|
| | | <dependency>
|
| | | <groupId>com.fasterxml.jackson.datatype</groupId>
|
| | | <artifactId>jackson-datatype-jsr310</artifactId>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>net.coobird</groupId>
|
| | | <artifactId>thumbnailator</artifactId>
|
| | | <version>${thumbnailator.version}</version>
|
| | | </dependency>
|
| | |
|
| | | </dependencies>
|
| | |
| | | <finalName>${project.artifactId}</finalName>
|
| | | <plugins>
|
| | | <plugin>
|
| | | <groupId>org.apache.maven.plugins</groupId>
|
| | | <artifactId>maven-compiler-plugin</artifactId>
|
| | | <version>3.14.1</version>
|
| | | <configuration>
|
| | | <release>${maven.compiler.release}</release>
|
| | | <proc>full</proc>
|
| | | <annotationProcessorPaths>
|
| | | <path>
|
| | | <groupId>org.projectlombok</groupId>
|
| | | <artifactId>lombok</artifactId>
|
| | | <version>${lombok.version}</version>
|
| | | </path>
|
| | | </annotationProcessorPaths>
|
| | | </configuration>
|
| | | </plugin>
|
| | | <plugin>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | | <artifactId>spring-boot-maven-plugin</artifactId>
|
| | | <configuration>
|
| | | <fork>true</fork> <!-- å¦ææ²¡æè¯¥é
ç½®ï¼devtoolsä¸ä¼çæ -->
|
| | | </configuration>
|
| | | </plugin>
|
| | | </plugins>
|
| | | </build>
|
| | |
| | | import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.generator.FastAutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.config.*; |
| | | import com.baomidou.mybatisplus.generator.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.generator.config.OutputFile; |
| | | import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableField; |
| | | import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; |
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://1.15.17.182:9999/product-inventory-management-new"; |
| | | public static String database_url = "jdbc:mysql://localhost:3300/product-inventory-management-new-pro"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "xd@123456.."; |
| | | public static String database_password= "root"; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "staff"; // 模å |
| | | public static String model = "sales"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| | |
| | | new Column("update_time", FieldFill.INSERT_UPDATE), |
| | | new Column("create_user", FieldFill.INSERT), |
| | | new Column("update_user", FieldFill.INSERT_UPDATE), |
| | | new Column("tenant_id", FieldFill.INSERT) |
| | | new Column("dept_id", FieldFill.INSERT) |
| | | ) |
| | | .idType(IdType.AUTO) // èªå¢ä¸»é® |
| | | |
| | |
| | | StringBuilder help = new StringBuilder(); |
| | | help.append("请è¾å
¥" + tip + "ï¼"); |
| | | System.out.println(help.toString()); |
| | | if (scanner.hasNext()) { |
| | | String ipt = scanner.next(); |
| | | |
| | | if (scanner.hasNextLine()) { |
| | | String ipt = scanner.nextLine(); |
| | | if (StringUtils.isNotBlank(ipt)) { |
| | | return ipt; |
| | | } |
| | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder;
|
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
| | |
|
| | | import jakarta.servlet.ServletContext;
|
| | | import jakarta.servlet.ServletException;
|
| | |
|
| | | /**
|
| | | * web容å¨ä¸è¿è¡é¨ç½²
|
| | | *
|
| | |
| | | {
|
| | | return application.sources(RuoYiApplication.class);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onStartup(ServletContext servletContext) throws ServletException {
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | import com.ruoyi.project.system.mapper.SysNoticeMapper; |
| | | import com.ruoyi.safe.mapper.SafeTrainingMapper; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | //宿¶ä»»å¡æ±æ» |
| | | public class ScheduleTask { |
| | | |
| | | @Autowired |
| | | private SafeTrainingMapper safeTrainingMapper; |
| | | private final SafeTrainingMapper safeTrainingMapper; |
| | | |
| | | @Autowired |
| | | private SysNoticeMapper noticeMapper; |
| | | private final SysNoticeMapper noticeMapper; |
| | | |
| | | //宿¶ä»»å¡(15åéæ§è¡ä¸æ¬¡--夿å¹è®è®¡åæ°æ®,ç¶æååæ´) |
| | | @Scheduled(cron = "0 0/15 * * * ?") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.dto.ReportDateDto; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountExpenseService; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/account/accountExpense") |
| | | @Api(tags = "è´¢å¡ç®¡ç--æ¯åºç®¡ç") |
| | | @Tag(name = "è´¢å¡ç®¡ç--æ¯åºç®¡ç") |
| | | public class AccountExpenseController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountExpense accountExpense) { |
| | | accountExpense.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.updateById(accountExpense)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountExpenseListPage(Page page, AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.accountExpenseListPage(page, accountExpense)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @ApiOperation("详æ
") |
| | | @Operation(summary = "详æ
") |
| | | public AjaxResult accountExpenseDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountExpenseService.getById(id)); |
| | | } |
| | |
| | | * @param accountExpense |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åº") |
| | | @Operation(summary = "导åº") |
| | | public void accountExpenseExport(HttpServletResponse response,AccountExpense accountExpense) { |
| | | accountExpenseService.accountExpenseExport(response, accountExpense); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/forms") |
| | | @ApiOperation("è´¢å¡æ¥è¡¨å¾è¡¨æ¥è¯¢") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¥è¯¢") |
| | | public AjaxResult report(DateQueryDto dateQueryDto) { |
| | | return AjaxResult.success(accountExpenseService.report(dateQueryDto)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/analysis") |
| | | @ApiOperation("è´¢å¡æ¥è¡¨-è´¢å¡åæ") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨-è´¢å¡åæ") |
| | | public AjaxResult analysis() { |
| | | return AjaxResult.success(accountExpenseService.analysis()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/income") |
| | | @ApiOperation("è´¢å¡æ¥è¡¨å¾è¡¨æ¶å
¥å¹´åº¦æ¥è¯¢") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¶å
¥å¹´åº¦æ¥è¯¢") |
| | | public AjaxResult reportIncome(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountIncomeService.reportIncome(reportDateDto)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/expense") |
| | | @ApiOperation("è´¢å¡æ¥è¡¨å¾è¡¨æ¯åºå¹´åº¦æ¥è¯¢") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¯åºå¹´åº¦æ¥è¯¢") |
| | | public AjaxResult reportExpense(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountExpenseService.reportExpense(reportDateDto)); |
| | | } |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import jakarta.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/account/accountFile") |
| | | @Api(tags = "è´¢å¡éä»¶") |
| | | @Tag(name = "è´¢å¡éä»¶") |
| | | public class AccountFileController { |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.save(accountFile)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delAccountFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountFileListPage(Page page, AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.accountFileListPage(page, accountFile)); |
| | | } |
| | |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/account/accountIncome") |
| | | @Api(tags = "è´¢å¡ç®¡ç--æ¶å
¥ç®¡ç") |
| | | @Tag(name = "è´¢å¡ç®¡ç--æ¶å
¥ç®¡ç") |
| | | public class AccountIncomeController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountIncome accountIncome) { |
| | | accountIncome.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.updateById(accountIncome)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.accountIncomeListPage(page, accountIncome)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @ApiOperation("详æ
") |
| | | @Operation(summary = "详æ
") |
| | | public AjaxResult accountIncomeDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountIncomeService.getById(id)); |
| | | } |
| | |
| | | * @param accountIncome |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åº") |
| | | @Operation(summary = "导åº") |
| | | public void accountIncomeExport(HttpServletResponse response,AccountIncome accountIncome) { |
| | | accountIncomeService.accountIncomeExport(response, accountIncome); |
| | | } |
| | |
| | | import com.ruoyi.account.service.impl.AccountingServiceImpl; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | * @author :yys |
| | | * @date : 2026/1/17 10:40 |
| | | */ |
| | | @Api(tags = "ä¼è®¡æ ¸ç®") |
| | | @Tag(name = "ä¼è®¡æ ¸ç®") |
| | | @RestController |
| | | @RequestMapping("/accounting") |
| | | @AllArgsConstructor |
| | | public class AccountingController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private AccountingServiceImpl accountingService; |
| | | |
| | | @ApiOperation("æ»è®¡") |
| | | @Operation(summary = "æ»è®¡") |
| | | @GetMapping("/total") |
| | | public AjaxResult total(@RequestParam Integer year) { |
| | | return accountingService.total(year); |
| | | } |
| | | |
| | | @ApiOperation("设å¤ç±»ååå¸") |
| | | @Operation(summary = "设å¤ç±»ååå¸") |
| | | @GetMapping("/deviceTypeDistribution") |
| | | public AjaxResult deviceTypeDistribution(@RequestParam Integer year) { |
| | | return accountingService.deviceTypeDistribution(year); |
| | | } |
| | | |
| | | @ApiOperation("设å¤å页æ¥è¯¢è®¡ç®ææ§") |
| | | @Operation(summary = "设å¤å页æ¥è¯¢è®¡ç®ææ§") |
| | | @GetMapping("/calculateDepreciation") |
| | | public AjaxResult calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | return accountingService.calculateDepreciation(page,year); |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:57:29 |
| | | */ |
| | | @Api(tags = "忬¾ä¿¡æ¯è¡¨") |
| | | @Tag(name = "忬¾ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping("/borrowInfo") |
| | | @AllArgsConstructor |
| | | public class BorrowInfoController { |
| | | |
| | | @Autowired |
| | | private BorrowInfoService borrowInfoService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | | return borrowInfoService.listPage(page,borrowInfo); |
| | | } |
| | |
| | | * å¯¼åº |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation(value = "导åºå款信æ¯") |
| | | @Operation(summary = "导åºå款信æ¯") |
| | | public void export(HttpServletResponse response, BorrowInfo borrowInfo) { |
| | | List<BorrowInfo> list = borrowInfoService.list(); |
| | | ExcelUtil<BorrowInfo> util = new ExcelUtil<>(BorrowInfo.class); |
| | |
| | | import com.ruoyi.account.service.SalesReceiptReturnService; |
| | | import com.ruoyi.account.service.impl.SalesReceiptReturnServiceImpl; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/salesReceiptReturn") |
| | | @AllArgsConstructor |
| | | public class SalesReceiptReturnController { |
| | | |
| | | @Autowired |
| | | private SalesReceiptReturnService salesReceiptReturnService; |
| | | |
| | | |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation("æ¶æ¬¾é货表-å页æ¥è¯¢") |
| | | @Operation(summary = "æ¶æ¬¾é货表-å页æ¥è¯¢") |
| | | public R<IPage<SalesReceiptReturnDto>> page(SalesReceiptReturnDto salesReceiptReturnDto) { |
| | | return R.ok(salesReceiptReturnService.pageSalesReceiptReturnDto(salesReceiptReturnDto)); |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.SalesRefundAmountOrder; |
| | | import com.ruoyi.account.service.SalesRefundAmountOrderService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/salesRefundAmountOrder") |
| | | @AllArgsConstructor |
| | | public class SalesRefundAmountOrderController { |
| | | |
| | | @Autowired |
| | | private SalesRefundAmountOrderService salesRefundAmountOrderService; |
| | | |
| | | @GetMapping("/page") |
| | |
| | | return R.ok(salesRefundAmountOrderService.pageSalesRefundAmountOrderDto(page, salesRefundAmountOrder)); |
| | | } |
| | | |
| | | @ApiOperation("å¤ç") |
| | | @Operation(summary = "å¤ç") |
| | | @PostMapping("/dispose") |
| | | public R dispose( SalesRefundAmountOrderDto salesRefundAmountOrderId) { |
| | | return R.ok(salesRefundAmountOrderService.dispose(salesRefundAmountOrderId)); |
| | |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | package com.ruoyi.account.dto; |
| | | |
| | | import com.mchange.v1.util.ListUtils; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | package com.ruoyi.account.dto; |
| | | |
| | | import com.ruoyi.account.pojo.SalesRefundAmountOrder; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SalesRefundAmountOrderDto extends SalesRefundAmountOrder { |
| | | |
| | | @ApiModelProperty("éè´§åå·") |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnManagementNo; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty("éå®åå·") |
| | | @Schema(description = "éå®åå·") |
| | | private String salesContractNo; |
| | | |
| | | @ApiModelProperty("å建人åç§°") |
| | | @Schema(description = "å建人åç§°") |
| | | private String createUserName; |
| | | |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | private Date inputTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æä»¶è·¯å¾") |
| | | @Schema(description = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private int fileSize; |
| | | |
| | | @ApiModelProperty(value = "è´¢å¡ID") |
| | | @Schema(description = "è´¢å¡ID") |
| | | @NotBlank(message = "è´¢å¡idä¸è½ä¸ºç©º!") |
| | | private Long accountId; |
| | | |
| | | /** |
| | | * ç±»å(æ¶å
¥/æ¯åº) |
| | | */ |
| | | @ApiModelProperty(value = "ç±»å(æ¶å
¥/æ¯åº)") |
| | | @Schema(description = "ç±»å(æ¶å
¥/æ¯åº)") |
| | | private String accountType; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´¢å¡ç®¡ç--æ¶å
¥ç®¡ç |
| | |
| | | */ |
| | | @TableName(value = "account_income") |
| | | @Data |
| | | public class AccountIncome extends DateQueryDto implements Serializable { |
| | | public class AccountIncome extends DateQueryDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ¶å
¥ç±»å(é宿¶å
¥ï¼æå¡æ¶å
¥ï¼å
¶ä»æ¶å
¥) |
| | | */ |
| | | @Excel(name = "æ¶å
¥ç±»å",readConverterExp = "0=é宿¶å
¥,1=æå¡æ¶å
¥,2=å
¶ä»æ¶å
¥,3=忬¾æ¶å
¥") |
| | | @Excel(name = "æ¶å
¥ç±»å", readConverterExp = "0=é宿¶å
¥,1=æå¡æ¶å
¥,2=å
¶ä»æ¶å
¥,3=忬¾æ¶å
¥") |
| | | @NotBlank(message = "æ¶å
¥ç±»åä¸è½ä¸ºç©º!!") |
| | | private String incomeType; |
| | | |
| | |
| | | /** |
| | | * æ¶æ¬¾æ¹å¼(ç°éï¼æ¯ç¥¨ï¼é¶è¡è½¬è´¦ï¼å
¶ä») |
| | | */ |
| | | @Excel(name = "æ¶æ¬¾æ¹å¼",readConverterExp = "0=ç°é,1=æ¯ç¥¨,2=é¶è¡è½¬è´¦,3=å
¶ä»") |
| | | @Excel(name = "æ¶æ¬¾æ¹å¼", readConverterExp = "0=ç°é,1=æ¯ç¥¨,2=é¶è¡è½¬è´¦,3=å
¶ä»") |
| | | private String incomeMethod; |
| | | |
| | | /** |
| | | * æ¶æ¬¾æ¹å¼æ ç¾ |
| | | */ |
| | | @TableField(exist = false) |
| | | private String incomeMethodLabel; |
| | | |
| | | /** |
| | | * payment_methods åå
¸ç¼ç éåï¼business_type 为空æ¶ï¼ |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<String> paymentMethodList; |
| | | |
| | | /** |
| | | * receipt_payment_type åå
¸ç¼ç éåï¼business_type=1æ¶ï¼ |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<String> receiptPaymentMethodList; |
| | | |
| | | /** |
| | | * å票å·ç |
| | |
| | | private Date inputTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("borrow_info") |
| | | @ApiModel(value = "BorrowInfo对象", description = "忬¾ä¿¡æ¯è¡¨") |
| | | @Schema(name = "BorrowInfo对象", description = "忬¾ä¿¡æ¯è¡¨") |
| | | public class BorrowInfo extends DateQueryDto implements Serializable{ |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("忬¾è®°å½ä¸»é®ID") |
| | | @Schema(description = "忬¾è®°å½ä¸»é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("忬¾äººå§å") |
| | | @Schema(description = "忬¾äººå§å") |
| | | @Excel(name = "忬¾äººå§å") |
| | | private String borrowerName; |
| | | |
| | | @ApiModelProperty("忬¾éé¢ï¼å
ï¼") |
| | | @Schema(description = "忬¾éé¢ï¼å
ï¼") |
| | | @Excel(name = "忬¾éé¢ï¼å
ï¼") |
| | | private BigDecimal borrowAmount; |
| | | |
| | | @ApiModelProperty("忬¾å©çï¼å¦ï¼5.85 代表5.85%ï¼") |
| | | @Schema(description = "忬¾å©çï¼å¦ï¼5.85 代表5.85%ï¼") |
| | | @Excel(name = "忬¾å©ç") |
| | | private BigDecimal interestRate; |
| | | |
| | | @ApiModelProperty("忬¾æ¥æ") |
| | | @Schema(description = "忬¾æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "忬¾æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDate borrowDate; |
| | | |
| | | @ApiModelProperty("å®é
è¿æ¬¾æ¥æï¼è¿æ¬¾åå¡«å
ï¼") |
| | | @Schema(description = "å®é
è¿æ¬¾æ¥æï¼è¿æ¬¾åå¡«å
ï¼") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å®é
è¿æ¬¾æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDate repayDate; |
| | | |
| | | @ApiModelProperty("忬¾ç¶æï¼1=å¾
è¿æ¬¾ï¼2=å·²è¿æ¬¾") |
| | | @Schema(description = "忬¾ç¶æï¼1=å¾
è¿æ¬¾ï¼2=å·²è¿æ¬¾") |
| | | @Excel(name = "忬¾ç¶æ", readConverterExp = "1=å¾
è¿æ¬¾,2=å·²è¿æ¬¾") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("夿³¨ï¼å款说æï¼") |
| | | @Schema(description = "夿³¨ï¼å款说æï¼") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("å建è
ID") |
| | | @Schema(description = "å建è
ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹è
ID") |
| | | @Schema(description = "ä¿®æ¹è
ID") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("sales_receipt_return") |
| | | @ApiModel(value = "SalesReceiptReturn对象", description = "æ¶æ¬¾é货表") |
| | | @Schema(name = "SalesReceiptReturn对象", description = "æ¶æ¬¾é货表") |
| | | public class SalesReceiptReturn implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("ä¸»é® ID") |
| | | @Schema(description = "ä¸»é® ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("鿬¾åå·") |
| | | @Schema(description = "鿬¾åå·") |
| | | private String refundId; |
| | | |
| | | @ApiModelProperty("仿¬¾è´¦å·") |
| | | @Schema(description = "仿¬¾è´¦å·") |
| | | private String paymentAccount; |
| | | |
| | | @ApiModelProperty("仿¬¾è´¦å·åç§°") |
| | | @Schema(description = "仿¬¾è´¦å·åç§°") |
| | | private String paymentAccountName; |
| | | |
| | | @ApiModelProperty("仿¬¾æ¹å¼") |
| | | @Schema(description = "仿¬¾æ¹å¼") |
| | | private Byte paymentMethod; |
| | | |
| | | @ApiModelProperty("å®é
仿¬¾éé¢") |
| | | @Schema(description = "å®é
仿¬¾éé¢") |
| | | private BigDecimal actualAmount; |
| | | |
| | | @ApiModelProperty("æç»è´¹") |
| | | @Schema(description = "æç»è´¹") |
| | | private BigDecimal fee; |
| | | |
| | | @ApiModelProperty("交æå·") |
| | | @Schema(description = "交æå·") |
| | | private String transactionNo; |
| | | |
| | | @ApiModelProperty("伿 éé¢") |
| | | @Schema(description = "伿 éé¢") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建è
") |
| | | @Schema(description = "å建è
") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("sales_refund_amount_order") |
| | | @ApiModel(value = "SalesRefundAmountOrder对象", description = "éå®ç®¡ç--鿬¾å") |
| | | @Schema(name = "SalesRefundAmountOrder对象", description = "éå®ç®¡ç--鿬¾å") |
| | | public class SalesRefundAmountOrder implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("éè´§åå·id") |
| | | @Schema(description = "éè´§åå·id") |
| | | private Long returnManagementId; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("åºé款éé¢") |
| | | @Schema(description = "åºé款éé¢") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @ApiModelProperty("已鿬¾éé¢") |
| | | @Schema(description = "已鿬¾éé¢") |
| | | private BigDecimal refundedAmount; |
| | | |
| | | @ApiModelProperty("æªé款éé¢") |
| | | @Schema(description = "æªé款éé¢") |
| | | private BigDecimal notRefundedAmount; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人id") |
| | | @Schema(description = "å建人id") |
| | | private Long createUserId; |
| | | |
| | | @ApiModelProperty("æ´æ°äººid") |
| | | @Schema(description = "æ´æ°äººid") |
| | | private Long updateUserId; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import com.ruoyi.account.dto.ReportDateDto; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface AccountIncomeService extends IService<AccountIncome> { |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.dto.ReportDateDto; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | |
| | | //å页æ¥è¯¢ |
| | | @Override |
| | | public IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | resolveIncomeMethodLabelFilter(accountIncome); |
| | | return accountIncomeMapper.accountIncomeListPage(page,accountIncome); |
| | | } |
| | | |
| | | private void resolveIncomeMethodLabelFilter(AccountIncome accountIncome) { |
| | | if (accountIncome == null) { |
| | | return; |
| | | } |
| | | if (accountIncome.getIncomeMethodLabel() == null || accountIncome.getIncomeMethodLabel().trim().isEmpty()) { |
| | | return; |
| | | } |
| | | String targetLabel = accountIncome.getIncomeMethodLabel().trim(); |
| | | List<String> paymentMethodList = selectDictValuesByLabel("payment_methods", targetLabel); |
| | | List<String> receiptPaymentMethodList = selectDictValuesByLabel("receipt_payment_type", targetLabel); |
| | | if (paymentMethodList.isEmpty()) { |
| | | paymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | if (receiptPaymentMethodList.isEmpty()) { |
| | | receiptPaymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | accountIncome.setPaymentMethodList(paymentMethodList); |
| | | accountIncome.setReceiptPaymentMethodList(receiptPaymentMethodList); |
| | | accountIncome.setIncomeMethod(null); |
| | | } |
| | | |
| | | private List<String> selectDictValuesByLabel(String dictType, String label) { |
| | | return sysDictDataMapper.selectDictDataByType(dictType).stream() |
| | | .filter(item -> label.equals(item.getDictLabel())) |
| | | .map(SysDictData::getDictValue) |
| | | .filter(v -> v != null && !v.trim().isEmpty()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | //å¯¼åº |
| | | @Override |
| | | public void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome) { |
| | |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.procurementrecord.service.impl.ProcurementRecordOutServiceImpl; |
| | | import com.ruoyi.procurementrecord.service.impl.ProcurementRecordServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class AccountingServiceImpl { |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private BorrowInfoMapper borrowInfoMapper; |
| | | |
| | | @Autowired |
| | | private CustomStorageMapper customStorageMapper; |
| | | |
| | | @Autowired |
| | | private ProcurementRecordMapper procurementRecordMapper; |
| | | |
| | | @Autowired |
| | | private ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final BorrowInfoMapper borrowInfoMapper; |
| | | private final CustomStorageMapper customStorageMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | |
| | | public AjaxResult total(Integer year) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.BorrowInfoMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.ruoyi.account.mapper.BorrowInfoMapper; |
| | | import com.ruoyi.account.service.AccountExpenseService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.account.service.BorrowInfoService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.service.ReceiptPaymentService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class BorrowInfoServiceImpl extends ServiceImpl<BorrowInfoMapper, BorrowInfo> implements BorrowInfoService { |
| | | |
| | | @Autowired |
| | | private BorrowInfoMapper borrowInfoMapper; |
| | | |
| | | @Autowired |
| | | private AccountIncomeService accountIncomeService; |
| | | |
| | | @Autowired |
| | | private AccountExpenseService accountExpenseService; |
| | | private final BorrowInfoMapper borrowInfoMapper; |
| | | private final AccountIncomeService accountIncomeService; |
| | | private final AccountExpenseService accountExpenseService; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.dto.SalesRefundAmountOrderDto; |
| | | import com.ruoyi.account.pojo.SalesRefundAmountOrder; |
| | | import com.ruoyi.account.mapper.SalesRefundAmountOrderMapper; |
| | | import com.ruoyi.account.service.SalesRefundAmountOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.account.dto.SalesRefundAmountOrderDto; |
| | | import com.ruoyi.account.mapper.SalesRefundAmountOrderMapper; |
| | | import com.ruoyi.account.pojo.SalesRefundAmountOrder; |
| | | import com.ruoyi.account.service.SalesRefundAmountOrderService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | * @since 2026-03-07 10:16:47 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SalesRefundAmountOrderServiceImpl extends ServiceImpl<SalesRefundAmountOrderMapper, SalesRefundAmountOrder> implements SalesRefundAmountOrderService { |
| | | |
| | | |
| | | @Autowired |
| | | private SalesRefundAmountOrderMapper salesRefundAmountOrderMapper; |
| | | private final SalesRefundAmountOrderMapper salesRefundAmountOrderMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesRefundAmountOrderDto> pageSalesRefundAmountOrderDto(Page<SalesRefundAmountOrderDto> page, SalesRefundAmountOrderDto salesRefundAmountOrder) { |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | * @since 2026/03/02 14:40 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "临æå®å管ç") |
| | | @Tag(name = "临æå®å管ç") |
| | | @RequestMapping("/afterSalesNearExpiryService") |
| | | @AllArgsConstructor |
| | | public class AfterSalesNearExpiryController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AfterSalesNearExpiryService afterSalesNearExpiryService; |
| | | |
| | | /** |
| | | * æ°å¢ä¸´æå®å |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢ä¸´æå®å") |
| | | @Operation(summary = "æ°å¢ä¸´æå®å") |
| | | @Log(title = "æ°å¢ä¸´æå®å", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.add(entity); |
| | |
| | | * æ´æ°ä¸´æå®å |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperation("æ´æ°ä¸´æå®å") |
| | | @Operation(summary = "æ´æ°ä¸´æå®å") |
| | | @Log(title = "æ´æ°ä¸´æå®å", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.update(entity); |
| | |
| | | * å é¤ä¸´æå®å |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å é¤ä¸´æå®å") |
| | | @Operation(summary = "å é¤ä¸´æå®å") |
| | | @Log(title = "å é¤ä¸´æå®å", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(Long[] ids) { |
| | | afterSalesNearExpiryService.delete(ids); |
| | |
| | | * å页æ¥è¯¢ä¸´æå®å |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢ä¸´æå®å") |
| | | @Operation(summary = "å页æ¥è¯¢ä¸´æå®å") |
| | | @Log(title = "å页æ¥è¯¢ä¸´æå®å", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | IPage<AfterSalesNearExpiry> listPage = afterSalesNearExpiryService.listPage(page, entity); |
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | * @date : 2025/7/30 9:27 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "å®åæå¡") |
| | | @Tag(name = "å®åæå¡") |
| | | @RequestMapping("/afterSalesService") |
| | | @AllArgsConstructor |
| | | public class AfterSalesServiceController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private AfterSalesServiceService afterSalesServiceService; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private ISalesLedgerService salesLedgerService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å®åæå¡-å页æ¥è¯¢") |
| | | @Operation(summary = "å®åæå¡-å页æ¥è¯¢") |
| | | @Log(title = "å®åæå¡-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | |
| | | |
| | | @Log(title = "å®åæå¡-åé¦ç»è®°", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("å®åæå¡-åé¦ç»è®°") |
| | | @Operation(summary = "å®åæå¡-åé¦ç»è®°") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto(); |
| | |
| | | |
| | | @Log(title = "å®åæå¡-å®åå¤ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportTwo") |
| | | @ApiOperation("å®åæå¡-å®åå¤ç") |
| | | @Operation(summary = "å®åæå¡-å®åå¤ç") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("å®åæå¡-æ°å¢") |
| | | @Operation(summary = "å®åæå¡-æ°å¢") |
| | | @Log(title = "å®åæå¡-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("å®åæå¡-ä¿®æ¹") |
| | | @Operation(summary = "å®åæå¡-ä¿®æ¹") |
| | | @Log(title = "å®åæå¡-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) { |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å®åæå¡-å é¤") |
| | | @Operation(summary = "å®åæå¡-å é¤") |
| | | @Log(title = "å®åæå¡-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | |
| | | } |
| | | |
| | | @PostMapping("/dispose") |
| | | @ApiOperation("å®åæå¡-å¤ç") |
| | | @Operation(summary = "å®åæå¡-å¤ç") |
| | | @Log(title = "å®åæå¡-å¤ç", businessType = BusinessType.UPDATE) |
| | | public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | AfterSalesService byId = afterSalesServiceService.getById(afterSalesService.getId()); |
| | |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @ApiOperation("å®åæå¡-è·åéå®å°è´¦") |
| | | @Operation(summary = "å®åæå¡-è·åéå®å°è´¦") |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return AjaxResult.success(list); |
| | |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @ApiOperation("å®åæå¡-æ ¹æ®idè·å详æ
") |
| | | @Operation(summary = "å®åæå¡-æ ¹æ®idè·å详æ
") |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @ApiOperation("å®åæå¡-ç»è®¡å·¥åæ
åµ") |
| | | @Operation(summary = "å®åæå¡-ç»è®¡å·¥åæ
åµ") |
| | | @GetMapping("count") |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * @since 2026/03/02 11:20 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "å®åæå¡é件表") |
| | | @Tag(name = "å®åæå¡é件表") |
| | | @RequestMapping("/afterSalesService/file") |
| | | @AllArgsConstructor |
| | | public class AfterSalesServiceFileController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AfterSalesServiceFileService afterSalesServiceFileService; |
| | | |
| | | @PostMapping("/upload") |
| | | @ApiOperation("å®åæå¡-æä»¶ä¸ä¼ ") |
| | | @Operation(summary = "å®åæå¡-æä»¶ä¸ä¼ ") |
| | | @Log(title = "å®åæå¡-æä»¶ä¸ä¼ ", businessType = BusinessType.INSERT) |
| | | public AjaxResult fileUpload(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("id") Long afterSalesServiceId) { |
| | |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å®åå¤ç-å®åéä»¶å表") |
| | | @Operation(summary = "å®åå¤ç-å®åéä»¶å表") |
| | | @Log(title = "å®åå¤ç-å®åéä»¶å表", businessType = BusinessType.OTHER) |
| | | public AjaxResult fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return AjaxResult.success(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{fileId}") |
| | | @ApiOperation("å®åå¤ç-å é¤éä»¶") |
| | | @Operation(summary = "å®åå¤ç-å é¤éä»¶") |
| | | @Log(title = "å®åå¤ç-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public AjaxResult delFile(@PathVariable Long fileId) { |
| | | afterSalesServiceFileService.delFile(fileId); |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | /** |
| | | * ç¶æ 1-å¾
å¤ç 2-å·²å¤ç |
| | | */ |
| | | @ApiModelProperty("ç¶æ 1-å¾
å¤ç 2-å·²å¤ç") |
| | | @Schema(description = "ç¶æ 1-å¾
å¤ç 2-å·²å¤ç") |
| | | private Integer status; |
| | | |
| | | |
| | |
| | | /** |
| | | * ç»è®°äººåç§° |
| | | */ |
| | | @ApiModelProperty("ç»è®°äººåç§°") |
| | | @Schema(description = "ç»è®°äººåç§°") |
| | | @Excel(name = "ç»è®°äººåç§°") |
| | | private String checkNickName; |
| | | |
| | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | /** |
| | | * é®é¢æè¿° |
| | | */ |
| | | @ApiModelProperty("é®é¢æè¿°") |
| | | @Schema(description = "é®é¢æè¿°") |
| | | @Excel(name = "é®é¢æè¿°") |
| | | private String proDesc; |
| | | |
| | |
| | | /** |
| | | * å馿¥æ |
| | | */ |
| | | @ApiModelProperty("å馿¥æ") |
| | | @Schema(description = "å馿¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å馿¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date feedbackDate; |
| | | |
| | | |
| | | @ApiModelProperty("å
³èé¨é¨") |
| | | @Schema(description = "å
³èé¨é¨") |
| | | @Excel(name = "å
³èé¨é¨") |
| | | private String deptName; |
| | | |
| | |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | @Data |
| | | public class AfterSalesServiceNewDto extends AfterSalesService { |
| | | |
| | | @ApiModelProperty("产ååå·IDæ°ç»") |
| | | @Schema(description = "产ååå·IDæ°ç»") |
| | | private List<Long> productModelIdList; |
| | | |
| | | private SalesLedgerDto salesLedgerDto; |
| | |
| | | package com.ruoyi.aftersalesservice.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("after_sales_near_expiry") |
| | | @ApiModel("临æå®å管ç表") |
| | | @Schema(name = "临æå®å管ç表") |
| | | public class AfterSalesNearExpiry { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty("主é®") |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("临æäº§ååç§°") |
| | | @Schema(description = "临æäº§ååç§°") |
| | | private String productName; |
| | | |
| | | @ApiModelProperty("äº§åæ¹å·") |
| | | @Schema(description = "äº§åæ¹å·") |
| | | private String batchNumber; |
| | | |
| | | @ApiModelProperty("ä¸´ææ¥æ") |
| | | @Schema(description = "ä¸´ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate expireDate; |
| | | |
| | | @ApiModelProperty("åºåæ°é") |
| | | @Schema(description = "åºåæ°é") |
| | | private Integer stockQuantity; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty("èç³»çµè¯") |
| | | @Schema(description = "èç³»çµè¯") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty("é®é¢æè¿°") |
| | | @Schema(description = "é®é¢æè¿°") |
| | | private String disRes; |
| | | |
| | | @ApiModelProperty("å¤çç»æ") |
| | | @Schema(description = "å¤çç»æ") |
| | | private String disposeResult; |
| | | |
| | | @ApiModelProperty("å¤çç¶æ (1-å¾
å¤ç 2-å·²å¤ç)") |
| | | @Schema(description = "å¤çç¶æ (1-å¾
å¤ç 2-å·²å¤ç)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å¤ç人ID") |
| | | @Schema(description = "å¤ç人ID") |
| | | private Long disposeUserId; |
| | | |
| | | @ApiModelProperty("å¤ç人åç§°") |
| | | @Schema(description = "å¤ç人åç§°") |
| | | private String disposeNickName; |
| | | |
| | | @ApiModelProperty("å¤çæ¥æ") |
| | | @Schema(description = "å¤çæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate disDate; |
| | | |
| | | @ApiModelProperty("å建è
") |
| | | @Schema(description = "å建è
") |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹è
") |
| | | @Schema(description = "ä¿®æ¹è
") |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("after_sales_service") |
| | | @ApiModel |
| | | @Schema |
| | | public class AfterSalesService { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * ç¶æ 1-å¾
å¤ç 2-å·²å¤ç |
| | | */ |
| | | @ApiModelProperty("ç¶æ 1-å¾
å¤ç 2-å·²å¤ç") |
| | | @Schema(description = "ç¶æ 1-å¾
å¤ç 2-å·²å¤ç") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å®ååå·") |
| | | @Schema(description = "å®ååå·") |
| | | private String afterSalesServiceNo; |
| | | |
| | | |
| | |
| | | /** |
| | | * ç»è®°äºº |
| | | */ |
| | | @ApiModelProperty("ç»è®°äºº") |
| | | @Schema(description = "ç»è®°äºº") |
| | | private Long checkUserId; |
| | | |
| | | /** |
| | | * ç»è®°äººåç§° |
| | | */ |
| | | @ApiModelProperty("ç»è®°äººåç§°") |
| | | @Schema(description = "ç»è®°äººåç§°") |
| | | @Excel(name = "ç»è®°äººåç§°") |
| | | private String checkNickName; |
| | | |
| | | /** |
| | | * å¤ç人 |
| | | */ |
| | | @ApiModelProperty("å¤ç人") |
| | | @Schema(description = "å¤ç人") |
| | | private Long disposeUserId; |
| | | |
| | | /** |
| | | * å¤ç人åç§° |
| | | */ |
| | | @ApiModelProperty("å¤ç人åç§°") |
| | | @Schema(description = "å¤ç人åç§°") |
| | | @Excel(name = "å¤ç人åç§°") |
| | | private String disposeNickName; |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | /** |
| | | * é®é¢æè¿° |
| | | */ |
| | | @ApiModelProperty("é®é¢æè¿°") |
| | | @Schema(description = "é®é¢æè¿°") |
| | | @Excel(name = "é®é¢æè¿°") |
| | | private String proDesc; |
| | | |
| | | /** |
| | | * å¤çç»æ |
| | | */ |
| | | @ApiModelProperty("å¤çç»æ") |
| | | @Schema(description = "å¤çç»æ") |
| | | @Excel(name = "å¤çç»æ") |
| | | private String disRes; |
| | | |
| | | /** |
| | | * å馿¥æ |
| | | */ |
| | | @ApiModelProperty("å馿¥æ") |
| | | @Schema(description = "å馿¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å馿¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | |
| | | /** |
| | | * å¤çæ¥æ |
| | | */ |
| | | @ApiModelProperty("å¤çæ¥æ") |
| | | @Schema(description = "å¤çæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¤çæ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | |
| | | private Long tenantId; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("é¨é¨åç§°") |
| | | @Schema(description = "é¨é¨åç§°") |
| | | private String deptName; |
| | | |
| | | |
| | | @ApiModelProperty("å®åç±»å") |
| | | @Schema(description = "å®åç±»å") |
| | | private String serviceType; |
| | | |
| | | @ApiModelProperty("ç´§æ¥ç¨åº¦") |
| | | @Schema(description = "ç´§æ¥ç¨åº¦") |
| | | private String urgency; |
| | | |
| | | @ApiModelProperty("éå®å°è´¦ID") |
| | | @Schema(description = "éå®å°è´¦ID") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty("åé
人ID") |
| | | @Schema(description = "åé
人ID") |
| | | private Long distributionUserId; |
| | | |
| | | |
| | | @ApiModelProperty("产ååå·IDs") |
| | | @Schema(description = "产ååå·IDs") |
| | | private String productModelIds; |
| | | |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.aftersalesservice.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | */ |
| | | @Data |
| | | @TableName("after_sales_service_file") |
| | | @ApiModel("å®åæå¡é件表") |
| | | @Schema(name = "å®åæå¡é件表") |
| | | public class AfterSalesServiceFile { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty("主é®") |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("å®åæå¡è®°å½ID") |
| | | @Schema(description = "å®åæå¡è®°å½ID") |
| | | private Long serviceId; |
| | | |
| | | @ApiModelProperty("æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty("æä»¶è®¿é®å°å") |
| | | @Schema(description = "æä»¶è®¿é®å°å") |
| | | private String fileUrl; |
| | | |
| | | @ApiModelProperty("æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private Long fileSize; |
| | | |
| | | @ApiModelProperty("æä»¶åç¼") |
| | | @Schema(description = "æä»¶åç¼") |
| | | private String fileSuffix; |
| | | |
| | | @ApiModelProperty("å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼") |
| | | @Schema(description = "å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼") |
| | | private String delFlag; |
| | | |
| | | @ApiModelProperty("ä¸ä¼ è
") |
| | | @Schema(description = "ä¸ä¼ è
") |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹è
") |
| | | @Schema(description = "ä¿®æ¹è
") |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * @since 2026/03/02 11:19 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AfterSalesServiceFileServiceImpl extends ServiceImpl<AfterSalesServiceFileMapper, AfterSalesServiceFile> implements AfterSalesServiceFileService { |
| | | |
| | | @Autowired |
| | | private AfterSalesServiceService afterSalesServiceService; |
| | | private final AfterSalesServiceService afterSalesServiceService; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class AfterSalesServiceServiceImpl extends ServiceImpl<AfterSalesServiceMapper, AfterSalesService> implements AfterSalesServiceService { |
| | | |
| | | @Autowired |
| | | private AfterSalesServiceMapper afterSalesServiceMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | @Autowired |
| | | private ISalesLedgerService salesLedgerService; |
| | | private final AfterSalesServiceMapper afterSalesServiceMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ISalesLedgerProductService salesLedgerProductService; |
| | | private final ISalesLedgerService salesLedgerService; |
| | | |
| | | @Override |
| | | public IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.MemoryId; |
| | | import dev.langchain4j.service.SystemMessage; |
| | | import dev.langchain4j.service.UserMessage; |
| | | import dev.langchain4j.service.spring.AiService; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; |
| | | |
| | | @AiService( |
| | | wiringMode = EXPLICIT, |
| | | streamingChatModel = "qwenStreamingChatModel", |
| | | chatMemoryProvider = "chatMemoryProviderApproveTodo", |
| | | tools = "approveTodoTools") |
| | | public interface ApproveTodoAgent { |
| | | |
| | | @SystemMessage(fromResource = "approve-todo-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.ai.tools.ApproveTodoTools; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Component |
| | | public class ApproveTodoIntentExecutor { |
| | | |
| | | private static final Pattern APPROVE_ID_PATTERN = Pattern.compile("\\b[A-Za-z]*\\d{8,}\\b"); |
| | | private static final Pattern LIMIT_PATTERN = Pattern.compile("(å|æè¿)?(\\d{1,2})æ¡"); |
| | | private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})"); |
| | | private static final Pattern NUMBER_PATTERN = Pattern.compile("(\\d+(?:\\.\\d+)?)"); |
| | | private static final Pattern RECENT_RANGE_PATTERN = Pattern.compile("è¿\\d+(天|å¨|个æ|æ|å¹´)"); |
| | | private static final Pattern HALF_RANGE_PATTERN = Pattern.compile("(æè¿|è¿)?å(个)?(æ|å¹´)"); |
| | | private static final Pattern EXPLICIT_RANGE_PATTERN = Pattern.compile(".*(å°|è³).*"); |
| | | |
| | | private final ApproveTodoTools approveTodoTools; |
| | | |
| | | public ApproveTodoIntentExecutor(ApproveTodoTools approveTodoTools) { |
| | | this.approveTodoTools = approveTodoTools; |
| | | } |
| | | |
| | | public String tryExecute(String memoryId, String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return null; |
| | | } |
| | | |
| | | String text = message.trim(); |
| | | String approveId = extractApproveId(text); |
| | | |
| | | if (isStatsIntent(text)) { |
| | | return approveTodoTools.getTodoStats( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractTimeRange(text) |
| | | ); |
| | | } |
| | | if (containsAny(text, "æµè½¬", "è¿åº¦", "èç¹", "æ¥å¿", "å¡å¨", "å¡å°", "å½å审æ¹äºº", "å¤çè®°å½")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.getTodoProgress(memoryId, approveId) |
| | | : missingApproveId("todo_progress", "æ¥è¯¢å®¡æ¹è¿åº¦éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "详æ
", "æç»") && !containsAny(text, "å表")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.getTodoDetail(memoryId, approveId) |
| | | : missingApproveId("todo_detail", "æ¥è¯¢å®¡æ¹è¯¦æ
éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "åæ¶å®¡æ ¸", "æ¤éå®¡æ ¸", "åéå®¡æ ¸", "æ¤é审æ¹", "æ¤å审æ¹") |
| | | || (containsAny(text, "æ¤é", "æ¤å") && containsAny(text, "å®¡æ¹æä½", "å®¡æ ¸æä½"))) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.cancelReviewTodo(memoryId, approveId, firstNonBlank(extractTail(text, "åå "), extractTail(text, "夿³¨"))) |
| | | : missingApproveId("cancel_review_action", "åæ¶å®¡æ ¸éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "å é¤", "ç§»é¤")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.deleteTodo(memoryId, approveId) |
| | | : missingApproveId("delete_action", "å é¤å®¡æ¹åéè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "驳å", "æç»")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", firstNonBlank(extractTail(text, "åå "), extractTail(text, "夿³¨"))) |
| | | : missingApproveId("review_action", "驳å审æ¹éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "å®¡æ ¸éè¿", "审æ¹éè¿", "éè¿å®¡æ¹", "åæå®¡æ¹", "审æ¹åæ")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "夿³¨")) |
| | | : missingApproveId("review_action", "审æ¹éè¿éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (StringUtils.hasText(approveId) |
| | | && containsAny(text, "éè¿", "åæ") |
| | | && !containsAny(text, "æªéè¿", "éè¿ç", "审æ¹éè¿ç", "å®¡æ ¸éè¿ç")) { |
| | | return approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "夿³¨")); |
| | | } |
| | | if (containsAny(text, "ä¿®æ¹", "æ´æ°", "åæ´")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.updateTodo( |
| | | memoryId, |
| | | approveId, |
| | | extractValue(text, "æ é¢"), |
| | | extractDateValue(text, "å¼å§æ¥æ"), |
| | | extractDateValue(text, "ç»ææ¥æ"), |
| | | extractBigDecimalValue(text, "éé¢"), |
| | | extractValue(text, "å°ç¹"), |
| | | extractIntegerValue(text, "ç±»å"), |
| | | extractValue(text, "夿³¨")) |
| | | : missingApproveId("update_action", "ä¿®æ¹å®¡æ¹åéè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "å表", "å¾
å", "æ¥è¯¢å®¡æ¹", "åæ®", "æµç¨", "å®¡æ¹æ¹")) { |
| | | return approveTodoTools.listTodos( |
| | | memoryId, |
| | | extractStatus(text), |
| | | extractApproveType(text), |
| | | extractKeyword(text), |
| | | extractLimit(text), |
| | | extractScope(text)); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean isStatsIntent(String text) { |
| | | if (containsAny(text, "ç»è®¡", "åæ", "å¾è¡¨", "è¶å¿", "å æ¯", "æ±æ»", "æ»é", "åå¸", "åæå¤å°", "æå¤å°")) { |
| | | return true; |
| | | } |
| | | boolean hasQueryWord = containsAny(text, "æ¥è¯¢", "æ¥ç", "çä¸", "çç", "è·å"); |
| | | boolean hasDataWord = containsAny(text, "æ°æ®", "æ¥è¡¨", "æ
åµ", "æ°é", "éé¢"); |
| | | boolean hasTimeWord = containsAny(text, "ä»å¤©", "æ¨æ¥", "æ¨å¤©", "æ¬å¨", "ä¸å¨", "æ¬æ", "䏿", "æ¬å¹´", "ä»å¹´", "å»å¹´") |
| | | || DATE_PATTERN.matcher(text).find() |
| | | || RECENT_RANGE_PATTERN.matcher(text).find() |
| | | || HALF_RANGE_PATTERN.matcher(text).find() |
| | | || EXPLICIT_RANGE_PATTERN.matcher(text).matches(); |
| | | return hasQueryWord && hasDataWord && hasTimeWord; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String extractApproveId(String text) { |
| | | Matcher matcher = APPROVE_ID_PATTERN.matcher(text); |
| | | return matcher.find() ? matcher.group() : null; |
| | | } |
| | | |
| | | private Integer extractLimit(String text) { |
| | | Matcher matcher = LIMIT_PATTERN.matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10; |
| | | } |
| | | |
| | | private String extractStatus(String text) { |
| | | if (containsAny(text, "å¾
å®¡æ ¸", "å¾
审æ¹")) { |
| | | return "pending"; |
| | | } |
| | | if (containsAny(text, "å®¡æ ¸ä¸", "å¤çä¸", "å¤çä¸ç", "åçä¸")) { |
| | | return "processing"; |
| | | } |
| | | if (containsAny(text, "å·²éè¿", "éè¿", "å®¡æ ¸å®æ", "审æ¹å®æ")) { |
| | | return "approved"; |
| | | } |
| | | if (containsAny(text, "æªéè¿", "驳å", "已驳å", "æç»")) { |
| | | return "rejected"; |
| | | } |
| | | if (containsAny(text, "éæ°æäº¤")) { |
| | | return "resubmitted"; |
| | | } |
| | | return "all"; |
| | | } |
| | | |
| | | private Integer extractApproveType(String text) { |
| | | if (text.contains("å
¬åº")) { |
| | | return 1; |
| | | } |
| | | if (text.contains("请å")) { |
| | | return 2; |
| | | } |
| | | if (text.contains("åºå·®")) { |
| | | return 3; |
| | | } |
| | | if (text.contains("æ¥é")) { |
| | | return 4; |
| | | } |
| | | if (text.contains("éè´")) { |
| | | return 5; |
| | | } |
| | | if (text.contains("æ¥ä»·")) { |
| | | return 6; |
| | | } |
| | | if (text.contains("åè´§")) { |
| | | return 7; |
| | | } |
| | | if (text.contains("å±é©ä½ä¸")) { |
| | | return 8; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String extractKeyword(String text) { |
| | | String cleaned = text |
| | | .replace("æ¥è¯¢", "") |
| | | .replace("æ¥ç", "") |
| | | .replace("ååº", "") |
| | | .replace("帮æ", "") |
| | | .replace("审æ¹", "") |
| | | .replace("åæ®", "") |
| | | .replace("å¾
å", "") |
| | | .replace("å表", "") |
| | | .replace("å10æ¡", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .trim(); |
| | | return cleaned.length() >= 2 ? cleaned : null; |
| | | } |
| | | |
| | | private String extractValue(String text, String fieldName) { |
| | | Pattern pattern = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|æ¯)[:ï¼]?[\\s]*([^,ï¼ãï¼;\\s]+)"); |
| | | Matcher matcher = pattern.matcher(text); |
| | | return matcher.find() ? matcher.group(2) : null; |
| | | } |
| | | |
| | | private String extractDateValue(String text, String fieldName) { |
| | | int index = text.indexOf(fieldName); |
| | | if (index < 0) { |
| | | return null; |
| | | } |
| | | Matcher matcher = DATE_PATTERN.matcher(text.substring(index)); |
| | | return matcher.find() ? matcher.group(1) : null; |
| | | } |
| | | |
| | | private String extractStartDate(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | return matcher.find() ? matcher.group(1) : null; |
| | | } |
| | | |
| | | private String extractEndDate(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | if (!matcher.find()) { |
| | | return null; |
| | | } |
| | | return matcher.find() ? matcher.group(1) : null; |
| | | } |
| | | |
| | | private String extractTimeRange(String text) { |
| | | if (containsAny(text, "ä»å¤©", "æ¨æ¥", "æ¨å¤©", "æ¬å¨", "ä¸å¨", "æ¬æ", "䏿", "æ¬å¹´", "ä»å¹´", "å»å¹´")) { |
| | | return text; |
| | | } |
| | | if (RECENT_RANGE_PATTERN.matcher(text).find()) { |
| | | return text; |
| | | } |
| | | if (HALF_RANGE_PATTERN.matcher(text).find()) { |
| | | return text; |
| | | } |
| | | if (EXPLICIT_RANGE_PATTERN.matcher(text).matches()) { |
| | | return text; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Integer extractIntegerValue(String text, String fieldName) { |
| | | if (!text.contains(fieldName)) { |
| | | return null; |
| | | } |
| | | Matcher matcher = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|æ¯)[:ï¼]?[\\s]*(\\d{1,2})").matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : null; |
| | | } |
| | | |
| | | private BigDecimal extractBigDecimalValue(String text, String fieldName) { |
| | | int index = text.indexOf(fieldName); |
| | | if (index < 0) { |
| | | return null; |
| | | } |
| | | Matcher matcher = NUMBER_PATTERN.matcher(text.substring(index)); |
| | | return matcher.find() ? new BigDecimal(matcher.group(1)) : null; |
| | | } |
| | | |
| | | private String extractTail(String text, String key) { |
| | | Pattern pattern = Pattern.compile(key + "(æ¯|为)?[:ï¼]?[\\s]*(.+)"); |
| | | Matcher matcher = pattern.matcher(text); |
| | | return matcher.find() ? matcher.group(2).trim() : null; |
| | | } |
| | | |
| | | private String extractScope(String text) { |
| | | if (containsAny(text, "æåèµ·", "ææäº¤", "æç³è¯·", "ç³è¯·äººæ¯æ")) { |
| | | return "applicant"; |
| | | } |
| | | if (containsAny(text, "å¾
æå®¡æ¹", "å¾
æå®¡æ ¸", "æå¤ç", "æå®¡æ¹", "å½åå¾
æ", "éè¦æå¤ç")) { |
| | | return "approver"; |
| | | } |
| | | return "related"; |
| | | } |
| | | |
| | | private String firstNonBlank(String first, String second) { |
| | | return StringUtils.hasText(first) ? first : second; |
| | | } |
| | | |
| | | private String missingApproveId(String type, String description) { |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("success", false); |
| | | result.put("type", type); |
| | | result.put("description", description); |
| | | result.put("summary", Map.of()); |
| | | result.put("data", Map.of()); |
| | | result.put("charts", Map.of()); |
| | | return JSON.toJSONString(result); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.spring.AiService; |
| | | |
| | | import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 18:26 |
| | | */ |
| | | //å 为æä»¬å¨é
ç½®æä»¶ä¸åæ¶é
ç½®äºå¤ä¸ªå¤§è¯è¨æ¨¡åï¼æä»¥éè¦å¨è¿éæç¡®æå®ï¼EXPLICITï¼æ¨¡åçbeanName |
| | | |
| | | @AiService(wiringMode = EXPLICIT, chatModel = "qwenChatModel") |
| | | public interface Assistant { |
| | | String chat(String userMessage); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.MemoryId; |
| | | import dev.langchain4j.service.SystemMessage; |
| | | import dev.langchain4j.service.UserMessage; |
| | | import dev.langchain4j.service.spring.AiService; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; |
| | | |
| | | @AiService( |
| | | wiringMode = EXPLICIT, |
| | | streamingChatModel = "qwenStreamingChatModel", |
| | | chatMemoryProvider = "chatMemoryProvider" |
| | | ) |
| | | public interface FileAnalyzeAgent { |
| | | |
| | | @SystemMessage(""" |
| | | ä½ æ¯ä¼ä¸ææ¡£åæå©æã |
| | | è¯·ä¸¥æ ¼åºäºç¨æ·æä¾çæä»¶å
容è¿è¡åæï¼è¾åºè¦ç»æåãåç¡®ãç®æ´ã |
| | | è¥æä»¶å
容ä¸è¶³ä»¥æ¯æç»è®ºï¼æç¡®æåºâä¸è¶³ä¿¡æ¯âå¹¶ç»åºéè¦è¡¥å
çæ°æ®é¡¹ã |
| | | """) |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.MemoryId; |
| | | import dev.langchain4j.service.SystemMessage; |
| | | import dev.langchain4j.service.UserMessage; |
| | | import dev.langchain4j.service.spring.AiService; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; |
| | | |
| | | @AiService( |
| | | wiringMode = EXPLICIT, |
| | | streamingChatModel = "qwenStreamingChatModel", |
| | | chatMemoryProvider = "chatMemoryProviderPurchase", |
| | | tools = "purchaseAgentTools" |
| | | ) |
| | | public interface PurchaseAgent { |
| | | |
| | | @SystemMessage(fromResource = "purchase-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import com.ruoyi.ai.tools.PurchaseAgentTools; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Component |
| | | public class PurchaseIntentExecutor { |
| | | |
| | | private static final Pattern ID_PATTERN = Pattern.compile("\\b\\d{1,12}\\b"); |
| | | private static final Pattern LIMIT_PATTERN = Pattern.compile("(å|æè¿)?(\\d{1,2})æ¡"); |
| | | private static final Pattern DATE_PATTERN = Pattern.compile("\\d{4}-\\d{2}-\\d{2}"); |
| | | |
| | | private final PurchaseAgentTools purchaseAgentTools; |
| | | |
| | | public PurchaseIntentExecutor(PurchaseAgentTools purchaseAgentTools) { |
| | | this.purchaseAgentTools = purchaseAgentTools; |
| | | } |
| | | |
| | | public String tryExecute(String memoryId, String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return null; |
| | | } |
| | | String text = message.trim(); |
| | | |
| | | if (containsAny(text, "æè¡", "æå", "åå ", "åäº", "åå") && containsAny(text, "ç©æ", "产å", "åææ", "éè´éé¢", "éé¢")) { |
| | | return purchaseAgentTools.rankPurchaseMaterials( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text, |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | if (containsAny(text, "æªå
¥åº", "å¾
å
¥åº", "没æå
¥åº", "è¿æªå
¥åº")) { |
| | | return purchaseAgentTools.listUnstockedPurchaseOrders( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | if (containsAny(text, "å°è´§å¼å¸¸", "å°è´§æå¼å¸¸", "å¼å¸¸å°è´§", "å°è´§é®é¢", "ä¾åºåå°è´§å¼å¸¸")) { |
| | | return purchaseAgentTools.listArrivalExceptions( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text, |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | if (containsAny(text, "å¾
仿¬¾", "æªä»æ¬¾", "æªä»æ¸
", "å¾
æ¯ä»", "åºä»")) { |
| | | return purchaseAgentTools.listPendingPaymentOrders( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | if (containsAny(text, "éè´§", "éæ", "ææ¶")) { |
| | | return purchaseAgentTools.listPurchaseReturns( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | if (isStatsIntent(text)) { |
| | | return purchaseAgentTools.getPurchaseStats( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text |
| | | ); |
| | | } |
| | | if (containsAny(text, "详æ
", "æç»") && extractId(text) != null) { |
| | | return purchaseAgentTools.getPurchaseLedgerDetail(memoryId, extractId(text)); |
| | | } |
| | | if (containsAny(text, "å°è´¦", "éè´å", "éè´è®¢å", "订å", "åå", "å表", "æ¥è¯¢")) { |
| | | return purchaseAgentTools.listPurchaseLedgers( |
| | | memoryId, |
| | | extractKeyword(text), |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractLimit(text) |
| | | ); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean isStatsIntent(String text) { |
| | | if (containsAny(text, "ç»è®¡", "åæ", "æ¥è¡¨", "æ±æ»", "è¶å¿", "æ°æ®çæ¿", "æ
åµ", "æå¤å°")) { |
| | | return true; |
| | | } |
| | | boolean queryWord = containsAny(text, "æ¥è¯¢", "æ¥ç", "çä¸", "çç", "è·å"); |
| | | boolean dataWord = containsAny(text, "æ°æ®", "éé¢", "æ°é", "ååé¢", "仿¬¾é¢", "å票é¢"); |
| | | boolean timeWord = containsAny(text, "ä»å¤©", "æ¬å¨", "æ¬æ", "䏿", "ä»å¹´", "å»å¹´", "è¿åå¹´", "æè¿å个æ", "å个æ") |
| | | || DATE_PATTERN.matcher(text).find(); |
| | | return queryWord && dataWord && timeWord; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private Long extractId(String text) { |
| | | Matcher matcher = ID_PATTERN.matcher(text); |
| | | if (!matcher.find()) { |
| | | return null; |
| | | } |
| | | return Long.parseLong(matcher.group()); |
| | | } |
| | | |
| | | private Integer extractLimit(String text) { |
| | | Matcher matcher = LIMIT_PATTERN.matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10; |
| | | } |
| | | |
| | | private String extractStartDate(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | return matcher.find() ? matcher.group() : null; |
| | | } |
| | | |
| | | private String extractEndDate(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | if (!matcher.find()) { |
| | | return null; |
| | | } |
| | | return matcher.find() ? matcher.group() : null; |
| | | } |
| | | |
| | | private String extractKeyword(String text) { |
| | | String cleaned = text |
| | | .replace("æ¥è¯¢", "") |
| | | .replace("æ¥ç", "") |
| | | .replace("éè´", "") |
| | | .replace("éè´å", "") |
| | | .replace("éè´è®¢å", "") |
| | | .replace("订å", "") |
| | | .replace("å°è´¦", "") |
| | | .replace("å表", "") |
| | | .replace("åªäº", "") |
| | | .replace("ååº", "") |
| | | .replace("帮æ", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .replace("å10æ¡", "") |
| | | .trim(); |
| | | return cleaned.length() >= 2 ? cleaned : null; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.MemoryId; |
| | | import dev.langchain4j.service.SystemMessage; |
| | | import dev.langchain4j.service.UserMessage; |
| | | import dev.langchain4j.service.V; |
| | | import dev.langchain4j.service.spring.AiService; |
| | | import dev.langchain4j.service.spring.AiServiceWiringMode; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 19:35 |
| | | */ |
| | | @AiService( |
| | | wiringMode = AiServiceWiringMode.EXPLICIT, |
| | | chatModel = "qwenChatModel", |
| | | chatMemoryProvider = "chatMemoryProvider" |
| | | ) |
| | | public interface SeparateChatAssistant { |
| | | |
| | | @SystemMessage(fromResource = "my-prompt-template.txt")//ç³»ç»æ¶æ¯æç¤ºè¯ |
| | | String chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | |
| | | @UserMessage("ä½ æ¯æç好æåï¼è¯·ç¨ç²¤è¯åçé®é¢ã{{message}}") |
| | | String chat2(@MemoryId String memoryId, @V("message") String userMessage); |
| | | |
| | | @SystemMessage(fromResource = "my-prompt-template3.txt") |
| | | String chat3( |
| | | @MemoryId String memoryId, |
| | | @UserMessage String userMessage, |
| | | @V("username") String username, |
| | | @V("age") int age |
| | | ); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.bean; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 20:03 |
| | | */ |
| | | @Data |
| | | public class ChatForm { |
| | | |
| | | private String memoryId;//对è¯id |
| | | private String message;//ç¨æ·é®é¢ |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.bean; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class PurchaseAiConfirmRequest { |
| | | |
| | | private String businessType; |
| | | |
| | | private Map<String, Object> payload; |
| | | |
| | | public String getBusinessType() { |
| | | return businessType; |
| | | } |
| | | |
| | | public void setBusinessType(String businessType) { |
| | | this.businessType = businessType; |
| | | } |
| | | |
| | | public Map<String, Object> getPayload() { |
| | | return payload; |
| | | } |
| | | |
| | | public void setPayload(Map<String, Object> payload) { |
| | | this.payload = payload; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import dev.langchain4j.memory.chat.ChatMemoryProvider; |
| | | import dev.langchain4j.memory.chat.MessageWindowChatMemory; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class ApproveTodoAgentConfig { |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProviderApproveTodo(MongoChatMemoryStore mongoChatMemoryStore) { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(30) |
| | | .chatMemoryStore(mongoChatMemoryStore) |
| | | .build(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import dev.langchain4j.data.segment.TextSegment; |
| | | import dev.langchain4j.model.embedding.EmbeddingModel; |
| | | import dev.langchain4j.store.embedding.EmbeddingStore; |
| | | import dev.langchain4j.store.embedding.pinecone.PineconeEmbeddingStore; |
| | | import dev.langchain4j.store.embedding.pinecone.PineconeServerlessIndexConfig; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 21:07 |
| | | */ |
| | | @Configuration |
| | | public class EmbeddingStoreConfig { |
| | | |
| | | @Autowired |
| | | private EmbeddingModel embeddingModel; |
| | | |
| | | @Bean |
| | | public EmbeddingStore<TextSegment> embeddingStore() { |
| | | //å建åéåå¨ |
| | | return PineconeEmbeddingStore.builder() |
| | | .apiKey("pcsk_4SJLnh_tNB3wSLJU8tc4E5P28PcXX8eCLdURqZpVhg1FMV8CRYxjneWdzqRdB5Ftqooi9") |
| | | .index("xiaozhi-index")//妿æå®çç´¢å¼ä¸åå¨ï¼å°å建ä¸ä¸ªæ°çç´¢å¼ |
| | | .nameSpace("xiaozhi-namespace") //妿æå®çå称空é´ä¸åå¨ï¼å°å建ä¸ä¸ªæ°çåç§° ç©ºé´ |
| | | .createIndex(PineconeServerlessIndexConfig.builder() |
| | | .cloud("AWS") //æå®ç´¢å¼é¨ç½²å¨ AWS äºæå¡ä¸ã |
| | | .region("us-east-1") //æå®ç´¢å¼æå¨ç AWS åºå为 us-east-1ã |
| | | .dimension(embeddingModel.dimension()) //æå®ç´¢å¼çåé维度ï¼è¯¥ç»´åº¦ä¸ embeddedModel çæçåé维度ç¸åã |
| | | .build()) |
| | | .build(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import dev.langchain4j.community.model.dashscope.QwenStreamingChatModel; |
| | | import dev.langchain4j.memory.chat.ChatMemoryProvider; |
| | | import dev.langchain4j.memory.chat.MessageWindowChatMemory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class PurchaseAgentConfig { |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProviderPurchase(MongoChatMemoryStore mongoChatMemoryStore) { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(30) |
| | | .chatMemoryStore(mongoChatMemoryStore) |
| | | .build(); |
| | | } |
| | | |
| | | @Bean("purchaseVisionStreamingChatModel") |
| | | QwenStreamingChatModel purchaseVisionStreamingChatModel( |
| | | @Value("${langchain4j.community.dashscope.streaming-chat-model.api-key}") String apiKey) { |
| | | return QwenStreamingChatModel.builder() |
| | | .apiKey(apiKey) |
| | | .modelName("qwen-vl-max") |
| | | .isMultimodalModel(true) |
| | | .build(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import dev.langchain4j.memory.chat.ChatMemoryProvider; |
| | | import dev.langchain4j.memory.chat.MessageWindowChatMemory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 19:20 |
| | | */ |
| | | @Configuration |
| | | public class SeparateChatAssistantConfig { |
| | | //注å
¥æä¹
å对象 |
| | | @Autowired |
| | | private MongoChatMemoryStore mongoChatMemoryStore; |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProvider() { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(10) |
| | | .chatMemoryStore(mongoChatMemoryStore)//é
ç½®æä¹
å对象 |
| | | .build(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import dev.langchain4j.memory.chat.ChatMemoryProvider; |
| | | import dev.langchain4j.memory.chat.MessageWindowChatMemory; |
| | | import dev.langchain4j.model.embedding.EmbeddingModel; |
| | | import dev.langchain4j.rag.content.retriever.ContentRetriever; |
| | | import dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever; |
| | | import dev.langchain4j.store.embedding.EmbeddingStore; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/5/2 20:01 |
| | | */ |
| | | @Configuration |
| | | public class XiaozhiAgentConfig { |
| | | |
| | | @Autowired |
| | | private MongoChatMemoryStore mongoChatMemoryStore; |
| | | |
| | | @Autowired |
| | | private EmbeddingStore embeddingStore; |
| | | @Autowired |
| | | private EmbeddingModel embeddingModel; |
| | | |
| | | // @Value("${knowledge.one}") |
| | | // private String one; |
| | | // |
| | | // @Value("${knowledge.two}") |
| | | // private String two; |
| | | // |
| | | // @Value("${knowledge.three}") |
| | | // private String three; |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProviderXiaozhi() { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(20) |
| | | .chatMemoryStore(mongoChatMemoryStore) |
| | | .build(); |
| | | } |
| | | |
| | | // @Bean |
| | | // ContentRetriever contentRetrieverXiaozhi() { |
| | | // //使ç¨FileSystemDocumentLoader读åæå®ç®å½ä¸çç¥è¯åºææ¡£ |
| | | // //并使ç¨é»è®¤çææ¡£è§£æå¨å¯¹ææ¡£è¿è¡è§£æ |
| | | // Document document1 = FileSystemDocumentLoader.loadDocument(one); |
| | | //// Document document2 = FileSystemDocumentLoader.loadDocument(two); |
| | | //// Document document3 = FileSystemDocumentLoader.loadDocument(three); |
| | | //// List<Document> documents = Arrays.asList(document1, document2, document3); |
| | | // |
| | | // List<Document> documents = Collections.singletonList(document1); |
| | | //// 2. å°æ°æ®åºæ°æ®è½¬ä¸ºLangChain4jçDocument对象 |
| | | //// List<Document> documents = new ArrayList<>(); |
| | | // |
| | | // //使ç¨å
ååéåå¨ |
| | | // InMemoryEmbeddingStore<TextSegment> inMemoryEmbeddingStore = new InMemoryEmbeddingStore<>(); |
| | | // //使ç¨é»è®¤çææ¡£åå²å¨ |
| | | // EmbeddingStoreIngestor.builder() |
| | | // .embeddingModel(embeddingModel) |
| | | // .embeddingStore(inMemoryEmbeddingStore) |
| | | // .build() |
| | | // .ingest(documents); |
| | | // //ä»åµå
¥åå¨ï¼EmbeddingStoreï¼éæ£ç´¢åæ¥è¯¢å
容ç¸å
³çä¿¡æ¯ |
| | | // return EmbeddingStoreContentRetriever.builder() |
| | | // .embeddingModel(embeddingModel) |
| | | // .embeddingStore(inMemoryEmbeddingStore) |
| | | // .build(); |
| | | // } |
| | | |
| | | @Bean |
| | | ContentRetriever contentRetrieverXiaozhiPincone() { |
| | | // å建ä¸ä¸ª EmbeddingStoreContentRetriever 对象ï¼ç¨äºä»åµå
¥åå¨ä¸æ£ç´¢å
容 |
| | | return EmbeddingStoreContentRetriever |
| | | .builder() |
| | | // 设置ç¨äºçæåµå
¥åéçåµå
¥æ¨¡å |
| | | .embeddingModel(embeddingModel) |
| | | // æå®è¦ä½¿ç¨çåµå
¥åå¨ |
| | | .embeddingStore(embeddingStore) |
| | | // 设置æå¤§æ£ç´¢ç»ææ°éï¼è¿é表示æå¤è¿å 1 æ¡å¹é
ç»æ |
| | | .maxResults(1) |
| | | // 设置æå°å¾åéå¼ï¼åªæå¾å大äºçäº 0.8 çç»ææä¼è¢«è¿å |
| | | .minScore(0.8) |
| | | // æå»ºæç»ç EmbeddingStoreContentRetriever å®ä¾ |
| | | .build(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.context; |
| | | |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @Component |
| | | public class AiSessionUserContext { |
| | | |
| | | private final Map<String, LoginUser> loginUserByMemoryId = new ConcurrentHashMap<>(); |
| | | |
| | | public void bind(String memoryId, LoginUser loginUser) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null) { |
| | | return; |
| | | } |
| | | loginUserByMemoryId.put(memoryId, loginUser); |
| | | } |
| | | |
| | | public LoginUser get(String memoryId) { |
| | | if (!StringUtils.hasText(memoryId)) { |
| | | return null; |
| | | } |
| | | return loginUserByMemoryId.get(memoryId); |
| | | } |
| | | |
| | | public void remove(String memoryId) { |
| | | if (!StringUtils.hasText(memoryId)) { |
| | | return; |
| | | } |
| | | loginUserByMemoryId.remove(memoryId); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.ai.assistant.PurchaseAgent; |
| | | import com.ruoyi.ai.assistant.PurchaseIntentExecutor; |
| | | import com.ruoyi.ai.bean.ChatForm; |
| | | import com.ruoyi.ai.bean.PurchaseAiConfirmRequest; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.ai.service.AiChatSessionService; |
| | | import com.ruoyi.ai.service.AiFileTextExtractor; |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import com.ruoyi.basic.mapper.SupplierManageMapper; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.service.IPaymentRegistrationService; |
| | | import com.ruoyi.purchase.service.IPurchaseLedgerService; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import dev.langchain4j.data.image.Image; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.Content; |
| | | import dev.langchain4j.data.message.ImageContent; |
| | | import dev.langchain4j.data.message.SystemMessage; |
| | | import dev.langchain4j.data.message.TextContent; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import dev.langchain4j.model.chat.StreamingChatLanguageModel; |
| | | import dev.langchain4j.model.chat.response.ChatResponse; |
| | | import dev.langchain4j.model.chat.response.StreamingChatResponseHandler; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Base64; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | | |
| | | @Tag(name = "éè´æºè½ä½") |
| | | @RestController |
| | | @RequestMapping("/purchase-ai") |
| | | public class PurchaseAiController extends BaseController { |
| | | |
| | | private static final String PURCHASE_FILE_ANALYZE_MEMORY_PREFIX = "purchase-file-analyze::"; |
| | | private static final int MAX_FILE_COUNT = 10; |
| | | private static final int MAX_SINGLE_FILE_TEXT_LENGTH = 8000; |
| | | private static final int MAX_TOTAL_FILE_TEXT_LENGTH = 30000; |
| | | |
| | | private final PurchaseAgent purchaseAgent; |
| | | private final PurchaseIntentExecutor purchaseIntentExecutor; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | private final MongoChatMemoryStore mongoChatMemoryStore; |
| | | private final AiChatSessionService aiChatSessionService; |
| | | private final AiFileTextExtractor aiFileTextExtractor; |
| | | private final ObjectMapper objectMapper; |
| | | private final IPurchaseLedgerService purchaseLedgerService; |
| | | private final IPaymentRegistrationService paymentRegistrationService; |
| | | private final PurchaseReturnOrdersService purchaseReturnOrdersService; |
| | | private final SupplierManageMapper supplierManageMapper; |
| | | private final StreamingChatLanguageModel purchaseVisionStreamingChatModel; |
| | | |
| | | public PurchaseAiController(PurchaseAgent purchaseAgent, |
| | | PurchaseIntentExecutor purchaseIntentExecutor, |
| | | AiSessionUserContext aiSessionUserContext, |
| | | MongoChatMemoryStore mongoChatMemoryStore, |
| | | AiChatSessionService aiChatSessionService, |
| | | AiFileTextExtractor aiFileTextExtractor, |
| | | ObjectMapper objectMapper, |
| | | IPurchaseLedgerService purchaseLedgerService, |
| | | IPaymentRegistrationService paymentRegistrationService, |
| | | PurchaseReturnOrdersService purchaseReturnOrdersService, |
| | | SupplierManageMapper supplierManageMapper, |
| | | @Qualifier("purchaseVisionStreamingChatModel") StreamingChatLanguageModel purchaseVisionStreamingChatModel) { |
| | | this.purchaseAgent = purchaseAgent; |
| | | this.purchaseIntentExecutor = purchaseIntentExecutor; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | this.mongoChatMemoryStore = mongoChatMemoryStore; |
| | | this.aiChatSessionService = aiChatSessionService; |
| | | this.aiFileTextExtractor = aiFileTextExtractor; |
| | | this.objectMapper = objectMapper; |
| | | this.purchaseLedgerService = purchaseLedgerService; |
| | | this.paymentRegistrationService = paymentRegistrationService; |
| | | this.purchaseReturnOrdersService = purchaseReturnOrdersService; |
| | | this.supplierManageMapper = supplierManageMapper; |
| | | this.purchaseVisionStreamingChatModel = purchaseVisionStreamingChatModel; |
| | | } |
| | | |
| | | @Operation(summary = "éè´å¯¹è¯") |
| | | @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8") |
| | | public Flux<String> chat(@RequestBody ChatForm chatForm) { |
| | | if (!StringUtils.hasText(chatForm.getMemoryId())) { |
| | | return Flux.just("memoryIdä¸è½ä¸ºç©º"); |
| | | } |
| | | if (!StringUtils.hasText(chatForm.getMessage())) { |
| | | return Flux.just("messageä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String memoryId = chatForm.getMemoryId(); |
| | | String userMessage = chatForm.getMessage(); |
| | | |
| | | aiSessionUserContext.bind(memoryId, loginUser); |
| | | aiChatSessionService.touchSession(memoryId, loginUser, userMessage); |
| | | |
| | | String directResponse = purchaseIntentExecutor.tryExecute(memoryId, userMessage); |
| | | if (StringUtils.isNotEmpty(directResponse)) { |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(directResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | return purchaseAgent.chat(memoryId, userMessage) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "éè´å¤æä»¶åæ") |
| | | @PostMapping(value = "/analyze-files", consumes = "multipart/form-data", produces = "text/stream;charset=utf-8") |
| | | public Flux<String> analyzeFiles(@RequestParam("files") MultipartFile[] files, |
| | | @RequestParam(value = "message", required = false) String message, |
| | | @RequestParam(value = "memoryId", required = false) String memoryId) { |
| | | if (files == null || files.length == 0) { |
| | | return Flux.just("filesä¸è½ä¸ºç©º"); |
| | | } |
| | | if (files.length > MAX_FILE_COUNT) { |
| | | return Flux.just("䏿¬¡æå¤åæ" + MAX_FILE_COUNT + "个æä»¶"); |
| | | } |
| | | |
| | | String rawMemoryId = StringUtils.hasText(memoryId) ? memoryId : UUID.randomUUID().toString(); |
| | | String finalMemoryId = rawMemoryId.startsWith(PURCHASE_FILE_ANALYZE_MEMORY_PREFIX) |
| | | ? rawMemoryId |
| | | : PURCHASE_FILE_ANALYZE_MEMORY_PREFIX + rawMemoryId; |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | aiSessionUserContext.bind(finalMemoryId, loginUser); |
| | | |
| | | String finalMessage = StringUtils.hasText(message) |
| | | ? message |
| | | : "请åæè¿äºéè´æä»¶ï¼æåå¯ç¨äºä¸å¡å¤ççæ°æ®ï¼å¹¶æ´çæå¾
客æ·ç¡®è®¤çæ ¼å¼"; |
| | | |
| | | String fileContent; |
| | | try { |
| | | fileContent = buildMultiFileContent(files); |
| | | } catch (IllegalArgumentException ex) { |
| | | return Flux.just(ex.getMessage()); |
| | | } catch (IOException ex) { |
| | | return Flux.just("æä»¶è¯»å失败"); |
| | | } |
| | | |
| | | if (!StringUtils.hasText(fileContent)) { |
| | | return Flux.just("æªæåå°æææä»¶å
容"); |
| | | } |
| | | |
| | | String userPrompt = buildPurchaseFileAnalyzePrompt(finalMessage, fileContent); |
| | | aiChatSessionService.touchSession(finalMemoryId, loginUser, "éè´å¤æä»¶åæ: " + finalMessage); |
| | | |
| | | if (containsImageFile(files)) { |
| | | return chatWithPurchaseVisionModel(finalMemoryId, userPrompt, files) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | return Flux.defer(() -> purchaseAgent.chat(finalMemoryId, userPrompt)) |
| | | .onErrorResume(NoSuchElementException.class, ex -> { |
| | | mongoChatMemoryStore.deleteMessages(finalMemoryId); |
| | | return purchaseAgent.chat(finalMemoryId, userPrompt); |
| | | }) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "éè´å¤æä»¶åæç¡®è®¤å¤ç") |
| | | @PostMapping("/analyze-files/confirm") |
| | | public AjaxResult confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | if (request == null || !StringUtils.hasText(request.getBusinessType())) { |
| | | return AjaxResult.error("businessTypeä¸è½ä¸ºç©º"); |
| | | } |
| | | if (request.getPayload() == null || request.getPayload().isEmpty()) { |
| | | return AjaxResult.error("payloadä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | try { |
| | | String businessType = request.getBusinessType().trim(); |
| | | return switch (businessType) { |
| | | case "purchase_ledger" -> processPurchaseLedger(request.getPayload()); |
| | | case "payment_registration" -> processPaymentRegistration(request.getPayload()); |
| | | case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload()); |
| | | default -> AjaxResult.error("æä¸æ¯æè¯¥ä¸å¡ç±»å: " + businessType); |
| | | }; |
| | | } catch (Exception ex) { |
| | | return AjaxResult.error(toCustomerMessage(ex)); |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤éè´ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private String buildMultiFileContent(MultipartFile[] files) throws IOException { |
| | | StringBuilder builder = new StringBuilder(); |
| | | int totalLength = 0; |
| | | for (MultipartFile file : files) { |
| | | String text = aiFileTextExtractor.extractText(file); |
| | | if (!StringUtils.hasText(text)) { |
| | | continue; |
| | | } |
| | | String limitedText = text.length() > MAX_SINGLE_FILE_TEXT_LENGTH |
| | | ? text.substring(0, MAX_SINGLE_FILE_TEXT_LENGTH) |
| | | : text; |
| | | if (totalLength + limitedText.length() > MAX_TOTAL_FILE_TEXT_LENGTH) { |
| | | int remain = MAX_TOTAL_FILE_TEXT_LENGTH - totalLength; |
| | | if (remain <= 0) { |
| | | break; |
| | | } |
| | | limitedText = limitedText.substring(0, remain); |
| | | } |
| | | builder.append("\n--- æä»¶: ") |
| | | .append(file.getOriginalFilename()) |
| | | .append(" ---\n") |
| | | .append(limitedText) |
| | | .append('\n'); |
| | | totalLength += limitedText.length(); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | | |
| | | private boolean containsImageFile(MultipartFile[] files) { |
| | | for (MultipartFile file : files) { |
| | | if (aiFileTextExtractor.isImageFile(file)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private Flux<String> chatWithPurchaseVisionModel(String memoryId, String userPrompt, MultipartFile[] files) { |
| | | return Flux.create(sink -> { |
| | | try { |
| | | List<Content> contents = new ArrayList<>(); |
| | | contents.add(TextContent.from(userPrompt)); |
| | | for (MultipartFile file : files) { |
| | | if (!aiFileTextExtractor.isImageFile(file)) { |
| | | continue; |
| | | } |
| | | contents.add(TextContent.from("ä¸é¢è¿å¼ å¾çæä»¶åï¼" + file.getOriginalFilename())); |
| | | contents.add(ImageContent.from(Image.builder() |
| | | .base64Data(Base64.getEncoder().encodeToString(file.getBytes())) |
| | | .mimeType(resolveImageMimeType(file)) |
| | | .build())); |
| | | } |
| | | |
| | | List<ChatMessage> messages = List.of( |
| | | SystemMessage.from("ä½ æ¯éè´ä¸å¡æä»¶åæå©æãè¯·ä»ææ¬åå¾çä¸è¯å«éè´å°è´¦ãéè´äº§åæç»ã仿¬¾æéè´§ä¿¡æ¯ï¼åªè¾åºåæ³ JSONã"), |
| | | UserMessage.from(contents) |
| | | ); |
| | | purchaseVisionStreamingChatModel.chat(messages, new StreamingChatResponseHandler() { |
| | | @Override |
| | | public void onPartialResponse(String partialResponse) { |
| | | sink.next(partialResponse); |
| | | } |
| | | |
| | | @Override |
| | | public void onCompleteResponse(ChatResponse completeResponse) { |
| | | sink.complete(); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable error) { |
| | | sink.error(error); |
| | | } |
| | | }); |
| | | } catch (Exception ex) { |
| | | sink.next("å¾çæä»¶è¯»å失败ï¼è¯·ç¡®è®¤å¾çæ ¼å¼ä¸º pngãjpgãjpegãwebp æ bmpï¼ä¸å¤§å°ä¸è¶
è¿10MB"); |
| | | sink.complete(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private String resolveImageMimeType(MultipartFile file) { |
| | | String contentType = file.getContentType(); |
| | | if (StringUtils.hasText(contentType) && contentType.startsWith("image/")) { |
| | | return contentType; |
| | | } |
| | | String filename = file.getOriginalFilename(); |
| | | String ext = ""; |
| | | if (StringUtils.hasText(filename) && filename.contains(".")) { |
| | | ext = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase(); |
| | | } |
| | | return switch (ext) { |
| | | case "jpg", "jpeg" -> "image/jpeg"; |
| | | case "webp" -> "image/webp"; |
| | | case "bmp" -> "image/bmp"; |
| | | default -> "image/png"; |
| | | }; |
| | | } |
| | | |
| | | private String buildPurchaseFileAnalyzePrompt(String message, String fileContent) { |
| | | return """ |
| | | ä½ æ¯éè´ä¸å¡æä»¶åæå©æãè¯·ä¸¥æ ¼æ ¹æ®ç¨æ·ä¸ä¼ çå¤ä¸ªæä»¶åç¨æ·è¦æ±æåéè´ä¸å¡æ°æ®ã |
| | | |
| | | ç¨æ·è¦æ±: |
| | | %s |
| | | |
| | | è¾åºè¦æ±: |
| | | 1. åªè¾åºåæ³ JSONï¼ä¸è¦ Markdownï¼ä¸è¦é¢å¤è§£éã |
| | | 2. JSON é¡¶å±å段åºå®ä¸º: |
| | | - success: boolean |
| | | - businessType: purchase_ledger | payment_registration | purchase_return_order | unknown |
| | | - action: confirm_required |
| | | - description: ä¸æè¯´æ |
| | | - confidence: 0å°1çå°æ° |
| | | - missingFields: ç¼ºå¤±åæ®µä¸æåç§°æ°ç»ï¼é¢å客æ·å±ç¤ºï¼ä¸è¦è¾åºè±æå段å |
| | | - warnings: é£é©æç¤ºæ°ç» |
| | | - payload: å¾
客æ·ç¡®è®¤çæ°æ®ï¼å段åå¿
须使ç¨å端 DTO åæ®µå |
| | | - preview: ç»å®¢æ·ç¡®è®¤ç¨ç䏿æè¦æ°ç» |
| | | 3. 妿å¯å¤æä¸ºéè´å°è´¦ï¼businessType ä½¿ç¨ purchase_ledgerï¼payload.purchaseLedgers 为éè´è®¢å/éè´å°è´¦æ°ç»: |
| | | - purchaseLedgers: éè´è®¢å/éè´å°è´¦æ°ç»ï¼æ¯æ¡è®°å½å段åå¿
é¡»ä¸ PurchaseLedgerDto ä¿æä¸è´ |
| | | - 产åæç»å¿
é¡»æ¾å¨æ¯æ¡éè´å°è´¦è®°å½ç productData åæ®µä¸ï¼productData ç±»å为 List<SalesLedgerProduct> |
| | | - ä¸è¦ä¼å
ä½¿ç¨ payload é¡¶å± productDataï¼é¡¶å± productData ä»
ä½ä¸ºæ§æ ¼å¼å
¼å®¹ |
| | | - æä»¶éçâéè´åå·âå°±æ¯âéè´ååå·âï¼ç»ä¸æ å°ä¸º purchaseContractNumber |
| | | - æä»¶éçâéå®åå·âå°±æ¯âéå®ååå·âï¼ç»ä¸æ å°ä¸º salesContractNo |
| | | - æææ¥æå段å¿
é¡»ä½¿ç¨ yyyy-MM-ddï¼ä¾å¦ 2026-04-30ï¼ä¸è¦è¾åº 4/30/26ã2026/4/30ã2026å¹´4æ30æ¥ æå¸¦æ¶åç§çæ ¼å¼ |
| | | - éè´å°è´¦ä¸éè¦å¨ payload ä¸ä¼ 审æ¹äººï¼ä¸è¦è¾åº approveUserIdsãapproverId |
| | | - missingFields åªå¡«åä¸å¡å¿
填使 æ³è¯å«çåæ®µï¼ä¸è¦æ PurchaseLedgerDto çææç©ºåæ®µé½å为缺失ï¼ç¼ºå¤±é¡¹å¿
é¡»å䏿ï¼ä¾å¦âä¾åºååç§°ââå«ç¨åä»·âï¼ä¸è¦å supplierIdãtaxInclusiveUnitPrice |
| | | - éè´å°è´¦ä¸»è¡¨å¿
å¡«åæ®µä»
æè¿äºå¤æ: purchaseContractNumberãsupplierName æ supplierId |
| | | - productData æ¯æ¡äº§åå¿
å¡«åæ®µ: productCategoryãspecificationModelãunitãquantityãtaxInclusiveUnitPrice æ taxInclusiveTotalPriceï¼å¦æåªæå«ç¨æ»ä»·åæ°éï¼å¿
é¡»è®¡ç® taxInclusiveUnitPriceï¼å¦æåªæå«ç¨åä»·åæ°éï¼å¿
é¡»è®¡ç® taxInclusiveTotalPrice |
| | | - 产ååæ®µæéè´å¯¼å
¥æ¥å£ PurchaseLedgerProductImportDto 对é½: éè´åå·ã产å大类ãè§æ ¼åå·ãåä½ãæ°éãç¨çãå«ç¨åä»·ãå«ç¨æ»ä»·ãå票类åãæ¯å¦è´¨æ£ |
| | | - éè´äº§å type åºå®ä¸º 2 |
| | | - purchaseLedgers æ¯æ¡è®°å½åªä½¿ç¨è¿äº PurchaseLedgerDto åæ®µå: |
| | | entryDateStart, entryDateEnd, id, purchaseContractNumber, supplierId, supplierName, isWhite, recorderId, recorderName, salesContractNo, salesContractNoId, projectName, entryDate, executionDate, remarks, attachmentMaterials, createdAt, updatedAt, salesLedgerId, hasChildren, Type, productData, tempFileIds, SalesLedgerFiles, phoneNumber, businessPersonId, productId, productModelId, invoiceNumber, invoiceAmount, ticketRegistrationId, contractAmount, receiptPaymentAmount, unReceiptPaymentAmount, type, paymentMethod, approvalStatus, templateName |
| | | - productData æ¯æ¡äº§ååªä½¿ç¨è¿äº SalesLedgerProduct åæ®µå: |
| | | productCategory, specificationModel, unit, quantity, taxRate, taxInclusiveUnitPrice, taxInclusiveTotalPrice, taxExclusiveTotalPrice, invoiceType, productId, productModelId, isChecked, type |
| | | 4. 妿å¯å¤æä¸ºä»æ¬¾ç»è®°ï¼businessType ä½¿ç¨ payment_registrationï¼payload.records ä¸ºä»æ¬¾ç»è®°æ°ç»ï¼å段尽éå
å« purchaseLedgerIdãsalesLedgerProductIdãcurrentPaymentAmountãpaymentMethodãpaymentDateã |
| | | 5. 妿å¯å¤æä¸ºéè´éè´§ï¼businessType ä½¿ç¨ purchase_return_orderï¼payload æ PurchaseReturnOrderDto ç»ç»ï¼æç»æ¾ purchaseReturnOrderProductsDtosã |
| | | 6. 缺å°ä¸å¡å¤çå¿
须忮µæ¶ï¼ä¸è¦ç¼é IDï¼æåæ®µæ¾å
¥ missingFieldsï¼å¹¶ä»è¿åå¯ç¡®è®¤çèç¨¿æ°æ®ã |
| | | 7. ææä¸æå
å®¹ç´æ¥ä¿çï¼ä¸è¦è½¬ä¹æ Unicodeã |
| | | |
| | | æä»¶å
容: |
| | | %s |
| | | """.formatted(message, fileContent); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | if (payload.containsKey("purchaseLedgers")) { |
| | | return processPurchaseLedgerBatch(payload); |
| | | } |
| | | |
| | | Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, 0); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | | int result = purchaseLedgerService.addOrEditPurchase(dto); |
| | | return AjaxResult.success("éè´å°è´¦å·²å¤ç", result); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers")); |
| | | if (purchaseLedgers.isEmpty()) { |
| | | return AjaxResult.error("purchaseLedgersä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<Map<String, Object>> topLevelProductData = toMapList(payload.get("productData")); |
| | | List<Map<String, Object>> results = new ArrayList<>(); |
| | | for (int i = 0; i < purchaseLedgers.size(); i++) { |
| | | Map<String, Object> ledgerMap = normalizePurchaseLedgerMap(purchaseLedgers.get(i)); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(ledgerMap, PurchaseLedgerDto.class); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, i); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | | |
| | | List<SalesLedgerProduct> products = dto.getProductData(); |
| | | if (products == null || products.isEmpty()) { |
| | | products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1); |
| | | dto.setProductData(products); |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(products, i); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | | int result = purchaseLedgerService.addOrEditPurchase(dto); |
| | | |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("index", i); |
| | | item.put("purchaseContractNumber", dto.getPurchaseContractNumber()); |
| | | item.put("supplierId", dto.getSupplierId()); |
| | | item.put("supplierName", dto.getSupplierName()); |
| | | item.put("productCount", products.size()); |
| | | item.put("result", result); |
| | | results.add(item); |
| | | } |
| | | return AjaxResult.success("éè´å°è´¦å·²æ¹éå¤ç", results); |
| | | } |
| | | |
| | | private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap, |
| | | PurchaseLedgerDto dto, |
| | | List<Map<String, Object>> productData, |
| | | boolean onlyOneLedger) { |
| | | List<SalesLedgerProduct> products = new ArrayList<>(); |
| | | for (Map<String, Object> productMap : productData) { |
| | | if (onlyOneLedger || productBelongsToLedger(productMap, ledgerMap, dto)) { |
| | | products.add(objectMapper.convertValue(normalizeSalesLedgerProductMap(productMap), SalesLedgerProduct.class)); |
| | | } |
| | | } |
| | | return products; |
| | | } |
| | | |
| | | private boolean productBelongsToLedger(Map<String, Object> productMap, Map<String, Object> ledgerMap, PurchaseLedgerDto dto) { |
| | | Long productPurchaseLedgerId = longValue(productMap, "purchaseLedgerId", "purchaseId", "éè´è®¢åid", "éè´å°è´¦id"); |
| | | if (productPurchaseLedgerId != null && dto.getId() != null && productPurchaseLedgerId.equals(dto.getId())) { |
| | | return true; |
| | | } |
| | | |
| | | Long productSalesLedgerId = longValue(productMap, "salesLedgerId"); |
| | | if (productSalesLedgerId != null && dto.getId() != null && productSalesLedgerId.equals(dto.getId())) { |
| | | return true; |
| | | } |
| | | |
| | | String productContractNo = stringValue(productMap, "purchaseContractNumber", "purchaseContractNo", "éè´ååå·", "éè´åå·", "éè´è®¢åå·"); |
| | | if (StringUtils.hasText(productContractNo) |
| | | && StringUtils.hasText(dto.getPurchaseContractNumber()) |
| | | && productContractNo.trim().equals(dto.getPurchaseContractNumber().trim())) { |
| | | return true; |
| | | } |
| | | |
| | | String ledgerContractNo = stringValue(ledgerMap, "purchaseContractNumber", "purchaseContractNo", "éè´ååå·", "éè´åå·", "éè´è®¢åå·"); |
| | | if (StringUtils.hasText(productContractNo) |
| | | && StringUtils.hasText(ledgerContractNo) |
| | | && productContractNo.trim().equals(ledgerContractNo.trim())) { |
| | | return true; |
| | | } |
| | | |
| | | String productSalesContractNo = stringValue(productMap, "salesContractNo", "salesContractNumber", "éå®ååå·", "éå®åå·", "éå®è®¢åå·"); |
| | | if (StringUtils.hasText(productSalesContractNo) |
| | | && StringUtils.hasText(dto.getSalesContractNo()) |
| | | && productSalesContractNo.trim().equals(dto.getSalesContractNo().trim())) { |
| | | return true; |
| | | } |
| | | |
| | | String ledgerSalesContractNo = stringValue(ledgerMap, "salesContractNo", "salesContractNumber", "éå®ååå·", "éå®åå·", "éå®è®¢åå·"); |
| | | if (StringUtils.hasText(productSalesContractNo) |
| | | && StringUtils.hasText(ledgerSalesContractNo) |
| | | && productSalesContractNo.trim().equals(ledgerSalesContractNo.trim())) { |
| | | return true; |
| | | } |
| | | |
| | | String productSupplierName = stringValue(productMap, "supplierName", "ä¾åºååç§°"); |
| | | return StringUtils.hasText(productSupplierName) |
| | | && StringUtils.hasText(dto.getSupplierName()) |
| | | && productSupplierName.trim().equals(dto.getSupplierName().trim()); |
| | | } |
| | | |
| | | private Map<String, Object> normalizePurchaseLedgerMap(Map<String, Object> source) { |
| | | Map<String, Object> target = new LinkedHashMap<>(); |
| | | copyPurchaseLedgerDtoFields(source, target); |
| | | putDtoFieldIfPresent(source, target, "entryDateStart", "å½å
¥å¼å§æ¥æ", "å½å
¥æ¥æå¼å§"); |
| | | putDtoFieldIfPresent(source, target, "entryDateEnd", "å½å
¥ç»ææ¥æ", "å½å
¥æ¥æç»æ"); |
| | | putDtoFieldIfPresent(source, target, "id", "éè´å°è´¦id", "éè´è®¢åid", "主é®"); |
| | | putDtoFieldIfPresent(source, target, "purchaseContractNumber", "purchaseContractNo", "éè´ååå·", "éè´åå·", "éè´è®¢åå·"); |
| | | putDtoFieldIfPresent(source, target, "supplierId", "ä¾åºåid", "ä¾åºåID", "ä¾åºååç§°id", "ä¾åºååç§°ID"); |
| | | putDtoFieldIfPresent(source, target, "supplierName", "ä¾åºå", "ä¾åºååç§°"); |
| | | putDtoFieldIfPresent(source, target, "isWhite", "æ¯å¦ç½åå"); |
| | | putDtoFieldIfPresent(source, target, "recorderId", "å½å
¥äººid", "å½å
¥äººID", "å½å
¥äººå§åid", "å½å
¥äººå§åID"); |
| | | putDtoFieldIfPresent(source, target, "recorderName", "å½å
¥äºº", "å½å
¥äººå§å"); |
| | | putDtoFieldIfPresent(source, target, "salesContractNo", "salesContractNumber", "éå®ååå·", "éå®åå·", "éå®è®¢åå·"); |
| | | putDtoFieldIfPresent(source, target, "salesContractNoId", "éå®ååå·id", "éå®ååå·ID", "éå®åå·id", "éå®åå·ID"); |
| | | putDtoFieldIfPresent(source, target, "projectName", "项ç®", "项ç®åç§°"); |
| | | putDtoFieldIfPresent(source, target, "entryDate", "å½å
¥æ¥æ"); |
| | | putDtoFieldIfPresent(source, target, "executionDate", "ç¾è®¢æ¥æ", "ååç¾è®¢æ¥æ"); |
| | | putDtoFieldIfPresent(source, target, "remarks", "夿³¨", "说æ"); |
| | | putDtoFieldIfPresent(source, target, "attachmentMaterials", "éä»¶ææ", "éä»¶ææè·¯å¾æåç§°"); |
| | | putDtoFieldIfPresent(source, target, "createdAt", "å建æ¶é´", "è®°å½å建æ¶é´"); |
| | | putDtoFieldIfPresent(source, target, "updatedAt", "æ´æ°æ¶é´", "è®°å½æåæ´æ°æ¶é´"); |
| | | putDtoFieldIfPresent(source, target, "salesLedgerId", "éå®å°è´¦id", "éå®å°è´¦ID", "å
³èéå®å°è´¦ä¸»è¡¨ä¸»é®"); |
| | | putDtoFieldIfPresent(source, target, "hasChildren", "æ¯å¦æå级", "æ¯å¦ææç»"); |
| | | putDtoFieldIfPresent(source, target, "Type", "å°è´¦ç±»å", "ä¸å¡ç±»å"); |
| | | putDtoFieldIfPresent(source, target, "productData", "products", "产åæç»", "éè´äº§åæç»"); |
| | | putDtoFieldIfPresent(source, target, "tempFileIds", "ä¸´æ¶æä»¶id", "ä¸´æ¶æä»¶ID", "ä¸´æ¶æä»¶ids"); |
| | | putDtoFieldIfPresent(source, target, "SalesLedgerFiles", "éä»¶å表", "éå®å°è´¦éä»¶"); |
| | | putDtoFieldIfPresent(source, target, "phoneNumber", "ä¸å¡åææºå·", "ææºå·"); |
| | | putDtoFieldIfPresent(source, target, "businessPersonId", "ä¸å¡åid", "ä¸å¡åID"); |
| | | putDtoFieldIfPresent(source, target, "productId", "产åid", "产åID"); |
| | | putDtoFieldIfPresent(source, target, "productModelId", "产åè§æ ¼id", "产åè§æ ¼ID"); |
| | | putDtoFieldIfPresent(source, target, "invoiceNumber", "å票å·", "å票å·ç "); |
| | | putDtoFieldIfPresent(source, target, "invoiceAmount", "å票éé¢", "å票éé¢ï¼å
ï¼"); |
| | | putDtoFieldIfPresent(source, target, "ticketRegistrationId", "æ¥ç¥¨ç»è®°id", "æ¥ç¥¨ç»è®°ID"); |
| | | putDtoFieldIfPresent(source, target, "contractAmount", "ååéé¢", "ååéé¢ï¼äº§åå«ç¨æ»ä»·ï¼"); |
| | | putDtoFieldIfPresent(source, target, "receiptPaymentAmount", "æ¥ç¥¨éé¢", "å·²æ¥ç¥¨éé¢", "å·²æ¥ç¥¨éé¢(å
)"); |
| | | putDtoFieldIfPresent(source, target, "unReceiptPaymentAmount", "æªæ¥ç¥¨éé¢", "æªæ¥ç¥¨éé¢(å
)"); |
| | | putDtoFieldIfPresent(source, target, "type", "æä»¶ç±»å"); |
| | | putDtoFieldIfPresent(source, target, "paymentMethod", "仿¬¾æ¹å¼"); |
| | | putDtoFieldIfPresent(source, target, "approvalStatus", "审æ¹ç¶æ"); |
| | | putDtoFieldIfPresent(source, target, "templateName", "模æ¿åç§°"); |
| | | target.remove("approveUserIds"); |
| | | target.remove("approverId"); |
| | | normalizeNestedProductData(target); |
| | | attachImportStyleProductData(source, target); |
| | | if (target.get("type") == null) { |
| | | target.put("type", 2); |
| | | } |
| | | target.putIfAbsent("entryDate", LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); |
| | | normalizePurchaseLedgerDateFields(target); |
| | | return target; |
| | | } |
| | | |
| | | private void attachImportStyleProductData(Map<String, Object> source, Map<String, Object> target) { |
| | | if (target.get("productData") != null) { |
| | | return; |
| | | } |
| | | Map<String, Object> productMap = normalizeSalesLedgerProductMap(source); |
| | | if (hasImportStyleProductData(productMap)) { |
| | | target.put("productData", List.of(productMap)); |
| | | } |
| | | } |
| | | |
| | | private boolean hasImportStyleProductData(Map<String, Object> productMap) { |
| | | return hasMapText(productMap, "productCategory") |
| | | || hasMapText(productMap, "specificationModel") |
| | | || productMap.get("quantity") != null |
| | | || productMap.get("taxInclusiveUnitPrice") != null |
| | | || productMap.get("taxInclusiveTotalPrice") != null; |
| | | } |
| | | |
| | | private boolean hasMapText(Map<String, Object> map, String key) { |
| | | Object value = map.get(key); |
| | | return value != null && StringUtils.hasText(String.valueOf(value)); |
| | | } |
| | | |
| | | private void normalizeNestedProductData(Map<String, Object> target) { |
| | | Object productDataValue = target.get("productData"); |
| | | if (productDataValue == null) { |
| | | return; |
| | | } |
| | | List<Map<String, Object>> productMaps = toMapList(productDataValue); |
| | | List<Map<String, Object>> normalizedProducts = new ArrayList<>(); |
| | | for (Map<String, Object> productMap : productMaps) { |
| | | normalizedProducts.add(normalizeSalesLedgerProductMap(productMap)); |
| | | } |
| | | target.put("productData", normalizedProducts); |
| | | } |
| | | |
| | | private Map<String, Object> normalizeSalesLedgerProductMap(Map<String, Object> source) { |
| | | Map<String, Object> target = new LinkedHashMap<>(); |
| | | copySalesLedgerProductFields(source, target); |
| | | putDtoFieldIfPresent(source, target, "productCategory", "产å大类", "产ååç§°", "产å", "åå", "ç©æåç§°"); |
| | | putDtoFieldIfPresent(source, target, "specificationModel", "è§æ ¼åå·", "åå·", "è§æ ¼", "产åè§æ ¼"); |
| | | putDtoFieldIfPresent(source, target, "unit", "åä½"); |
| | | putDtoFieldIfPresent(source, target, "quantity", "æ°é", "éè´æ°é"); |
| | | putDtoFieldIfPresent(source, target, "taxRate", "ç¨ç"); |
| | | putDtoFieldIfPresent(source, target, "taxInclusiveUnitPrice", "å«ç¨åä»·", "åä»·", "éè´åä»·", "å«ç¨ä»·æ ¼"); |
| | | putDtoFieldIfPresent(source, target, "taxInclusiveTotalPrice", "å«ç¨æ»ä»·", "æ»ä»·", "éè´éé¢", "éé¢", "ååéé¢"); |
| | | putDtoFieldIfPresent(source, target, "taxExclusiveTotalPrice", "ä¸å«ç¨æ»ä»·"); |
| | | putDtoFieldIfPresent(source, target, "invoiceType", "å票类å", "å票类å«"); |
| | | putDtoFieldIfPresent(source, target, "productId", "产åid", "产åID"); |
| | | putDtoFieldIfPresent(source, target, "productModelId", "产åè§æ ¼id", "产åè§æ ¼ID", "åå·id", "åå·ID"); |
| | | putDtoFieldIfPresent(source, target, "isChecked", "æ¯å¦è´¨æ£", "æ¯å¦è´¨æ£éª", "è´¨æ£"); |
| | | putDtoFieldIfPresent(source, target, "type", "å°è´¦ç±»å"); |
| | | normalizeProductAmounts(target); |
| | | target.putIfAbsent("type", 2); |
| | | return target; |
| | | } |
| | | |
| | | private void copySalesLedgerProductFields(Map<String, Object> source, Map<String, Object> target) { |
| | | String[] productFields = { |
| | | "id", "salesLedgerId", "warnNum", "productCategory", "specificationModel", "unit", |
| | | "speculativeTradingName", "quantity", "minStock", "taxRate", "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", "taxExclusiveTotalPrice", "invoiceType", "type", "ticketsNum", |
| | | "ticketsAmount", "futureTickets", "futureTicketsAmount", "invoiceNum", "noInvoiceNum", |
| | | "invoiceAmount", "noInvoiceAmount", "productId", "productModelId", "register", "registerDate", |
| | | "approveStatus", "pendingInvoiceTotal", "invoiceTotal", "pendingTicketsTotal", "ticketsTotal", |
| | | "isChecked", "isProduction" |
| | | }; |
| | | for (String field : productFields) { |
| | | if (source.containsKey(field)) { |
| | | target.put(field, source.get(field)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void normalizeProductAmounts(Map<String, Object> target) { |
| | | BigDecimal quantity = decimalValue(target.get("quantity")); |
| | | BigDecimal unitPrice = decimalValue(target.get("taxInclusiveUnitPrice")); |
| | | BigDecimal totalPrice = decimalValue(target.get("taxInclusiveTotalPrice")); |
| | | if (unitPrice == null && totalPrice != null && quantity != null && quantity.compareTo(BigDecimal.ZERO) != 0) { |
| | | target.put("taxInclusiveUnitPrice", totalPrice.divide(quantity, 6, RoundingMode.HALF_UP)); |
| | | } |
| | | if (totalPrice == null && unitPrice != null && quantity != null) { |
| | | target.put("taxInclusiveTotalPrice", unitPrice.multiply(quantity)); |
| | | } |
| | | BigDecimal taxRate = decimalValue(target.get("taxRate")); |
| | | totalPrice = decimalValue(target.get("taxInclusiveTotalPrice")); |
| | | if (target.get("taxExclusiveTotalPrice") == null && totalPrice != null && taxRate != null) { |
| | | BigDecimal divisor = BigDecimal.ONE.add(taxRate.divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP)); |
| | | target.put("taxExclusiveTotalPrice", totalPrice.divide(divisor, 2, RoundingMode.HALF_UP)); |
| | | } |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | if (products == null || products.isEmpty()) { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < products.size(); i++) { |
| | | SalesLedgerProduct product = products.get(i); |
| | | String prefix = "第" + (ledgerIndex + 1) + "个éè´å°è´¦ç第" + (i + 1) + "æ¡äº§å"; |
| | | if (!StringUtils.hasText(product.getProductCategory())) { |
| | | return AjaxResult.error(prefix + "缺å°äº§ååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getSpecificationModel())) { |
| | | return AjaxResult.error(prefix + "缺å°è§æ ¼åå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getUnit())) { |
| | | return AjaxResult.error(prefix + "缺å°åä½ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getQuantity() == null) { |
| | | return AjaxResult.error(prefix + "ç¼ºå°æ°é"); |
| | | } |
| | | if (product.getTaxInclusiveUnitPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getTaxInclusiveTotalPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | String prefix = "第" + (ledgerIndex + 1) + "个éè´å°è´¦"; |
| | | if (!StringUtils.hasText(dto.getPurchaseContractNumber())) { |
| | | return AjaxResult.error(prefix + "缺å°éè´ååå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error(prefix + "缺å°ä¾åºååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void normalizePurchaseLedgerDateFields(Map<String, Object> target) { |
| | | normalizeDateField(target, "entryDate"); |
| | | normalizeDateField(target, "executionDate"); |
| | | normalizeDateField(target, "createdAt"); |
| | | normalizeDateField(target, "updatedAt"); |
| | | } |
| | | |
| | | private void normalizeDateField(Map<String, Object> target, String fieldName) { |
| | | Object value = target.get(fieldName); |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | String normalizedDate = normalizeDateValue(value); |
| | | if (StringUtils.hasText(normalizedDate)) { |
| | | target.put(fieldName, normalizedDate); |
| | | } |
| | | } |
| | | |
| | | private String normalizeDateValue(Object value) { |
| | | if (value instanceof Date date) { |
| | | return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | } |
| | | if (value instanceof Number number) { |
| | | return LocalDate.of(1899, 12, 30) |
| | | .plusDays(number.longValue()) |
| | | .format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | } |
| | | |
| | | String text = String.valueOf(value).trim(); |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | if (text.length() >= 10 && text.charAt(4) == '-' && text.charAt(7) == '-') { |
| | | return text.substring(0, 10); |
| | | } |
| | | |
| | | String normalizedText = text.replace("å¹´", "-") |
| | | .replace("æ", "-") |
| | | .replace("æ¥", "") |
| | | .replace(".", "-") |
| | | .replace("/", "-") |
| | | .trim(); |
| | | DateTimeFormatter[] formatters = { |
| | | DateTimeFormatter.ofPattern("yyyy-M-d"), |
| | | DateTimeFormatter.ofPattern("M-d-yyyy"), |
| | | DateTimeFormatter.ofPattern("M-d-yy") |
| | | }; |
| | | for (DateTimeFormatter formatter : formatters) { |
| | | try { |
| | | return LocalDate.parse(normalizedText, formatter).format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | } catch (DateTimeParseException ignored) { |
| | | // Try the next supported input pattern. |
| | | } |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | private void copyPurchaseLedgerDtoFields(Map<String, Object> source, Map<String, Object> target) { |
| | | String[] dtoFields = { |
| | | "entryDateStart", "entryDateEnd", "id", "purchaseContractNumber", |
| | | "supplierId", "supplierName", "isWhite", "recorderId", "recorderName", "salesContractNo", |
| | | "salesContractNoId", "projectName", "entryDate", "executionDate", "remarks", "attachmentMaterials", |
| | | "createdAt", "updatedAt", "salesLedgerId", "hasChildren", "Type", "productData", "tempFileIds", |
| | | "SalesLedgerFiles", "phoneNumber", "businessPersonId", "productId", "productModelId", "invoiceNumber", |
| | | "invoiceAmount", "ticketRegistrationId", "contractAmount", "receiptPaymentAmount", |
| | | "unReceiptPaymentAmount", "type", "paymentMethod", "approvalStatus", "templateName" |
| | | }; |
| | | for (String field : dtoFields) { |
| | | if (source.containsKey(field)) { |
| | | target.put(field, source.get(field)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void putDtoFieldIfPresent(Map<String, Object> source, Map<String, Object> target, String dtoField, String... aliases) { |
| | | if (target.containsKey(dtoField) && target.get(dtoField) != null) { |
| | | return; |
| | | } |
| | | for (String alias : aliases) { |
| | | Object value = source.get(alias); |
| | | if (value != null && StringUtils.hasText(String.valueOf(value))) { |
| | | target.put(dtoField, value); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<Map<String, Object>> toMapList(Object value) { |
| | | if (value == null) { |
| | | return List.of(); |
| | | } |
| | | return objectMapper.convertValue(value, new TypeReference<List<Map<String, Object>>>() { |
| | | }); |
| | | } |
| | | |
| | | private String stringValue(Map<String, Object> map, String... keys) { |
| | | for (String key : keys) { |
| | | Object value = map.get(key); |
| | | if (value != null && StringUtils.hasText(String.valueOf(value))) { |
| | | return String.valueOf(value); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Long longValue(Map<String, Object> map, String... keys) { |
| | | String value = stringValue(map, keys); |
| | | if (!StringUtils.hasText(value)) { |
| | | return null; |
| | | } |
| | | try { |
| | | return Long.parseLong(value.trim()); |
| | | } catch (NumberFormatException ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private BigDecimal decimalValue(Object value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | if (value instanceof BigDecimal decimal) { |
| | | return decimal; |
| | | } |
| | | if (value instanceof Number number) { |
| | | return new BigDecimal(String.valueOf(number)); |
| | | } |
| | | String text = String.valueOf(value) |
| | | .replace(",", "") |
| | | .replace("ï¼", "") |
| | | .replace("å
", "") |
| | | .replace("ï¿¥", "") |
| | | .trim(); |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | try { |
| | | return new BigDecimal(text); |
| | | } catch (NumberFormatException ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String toCustomerMessage(Exception ex) { |
| | | String message = ex.getMessage(); |
| | | if (!StringUtils.hasText(message)) { |
| | | return "å¤ç失败ï¼è¯·æ£æ¥ç¡®è®¤æ°æ®åéè¯"; |
| | | } |
| | | if (message.contains("tax_inclusive_unit_price")) { |
| | | return "å¤ç失败ï¼äº§åæç»ç¼ºå°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"; |
| | | } |
| | | if (message.contains("tax_inclusive_total_price")) { |
| | | return "å¤ç失败ï¼äº§åæç»ç¼ºå°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"; |
| | | } |
| | | if (message.contains("entryDate")) { |
| | | return "å¤ç失败ï¼å½å
¥æ¥ææ ¼å¼ä¸æ£ç¡®ï¼è¯·ä½¿ç¨ yyyy-MM-ddï¼ä¾å¦ 2026-04-30"; |
| | | } |
| | | if (message.contains("supplier")) { |
| | | return "å¤ç失败ï¼ä¾åºåä¿¡æ¯ä¸å®æ´ï¼è¯·ç¡®è®¤ä¾åºååç§°æä¾åºåID"; |
| | | } |
| | | if (message.contains("SQL") || message.contains("java.") || message.contains("Exception")) { |
| | | return "å¤ç失败ï¼ç¡®è®¤æ°æ®ä¸å®æ´ææ ¼å¼ä¸æ£ç¡®ï¼è¯·æ£æ¥å¿
å¡«åæ®µåéè¯"; |
| | | } |
| | | return "å¤ç失败ï¼" + message; |
| | | } |
| | | |
| | | private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | if (dto.getSupplierId() != null) { |
| | | return null; |
| | | } |
| | | if (!StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error("ä¾åºåIDä¸è½ä¸ºç©ºï¼æªè¯å«å°ä¾åºååç§°ï¼æ æ³èªå¨å¹é
ä¾åºåID"); |
| | | } |
| | | |
| | | SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>() |
| | | .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim()) |
| | | .last("limit 1")); |
| | | if (supplier == null) { |
| | | return AjaxResult.error("æªæ¾å°ä¾åºåï¼" + dto.getSupplierName() + "ï¼è¯·å
ç»´æ¤ä¾åºåææå¨éæ©ä¾åºåID"); |
| | | } |
| | | dto.setSupplierId(supplier.getId()); |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult processPaymentRegistration(Map<String, Object> payload) { |
| | | Object recordsValue = payload.get("records"); |
| | | List<PaymentRegistration> records; |
| | | if (recordsValue == null) { |
| | | records = Collections.singletonList(objectMapper.convertValue(payload, PaymentRegistration.class)); |
| | | } else { |
| | | records = objectMapper.convertValue(recordsValue, new TypeReference<List<PaymentRegistration>>() { |
| | | }); |
| | | } |
| | | int result = paymentRegistrationService.insertPaymentRegistration(records); |
| | | return AjaxResult.success("仿¬¾ç»è®°å·²å¤ç", result); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class); |
| | | Boolean result = purchaseReturnOrdersService.add(dto); |
| | | return AjaxResult.success("éè´éè´§åå·²å¤ç", result); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.controller; |
| | | |
| | | import com.ruoyi.ai.assistant.ApproveTodoAgent; |
| | | import com.ruoyi.ai.assistant.ApproveTodoIntentExecutor; |
| | | import com.ruoyi.ai.assistant.FileAnalyzeAgent; |
| | | import com.ruoyi.ai.bean.ChatForm; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.ai.service.AiChatSessionService; |
| | | import com.ruoyi.ai.service.AiFileTextExtractor; |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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.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 reactor.core.publisher.Flux; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | | |
| | | @Tag(name = "åååå
¬å©æ") |
| | | @RestController |
| | | @RequestMapping("/xiaozhi") |
| | | public class XiaozhiController extends BaseController { |
| | | |
| | | private static final String FILE_ANALYZE_MEMORY_PREFIX = "file-analyze::"; |
| | | |
| | | private final ApproveTodoAgent approveTodoAgent; |
| | | private final ApproveTodoIntentExecutor approveTodoIntentExecutor; |
| | | private final FileAnalyzeAgent fileAnalyzeAgent; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | private final MongoChatMemoryStore mongoChatMemoryStore; |
| | | private final AiFileTextExtractor aiFileTextExtractor; |
| | | private final AiChatSessionService aiChatSessionService; |
| | | |
| | | public XiaozhiController(ApproveTodoAgent approveTodoAgent, |
| | | ApproveTodoIntentExecutor approveTodoIntentExecutor, |
| | | FileAnalyzeAgent fileAnalyzeAgent, |
| | | AiSessionUserContext aiSessionUserContext, |
| | | MongoChatMemoryStore mongoChatMemoryStore, |
| | | AiFileTextExtractor aiFileTextExtractor, |
| | | AiChatSessionService aiChatSessionService) { |
| | | this.approveTodoAgent = approveTodoAgent; |
| | | this.approveTodoIntentExecutor = approveTodoIntentExecutor; |
| | | this.fileAnalyzeAgent = fileAnalyzeAgent; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | this.mongoChatMemoryStore = mongoChatMemoryStore; |
| | | this.aiFileTextExtractor = aiFileTextExtractor; |
| | | this.aiChatSessionService = aiChatSessionService; |
| | | } |
| | | |
| | | @Operation(summary = "对è¯") |
| | | @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8") |
| | | public Flux<String> chat(@RequestBody ChatForm chatForm) { |
| | | if (!StringUtils.hasText(chatForm.getMemoryId())) { |
| | | return Flux.just("memoryIdä¸è½ä¸ºç©º"); |
| | | } |
| | | if (!StringUtils.hasText(chatForm.getMessage())) { |
| | | return Flux.just("messageä¸è½ä¸ºç©º"); |
| | | } |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String memoryId = chatForm.getMemoryId(); |
| | | String userMessage = chatForm.getMessage(); |
| | | |
| | | aiSessionUserContext.bind(memoryId, loginUser); |
| | | aiChatSessionService.touchSession(memoryId, loginUser, userMessage); |
| | | |
| | | String directResponse = approveTodoIntentExecutor.tryExecute(memoryId, userMessage); |
| | | if (StringUtils.isNotEmpty(directResponse)) { |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(directResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | return approveTodoAgent.chat(memoryId, userMessage) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "ä¸ä¼ æä»¶åæ") |
| | | @PostMapping(value = "/analyze-file", consumes = "multipart/form-data", produces = "text/stream;charset=utf-8") |
| | | public Flux<String> analyzeFile(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "message", required = false) String message, |
| | | @RequestParam(value = "memoryId", required = false) String memoryId) { |
| | | String rawMemoryId = StringUtils.hasText(memoryId) ? memoryId : UUID.randomUUID().toString(); |
| | | String finalMemoryId = rawMemoryId.startsWith(FILE_ANALYZE_MEMORY_PREFIX) |
| | | ? rawMemoryId |
| | | : FILE_ANALYZE_MEMORY_PREFIX + rawMemoryId; |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | aiSessionUserContext.bind(finalMemoryId, loginUser); |
| | | |
| | | String finalMessage = StringUtils.hasText(message) ? message : "请åæè¿ä¸ªæä»¶çæ ¸å¿å
容并ç»åºæ»ç»"; |
| | | String fileText; |
| | | try { |
| | | fileText = aiFileTextExtractor.extractText(file); |
| | | } catch (IllegalArgumentException ex) { |
| | | return Flux.just(ex.getMessage()); |
| | | } catch (IOException ex) { |
| | | return Flux.just("æä»¶è¯»å失败"); |
| | | } |
| | | |
| | | if (!StringUtils.hasText(fileText)) { |
| | | return Flux.just("æªæåå°æææä»¶å
容"); |
| | | } |
| | | |
| | | String limitedContent = fileText.length() > 12000 ? fileText.substring(0, 12000) : fileText; |
| | | String userPrompt = "ä½ å°åæç¨æ·ä¸ä¼ çæä»¶å
容ã\n" |
| | | + "æä»¶å: " + file.getOriginalFilename() + "\n" |
| | | + "ç¨æ·é®é¢: " + finalMessage + "\n" |
| | | + "æä»¶å
容å¦ä¸:\n" |
| | | + limitedContent; |
| | | |
| | | aiChatSessionService.touchSession(finalMemoryId, loginUser, "æä»¶åæ: " + finalMessage); |
| | | |
| | | return Flux.defer(() -> fileAnalyzeAgent.chat(finalMemoryId, userPrompt)) |
| | | .onErrorResume(NoSuchElementException.class, ex -> { |
| | | // DashScope å¨å岿¶æ¯å
¼å®¹åºæ¯ä¸å¯è½æ NoSuchElementExceptionï¼æ¸
空åéè¯ä¸æ¬¡ |
| | | mongoChatMemoryStore.deleteMessages(finalMemoryId); |
| | | return fileAnalyzeAgent.chat(finalMemoryId, userPrompt); |
| | | }) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class AiChatMessageDto { |
| | | |
| | | private String role; |
| | | |
| | | private String content; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class AiChatSessionDto { |
| | | |
| | | private String memoryId; |
| | | |
| | | private String title; |
| | | |
| | | private String lastMessage; |
| | | |
| | | private Integer messageCount; |
| | | |
| | | private Date lastChatTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.ai.pojo.AiChatSession; |
| | | |
| | | public interface AiChatSessionMapper extends BaseMapper<AiChatSession> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.mongodbBean; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.bson.types.ObjectId; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Document("chat_messages") |
| | | public class ChatMessages { |
| | | |
| | | @Id |
| | | private ObjectId id; |
| | | |
| | | @Indexed(unique = true) |
| | | private String memoryId; |
| | | |
| | | private String content; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("ai_chat_session") |
| | | public class AiChatSession { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private String memoryId; |
| | | |
| | | private Long userId; |
| | | |
| | | private Long tenantId; |
| | | |
| | | private String title; |
| | | |
| | | private String lastMessage; |
| | | |
| | | private Integer messageCount; |
| | | |
| | | private Date lastChatTime; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.ai.dto.AiChatMessageDto; |
| | | import com.ruoyi.ai.dto.AiChatSessionDto; |
| | | import com.ruoyi.ai.pojo.AiChatSession; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AiChatSessionService extends IService<AiChatSession> { |
| | | |
| | | void touchSession(String memoryId, LoginUser loginUser, String userMessage); |
| | | |
| | | void refreshSessionStats(String memoryId, LoginUser loginUser); |
| | | |
| | | List<AiChatSessionDto> listCurrentUserSessions(LoginUser loginUser); |
| | | |
| | | List<AiChatMessageDto> listCurrentUserMessages(String memoryId, LoginUser loginUser); |
| | | |
| | | boolean deleteCurrentUserSession(String memoryId, LoginUser loginUser); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.service; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.DataFormatter; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.apache.poi.xwpf.extractor.XWPFWordExtractor; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | @Component |
| | | public class AiFileTextExtractor { |
| | | |
| | | private static final long MAX_FILE_SIZE = 10L * 1024 * 1024; |
| | | |
| | | public String extractText(MultipartFile file) throws IOException { |
| | | if (file == null || file.isEmpty()) { |
| | | throw new IllegalArgumentException("æä»¶ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (file.getSize() > MAX_FILE_SIZE) { |
| | | throw new IllegalArgumentException("æä»¶è¿å¤§ï¼è¯·æ§å¶å¨10MB以å
"); |
| | | } |
| | | |
| | | String filename = file.getOriginalFilename(); |
| | | String ext = getExtension(filename); |
| | | byte[] bytes = file.getBytes(); |
| | | |
| | | if (isPlainText(ext)) { |
| | | return decodeText(bytes); |
| | | } |
| | | if ("docx".equals(ext)) { |
| | | return extractDocx(bytes); |
| | | } |
| | | if ("xlsx".equals(ext)) { |
| | | return extractXlsx(bytes); |
| | | } |
| | | if ("xls".equals(ext)) { |
| | | return extractXls(bytes); |
| | | } |
| | | if (isImage(ext)) { |
| | | return "å¾çæä»¶ï¼" + filename + "ï¼å·²ä¸ä¼ ï¼è¯·ç»åå¾çå
容è¯å«éè´åæ®ãè¡¨æ ¼å产åæç»ã"; |
| | | } |
| | | throw new IllegalArgumentException("æä¸æ¯æè¯¥æä»¶ç±»å: " + ext); |
| | | } |
| | | |
| | | public boolean isImageFile(MultipartFile file) { |
| | | if (file == null) { |
| | | return false; |
| | | } |
| | | return isImage(getExtension(file.getOriginalFilename())); |
| | | } |
| | | |
| | | private String extractDocx(byte[] bytes) throws IOException { |
| | | try (ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); |
| | | XWPFDocument document = new XWPFDocument(inputStream); |
| | | XWPFWordExtractor extractor = new XWPFWordExtractor(document)) { |
| | | return extractor.getText(); |
| | | } |
| | | } |
| | | |
| | | private String extractXlsx(byte[] bytes) throws IOException { |
| | | try (ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); |
| | | XSSFWorkbook workbook = new XSSFWorkbook(inputStream)) { |
| | | return extractWorkbook(workbook); |
| | | } |
| | | } |
| | | |
| | | private String extractXls(byte[] bytes) throws IOException { |
| | | try (ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); |
| | | HSSFWorkbook workbook = new HSSFWorkbook(inputStream)) { |
| | | return extractWorkbook(workbook); |
| | | } |
| | | } |
| | | |
| | | private String extractWorkbook(org.apache.poi.ss.usermodel.Workbook workbook) { |
| | | StringBuilder text = new StringBuilder(); |
| | | DataFormatter formatter = new DataFormatter(); |
| | | for (int i = 0; i < workbook.getNumberOfSheets(); i++) { |
| | | Sheet sheet = workbook.getSheetAt(i); |
| | | text.append("Sheet: ").append(sheet.getSheetName()).append("\n"); |
| | | for (Row row : sheet) { |
| | | short lastCellNum = row.getLastCellNum(); |
| | | if (lastCellNum <= 0) { |
| | | text.append("\n"); |
| | | continue; |
| | | } |
| | | for (int c = 0; c < lastCellNum; c++) { |
| | | String cellText = formatter.formatCellValue(row.getCell(c)); |
| | | text.append(cellText); |
| | | if (c < lastCellNum - 1) { |
| | | text.append('\t'); |
| | | } |
| | | } |
| | | text.append('\n'); |
| | | } |
| | | } |
| | | return text.toString(); |
| | | } |
| | | |
| | | private String decodeText(byte[] bytes) { |
| | | String utf8 = new String(bytes, StandardCharsets.UTF_8); |
| | | if (utf8.contains("�")) { |
| | | return new String(bytes, java.nio.charset.Charset.forName("GBK")); |
| | | } |
| | | return utf8; |
| | | } |
| | | |
| | | private String getExtension(String filename) { |
| | | if (!StringUtils.hasText(filename) || !filename.contains(".")) { |
| | | return ""; |
| | | } |
| | | return filename.substring(filename.lastIndexOf('.') + 1).toLowerCase(); |
| | | } |
| | | |
| | | private boolean isPlainText(String ext) { |
| | | return StringUtils.inStringIgnoreCase(ext, |
| | | "txt", "md", "markdown", "json", "xml", "yaml", "yml", "csv", "log", "properties", |
| | | "java", "js", "ts", "vue", "html", "css", "sql", "py", "go", "sh", "bat"); |
| | | } |
| | | |
| | | private boolean isImage(String ext) { |
| | | return StringUtils.inStringIgnoreCase(ext, "png", "jpg", "jpeg", "webp", "bmp"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.ai.dto.AiChatMessageDto; |
| | | import com.ruoyi.ai.dto.AiChatSessionDto; |
| | | import com.ruoyi.ai.mapper.AiChatSessionMapper; |
| | | import com.ruoyi.ai.pojo.AiChatSession; |
| | | import com.ruoyi.ai.service.AiChatSessionService; |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.SystemMessage; |
| | | import dev.langchain4j.data.message.ToolExecutionResultMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AiChatSessionServiceImpl extends ServiceImpl<AiChatSessionMapper, AiChatSession> implements AiChatSessionService { |
| | | |
| | | private static final int TITLE_MAX_LENGTH = 40; |
| | | private static final int LAST_MESSAGE_MAX_LENGTH = 300; |
| | | |
| | | private final MongoChatMemoryStore mongoChatMemoryStore; |
| | | |
| | | @Override |
| | | public void touchSession(String memoryId, LoginUser loginUser, String userMessage) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null || loginUser.getUserId() == null) { |
| | | return; |
| | | } |
| | | Date now = new Date(); |
| | | AiChatSession session = getSession(memoryId, loginUser.getUserId(), loginUser.getTenantId()); |
| | | if (session == null) { |
| | | AiChatSession add = new AiChatSession(); |
| | | add.setMemoryId(memoryId); |
| | | add.setUserId(loginUser.getUserId()); |
| | | add.setTenantId(loginUser.getTenantId()); |
| | | add.setTitle(buildTitle(userMessage)); |
| | | add.setLastMessage(trimText(userMessage, LAST_MESSAGE_MAX_LENGTH)); |
| | | add.setMessageCount(0); |
| | | add.setLastChatTime(now); |
| | | add.setCreateTime(now); |
| | | add.setUpdateTime(now); |
| | | save(add); |
| | | return; |
| | | } |
| | | |
| | | AiChatSession update = new AiChatSession(); |
| | | update.setId(session.getId()); |
| | | if (!StringUtils.hasText(session.getTitle())) { |
| | | update.setTitle(buildTitle(userMessage)); |
| | | } |
| | | update.setLastMessage(trimText(userMessage, LAST_MESSAGE_MAX_LENGTH)); |
| | | update.setLastChatTime(now); |
| | | update.setUpdateTime(now); |
| | | updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public void refreshSessionStats(String memoryId, LoginUser loginUser) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null || loginUser.getUserId() == null) { |
| | | return; |
| | | } |
| | | AiChatSession session = getSession(memoryId, loginUser.getUserId(), loginUser.getTenantId()); |
| | | if (session == null) { |
| | | return; |
| | | } |
| | | List<ChatMessage> messages = mongoChatMemoryStore.getMessages(memoryId); |
| | | AiChatSession update = new AiChatSession(); |
| | | update.setId(session.getId()); |
| | | update.setMessageCount(messages.size()); |
| | | update.setLastMessage(trimText(lastMessageText(messages), LAST_MESSAGE_MAX_LENGTH)); |
| | | update.setLastChatTime(new Date()); |
| | | update.setUpdateTime(new Date()); |
| | | updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiChatSessionDto> listCurrentUserSessions(LoginUser loginUser) { |
| | | if (loginUser == null || loginUser.getUserId() == null) { |
| | | return new LinkedList<>(); |
| | | } |
| | | LambdaQueryWrapper<AiChatSession> queryWrapper = new LambdaQueryWrapper<AiChatSession>() |
| | | .eq(AiChatSession::getUserId, loginUser.getUserId()) |
| | | .orderByDesc(AiChatSession::getLastChatTime); |
| | | applyTenantCondition(queryWrapper, loginUser.getTenantId()); |
| | | return list(queryWrapper).stream().map(item -> { |
| | | AiChatSessionDto dto = new AiChatSessionDto(); |
| | | dto.setMemoryId(item.getMemoryId()); |
| | | dto.setTitle(item.getTitle()); |
| | | dto.setLastMessage(item.getLastMessage()); |
| | | dto.setMessageCount(item.getMessageCount()); |
| | | dto.setLastChatTime(item.getLastChatTime()); |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiChatMessageDto> listCurrentUserMessages(String memoryId, LoginUser loginUser) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null || loginUser.getUserId() == null) { |
| | | return new LinkedList<>(); |
| | | } |
| | | AiChatSession session = getSession(memoryId, loginUser.getUserId(), loginUser.getTenantId()); |
| | | if (session == null) { |
| | | return new LinkedList<>(); |
| | | } |
| | | List<ChatMessage> messages = mongoChatMemoryStore.getMessages(memoryId); |
| | | return messages.stream().map(this::convertMessage).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteCurrentUserSession(String memoryId, LoginUser loginUser) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null || loginUser.getUserId() == null) { |
| | | return false; |
| | | } |
| | | LambdaQueryWrapper<AiChatSession> queryWrapper = new LambdaQueryWrapper<AiChatSession>() |
| | | .eq(AiChatSession::getMemoryId, memoryId) |
| | | .eq(AiChatSession::getUserId, loginUser.getUserId()); |
| | | applyTenantCondition(queryWrapper, loginUser.getTenantId()); |
| | | boolean removed = remove(queryWrapper); |
| | | mongoChatMemoryStore.deleteMessages(memoryId); |
| | | return removed; |
| | | } |
| | | |
| | | private AiChatSession getSession(String memoryId, Long userId, Long tenantId) { |
| | | LambdaQueryWrapper<AiChatSession> queryWrapper = new LambdaQueryWrapper<AiChatSession>() |
| | | .eq(AiChatSession::getMemoryId, memoryId) |
| | | .eq(AiChatSession::getUserId, userId); |
| | | applyTenantCondition(queryWrapper, tenantId); |
| | | return getOne(queryWrapper, false); |
| | | } |
| | | |
| | | private void applyTenantCondition(LambdaQueryWrapper<AiChatSession> queryWrapper, Long tenantId) { |
| | | if (tenantId == null) { |
| | | queryWrapper.isNull(AiChatSession::getTenantId); |
| | | return; |
| | | } |
| | | queryWrapper.eq(AiChatSession::getTenantId, tenantId); |
| | | } |
| | | |
| | | private String buildTitle(String userMessage) { |
| | | if (!StringUtils.hasText(userMessage)) { |
| | | return "æ°ä¼è¯"; |
| | | } |
| | | return trimText(userMessage, TITLE_MAX_LENGTH); |
| | | } |
| | | |
| | | private String trimText(String text, int maxLength) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return ""; |
| | | } |
| | | String source = text.trim(); |
| | | if (source.length() <= maxLength) { |
| | | return source; |
| | | } |
| | | return source.substring(0, maxLength) + "..."; |
| | | } |
| | | |
| | | private String lastMessageText(List<ChatMessage> messages) { |
| | | if (messages == null || messages.isEmpty()) { |
| | | return ""; |
| | | } |
| | | ChatMessage lastMessage = messages.get(messages.size() - 1); |
| | | return convertMessage(lastMessage).getContent(); |
| | | } |
| | | |
| | | private AiChatMessageDto convertMessage(ChatMessage message) { |
| | | if (message instanceof UserMessage userMessage) { |
| | | return new AiChatMessageDto("user", userMessage.singleText()); |
| | | } |
| | | if (message instanceof AiMessage aiMessage) { |
| | | return new AiChatMessageDto("assistant", aiMessage.text()); |
| | | } |
| | | if (message instanceof SystemMessage systemMessage) { |
| | | return new AiChatMessageDto("system", systemMessage.text()); |
| | | } |
| | | if (message instanceof ToolExecutionResultMessage toolExecutionResultMessage) { |
| | | return new AiChatMessageDto("tool", toolExecutionResultMessage.text()); |
| | | } |
| | | return new AiChatMessageDto("unknown", String.valueOf(message)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.store; |
| | | |
| | | import com.ruoyi.ai.mongodbBean.ChatMessages; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.ChatMessageDeserializer; |
| | | import dev.langchain4j.data.message.ChatMessageSerializer; |
| | | import dev.langchain4j.store.memory.chat.ChatMemoryStore; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class MongoChatMemoryStore implements ChatMemoryStore { |
| | | |
| | | private final MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public List<ChatMessage> getMessages(Object memoryId) { |
| | | Query query = Query.query(Criteria.where("memoryId").is(memoryIdString(memoryId))); |
| | | ChatMessages chatMessages = mongoTemplate.findOne(query, ChatMessages.class); |
| | | if (chatMessages == null || chatMessages.getContent() == null) { |
| | | return new LinkedList<>(); |
| | | } |
| | | return ChatMessageDeserializer.messagesFromJson(chatMessages.getContent()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateMessages(Object memoryId, List<ChatMessage> messages) { |
| | | String memoryIdValue = memoryIdString(memoryId); |
| | | Query query = Query.query(Criteria.where("memoryId").is(memoryIdValue)); |
| | | Update update = new Update(); |
| | | update.set("memoryId", memoryIdValue); |
| | | update.set("content", ChatMessageSerializer.messagesToJson(messages)); |
| | | update.set("updateTime", new Date()); |
| | | update.setOnInsert("createTime", new Date()); |
| | | mongoTemplate.upsert(query, update, ChatMessages.class); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteMessages(Object memoryId) { |
| | | Query query = Query.query(Criteria.where("memoryId").is(memoryIdString(memoryId))); |
| | | mongoTemplate.remove(query, ChatMessages.class); |
| | | } |
| | | |
| | | public void appendMessages(Object memoryId, List<ChatMessage> appendList) { |
| | | List<ChatMessage> messages = new LinkedList<>(getMessages(memoryId)); |
| | | messages.addAll(appendList); |
| | | updateMessages(memoryId, messages); |
| | | } |
| | | |
| | | private String memoryIdString(Object memoryId) { |
| | | return memoryId == null ? "" : memoryId.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.tools; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.approve.mapper.ApproveLogMapper; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveLog; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import dev.langchain4j.agent.tool.P; |
| | | import dev.langchain4j.agent.tool.Tool; |
| | | import dev.langchain4j.agent.tool.ToolMemoryId; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.StringJoiner; |
| | | import java.util.regex.Matcher; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class ApproveTodoTools { |
| | | |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 20; |
| | | private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); |
| | | private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveLogMapper approveLogMapper; |
| | | private final IApproveNodeService approveNodeService; |
| | | private final ApproveProcessServiceImpl approveProcessService; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public ApproveTodoTools(ApproveProcessMapper approveProcessMapper, |
| | | ApproveNodeMapper approveNodeMapper, |
| | | ApproveLogMapper approveLogMapper, |
| | | IApproveNodeService approveNodeService, |
| | | ApproveProcessServiceImpl approveProcessService, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.approveProcessMapper = approveProcessMapper; |
| | | this.approveNodeMapper = approveNodeMapper; |
| | | this.approveLogMapper = approveLogMapper; |
| | | this.approveNodeService = approveNodeService; |
| | | this.approveProcessService = approveProcessService; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å®¡æ¹å¾
åå表", value = "æ¥è¯¢å½åç»å½äººç¸å
³ç审æ¹å¾
åï¼ä¼å
è¿åèªå·±å¾
å¤çç审æ¹ï¼æ¯ææç¶æãç±»åãå
³é®ååèå´è¿æ»¤ã") |
| | | public String listTodos(@ToolMemoryId String memoryId, |
| | | @P(value = "审æ¹ç¶æï¼å¯éå¼ï¼allãpendingãprocessingãapprovedãrejectedãresubmitted", required = false) String status, |
| | | @P(value = "审æ¹ç±»åç¼å·ï¼å¯ä¸ä¼ ", required = false) Integer approveType, |
| | | @P(value = "å
³é®åï¼å¯å¹é
æµç¨ç¼å·ãæ é¢ãç³è¯·äººãå½å审æ¹äºº", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§20", required = false) Integer limit, |
| | | @P(value = "æ¥è¯¢èå´ï¼å¯éå¼ï¼relatedãapplicantãapproverï¼related 表示å½åç¨æ·ç¸å
³ï¼applicant 表示æåèµ·çï¼approver 表示å¾
æå¤çç", required = false) String scope) { |
| | | |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | Long userId = loginUser.getUserId(); |
| | | Integer statusCode = parseStatus(status); |
| | | String normalizedScope = normalizeScope(scope); |
| | | |
| | | LambdaQueryWrapper<ApproveProcess> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ApproveProcess::getApproveDelete, 0); |
| | | if (statusCode == null) { |
| | | wrapper.ne(ApproveProcess::getApproveStatus, 2); |
| | | } |
| | | |
| | | if (approveType != null) { |
| | | wrapper.eq(ApproveProcess::getApproveType, approveType); |
| | | } |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(ApproveProcess::getApproveId, keyword) |
| | | .or().like(ApproveProcess::getApproveReason, keyword) |
| | | .or().like(ApproveProcess::getApproveUserName, keyword) |
| | | .or().like(ApproveProcess::getApproveUserCurrentName, keyword)); |
| | | } |
| | | if ("applicant".equals(normalizedScope)) { |
| | | wrapper.eq(ApproveProcess::getApproveUser, userId); |
| | | if (statusCode != null) { |
| | | wrapper.eq(ApproveProcess::getApproveStatus, statusCode); |
| | | } |
| | | } else if ("approver".equals(normalizedScope)) { |
| | | wrapper.eq(ApproveProcess::getApproveUserCurrentId, userId); |
| | | if (statusCode != null) { |
| | | wrapper.eq(ApproveProcess::getApproveStatus, statusCode); |
| | | } |
| | | } else if (statusCode != null && (statusCode == 0 || statusCode == 1)) { |
| | | wrapper.eq(ApproveProcess::getApproveUserCurrentId, userId); |
| | | wrapper.eq(ApproveProcess::getApproveStatus, statusCode); |
| | | } else { |
| | | wrapper.and(w -> w.eq(ApproveProcess::getApproveUser, userId) |
| | | .or().eq(ApproveProcess::getApproveUserCurrentId, userId) |
| | | .or().apply("FIND_IN_SET({0}, approve_user_ids)", userId)); |
| | | if (statusCode != null) { |
| | | wrapper.eq(ApproveProcess::getApproveStatus, statusCode); |
| | | } |
| | | } |
| | | |
| | | wrapper.orderByDesc(ApproveProcess::getCreateTime) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | |
| | | List<ApproveProcess> processes = defaultList(approveProcessMapper.selectList(wrapper)); |
| | | if (processes.isEmpty()) { |
| | | return jsonResponse(true, "todo_list", "æªæ¥è¯¢å°å½åç¨æ·ç¬¦åæ¡ä»¶ç审æ¹å¾
åã", |
| | | Map.of("count", 0), |
| | | Map.of("columns", todoColumns(), "items", List.of()), |
| | | Map.of()); |
| | | } |
| | | |
| | | List<Map<String, Object>> items = processes.stream() |
| | | .filter(process -> canView(process, userId)) |
| | | .sorted(Comparator |
| | | .comparing((ApproveProcess process) -> !Objects.equals(process.getApproveUserCurrentId(), userId)) |
| | | .thenComparing(ApproveProcess::getCreateTime, Comparator.nullsLast(Comparator.reverseOrder()))) |
| | | .map(process -> { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("approveId", process.getApproveId()); |
| | | item.put("approveType", approveTypeName(process.getApproveType())); |
| | | item.put("approveUserName", safe(process.getApproveUserName())); |
| | | item.put("approveUserCurrentName", safe(process.getApproveUserCurrentName())); |
| | | item.put("approveReason", safe(process.getApproveReason())); |
| | | item.put("approveStatus", approveStatusName(process.getApproveStatus())); |
| | | item.put("createTime", formatDateTime(process.getCreateTime())); |
| | | item.put("relation", relationName(process, userId)); |
| | | return item; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return jsonResponse(true, "todo_list", "å·²è¿åå½åç¨æ·ç¸å
³å®¡æ¹å表ã", |
| | | Map.of( |
| | | "count", items.size(), |
| | | "statusFilter", StringUtils.hasText(status) ? status : "all", |
| | | "approveType", approveType == null ? "" : approveType, |
| | | "keyword", keyword == null ? "" : keyword, |
| | | "scope", normalizedScope |
| | | ), |
| | | Map.of("columns", todoColumns(), "items", items), |
| | | Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å®¡æ¹å¾
å详æ
", value = "æ ¹æ®æµç¨ç¼å·æ¥è¯¢å½åç»å½äººå¯è§ç审æ¹è¯¦æ
ã") |
| | | public String getTodoDetail(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId) { |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ ææ¥ç该æµç¨ã"; |
| | | } |
| | | |
| | | StringJoiner detail = new StringJoiner("\n"); |
| | | detail.add("审æ¹è¯¦æ
"); |
| | | detail.add("æµç¨ç¼å·: " + safe(process.getApproveId())); |
| | | detail.add("审æ¹ç±»å: " + approveTypeName(process.getApproveType())); |
| | | detail.add("ç³è¯·äºº: " + safe(process.getApproveUserName())); |
| | | detail.add("ç³è¯·é¨é¨: " + safe(process.getApproveDeptName())); |
| | | detail.add("å½å审æ¹äºº: " + safe(process.getApproveUserCurrentName())); |
| | | detail.add("æ é¢: " + safe(process.getApproveReason())); |
| | | detail.add("ç¶æ: " + approveStatusName(process.getApproveStatus())); |
| | | detail.add("ç³è¯·æ¥æ: " + formatDate(process.getApproveTime())); |
| | | detail.add("å¼å§æ¥æ: " + formatDate(process.getStartDate())); |
| | | detail.add("ç»ææ¥æ: " + formatDate(process.getEndDate())); |
| | | detail.add("å°ç¹: " + safe(process.getLocation())); |
| | | detail.add("éé¢: " + (process.getPrice() == null ? "" : process.getPrice().toPlainString())); |
| | | detail.add("夿³¨: " + safe(process.getApproveRemark())); |
| | | detail.add("å建æ¶é´: " + formatDateTime(process.getCreateTime())); |
| | | detail.add("ä¸å½åç¨æ·å
³ç³»: " + relationName(process, currentUserId(memoryId))); |
| | | return detail.toString(); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å®¡æ¹æµè½¬è®°å½", value = "æ ¹æ®æµç¨ç¼å·æ¥è¯¢å®¡æ¹èç¹åå®¡æ¹æ¥å¿ï¼ç¨äºåçè¿åº¦ãå½åå¡ç¹ååå²å¤çè®°å½ã") |
| | | public String getTodoProgress(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId) { |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return jsonResponse(false, "todo_progress", "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ ææ¥ç该æµç¨ã", |
| | | Map.of("approveId", safe(approveId)), |
| | | Map.of(), |
| | | Map.of()); |
| | | } |
| | | |
| | | List<ApproveNode> nodes = listNodes(process); |
| | | List<ApproveLog> logs = listLogs(process.getId()); |
| | | ApproveNode currentNode = findCurrentNode(nodes); |
| | | |
| | | List<Map<String, Object>> nodeItems = nodes.stream().map(node -> { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("approveNodeOrder", node.getApproveNodeOrder()); |
| | | item.put("approveNodeUser", safe(node.getApproveNodeUser())); |
| | | item.put("approveNodeUserId", node.getApproveNodeUserId()); |
| | | item.put("approveNodeStatus", approveNodeStatusName(node.getApproveNodeStatus())); |
| | | item.put("approveNodeTime", formatDate(node.getApproveNodeTime())); |
| | | item.put("approveNodeReason", safe(node.getApproveNodeReason())); |
| | | item.put("approveNodeRemark", safe(node.getApproveNodeRemark())); |
| | | item.put("isCurrent", currentNode != null && Objects.equals(currentNode.getId(), node.getId())); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | List<Map<String, Object>> logItems = logs.stream().map(log -> { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("approveNodeOrder", log.getApproveNodeOrder()); |
| | | item.put("approveUser", log.getApproveUser()); |
| | | item.put("approveStatus", approveStatusName(log.getApproveStatus())); |
| | | item.put("approveTime", formatDate(log.getApproveTime())); |
| | | item.put("approveRemark", safe(log.getApproveRemark())); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | return jsonResponse(true, "todo_progress", "å·²è¿åå®¡æ¹æµè½¬è®°å½ã", |
| | | Map.of( |
| | | "approveId", safe(process.getApproveId()), |
| | | "currentStatus", approveStatusName(process.getApproveStatus()), |
| | | "currentApprover", safe(process.getApproveUserCurrentName()), |
| | | "currentNodeOrder", currentNode == null ? "" : currentNode.getApproveNodeOrder(), |
| | | "nodeCount", nodeItems.size(), |
| | | "logCount", logItems.size() |
| | | ), |
| | | Map.of("nodes", nodeItems, "logs", logItems), |
| | | Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "ç»è®¡å®¡æ¹å¾
åæ°æ®", value = "æç¨æ·æå®çæ¶é´èå´ç»è®¡å½åç»å½äººç¸å
³å®¡æ¹çç¶æåå¸ãç±»ååå¸åè¶å¿ï¼æªæå®æ¶é»è®¤è¿7天ã") |
| | | public String getTodoStats(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-ddï¼å¯ä¸ä¼ ", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-ddï¼å¯ä¸ä¼ ", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼ä¾å¦ ä»å¤©ãæ¬æãè¿30天ã2026-04-01å°2026-04-27", required = false) String timeRange) { |
| | | Long userId = currentUserId(memoryId); |
| | | List<ApproveProcess> processes = defaultList(approveProcessMapper.selectList(new LambdaQueryWrapper<ApproveProcess>() |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .and(w -> w.eq(ApproveProcess::getApproveUser, userId) |
| | | .or().eq(ApproveProcess::getApproveUserCurrentId, userId) |
| | | .or().apply("FIND_IN_SET({0}, approve_user_ids)", userId)))); |
| | | |
| | | DateRange dateRange = resolveDateRange(startDate, endDate, timeRange); |
| | | List<ApproveProcess> filteredProcesses = processes.stream() |
| | | .filter(process -> withinDateRange(process.getCreateTime(), dateRange)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (filteredProcesses.isEmpty()) { |
| | | return jsonResponse(true, "todo_stats", "å½åç¨æ·æ²¡æç¸å
³å®¡æ¹æ°æ®ã", |
| | | Map.of( |
| | | "total", 0, |
| | | "startDate", dateRange.start().toString(), |
| | | "endDate", dateRange.end().toString(), |
| | | "timeRange", dateRange.label() |
| | | ), |
| | | Map.of( |
| | | "statusDistribution", Map.of(), |
| | | "typeDistribution", Map.of(), |
| | | "trend", List.of() |
| | | ), |
| | | Map.of()); |
| | | } |
| | | |
| | | Map<String, Long> statusStats = filteredProcesses.stream() |
| | | .collect(Collectors.groupingBy(p -> approveStatusName(p.getApproveStatus()), LinkedHashMap::new, Collectors.counting())); |
| | | Map<String, Long> typeStats = filteredProcesses.stream() |
| | | .collect(Collectors.groupingBy(p -> approveTypeName(p.getApproveType()), LinkedHashMap::new, Collectors.counting())); |
| | | |
| | | long pendingCount = countByStatus(filteredProcesses, 0); |
| | | long processingCount = countByStatus(filteredProcesses, 1); |
| | | long approvedCount = countByStatus(filteredProcesses, 2); |
| | | long rejectedCount = countByStatus(filteredProcesses, 3); |
| | | long resubmittedCount = countByStatus(filteredProcesses, 4); |
| | | |
| | | TrendRange trendRange = buildTrendRange(dateRange.start(), dateRange.end(), filteredProcesses); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("total", filteredProcesses.size()); |
| | | summary.put("pending", pendingCount); |
| | | summary.put("processing", processingCount); |
| | | summary.put("approved", approvedCount); |
| | | summary.put("rejected", rejectedCount); |
| | | summary.put("resubmitted", resubmittedCount); |
| | | summary.put("approvalCompletionRate", calculateRate(approvedCount, filteredProcesses.size())); |
| | | summary.put("rejectionRate", calculateRate(rejectedCount, filteredProcesses.size())); |
| | | summary.put("startDate", dateRange.start().toString()); |
| | | summary.put("endDate", dateRange.end().toString()); |
| | | summary.put("timeRange", dateRange.label()); |
| | | summary.put("trendGranularity", trendRange.granularity()); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("statusBarOption", buildStatusBarOption(statusStats)); |
| | | charts.put("typePieOption", buildTypePieOption(typeStats)); |
| | | charts.put("trendLineOption", buildTrendLineOption(trendRange.labels(), trendRange.values(), trendRange.label())); |
| | | |
| | | return jsonResponse(true, "todo_stats", "å·²è¿åå½åç¨æ·ç¸å
³å®¡æ¹ç»è®¡ã", |
| | | summary, |
| | | Map.of( |
| | | "statusDistribution", statusStats, |
| | | "typeDistribution", typeStats, |
| | | "trend", toTrendItems(trendRange.labels(), trendRange.values()) |
| | | ), |
| | | charts); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Tool(name = "审æ¹å¾
å", value = "æ§è¡å®¡æ¹å¨ä½ï¼action ä»
æ¯æ approve æ rejectï¼ä¸åªè½å¤çå½åç»å½äººèªå·±çå¾
审èç¹ã") |
| | | public String reviewTodo(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId, |
| | | @P("å¨ä½ï¼approve=éè¿ï¼reject=驳å") String action, |
| | | @P(value = "审æ¹å¤æ³¨ï¼å¯ä¸ä¼ ", required = false) String remark) { |
| | | |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return actionResult(false, "review_action", "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ æè®¿é®è¯¥æµç¨ã", approveId, null); |
| | | } |
| | | if (!canOperate(process, currentUserId(memoryId))) { |
| | | return actionResult(false, "review_action", "å½åç»å½äººä¸æ¯è¯¥å®¡æ¹çå½åå¤ç人ã", approveId, null); |
| | | } |
| | | if (process.getApproveStatus() != null && (process.getApproveStatus() == 2 || process.getApproveStatus() == 3)) { |
| | | return actionResult(false, "review_action", "该审æ¹å·²ç»æï¼ä¸è½éå¤å¤çã", approveId, null); |
| | | } |
| | | |
| | | List<ApproveNode> nodes = listNodes(process); |
| | | ApproveNode currentNode = findCurrentNode(nodes); |
| | | if (currentNode == null || !Objects.equals(currentNode.getApproveNodeUserId(), currentUserId(memoryId))) { |
| | | return actionResult(false, "review_action", "æªæ¾å°å½åç¨æ·å¯å¤çç审æ¹èç¹ã", approveId, null); |
| | | } |
| | | |
| | | String normalizedAction = action == null ? "" : action.trim().toLowerCase(); |
| | | currentNode.setApproveNodeRemark(remark); |
| | | currentNode.setApproveNodeReason("reject".equals(normalizedAction) ? remark : null); |
| | | currentNode.setUpdateUser(currentUserId(memoryId)); |
| | | currentNode.setUpdateTime(LocalDateTime.now()); |
| | | currentNode.setIsLast(isLastNode(nodes, currentNode)); |
| | | |
| | | try { |
| | | switch (normalizedAction) { |
| | | case "approve" -> currentNode.setApproveNodeStatus(1); |
| | | case "reject" -> currentNode.setApproveNodeStatus(2); |
| | | default -> { |
| | | return actionResult(false, "review_action", "action åªæ¯æ approve æ rejectã", approveId, null); |
| | | } |
| | | } |
| | | approveNodeService.updateApproveNode(currentNode); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("审æ¹å¤ç失败", e); |
| | | } |
| | | |
| | | ApproveProcess refreshed = getProcessByApproveId(approveId); |
| | | writeApproveLog(memoryId, refreshed, currentNode, remark); |
| | | ApproveNode nextNode = refreshed == null ? null : findCurrentNode(listNodes(refreshed)); |
| | | |
| | | return actionResult(true, "review_action", |
| | | "approve".equals(normalizedAction) ? "审æ¹å·²éè¿ã" : "审æ¹å·²é©³åã", |
| | | approveId, |
| | | Map.of( |
| | | "action", normalizedAction, |
| | | "currentStatus", refreshed == null ? "" : approveStatusName(refreshed.getApproveStatus()), |
| | | "nextApprover", nextNode == null ? "" : safe(nextNode.getApproveNodeUser()), |
| | | "remark", safe(remark) |
| | | )); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Tool(name = "忶审æ¹å¾
åå®¡æ ¸", value = "æ¤éæè¿ä¸æ¬¡å®¡æ ¸ç»æï¼ä»
å
许æè¿ä¸æ¬¡å®¡æ ¸äººæç³è¯·äººæä½ã") |
| | | public String cancelReviewTodo(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId, |
| | | @P(value = "åæ¶åå ï¼å¯ä¸ä¼ ", required = false) String reason) { |
| | | |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return actionResult(false, "cancel_review_action", "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ æè®¿é®è¯¥æµç¨ã", approveId, null); |
| | | } |
| | | |
| | | List<ApproveNode> nodes = listNodes(process); |
| | | ApproveNode lastReviewedNode = nodes.stream() |
| | | .filter(node -> node.getApproveNodeStatus() != null && node.getApproveNodeStatus() != 0) |
| | | .max(Comparator.comparing(ApproveNode::getApproveNodeOrder)) |
| | | .orElse(null); |
| | | if (lastReviewedNode == null) { |
| | | return actionResult(false, "cancel_review_action", "å½åæµç¨æ²¡æå¯æ¤éçå®¡æ ¸è®°å½ã", approveId, null); |
| | | } |
| | | |
| | | Long userId = currentUserId(memoryId); |
| | | if (!isAdmin(userId) |
| | | && !Objects.equals(process.getApproveUser(), userId) |
| | | && !Objects.equals(lastReviewedNode.getApproveNodeUserId(), userId)) { |
| | | return actionResult(false, "cancel_review_action", "åªæç³è¯·äººãæè¿ä¸æ¬¡å®¡æ ¸äººæç®¡çåå¯ä»¥æ¤éã", approveId, null); |
| | | } |
| | | |
| | | lastReviewedNode.setApproveNodeStatus(0); |
| | | lastReviewedNode.setApproveNodeTime(null); |
| | | lastReviewedNode.setApproveNodeReason(null); |
| | | lastReviewedNode.setApproveNodeRemark(reason); |
| | | lastReviewedNode.setUpdateUser(userId); |
| | | lastReviewedNode.setUpdateTime(LocalDateTime.now()); |
| | | approveNodeMapper.updateById(lastReviewedNode); |
| | | |
| | | ApproveLog latestLog = listLogs(process.getId()).stream() |
| | | .max(Comparator.comparing(ApproveLog::getApproveNodeOrder) |
| | | .thenComparing(ApproveLog::getApproveTime, Comparator.nullsLast(Date::compareTo))) |
| | | .orElse(null); |
| | | if (latestLog != null) { |
| | | approveLogMapper.deleteById(latestLog.getId()); |
| | | } |
| | | |
| | | process.setApproveOverTime(null); |
| | | process.setApproveRemark(reason); |
| | | process.setApproveStatus(lastReviewedNode.getApproveNodeOrder() == null || lastReviewedNode.getApproveNodeOrder() <= 1 ? 0 : 1); |
| | | process.setApproveUserCurrentId(lastReviewedNode.getApproveNodeUserId()); |
| | | process.setApproveUserCurrentName(lastReviewedNode.getApproveNodeUser()); |
| | | approveProcessMapper.updateById(process); |
| | | |
| | | return actionResult(true, "cancel_review_action", "æè¿ä¸æ¬¡å®¡æ ¸å·²æ¤éã", approveId, Map.of( |
| | | "rollbackNodeOrder", lastReviewedNode.getApproveNodeOrder(), |
| | | "currentStatus", approveStatusName(process.getApproveStatus()), |
| | | "currentApprover", safe(process.getApproveUserCurrentName()), |
| | | "reason", safe(reason) |
| | | )); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Tool(name = "ä¿®æ¹å®¡æ¹å¾
å", value = "ä¿®æ¹å®¡æ¹ååºç¡ä¿¡æ¯ï¼ä»
å
许ç³è¯·äººä¿®æ¹ï¼ä¸æ¯æéè¿ AI 忴审æ¹ç±»åã") |
| | | public String updateTodo(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId, |
| | | @P(value = "æ°çæ é¢ï¼å¯ä¸ä¼ ", required = false) String approveReason, |
| | | @P(value = "æ°çå¼å§æ¥æ yyyy-MM-ddï¼å¯ä¸ä¼ ", required = false) String startDate, |
| | | @P(value = "æ°çç»ææ¥æ yyyy-MM-ddï¼å¯ä¸ä¼ ", required = false) String endDate, |
| | | @P(value = "æ°çéé¢ï¼å¯ä¸ä¼ ", required = false) BigDecimal price, |
| | | @P(value = "æ°çå°ç¹ï¼å¯ä¸ä¼ ", required = false) String location, |
| | | @P(value = "æ°ç审æ¹ç±»åï¼å¯ä¸ä¼ ", required = false) Integer approveType, |
| | | @P(value = "æ°ç夿³¨ï¼å¯ä¸ä¼ ", required = false) String approveRemark) { |
| | | |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return actionResult(false, "update_action", "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ æè®¿é®è¯¥æµç¨ã", approveId, null); |
| | | } |
| | | if (!Objects.equals(process.getApproveUser(), currentUserId(memoryId)) && !isAdmin(currentUserId(memoryId))) { |
| | | return actionResult(false, "update_action", "åªæç³è¯·äººæç®¡çåå¯ä»¥ä¿®æ¹å®¡æ¹åã", approveId, null); |
| | | } |
| | | if (process.getApproveStatus() != null && (process.getApproveStatus() == 1 || process.getApproveStatus() == 2)) { |
| | | return actionResult(false, "update_action", "审æ¹å¤ç䏿已宿æ¶ï¼ä¸å
许éè¿ AI ä¿®æ¹ã", approveId, null); |
| | | } |
| | | if (approveType != null && !Objects.equals(approveType, process.getApproveType())) { |
| | | return actionResult(false, "update_action", "AI 婿æä¸æ¯æç´æ¥åæ´å®¡æ¹ç±»åï¼é¿å
èç¹é
置失çã", approveId, null); |
| | | } |
| | | if (!StringUtils.hasText(approveReason) |
| | | && !StringUtils.hasText(startDate) |
| | | && !StringUtils.hasText(endDate) |
| | | && price == null |
| | | && !StringUtils.hasText(location) |
| | | && !StringUtils.hasText(approveRemark)) { |
| | | return actionResult(false, "update_action", "æ²¡ææ£æµå°å¯æ´æ°çåæ®µã", approveId, null); |
| | | } |
| | | |
| | | if (StringUtils.hasText(approveReason)) { |
| | | process.setApproveReason(approveReason); |
| | | } |
| | | if (StringUtils.hasText(startDate)) { |
| | | process.setStartDate(parseDate(startDate)); |
| | | } |
| | | if (StringUtils.hasText(endDate)) { |
| | | process.setEndDate(parseDate(endDate)); |
| | | } |
| | | if (price != null) { |
| | | process.setPrice(price); |
| | | } |
| | | if (StringUtils.hasText(location)) { |
| | | process.setLocation(location); |
| | | } |
| | | if (StringUtils.hasText(approveRemark)) { |
| | | process.setApproveRemark(approveRemark); |
| | | } |
| | | |
| | | approveProcessMapper.updateById(process); |
| | | return actionResult(true, "update_action", "审æ¹åå·²æ´æ°ã", approveId, Map.of( |
| | | "approveReason", safe(process.getApproveReason()), |
| | | "startDate", formatDate(process.getStartDate()), |
| | | "endDate", formatDate(process.getEndDate()), |
| | | "price", process.getPrice() == null ? "" : process.getPrice(), |
| | | "location", safe(process.getLocation()), |
| | | "approveType", approveTypeName(process.getApproveType()), |
| | | "approveRemark", safe(process.getApproveRemark()) |
| | | )); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Tool(name = "å é¤å®¡æ¹å¾
å", value = "å é¤å®¡æ¹æµç¨ï¼ä»
å
许ç³è¯·äººå 餿ªå®æçæµç¨ã") |
| | | public String deleteTodo(@ToolMemoryId String memoryId, |
| | | @P("æµç¨ç¼å· approveId") String approveId) { |
| | | ApproveProcess process = getAccessibleProcess(memoryId, approveId); |
| | | if (process == null) { |
| | | return actionResult(false, "delete_action", "æªæ¾å°å¯¹åºå®¡æ¹ï¼æå½åç¨æ·æ æè®¿é®è¯¥æµç¨ã", approveId, null); |
| | | } |
| | | if (!Objects.equals(process.getApproveUser(), currentUserId(memoryId)) && !isAdmin(currentUserId(memoryId))) { |
| | | return actionResult(false, "delete_action", "åªæç³è¯·äººæç®¡çåå¯ä»¥å é¤å®¡æ¹åã", approveId, null); |
| | | } |
| | | if (process.getApproveStatus() != null && (process.getApproveStatus() == 1 || process.getApproveStatus() == 2)) { |
| | | return actionResult(false, "delete_action", "审æ¹å¤çä¸æå·²å®æçæµç¨ä¸å
许éè¿ AI å é¤ã", approveId, null); |
| | | } |
| | | |
| | | approveProcessService.delByIds(Collections.singletonList(process.getId())); |
| | | return actionResult(true, "delete_action", "å®¡æ¹æµç¨å·²å é¤ã", approveId, Map.of( |
| | | "deletedProcessId", process.getId(), |
| | | "approveStatus", approveStatusName(process.getApproveStatus()) |
| | | )); |
| | | } |
| | | |
| | | private ApproveProcess getAccessibleProcess(String memoryId, String approveId) { |
| | | ApproveProcess process = getProcessByApproveId(approveId); |
| | | if (process == null) { |
| | | return null; |
| | | } |
| | | return canView(process, currentUserId(memoryId)) ? process : null; |
| | | } |
| | | |
| | | private ApproveProcess getProcessByApproveId(String approveId) { |
| | | if (!StringUtils.hasText(approveId)) { |
| | | return null; |
| | | } |
| | | return approveProcessMapper.selectOne(new LambdaQueryWrapper<ApproveProcess>() |
| | | .eq(ApproveProcess::getApproveId, approveId) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | private List<ApproveNode> listNodes(ApproveProcess process) { |
| | | if (process == null) { |
| | | return List.of(); |
| | | } |
| | | List<ApproveNode> nodes = defaultList(approveNodeMapper.selectList(new LambdaQueryWrapper<ApproveNode>() |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getApproveProcessId, process.getApproveId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder))); |
| | | if (!nodes.isEmpty()) { |
| | | return nodes; |
| | | } |
| | | return defaultList(approveNodeMapper.selectList(new LambdaQueryWrapper<ApproveNode>() |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getApproveProcessId, String.valueOf(process.getId())) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder))); |
| | | } |
| | | |
| | | private List<ApproveLog> listLogs(Long processId) { |
| | | return defaultList(approveLogMapper.selectList(new LambdaQueryWrapper<ApproveLog>() |
| | | .eq(ApproveLog::getApproveId, processId) |
| | | .orderByAsc(ApproveLog::getApproveNodeOrder, ApproveLog::getApproveTime))); |
| | | } |
| | | |
| | | private ApproveNode findCurrentNode(List<ApproveNode> nodes) { |
| | | return nodes.stream() |
| | | .filter(node -> node.getApproveNodeStatus() != null && node.getApproveNodeStatus() == 0) |
| | | .min(Comparator.comparing(ApproveNode::getApproveNodeOrder)) |
| | | .orElse(null); |
| | | } |
| | | |
| | | private boolean isLastNode(List<ApproveNode> nodes, ApproveNode currentNode) { |
| | | Integer maxOrder = nodes.stream() |
| | | .map(ApproveNode::getApproveNodeOrder) |
| | | .filter(Objects::nonNull) |
| | | .max(Integer::compareTo) |
| | | .orElse(null); |
| | | return maxOrder != null && Objects.equals(maxOrder, currentNode.getApproveNodeOrder()); |
| | | } |
| | | |
| | | private void writeApproveLog(String memoryId, ApproveProcess process, ApproveNode currentNode, String remark) { |
| | | if (process == null || currentNode == null) { |
| | | return; |
| | | } |
| | | ApproveLog log = new ApproveLog(); |
| | | log.setApproveId(process.getId()); |
| | | log.setApproveNodeOrder(currentNode.getApproveNodeOrder()); |
| | | log.setApproveUser(currentUserId(memoryId)); |
| | | log.setApproveTime(new Date()); |
| | | log.setApproveStatus(process.getApproveStatus()); |
| | | log.setApproveRemark(remark); |
| | | approveLogMapper.insert(log); |
| | | } |
| | | |
| | | private boolean canView(ApproveProcess process, Long userId) { |
| | | if (process == null || userId == null) { |
| | | return false; |
| | | } |
| | | return isAdmin(userId) |
| | | || Objects.equals(process.getApproveUser(), userId) |
| | | || Objects.equals(process.getApproveUserCurrentId(), userId) |
| | | || containsUserId(process.getApproveUserIds(), userId); |
| | | } |
| | | |
| | | private boolean canOperate(ApproveProcess process, Long userId) { |
| | | return process != null && userId != null && Objects.equals(process.getApproveUserCurrentId(), userId); |
| | | } |
| | | |
| | | private boolean containsUserId(String csv, Long userId) { |
| | | if (!StringUtils.hasText(csv) || userId == null) { |
| | | return false; |
| | | } |
| | | String target = String.valueOf(userId); |
| | | for (String item : csv.split(",")) { |
| | | if (target.equals(item.trim())) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String relationName(ApproveProcess process, Long userId) { |
| | | if (Objects.equals(process.getApproveUserCurrentId(), userId)) { |
| | | return "å½å审æ¹äºº"; |
| | | } |
| | | if (Objects.equals(process.getApproveUser(), userId)) { |
| | | return "ç³è¯·äºº"; |
| | | } |
| | | if (containsUserId(process.getApproveUserIds(), userId)) { |
| | | return "审æ¹é¾æå"; |
| | | } |
| | | return "å¯è§"; |
| | | } |
| | | |
| | | private List<String> todoColumns() { |
| | | return List.of("approveId", "approveType", "approveUserName", "approveUserCurrentName", |
| | | "approveReason", "approveStatus", "createTime", "relation"); |
| | | } |
| | | |
| | | private int normalizeLimit(Integer limit) { |
| | | if (limit == null || limit <= 0) { |
| | | return DEFAULT_LIMIT; |
| | | } |
| | | return Math.min(limit, MAX_LIMIT); |
| | | } |
| | | |
| | | private Integer parseStatus(String status) { |
| | | if (!StringUtils.hasText(status) || "all".equalsIgnoreCase(status)) { |
| | | return null; |
| | | } |
| | | return switch (status.trim().toLowerCase()) { |
| | | case "pending" -> 0; |
| | | case "processing" -> 1; |
| | | case "approved" -> 2; |
| | | case "rejected" -> 3; |
| | | case "resubmitted" -> 4; |
| | | default -> null; |
| | | }; |
| | | } |
| | | |
| | | private String normalizeScope(String scope) { |
| | | if (!StringUtils.hasText(scope)) { |
| | | return "related"; |
| | | } |
| | | return switch (scope.trim().toLowerCase()) { |
| | | case "applicant", "mine", "created", "initiated" -> "applicant"; |
| | | case "approver", "handler", "todo", "pending" -> "approver"; |
| | | default -> "related"; |
| | | }; |
| | | } |
| | | |
| | | private String approveStatusName(Integer status) { |
| | | if (status == null) { |
| | | return "æªç¥"; |
| | | } |
| | | return switch (status) { |
| | | case 0 -> "å¾
å®¡æ ¸"; |
| | | case 1 -> "å®¡æ ¸ä¸"; |
| | | case 2 -> "å®¡æ ¸å®æ"; |
| | | case 3 -> "å®¡æ ¸æªéè¿"; |
| | | case 4 -> "已鿰æäº¤"; |
| | | default -> "æªç¥"; |
| | | }; |
| | | } |
| | | |
| | | private String approveNodeStatusName(Integer status) { |
| | | if (status == null) { |
| | | return "æªç¥"; |
| | | } |
| | | return switch (status) { |
| | | case 0 -> "æªå®¡æ ¸"; |
| | | case 1 -> "åæ"; |
| | | case 2 -> "æç»"; |
| | | default -> "æªç¥"; |
| | | }; |
| | | } |
| | | |
| | | private String approveTypeName(Integer type) { |
| | | if (type == null) { |
| | | return "æªç¥"; |
| | | } |
| | | return switch (type) { |
| | | case 1 -> "å
¬åºç®¡ç"; |
| | | case 2 -> "请å管ç"; |
| | | case 3 -> "åºå·®ç®¡ç"; |
| | | case 4 -> "æ¥é管ç"; |
| | | case 5 -> "éè´å®¡æ¹"; |
| | | case 6 -> "æ¥ä»·å®¡æ¹"; |
| | | case 7 -> "å货审æ¹"; |
| | | case 8 -> "å±é©ä½ä¸å®¡æ¹"; |
| | | case 9 -> "åå
¬ç¨å审æ¹"; |
| | | default -> "ç±»å" + type; |
| | | }; |
| | | } |
| | | |
| | | private String safe(Object value) { |
| | | return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' '); |
| | | } |
| | | |
| | | private String formatDateTime(Object value) { |
| | | if (value == null) { |
| | | return ""; |
| | | } |
| | | if (value instanceof LocalDateTime localDateTime) { |
| | | return localDateTime.format(DATE_TIME_FORMATTER); |
| | | } |
| | | return safe(value); |
| | | } |
| | | |
| | | private String formatDate(Date value) { |
| | | return value == null ? "" : DATE_FORMAT.format(value); |
| | | } |
| | | |
| | | private long countByStatus(List<ApproveProcess> processes, int status) { |
| | | return processes.stream() |
| | | .filter(process -> process.getApproveStatus() != null) |
| | | .filter(process -> process.getApproveStatus() == status) |
| | | .count(); |
| | | } |
| | | |
| | | private String calculateRate(long part, int total) { |
| | | if (total <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | return String.format("%.2f%%", part * 100.0 / total); |
| | | } |
| | | |
| | | private List<Map<String, Object>> toTrendItems(List<String> dates, List<Long> values) { |
| | | List<Map<String, Object>> items = new ArrayList<>(); |
| | | for (int i = 0; i < dates.size(); i++) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("date", dates.get(i)); |
| | | item.put("count", values.get(i)); |
| | | items.add(item); |
| | | } |
| | | return items; |
| | | } |
| | | |
| | | private Map<String, Object> buildStatusBarOption(Map<String, Long> statusStats) { |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "审æ¹ç¶æåå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", new ArrayList<>(statusStats.keySet()))); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of( |
| | | "name", "æ°é", |
| | | "type", "bar", |
| | | "data", new ArrayList<>(statusStats.values()), |
| | | "barWidth", "40%" |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildTypePieOption(Map<String, Long> typeStats) { |
| | | List<Map<String, Object>> data = typeStats.entrySet().stream() |
| | | .map(entry -> { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("name", entry.getKey()); |
| | | item.put("value", entry.getValue()); |
| | | return item; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "审æ¹ç±»åå æ¯", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "item")); |
| | | option.put("legend", Map.of("orient", "vertical", "left", "left")); |
| | | option.put("series", List.of(Map.of( |
| | | "name", "审æ¹ç±»å", |
| | | "type", "pie", |
| | | "radius", List.of("35%", "65%"), |
| | | "data", data |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildTrendLineOption(List<String> dates, List<Long> values, String label) { |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", label + "å®¡æ¹æ°å¢è¶å¿", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", dates)); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of( |
| | | "name", "æ°å¢å®¡æ¹", |
| | | "type", "line", |
| | | "smooth", true, |
| | | "data", values, |
| | | "areaStyle", Map.of() |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private Date parseDate(String dateText) { |
| | | try { |
| | | return DATE_FORMAT.parse(dateText); |
| | | } catch (ParseException e) { |
| | | throw new IllegalArgumentException("æ¥ææ ¼å¼å¿
é¡»æ¯ yyyy-MM-dd"); |
| | | } |
| | | } |
| | | |
| | | private DateRange resolveDateRange(String startDateText, String endDateText, String timeRange) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate explicitStart = parseLocalDate(startDateText); |
| | | LocalDate explicitEnd = parseLocalDate(endDateText); |
| | | if (explicitStart != null || explicitEnd != null) { |
| | | LocalDate start = explicitStart != null ? explicitStart : explicitEnd; |
| | | LocalDate end = explicitEnd != null ? explicitEnd : explicitStart; |
| | | if (start.isAfter(end)) { |
| | | LocalDate temp = start; |
| | | start = end; |
| | | end = temp; |
| | | } |
| | | return new DateRange(start, end, start + "è³" + end); |
| | | } |
| | | if (!StringUtils.hasText(timeRange)) { |
| | | return new DateRange(today.minusDays(6), today, "è¿7天"); |
| | | } |
| | | |
| | | String text = timeRange.trim(); |
| | | if (text.contains("ä»å¤©")) { |
| | | return new DateRange(today, today, "ä»å¤©"); |
| | | } |
| | | if (text.contains("æ¨å¤©") || text.contains("æ¨æ¥")) { |
| | | LocalDate day = today.minusDays(1); |
| | | return new DateRange(day, day, "æ¨å¤©"); |
| | | } |
| | | if (text.contains("æ¬å¨")) { |
| | | LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | return new DateRange(start, today, "æ¬å¨"); |
| | | } |
| | | if (text.contains("ä¸å¨")) { |
| | | LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | LocalDate start = thisWeekStart.minusWeeks(1); |
| | | LocalDate end = thisWeekStart.minusDays(1); |
| | | return new DateRange(start, end, "ä¸å¨"); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | LocalDate start = today.withDayOfMonth(1); |
| | | return new DateRange(start, today, "æ¬æ"); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | YearMonth lastMonth = YearMonth.from(today).minusMonths(1); |
| | | return new DateRange(lastMonth.atDay(1), lastMonth.atEndOfMonth(), "䏿"); |
| | | } |
| | | if (text.contains("æ¬å¹´") || text.contains("ä»å¹´")) { |
| | | LocalDate start = today.withDayOfYear(1); |
| | | return new DateRange(start, today, "æ¬å¹´"); |
| | | } |
| | | if (text.contains("å»å¹´")) { |
| | | LocalDate start = today.minusYears(1).withDayOfYear(1); |
| | | LocalDate end = today.minusYears(1).withMonth(12).withDayOfMonth(31); |
| | | return new DateRange(start, end, "å»å¹´"); |
| | | } |
| | | |
| | | Matcher relativeMatcher = java.util.regex.Pattern.compile("(è¿|æè¿)(\\d+)(天|å¨|个æ|æ|å¹´)").matcher(text); |
| | | if (relativeMatcher.find()) { |
| | | int amount = Integer.parseInt(relativeMatcher.group(2)); |
| | | String unit = relativeMatcher.group(3); |
| | | LocalDate start = switch (unit) { |
| | | case "天" -> today.minusDays(Math.max(amount - 1L, 0)); |
| | | case "å¨" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1); |
| | | case "个æ", "æ" -> today.minusMonths(Math.max(amount, 1)).plusDays(1); |
| | | case "å¹´" -> today.minusYears(Math.max(amount, 1)).plusDays(1); |
| | | default -> today.minusDays(6); |
| | | }; |
| | | return new DateRange(start, today, "è¿" + amount + unit); |
| | | } |
| | | |
| | | Matcher dateMatcher = java.util.regex.Pattern.compile("(\\d{4}-\\d{2}-\\d{2})").matcher(text); |
| | | if (dateMatcher.find()) { |
| | | LocalDate start = LocalDate.parse(dateMatcher.group(1)); |
| | | LocalDate end = dateMatcher.find() ? LocalDate.parse(dateMatcher.group(1)) : start; |
| | | if (start.isAfter(end)) { |
| | | LocalDate temp = start; |
| | | start = end; |
| | | end = temp; |
| | | } |
| | | return new DateRange(start, end, start + "è³" + end); |
| | | } |
| | | |
| | | return new DateRange(today.minusDays(6), today, "è¿7天"); |
| | | } |
| | | |
| | | private boolean withinDateRange(LocalDateTime createTime, DateRange dateRange) { |
| | | if (createTime == null) { |
| | | return false; |
| | | } |
| | | LocalDate date = createTime.toLocalDate(); |
| | | return !date.isBefore(dateRange.start()) && !date.isAfter(dateRange.end()); |
| | | } |
| | | |
| | | private TrendRange buildTrendRange(LocalDate start, LocalDate end, List<ApproveProcess> processes) { |
| | | long days = ChronoUnit.DAYS.between(start, end) + 1; |
| | | if (days <= 31) { |
| | | List<String> labels = new ArrayList<>(); |
| | | List<Long> values = new ArrayList<>(); |
| | | for (LocalDate cursor = start; !cursor.isAfter(end); cursor = cursor.plusDays(1)) { |
| | | LocalDate current = cursor; |
| | | labels.add(current.toString()); |
| | | values.add(processes.stream() |
| | | .filter(process -> process.getCreateTime() != null) |
| | | .filter(process -> process.getCreateTime().toLocalDate().equals(current)) |
| | | .count()); |
| | | } |
| | | return new TrendRange(labels, values, "day", start + "è³" + end); |
| | | } |
| | | |
| | | List<String> labels = new ArrayList<>(); |
| | | List<Long> values = new ArrayList<>(); |
| | | YearMonth startMonth = YearMonth.from(start); |
| | | YearMonth endMonth = YearMonth.from(end); |
| | | for (YearMonth cursor = startMonth; !cursor.isAfter(endMonth); cursor = cursor.plusMonths(1)) { |
| | | YearMonth current = cursor; |
| | | labels.add(current.toString()); |
| | | values.add(processes.stream() |
| | | .filter(process -> process.getCreateTime() != null) |
| | | .filter(process -> YearMonth.from(process.getCreateTime()).equals(current)) |
| | | .count()); |
| | | } |
| | | return new TrendRange(labels, values, "month", start + "è³" + end); |
| | | } |
| | | |
| | | private LocalDate parseLocalDate(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | return LocalDate.parse(text.trim()); |
| | | } |
| | | |
| | | private String actionResult(boolean success, String type, String description, String approveId, Map<String, Object> data) { |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("approveId", safe(approveId)); |
| | | return jsonResponse(success, type, description, summary, data == null ? Map.of() : data, Map.of()); |
| | | } |
| | | |
| | | private String jsonResponse(boolean success, |
| | | String type, |
| | | String description, |
| | | Map<String, Object> summary, |
| | | Map<String, Object> data, |
| | | Map<String, Object> charts) { |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("success", success); |
| | | result.put("type", type); |
| | | result.put("description", description); |
| | | result.put("summary", summary == null ? Map.of() : summary); |
| | | result.put("data", data == null ? Map.of() : data); |
| | | result.put("charts", charts == null ? Map.of() : charts); |
| | | return JSON.toJSONString(result); |
| | | } |
| | | |
| | | private LoginUser currentLoginUser(String memoryId) { |
| | | LoginUser loginUser = aiSessionUserContext.get(memoryId); |
| | | if (loginUser != null) { |
| | | return loginUser; |
| | | } |
| | | return SecurityUtils.getLoginUser(); |
| | | } |
| | | |
| | | private Long currentUserId(String memoryId) { |
| | | return currentLoginUser(memoryId).getUserId(); |
| | | } |
| | | |
| | | private boolean isAdmin(Long userId) { |
| | | return SecurityUtils.isAdmin(userId); |
| | | } |
| | | |
| | | private <T> List<T> defaultList(List<T> list) { |
| | | return list == null ? List.of() : list; |
| | | } |
| | | |
| | | private record DateRange(LocalDate start, LocalDate end, String label) { |
| | | } |
| | | |
| | | private record TrendRange(List<String> labels, List<Long> values, String granularity, String label) { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.tools; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.purchase.mapper.InvoicePurchaseMapper; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.procurementrecord.mapper.InboundManagementMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.InboundManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import dev.langchain4j.agent.tool.P; |
| | | import dev.langchain4j.agent.tool.Tool; |
| | | import dev.langchain4j.agent.tool.ToolMemoryId; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Comparator; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class PurchaseAgentTools { |
| | | |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 30; |
| | | |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final PaymentRegistrationMapper paymentRegistrationMapper; |
| | | private final InvoicePurchaseMapper invoicePurchaseMapper; |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final InboundManagementMapper inboundManagementMapper; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public PurchaseAgentTools(PurchaseLedgerMapper purchaseLedgerMapper, |
| | | PaymentRegistrationMapper paymentRegistrationMapper, |
| | | InvoicePurchaseMapper invoicePurchaseMapper, |
| | | PurchaseReturnOrdersMapper purchaseReturnOrdersMapper, |
| | | SalesLedgerProductMapper salesLedgerProductMapper, |
| | | ProcurementRecordMapper procurementRecordMapper, |
| | | InboundManagementMapper inboundManagementMapper, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.purchaseLedgerMapper = purchaseLedgerMapper; |
| | | this.paymentRegistrationMapper = paymentRegistrationMapper; |
| | | this.invoicePurchaseMapper = invoicePurchaseMapper; |
| | | this.purchaseReturnOrdersMapper = purchaseReturnOrdersMapper; |
| | | this.salesLedgerProductMapper = salesLedgerProductMapper; |
| | | this.procurementRecordMapper = procurementRecordMapper; |
| | | this.inboundManagementMapper = inboundManagementMapper; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éè´å°è´¦å表", value = "æå
³é®ååæ¶é´èå´æ¥è¯¢éè´å°è´¦ï¼æ¯æè¿åæè¿Næ¡") |
| | | public String listPurchaseLedgers(@ToolMemoryId String memoryId, |
| | | @P(value = "å
³é®åï¼å¯å¹é
éè´ååå·/ä¾åºå/项ç®å", required = false) String keyword, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | LocalDate start = parseLocalDate(startDate); |
| | | LocalDate end = parseLocalDate(endDate); |
| | | int finalLimit = normalizeLimit(limit); |
| | | |
| | | LambdaQueryWrapper<PurchaseLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PurchaseLedger::getTenantId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(PurchaseLedger::getPurchaseContractNumber, keyword) |
| | | .or().like(PurchaseLedger::getSupplierName, keyword) |
| | | .or().like(PurchaseLedger::getProjectName, keyword)); |
| | | } |
| | | if (start != null) { |
| | | wrapper.ge(PurchaseLedger::getEntryDate, toDate(start)); |
| | | } |
| | | if (end != null) { |
| | | wrapper.lt(PurchaseLedger::getEntryDate, toExclusiveEndDate(end)); |
| | | } |
| | | wrapper.orderByDesc(PurchaseLedger::getEntryDate, PurchaseLedger::getId).last("limit " + finalLimit); |
| | | |
| | | List<PurchaseLedger> rows = defaultList(purchaseLedgerMapper.selectList(wrapper)); |
| | | List<Map<String, Object>> items = rows.stream().map(this::toLedgerItem).collect(Collectors.toList()); |
| | | return jsonResponse(true, "purchase_ledger_list", "å·²è¿åéè´å°è´¦å表", |
| | | Map.of("count", items.size(), "limit", finalLimit, "keyword", safe(keyword)), |
| | | Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éè´å°è´¦è¯¦æ
", value = "æéè´å°è´¦IDæ¥è¯¢è¯¦æ
") |
| | | public String getPurchaseLedgerDetail(@ToolMemoryId String memoryId, @P("éè´å°è´¦ID") Long ledgerId) { |
| | | if (ledgerId == null) { |
| | | return jsonResponse(false, "purchase_ledger_detail", "éè´å°è´¦IDä¸è½ä¸ºç©º", Map.of(), Map.of(), Map.of()); |
| | | } |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | PurchaseLedger ledger = purchaseLedgerMapper.selectById(ledgerId); |
| | | if (ledger == null || !tenantMatched(ledger.getTenantId(), loginUser.getTenantId())) { |
| | | return jsonResponse(false, "purchase_ledger_detail", "æªæ¾å°è¯¥éè´å°è´¦ææ æé访é®", Map.of("ledgerId", ledgerId), Map.of(), Map.of()); |
| | | } |
| | | return jsonResponse(true, "purchase_ledger_detail", "å·²è¿åéè´å°è´¦è¯¦æ
", |
| | | Map.of("ledgerId", ledgerId), |
| | | Map.of("detail", toLedgerItem(ledger)), |
| | | Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "ç»è®¡éè´æ°æ®", value = "ç»è®¡æ¶é´èå´å
éè´ååæ°ãååéé¢ã仿¬¾éé¢ãå票éé¢ãéè´§éé¢") |
| | | public String getPurchaseStats(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼ä¾å¦ä»å¹´ãæ¬æãè¿30天", required = false) String timeRange) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange); |
| | | |
| | | List<PurchaseLedger> ledgers = queryLedgers(loginUser, range); |
| | | List<PaymentRegistration> payments = queryPayments(loginUser, range); |
| | | List<InvoicePurchase> invoices = queryInvoices(loginUser, range); |
| | | List<PurchaseReturnOrders> returns = queryReturns(loginUser, range); |
| | | |
| | | BigDecimal contractAmount = ledgers.stream() |
| | | .map(PurchaseLedger::getContractAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal paymentAmount = payments.stream() |
| | | .map(PaymentRegistration::getCurrentPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal invoiceAmount = invoices.stream() |
| | | .map(InvoicePurchase::getInvoiceAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal returnAmount = returns.stream() |
| | | .map(PurchaseReturnOrders::getTotalAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", range.start().toString()); |
| | | summary.put("endDate", range.end().toString()); |
| | | summary.put("ledgerCount", ledgers.size()); |
| | | summary.put("paymentCount", payments.size()); |
| | | summary.put("invoiceCount", invoices.size()); |
| | | summary.put("returnCount", returns.size()); |
| | | summary.put("contractAmount", contractAmount); |
| | | summary.put("paymentAmount", paymentAmount); |
| | | summary.put("invoiceAmount", invoiceAmount); |
| | | summary.put("returnAmount", returnAmount); |
| | | |
| | | return jsonResponse(true, "purchase_stats", "å·²è¿åéè´ç»è®¡æ°æ®", summary, Map.of(), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "éè´ç©æé颿è¡", value = "ææ¶é´èå´ç»è®¡éè´ç©æé颿è¡ï¼å¯åçæ¬æéè´é颿åé åçç©æã") |
| | | public String rankPurchaseMaterials(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼ä¾å¦æ¬æãè¿7天ãè¿30天", required = false) String timeRange, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange); |
| | | List<Long> ledgerIds = queryLedgers(loginUser, range).stream() |
| | | .map(PurchaseLedger::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | if (ledgerIds.isEmpty()) { |
| | | return jsonResponse(true, "purchase_material_rank", "å½åæ¶é´èå´å
没æéè´ç©ææ°æ®ã", |
| | | rangeSummary(range, 0), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<SalesLedgerProduct> products = defaultList(salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getType, 2) |
| | | .in(SalesLedgerProduct::getSalesLedgerId, ledgerIds))); |
| | | |
| | | Map<String, MaterialRankItem> grouped = new LinkedHashMap<>(); |
| | | for (SalesLedgerProduct product : products) { |
| | | String name = safe(product.getProductCategory()); |
| | | String model = safe(product.getSpecificationModel()); |
| | | String key = name + "|" + model; |
| | | MaterialRankItem item = grouped.computeIfAbsent(key, ignored -> new MaterialRankItem(name, model, safe(product.getUnit()))); |
| | | item.quantity = item.quantity.add(defaultDecimal(product.getQuantity())); |
| | | item.amount = item.amount.add(defaultDecimal(product.getTaxInclusiveTotalPrice())); |
| | | } |
| | | |
| | | List<Map<String, Object>> items = grouped.values().stream() |
| | | .sorted(Comparator.comparing((MaterialRankItem item) -> item.amount).reversed()) |
| | | .limit(normalizeLimit(limit)) |
| | | .map(MaterialRankItem::toMap) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return jsonResponse(true, "purchase_material_rank", "å·²è¿åéè´ç©æé颿è¡ã", |
| | | rangeSummary(range, items.size()), Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢æªå
¥åºéè´è®¢å", value = "æ¥è¯¢éè´è®¢åä¸ä»æå¾
å
¥åºæ°éçç©ææç»ã") |
| | | public String listUnstockedPurchaseOrders(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "å
³é®åï¼å¯å¹é
éè´ååå·/ä¾åºå/ç©æ", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | List<PurchaseLedger> ledgers = queryLedgers(loginUser, range).stream() |
| | | .filter(ledger -> matchLedgerKeyword(ledger, keyword)) |
| | | .collect(Collectors.toList()); |
| | | Map<Long, PurchaseLedger> ledgerMap = ledgers.stream() |
| | | .filter(ledger -> ledger.getId() != null) |
| | | .collect(Collectors.toMap(PurchaseLedger::getId, ledger -> ledger, (a, b) -> a, LinkedHashMap::new)); |
| | | if (ledgerMap.isEmpty()) { |
| | | return jsonResponse(true, "purchase_unstocked_list", "æªæ¥è¯¢å°ç¬¦åæ¡ä»¶çéè´è®¢åã", |
| | | rangeSummary(range, 0), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<SalesLedgerProduct> products = defaultList(salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getType, 2) |
| | | .in(SalesLedgerProduct::getSalesLedgerId, ledgerMap.keySet()))); |
| | | |
| | | List<Map<String, Object>> items = products.stream() |
| | | .filter(product -> matchProductKeyword(product, keyword)) |
| | | .map(product -> toUnstockedItem(product, ledgerMap.get(product.getSalesLedgerId()))) |
| | | .filter(Objects::nonNull) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return jsonResponse(true, "purchase_unstocked_list", "å·²è¿åæªå
¥åºéè´è®¢åã", |
| | | rangeSummary(range, items.size()), Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éè´å°è´§å¼å¸¸", value = "æ¥è¯¢å°è´§ç¶æå¼å¸¸æå¤æ³¨å
å«å¼å¸¸ä¿¡æ¯çå°è´§è®°å½ã") |
| | | public String listArrivalExceptions(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼ä¾å¦è¿7å¤©ãæ¬æ", required = false) String timeRange, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange); |
| | | LambdaQueryWrapper<InboundManagement> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), InboundManagement::getTenantId); |
| | | wrapper.ge(InboundManagement::getArrivalTime, toDate(range.start())) |
| | | .lt(InboundManagement::getArrivalTime, toExclusiveEndDate(range.end())) |
| | | .and(w -> w.notLike(InboundManagement::getStatus, "æ£å¸¸") |
| | | .notLike(InboundManagement::getStatus, "宿") |
| | | .notLike(InboundManagement::getStatus, "å·²å°è´§") |
| | | .or().like(InboundManagement::getStatus, "å¼å¸¸") |
| | | .or().like(InboundManagement::getRemark, "å¼å¸¸") |
| | | .or().like(InboundManagement::getRemark, "é®é¢") |
| | | .or().like(InboundManagement::getRemark, "å»¶è¿") |
| | | .or().like(InboundManagement::getRemark, "ç缺")); |
| | | wrapper.orderByDesc(InboundManagement::getArrivalTime).last("limit " + normalizeLimit(limit)); |
| | | |
| | | List<Map<String, Object>> items = defaultList(inboundManagementMapper.selectList(wrapper)).stream() |
| | | .map(this::toArrivalItem) |
| | | .collect(Collectors.toList()); |
| | | return jsonResponse(true, "purchase_arrival_exception_list", "å·²è¿åéè´å°è´§å¼å¸¸è®°å½ã", |
| | | rangeSummary(range, items.size()), Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å¾
仿¬¾éè´å", value = "æ¥è¯¢ååéé¢å¤§äºå·²ä»æ¬¾éé¢çéè´åã") |
| | | public String listPendingPaymentOrders(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "å
³é®åï¼å¯å¹é
éè´ååå·/ä¾åºå/项ç®å", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | List<Map<String, Object>> items = queryLedgers(loginUser, range).stream() |
| | | .filter(ledger -> matchLedgerKeyword(ledger, keyword)) |
| | | .map(ledger -> toPendingPaymentItem(loginUser, ledger)) |
| | | .filter(Objects::nonNull) |
| | | .sorted(Comparator.comparing(item -> (BigDecimal) item.get("pendingAmount"), Comparator.reverseOrder())) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | return jsonResponse(true, "purchase_pending_payment_list", "å·²è¿åå¾
仿¬¾éè´åã", |
| | | rangeSummary(range, items.size()), Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éè´éè´§æ
åµ", value = "ææ¶é´èå´æ¥è¯¢éè´éè´§åå表åéè´§éé¢ã") |
| | | public String listPurchaseReturns(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "å
³é®åï¼å¯å¹é
éè´§åå·/夿³¨", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<PurchaseReturnOrders> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), PurchaseReturnOrders::getDeptId); |
| | | wrapper.ge(PurchaseReturnOrders::getPreparedAt, range.start()) |
| | | .le(PurchaseReturnOrders::getPreparedAt, range.end()); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(PurchaseReturnOrders::getNo, keyword) |
| | | .or().like(PurchaseReturnOrders::getRemark, keyword) |
| | | .or().like(PurchaseReturnOrders::getReturnUserName, keyword)); |
| | | } |
| | | wrapper.orderByDesc(PurchaseReturnOrders::getPreparedAt).last("limit " + normalizeLimit(limit)); |
| | | |
| | | List<PurchaseReturnOrders> returns = defaultList(purchaseReturnOrdersMapper.selectList(wrapper)); |
| | | BigDecimal totalAmount = returns.stream() |
| | | .map(PurchaseReturnOrders::getTotalAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | Map<String, Object> summary = rangeSummary(range, returns.size()); |
| | | summary.put("returnAmount", totalAmount); |
| | | |
| | | return jsonResponse(true, "purchase_return_list", "å·²è¿åéè´éè´§æ
åµã", |
| | | summary, |
| | | Map.of("items", returns.stream().map(this::toReturnItem).collect(Collectors.toList())), |
| | | Map.of()); |
| | | } |
| | | |
| | | private List<PurchaseLedger> queryLedgers(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PurchaseLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PurchaseLedger::getTenantId); |
| | | wrapper.ge(PurchaseLedger::getEntryDate, toDate(range.start())) |
| | | .lt(PurchaseLedger::getEntryDate, toExclusiveEndDate(range.end())); |
| | | return defaultList(purchaseLedgerMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<String, Object> rangeSummary(DateRange range, int count) { |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", range.start().toString()); |
| | | summary.put("endDate", range.end().toString()); |
| | | summary.put("count", count); |
| | | return summary; |
| | | } |
| | | |
| | | private boolean matchLedgerKeyword(PurchaseLedger ledger, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | return safe(ledger.getPurchaseContractNumber()).contains(text) |
| | | || safe(ledger.getSupplierName()).contains(text) |
| | | || safe(ledger.getProjectName()).contains(text); |
| | | } |
| | | |
| | | private boolean matchProductKeyword(SalesLedgerProduct product, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | return safe(product.getProductCategory()).contains(text) |
| | | || safe(product.getSpecificationModel()).contains(text); |
| | | } |
| | | |
| | | private Map<String, Object> toUnstockedItem(SalesLedgerProduct product, PurchaseLedger ledger) { |
| | | if (product == null || ledger == null || product.getId() == null) { |
| | | return null; |
| | | } |
| | | BigDecimal orderedQuantity = defaultDecimal(product.getQuantity()); |
| | | BigDecimal inboundQuantity = sumInboundQuantity(product.getId()); |
| | | BigDecimal pendingQuantity = orderedQuantity.subtract(inboundQuantity); |
| | | if (pendingQuantity.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return null; |
| | | } |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("purchaseLedgerId", ledger.getId()); |
| | | item.put("purchaseContractNumber", safe(ledger.getPurchaseContractNumber())); |
| | | item.put("supplierName", safe(ledger.getSupplierName())); |
| | | item.put("productCategory", safe(product.getProductCategory())); |
| | | item.put("specificationModel", safe(product.getSpecificationModel())); |
| | | item.put("unit", safe(product.getUnit())); |
| | | item.put("orderedQuantity", orderedQuantity); |
| | | item.put("inboundQuantity", inboundQuantity); |
| | | item.put("pendingInboundQuantity", pendingQuantity); |
| | | item.put("entryDate", formatDate(ledger.getEntryDate())); |
| | | return item; |
| | | } |
| | | |
| | | private BigDecimal sumInboundQuantity(Long salesLedgerProductId) { |
| | | List<ProcurementRecordStorage> records = defaultList(procurementRecordMapper.selectList(new LambdaQueryWrapper<ProcurementRecordStorage>() |
| | | .eq(ProcurementRecordStorage::getType, 1) |
| | | .eq(ProcurementRecordStorage::getSalesLedgerProductId, salesLedgerProductId))); |
| | | return records.stream() |
| | | .map(ProcurementRecordStorage::getInboundNum) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | private Map<String, Object> toArrivalItem(InboundManagement item) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("orderNo", safe(item.getOrderNo())); |
| | | map.put("arrivalNo", safe(item.getArrivalNo())); |
| | | map.put("supplierName", safe(item.getSupplierName())); |
| | | map.put("status", safe(item.getStatus())); |
| | | map.put("arrivalTime", formatDate(item.getArrivalTime())); |
| | | map.put("arrivalQuantity", safe(item.getArrivalQuantity())); |
| | | map.put("remark", safe(item.getRemark())); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> toPendingPaymentItem(LoginUser loginUser, PurchaseLedger ledger) { |
| | | BigDecimal contractAmount = defaultDecimal(ledger.getContractAmount()); |
| | | BigDecimal paidAmount = sumPaymentAmount(loginUser, ledger.getId()); |
| | | BigDecimal pendingAmount = contractAmount.subtract(paidAmount); |
| | | if (pendingAmount.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return null; |
| | | } |
| | | Map<String, Object> item = toLedgerItem(ledger); |
| | | item.put("paidAmount", paidAmount); |
| | | item.put("pendingAmount", pendingAmount); |
| | | return item; |
| | | } |
| | | |
| | | private BigDecimal sumPaymentAmount(LoginUser loginUser, Long purchaseLedgerId) { |
| | | LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId); |
| | | wrapper.eq(PaymentRegistration::getPurchaseLedgerId, purchaseLedgerId); |
| | | return defaultList(paymentRegistrationMapper.selectList(wrapper)).stream() |
| | | .map(PaymentRegistration::getCurrentPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | private Map<String, Object> toReturnItem(PurchaseReturnOrders item) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("no", safe(item.getNo())); |
| | | map.put("returnType", item.getReturnType()); |
| | | map.put("purchaseLedgerId", item.getPurchaseLedgerId()); |
| | | map.put("preparedAt", item.getPreparedAt() == null ? "" : item.getPreparedAt().toString()); |
| | | map.put("returnUserName", safe(item.getReturnUserName())); |
| | | map.put("totalAmount", item.getTotalAmount()); |
| | | map.put("remark", safe(item.getRemark())); |
| | | return map; |
| | | } |
| | | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private List<PaymentRegistration> queryPayments(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId); |
| | | wrapper.ge(PaymentRegistration::getPaymentDate, toDate(range.start())) |
| | | .lt(PaymentRegistration::getPaymentDate, toExclusiveEndDate(range.end())); |
| | | return defaultList(paymentRegistrationMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<InvoicePurchase> queryInvoices(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<InvoicePurchase> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), InvoicePurchase::getTenantId); |
| | | wrapper.ge(InvoicePurchase::getIssueDate, range.start()) |
| | | .le(InvoicePurchase::getIssueDate, range.end()); |
| | | return defaultList(invoicePurchaseMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<PurchaseReturnOrders> queryReturns(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PurchaseReturnOrders> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), PurchaseReturnOrders::getDeptId); |
| | | wrapper.ge(PurchaseReturnOrders::getPreparedAt, range.start()) |
| | | .le(PurchaseReturnOrders::getPreparedAt, range.end()); |
| | | return defaultList(purchaseReturnOrdersMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<String, Object> toLedgerItem(PurchaseLedger item) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("purchaseContractNumber", safe(item.getPurchaseContractNumber())); |
| | | map.put("supplierName", safe(item.getSupplierName())); |
| | | map.put("projectName", safe(item.getProjectName())); |
| | | map.put("entryDate", formatDate(item.getEntryDate())); |
| | | map.put("contractAmount", item.getContractAmount()); |
| | | map.put("approvalStatus", item.getApprovalStatus()); |
| | | map.put("paymentMethod", safe(item.getPaymentMethod())); |
| | | return map; |
| | | } |
| | | |
| | | private DateRange resolveDateRange(String startDate, String endDate, String timeRange) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate start = parseLocalDate(startDate); |
| | | LocalDate end = parseLocalDate(endDate); |
| | | if (start != null || end != null) { |
| | | LocalDate s = start != null ? start : end; |
| | | LocalDate e = end != null ? end : start; |
| | | if (s.isAfter(e)) { |
| | | LocalDate temp = s; |
| | | s = e; |
| | | e = temp; |
| | | } |
| | | return new DateRange(s, e, s + "è³" + e); |
| | | } |
| | | if (!StringUtils.hasText(timeRange)) { |
| | | return new DateRange(today.minusDays(29), today, "è¿30天"); |
| | | } |
| | | String text = timeRange.trim(); |
| | | if (text.contains("ä»å¹´") || text.contains("æ¬å¹´")) { |
| | | return new DateRange(today.withDayOfYear(1), today, "ä»å¹´"); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | return new DateRange(today.withDayOfMonth(1), today, "æ¬æ"); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | LocalDate first = today.minusMonths(1).withDayOfMonth(1); |
| | | LocalDate last = first.withDayOfMonth(first.lengthOfMonth()); |
| | | return new DateRange(first, last, "䏿"); |
| | | } |
| | | if (text.contains("è¿åå¹´") || text.contains("æè¿åå¹´")) { |
| | | return new DateRange(today.minusMonths(6).plusDays(1), today, "è¿åå¹´"); |
| | | } |
| | | if (text.contains("è¿å个æ") || text.contains("æè¿å个æ") || text.contains("å个æ")) { |
| | | return new DateRange(today.minusDays(14), today, "è¿å个æ"); |
| | | } |
| | | java.util.regex.Matcher relativeMatcher = java.util.regex.Pattern.compile("(è¿|æè¿)(\\d+)(天|å¨|个æ|æ|å¹´)").matcher(text); |
| | | if (relativeMatcher.find()) { |
| | | int amount = Integer.parseInt(relativeMatcher.group(2)); |
| | | String unit = relativeMatcher.group(3); |
| | | LocalDate relativeStart = switch (unit) { |
| | | case "天" -> today.minusDays(Math.max(amount - 1L, 0)); |
| | | case "å¨" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1); |
| | | case "个æ", "æ" -> today.minusMonths(Math.max(amount, 1)).plusDays(1); |
| | | case "å¹´" -> today.minusYears(Math.max(amount, 1)).plusDays(1); |
| | | default -> today.minusDays(29); |
| | | }; |
| | | return new DateRange(relativeStart, today, "è¿" + amount + unit); |
| | | } |
| | | return new DateRange(today.minusDays(29), today, "è¿30天"); |
| | | } |
| | | |
| | | private LocalDate parseLocalDate(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | return LocalDate.parse(text.trim(), DATE_FMT); |
| | | } |
| | | |
| | | private Date toDate(LocalDate localDate) { |
| | | return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private Date toExclusiveEndDate(LocalDate localDate) { |
| | | return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private String formatDate(Date date) { |
| | | if (date == null) { |
| | | return ""; |
| | | } |
| | | return DATE_FMT.format(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); |
| | | } |
| | | |
| | | private boolean tenantMatched(Long dataTenantId, Long userTenantId) { |
| | | if (userTenantId == null) { |
| | | return true; |
| | | } |
| | | return Objects.equals(dataTenantId, userTenantId); |
| | | } |
| | | |
| | | private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, com.baomidou.mybatisplus.core.toolkit.support.SFunction<T, Long> field) { |
| | | if (tenantId != null) { |
| | | wrapper.eq(field, tenantId); |
| | | } |
| | | } |
| | | |
| | | private <T> void applyDeptFilter(LambdaQueryWrapper<T> wrapper, Long deptId, com.baomidou.mybatisplus.core.toolkit.support.SFunction<T, Long> field) { |
| | | if (deptId != null) { |
| | | wrapper.eq(field, deptId); |
| | | } |
| | | } |
| | | |
| | | private LoginUser currentLoginUser(String memoryId) { |
| | | LoginUser loginUser = aiSessionUserContext.get(memoryId); |
| | | if (loginUser != null) { |
| | | return loginUser; |
| | | } |
| | | return SecurityUtils.getLoginUser(); |
| | | } |
| | | |
| | | private int normalizeLimit(Integer limit) { |
| | | if (limit == null || limit <= 0) { |
| | | return DEFAULT_LIMIT; |
| | | } |
| | | return Math.min(limit, MAX_LIMIT); |
| | | } |
| | | |
| | | private String safe(Object value) { |
| | | return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' '); |
| | | } |
| | | |
| | | private <T> List<T> defaultList(List<T> list) { |
| | | return list == null ? List.of() : list; |
| | | } |
| | | |
| | | private String jsonResponse(boolean success, |
| | | String type, |
| | | String description, |
| | | Map<String, Object> summary, |
| | | Map<String, Object> data, |
| | | Map<String, Object> charts) { |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("success", success); |
| | | result.put("type", type); |
| | | result.put("description", description); |
| | | result.put("summary", summary == null ? Map.of() : summary); |
| | | result.put("data", data == null ? Map.of() : data); |
| | | result.put("charts", charts == null ? Map.of() : charts); |
| | | return JSON.toJSONString(result); |
| | | } |
| | | |
| | | private record DateRange(LocalDate start, LocalDate end, String label) { |
| | | } |
| | | |
| | | private static class MaterialRankItem { |
| | | private final String productCategory; |
| | | private final String specificationModel; |
| | | private final String unit; |
| | | private BigDecimal quantity = BigDecimal.ZERO; |
| | | private BigDecimal amount = BigDecimal.ZERO; |
| | | |
| | | private MaterialRankItem(String productCategory, String specificationModel, String unit) { |
| | | this.productCategory = productCategory; |
| | | this.specificationModel = specificationModel; |
| | | this.unit = unit; |
| | | } |
| | | |
| | | private Map<String, Object> toMap() { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("productCategory", productCategory); |
| | | map.put("specificationModel", specificationModel); |
| | | map.put("unit", unit); |
| | | map.put("quantity", quantity); |
| | | map.put("amount", amount); |
| | | return map; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveNodeDto extends ApproveNode { |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveProcessConfigNodeDto extends ApproveProcessConfigNode { |
| | | |
| | | private List<ApproveProcessConfigNode> approveProcessConfigNodes; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveGetAndUpdateVo { |
| | | |
| | | private List<String> tempFileIds; |
| | | //审æ¹id |
| | | @NotBlank(message = "æµç¨ç¼å·ä¸è½ä¸ºç©º") |
| | | private String id; |
| | | //ç³è¯·äºç± |
| | | @NotBlank(message = "ç³è¯·äºç±ä¸è½ä¸ºç©º") |
| | | private String approveReason; |
| | | |
| | | private String approveUserIds; |
| | | |
| | | private String approveDeptName; |
| | | |
| | | private Long approveUser; |
| | | |
| | | private String approveTime; |
| | | |
| | | private Integer approveStatus; |
| | | |
| | | @Excel(name = "å¼å§æ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Schema(description = "å¼å§æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Excel(name = "ç»ææ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Schema(description = "ç»ææ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | private BigDecimal price; |
| | | |
| | | private String location; |
| | | /** |
| | | * 审æ¹ç±»å |
| | | */ |
| | | private Integer approveType; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOS; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ApproveProcessConfigNodeVo extends ApproveProcessConfigNode { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveProcessVO { |
| | | /** |
| | | * ä¸´æ¶æä»¶idå表 |
| | | */ |
| | | private List<String> tempFileIds; |
| | | /** |
| | | * å®¡æ¹æµç¨id |
| | | */ |
| | | private Long id; |
| | | |
| | | private String approveId; |
| | | /** |
| | | * 审æ¹é¨é¨id |
| | | */ |
| | | private Long approveDeptId; |
| | | /** |
| | | * å®¡æ¹æ¶é´ |
| | | */ |
| | | private String approveTime; |
| | | /** |
| | | * ç³è¯·äººid |
| | | */ |
| | | // ç³è¯·äºº |
| | | private Long approveUser; |
| | | /** |
| | | * 审æ¹äººidå表 |
| | | */ |
| | | // 审æ¹äºº |
| | | private String approveUserIds; |
| | | /** |
| | | * 审æ¹çç± |
| | | */ |
| | | private String approveReason; |
| | | |
| | | @Excel(name = "å¼å§æ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Schema(description = "å¼å§æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Excel(name = "ç»ææ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Schema(description = "ç»ææ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | private BigDecimal price; |
| | | |
| | | private String location; |
| | | |
| | | /** |
| | | * 审æ¹ç±»å |
| | | */ |
| | | private Integer approveType; |
| | | /** |
| | | * è®¾å¤æ¥ä¿®id |
| | | */ |
| | | private Long deviceRepairId; |
| | | /** |
| | | * æ¥ä¿®éé¢ |
| | | */ |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOList; |
| | | } |
| | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | @Api(tags = "审æ¹è®°å½") |
| | | @Tag(name = "审æ¹è®°å½") |
| | | @RestController |
| | | @RequestMapping("/approveNode") |
| | | @AllArgsConstructor |
| | | public class ApproveNodeController { |
| | | @Autowired |
| | | |
| | | private IApproveNodeService approveNodeService; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/details/{id}") |
| | | @ApiOperation(value = "æµç¨ç¶æè¯¦æ
") |
| | | @Operation(summary = "æµç¨ç¶æè¯¦æ
") |
| | | public AjaxResult details(@PathVariable String id) { |
| | | return AjaxResult.success(approveNodeService.details(id)); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/updateApproveNode") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "审æ¹èç¹") |
| | | @Operation(summary = "审æ¹èç¹") |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | approveNodeService.updateApproveNode(approveNode); |
| | | return AjaxResult.success(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import com.ruoyi.approve.service.ApproveProcessConfigNodeService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æµç¨é
ç½®èç¹è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-23 10:21:41 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approveProcessConfigNode") |
| | | @AllArgsConstructor |
| | | public class ApproveProcessConfigNodeController { |
| | | |
| | | private final ApproveProcessConfigNodeService approveProcessConfigNodeService; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¡æ¹ä¸é¢çèç¹ |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public R listNode(Integer type) { |
| | | return R.ok(approveProcessConfigNodeService.listNode(type)); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å 审æ¹èç¹ |
| | | * @param approveProcessConfigNodes |
| | | * @return |
| | | */ |
| | | @ApiOperation("æ·»å 审æ¹èç¹") |
| | | @PostMapping("/add") |
| | | public R addApproveProcessConfigNodes(@RequestBody List<ApproveProcessConfigNode> approveProcessConfigNodes) { |
| | | return R.ok(approveProcessConfigNodeService.addApproveProcessConfigNodes(approveProcessConfigNodes)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/approveProcess") |
| | | @Api(tags = "审æ¹") |
| | | @AllArgsConstructor |
| | | @Tag(name = "审æ¹") |
| | | public class ApproveProcessController { |
| | | |
| | | @GetMapping("/test") |
| | | public AjaxResult test() { |
| | | System.out.println(1111); |
| | | return AjaxResult.success("æµè¯"); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private IApproveProcessService approveProcessService; |
| | | /**ã |
| | | * è·åé¨é¨å表 |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "æ·»å 审æ¹") |
| | | @Operation(summary = "æ·»å 审æ¹") |
| | | public AjaxResult add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | if (approveProcessVO == null) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/get") |
| | | @ApiOperation(value = "审æ¹è¯¦æ
") |
| | | @Operation(summary = "审æ¹è¯¦æ
") |
| | | public AjaxResult get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | if (approveGetAndUpdateVo.getId() == null || approveGetAndUpdateVo.getId().isEmpty()) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "æ´æ°å®¡æ¹") |
| | | @Operation(summary = "æ´æ°å®¡æ¹") |
| | | public AjaxResult update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | if (approveGetAndUpdateVo == null) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "è·å审æ¹å表") |
| | | @Operation(summary = "è·å审æ¹å表") |
| | | public AjaxResult list(Page page, ApproveProcess approveProcess) { |
| | | return AjaxResult.success(approveProcessService.listAll(page, approveProcess)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteIds") |
| | | @ApiOperation(value = "å é¤å®¡æ¹") |
| | | @Operation(summary = "å é¤å®¡æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult deleteIds(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.size() == 0) { |
| | |
| | | return AjaxResult.success("æä½æå"); |
| | | } |
| | | |
| | | @ApiOperation(value = "å
¬åºç®¡ç导åº") |
| | | @Operation(summary = "å
¬åºç®¡ç导åº") |
| | | @PostMapping("/exportOne") |
| | | public void exportOne(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "å
¬åºç®¡ç导åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "请å管ç导åº") |
| | | @Operation(summary = "请å管ç导åº") |
| | | @PostMapping("/exportTwo") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "请å管ç导åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "åºå·®ç®¡ç导åº") |
| | | @Operation(summary = "åºå·®ç®¡ç导åº") |
| | | @PostMapping("/exportThree") |
| | | public void exportThree(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "åºå·®ç®¡ç导åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥é管ç导åº") |
| | | @Operation(summary = "æ¥é管ç导åº") |
| | | @PostMapping("/exportFour") |
| | | public void exportFour(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "æ¥é管ç导åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "éè´ç³è¯·å¯¼åº") |
| | | @Operation(summary = "éè´ç³è¯·å¯¼åº") |
| | | @PostMapping("/exportFive") |
| | | public void exportFive(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "éè´ç³è¯·å¯¼åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "åå审æ¹å¯¼åº") |
| | | @Operation(summary = "åå审æ¹å¯¼åº") |
| | | @PostMapping("/exportZero") |
| | | public void exportZero(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | util.exportExcel(response, accountExpenses, "åå审æ¹å¯¼åº"); |
| | | } |
| | | |
| | | @ApiOperation(value = "å±é©ä½ä¸å®¡æ¹å¯¼åº") |
| | | @Operation(summary = "å±é©ä½ä¸å®¡æ¹å¯¼åº") |
| | | @PostMapping("/exportEight") |
| | | public void exportEight(HttpServletResponse response) { |
| | | List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | |
| | | @RequestMapping("/holidaySettings") |
| | | @AllArgsConstructor |
| | | public class HolidaySettingsController { |
| | | @Autowired |
| | | private HolidaySettingsService holidaySettingsService; |
| | | @Autowired |
| | | private AnnualLeaveSettingMapper annualLeaveSettingMapper; |
| | | @Autowired |
| | | private OvertimeSettingMapper overtimeSettingMapper; |
| | | @Autowired |
| | | private WorkingHoursSettingMapper workingHoursSettingMapper; |
| | | |
| | | /**ã |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.mapper.KnowledgeBaseMapper; |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.approve.pojo.RpaProcessAutomation; |
| | | import com.ruoyi.approve.service.KnowledgeBaseService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/knowledgeBase") |
| | | @AllArgsConstructor |
| | | @Api(tags = "ç¥è¯åºç®¡ç") |
| | | @Tag(name = "ç¥è¯åºç®¡ç") |
| | | public class KnowledgeBaseController { |
| | | @Autowired |
| | | private KnowledgeBaseService knowledgeBaseService; |
| | | |
| | | /**ã |
| | |
| | | return AjaxResult.success(knowledgeBaseService.removeByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ç¥è¯åºç®¡ç导åº") |
| | | @Operation(summary = "ç¥è¯åºç®¡ç导åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<KnowledgeBase> accountExpenses = knowledgeBaseService.list(); |
| | |
| | | @RequestMapping("/notificationManagement") |
| | | @AllArgsConstructor |
| | | public class NotificationManagementController { |
| | | @Autowired |
| | | private NotificationManagementService notificationManagementService ; |
| | | @Autowired |
| | | private OnlineMeetingMapper onlineMeetingMapper; |
| | | @Autowired |
| | | private FileSharingMapper fileSharingMapper; |
| | | /**ã |
| | | * è·åå表 |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.pojo.RpaProcessAutomation; |
| | | import com.ruoyi.approve.service.RpaProcessAutomationService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/rpaProcessAutomation") |
| | | @AllArgsConstructor |
| | | @Api(tags = "RPAæµç¨èªå¨å") |
| | | @Tag(name = "RPAæµç¨èªå¨å") |
| | | public class RpaProcessAutomationController { |
| | | @Autowired |
| | | private RpaProcessAutomationService rpaProcessAutomationService; |
| | | /**ã |
| | | * è·åå表 |
| | |
| | | return AjaxResult.success(rpaProcessAutomationService.removeByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "RPAæµç¨èªå¨å导åº") |
| | | @Operation(summary = "RPAæµç¨èªå¨å导åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<RpaProcessAutomation> accountExpenses = rpaProcessAutomationService.list(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æµç¨é
ç½®èç¹è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-23 10:21:41 |
| | | */ |
| | | @Mapper |
| | | public interface ApproveProcessConfigNodeMapper extends BaseMapper<ApproveProcessConfigNode> { |
| | | |
| | | } |
| | |
| | | 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.approve.vo.ApproveProcessVo; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | @Mapper |
| | | public interface ApproveProcessMapper extends BaseMapper<ApproveProcess> { |
| | | |
| | | IPage<ApproveProcess> listPage(Page page,@Param("req") ApproveProcess approveProcess); |
| | | IPage<ApproveProcessVo> listPage(Page page, @Param("req") ApproveProcess approveProcess); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | */ |
| | | private String approveRemark; |
| | | |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 审æ¹èç¹è¡¨ |
| | |
| | | */ |
| | | @Data |
| | | @TableName("approve_node") |
| | | @ApiModel |
| | | @Schema |
| | | public class ApproveNode{ |
| | | |
| | | |
| | | @ApiModelProperty("éä»¶id") |
| | | @Schema(description = "éä»¶id") |
| | | @TableField(exist = false) |
| | | private List<String> tempFileIds; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("éä»¶å表") |
| | | @Schema(description = "éä»¶å表") |
| | | private String url; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | */ |
| | | private Long id; |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | } |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOS; |
| | | } |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import java.io.Serializable; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * å®¡æ¹æµç¨è¡¨ |
| | |
| | | */ |
| | | @Data |
| | | @TableName("approve_process") |
| | | @ApiModel |
| | | @Schema |
| | | public class ApproveProcess{ |
| | | /** |
| | | * |
| | |
| | | /** |
| | | * æµç¨ç¼å· |
| | | */ |
| | | @ApiModelProperty(value = "æµç¨ç¼å·") |
| | | @Schema(description = "æµç¨ç¼å·") |
| | | @Excel(name = "æµç¨ç¼å·") |
| | | private String approveId; |
| | | |
| | |
| | | /** |
| | | * ç³è¯·äººåç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç³è¯·äººåç§°") |
| | | @Schema(description = "ç³è¯·äººåç§°") |
| | | @Excel(name = "ç³è¯·äºº") |
| | | private String approveUserName; |
| | | |
| | |
| | | /** |
| | | * ç³è¯·é¨é¨åç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç³è¯·é¨é¨åç§°") |
| | | @Schema(description = "ç³è¯·é¨é¨åç§°") |
| | | @Excel(name = "ç³è¯·é¨é¨") |
| | | private String approveDeptName; |
| | | |
| | |
| | | /** |
| | | * ç³è¯·åå |
| | | */ |
| | | @ApiModelProperty(value = "ç³è¯·åå ") |
| | | @Schema(description = "ç³è¯·åå ") |
| | | @Excel(name = "审æ¹äºç±") |
| | | private String approveReason; |
| | | |
| | |
| | | /** |
| | | * å½å审æ¹ç¨æ·åç§° |
| | | */ |
| | | @ApiModelProperty(value = "å½å审æ¹äºº") |
| | | @Schema(description = "å½å审æ¹äºº") |
| | | @Excel(name = "å½å审æ¹äºº") |
| | | private String approveUserCurrentName; |
| | | |
| | |
| | | * ç³è¯·æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "ç³è¯·æ¥æ") |
| | | @Schema(description = "ç³è¯·æ¥æ") |
| | | @Excel(name = "ç³è¯·æ¥æ" ,dateFormat = "yyyy-MM-dd") |
| | | private Date approveTime; |
| | | |
| | |
| | | * 审æ¹å®ææ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "审æ¹å®ææ¶é´") |
| | | @Schema(description = "审æ¹å®ææ¶é´") |
| | | @Excel(name = "ç»ææ¥æ" ,dateFormat = "yyyy-MM-dd") |
| | | private Date approveOverTime; |
| | | |
| | | /** |
| | | * 审æ¹ç¶æï¼0å¾
å®¡æ ¸ï¼1å®¡æ ¸ä¸ï¼2å®¡æ ¸å®æ 3å®¡æ ¸æªéè¿ 4已鿰æäº¤ |
| | | */ |
| | | @ApiModelProperty(value = "审æ¹ç¶æï¼0å¾
å®¡æ ¸ï¼1å®¡æ ¸ä¸ï¼2å®¡æ ¸å®æ 3å®¡æ ¸æªéè¿ 4已鿰æäº¤") |
| | | @Schema(description = "审æ¹ç¶æï¼0å¾
å®¡æ ¸ï¼1å®¡æ ¸ä¸ï¼2å®¡æ ¸å®æ 3å®¡æ ¸æªéè¿ 4已鿰æäº¤") |
| | | @Excel(name = "审æ¹ç¶æ", readConverterExp = "0=å¾
å®¡æ ¸,1=å®¡æ ¸ä¸,2=å®¡æ ¸å®æ,3=å®¡æ ¸æªéè¿,4=已鿰æäº¤") |
| | | private Integer approveStatus; |
| | | |
| | |
| | | /** |
| | | * 审æ¹å¤æ³¨ |
| | | */ |
| | | @ApiModelProperty(value = "审æ¹å¤æ³¨") |
| | | @Schema(description = "审æ¹å¤æ³¨") |
| | | private String approveRemark; |
| | | |
| | | @Excel(name = "å¼å§æ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | @Schema(description = "å¼å§æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Excel(name = "ç»ææ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | @Schema(description = "ç»ææ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobVO> storageBlobVOS; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æµç¨é
ç½®èç¹è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-23 10:21:41 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approve_process_config_node") |
| | | @ApiModel(value = "ApproveProcessConfigNode对象", description = "å®¡æ¹æµç¨é
ç½®èç¹è¡¨") |
| | | public class ApproveProcessConfigNode implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @ApiModelProperty("主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | |
| | | |
| | | // '审æ¹ç±»åï¼1å
¬åºç®¡çï¼2请å管çï¼3åºå·®ç®¡çï¼4æ¥é管çï¼5éè´å®¡æ¹ï¼6æ¥ä»·å®¡æ¹ï¼7å货审æ¹ï¼8å±é©ä½ä¸å®¡æ¹', |
| | | @ApiModelProperty("审æ¹ç±»åï¼1å
¬åºç®¡çï¼2请å管çï¼3åºå·®ç®¡çï¼4æ¥é管çï¼5éè´å®¡æ¹ï¼6æ¥ä»·å®¡æ¹ï¼7å货审æ¹ï¼8å±é©ä½ä¸å®¡æ¹") |
| | | private Integer approveType; |
| | | /** |
| | | * èç¹é¡ºåº |
| | | */ |
| | | @ApiModelProperty("èç¹é¡ºåº") |
| | | private Integer nodeOrder; |
| | | |
| | | |
| | | /** |
| | | * 审æ¹äººIDsï¼å¤ä¸ªç¨éå·åéï¼ |
| | | */ |
| | | @ApiModelProperty("审æ¹äººID") |
| | | private Long approverId; |
| | | |
| | | /** |
| | | * 审æ¹äººåç§° |
| | | */ |
| | | @ApiModelProperty("审æ¹äººåç§°") |
| | | private String approverName; |
| | | |
| | | |
| | | /** |
| | | * è¶
æ¶æ¶é¿ï¼å°æ¶ï¼ |
| | | */ |
| | | @ApiModelProperty("è¶
æ¶æ¶é¿ï¼å°æ¶ï¼") |
| | | private Integer timeoutHours; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @ApiModelProperty("ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * åå»ºç¨æ·ID |
| | | */ |
| | | @ApiModelProperty("åå»ºç¨æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·ID |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹ç¨æ·ID") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å 餿 è®°ï¼0æ£å¸¸ï¼1å é¤ |
| | | */ |
| | | @ApiModelProperty("å 餿 è®°ï¼0æ£å¸¸ï¼1å é¤") |
| | | private Boolean deleteFlag; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessConfigNodeVo; |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æµç¨é
ç½®èç¹è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-23 10:21:41 |
| | | */ |
| | | public interface ApproveProcessConfigNodeService extends IService<ApproveProcessConfigNode> { |
| | | |
| | | List<ApproveProcessConfigNodeVo> listNode(Integer type); |
| | | |
| | | Boolean addApproveProcessConfigNodes(List<ApproveProcessConfigNode> approveProcessConfigNodes); |
| | | } |
| | |
| | | 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.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.vo.ApproveProcessVo; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | public interface IApproveProcessService extends IService<ApproveProcess> { |
| | |
| | | */ |
| | | List<SysDept> selectDeptListByDeptIds(Long[] deptIds); |
| | | |
| | | IPage<ApproveProcess> listAll(Page page, ApproveProcess approveProcess); |
| | | IPage<ApproveProcessVo> listAll(Page page, ApproveProcess approveProcess); |
| | | |
| | | void delApprove(List<Long> ids); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.service.impl.PurchaseLedgerServiceImpl; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardParamMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | //@RequiredArgsConstructor |
| | | @RequiredArgsConstructor |
| | | public class ApproveNodeServiceImpl extends ServiceImpl<ApproveNodeMapper, ApproveNode> implements IApproveNodeService { |
| | | |
| | | @Autowired |
| | | private ApproveNodeMapper approveNodeMapper; |
| | | @Autowired |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper fileMapper; |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | @Autowired |
| | | private SalesQuotationMapper salesQuotationMapper; |
| | | |
| | | @Autowired |
| | | private ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerServiceImpl purchaseLedgerServiceImpl; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final CommonFileMapper fileMapper; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final StockUtils stockUtils; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | private final FileUtil fileUtil; |
| | | |
| | | |
| | | public ApproveProcess getApproveById(String id) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void initApproveNodes(String approveUserIds,String approveID,Long tenantId) { |
| | | public void initApproveNodes(String approveUserIds, String approveID, Long tenantId) { |
| | | Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); |
| | | String[] names = approveUserIds.split(","); |
| | | for (int i = 0; i < names.length; i++) { |
| | |
| | | if (sysUser == null) continue; |
| | | ApproveNode approveNode = new ApproveNode(); |
| | | approveNode.setApproveProcessId(approveID); |
| | | approveNode.setApproveNodeOrder(i +1); |
| | | approveNode.setApproveNodeOrder(i + 1); |
| | | approveNode.setApproveNodeUser(sysUser.getNickName()); |
| | | approveNode.setApproveNodeUserId(sysUser.getUserId()); |
| | | approveNode.setApproveNodeTime(new Date()); |
| | |
| | | // .eq(ApproveProcess::getApproveStatus, 0) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess != null && approveProcess.getApproveStatus() == 3){ |
| | | if (approveProcess != null && approveProcess.getApproveStatus() == 3) { |
| | | return list; |
| | | } |
| | | for (ApproveNode approveNode : list) { |
| | | List<CommonFile> commonFiles = fileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, approveNode.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveNode.getValue())); |
| | | if(!CollectionUtils.isEmpty(commonFiles)){ |
| | | if (!CollectionUtils.isEmpty(commonFiles)) { |
| | | approveNode.setUrl(commonFiles.get(0).getUrl()); |
| | | } |
| | | if(approveNode.getApproveNodeStatus() == 1){ |
| | | if (approveNode.getApproveNodeStatus() == 1) { |
| | | continue; |
| | | } |
| | | approveNode.setIsShen(true); |
| | |
| | | return list; |
| | | } |
| | | |
| | | public void updateApproveProcessStatus(ApproveNode approveNode,Integer status) throws IOException { |
| | | public void updateApproveProcessStatus(ApproveNode approveNode, Integer status) throws IOException { |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess == null) throw new RuntimeException("审æ¹ä¸åå¨"); |
| | | if (approveProcess == null) throw new RuntimeException("审æ¹ä¸åå¨"); |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveNode::getApproveNodeOrder, approveNode.getApproveNodeOrder() + 1) |
| | |
| | | .last("limit 1"); |
| | | ApproveNode approveNode1 = approveNodeMapper.selectOne(approveNodeLambdaQueryWrapper); |
| | | approveProcess.setApproveStatus(status); |
| | | if(approveNode1 != null){ |
| | | if (approveNode1 != null) { |
| | | approveProcess.setApproveUserCurrentId(approveNode1.getApproveNodeUserId()); |
| | | approveProcess.setApproveUserCurrentName(approveNode1.getApproveNodeUser()); |
| | | } |
| | | if(approveProcess.getApproveStatus().equals(2) || approveProcess.getApproveStatus().equals(3) || approveProcess.getApproveStatus().equals(4)){ |
| | | if (approveProcess.getApproveStatus().equals(2) || approveProcess.getApproveStatus().equals(3) || approveProcess.getApproveStatus().equals(4)) { |
| | | approveProcess.setApproveOverTime(new Date()); |
| | | } |
| | | approveProcessMapper.updateById(approveProcess); |
| | | |
| | | DeviceRepair deviceRepair = deviceRepairMapper.selectById(approveProcess.getDeviceRepairId()); |
| | | if(ObjectUtils.isNotNull(deviceRepair)) { |
| | | if(approveProcess.getApproveStatus().equals(2)){ |
| | | // åæ |
| | | deviceRepair.setStatus(1); |
| | | }else if(approveProcess.getApproveStatus().equals(3)){ |
| | | // æç» |
| | | deviceRepair.setStatus(2); |
| | | } |
| | | deviceRepairMapper.updateById(deviceRepair); |
| | | } |
| | | |
| | | //éè´å®¡æ ¸ |
| | | if(approveProcess.getApproveType().equals(5)){ |
| | | if (approveProcess.getApproveType().equals(5)) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcess.getApproveReason()) |
| | | .last("limit 1")); |
| | | if(purchaseLedger != null) { |
| | | if (purchaseLedger != null) { |
| | | if (status.equals(2)) { |
| | | // åæ |
| | | purchaseLedger.setApprovalStatus(3); |
| | |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | // è´¨æ£ |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | }else { |
| | | addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId()); |
| | | } |
| | |
| | | } |
| | | } |
| | | // é宿¥ä»·ç¶æä¿®æ¹ |
| | | if(approveProcess.getApproveType().equals(6)){ |
| | | if (approveProcess.getApproveType().equals(6)) { |
| | | SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getQuotationNo, approveProcess.getApproveReason()) |
| | | .last("limit 1")); |
| | | // åæ |
| | | if(status.equals(2) && salesQuote != null){ |
| | | if (status.equals(2) && salesQuote != null) { |
| | | salesQuote.setStatus("éè¿"); |
| | | }else if(status.equals(3) && salesQuote != null){ |
| | | } else if (status.equals(3) && salesQuote != null) { |
| | | salesQuote.setStatus("æç»"); |
| | | }else if(status.equals(1) && salesQuote != null){ |
| | | } else if (status.equals(1) && salesQuote != null) { |
| | | salesQuote.setStatus("å®¡æ ¸ä¸"); |
| | | } |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | // åºåºå®¡æ¹ä¿®æ¹ |
| | | if(approveProcess.getApproveType().equals(7)){ |
| | | if (approveProcess.getApproveType().equals(7)) { |
| | | String[] split = approveProcess.getApproveReason().split(":"); |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, split[1]) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if(shippingInfo != null){ |
| | | if(status.equals(2)){ |
| | | if (shippingInfo != null) { |
| | | if (status.equals(2)) { |
| | | shippingInfo.setStatus("å®¡æ ¸éè¿"); |
| | | }else if(status.equals(3)){ |
| | | } else if (status.equals(3)) { |
| | | shippingInfo.setStatus("å®¡æ ¸æç»"); |
| | | }else if(status.equals(1)){ |
| | | } else if (status.equals(1)) { |
| | | shippingInfo.setStatus("å®¡æ ¸ä¸"); |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | |
| | | } |
| | | // ç»å®éä»¶ |
| | | if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){ |
| | | tempFileService.migrateTempFilesToFormal(approveNode.getId(), approveNode.getTempFileIds(), FileNameType.ApproveNode.getValue()); |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_NODE, approveNode.getId(), approveNode.getStorageBlobDTOS()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateApproveNode(ApproveNode approveNode) throws IOException { |
| | | // 审æ¹èç¹ç¶æ:1åæï¼2æç»ï¼0å°æªå®¡æ ¸ |
| | | switch (approveNode.getApproveNodeStatus()){ |
| | | switch (approveNode.getApproveNodeStatus()) { |
| | | case 1: |
| | | updateApproveProcessStatus(approveNode, Boolean.TRUE.equals(approveNode.getIsLast()) ? 2 : 1); |
| | | /*æ¶æ¯éç¥*/ |
| | | Integer nodeOrder = approveNode.getApproveNodeOrder(); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectList(Wrappers.<ApproveProcess>lambdaQuery() |
| | | .eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId())).get(0); |
| | | if (approveProcess.getApproveUserIds().split(",").length > nodeOrder){ |
| | | if (approveProcess.getApproveUserIds().split(",").length > nodeOrder) { |
| | | String id = approveProcess.getApproveUserIds().split(",")[nodeOrder]; |
| | | if (approveProcess.getApproveType()==8){ |
| | | if (approveProcess.getApproveType() == 8) { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | } else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | |
| | | } |
| | | |
| | | //审æ¹ç±»åè·å(ä¸å端页é¢å¯¹åº) |
| | | private String approveProcessType(Integer approveType){ |
| | | switch (approveType){ |
| | | private String approveProcessType(Integer approveType) { |
| | | switch (approveType) { |
| | | case 1: |
| | | return "å
¬åºç®¡ç"; |
| | | case 2: |
| | |
| | | return "å货审æ¹"; |
| | | case 8: |
| | | return "å±é©ä½ä¸å®¡æ¹"; |
| | | case 9: |
| | | return "åå
¬ç¨å审æ¹"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getProductId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null); |
| | | if (qualityTestStandard.size() > 0) { |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId())) |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessConfigNodeVo; |
| | | import com.ruoyi.approve.mapper.ApproveProcessConfigNodeMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import com.ruoyi.approve.service.ApproveProcessConfigNodeService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æµç¨é
ç½®èç¹è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-23 10:21:41 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApproveProcessConfigNodeServiceImpl extends ServiceImpl<ApproveProcessConfigNodeMapper, ApproveProcessConfigNode> implements ApproveProcessConfigNodeService { |
| | | |
| | | private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper; |
| | | @Override |
| | | public List<ApproveProcessConfigNodeVo> listNode(Integer type) { |
| | | List<ApproveProcessConfigNode> approveProcessConfigNodes = approveProcessConfigNodeMapper.selectList(new QueryWrapper<ApproveProcessConfigNode>().lambda().eq(ApproveProcessConfigNode::getApproveType, type).orderByAsc(ApproveProcessConfigNode::getNodeOrder)); |
| | | return approveProcessConfigNodes.stream() |
| | | .map(node -> { |
| | | ApproveProcessConfigNodeVo vo = new ApproveProcessConfigNodeVo(); |
| | | BeanUtils.copyProperties(node, vo); |
| | | return vo; |
| | | }) |
| | | .collect(java.util.stream.Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addApproveProcessConfigNodes(List<ApproveProcessConfigNode> approveProcessConfigNodes) { |
| | | //å 餿§æ°æ® |
| | | approveProcessConfigNodeMapper.delete(new QueryWrapper<ApproveProcessConfigNode>().lambda().eq(ApproveProcessConfigNode::getApproveType, approveProcessConfigNodes.get(0).getApproveType())); |
| | | //æ°å¢ æ°æ® |
| | | approveProcessConfigNodeMapper.insert(approveProcessConfigNodes); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | 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.approve.bean.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessConfigNodeVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessConfigNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import com.ruoyi.approve.service.ApproveProcessConfigNodeService; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.utils.DailyRedisCounter; |
| | | import com.ruoyi.approve.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.vo.ApproveProcessVo; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | //@RequiredArgsConstructor |
| | | @RequiredArgsConstructor |
| | | public class ApproveProcessServiceImpl extends ServiceImpl<ApproveProcessMapper, ApproveProcess> implements IApproveProcessService { |
| | | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | @Autowired |
| | | private DailyRedisCounter dailyRedisCounter; |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Autowired |
| | | private IApproveNodeService approveNodeService; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final IApproveNodeService approveNodeService; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final CommonFileMapper commonFileMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveProcessConfigNodeService approveProcessConfigNodeService; |
| | | private final FileUtil fileUtil; |
| | | private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper; |
| | | |
| | | @Override |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | | SysUser sysUser = sysUserMapper.selectUserById(approveProcessVO.getApproveUser()); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(approveProcessVO.getApproveDeptId()); |
| | | String[] split = approveProcessVO.getApproveUserIds().split(","); |
| | | List<Long> longList = Arrays.stream(split) |
| | | .map(Long::valueOf) // å°æ¯ä¸ª String 转æ¢ä¸º Long |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(SecurityUtils.getLoginUser().getCurrentDeptId()); |
| | | List<ApproveProcessConfigNodeVo> list = approveProcessConfigNodeService.listNode(approveProcessVO.getApproveType()); |
| | | List<Long> nodeIds = list.stream() |
| | | .map(ApproveProcessConfigNodeVo::getApproverId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(longList); |
| | | if (list.isEmpty()) { |
| | | throw new RuntimeException("æµç¨ä¸åå¨"); |
| | | } |
| | | if (CollectionUtils.isEmpty(nodeIds)) { |
| | | autoPassPurchaseApproveIfNoApprover(approveProcessVO); |
| | | return; |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(nodeIds); |
| | | if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | if (sysDept == null) throw new RuntimeException("é¨é¨ä¸åå¨"); |
| | | if (sysUser == null) throw new RuntimeException("ç³è¯·äººä¸åå¨"); |
| | | String today = LocalDate.now().format(DATE_FORMAT); |
| | | Long approveId = dailyRedisCounter.incrementAndGetByDb(); |
| | | String formattedCount = String.format("%03d", approveId); |
| | | //æµç¨ ID |
| | | String approveID = today + formattedCount; |
| | | // String today = LocalDate.now().format(DATE_FORMAT); |
| | | // Long approveId = dailyRedisCounter.incrementAndGetByDb(); |
| | | // String formattedCount = String.format("%03d", approveId); |
| | | // //æµç¨ ID |
| | | // String approveID = today + formattedCount; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | approveProcess.setApproveId(approveID); |
| | | approveProcess.setApproveUser(approveProcessVO.getApproveUser()); |
| | | String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id"); |
| | | approveProcess.setApproveId(no); |
| | | approveProcess.setApproveUser(sysUser.getUserId()); |
| | | approveProcess.setApproveUserName(sysUser.getNickName()); |
| | | approveProcess.setApproveDeptId(approveProcessVO.getApproveDeptId()); |
| | | approveProcess.setApproveDeptId(sysDept.getDeptId()); |
| | | approveProcess.setApproveUserIds(nodeIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveDeptName(sysDept.getDeptName()); |
| | | approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? null : dateFormat.parse(approveProcessVO.getApproveTime())); |
| | | approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? new Date() : dateFormat.parse(approveProcessVO.getApproveTime())); |
| | | approveProcess.setApproveReason(approveProcessVO.getApproveReason()); |
| | | approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId()); |
| | | approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice()); |
| | |
| | | approveProcess.setApproveType(approveProcessVO.getApproveType()); |
| | | approveProcess.setCreateTime(LocalDateTime.now()); |
| | | approveProcess.setTenantId(approveProcessVO.getApproveDeptId()); |
| | | approveProcess.setApproveUserIds(approveProcessVO.getApproveUserIds()); |
| | | approveProcess.setApproveUserCurrentId(longList.get(0)); |
| | | approveProcess.setApproveUserCurrentId(nodeIds.get(0)); |
| | | approveProcess.setApproveUserCurrentName(sysUsers |
| | | .stream() |
| | | .filter(SysUser -> SysUser.getUserId().equals(longList.get(0))) |
| | | .filter(SysUser -> SysUser.getUserId().equals(nodeIds.get(0))) |
| | | .collect(Collectors.toList()) |
| | | .get(0) |
| | | .getNickName()); |
| | |
| | | } |
| | | save(approveProcess); |
| | | //åå§å审æ¹èç¹ |
| | | approveNodeService.initApproveNodes(approveProcessVO.getApproveUserIds(), approveID, approveProcessVO.getApproveDeptId()); |
| | | String nodeIdStr = nodeIds.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | approveNodeService.initApproveNodes(nodeIdStr, no, approveProcessVO.getApproveDeptId()); |
| | | // éä»¶ç»å® |
| | | tempFileService.migrateTempFilesToFormal(approveProcess.getId(), approveProcessVO.getTempFileIds(), FileNameType.ApproveProcess.getValue()); |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOList()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approveProcessVO.getApproveUserIds().split(",")[0]; |
| | | if (approveProcess.getApproveType()==8){ |
| | | Long id = nodeIds.getFirst(); |
| | | if (approveProcess.getApproveType() == 8) { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | } else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | | |
| | | private void autoPassPurchaseApproveIfNoApprover(ApproveProcessVO approveProcessVO) { |
| | | if (!Objects.equals(approveProcessVO.getApproveType(), 5) |
| | | || !StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | } |
| | | purchaseLedgerMapper.update(null, new LambdaUpdateWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason()) |
| | | .set(PurchaseLedger::getApprovalStatus, 3)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return sysDeptList; |
| | | } |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | @Autowired |
| | | private ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | @Override |
| | | public IPage<ApproveProcess> listAll(Page page, ApproveProcess approveProcess) { |
| | | IPage<ApproveProcess> approveProcessIPage = approveProcessMapper.listPage(page, approveProcess); |
| | | List<ApproveProcess> records = approveProcessIPage.getRecords(); |
| | | public IPage<ApproveProcessVo> listAll(Page page, ApproveProcess approveProcess) { |
| | | IPage<ApproveProcessVo> approveProcessIPage = approveProcessMapper.listPage(page, approveProcess); |
| | | List<ApproveProcessVo> records = approveProcessIPage.getRecords(); |
| | | |
| | | for (ApproveProcess record : records) { |
| | | for (ApproveProcessVo record : records) { |
| | | List<CommonFile> allFiles = new ArrayList<>(); |
| | | |
| | | // éè´å®¡æ¹æ¥è¯¢ |
| | |
| | | } |
| | | |
| | | record.setCommonFileList(allFiles); |
| | | record.setStorageBlobVOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.APPROVE_PROCESS, record.getId())); |
| | | } |
| | | return approveProcessIPage; |
| | | } |
| | |
| | | |
| | | // å é¤å¯¹åºçæ¶æ¯éç¥ |
| | | sysNoticeService.remove(new LambdaQueryWrapper<SysNotice>() |
| | | .eq(SysNotice::getNoticeTitle, approveProcessType(latestProcess.getApproveType())) |
| | | .eq(SysNotice::getSenderId, latestProcess.getApproveUser()) |
| | | .apply("CAST(notice_content AS CHAR) LIKE CONCAT('%', {0}, '%')", latestProcess.getApproveId())); |
| | | .eq(SysNotice::getNoticeTitle, approveProcessType(latestProcess.getApproveType())) |
| | | .eq(SysNotice::getSenderId, latestProcess.getApproveUser()) |
| | | .apply("CAST(notice_content AS CHAR) LIKE CONCAT('%', {0}, '%')", latestProcess.getApproveId())); |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public ApproveProcess getApproveById(String id) { |
| | | ApproveProcess one = approveProcessMapper.selectList(Wrappers.<ApproveProcess>lambdaQuery() |
| | | .eq(ApproveProcess::getApproveId,id) |
| | | .eq(ApproveProcess::getApproveDelete,0)).get(0); |
| | | one.setCommonFileList(commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, one.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue()))); |
| | | .eq(ApproveProcess::getApproveId, id) |
| | | .eq(ApproveProcess::getApproveDelete, 0)).get(0); |
| | | one.setStorageBlobVOS(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.APPROVE_PROCESS, one.getId())); |
| | | return one; |
| | | } |
| | | |
| | | @Autowired |
| | | private ApproveNodeMapper approveNodeMapper; |
| | | |
| | | // æ¥ä»·å®¡æ¹ç¼è¾å®¡æ ¸äºº |
| | | public void updateApproveUser(ApproveGetAndUpdateVo approveGetAndUpdateVo) { |
| | |
| | | .eq(ApproveProcess::getApproveReason, approveGetAndUpdateVo.getApproveReason()) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | |
| | | if (approveProcess == null) throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | String[] split = approveGetAndUpdateVo.getApproveUserIds().split(","); |
| | | if (split.length == 0) { |
| | | throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(Arrays.asList(split).stream().map(Long::parseLong).collect(Collectors.toList())); |
| | | //æ¥è¯¢å®¡æ¹é
ç½® |
| | | List<ApproveProcessConfigNode> approveProcessConfig = approveProcessConfigNodeMapper.selectList(new LambdaQueryWrapper<ApproveProcessConfigNode>().eq(ApproveProcessConfigNode::getApproveType, approveGetAndUpdateVo.getApproveType())); |
| | | List<Long> configNodeIds = approveProcessConfig.stream() |
| | | .sorted(Comparator.comparing(ApproveProcessConfigNode::getNodeOrder)) |
| | | .map(ApproveProcessConfigNode::getApproverId) |
| | | .collect(Collectors.toList()); |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(configNodeIds); |
| | | if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | //å®¡æ ¸ä¸ä¸å¯ä»¥ç¼è¾å®¡æ ¸äºº |
| | | if (approveProcess.getApproveStatus() != 1) { |
| | | approveProcess.setApproveUserCurrentId(Long.parseLong(split[0])); |
| | | approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(Long.parseLong(split[0]))).collect(Collectors.toList()).get(0).getNickName()); |
| | | approveProcess.setApproveUserCurrentId(configNodeIds.get(0)); |
| | | approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(configNodeIds.get(0))).collect(Collectors.toList()).get(0).getNickName()); |
| | | } |
| | | if (approveGetAndUpdateVo.getApproveStatus() != null) { |
| | | approveProcess.setApproveStatus(approveGetAndUpdateVo.getApproveStatus()); |
| | |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveProcess.getApproveId()) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | // .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder); |
| | | approveNodeMapper.delete(approveNodeLambdaQueryWrapper); |
| | | //æ¥è¯¢å®¡æ¹é
ç½® |
| | | approveGetAndUpdateVo.setApproveUserIds(configNodeIds.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(","))); |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approveProcess.getApproveId(), approveProcess.getTenantId()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approveProcess.getApproveUserIds().split(",")[0]; |
| | | if (approveProcess.getApproveType()==8){ |
| | | Long id = configNodeIds.get(0); |
| | | if (approveProcess.getApproveType() == 8) { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | } else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | |
| | | // approveNodeMapper.updateById(approveNode); |
| | | // i++; |
| | | // } |
| | | tempFileService.migrateTempFilesToFormal(approve.getId(), approveGetAndUpdateVo.getTempFileIds(), FileNameType.ApproveProcess.getValue()); |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approve.getId(), approveGetAndUpdateVo.getStorageBlobDTOS()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approve.getApproveUserIds().split(",")[0]; |
| | | if (approve.getApproveType()==8){ |
| | | if (approve.getApproveType() == 8) { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approve.getApproveType()), |
| | | approve.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approve.getApproveType() + "&approveId=" + approve.getApproveId()); |
| | | }else { |
| | | } else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approve.getApproveType()), |
| | | approve.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | |
| | | return "å货审æ¹"; |
| | | case 8: |
| | | return "å±é©ä½ä¸å®¡æ¹"; |
| | | case 9: |
| | | return "åå
¬ç¨å审æ¹"; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | import com.ruoyi.approve.mapper.HolidaySettingsMapper; |
| | | import com.ruoyi.approve.pojo.HolidaySettings; |
| | | import com.ruoyi.approve.service.HolidaySettingsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class HolidaySettingsServiceImpl extends ServiceImpl<HolidaySettingsMapper, HolidaySettings> implements HolidaySettingsService { |
| | | @Autowired |
| | | private HolidaySettingsMapper holidaySettingsMapper; |
| | | private final HolidaySettingsMapper holidaySettingsMapper; |
| | | |
| | | @Override |
| | | public IPage<HolidaySettings> listpage(Page page, HolidaySettings holidaySettings) { |
| | |
| | | import com.ruoyi.approve.mapper.KnowledgeBaseMapper; |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.approve.service.KnowledgeBaseService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class KnowledgeBaseServiceImpl extends ServiceImpl<KnowledgeBaseMapper, KnowledgeBase> implements KnowledgeBaseService { |
| | | @Autowired |
| | | private KnowledgeBaseMapper knowledgeBaseMapper; |
| | | private final KnowledgeBaseMapper knowledgeBaseMapper; |
| | | |
| | | @Override |
| | | public IPage<KnowledgeBase> listpage(Page page, KnowledgeBase knowledgeBase) { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.NotificationManagementMapper; |
| | | import com.ruoyi.approve.pojo.NotificationManagement; |
| | | import com.ruoyi.approve.service.NotificationManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class NotificationManagementServiceImpl extends ServiceImpl<NotificationManagementMapper, NotificationManagement> implements NotificationManagementService { |
| | | @Autowired |
| | | private NotificationManagementMapper notificationManagementMapper; |
| | | private final NotificationManagementMapper notificationManagementMapper; |
| | | |
| | | @Override |
| | | public IPage<NotificationManagement> listpage(Page page, NotificationManagement notificationManagement) { |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.RpaProcessAutomationMapper; |
| | | import com.ruoyi.approve.pojo.RpaProcessAutomation; |
| | | import com.ruoyi.approve.service.RpaProcessAutomationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class RpaProcessAutomationServiceImpl extends ServiceImpl<RpaProcessAutomationMapper, RpaProcessAutomation> implements RpaProcessAutomationService { |
| | | @Autowired |
| | | private RpaProcessAutomationMapper rpaProcessAutomationMapper; |
| | | private final RpaProcessAutomationMapper rpaProcessAutomationMapper; |
| | | @Override |
| | | public IPage<RpaProcessAutomation> listpage(Page page, RpaProcessAutomation rpaProcessAutomation) { |
| | | return rpaProcessAutomationMapper.listpage(page,rpaProcessAutomation); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.utils; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | @RequiredArgsConstructor |
| | | public class ApproveProcessConfigNodeUtils { |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | //åºäºredisçä¸ä¸ªæ¯æ¥è®¡æ°å¨ |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class DailyRedisCounter { |
| | | private static final String KEY_PREFIX = "daily_counter:"; |
| | | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | public DailyRedisCounter(StringRedisTemplate redisTemplate) { |
| | | this.redisTemplate = redisTemplate; |
| | | } |
| | | |
| | | @Value("${ruoyi.approvalNumberPrefix}") |
| | | private String approvalNumberPrefix; |
| | |
| | | return count; |
| | | } |
| | | |
| | | @Autowired |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´ç å¼å§æ¥æ ï¼ç»ææ¥æ |
| | |
| | | package com.ruoyi.approve.utils; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | * @date : 2023/9/19 10:58 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @Schema |
| | | public class StartAndEndDateDto { |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | @Schema(description = "å¼å§æ¶é´") |
| | | @TableField(exist = false) |
| | | private String startDate; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | @Schema(description = "ç»ææ¶é´") |
| | | @TableField(exist = false) |
| | | private String endDate; |
| | | |
| | | @ApiModelProperty("å¼å§æä»½") |
| | | @Schema(description = "å¼å§æä»½") |
| | | @TableField(exist = false) |
| | | private Integer startMonth; |
| | | |
| | | @ApiModelProperty("ç»ææä»½") |
| | | @Schema(description = "ç»ææä»½") |
| | | @TableField(exist = false) |
| | | private Integer endMonth; |
| | | |
| | | @ApiModelProperty("年份") |
| | | @Schema(description = "年份") |
| | | @TableField(exist = false) |
| | | private Integer year; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.vo; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveProcessVo extends ApproveProcess { |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public IPage<Customer> list(Page<Customer> page, Customer customer) { |
| | | return customerService.selectCustomerList(page, customer); |
| | | public R list(Page<CustomerDto> page, CustomerDto customer) { |
| | | IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer); |
| | | return R.ok(customerDtoIPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, Customer customer) { |
| | | Long[] ids = customer.getIds(); |
| | | List<Customer> list; |
| | | if (ids != null && ids.length > 0) { |
| | | list = customerService.selectCustomerListByIds(ids); |
| | | } else { |
| | | list = customerService.selectCustomerLists(customer); |
| | | } |
| | | ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class); |
| | | util.exportExcel(response, list, "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | public void export(HttpServletResponse response, CustomerDto customer) { |
| | | ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class); |
| | | util.exportExcel(response, customerService.selectCustomerLists(customer), "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R importData(MultipartFile file, Integer type) throws Exception { |
| | | |
| | | return customerService.importData(file); |
| | | return customerService.importData(file, type); |
| | | } |
| | | |
| | | /** |
| | | * è·åå®¢æ·æ¡£æ¡è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(customerService.selectCustomerDetailById(id)); |
| | | public R getInfo(@PathVariable("id") Long id) { |
| | | return R.ok(customerService.selectCustomerDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addCustomer") |
| | | public AjaxResult add(@RequestBody Customer customer) { |
| | | return toAjax(customerService.insertCustomer(customer)); |
| | | public R add(@RequestBody Customer customer) { |
| | | return R.ok(customerService.insertCustomer(customer)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/updateCustomer") |
| | | public AjaxResult edit(@RequestBody Customer customer) { |
| | | return toAjax(customerService.updateCustomer(customer)); |
| | | public R edit(@RequestBody Customer customer) { |
| | | return R.ok(customerService.updateCustomer(customer)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delCustomer") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | public R remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return toAjax(customerService.deleteCustomerByIds(ids)); |
| | | return R.ok(customerService.deleteCustomerByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public List customerList(Customer customer) { |
| | | return customerService.customerList(customer); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åé
å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/assignCustomer") |
| | | public R assignCustomer(@RequestBody CustomerDto customer) { |
| | | customerService.assignCustomer(customer); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/recycleCustomer") |
| | | public R recycleCustomer(@RequestBody CustomerDto customer) { |
| | | customerService.recycleCustomer(customer); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å
±äº«å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/together") |
| | | public R together(@RequestBody CustomerDto customer) { |
| | | customerService.together(customer); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ç§æµ·å®¢æ·æµåå
¬æµ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/back") |
| | | public R back(Long id) { |
| | | return R.ok(customerService.back(id)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import com.ruoyi.basic.pojo.CustomerReturnVisit; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/basic/customer-follow") |
| | | @AllArgsConstructor |
| | | public class CustomerFollowUpController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | private final CustomerFollowUpService customerFollowUpService; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | private final CustomerReturnVisitService customerReturnVisitService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·è·è¿å表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation("æ¥è¯¢å®¢æ·è·è¿å表") |
| | | @Operation(summary = "æ¥è¯¢å®¢æ·è·è¿å表") |
| | | public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) { |
| | | LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId()) |
| | |
| | | /** |
| | | * è·å客æ·è·è¿è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @ApiOperation("è·å客æ·è·è¿è¯¦ç»ä¿¡æ¯") |
| | | @Operation(summary = "è·å客æ·è·è¿è¯¦ç»ä¿¡æ¯") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id)); |
| | |
| | | * æ°å¢å®¢æ·è·è¿ |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢å®¢æ·è·è¿") |
| | | @Operation(summary = "æ°å¢å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp)); |
| | |
| | | * ä¿®æ¹å®¢æ·è·è¿ |
| | | */ |
| | | @PutMapping("/edit") |
| | | @ApiOperation("ä¿®æ¹å®¢æ·è·è¿") |
| | | @Operation(summary = "ä¿®æ¹å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp)); |
| | |
| | | /** |
| | | * ä¸ä¼ è·è¿éä»¶ |
| | | */ |
| | | @ApiOperation("ä¸ä¼ è·è¿éä»¶") |
| | | @Operation(summary = "ä¸ä¼ è·è¿éä»¶") |
| | | @PostMapping("/upload/{followUpId}") |
| | | @Log(title = "客æ·è·è¿-ä¸ä¼ éä»¶", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | |
| | | /** |
| | | * ä¸ä¼ è·è¿éä»¶ï¼å¤ç¨ï¼æ IDï¼ |
| | | */ |
| | | @ApiOperation("ä¸ä¼ éä»¶(å¤ç¨)") |
| | | @Operation(summary = "ä¸ä¼ éä»¶(å¤ç¨)") |
| | | @PostMapping("/upload") |
| | | @Log(title = "ä¸ä¼ éä»¶(å¤ç¨)", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | |
| | | /** |
| | | * æ¹éæ¥è¯¢éä»¶å表 |
| | | */ |
| | | @ApiOperation("æ¹éæ¥è¯¢éä»¶å表") |
| | | @Operation(summary = "æ¹éæ¥è¯¢éä»¶å表") |
| | | @PostMapping("/file/list") |
| | | public AjaxResult getFileList(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | |
| | | /** |
| | | * å é¤è·è¿éä»¶ |
| | | */ |
| | | @ApiOperation("å é¤è·è¿éä»¶") |
| | | @Operation(summary = "å é¤è·è¿éä»¶") |
| | | @DeleteMapping("/file/{fileId}") |
| | | @Log(title = "客æ·è·è¿-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public AjaxResult deleteFile(@PathVariable Integer fileId) { |
| | |
| | | /** |
| | | * å é¤å®¢æ·è·è¿ |
| | | */ |
| | | @ApiOperation("å é¤å®¢æ·è·è¿") |
| | | @Operation(summary = "å é¤å®¢æ·è·è¿") |
| | | @DeleteMapping("/{id}") |
| | | @Log(title = "客æ·è·è¿-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult remove(@PathVariable Integer id) { |
| | |
| | | /** |
| | | * æ°å¢/æ´æ°å访æé |
| | | */ |
| | | @ApiOperation("æ°å¢/æ´æ°å访æé") |
| | | @Operation(summary = "æ°å¢/æ´æ°å访æé") |
| | | @PostMapping("/return-visit") |
| | | @Log(title = "å访æé-æ°å¢/æ´æ°", businessType = BusinessType.UPDATE) |
| | | public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | |
| | | /** |
| | | * è·åå访æé详æ
|
| | | */ |
| | | @ApiOperation("è·åå访æé详æ
") |
| | | @Operation(summary = "è·åå访æé详æ
") |
| | | @GetMapping("/return-visit/{customerId}") |
| | | public AjaxResult getReturnVisit(@PathVariable Integer customerId) { |
| | | return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId)); |
| | |
| | | /** |
| | | * æ è®°å访æé已读 |
| | | */ |
| | | @ApiOperation("æ è®°å访æé已读") |
| | | @Operation(summary = "æ è®°å访æé已读") |
| | | @PutMapping("/return-visit/read/{id}") |
| | | @Log(title = "å访æé-æ 记已读", businessType = BusinessType.UPDATE) |
| | | public AjaxResult markAsRead(@PathVariable Long id) { |
| | |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(tags = "æä¸¾æ¥å£") |
| | | @Tag(name = "æä¸¾æ¥å£") |
| | | @RequestMapping("/basic/enum") |
| | | public class EnumController { |
| | | |
| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.service.IProductModelService; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.basic.vo.ProductModelVo; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | public class ProductController extends BaseController { |
| | | |
| | | private IProductService productService; |
| | | |
| | | private IProductModelService productModelService; |
| | | @Autowired |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | /** |
| | | * æ¥è¯¢äº§å |
| | |
| | | return productModelService.modelListPage(page, productDto); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢ææäº§ååå·") |
| | | @Operation(summary = "å页æ¥è¯¢ææäº§ååå·") |
| | | @GetMapping("/pageModel") |
| | | public IPage<ProductModel> listPageProductModel(Page<ProductModel> page, ProductModel productModel) { |
| | | public IPage<ProductModelVo> listPageProductModel(Page<ProductModelVo> page, ProductModel productModel) { |
| | | return productService.listPageProductModel(page, productModel); |
| | | } |
| | | |
| | |
| | | * 产å导å
¥æ¨¡æ¿ |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation("产å导å
¥æ¨¡æ¿") |
| | | @Operation(summary = "产å导å
¥æ¨¡æ¿") |
| | | @Log(title = "产å导å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | public void importProduct(HttpServletResponse response) { |
| | | ExcelUtil<ProductModelExportDto> excelUtil = new ExcelUtil<>(ProductModelExportDto.class); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import com.ruoyi.basic.dto.StorageAttachmentDTO; |
| | | import com.ruoyi.basic.service.StorageAttachmentService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Tag(name = "éç¨ä¸ä¼ ") |
| | | @RequestMapping("/storageAttachment") |
| | | public class StorageAttachmentController { |
| | | private StorageAttachmentService storageAttachmentService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * |
| | | * @param storageAttachmentDTO å
³èè®°å½ä¿¡æ¯ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "å页æ¥è¯¢éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯") |
| | | public R list(StorageAttachmentDTO storageAttachmentDTO) { |
| | | return R.ok(storageAttachmentService.list(storageAttachmentDTO)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * |
| | | * @param ids æä»¶idå表 |
| | | * @return å é¤ç»æ |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯") |
| | | public R batchDelete(@RequestBody List<Long> ids) { |
| | | return R.ok(storageAttachmentService.batchDeleteStorageAttachment(ids)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åéç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "ä¿åéç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯") |
| | | public R add(@RequestBody StorageAttachmentDTO storageAttachmentDTO) { |
| | | storageAttachmentService.saveStorageAttachment(storageAttachmentDTO); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.basic.service.ISupplierService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/system/supplier") |
| | | @AllArgsConstructor |
| | | public class SupplierManageController { |
| | | |
| | | @Autowired |
| | | private ISupplierService supplierService; |
| | | |
| | | /** |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import jakarta.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | |
| | | } |
| | | private String usageUserName; |
| | | |
| | | private String togetherUserNames; |
| | | |
| | | /** |
| | | * å
±äº«ç¨æ·IDå表 |
| | | */ |
| | | private List<Long> userIds; |
| | | } |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.bean.dto.ProductStructureDto; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StorageAttachmentDTO extends StorageAttachment { |
| | | /** |
| | | * å卿件å表 |
| | | */ |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StorageAttachmentVO extends StorageAttachment { |
| | | /** |
| | | * å卿件å表 |
| | | */ |
| | | private List<StorageBlobVO> storageBlobVOS; |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class StorageBlobDTO extends StorageBlob { |
| | | private String url; |
| | | /** |
| | | * é¢è§å°å |
| | | */ |
| | | private String previewURL; |
| | | |
| | | private String downloadUrl; |
| | | /** |
| | | * ä¸è½½å°å |
| | | */ |
| | | private String downloadURL; |
| | | |
| | | /** |
| | | * æä»¶ç±»å |
| | | */ |
| | | private String application; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StorageBlobVO extends StorageBlob { |
| | | /** |
| | | * é¢è§å°å |
| | | */ |
| | | private String previewURL; |
| | | |
| | | /** |
| | | * ä¸è½½å°å |
| | | */ |
| | | private String downloadURL; |
| | | |
| | | private Long storageAttachmentId; |
| | | } |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SupplierManageDto extends SupplierManage { |
| | | |
| | | @ApiModelProperty(value = "ç»´æ¤äººååç§°") |
| | | @Schema(description = "ç»´æ¤äººååç§°") |
| | | private String maintainUserName; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.enums; |
| | | |
| | | public enum ApplicationTypeEnum { |
| | | IMAGE("image"), |
| | | FILE("file"), |
| | | AFTER_FILE("after_file"), |
| | | BEFORE_FILE("before_file"), |
| | | APK("apk"); |
| | | |
| | | |
| | | private final String type; |
| | | ApplicationTypeEnum(String type) { this.type = type; } |
| | | public String getType() { return type; } |
| | | |
| | | /** |
| | | * æ ¹æ® type å¼è·å对åºçæä¸¾å®ä¾ |
| | | * @param type åºç¨ç±»åå符串 |
| | | * @return 对åºç ApplicationTypeEnum æä¸¾å®ä¾ |
| | | * @throws RuntimeException 妿 type æ æ |
| | | */ |
| | | public static ApplicationTypeEnum getByType(String type) { |
| | | for (ApplicationTypeEnum enumValue : ApplicationTypeEnum.values()) { |
| | | if (enumValue.getType().equals(type)) { |
| | | return enumValue; |
| | | } |
| | | } |
| | | throw new RuntimeException("æ æçåºç¨ç±»å: " + type); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.enums; |
| | | |
| | | public enum RecordTypeEnum { |
| | | SHIPPING_INFO("shipping_info"), |
| | | INSPECTION_TASK("inspection_task"), |
| | | PDA_VERSION("pda_version"), |
| | | SALES_LEDGER("sales_ledger"), |
| | | SUPPLIER_MANAGE("supplier_manage"), |
| | | APPROVAL_PROCESS("approval_process"), |
| | | QR_CODE_SCAN_RECORDS("qr_code_scan_records"), |
| | | // Water Record |
| | | WATER_RECORD("water_record"), |
| | | // Warehouse |
| | | WAREHOUSE_GOODS_SHELVES_ROWCOL("warehouse_goods_shelves_rowcol"), |
| | | WAREHOUSE_GOODS_SHELVES("warehouse_goods_shelves"), |
| | | DOCUMENTATION_FILE("documentation_file"), |
| | | DOCUMENTATION_RETURN_MANAGEMENT("documentation_return_management"), |
| | | DOCUMENTATION_BORROW_MANAGEMENT("documentation_borrow_management"), |
| | | DOCUMENTATION("documentation"), |
| | | WAREHOUSE("warehouse"), |
| | | DOCUMENT_CLASSIFICATION("document_classification"), |
| | | // Technology |
| | | TECHNOLOGY_ROUTING_OPERATION_PARAM("technology_routing_operation_param"), |
| | | TECHNOLOGY_ROUTING("technology_routing"), |
| | | TECHNOLOGY_ROUTING_OPERATION("technology_routing_operation"), |
| | | TECHNOLOGY_BOM("technology_bom"), |
| | | TECHNOLOGY_PARAM("technology_param"), |
| | | TECHNOLOGY_OPERATION_PARAM("technology_operation_param"), |
| | | TECHNOLOGY_OPERATION("technology_operation"), |
| | | TECHNOLOGY_BOM_STRUCTURE("technology_bom_structure"), |
| | | // Stock |
| | | STOCK_OUT_RECORD("stock_out_record"), |
| | | STOCK_UNINVENTORY("stock_uninventory"), |
| | | STOCK_INVENTORY("stock_inventory"), |
| | | STOCK_IN_RECORD("stock_in_record"), |
| | | // Staff |
| | | STAFF_WORK_EXPERIENCE("staff_work_experience"), |
| | | STAFF_SALARY_MAIN("staff_salary_main"), |
| | | STAFF_SCHEDULING("staff_scheduling"), |
| | | STAFF_SALARY_DETAIL("staff_salary_detail"), |
| | | STAFF_ON_JOB("staff_on_job"), |
| | | STAFF_LEAVE("staff_leave"), |
| | | STAFF_CONTRACT("staff_contract"), |
| | | STAFF_EMERGENCY_CONTACT("staff_emergency_contact"), |
| | | STAFF_EDUCATION("staff_education"), |
| | | SCHEME_APPLICABLE_STAFF("scheme_applicable_staff"), |
| | | PERSONAL_SHIFT("personal_shift"), |
| | | SCHEME_INSURANCE_DETAIL("scheme_insurance_detail"), |
| | | PERSONAL_ATTENDANCE_RECORDS("personal_attendance_records"), |
| | | PERSONAL_ATTENDANCE_LOCATION_CONFIG("personal_attendance_location_config"), |
| | | BANK("bank"), |
| | | HOLIDAY_APPLICATION("holiday_application"), |
| | | // Sales |
| | | SHIPMENT_APPROVAL("shipment_approval"), |
| | | SALESPERSON_MANAGEMENT("salesperson_management"), |
| | | SALES_QUOTATION_PRODUCT("sales_quotation_product"), |
| | | SALES_QUOTATION("sales_quotation"), |
| | | SALES_LEDGER_PRODUCT("sales_ledger_product"), |
| | | PURCHASE_LEDGER_FILE("purchase_ledger_file"), |
| | | RECEIPT_PAYMENT("receipt_payment"), |
| | | PAYMENT_SHIPPING("payment_shipping"), |
| | | INVOICE_REGISTRATION_PRODUCT("invoice_registration_product"), |
| | | LOSS("loss"), |
| | | INVOICE_REGISTRATION("invoice_registration"), |
| | | INVOICE_LEDGER_FILE("invoice_ledger_file"), |
| | | INVOICE_LEDGER("invoice_ledger"), |
| | | COMMON_FILE("common_file"), |
| | | // Safe |
| | | SAFE_TRAINING_FILE("safe_training_file"), |
| | | SAFE_TRAINING_DETAILS("safe_training_details"), |
| | | SAFE_TRAINING("safe_training"), |
| | | SAFE_HIDDEN_FILE("safe_hidden_file"), |
| | | SAFE_HAZARD_RECORD("safe_hazard_record"), |
| | | SAFE_HIDDEN("safe_hidden"), |
| | | SAFE_HAZARD("safe_hazard"), |
| | | SAFE_CONTINGENCY_PLAN("safe_contingency_plan"), |
| | | SAFE_CERTIFICATION_FILE("safe_certification_file"), |
| | | SAFE_CERTIFICATION("safe_certification"), |
| | | SAFE_ACCIDENT("safe_accident"), |
| | | // Quality |
| | | QUALITY_UNQUALIFIED("quality_unqualified"), |
| | | QUALITY_TEST_STANDARD_PARAM("quality_test_standard_param"), |
| | | QUALITY_TEST_STANDARD_BINDING("quality_test_standard_binding"), |
| | | QUALITY_TEST_STANDARD("quality_test_standard"), |
| | | QUALITY_INSPECT_FILE("quality_inspect_file"), |
| | | QUALITY_INSPECT_PARAM("quality_inspect_param"), |
| | | QUALITY_INSPECT("quality_inspect"), |
| | | // Purchase |
| | | TICKET_REGISTRATION("ticket_registration"), |
| | | PURCHASE_RETURN_ORDER_PRODUCTS("purchase_return_order_products"), |
| | | PURCHASE_RETURN_ORDERS("purchase_return_orders"), |
| | | SALES_LEDGER_PRODUCT_TEMPLATE("sales_ledger_product_template"), |
| | | PURCHASE_LEDGER("purchase_ledger"), |
| | | PURCHASE_LEDGER_TEMPLATE("purchase_ledger_template"), |
| | | PRODUCT_RECORD("product_record"), |
| | | PAYMENT_REGISTRATION("payment_registration"), |
| | | INVOICE_PURCHASE("invoice_purchase"), |
| | | // Project Management |
| | | SHIPPING_ADDRESS("shipping_address"), |
| | | ROLES("roles"), |
| | | PLAN("plan"), |
| | | PLAN_NODE("plan_node"), |
| | | INFO_STAGE("info_stage"), |
| | | CONTRACT_INFO("contract_info"), |
| | | INFO("info"), |
| | | // Production |
| | | PRODUCTION_PRODUCT_OUTPUT("production_product_output"), |
| | | PRODUCTION_ORDER_ROUTING_OPERATION("production_order_routing_operation"), |
| | | PRODUCTION_PRODUCT_INPUT("production_product_input"), |
| | | PRODUCTION_PRODUCT_MAIN("production_product_main"), |
| | | PRODUCTION_PLAN("production_plan"), |
| | | PRODUCTION_ORDER_ROUTING_OPERATION_PARAM("production_order_routing_operation_param"), |
| | | PRODUCTION_ORDER_ROUTING("production_order_routing"), |
| | | PRODUCTION_ORDER_PICK_RECORD("production_order_pick_record"), |
| | | PRODUCTION_ORDER_PICK("production_order_pick"), |
| | | PRODUCTION_ORDER_BOM("production_order_bom"), |
| | | PRODUCTION_OPERATION_TASK("production_operation_task"), |
| | | PRODUCTION_ORDER("production_order"), |
| | | PRODUCTION_ACCOUNT("production_account"), |
| | | PRODUCTION_BOM_STRUCTURE("production_bom_structure"), |
| | | PRODUCTION_OPERATION_MAIN_PARAM("production_operation_main_param"), |
| | | // Procurement Record |
| | | RETURN_SALE_PRODUCT("return_sale_product"), |
| | | PROCUREMENT_PLAN("procurement_plan"), |
| | | PROCUREMENT_RECORD_OUT("procurement_record_out"), |
| | | PROCUREMENT_RECORD_STORAGE("procurement_record_storage"), |
| | | RETURN_MANAGEMENT("return_management"), |
| | | PROCUREMENT_PRICE_MANAGEMENT("procurement_price_management"), |
| | | GAS_TANK_WARNING("gas_tank_warning"), |
| | | CUSTOM_STORAGE("custom_storage"), |
| | | PROCUREMENT_EXCEPTION_RECORD("procurement_exception_record"), |
| | | INBOUND_MANAGEMENT("inbound_management"), |
| | | // Office Supplies |
| | | OFFICE_SUPPLIES("office_supplies"), |
| | | // OA |
| | | OA_PROJECT_PHASE_TASK("oa_project_phase_task"), |
| | | OA_PROJECT("oa_project"), |
| | | OA_PROJECT_PHASE("oa_project_phase"), |
| | | // Measuring Instrument Ledger |
| | | SPARE_PARTS("spare_parts"), |
| | | MEASURING_INSTRUMENT_LEDGER_RECORD("measuring_instrument_ledger_record"), |
| | | MEASURING_INSTRUMENT_LEDGER("measuring_instrument_ledger"), |
| | | SPARE_PARTS_REQUISITION_RECORD("spare_parts_requisition_record"), |
| | | // Labor Issue |
| | | LABOR_ISSUE("labor_issue"), |
| | | // Inspection Task |
| | | TIMING_TASK("timing_task"), |
| | | QR_CODE("qr_code"), |
| | | // Equipment Energy Consumption |
| | | ENERGY_PERIOD("energy_period"), |
| | | EQUIPMENT_ENERGY_CONSUMPTION("equipment_energy_consumption"), |
| | | ELECTRICITY_CONSUMPTION_AREA("electricity_consumption_area"), |
| | | // Device |
| | | MAINTENANCE_TASK("maintenance_task"), |
| | | DEVICE_REPAIR("device_repair"), |
| | | DEVICE_MAINTENANCE_FILE("device_maintenance_file"), |
| | | DEVICE_DEFECT_RECORD("device_defect_record"), |
| | | DEVICE_MAINTENANCE("device_maintenance"), |
| | | DEVICE_LEDGER("device_ledger"), |
| | | // Customer Visits |
| | | CUSTOMER_VISITS("customer_visits"), |
| | | // Compensation Performance |
| | | COMPENSATION_PERFORMANCE("compensation_performance"), |
| | | // Collaborative Approval |
| | | STAFF_CONTACTS_PERSONAL("staff_contacts_personal"), |
| | | SEAL_APPLICATION_MANAGEMENT("seal_application_management"), |
| | | RULES_REGULATIONS_MANAGEMENT_FILE("rules_regulations_management_file"), |
| | | RULES_REGULATIONS_MANAGEMENT("rules_regulations_management"), |
| | | READING_STATUS("reading_status"), |
| | | NOTICE("notice"), |
| | | NOTICE_TYPE("notice_type"), |
| | | MEET_DRAFT("meet_draft"), |
| | | MEETING_ROOM("meeting_room"), |
| | | MEETING_MINUTES("meeting_minutes"), |
| | | MEET_APPLICATION("meet_application"), |
| | | DUTY_PLAN("duty_plan"), |
| | | // Basic |
| | | SUPPLIER_MANAGE_FILE("supplier_manage_file"), |
| | | PRODUCT_MODEL("product_model"), |
| | | CUSTOMER_RETURN_VISIT("customer_return_visit"), |
| | | PRODUCT("product"), |
| | | CUSTOMER("customer"), |
| | | CUSTOMER_PRIVATE_POOL("customer_private_pool"), |
| | | CUSTOMER_FOLLOW_UP_FILE("customer_follow_up_file"), |
| | | CUSTOMER_FOLLOW_UP("customer_follow_up"), |
| | | CUSTOMER_PRIVATE("customer_private"), |
| | | // Approve |
| | | WORKING_HOURS_SETTING("working_hours_setting"), |
| | | OVERTIME_SETTING("overtime_setting"), |
| | | RPA_PROCESS_AUTOMATION("rpa_process_automation"), |
| | | HOLIDAY_SETTINGS("holiday_settings"), |
| | | ONLINE_MEETING("online_meeting"), |
| | | KNOWLEDGE_BASE("knowledge_base"), |
| | | NOTIFICATION_MANAGEMENT("notification_management"), |
| | | APPROVE_NODE("approve_node"), |
| | | APPROVE_PROCESS("approve_process"), |
| | | APPROVE_PROCESS_CONFIG_NODE("approve_process_config_node"), |
| | | APPROVE_LOG("approve_log"), |
| | | ANNUAL_LEAVE_SETTING("annual_leave_setting"), |
| | | FILE_SHARING("file_sharing"), |
| | | // After Sales Service |
| | | AFTER_SALES_SERVICE("after_sales_service"), |
| | | AFTER_SALES_SERVICE_FILE("after_sales_service_file"), |
| | | AFTER_SALES_NEAR_EXPIRY("after_sales_near_expiry"), |
| | | // Account |
| | | ACCOUNT_INCOME("account_income"), |
| | | BORROW_INFO("borrow_info"), |
| | | SALES_REFUND_AMOUNT_ORDER("sales_refund_amount_order"), |
| | | SALES_RECEIPT_RETURN("sales_receipt_return"), |
| | | ACCOUNT_EXPENSE("account_expense"), |
| | | ACCOUNT_FILE("account_file"); |
| | | |
| | | private final String type; |
| | | RecordTypeEnum(String type) { this.type = type; } |
| | | public String getType() { return type; } |
| | | |
| | | /** |
| | | * æ ¹æ® type å¼è·å对åºçæä¸¾å®ä¾ |
| | | * @param type è®°å½ç±»åå符串 |
| | | * @return 对åºç RecordTypeEnum æä¸¾å®ä¾ |
| | | * @throws RuntimeException 妿 type æ æ |
| | | */ |
| | | public static RecordTypeEnum getByType(String type) { |
| | | for (RecordTypeEnum enumValue : RecordTypeEnum.values()) { |
| | | if (enumValue.getType().equals(type)) { |
| | | return enumValue; |
| | | } |
| | | } |
| | | throw new RuntimeException("æ æçè®°å½ç±»å: " + type); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | package com.ruoyi.basic.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.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author ruoyi |
| | | * @date 2025-05-07 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerMapper extends BaseMapper<Customer> |
| | | { |
| | | /** |
| | |
| | | * @return ç»æ |
| | | */ |
| | | int deleteCustomerByIds(Long[] ids); |
| | | } |
| | | |
| | | IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | |
| | | List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Mapperæ¥å£ |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerUserMapper extends BaseMapper<CustomerUser> { |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.vo.ProductModelVo; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | public interface ProductModelMapper extends BaseMapper<ProductModel> { |
| | | |
| | | IPage<ProductModel> listPageProductModel(Page<ProductModel> page, @Param("c") ProductModel productModel); |
| | | IPage<ProductModelVo> listPageProductModel(Page<ProductModelVo> page, @Param("c") ProductModel productModel); |
| | | |
| | | IPage<ProductModel> listPageProductionStock(Page<ProductModel> page, @Param("req") ProcurementPageDto req); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface StorageBlobMapper extends BaseMapper<StorageBlob> { |
| | | |
| | | java.util.List<StorageBlob> selectOrphanBlobsByIdRange(@Param("lastId") long lastId, @Param("limit") int limit); |
| | | |
| | | int deleteByIdList(@Param("ids") java.util.List<Long> ids); |
| | | |
| | | java.util.List<String> selectExistingUidFilenames(@Param("fileNames") java.util.List<String> fileNames); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | |
| | | /** |
| | | * å®¢æ·æ¡£æ¡å¯¹è±¡ customer |
| | |
| | | @TableField(exist = false) |
| | | private String addressPhone; |
| | | |
| | | @ApiModelProperty(value = "é¶è¡åºæ¬æ·") |
| | | @Schema(description = "é¶è¡åºæ¬æ·") |
| | | @Excel(name = "é¶è¡åºæ¬æ·") |
| | | private String basicBankAccount; |
| | | |
| | | @ApiModelProperty(value = "é¶è¡è´¦å·") |
| | | @Schema(description = "é¶è¡è´¦å·") |
| | | @Excel(name = "é¶è¡è´¦å·") |
| | | private String bankAccount; |
| | | |
| | | @ApiModelProperty(value = "弿·è¡å·") |
| | | @Schema(description = "弿·è¡å·") |
| | | @Excel(name = "弿·è¡å·") |
| | | private String bankCode; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "使ç¨ç¨æ·") |
| | | private Long usageUser; |
| | | @Schema(description = "使ç¨ç¶æ") |
| | | private Long usageStatus; |
| | | |
| | | @Schema(description = "ç±»å 0 ç§æµ·å®¢æ· 1 å
¬æµ·å®¢æ·") |
| | | private Integer type; |
| | | |
| | | @Schema(description = "æ¯å¦è¢«åé
ï¼0-æªåé
ï¼1-å·²åé
") |
| | | private Integer isAssigned; |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³èç客æ·ID |
| | | * å
³èçç§æµ·id |
| | | */ |
| | | private Integer customerId; |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * è·è¿æ¹å¼ |
| | |
| | | * è·è¿æ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime followUpTime; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | * ç§æ·ID |
| | | */ |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | |
| | | /** |
| | | * å
³è客æ·ID |
| | | */ |
| | | private Integer customerId; |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * æéå¼å
³ (0:å
³é, 1:å¼å¯) |
| | |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @TableName(value = "customer_user") |
| | | @Data |
| | | public class CustomerUser implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 客æ·id |
| | | */ |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * ç¨æ·id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å½å
¥æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | |
| | | */ |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(exist = false) |
| | | private Long[] deptIds; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("product_model") |
| | | public class ProductModel { |
| | | public class ProductModel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String model; |
| | | |
| | | @Excel(name = "产åç¼ç ") |
| | | @TableField("product_code") |
| | | private String productCode; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | |
| | | @Excel(name = "çäº§çæº") |
| | | private String speculativeTradingName; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @TableField(exist = false) |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "é¡¶é¨ç¶äº§åid") |
| | | @TableField(exist = false) |
| | | private Long topProductParentId; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ å®ä½ç±» |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-29 |
| | | */ |
| | | @Data |
| | | @TableName("storage_attachment") |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** å建æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** æ´æ°æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é»è¾å é¤ |
| | |
| | | * å
³èçè®°å½ç±»å |
| | | */ |
| | | @TableField(value = "record_type") |
| | | private Long recordType; |
| | | private String recordType; |
| | | /** |
| | | * å
³èçè®°å½id |
| | | */ |
| | | @TableField(value = "record_id") |
| | | private Long recordId; |
| | | /** |
| | | * ç±»ååç§°, å¦: file, avatar (åºåå䏿¡è®°å½ä¸åç±»åçéä»¶) |
| | | * æä»¶ç¨é, å¦: file, avatar (åºåå䏿¡è®°å½ä¸åç±»åçéä»¶) |
| | | */ |
| | | @TableField(value = "name") |
| | | private String name; |
| | | @TableField(value = "application") |
| | | private String application; |
| | | /** |
| | | * å
³èstorage_blobè®°å½id |
| | | */ |
| | | @TableField(value = "storage_blob_id") |
| | | private Long storageBlobId; |
| | | |
| | | @TableField(exist = false) |
| | | private StorageBlobDTO storageBlobDTO; |
| | | |
| | | public StorageAttachment(String fileType, Long recordType, Long recordId) { |
| | | this.name = fileType; |
| | | this.recordType = recordType; |
| | | this.recordId = recordId; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ å®ä½ç±» |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-29 |
| | | */ |
| | | @Data |
| | | @TableName("storage_blob") |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | |
| | | private String originalFilename; |
| | | |
| | | /** |
| | | * å卿¡¶ä¸ |
| | | * å¯ä¸æä»¶åç§° |
| | | */ |
| | | @TableField(value = "bucket_filename") |
| | | private String bucketFilename; |
| | | /** |
| | | * å卿¡¶å |
| | | */ |
| | | @TableField(value = "bucket_name") |
| | | private String bucketName; |
| | | @TableField(value = "uid_filename") |
| | | private String uidFilename; |
| | | |
| | | /** |
| | | * èµæºå°ºå¯¸(åè) |
| | | */ |
| | |
| | | private Long byteSize; |
| | | |
| | | /** |
| | | * 0ç产å 1ç产å 2ç产é®é¢ |
| | | * æä»¶è·¯å¾ |
| | | */ |
| | | @TableField(value = "type") |
| | | private Long type; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "å建该记å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½å建æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½æåæ´æ°æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | @TableField(value = "path") |
| | | private String path; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºååç§°") |
| | | @Schema(description = "ä¾åºååç§°") |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "纳ç¨äººè¯å«å·") |
| | | @Schema(description = "纳ç¨äººè¯å«å·") |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | | |
| | | @ApiModelProperty(value = "å
¬å¸å°å") |
| | | @Schema(description = "å
¬å¸å°å") |
| | | @Excel(name = "å
¬å¸å°å") |
| | | private String companyAddress; |
| | | |
| | | @ApiModelProperty(value = "å
¬å¸çµè¯") |
| | | @Schema(description = "å
¬å¸çµè¯") |
| | | @Excel(name = "å
¬å¸çµè¯") |
| | | private String companyPhone; |
| | | |
| | | @ApiModelProperty(value = "弿·è¡") |
| | | @Schema(description = "弿·è¡") |
| | | @Excel(name = "弿·è¡") |
| | | private String bankAccountName; |
| | | |
| | | @ApiModelProperty(value = "è´¦å·") |
| | | @Schema(description = "è´¦å·") |
| | | @Excel(name = "è´¦å·") |
| | | private String bankAccountNum; |
| | | |
| | | @ApiModelProperty(value = "è系人") |
| | | @Schema(description = "è系人") |
| | | @Excel(name = "è系人") |
| | | private String contactUserName; |
| | | |
| | | @ApiModelProperty(value = "èç³»çµè¯") |
| | | @Schema(description = "èç³»çµè¯") |
| | | @Excel(name = "èç³»çµè¯") |
| | | private String contactUserPhone; |
| | | |
| | | @ApiModelProperty(value = "ç»´æ¤äººID") |
| | | @Schema(description = "ç»´æ¤äººID") |
| | | @Excel(name = "ç»´æ¤äºº") |
| | | private Integer maintainUserId; |
| | | |
| | | @ApiModelProperty(value = "ç»´æ¤æ¶é´") |
| | | @Schema(description = "ç»´æ¤æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | // @Excel(name = "ç»´æ¤æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDate maintainTime; |
| | | @Excel(name = "æ¯å¦ç½åå") |
| | | @ApiModelProperty(value = "æ¯å¦ç½ååï¼0æ¯ 1å¦ï¼") |
| | | @Schema(description = "æ¯å¦ç½ååï¼0æ¯ 1å¦ï¼") |
| | | private Integer isWhite; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºåç±»å") |
| | | @Schema(description = "ä¾åºåç±»å") |
| | | @TableField(value = "supplier_type") |
| | | private String supplierType; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æä»¶è·¯å¾") |
| | | @Schema(description = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private int fileSize; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºåID") |
| | | @Schema(description = "ä¾åºåID") |
| | | @NotBlank(message = "ä¾åºåidä¸è½ä¸ºç©º!") |
| | | private Long supplierId; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.common.vo.SimpleFileVo; |
| | | |
| | | import javax.annotation.Nullable; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Null; |
| | | import jakarta.annotation.Nullable; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Null; |
| | | import java.util.List; |
| | | import java.util.function.BiConsumer; |
| | | import java.util.function.Function; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Serviceæ¥å£ |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | public interface CustomerUserService extends IService<CustomerUser> { |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param id å®¢æ·æ¡£æ¡ä¸»é® |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | CustomerDto selectCustomerDetailById(Long id); |
| | | CustomerVo selectCustomerDetailById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | |
| | | * @param customer å®¢æ·æ¡£æ¡ |
| | | * @return å®¢æ·æ¡£æ¡éå |
| | | */ |
| | | IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer); |
| | | |
| | | /** |
| | | * æ°å¢å®¢æ·æ¡£æ¡ |
| | |
| | | */ |
| | | List<Map<String, Object>> customerList(Customer customer); |
| | | |
| | | List<Customer> selectCustomerLists(Customer customer); |
| | | List<CustomerVo> selectCustomerLists(CustomerDto customer); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R importData(MultipartFile file, Integer type); |
| | | |
| | | IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer); |
| | | |
| | | void assignCustomer(CustomerDto customer); |
| | | |
| | | void recycleCustomer(CustomerDto customer); |
| | | |
| | | /** |
| | | * å
±äº«å®¢æ·ç»å
¶ä»ç¨æ· |
| | | * |
| | | * @param customerDto 客æ·DTOï¼å
å«å®¢æ·IDåå
±äº«ç¨æ·IDåè¡¨ï¼ |
| | | */ |
| | | void together(CustomerDto customerDto); |
| | | |
| | | Boolean back(Long id); |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.vo.ProductModelVo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<ProductTreeDto> selectProductList(ProductDto productDto); |
| | | |
| | | IPage<ProductModel> listPageProductModel(Page<ProductModel> page, ProductModel productModel); |
| | | IPage<ProductModelVo> listPageProductModel(Page<ProductModelVo> page, ProductModel productModel); |
| | | } |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface ISupplierService extends IService<SupplierManage> { |
| | |
| | | package com.ruoyi.basic.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.basic.dto.StorageAttachmentDTO; |
| | | import com.ruoyi.basic.dto.StorageAttachmentVO; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.common.constant.StorageAttachmentConstants; |
| | | import com.ruoyi.common.enums.StorageAttachmentRecordType; |
| | |
| | | * @since 2025-05-29 |
| | | */ |
| | | public interface StorageAttachmentService extends IService<StorageAttachment> { |
| | | /** |
| | | * æ¥è¯¢éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * @param recordId å
³èè®°å½id |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param fileType æä»¶ç±»å |
| | | * @return æä»¶ä¿¡æ¯å表 |
| | | */ |
| | | List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, String fileType); |
| | | |
| | | /** |
| | | * ä¿åéç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * @param attachments æä»¶ä¿¡æ¯å表 |
| | | * @param recordId 管çè®°å½id |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param fileType æä»¶ç±»å |
| | | */ |
| | | public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType); |
| | | public void saveStorageAttachment(StorageAttachmentDTO storageAttachmentDTO); |
| | | |
| | | public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, String fileType); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * @param storageAttachmentDTO å
³èè®°å½ä¿¡æ¯ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | public List<StorageBlobVO> list(StorageAttachmentDTO storageAttachmentDTO); |
| | | |
| | | /** |
| | | * å é¤éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | |
| | | * @return å é¤ç»æ |
| | | */ |
| | | public int deleteStorageAttachment(StorageAttachment storageAttachment); |
| | | |
| | | /** |
| | | * æ¹éå é¤éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ |
| | | * @param ids æä»¶idå表 |
| | | * @return å é¤ç»æ |
| | | */ |
| | | public int batchDeleteStorageAttachment(List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.basic.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public interface StorageBlobService extends IService<StorageBlob> { |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ æ¥å£ |
| | | * @param files æä»¶ä¿¡æ¯ |
| | | * @param bucketName å卿¡¶åç§° |
| | | * ä¸ä¼ æä»¶ |
| | | * @param files æä»¶å表 |
| | | * @return ä¸ä¼ ç»æ |
| | | */ |
| | | List<StorageBlobDTO> updateStorageBlobs(List<MultipartFile> files, String bucketName); |
| | | List<StorageBlobVO> upload(List<MultipartFile> files, Boolean isPublic); |
| | | |
| | | List<StorageBlobDTO> updateStorageBlobs(List<MultipartFile> files, String bucketName,Long type); |
| | | File getFileByToken(String fileName, String token); |
| | | |
| | | File getPublicFile(String fileName, String publicKey); |
| | | |
| | | /** |
| | | * æ¹éå 餿件 |
| | | * @param attachment |
| | | * @return |
| | | */ |
| | | public int deleteStorageBlobs(StorageAttachment attachment); |
| | | String getDownloadFileName(String fileName); |
| | | } |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.stream.CollectorUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.basic.mapper.CustomerFollowUpFileMapper; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.common.vo.SimpleFileVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | |
| | | * @since 2026/03/04 14:53 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CustomerFollowUpFileServiceImpl extends ServiceImpl<CustomerFollowUpFileMapper, CustomerFollowUpFile> implements CustomerFollowUpFileService { |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | |
| | | private final CustomerFollowUpFileMapper customerFollowUpFileMapper; |
| | | |
| | | @Override |
| | | public <T> void fillAttachment(List<T> list, Function<T, String> getAttachmentIds, BiConsumer<T, List<SimpleFileVo>> setAttachmentList) { |
| | |
| | | List<CustomerFollowUpFile> followUpFilesByIds = new ArrayList<>(); |
| | | Lists.partition(Lists.newArrayList(ids), 999).forEach(it -> { |
| | | followUpFilesByIds.addAll( |
| | | customerFollowUpService.getFollowUpFilesByIds(it) |
| | | getFollowUpFilesByIds(it) |
| | | ); |
| | | }); |
| | | if (CollUtil.isEmpty(followUpFilesByIds)) { |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds) { |
| | | if (fileIds == null || fileIds.isEmpty()) { |
| | | return new ArrayList<>(0); |
| | | } |
| | | |
| | | LambdaQueryWrapper<CustomerFollowUpFile> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CustomerFollowUpFile::getId, fileIds) |
| | | .select(CustomerFollowUpFile::getId, CustomerFollowUpFile::getFileUrl, CustomerFollowUpFile::getFileName); |
| | | return customerFollowUpFileMapper.selectList(queryWrapper); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.basic.mapper.CustomerFollowUpMapper; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @since 2026/03/04 14:48 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CustomerFollowUpServiceImpl extends ServiceImpl<CustomerFollowUpMapper, CustomerFollowUp> implements CustomerFollowUpService { |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpFileService customerFollowUpFileService; |
| | | private final CustomerFollowUpFileService customerFollowUpFileService; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | * @since 2026/03/04 17:58 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CustomerReturnVisitServiceImpl extends ServiceImpl<CustomerReturnVisitMapper, CustomerReturnVisit> implements CustomerReturnVisitService { |
| | | |
| | | @Autowired |
| | | private ReturnVisitReminderService returnVisitReminderService; |
| | | private final ReturnVisitReminderService returnVisitReminderService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | import com.ruoyi.basic.service.*; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService { |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpFileService customerFollowUpFileService; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | @Autowired |
| | | private CustomerUserService customerUserService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡ |
| | |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | @Override |
| | | public CustomerDto selectCustomerDetailById(Long id) { |
| | | Customer customer = customerMapper.selectById(id); |
| | | if (customer == null) { |
| | | return null; |
| | | } |
| | | |
| | | CustomerDto dto = new CustomerDto(); |
| | | BeanUtils.copyProperties(customer, dto); |
| | | public CustomerVo selectCustomerDetailById(Long id) { |
| | | CustomerVo customerVo = new CustomerVo(); |
| | | BeanUtils.copyProperties(this.getById(id), customerVo); |
| | | |
| | | // æ¥è¯¢è·è¿è®°å½ |
| | | List<CustomerFollowUp> followUpList = customerFollowUpService.list( |
| | |
| | | .eq(CustomerFollowUp::getCustomerId, id) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(followUpList)) { |
| | | if (!com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(followUpList)) { |
| | | List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> { |
| | | CustomerFollowUpDto followUpDto = new CustomerFollowUpDto(); |
| | | BeanUtils.copyProperties(followUp, followUpDto); |
| | |
| | | return followUpDto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | dto.setFollowUpList(followUpDtoList); |
| | | customerVo.setFollowUpList(followUpDtoList); |
| | | } |
| | | |
| | | return dto; |
| | | return customerVo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return å®¢æ·æ¡£æ¡ |
| | | */ |
| | | @Override |
| | | public IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer) { |
| | | // 1. å¤ç空å¼åºæ¯ï¼åæ°æ ¡éªï¼ |
| | | if (page == null) { |
| | | page = Page.of(1, 10); // é»è®¤ç¬¬1é¡µï¼æ¯é¡µ10æ¡æ°æ® |
| | | } |
| | | if (customer == null) { |
| | | customer = new Customer(); // é¿å
空对象导è´çNPE |
| | | public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId); |
| | | |
| | | List<CustomerVo> records = customerPage.getRecords(); |
| | | if (CollectionUtils.isEmpty(records)) { |
| | | return customerPage; |
| | | } |
| | | |
| | | // 2. æå»ºæ¥è¯¢æ¡ä»¶ï¼å¢å¼ºç©ºå¼å®å
¨ï¼ |
| | | LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>(); |
| | | String customerName = customer.getCustomerName(); |
| | | String customerType = customer.getCustomerType(); |
| | | if (StringUtils.isNotBlank(customerName)) { |
| | | queryWrapper.like(Customer::getCustomerName, customerName); |
| | | } |
| | | if (StringUtils.isNotBlank(customerType)) { |
| | | queryWrapper.like(Customer::getCustomerType, customerType); |
| | | } |
| | | |
| | | // 3. æ§è¡å页æ¥è¯¢ï¼ä¿çå页å
æ°æ®ï¼ |
| | | IPage<Customer> customerPage = customerMapper.selectPage(page, queryWrapper); |
| | | |
| | | // 4. æ°æ®å¤çï¼å¢å¼ºç©ºå¼å®å
¨ & 代ç å¯è¯»æ§ï¼ |
| | | List<Customer> processedList = customerPage.getRecords().stream() |
| | | .filter(Objects::nonNull) // è¿æ»¤ç©ºå¯¹è±¡ï¼é¿å
åç»æä½NPEï¼ |
| | | .peek(c -> { |
| | | // å®å
¨è·ååæ®µï¼é¿å
null弿¼æ¥ |
| | | String address = StringUtils.defaultString(c.getCompanyAddress(), ""); |
| | | String phone = StringUtils.defaultString(c.getCompanyPhone(), ""); |
| | | c.setAddressPhone(address + "(" + phone + ")"); |
| | | |
| | | // æ¥è¯¢ææ°çè·è¿è®°å½ |
| | | CustomerFollowUp followUp = customerFollowUpService.getOne( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerId, c.getId()) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | .last("LIMIT 1") |
| | | ); |
| | | |
| | | if (followUp != null) { |
| | | c.setFollowUpLevel(followUp.getFollowUpLevel()); |
| | | c.setFollowUpTime( |
| | | Date.from( |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | ) |
| | | ); |
| | | } |
| | | }) |
| | | List<Long> customerIds = records.stream() |
| | | .map(CustomerVo::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 5. æ´æ°åé¡µç»æä¸çæ°æ®ï¼ä¿æå页信æ¯å®æ´ï¼ |
| | | IPage<Customer> resultPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal()); |
| | | resultPage.setRecords(processedList); |
| | | if (!CollectionUtils.isEmpty(customerIds)) { |
| | | Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds); |
| | | |
| | | return customerPage; // è¿åå
å«å页信æ¯çIPage对象 |
| | | records.forEach(c -> { |
| | | String address = StringUtils.defaultString(c.getCompanyAddress(), ""); |
| | | String phone = StringUtils.defaultString(c.getCompanyPhone(), ""); |
| | | c.setAddressPhone(address + "(" + phone + ")"); |
| | | |
| | | CustomerFollowUp followUp = latestFollowUpMap.get(c.getId()); |
| | | if (followUp != null) { |
| | | c.setFollowUpLevel(followUp.getFollowUpLevel()); |
| | | c.setFollowUpTime(Date.from( |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | )); |
| | | } |
| | | |
| | | // 转æ¢å
±äº«ç¨æ·IDå符串为List<Long> |
| | | String userIdsStr = c.getUserIdsStr(); |
| | | if (StringUtils.isNotEmpty(userIdsStr)) { |
| | | List<Long> userIds = Arrays.stream(userIdsStr.split(",")) |
| | | .map(String::trim) |
| | | .map(Long::parseLong) |
| | | .collect(Collectors.toList()); |
| | | c.setUserIds(userIds); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return customerPage; |
| | | } |
| | | |
| | | private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) { |
| | | List<CustomerFollowUp> followUps = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .in(CustomerFollowUp::getCustomerId, customerIds) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | return followUps.stream() |
| | | .collect(Collectors.toMap( |
| | | CustomerFollowUp::getCustomerId, |
| | | followUp -> followUp, |
| | | (existing, replacement) -> existing |
| | | )); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!salesLedgers.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æéå®ååï¼è¯·å
å é¤éå®åå"); |
| | | } |
| | | // å é¤å®¢æ·çåæ¶ä¹éè¦å é¤å¯¹åºç客æ·è·éãéä»¶åå访æé |
| | | // æ¥è¯¢æ¯å¦æå·²åé
çå
¬æµ·å®¢æ· |
| | | List<Customer> assignedPools = customerMapper.selectList( |
| | | new QueryWrapper<Customer>().lambda() |
| | | .in(Customer::getId, idList) |
| | | .eq(Customer::getType, 1). |
| | | eq(Customer::getIsAssigned, 1) // å
¬æµ·å®¢æ· |
| | | ); |
| | | if (!assignedPools.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æå·²åé
çå
¬æµ·å®¢æ·ï¼è¯·å
æ¶å"); |
| | | } |
| | | // å é¤å®¢æ·çåæ¶ä¹éè¦å é¤å¯¹åºç客æ·è·éãéä»¶åå访æé |
| | | for (Long id : ids) { |
| | | customerFollowUpService.deleteByCustomerId(id); |
| | | customerReturnVisitService.deleteByCustomerId(id); |
| | | // å é¤å®¢æ·çå
±äº«å
³ç³» |
| | | customerUserService.remove( |
| | | new QueryWrapper<CustomerUser>().lambda() |
| | | .eq(CustomerUser::getCustomerId, id) |
| | | ); |
| | | } |
| | | |
| | | // å é¤å®¢æ·ä¸»è¡¨æ°æ® |
| | | return customerMapper.deleteBatchIds(idList); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Customer> selectCustomerLists(Customer customer) { |
| | | return customerMapper.selectList(null); |
| | | public List<CustomerVo> selectCustomerLists(CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | return customerMapper.list(customer, loginUserId); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R importData(MultipartFile file, Integer type) { |
| | | try { |
| | | ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class); |
| | | List<Customer> userList = util.importExcel(file.getInputStream()); |
| | | if (CollectionUtils.isEmpty(userList)) { |
| | | return AjaxResult.warn("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | return R.fail("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | // æ ¹æ® type åæ°è®¾ç½®å®¢æ·ç±»åï¼ç§æµ·/å
¬æµ·ï¼ |
| | | if (type != null) { |
| | | userList.forEach(customer -> { |
| | | customer.setType(type); |
| | | }); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return AjaxResult.success(true); |
| | | return R.ok(true); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | // åé
å
¬æµ·å®¢æ·ç»ç§æµ· |
| | | @Override |
| | | public void assignCustomer(CustomerDto customerDto) { |
| | | Customer customer = customerMapper.selectById(customerDto.getId()); |
| | | if (customer.getType() == 1 && customer.getIsAssigned() == 0) { // å
¬æµ·ä¸å¯åé
|
| | | customer.setIsAssigned(1); |
| | | customer.setUsageStatus(1L); |
| | | customer.setUsageUser(customerDto.getUsageUser()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | } |
| | | |
| | | // åæ¶ç§æµ·å®¢æ·å°å
¬æµ· |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void recycleCustomer(CustomerDto customerDto) { |
| | | Customer customer = customerMapper.selectById(customerDto.getId()); |
| | | if (customer.getType() == 1 && customer.getIsAssigned() == 1) { // å
¬æµ·ä¸å·²åé
|
| | | customer.setIsAssigned(0); |
| | | customer.setUsageStatus(0L); |
| | | customer.setUsageUser(0L); |
| | | customerMapper.updateById(customer); |
| | | |
| | | // å é¤è¯¥å®¢æ·çææå
±äº«å
³ç³» |
| | | customerUserService.remove( |
| | | new QueryWrapper<CustomerUser>().lambda() |
| | | .eq(CustomerUser::getCustomerId, customerDto.getId()) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 客æ·å
񄧮 |
| | | @Override |
| | | public void together(CustomerDto customerDto) { |
| | | // æ¥è¯¢ç°æçå
±äº«è®°å½ |
| | | List<CustomerUser> existingUsers = customerUserService.list( |
| | | new QueryWrapper<CustomerUser>().lambda().eq(CustomerUser::getCustomerId, customerDto.getId()) |
| | | ); |
| | | |
| | | // è·åå·²åå¨çç¨æ·IDå表 |
| | | List<Long> existingUserIds = existingUsers.stream() |
| | | .map(CustomerUser::getUserId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // è¿æ»¤æå·²åå¨çç¨æ·ï¼åªä¿çæ°ç¨æ· |
| | | List<Long> newUserIds = customerDto.getUserIds().stream() |
| | | .filter(userId -> !existingUserIds.contains(userId)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (CollectionUtils.isEmpty(newUserIds)) { |
| | | return; |
| | | } |
| | | |
| | | // è·åå½åç§æ·ID |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long tenantId = loginUser.getTenantId(); |
| | | |
| | | // æ¹éä¿åæ°çå
±äº«è®°å½ |
| | | List<CustomerUser> customerUsers = newUserIds.stream() |
| | | .map(userId -> { |
| | | CustomerUser customerUser = new CustomerUser(); |
| | | customerUser.setCustomerId(customerDto.getId()); |
| | | customerUser.setUserId(userId); |
| | | customerUser.setTenantId(tenantId); |
| | | return customerUser; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | customerUserService.saveBatch(customerUsers); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean back(Long id) { |
| | | //å°å®¢æ·çtypeæ¹ä¸º1 ä¸ç´æ¥åé
ç»å½åç¨æ· |
| | | Customer customer = customerMapper.selectById(id); |
| | | customer.setType(1); |
| | | customer.setIsAssigned(1); |
| | | return this.updateById(customer); |
| | | } |
| | | |
| | | /** |
| | | * ä¸å线å½å转驼峰å½å |
| | | */ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.ruoyi.basic.mapper.CustomerUserMapper; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | import com.ruoyi.basic.service.CustomerUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Serviceå®ç°ç±» |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CustomerUserServiceImpl extends ServiceImpl<CustomerUserMapper, CustomerUser> implements CustomerUserService { |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.basic.vo.ProductModelVo; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProductModel> listPageProductModel(Page<ProductModel> page, ProductModel productModel) { |
| | | public IPage<ProductModelVo> listPageProductModel(Page<ProductModelVo> page, ProductModel productModel) { |
| | | return productModelMapper.listPageProductModel(page, productModel); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public int addOrEditProduct(ProductDto productDto) { |
| | | if (ObjectUtils.isEmpty(productDto.getParentId())) { |
| | | throw new IllegalArgumentException("è¯·éæ©ç¶èç¹"); |
| | | } |
| | | if (productDto.getId() == null) { |
| | | // æ°å¢äº§åé»è¾ |
| | | if (productDto.getParentId() == null) { |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.ruoyi.basic.mapper.CustomerReturnVisitMapper; |
| | | import com.ruoyi.basic.pojo.CustomerReturnVisit; |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.ZoneId; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ReturnVisitReminderService { |
| | | |
| | | private static final String REMINDER_QUEUE_KEY = "return_visit:reminder:queue"; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | private final RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | private final CustomerReturnVisitMapper customerReturnVisitMapper; |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public void scheduleReminder(Long returnVisitId) { |
| | | CustomerReturnVisit returnVisit = customerReturnVisitService.getById(returnVisitId); |
| | | CustomerReturnVisit returnVisit = customerReturnVisitMapper.selectById(returnVisitId); |
| | | if (returnVisit == null || returnVisit.getIsEnabled() == 0) { |
| | | return; |
| | | } |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.dto.StorageAttachmentDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.basic.mapper.StorageBlobMapper; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.service.StorageAttachmentService; |
| | | import com.ruoyi.basic.service.StorageBlobService; |
| | | import com.ruoyi.common.constant.StorageAttachmentConstants; |
| | | import com.ruoyi.common.enums.StorageAttachmentRecordType; |
| | | import com.ruoyi.common.utils.MinioUtils; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class StorageAttachmentServiceImpl extends ServiceImpl<StorageAttachmentMapper, StorageAttachment> implements StorageAttachmentService { |
| | | @Autowired |
| | | private StorageBlobMapper storageBlobMapper; |
| | | private final StorageBlobMapper storageBlobMapper; |
| | | |
| | | @Autowired |
| | | private StorageAttachmentMapper storageAttachmentMapper; |
| | | private final StorageAttachmentMapper storageAttachmentMapper; |
| | | |
| | | @Autowired |
| | | private StorageBlobService storageBlobService; |
| | | |
| | | @Autowired |
| | | private MinioUtils minioUtils; |
| | | private final StorageBlobService storageBlobService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, String fileType) { |
| | | List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordId, recordId) |
| | | .eq(StorageAttachment::getRecordType, recordType.ordinal()) |
| | | .eq(StorageAttachment::getName, fileType)); |
| | | if (storageAttachments != null) { |
| | | for (StorageAttachment storageAttachment : storageAttachments) { |
| | | StorageBlob storageBlob = storageBlobMapper.selectById(storageAttachment.getStorageBlobId()); |
| | | StorageBlobDTO storageBlobDTO = new StorageBlobDTO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobDTO); |
| | | storageBlobDTO.setUrl(minioUtils.getPreviewUrl(storageBlob.getBucketName(), storageBlob.getBucketName(), true)); |
| | | storageAttachment.setStorageBlobDTO(storageBlobDTO); |
| | | } |
| | | } |
| | | |
| | | return storageAttachments; |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStorageAttachment(StorageAttachmentDTO storageAttachmentDTO) { |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId(storageAttachmentDTO.getApplication(), RecordTypeEnum.getByType(storageAttachmentDTO.getRecordType()), storageAttachmentDTO.getRecordId(), storageAttachmentDTO.getStorageBlobDTOs()); |
| | | } |
| | | |
| | | @Override |
| | | public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType) { |
| | | // å 餿§å¾ |
| | | deleteStorageAttachment(new StorageAttachment(fileType.toString(), (long) recordType.ordinal(), recordId)); |
| | | for (StorageAttachment attachment : attachments) { |
| | | // è·åå
³èè®°å½ |
| | | StorageBlob storageBlob = attachment.getStorageBlobDTO(); |
| | | attachment.setName(fileType.toString()); |
| | | attachment.setRecordType((long) recordType.ordinal()); |
| | | attachment.setRecordId(recordId); |
| | | attachment.setStorageBlobId(storageBlob.getId()); |
| | | storageAttachmentMapper.insert(attachment); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, String fileType) { |
| | | // å 餿§å¾ |
| | | // deleteStorageAttachment(new StorageAttachment(fileType, (long) recordType.ordinal(), recordId)); |
| | | for (StorageAttachment attachment : attachments) { |
| | | // è·åå
³èè®°å½ |
| | | StorageBlob storageBlob = attachment.getStorageBlobDTO(); |
| | | attachment.setName(fileType); |
| | | attachment.setRecordType((long) recordType.ordinal()); |
| | | attachment.setRecordId(recordId); |
| | | attachment.setStorageBlobId(storageBlob.getId()); |
| | | storageAttachmentMapper.insert(attachment); |
| | | } |
| | | |
| | | public List<StorageBlobVO> list(StorageAttachmentDTO storageAttachmentDTO) { |
| | | return fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(storageAttachmentDTO); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStorageAttachment(StorageAttachment storageAttachment) { |
| | | // å
å 餿ç»è¡¨ |
| | | storageBlobService.deleteStorageBlobs(storageAttachment); |
| | | // todo fileChange |
| | | // storageBlobService.deleteStorageBlobs(storageAttachment); |
| | | // |
| | | // |
| | | // return storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>() |
| | | // .eq(StorageAttachment::getRecordId, storageAttachment.getRecordId()) |
| | | // .eq(StorageAttachment::getRecordType, storageAttachment.getRecordType()) |
| | | // .eq(StorageAttachment::getName, storageAttachment.getName())); |
| | | // } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | return storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordId, storageAttachment.getRecordId()) |
| | | .eq(StorageAttachment::getRecordType, storageAttachment.getRecordType()) |
| | | .eq(StorageAttachment::getName, storageAttachment.getName())); |
| | | @Override |
| | | public int batchDeleteStorageAttachment(List<Long> ids) { |
| | | fileUtil.deleteStorageAttachmentsByStorageAttachmentIds(ids); |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.mapper.StorageBlobMapper; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.basic.service.StorageBlobService; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.exception.file.InvalidExtensionException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.MinioUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.framework.web.domain.MinioResult; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.config.FileProperties; |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.security.Keys; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import javax.crypto.SecretKey; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * <p> |
| | | * éç¨æä»¶ä¸ä¼ çéä»¶ä¿¡æ¯ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author ruoyi |
| | | * @since 2025-05-29 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class StorageBlobServiceImpl extends ServiceImpl<StorageBlobMapper, StorageBlob> implements StorageBlobService { |
| | | @Autowired |
| | | private StorageAttachmentMapper storageAttachmentMapper; |
| | | |
| | | @Autowired |
| | | private StorageBlobMapper storageBlobMapper; |
| | | |
| | | @Autowired |
| | | private MinioUtils minioUtils; |
| | | private final FileProperties properties; |
| | | private final StorageBlobMapper storageBlobMapper; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public List<StorageBlobDTO> updateStorageBlobs(List<MultipartFile> files, String bucketName) { |
| | | |
| | | // è¥æ²¡ä¼ å
¥bucketNameï¼å使ç¨é»è®¤bucketName |
| | | if (StringUtils.isEmpty(bucketName)) { |
| | | bucketName = minioUtils.getDefaultBucket(); |
| | | public List<StorageBlobVO> upload(List<MultipartFile> files, Boolean isPublic) { |
| | | if (CollectionUtils.isEmpty(files)) { |
| | | throw new IllegalArgumentException("æä»¶ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<StorageBlobDTO> storageBlobDTOs = new ArrayList<>(); |
| | | List<StorageBlobVO> storageBlobVOS = new ArrayList<>(); |
| | | |
| | | for (MultipartFile file : files) { |
| | | try { |
| | | MinioResult res = minioUtils.upload(bucketName, file, false); |
| | | StorageBlobDTO dto = new StorageBlobDTO(); |
| | | dto.setContentType(file.getContentType()); |
| | | dto.setBucketFilename(res.getBucketFileName()); |
| | | dto.setOriginalFilename(res.getOriginalName()); |
| | | dto.setByteSize(file.getSize()); |
| | | dto.setResourceKey(IdUtils.simpleUUID()); |
| | | dto.setBucketName(bucketName); |
| | | dto.setUrl(minioUtils.getPreviewUrl(res.getBucketFileName(), bucketName, false)); |
| | | // æå
¥æ°æ®åº |
| | | storageBlobMapper.insert(dto); |
| | | |
| | | storageBlobDTOs.add(dto); |
| | | } catch (InvalidExtensionException e) { |
| | | throw new RuntimeException("minioæä»¶ä¸ä¼ å¼å¸¸ï¼" + e); |
| | | if (file == null || file.isEmpty()) { |
| | | throw new IllegalArgumentException("æä»¶ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | String originalFileName = StringUtils.hasText(file.getOriginalFilename()) |
| | | ? StringUtils.cleanPath(file.getOriginalFilename()) |
| | | : UUID.randomUUID().toString(); |
| | | String fileName = UUID.randomUUID() + "_" + originalFileName; |
| | | String relativePath = fileUtil.buildRelativePath(); |
| | | File targetDirectory = new File(properties.getPath(), relativePath); |
| | | if (!targetDirectory.exists() && !targetDirectory.mkdirs()) { |
| | | throw new RuntimeException("å建ä¸ä¼ ç®å½å¤±è´¥"); |
| | | } |
| | | File dest = new File(targetDirectory, fileName); |
| | | |
| | | StorageBlobVO storageBlob; |
| | | try { |
| | | file.transferTo(dest); |
| | | storageBlob = getStorageBlob(file, originalFileName, fileName, relativePath, isPublic); |
| | | if (storageBlob == null || storageBlob.getId() == null) { |
| | | throw new RuntimeException("æä»¶å
æ°æ®ä¿å失败"); |
| | | } |
| | | } catch (RuntimeException e) { |
| | | if (dest.exists()) { |
| | | dest.delete(); |
| | | } |
| | | throw e; |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("æä»¶ä¿å失败", e); |
| | | } |
| | | |
| | | storageBlobVOS.add(storageBlob); |
| | | } |
| | | |
| | | |
| | | return storageBlobDTOs; |
| | | return storageBlobVOS; |
| | | } |
| | | |
| | | @Override |
| | | public List<StorageBlobDTO> updateStorageBlobs(List<MultipartFile> files, String bucketName, Long type) { |
| | | |
| | | // è¥æ²¡ä¼ å
¥bucketNameï¼å使ç¨é»è®¤bucketName |
| | | if (StringUtils.isEmpty(bucketName)) { |
| | | bucketName = minioUtils.getDefaultBucket(); |
| | | } |
| | | List<StorageBlobDTO> storageBlobDTOs = new ArrayList<>(); |
| | | for (MultipartFile file : files) { |
| | | try { |
| | | validateFileExtension(file); |
| | | |
| | | MinioResult res = minioUtils.upload(bucketName, file, false); |
| | | |
| | | StorageBlobDTO dto = buildStorageBlobDTO(file, res, bucketName, type); |
| | | |
| | | storageBlobMapper.insert(dto); |
| | | storageBlobDTOs.add(dto); |
| | | |
| | | } catch (InvalidExtensionException e) { |
| | | throw new RuntimeException("䏿¯æçæä»¶ç±»åï¼" + file.getOriginalFilename(), e); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("ä¸ä¼ æä»¶å¤±è´¥ï¼" + file.getOriginalFilename(), e); |
| | | } |
| | | } |
| | | return storageBlobDTOs; |
| | | } |
| | | |
| | | private StorageBlobDTO buildStorageBlobDTO(MultipartFile file, MinioResult res, String bucketName, Long type) { |
| | | StorageBlobDTO dto = new StorageBlobDTO(); |
| | | dto.setContentType(file.getContentType()); |
| | | dto.setBucketFilename(res.getBucketFileName()); |
| | | dto.setOriginalFilename(res.getOriginalName()); |
| | | dto.setByteSize(file.getSize()); |
| | | dto.setResourceKey(IdUtils.simpleUUID()); |
| | | dto.setBucketName(bucketName); |
| | | dto.setUrl(minioUtils.getPreviewUrl(res.getBucketFileName(), bucketName, false)); |
| | | dto.setDownloadUrl(minioUtils.getDownloadUrl(res.getBucketFileName(), bucketName)); |
| | | |
| | | if (type != null) { |
| | | dto.setType(type); |
| | | public File getFileByToken(String fileName, String token) { |
| | | if (!StringUtils.hasText(token)) { |
| | | throw new IllegalArgumentException("tokenä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | | String secretStr = properties.getJwtSecret(); |
| | | |
| | | private void validateFileExtension(MultipartFile file) throws InvalidExtensionException { |
| | | String filename = file.getOriginalFilename(); |
| | | String extension = FilenameUtils.getExtension(filename).toLowerCase(); |
| | | List<String> allowedExtensions = Arrays.asList( |
| | | // å¾ç |
| | | "jpg", "jpeg", "png", "gif", "bmp", "webp", "tiff", "ico", "svg", |
| | | |
| | | // ææ¡£ |
| | | "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "rtf", "md", "csv", "odt", |
| | | |
| | | // è§é¢ |
| | | "mp4", "mov", "avi", "wmv", "flv", "mkv", "webm", "mpeg", "3gp", "MOV", |
| | | |
| | | // é³é¢ |
| | | "mp3", "wav", "ogg", "aac", "flac", "m4a", "wma", "amr", |
| | | |
| | | // å缩å
|
| | | "zip", "rar", "7z", "tar", "gz", "bz2", "xz", |
| | | |
| | | // ç¼ç¨ä»£ç æä»¶ |
| | | "java", "py", "js", "ts", "html", "css", "cpp", "c", "cs", "json", "xml", "sql", "yaml", "yml", "sh", "bat", |
| | | |
| | | // å®è£
ç¨åº & äºè¿å¶ |
| | | "exe", "apk", "dmg", "msi", "bin", "iso", |
| | | |
| | | // 设计类 |
| | | "psd", "ai", "xd", "sketch", "fig" |
| | | ); |
| | | |
| | | if (!allowedExtensions.contains(extension)) { |
| | | throw new BaseException("æä»¶ç±»åä¸è¢«å
许ï¼" + extension); |
| | | SecretKey key = Keys.hmacShaKeyFor(secretStr.getBytes(StandardCharsets.UTF_8)); |
| | | Claims claims = Jwts.parser() |
| | | .verifyWith(key) // ä»£æ¿æ§çç setSigningKey |
| | | .build() // å¿
é¡»å
æå»ºè§£æå¨ |
| | | .parseSignedClaims(token) // ä»£æ¿æ§çç parseClaimsJws |
| | | .getPayload(); // ä»£æ¿æ§çç getBody() |
| | | if (!fileName.equals(claims.getSubject())) { |
| | | throw new IllegalArgumentException("token䏿件ä¸å¹é
"); |
| | | } |
| | | fileUtil.validateTokenUsage(token); |
| | | StorageBlob storageBlob = findStorageBlob(fileName); |
| | | String path = storageBlob == null ? claims.get("path", String.class) : storageBlob.getPath(); |
| | | if (!StringUtils.hasText(path)) { |
| | | return new File(properties.getPath(), fileName); |
| | | } |
| | | return new File(new File(properties.getPath(), path), fileName); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStorageBlobs(StorageAttachment attachment) { |
| | | List<StorageAttachment> attachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordId, attachment.getRecordId()) |
| | | .eq(StorageAttachment::getRecordType, attachment.getRecordType()) |
| | | .eq(StorageAttachment::getName, attachment.getName())); |
| | | List<Long> ids = attachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return 0; |
| | | public File getPublicFile(String fileName, String publicKey) { |
| | | if (!StringUtils.hasText(fileName)) { |
| | | throw new IllegalArgumentException("æä»¶åä¸è½ä¸ºç©º"); |
| | | } |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectList(new LambdaQueryWrapper<StorageBlob>() |
| | | .in(StorageBlob::getId, ids)); |
| | | if (!storageBlobs.isEmpty()) { |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | // ç§»é¤æ¡¶å
æä»¶ |
| | | minioUtils.removeObjectsResult(storageBlob.getBucketName(), storageBlob.getBucketName()); |
| | | } |
| | | if (!StringUtils.hasText(publicKey)) { |
| | | throw new IllegalArgumentException("publicKeyä¸è½ä¸ºç©º"); |
| | | } |
| | | StorageBlob storageBlob = storageBlobMapper.selectOne(new LambdaQueryWrapper<StorageBlob>() |
| | | .eq(StorageBlob::getUidFilename, fileName) |
| | | .eq(StorageBlob::getResourceKey, publicKey) |
| | | .last("limit 1")); |
| | | if (storageBlob == null) { |
| | | throw new IllegalArgumentException("å
¬å¼æä»¶ä¸å卿publicKeyä¸å¹é
"); |
| | | } |
| | | String path = storageBlob.getPath(); |
| | | if (!StringUtils.hasText(path)) { |
| | | return new File(properties.getPath(), fileName); |
| | | } |
| | | return new File(new File(properties.getPath(), path), fileName); |
| | | } |
| | | |
| | | if (!ids.isEmpty()) { |
| | | return storageBlobMapper.delete(new QueryWrapper<StorageBlob>().lambda().in(StorageBlob::getId, ids)); |
| | | } |
| | | private StorageBlob findStorageBlob(String fileName) { |
| | | return storageBlobMapper.selectOne(new LambdaQueryWrapper<StorageBlob>() |
| | | .eq(StorageBlob::getUidFilename, fileName) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | return 0; |
| | | private StorageBlobVO getStorageBlob(MultipartFile file, String originalFileName, String fileName, String relativePath, Boolean isPublic) { |
| | | StorageBlobVO storageBlob = new StorageBlobVO(); |
| | | storageBlob.setResourceKey(UUID.randomUUID().toString().replace("-", "")); |
| | | storageBlob.setContentType(file.getContentType()); |
| | | storageBlob.setOriginalFilename(originalFileName); |
| | | storageBlob.setUidFilename(fileName); |
| | | storageBlob.setByteSize(file.getSize()); |
| | | storageBlob.setPath(relativePath); |
| | | if (isPublic) { |
| | | storageBlob.setPreviewURL(fileUtil.buildSignedUrl(storageBlob, "/preview/", BigDecimal.valueOf(-1))); |
| | | storageBlob.setDownloadURL(fileUtil.buildSignedUrl(storageBlob, "/download/", BigDecimal.valueOf(-1))); |
| | | } else { |
| | | storageBlob.setPreviewURL(fileUtil.buildSignedPreviewUrl(storageBlob)); |
| | | storageBlob.setDownloadURL(fileUtil.buildSignedDownloadUrl(storageBlob)); |
| | | } |
| | | int affectedRows = storageBlobMapper.insert(storageBlob); |
| | | if (affectedRows <= 0) { |
| | | throw new RuntimeException("æä»¶å
æ°æ®ä¿å失败"); |
| | | } |
| | | return storageBlob; |
| | | } |
| | | |
| | | @Override |
| | | public String getDownloadFileName(String fileName) { |
| | | StorageBlob storageBlob = findStorageBlob(fileName); |
| | | if (storageBlob == null || !StringUtils.hasText(storageBlob.getOriginalFilename())) { |
| | | return fileName; |
| | | } |
| | | return storageBlob.getOriginalFilename(); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.basic.mapper.SupplierManageMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.basic.service.ISupplierService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SupplierServiceImpl extends ServiceImpl<SupplierManageMapper,SupplierManage> implements ISupplierService { |
| | | |
| | | @Autowired |
| | | private SupplierManageMapper supplierMapper; |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SupplierManageMapper supplierMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | /** |
| | | * ä¾åºåæ°å¢ |
| | |
| | | import com.ruoyi.project.system.domain.SysUserClient; |
| | | import com.ruoyi.project.system.service.SysUserClientService; |
| | | import com.ruoyi.project.system.service.impl.UnipushService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class ReturnVisitReminderTask { |
| | | |
| | | private static final String REMINDER_QUEUE_KEY = "return_visit:reminder:queue"; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | private final RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | private final CustomerReturnVisitService customerReturnVisitService; |
| | | |
| | | @Autowired |
| | | private UnipushService unipushService; |
| | | private final UnipushService unipushService; |
| | | |
| | | @Autowired |
| | | private SysUserClientService userClientService; |
| | | private final SysUserClientService userClientService; |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Scheduled(fixedDelay = 60000) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.task; |
| | | |
| | | import com.ruoyi.basic.mapper.StorageBlobMapper; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.common.config.FileProperties; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayDeque; |
| | | import java.util.ArrayList; |
| | | import java.util.Deque; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | | * æ¸
çæ ææä»¶å®æ¶ä»»å¡ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class StorageBlobCleanupTask { |
| | | |
| | | private static final int DB_BATCH_SIZE = 500; |
| | | private static final int FILE_NAME_BATCH_SIZE = 1000; |
| | | |
| | | private final StorageBlobMapper storageBlobMapper; |
| | | private final FileProperties fileProperties; |
| | | |
| | | private final AtomicBoolean running = new AtomicBoolean(false); |
| | | |
| | | /** |
| | | * æ¯æ 1 å·åæ¨ 2 ç¹æ§è¡ä¸æ¬¡ï¼ |
| | | * 1. å é¤ storage_blob 䏿ªè¢« storage_attachment å
³èçè®°å½åå
¶æä»¶ |
| | | * 2. å é¤ç£çä¸ä¸åå¨äº storage_blob.uid_filename çæä»¶ |
| | | */ |
| | | @Scheduled(cron = "0 0 2 1 * ?") |
| | | public void cleanupUnusedStorageFiles() { |
| | | if (!running.compareAndSet(false, true)) { |
| | | log.warn("æä»¶æ¸
ç任塿£å¨æ§è¡ï¼æ¬æ¬¡è·³è¿"); |
| | | return; |
| | | } |
| | | |
| | | long start = System.currentTimeMillis(); |
| | | log.info("æä»¶æ¸
çä»»å¡å¼å§æ§è¡ï¼æ ¹ç®å½ï¼{}", fileProperties.getPath()); |
| | | try { |
| | | int removedBlobCount = cleanupOrphanStorageBlobs(); |
| | | int removedDiskFileCount = cleanupOrphanDiskFiles(); |
| | | long cost = System.currentTimeMillis() - start; |
| | | log.info("æä»¶æ¸
ç任塿§è¡å®æï¼å é¤å¤å¿ blob è®°å½ï¼{}ï¼å é¤ç£çæ ææä»¶ï¼{}ï¼èæ¶ï¼{} ms", |
| | | removedBlobCount, removedDiskFileCount, cost); |
| | | } catch (Exception e) { |
| | | log.error("æä»¶æ¸
ç任塿§è¡å¤±è´¥", e); |
| | | } finally { |
| | | running.set(false); |
| | | } |
| | | } |
| | | |
| | | private int cleanupOrphanStorageBlobs() { |
| | | long lastId = 0L; |
| | | int removedCount = 0; |
| | | |
| | | while (true) { |
| | | List<StorageBlob> orphanBlobs = storageBlobMapper.selectOrphanBlobsByIdRange(lastId, DB_BATCH_SIZE); |
| | | if (CollectionUtils.isEmpty(orphanBlobs)) { |
| | | break; |
| | | } |
| | | |
| | | List<Long> ids = new ArrayList<>(orphanBlobs.size()); |
| | | for (StorageBlob storageBlob : orphanBlobs) { |
| | | ids.add(storageBlob.getId()); |
| | | deleteBlobFiles(storageBlob); |
| | | } |
| | | storageBlobMapper.deleteByIdList(ids); |
| | | removedCount += ids.size(); |
| | | lastId = orphanBlobs.get(orphanBlobs.size() - 1).getId(); |
| | | |
| | | log.info("å·²å é¤ä¸æ¹å¤å¿ blobï¼batchSize={}ï¼lastId={}", ids.size(), lastId); |
| | | } |
| | | |
| | | return removedCount; |
| | | } |
| | | |
| | | private int cleanupOrphanDiskFiles() { |
| | | File rootDirectory = new File(fileProperties.getPath()); |
| | | if (!rootDirectory.exists() || !rootDirectory.isDirectory()) { |
| | | log.warn("æä»¶æ ¹ç®å½ä¸å卿䏿¯ç®å½ï¼è·³è¿ç£çæ¸
çï¼{}", fileProperties.getPath()); |
| | | return 0; |
| | | } |
| | | |
| | | int deletedCount = 0; |
| | | Deque<File> directories = new ArrayDeque<>(); |
| | | directories.push(rootDirectory); |
| | | |
| | | while (!directories.isEmpty()) { |
| | | File currentDirectory = directories.pop(); |
| | | File[] children = currentDirectory.listFiles(); |
| | | if (children == null || children.length == 0) { |
| | | continue; |
| | | } |
| | | |
| | | List<File> filesInDirectory = new ArrayList<>(); |
| | | for (File child : children) { |
| | | if (child.isDirectory()) { |
| | | directories.push(child); |
| | | } else if (child.isFile()) { |
| | | filesInDirectory.add(child); |
| | | } |
| | | } |
| | | |
| | | deletedCount += cleanupFilesInDirectory(filesInDirectory); |
| | | } |
| | | |
| | | return deletedCount; |
| | | } |
| | | |
| | | private int cleanupFilesInDirectory(List<File> filesInDirectory) { |
| | | if (CollectionUtils.isEmpty(filesInDirectory)) { |
| | | return 0; |
| | | } |
| | | |
| | | int deletedCount = 0; |
| | | for (int start = 0; start < filesInDirectory.size(); start += FILE_NAME_BATCH_SIZE) { |
| | | int end = Math.min(start + FILE_NAME_BATCH_SIZE, filesInDirectory.size()); |
| | | List<File> batchFiles = filesInDirectory.subList(start, end); |
| | | List<String> fileNames = new ArrayList<>(batchFiles.size()); |
| | | for (File file : batchFiles) { |
| | | fileNames.add(file.getName()); |
| | | } |
| | | |
| | | Set<String> existingFileNames = new HashSet<>(storageBlobMapper.selectExistingUidFilenames(fileNames)); |
| | | for (File file : batchFiles) { |
| | | if (!existingFileNames.contains(file.getName()) && safeDelete(file)) { |
| | | deletedCount++; |
| | | } |
| | | } |
| | | } |
| | | return deletedCount; |
| | | } |
| | | |
| | | private void deleteBlobFiles(StorageBlob storageBlob) { |
| | | File originalFile = resolveBlobFile(storageBlob); |
| | | safeDelete(originalFile); |
| | | |
| | | File compressedFile = resolveCompressedFile(originalFile); |
| | | safeDelete(compressedFile); |
| | | } |
| | | |
| | | private File resolveBlobFile(StorageBlob storageBlob) { |
| | | String basePath = fileProperties.getPath(); |
| | | if (!StringUtils.hasText(storageBlob.getPath())) { |
| | | return new File(basePath, storageBlob.getUidFilename()); |
| | | } |
| | | return new File(new File(basePath, storageBlob.getPath()), storageBlob.getUidFilename()); |
| | | } |
| | | |
| | | private File resolveCompressedFile(File originalFile) { |
| | | if (originalFile == null) { |
| | | return null; |
| | | } |
| | | File parent = originalFile.getParentFile(); |
| | | if (parent == null) { |
| | | return null; |
| | | } |
| | | return new File(parent, "thumb_" + originalFile.getName()); |
| | | } |
| | | |
| | | private boolean safeDelete(File file) { |
| | | if (file == null || !file.exists() || !file.isFile()) { |
| | | return false; |
| | | } |
| | | if (file.delete()) { |
| | | return true; |
| | | } |
| | | log.warn("å é¤æä»¶å¤±è´¥ï¼{}", file.getAbsolutePath()); |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.StorageAttachmentDTO; |
| | | import com.ruoyi.basic.dto.StorageAttachmentVO; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.basic.mapper.StorageBlobMapper; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.common.config.FileProperties; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.security.Keys; |
| | | import lombok.RequiredArgsConstructor; |
| | | import net.coobird.thumbnailator.Thumbnails; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.crypto.SecretKey; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class FileUtil { |
| | | private final FileProperties properties; |
| | | private final StorageAttachmentMapper storageAttachmentMapper; |
| | | private final StringRedisTemplate stringRedisTemplate; |
| | | private final StorageBlobMapper storageBlobMapper; |
| | | |
| | | private static final String TOKEN_USAGE_KEY_PREFIX = "file:token:usage:"; |
| | | private static final DateTimeFormatter YEAR_PATH_FORMATTER = DateTimeFormatter.ofPattern("yyyy"); |
| | | private static final DateTimeFormatter MONTH_DAY_PATH_FORMATTER = DateTimeFormatter.ofPattern("MMdd"); |
| | | |
| | | /** |
| | | * ä¿åéä»¶ä¿¡æ¯ |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | * @param storageBlobDTOS æä»¶ä¿¡æ¯ |
| | | */ |
| | | public void saveStorageAttachment(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, List<StorageBlobDTO> storageBlobDTOS) { |
| | | if (application == null) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | // å 餿§éä»¶ä¿¡æ¯ |
| | | deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageBlobDTOS)) { |
| | | return; |
| | | } |
| | | List<StorageAttachment> storageAttachments = new ArrayList<>(); |
| | | for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) { |
| | | StorageAttachment storageAttachment = new StorageAttachment(); |
| | | storageAttachment.setApplication(application.getType()); |
| | | storageAttachment.setRecordType(recordType.getType()); |
| | | storageAttachment.setRecordId(recordId); |
| | | storageAttachment.setStorageBlobId(storageBlobDTO.getId()); |
| | | storageAttachment.setDeleted(0L); |
| | | storageAttachments.add(storageAttachment); |
| | | } |
| | | storageAttachmentMapper.insert(storageAttachments); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åéä»¶ä¿¡æ¯ |
| | | * |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | * @param storageBlobDTOS æä»¶ä¿¡æ¯ |
| | | */ |
| | | public void saveStorageAttachmentByRecordTypeAndRecordId(String application,RecordTypeEnum recordType, Long recordId, List<StorageBlobDTO> storageBlobDTOS) { |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordId == null) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // å 餿§éä»¶ä¿¡æ¯ |
| | | if (application == null) { |
| | | for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) { |
| | | deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.getByType(storageBlobDTO.getApplication()), recordType, recordId); |
| | | } |
| | | } else { |
| | | deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.getByType(application), recordType, recordId); |
| | | } |
| | | |
| | | if (CollectionUtils.isEmpty(storageBlobDTOS)) { |
| | | deleteStorageAttachmentsByRecordTypeAndRecordId(recordType, recordId); |
| | | } |
| | | |
| | | List<StorageAttachment> storageAttachments = new ArrayList<>(); |
| | | for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) { |
| | | StorageAttachment storageAttachment = new StorageAttachment(); |
| | | storageAttachment.setApplication(Objects.requireNonNullElseGet(application, () -> ApplicationTypeEnum.getByType(storageBlobDTO.getApplication()).getType())); |
| | | storageAttachment.setRecordType(recordType.getType()); |
| | | storageAttachment.setRecordId(recordId); |
| | | storageAttachment.setStorageBlobId(storageBlobDTO.getId()); |
| | | storageAttachment.setDeleted(0L); |
| | | storageAttachments.add(storageAttachment); |
| | | } |
| | | storageAttachmentMapper.insert(storageAttachments); |
| | | } |
| | | |
| | | /** |
| | | * å é¤æä»¶ä¿¡æ¯ |
| | | * |
| | | * @param storageBlobIds æä»¶id |
| | | */ |
| | | public void deleteStorageBlobs(List<Long> storageBlobIds) { |
| | | storageBlobMapper.deleteByIds(storageBlobIds); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidå é¤æä»¶ä¿¡æ¯ |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | */ |
| | | public void deleteStorageBlobsByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectByIds(storageAttachmentIds); |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | deleteStorageBlobs(storageBlobIds); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idå é¤æä»¶ä¿¡æ¯ |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordIds å
³èè®°å½id |
| | | */ |
| | | public void deleteStorageBlobsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum application, RecordTypeEnum recordType, List<Long> recordIds) { |
| | | if (recordIds == null || recordIds.isEmpty()) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (application == null) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .in(StorageAttachment::getRecordId, recordIds) |
| | | .eq(StorageAttachment::getApplication, application.getType())); |
| | | if (CollectionUtils.isNotEmpty(storageAttachments)) { |
| | | List<Long> storageAttachmentIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId) |
| | | .collect(Collectors.toList()); |
| | | deleteStorageBlobsByStorageAttachmentIds(storageAttachmentIds); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éè¿å
³èè®°å½ç±»åãå
³èè®°å½idå é¤æä»¶ä¿¡æ¯ |
| | | * |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public void deleteStorageBlobsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId) { |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .eq(StorageAttachment::getRecordId, recordId)); |
| | | if (CollectionUtils.isNotEmpty(storageAttachments)) { |
| | | List<Long> storageAttachmentIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId) |
| | | .collect(Collectors.toList()); |
| | | deleteStorageBlobsByStorageAttachmentIds(storageAttachmentIds); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å 餿件å
³èä¿¡æ¯ |
| | | * |
| | | * @param storageAttachmentIds æä»¶å
³èid |
| | | */ |
| | | public void deleteStorageAttachmentsByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | deleteStorageBlobsByStorageAttachmentIds(storageAttachmentIds); |
| | | storageAttachmentMapper.deleteByIds(storageAttachmentIds); |
| | | } |
| | | |
| | | /** |
| | | * å 餿件å
³èä¿¡æ¯ |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public void deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (application == null) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | deleteStorageBlobsByApplicationAndRecordTypeAndRecordIds(application, recordType, Arrays.asList(recordId)); |
| | | storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .eq(StorageAttachment::getRecordId, recordId) |
| | | .eq(StorageAttachment::getApplication, application.getType())); |
| | | } |
| | | |
| | | /** |
| | | * å 餿件å
³èä¿¡æ¯ |
| | | * |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public void deleteStorageAttachmentsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId) { |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | deleteStorageBlobsByRecordTypeAndRecordId(recordType, recordId); |
| | | storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .eq(StorageAttachment::getRecordId, recordId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿件å
³èä¿¡æ¯ attachment |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordIds å
³èè®°å½id |
| | | */ |
| | | public void deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum application, RecordTypeEnum recordType, List<Long> recordIds) { |
| | | if (recordIds == null || recordIds.isEmpty()) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (application == null) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | deleteStorageBlobsByApplicationAndRecordTypeAndRecordIds(application, recordType, recordIds); |
| | | storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .in(StorageAttachment::getRecordId, recordIds) |
| | | .eq(StorageAttachment::getApplication, application.getType())); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯ attachment |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | */ |
| | | public List<StorageAttachment> getStorageAttachmentsByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | if (CollectionUtils.isEmpty(storageAttachmentIds)) { |
| | | throw new RuntimeException("æä»¶idä¸è½ä¸ºç©º"); |
| | | } |
| | | return storageAttachmentMapper.selectByIds(storageAttachmentIds); |
| | | } |
| | | |
| | | /** |
| | | * éè¿è®°å½ç±»åè·åæä»¶ä¿¡æ¯ attachmentï¼åé¡µï¼ |
| | | * |
| | | * @param storageAttachmentDTO å
³èè®°å½ä¿¡æ¯ |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(StorageAttachmentDTO storageAttachmentDTO) { |
| | | LambdaQueryWrapper<StorageAttachment> queryWrapper = new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, storageAttachmentDTO.getRecordType()) |
| | | .eq(StorageAttachment::getRecordId, storageAttachmentDTO.getRecordId()); |
| | | if (storageAttachmentDTO.getApplication() != null) { |
| | | queryWrapper.eq(StorageAttachment::getApplication, storageAttachmentDTO.getApplication()); |
| | | } |
| | | List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | return getStorageBlobVOsByStorageAttachmentIds(storageAttachments.stream().map(StorageAttachment::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idè·åæä»¶å
³èä¿¡æ¯ attachment |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public List<StorageAttachment> getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } if (application == null) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | return storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .eq(StorageAttachment::getRecordId, recordId) |
| | | .eq(StorageAttachment::getApplication, application.getType())); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯ blob |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | Map<Long, Long> blobIdToAttachmentIdMap = storageAttachments.stream() |
| | | .collect(Collectors.toMap(StorageAttachment::getStorageBlobId, StorageAttachment::getId)); |
| | | |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | List<StorageBlobVO> storageBlobDTOS = new ArrayList<>(); |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId())); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | | return storageBlobDTOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idè·åæä»¶å
³èä¿¡æ¯ attachment |
| | | * |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public List<StorageAttachment> getStorageAttachmentsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId) { |
| | | if (recordId == null || recordId <= 0) { |
| | | throw new RuntimeException("å
³èè®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | if (recordType == null) { |
| | | throw new RuntimeException("å
³èè®°å½ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | return storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() |
| | | .eq(StorageAttachment::getRecordType, recordType.getType()) |
| | | .eq(StorageAttachment::getRecordId, recordId)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idè·åæä»¶ä¿¡æ¯ blob |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | // æå»º storageBlobId -> storageAttachmentId çæ å° |
| | | Map<Long, Long> blobIdToAttachmentIdMap = storageAttachments.stream() |
| | | .collect(Collectors.toMap(StorageAttachment::getStorageBlobId, StorageAttachment::getId)); |
| | | |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | List<StorageBlobVO> storageBlobDTOS = new ArrayList<>(); |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId())); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | | return storageBlobDTOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idè·åæä»¶ä¿¡æ¯ blob |
| | | * |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum recordType, Long recordId) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByRecordTypeAndRecordId(recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | List<StorageBlobVO> storageBlobDTOS = new ArrayList<>(); |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | | return storageBlobDTOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶ç¨éãå
³èè®°å½ç±»åãå
³èè®°å½idè·åæä»¶ä¿¡æ¯ èªå®ä¹è¿ææ¶é´ï¼åéï¼ blob |
| | | * |
| | | * @param application æä»¶ç¨é |
| | | * @param recordType å
³èè®°å½ç±»å |
| | | * @param recordId å
³èè®°å½id |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | // æå»º storageBlobId -> storageAttachmentId çæ å° |
| | | Map<Long, Long> blobIdToAttachmentIdMap = storageAttachments.stream() |
| | | .collect(Collectors.toMap(StorageAttachment::getStorageBlobId, StorageAttachment::getId)); |
| | | |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | List<StorageBlobVO> storageBlobDTOS = new ArrayList<>(); |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedUrl(storageBlobVO, "/preview/", expired)); |
| | | storageBlobVO.setDownloadURL(buildSignedUrl(storageBlobVO, "/download/", expired)); |
| | | storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId())); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | | return storageBlobDTOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯åå¨è¿ææ¶é´ èªå®ä¹è¿ææ¶é´ï¼åéï¼ blob |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<StorageBlobVO> getStorageBlobVOsByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return null; |
| | | } |
| | | List<Long> storageBlobIds = storageAttachments.stream().map(StorageAttachment::getStorageBlobId).collect(Collectors.toList()); |
| | | List<StorageBlob> storageBlobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | List<StorageBlobVO> storageBlobDTOS = new ArrayList<>(); |
| | | for (StorageBlob storageBlob : storageBlobs) { |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedUrl(storageBlobVO, "/preview/", expired)); |
| | | storageBlobVO.setDownloadURL(buildSignedUrl(storageBlobVO, "/download/", expired)); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | | return storageBlobDTOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯ attachment |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | */ |
| | | public List<StorageAttachmentVO> getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>(); |
| | | for (StorageAttachment storageAttachment : storageAttachments) { |
| | | StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO(); |
| | | BeanUtils.copyProperties(storageAttachment, storageAttachmentVO); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId())); |
| | | if (CollectionUtils.isEmpty(storageBlobVOS)) { |
| | | storageAttachmentVO.setStorageBlobVOS(new ArrayList<>()); |
| | | } else { |
| | | storageAttachmentVO.setStorageBlobVOS(storageBlobVOS); |
| | | } |
| | | storageAttachmentVOS.add(storageAttachmentVO); |
| | | } |
| | | return storageAttachmentVOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯åå¨è¿ææ¶é´ èªå®ä¹è¿ææ¶é´ï¼åéï¼ attachment |
| | | * |
| | | * @param storageAttachmentIds æä»¶id |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<StorageAttachmentVO> getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>(); |
| | | for (StorageAttachment storageAttachment : storageAttachments) { |
| | | StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO(); |
| | | BeanUtils.copyProperties(storageAttachment, storageAttachmentVO); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()), expired); |
| | | if (CollectionUtils.isEmpty(storageBlobVOS)) { |
| | | storageAttachmentVO.setStorageBlobVOS(new ArrayList<>()); |
| | | } else { |
| | | storageAttachmentVO.setStorageBlobVOS(storageBlobVOS); |
| | | } |
| | | storageAttachmentVOS.add(storageAttachmentVO); |
| | | } |
| | | return storageAttachmentVOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯ attachment |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | */ |
| | | public List<StorageAttachmentVO> getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>(); |
| | | for (StorageAttachment storageAttachment : storageAttachments) { |
| | | StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO(); |
| | | BeanUtils.copyProperties(storageAttachment, storageAttachmentVO); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId())); |
| | | if (CollectionUtils.isEmpty(storageBlobVOS)) { |
| | | storageAttachmentVO.setStorageBlobVOS(new ArrayList<>()); |
| | | } else { |
| | | storageAttachmentVO.setStorageBlobVOS(storageBlobVOS); |
| | | } |
| | | storageAttachmentVOS.add(storageAttachmentVO); |
| | | } |
| | | return storageAttachmentVOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¿¡æ¯åå¨è¿ææ¶é´ èªå®ä¹è¿ææ¶é´ï¼åéï¼ attachment |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<StorageAttachmentVO> getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>(); |
| | | for (StorageAttachment storageAttachment : storageAttachments) { |
| | | StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO(); |
| | | BeanUtils.copyProperties(storageAttachment, storageAttachmentVO); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()), expired); |
| | | if (CollectionUtils.isEmpty(storageBlobVOS)) { |
| | | storageAttachmentVO.setStorageBlobVOS(new ArrayList<>()); |
| | | } else { |
| | | storageAttachmentVO.setStorageBlobVOS(storageBlobVOS); |
| | | } |
| | | storageAttachmentVOS.add(storageAttachmentVO); |
| | | } |
| | | return storageAttachmentVOS; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶é¢è§å°å |
| | | * |
| | | * @param storageAttachmentIds æä»¶å
³èid |
| | | */ |
| | | public List<String> getFilePreviewURLByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | List<String> res = new ArrayList<>(); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(storageAttachmentIds); |
| | | for (StorageBlobVO storageBlobVO : storageBlobVOS) { |
| | | res.add(buildSignedPreviewUrl(storageBlobVO)); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶é¢è§å°ååå¨è¿ææ¶é´ èªå®ä¹è¿ææ¶é´ï¼åéï¼ |
| | | * |
| | | * @param storageAttachmentIds æä»¶å
³èid |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<String> getFilePreviewURLByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) { |
| | | List<String> res = new ArrayList<>(); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(storageAttachmentIds); |
| | | for (StorageBlobVO storageBlobVO : storageBlobVOS) { |
| | | res.add(buildSignedUrl(storageBlobVO, "/preview/", expired)); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¸è½½å°å |
| | | * |
| | | * @param storageAttachmentIds æä»¶å
³èid |
| | | */ |
| | | public List<String> getFileDownloadURLByStorageAttachmentIds(List<Long> storageAttachmentIds) { |
| | | List<String> res = new ArrayList<>(); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(storageAttachmentIds); |
| | | for (StorageBlobVO storageBlobVO : storageBlobVOS) { |
| | | res.add(buildSignedDownloadUrl(storageBlobVO)); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¸è½½å°ååå¨è¿ææ¶é´ èªå®ä¹è¿ææ¶é´ï¼åéï¼ |
| | | * |
| | | * @param storageAttachmentIds æä»¶å
³èid |
| | | * @param expired è¿ææ¶é´ |
| | | */ |
| | | public List<String> getFileDownloadURLByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) { |
| | | List<String> res = new ArrayList<>(); |
| | | List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(storageAttachmentIds); |
| | | for (StorageBlobVO storageBlobVO : storageBlobVOS) { |
| | | res.add(buildSignedUrl(storageBlobVO, "/download/", expired)); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶é¢è§å°å |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | */ |
| | | public List<String> getFilePreviewURLByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return getFilePreviewURLByStorageAttachmentIds(storageAttachments.stream().map(StorageAttachment::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶é¢è§å°ååå¨è¿ææ¶é´ |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | * @param expired è¿ææ¶é´ï¼åéï¼ |
| | | */ |
| | | public List<String> getFilePreviewURLByApplicationAndRecordTypeAndRecordIdAndExpired(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return getFilePreviewURLByStorageAttachmentIds(storageAttachments.stream().map(StorageAttachment::getId).collect(Collectors.toList()), expired); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¸è½½å°å |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | */ |
| | | public List<String> getFileDownloadURLByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return getFileDownloadURLByStorageAttachmentIds(storageAttachments.stream().map(StorageAttachment::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | | * éè¿æä»¶å
³èidè·åæä»¶ä¸è½½å°ååå¨è¿ææ¶é´ |
| | | * |
| | | * @param application åºç¨ |
| | | * @param recordType è®°å½ç±»å |
| | | * @param recordId è®°å½id |
| | | * @param expired è¿ææ¶é´ï¼åéï¼ |
| | | */ |
| | | public List<String> getFileDownloadURLByApplicationAndRecordTypeAndRecordIdAndExpired(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) { |
| | | List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId); |
| | | if (CollectionUtils.isEmpty(storageAttachments)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return getFileDownloadURLByStorageAttachmentIds(storageAttachments.stream().map(StorageAttachment::getId).collect(Collectors.toList()), expired); |
| | | } |
| | | |
| | | public String buildSignedPreviewUrl(StorageBlobVO storageBlob) { |
| | | return buildSignedUrl(storageBlob, "/preview/", properties.getExpired()); |
| | | } |
| | | public String buildSignedDownloadUrl(StorageBlobVO storageBlob) { |
| | | return buildSignedUrl(storageBlob, "/download/", properties.getExpired()); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå¸¦ç¾åçURL |
| | | * |
| | | * @param storageBlob æä»¶å
æ°æ® |
| | | * @param actionPath æä½è·¯å¾ "/preview/" or "/download/" |
| | | * @param expired è¿ææ¶é´ 妿ä¸é
ç½®ï¼ä¸ä¼ åï¼å°ä½¿ç¨é»è®¤å¼120åé |
| | | * @return 带ç¾åçURL |
| | | */ |
| | | public String buildSignedUrl(StorageBlobVO storageBlob, String actionPath, BigDecimal expired) { |
| | | if (!Arrays.asList("/preview/", "/download/").contains(actionPath)) { |
| | | throw new IllegalArgumentException("æä½è·¯å¾åæ°é误"); |
| | | } |
| | | if (storageBlob == null || !StringUtils.hasText(storageBlob.getUidFilename())) { |
| | | throw new IllegalArgumentException("æä»¶ä¿¡æ¯ä¸å®æ´"); |
| | | } |
| | | String domain = StringUtils.trimTrailingCharacter(properties.getDomain(), '/'); |
| | | String prefix = properties.getUrlPrefix().startsWith("/") ? properties.getUrlPrefix() : "/" + properties.getUrlPrefix(); |
| | | String normalizedActionPath = StringUtils.hasText(actionPath) ? actionPath : "/preview/"; |
| | | if (!normalizedActionPath.startsWith("/")) { |
| | | normalizedActionPath = "/" + normalizedActionPath; |
| | | } |
| | | if (!normalizedActionPath.endsWith("/")) { |
| | | normalizedActionPath = normalizedActionPath + "/"; |
| | | } |
| | | String baseUrl = domain + prefix + normalizedActionPath + storageBlob.getUidFilename(); |
| | | |
| | | // -1 表示永ä¹
ææï¼ä¸çæ tokenï¼æ¹ä¸º publicKey ç»åæ ¡éª |
| | | if (expired != null && BigDecimal.valueOf(-1L).compareTo(expired) == 0) { |
| | | if (!StringUtils.hasText(storageBlob.getResourceKey())) { |
| | | throw new IllegalArgumentException("å
¬å¼é¾æ¥ç¼ºå°publicKey"); |
| | | } |
| | | return baseUrl + "?publicKey=" + storageBlob.getResourceKey(); |
| | | } |
| | | |
| | | long now = System.currentTimeMillis(); |
| | | BigDecimal expiredValue = expired == null ? new BigDecimal("120") : expired; |
| | | long expiredMillis = expiredValue.multiply(new BigDecimal("60000")).longValue(); |
| | | if (expiredMillis <= 0L) { |
| | | expiredMillis = 2L * 60L * 60L * 1000L; |
| | | } |
| | | Date issuedAt = new Date(now); |
| | | Date expiration = new Date(now + expiredMillis); |
| | | SecretKey key = Keys.hmacShaKeyFor(properties.getJwtSecret().getBytes(StandardCharsets.UTF_8)); |
| | | |
| | | String token = Jwts.builder() |
| | | .subject(storageBlob.getUidFilename()) |
| | | .issuedAt(issuedAt) // æ°çå»ºè®®ç´æ¥è°ç¨ .issuedAt() |
| | | .expiration(expiration) // æ°çå»ºè®®ç´æ¥è°ç¨ .expiration() |
| | | .claim("path", storageBlob.getPath()) |
| | | .claim("resourceKey", storageBlob.getResourceKey()) |
| | | .signWith(key) // éç¹ï¼ä¼ å
¥ä¸é¢çæç key 对象ï¼è䏿¯ String |
| | | .compact(); |
| | | cacheTokenUsage(token, expiredMillis); |
| | | return baseUrl + "?token=" + token; |
| | | } |
| | | |
| | | private void cacheTokenUsage(String token, long expiredMillis) { |
| | | if (!StringUtils.hasText(token)) { |
| | | return; |
| | | } |
| | | long ttl = expiredMillis > 0L ? expiredMillis : 2L * 60L * 60L * 1000L; |
| | | stringRedisTemplate.opsForValue().set(buildTokenUsageKey(token), "0", ttl, TimeUnit.MILLISECONDS); |
| | | } |
| | | |
| | | private String buildTokenUsageKey(String token) { |
| | | return TOKEN_USAGE_KEY_PREFIX + token; |
| | | } |
| | | |
| | | public String buildRelativePath() { |
| | | LocalDate now = LocalDate.now(); |
| | | return now.format(YEAR_PATH_FORMATTER) + "/" + now.format(MONTH_DAY_PATH_FORMATTER); |
| | | } |
| | | |
| | | public void validateTokenUsage(String token) { |
| | | String redisKey = buildTokenUsageKey(token); |
| | | String currentCountValue = stringRedisTemplate.opsForValue().get(redisKey); |
| | | if (!StringUtils.hasText(currentCountValue)) { |
| | | throw new IllegalArgumentException("龿¥å·²è¿ææè¾¾å°ä½¿ç¨æ¬¡æ°å¤±æ"); |
| | | } |
| | | long currentCount = Long.parseLong(currentCountValue); |
| | | int limit = resolveLimit(); |
| | | if (currentCount >= limit) { |
| | | stringRedisTemplate.delete(redisKey); |
| | | throw new IllegalArgumentException("龿¥è¾¾å°ä½¿ç¨æ¬¡æ°å¤±æ"); |
| | | } |
| | | Long updatedCount = stringRedisTemplate.opsForValue().increment(redisKey); |
| | | if (updatedCount != null && updatedCount >= limit) { |
| | | stringRedisTemplate.delete(redisKey); |
| | | } |
| | | } |
| | | |
| | | private int resolveLimit() { |
| | | return properties.getUseLimit() == null || properties.getUseLimit() <= 0 ? 10 : properties.getUseLimit(); |
| | | } |
| | | |
| | | /** |
| | | * å缩æä»¶ å¾ç |
| | | * |
| | | * @param file æä»¶ |
| | | * @return å缩åçæä»¶ |
| | | */ |
| | | public File compressFile(File file) { |
| | | if (properties.getCompress() && isImage(file.getName()) && (file.length() > properties.getNeedCompressSize().toBytes())) { |
| | | try { |
| | | // å建ä¸ä¸ªä¸´æ¶æä»¶åæ¾å缩åçå¾çï¼é¿å
ç ´ååå¾ |
| | | File compressedFile = new File(file.getParent(), "thumb_" + file.getName()); |
| | | |
| | | // 1. 妿已ç»åå¨å缩è¿çæä»¶ï¼ç´æ¥è¿åï¼ä¸åæ¶è CPU å缩 |
| | | if (compressedFile.exists()) { |
| | | return compressedFile; |
| | | } |
| | | |
| | | // ä½¿ç¨ Thumbnailator è¿è¡å缩 |
| | | Thumbnails.of(file) |
| | | .scale(1.0f) // ä¿æå尺寸 |
| | | .outputQuality(properties.getCompressQuality()) // æ ¸å¿ï¼è®¾ç½®ç»è´¨ (0.0~1.0) |
| | | .toFile(compressedFile); |
| | | |
| | | return compressedFile; |
| | | } catch (Exception e) { |
| | | // 妿å缩失败ï¼é级å¤çï¼è¿ååå¾ |
| | | return file; |
| | | } |
| | | } |
| | | return file; |
| | | } |
| | | // ç®åçåç¼å¤æ |
| | | private boolean isImage(String fileName) { |
| | | String ext = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); |
| | | return "jpg".equals(ext) || "jpeg".equals(ext) || "png".equals(ext); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.vo; |
| | | |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CustomerVo extends Customer { |
| | | @ApiModelProperty(value = "è·è¿è®°å½") |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | |
| | | private String usageUserName; |
| | | |
| | | private String togetherUserNames; |
| | | |
| | | /** |
| | | * å
±äº«ç¨æ·IDå表 |
| | | */ |
| | | private List<Long> userIds; |
| | | |
| | | /** |
| | | * å
±äº«ç¨æ·IDå符串ï¼SQLæ¥è¯¢è¿åï¼ç¨äºè½¬æ¢ä¸ºListï¼ |
| | | */ |
| | | private String userIdsStr; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.vo; |
| | | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class ProductModelVo extends ProductModel { |
| | | |
| | | private List<String> batchNoList; |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.service.DutyPlanService; |
| | | import com.ruoyi.common.utils.excel.ExcelUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/dutyPlan") |
| | | @AllArgsConstructor |
| | | public class DutyPlanController { |
| | | @Autowired |
| | | private DutyPlanService dutyPlanService; |
| | | |
| | | @GetMapping("/getList") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return AjaxResult.success(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | } |
| | | @GetMapping("/getNum") |
| | | @ApiOperation("è·åççº§æ°æ®") |
| | | @Operation(summary = "è·åççº§æ°æ®") |
| | | public AjaxResult getNum(){ |
| | | return AjaxResult.success(dutyPlanService.getNum()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.save(dutyPlan)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.updateById(dutyPlan)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | |
| | | return AjaxResult.success(dutyPlanService.removeBatchByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åº") |
| | | @Operation(summary = "导åº") |
| | | public void exportData(HttpServletResponse response, DutyPlanDTO dutyPlanDTO){ |
| | | dutyPlanService.exportData(response, dutyPlanDTO); |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingUseVo; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/meeting") |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "ä¼è®®") |
| | | @Tag(name = "ä¼è®®") |
| | | public class MeetingController { |
| | | private final MeetingService meetingService; |
| | | |
| | |
| | | return R.ok(meetingService.getMeetSummaryItems()); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¼è®®å®¤è®¾ç½®å¯¼åº") |
| | | @Operation(summary = "ä¼è®®å®¤è®¾ç½®å¯¼åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<MeetingRoom> accountExpenses = meetingService.list(); |
| | |
| | | |
| | | private final MeetDraftMapper meetDraftMapper; |
| | | |
| | | @ApiOperation(value = "ä¼è®®è稿导åº") |
| | | @Operation(summary = "ä¼è®®è稿导åº") |
| | | @PostMapping("/exportOne") |
| | | public void exportOne(HttpServletResponse response) { |
| | | List<MeetDraft> accountExpenses = meetDraftMapper.selectList(new LambdaQueryWrapper<MeetDraft>()); |
| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "éç¥å
Œ") |
| | | @Tag(name = "éç¥å
Œ") |
| | | @RequestMapping("/collaborativeApproval/notice") |
| | | public class NoticeController extends BaseController { |
| | | |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Log(title = "å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, NoticeDTO noticeDTO){ |
| | | return AjaxResult.success(noticeService.listPage(page, noticeDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "æ°å¢", businessType = BusinessType.INSERT) |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody NoticeDTO noticeDTO){ |
| | | if (noticeDTO.getStatus()==1){ |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody NoticeDTO noticeDTO){ |
| | | if (ObjectUtils.isNotNull(noticeDTO.getStatus()) && noticeDTO.getStatus()==1){ |
| | | Notice notice = noticeService.getById(noticeDTO.getId()); |
| | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | |
| | | |
| | | @GetMapping("/count") |
| | | @Log(title = "è·åå
¬åæ°é", businessType = BusinessType.OTHER) |
| | | @ApiOperation("è·åå
¬åæ°é") |
| | | @Operation(summary = "è·åå
¬åæ°é") |
| | | public AjaxResult count(){ |
| | | return AjaxResult.success(noticeService.selectCount()); |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.NoticeType; |
| | | import com.ruoyi.collaborativeApproval.service.NoticeTypeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/noticeType") |
| | | @AllArgsConstructor |
| | | public class NoticeTypeController { |
| | | |
| | | @Autowired |
| | | private NoticeTypeService noticeTypeService; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/rulesRegulationsManagement") |
| | | @AllArgsConstructor |
| | | @Api(tags = "å¶åº¦ç®¡ç") |
| | | @Tag(name = "å¶åº¦ç®¡ç") |
| | | public class RulesRegulationsManagementController { |
| | | @Autowired |
| | | private RulesRegulationsManagementService rulesRegulationsManagementService; |
| | | @Autowired |
| | | private ReadingStatusMapper readingStatusMapper; |
| | | |
| | | @GetMapping("/getList") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | rulesRegulationsManagementService.save(rulesRegulationsManagement); |
| | | return AjaxResult.success(rulesRegulationsManagement.getId()); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | |
| | | } |
| | | //è§åæ¥çæ¶æ°å¢é
è¯»ç¶æ |
| | | @PostMapping("/addReadingStatus") |
| | | @ApiOperation("æ°å¢é
è¯»ç¶æ") |
| | | @Operation(summary = "æ°å¢é
è¯»ç¶æ") |
| | | public AjaxResult addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.insert(readingStatus)); |
| | | } |
| | | @PostMapping("/updateReadingStatus") |
| | | @ApiOperation("ä¿®æ¹é
è¯»ç¶æ") |
| | | @Operation(summary = "ä¿®æ¹é
è¯»ç¶æ") |
| | | public AjaxResult updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.updateById(readingStatus)); |
| | | } |
| | | @GetMapping("/getReadingStatusList") |
| | | @ApiOperation("å页æ¥è¯¢é
è¯»ç¶æ") |
| | | @Operation(summary = "å页æ¥è¯¢é
è¯»ç¶æ") |
| | | public AjaxResult listPage(Page page, ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | } |
| | | @GetMapping("/getReadingStatusByRuleId/{ruleId}") |
| | | @ApiOperation("æ ¹æ®å¶åº¦idæ¥è¯¢é
è¯»ç¶æ") |
| | | @Operation(summary = "æ ¹æ®å¶åº¦idæ¥è¯¢é
è¯»ç¶æ") |
| | | public AjaxResult getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return AjaxResult.success(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | } |
| | | |
| | | @ApiOperation(value = "è§ç« å¶åº¦ç®¡ç导åº") |
| | | @Operation(summary = "è§ç« å¶åº¦ç®¡ç导åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<RulesRegulationsManagement> accountExpenses = rulesRegulationsManagementService.list(); |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import jakarta.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @AllArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/sealApplicationManagement") |
| | | @Api(tags = "ç¨å°ç³è¯·ç®¡ç") |
| | | @Tag(name = "ç¨å°ç³è¯·ç®¡ç") |
| | | public class SealApplicationManagementController { |
| | | @Autowired |
| | | private SealApplicationManagementService sealApplicationManagementService; |
| | | |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | |
| | | @GetMapping("/getList") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return AjaxResult.success(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody SealApplicationManagement sealApplicationManagement){ |
| | | sealApplicationManagementService.save(sealApplicationManagement); |
| | | //æ¶æ¯éç¥ |
| | |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody SealApplicationManagement sealApplicationManagement){ |
| | | return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å é¤") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | |
| | | return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ç¨å°ç³è¯·ç®¡ç导åº") |
| | | @Operation(summary = "ç¨å°ç³è¯·ç®¡ç导åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<SealApplicationManagement> accountExpenses = sealApplicationManagementService.list(); |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.StaffContactsPersonal; |
| | | import com.ruoyi.collaborativeApproval.service.StaffContactsPersonalService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/staffContactsPersonal") |
| | | @AllArgsConstructor |
| | | public class StaffContactsPersonalController { |
| | | @Autowired |
| | | private StaffContactsPersonalService staffContactsPersonalService; |
| | | |
| | | @GetMapping("/getList") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO ){ |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return AjaxResult.success(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | public AjaxResult add(@RequestBody StaffContactsPersonal staffContactsPersonal){ |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return AjaxResult.success(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @ApiOperation("å é¤") |
| | | public AjaxResult delete(@PathVariable("id") Long id){ |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("id") Long id) { |
| | | // if (CollectionUtils.isEmpty(id)) { |
| | | // throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | // } |
| | |
| | | package com.ruoyi.collaborativeApproval.dto; |
| | | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.approve.utils.ListToStringTypeHandler; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | * è®¡åæ é¢ |
| | | */ |
| | | @Excel(name = "è®¡åæ é¢") |
| | | @ApiModelProperty("è®¡åæ é¢") |
| | | @Schema(description = "è®¡åæ é¢") |
| | | private String title; |
| | | /** |
| | | * 计åæè¿° |
| | | */ |
| | | @Excel(name = "计åæè¿°") |
| | | @ApiModelProperty("计åæè¿°") |
| | | @Schema(description = "计åæè¿°") |
| | | private String description; |
| | | |
| | | |
| | |
| | | * 计åçº§å« |
| | | */ |
| | | @Excel(name = "计å级å«") |
| | | @ApiModelProperty("计å级å«") |
| | | @Schema(description = "计å级å«") |
| | | private String level; |
| | | /** |
| | | * æ¶é´å¨æ |
| | | */ |
| | | @Excel(name = "æ¶é´å¨æ") |
| | | @ApiModelProperty("æ¶é´å¨æ") |
| | | @Schema(description = "æ¶é´å¨æ") |
| | | private String period; |
| | | /** |
| | | * å¼å§æ¶é´ |
| | |
| | | * è´è´£äºº |
| | | */ |
| | | @Excel(name = "è´è´£äºº") |
| | | @ApiModelProperty("è´è´£äºº") |
| | | @Schema(description = "è´è´£äºº") |
| | | private String assignee; |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | @Excel(name = "ç¶æ") |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private String status; |
| | | /** |
| | | * ä¼å
级 |
| | | */ |
| | | @Excel(name = "ä¼å
级") |
| | | @ApiModelProperty("ä¼å
级") |
| | | @Schema(description = "ä¼å
级") |
| | | private String priority; |
| | | /** |
| | | * å®æåº¦ |
| | | */ |
| | | @Excel(name = "å®æåº¦") |
| | | @ApiModelProperty("å®æåº¦") |
| | | @Schema(description = "å®æåº¦") |
| | | private Integer progress; |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @Excel(name = "æ ç¾") |
| | | @ApiModelProperty("æ ç¾") |
| | | @Schema(description = "æ ç¾") |
| | | @TableField(value = "tags",typeHandler = ListToStringTypeHandler.class,jdbcType = JdbcType.VARCHAR) |
| | | private List<String> tags; |
| | | /** |
| | |
| | | private Long tenantId; |
| | | |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | */ |
| | | @Data |
| | | @TableName("notice") |
| | | @ApiModel |
| | | @Schema |
| | | public class Notice { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | /** |
| | | * å
¬åæ é¢ |
| | | */ |
| | | @ApiModelProperty("å
¬åæ é¢") |
| | | @Schema(description = "å
¬åæ é¢") |
| | | private String title; |
| | | |
| | | /** |
| | | * å
¬åç±»å |
| | | */ |
| | | @ApiModelProperty("å
¬åç±»å") |
| | | @Schema(description = "å
¬åç±»å") |
| | | private String type; |
| | | |
| | | /** |
| | | * ç¶æï¼0è稿 1åå¸ 2å·²ä¸çº¿ï¼ |
| | | */ |
| | | @ApiModelProperty("ç¶æï¼0è稿 1åå¸ 2å·²ä¸çº¿ï¼") |
| | | @Schema(description = "ç¶æï¼0è稿 1åå¸ 2å·²ä¸çº¿ï¼") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * å
¬åå
容 |
| | | */ |
| | | @ApiModelProperty("å
¬åå
容") |
| | | @Schema(description = "å
¬åå
容") |
| | | private String content; |
| | | |
| | | /** |
| | | * ä¼å
级(1æ®é 2éè¦ 3ç´§æ¥) |
| | | */ |
| | | @ApiModelProperty("ä¼å
级(1æ®é 2éè¦ 3ç´§æ¥)") |
| | | @Schema(description = "ä¼å
级(1æ®é 2éè¦ 3ç´§æ¥)") |
| | | private Integer priority; |
| | | |
| | | |
| | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("notice_type") |
| | | @ApiModel(value = "NoticeType对象", description = "éç¥å
¬åçå
¬åç±»åç»´æ¤") |
| | | @Schema(name = "NoticeType对象", description = "éç¥å
¬åçå
¬åç±»åç»´æ¤") |
| | | public class NoticeType implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("éç¥å
¬åçå
¬åç±»å") |
| | | @Schema(description = "éç¥å
¬åçå
¬åç±»å") |
| | | private String noticeType; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.approve.utils.ListToStringTypeHandler; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | /** |
| | | * å¶åº¦ç¼å· |
| | | */ |
| | | @ApiModelProperty("å¶åº¦ç¼å·") |
| | | @Schema(description = "å¶åº¦ç¼å·") |
| | | @Excel(name = "å¶åº¦ç¼å·") |
| | | private String regulationNum; |
| | | |
| | | /** |
| | | * æ é¢ |
| | | */ |
| | | @ApiModelProperty("æ é¢") |
| | | @Schema(description = "æ é¢") |
| | | @Excel(name = "æ é¢") |
| | | private String title; |
| | | /** |
| | | * å¶åº¦åç±» |
| | | */ |
| | | @ApiModelProperty("å¶åº¦åç±»") |
| | | @Schema(description = "å¶åº¦åç±»") |
| | | @Excel(name = "å¶åº¦åç±»", readConverterExp = "finance=è´¢å¡å¶åº¦,hr=人äºå¶åº¦,safety=å®å
¨å¶åº¦,tech=ææ¯å¶åº¦") |
| | | private String category; |
| | | /** |
| | | * å¶åº¦å
容 |
| | | */ |
| | | @ApiModelProperty("å¶åº¦å
容") |
| | | @Schema(description = "å¶åº¦å
容") |
| | | private String content; |
| | | /** |
| | | * çææ¶é´ |
| | |
| | | /** |
| | | * éç¨èå´ |
| | | */ |
| | | @ApiModelProperty("éç¨èå´") |
| | | @Schema(description = "éç¨èå´") |
| | | @TableField(value = "scope",typeHandler = ListToStringTypeHandler.class,jdbcType = JdbcType.VARCHAR) |
| | | private List<String> scope; |
| | | /** |
| | | * æ¯å¦éè¦ç¡®è®¤ |
| | | */ |
| | | @ApiModelProperty("æ¯å¦éè¦ç¡®è®¤") |
| | | @Schema(description = "æ¯å¦éè¦ç¡®è®¤") |
| | | private Boolean requireConfirm; |
| | | /** |
| | | * çæ¬ |
| | | */ |
| | | @ApiModelProperty("çæ¬") |
| | | @Schema(description = "çæ¬") |
| | | @Excel(name = "çæ¬") |
| | | private String version; |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | @Excel(name = "ç¶æ", readConverterExp = "repealed=å·²åºæ¢,active=çæä¸") |
| | | private String status; |
| | | /** |
| | | * å·²è¯»äººæ° |
| | | */ |
| | | @ApiModelProperty("已读人æ°") |
| | | @Schema(description = "已读人æ°") |
| | | @Excel(name = "已读人æ°") |
| | | private Integer readCount; |
| | | /** |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("rules_regulations_management_file") |
| | | @ApiModel(value = "RulesRegulationsManagementFile对象", description = "è§ç« å¶åº¦ç®¡ç--éä»¶") |
| | | @Schema(name = "RulesRegulationsManagementFile对象", description = "è§ç« å¶åº¦ç®¡ç--éä»¶") |
| | | public class RulesRegulationsManagementFile implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("æä»¶è·¯å¾") |
| | | @Schema(description = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty("æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private Integer fileSize; |
| | | |
| | | @ApiModelProperty("è§ç« å¶åº¦ID") |
| | | @Schema(description = "è§ç« å¶åº¦ID") |
| | | private Integer rulesRegulationsManagementId; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | /** |
| | | * ç³è¯·ç¼å· |
| | | */ |
| | | @ApiModelProperty("ç³è¯·ç¼å·") |
| | | @Schema(description = "ç³è¯·ç¼å·") |
| | | @Excel(name = "ç³è¯·ç¼å·") |
| | | private String applicationNum; |
| | | |
| | | /** |
| | | * å
¬åæ é¢ |
| | | */ |
| | | @ApiModelProperty("å
¬åæ é¢") |
| | | @Schema(description = "å
¬åæ é¢") |
| | | @Excel(name = "ç³è¯·æ é¢") |
| | | private String title; |
| | | /** |
| | | * ç¨å°ç±»å |
| | | */ |
| | | @ApiModelProperty("ç¨å°ç±»å") |
| | | @Schema(description = "ç¨å°ç±»å") |
| | | @Excel(name = "ç¨å°ç±»å", readConverterExp = "official=å
¬ç« ,contract=ååä¸ç¨ç« ,finance=è´¢å¡ä¸ç¨ç« ,legal=æ³äººç« ") |
| | | private String sealType; |
| | | /** |
| | | * ç³è¯·ç¨å°åå |
| | | */ |
| | | @ApiModelProperty("ç³è¯·ç¨å°åå ") |
| | | @Schema(description = "ç³è¯·ç¨å°åå ") |
| | | private String reason; |
| | | |
| | | /** |
| | | * ç´§æ¥ç¨åº¦ |
| | | */ |
| | | @ApiModelProperty("ç´§æ¥ç¨åº¦") |
| | | @Schema(description = "ç´§æ¥ç¨åº¦") |
| | | private String urgency; |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | @Excel(name = "ç¶æ", readConverterExp = "pending=å¾
审æ¹,approved=å·²éè¿,rejected=å·²æç»") |
| | | private String status; |
| | | |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.collaborativeApproval.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | // /** |
| | | // * ç¨æ·IDï¼æå±è
ï¼ |
| | | // */ |
| | | // @ApiModelProperty("ç¨æ·IDï¼æå±è
ï¼") |
| | | // @Schema(description = "ç¨æ·IDï¼æå±è
ï¼") |
| | | // private Integer userId; |
| | | |
| | | /** |
| | | * åå·¥ID |
| | | */ |
| | | @ApiModelProperty("åå·¥ID") |
| | | @Schema(description = "åå·¥ID") |
| | | private Integer contactId; |
| | | /** |
| | | * å建è
|
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.dto.DutyPlanDTO; |
| | | import com.ruoyi.collaborativeApproval.pojo.DutyPlan; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.DutyPlan; |
| | | import com.ruoyi.collaborativeApproval.service.DutyPlanService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class DutyPlanServiceImpl extends ServiceImpl<DutyPlanMapper, DutyPlan> implements DutyPlanService { |
| | | @Autowired |
| | | private DutyPlanMapper dutyPlanMapper; |
| | | private final DutyPlanMapper dutyPlanMapper; |
| | | |
| | | @Override |
| | | public IPage listPage(Page page, DutyPlanDTO dutyPlanDTO) { |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | package com.ruoyi.collaborativeApproval.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.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagementFile; |
| | | import com.ruoyi.collaborativeApproval.mapper.RulesRegulationsManagementFileMapper; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementFileService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.collaborativeApproval.mapper.RulesRegulationsManagementFileMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagementFile; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementFileService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.management.Query; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2026-01-13 01:06:41 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class RulesRegulationsManagementFileServiceImpl extends ServiceImpl<RulesRegulationsManagementFileMapper, RulesRegulationsManagementFile> implements RulesRegulationsManagementFileService { |
| | | |
| | | @Autowired |
| | | private RulesRegulationsManagementFileMapper rulesRegulationsManagementFileMapper; |
| | | private final RulesRegulationsManagementFileMapper rulesRegulationsManagementFileMapper; |
| | | |
| | | @Override |
| | | public IPage<RulesRegulationsManagementFile> listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | |
| | | import com.ruoyi.collaborativeApproval.mapper.RulesRegulationsManagementMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagement; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class RulesRegulationsManagementServiceImpl extends ServiceImpl<RulesRegulationsManagementMapper, RulesRegulationsManagement> implements RulesRegulationsManagementService { |
| | | @Autowired |
| | | private RulesRegulationsManagementMapper rulesRegulationsManagementMapper; |
| | | private final RulesRegulationsManagementMapper rulesRegulationsManagementMapper; |
| | | |
| | | @Override |
| | | public IPage<RulesRegulationsManagementDTO> listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement) { |
| | | return rulesRegulationsManagementMapper.listPage(page, rulesRegulationsManagement); |
| | |
| | | import com.ruoyi.collaborativeApproval.mapper.SealApplicationManagementMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement; |
| | | import com.ruoyi.collaborativeApproval.service.SealApplicationManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SealApplicationManagementServiceImpl extends ServiceImpl<SealApplicationManagementMapper, SealApplicationManagement> implements SealApplicationManagementService { |
| | | @Autowired |
| | | private SealApplicationManagementMapper sealApplicationManagementMapper; |
| | | private final SealApplicationManagementMapper sealApplicationManagementMapper; |
| | | |
| | | @Override |
| | | public IPage<SealApplicationManagementDTO> listPage(Page page, SealApplicationManagement sealApplicationManagement) { |
| | |
| | | package com.ruoyi.collaborativeApproval.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.collaborativeApproval.mapper.StaffContactsPersonalMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.StaffContactsPersonal; |
| | | import com.ruoyi.collaborativeApproval.service.StaffContactsPersonalService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class StaffContactsPersonalServiceImpl extends ServiceImpl<StaffContactsPersonalMapper, StaffContactsPersonal> implements StaffContactsPersonalService { |
| | | @Autowired |
| | | private StaffContactsPersonalMapper staffContactsPersonalMapper; |
| | | private final StaffContactsPersonalMapper staffContactsPersonalMapper; |
| | | |
| | | @Override |
| | | public IPage listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return staffContactsPersonalMapper.listPage(page, staffContactsPersonalDTO); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.aop; |
| | | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import jakarta.servlet.ServletRequest; |
| | | import jakarta.servlet.ServletResponse; |
| | | import java.lang.reflect.Array; |
| | | import java.lang.reflect.Field; |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | |
| | | @Aspect |
| | | @Component |
| | | public class DataScopeAop { |
| | | |
| | | private static final String DATA_SCOPE_ALL = "1"; |
| | | private static final String DATA_SCOPE_CUSTOM = "2"; |
| | | private static final String DATA_SCOPE_DEPT = "3"; |
| | | private static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; |
| | | private static final String DATA_SCOPE_SELF = "5"; |
| | | |
| | | @Before("@within(restController)") |
| | | public void fillDataScopeCondition(JoinPoint joinPoint, RestController restController) { |
| | | System.out.println("[DataScopeAop] enter: " + joinPoint.getSignature().toShortString()); |
| | | fillDataScopeCondition(joinPoint); |
| | | } |
| | | |
| | | public void fillDataScopeCondition(JoinPoint joinPoint) { |
| | | LoginUser loginUser; |
| | | try { |
| | | loginUser = SecurityUtils.getLoginUser(); |
| | | } catch (Exception ignored) { |
| | | System.out.println("[DataScopeAop] skip: loginUser unavailable"); |
| | | return; |
| | | } |
| | | if (loginUser == null || loginUser.getUser() == null || loginUser.getUser().isAdmin()) { |
| | | System.out.println("[DataScopeAop] skip: loginUser null or admin"); |
| | | return; |
| | | } |
| | | String dataScope = loginUser.getDataScope(); |
| | | if (dataScope == null || DATA_SCOPE_ALL.equals(dataScope)) { |
| | | System.out.println("[DataScopeAop] skip: dataScope=" + dataScope); |
| | | return; |
| | | } |
| | | for (Object arg : joinPoint.getArgs()) { |
| | | bindScope(arg, loginUser, dataScope); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void bindScope(Object arg, LoginUser loginUser, String dataScope) { |
| | | if (arg == null || isIgnoredType(arg.getClass())) { |
| | | return; |
| | | } |
| | | if (arg instanceof Collection<?>) { |
| | | for (Object item : (Collection<?>) arg) { |
| | | bindScope(item, loginUser, dataScope); |
| | | } |
| | | return; |
| | | } |
| | | if (arg instanceof Map<?, ?>) { |
| | | for (Object value : ((Map<?, ?>) arg).values()) { |
| | | bindScope(value, loginUser, dataScope); |
| | | } |
| | | return; |
| | | } |
| | | if (arg.getClass().isArray()) { |
| | | int length = Array.getLength(arg); |
| | | for (int i = 0; i < length; i++) { |
| | | bindScope(Array.get(arg, i), loginUser, dataScope); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (DATA_SCOPE_SELF.equals(dataScope)) { |
| | | setFieldValue(arg, "createUser", Integer.class, loginUser.getUserId() == null ? null : loginUser.getUserId().intValue()); |
| | | return; |
| | | } |
| | | |
| | | if (DATA_SCOPE_DEPT.equals(dataScope)) { |
| | | setFieldValue(arg, "deptId", Long.class, resolveDeptId(loginUser)); |
| | | return; |
| | | } |
| | | |
| | | if (DATA_SCOPE_CUSTOM.equals(dataScope) || DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { |
| | | Long[] deptIds = loginUser.getDeptIds(); |
| | | setFieldValue(arg, "deptIds", Long[].class, deptIds); |
| | | if (deptIds != null && deptIds.length == 1) { |
| | | setFieldValue(arg, "deptId", Long.class, deptIds[0]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Long resolveDeptId(LoginUser loginUser) { |
| | | if (loginUser.getCurrentDeptId() != null) { |
| | | return loginUser.getCurrentDeptId(); |
| | | } |
| | | Long[] deptIds = loginUser.getDeptIds(); |
| | | return deptIds != null && deptIds.length > 0 ? deptIds[0] : null; |
| | | } |
| | | |
| | | private void setFieldValue(Object target, String fieldName, Class<?> fieldType, Object value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | Field field = findField(target.getClass(), fieldName); |
| | | if (field == null || !fieldType.isAssignableFrom(field.getType())) { |
| | | return; |
| | | } |
| | | try { |
| | | field.setAccessible(true); |
| | | field.set(target, value); |
| | | System.out.println("[DataScopeAop] inject: class=" + target.getClass().getSimpleName() + ", field=" + fieldName + ", value=" + value); |
| | | } catch (IllegalAccessException ignored) { |
| | | } |
| | | } |
| | | |
| | | private Field findField(Class<?> type, String fieldName) { |
| | | Class<?> current = type; |
| | | while (current != null && current != Object.class) { |
| | | try { |
| | | return current.getDeclaredField(fieldName); |
| | | } catch (NoSuchFieldException ignored) { |
| | | current = current.getSuperclass(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean isIgnoredType(Class<?> type) { |
| | | Package targetPackage = type.getPackage(); |
| | | String packageName = targetPackage == null ? "" : targetPackage.getName(); |
| | | return type.isPrimitive() |
| | | || Number.class.isAssignableFrom(type) |
| | | || CharSequence.class.isAssignableFrom(type) |
| | | || Boolean.class == type |
| | | || Character.class == type |
| | | || type.isEnum() |
| | | || Page.class.isAssignableFrom(type) |
| | | || MultipartFile.class.isAssignableFrom(type) |
| | | || ServletRequest.class.isAssignableFrom(type) |
| | | || ServletResponse.class.isAssignableFrom(type) |
| | | || packageName.startsWith("java.") |
| | | || packageName.startsWith("jakarta.") |
| | | || packageName.startsWith("jakarta.") |
| | | || packageName.startsWith("org.springframework.") |
| | | || packageName.startsWith("com.baomidou."); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.unit.DataSize; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Configuration |
| | | @Component |
| | | @ConfigurationProperties(prefix = "file", ignoreUnknownFields = true) |
| | | @Data |
| | | public class FileProperties { |
| | | private String path = "D:/upload"; |
| | | private String urlPrefix = "/file"; |
| | | private String domain = "http://localhost:8080"; |
| | | private BigDecimal expired = new BigDecimal("120"); |
| | | private Integer useLimit = 10; |
| | | // 令çç§é¥ |
| | | @Value("${token.secret}") |
| | | private String jwtSecret; |
| | | private Boolean compress; |
| | | private DataSize needCompressSize; |
| | | private float compressQuality; |
| | | } |
| | |
| | | IGNORE_TABLES.add("sys_user_dept"); |
| | | IGNORE_TABLES.add("sys_job_log"); |
| | | IGNORE_TABLES.add("gen_table"); |
| | | IGNORE_TABLES.add("gen_table_column"); |
| | | IGNORE_TABLES.add("sys_notice"); |
| | | IGNORE_TABLES.add("sys_user_client"); |
| | | IGNORE_TABLES.add("product_model"); |
| | | IGNORE_TABLES.add("ai_chat_session"); |
| | | IGNORE_TABLES.add("product"); |
| | | |
| | | } |
| | | } |
| | |
| | | Integer userId = null; |
| | | Long tenantId = null; |
| | | String userName = null; |
| | | Long deptId = null; |
| | | try { |
| | | userId = SecurityUtils.getUserId().intValue(); |
| | | tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | userName = SecurityUtils.getUsername(); |
| | | deptId = SecurityUtils.getLoginUser().getCurrentDeptId(); |
| | | } catch (Exception ignored) { |
| | | } |
| | | this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); |
| | |
| | | this.strictInsertFill(metaObject, "updateUser", Long.class, userId == null ? 0 : userId.longValue()); |
| | | this.strictInsertFill(metaObject, "createUserName", String.class, userName); |
| | | this.strictInsertFill(metaObject, "updateUserName", String.class, userName); |
| | | |
| | | this.strictInsertFill(metaObject, "deptId", Long.class, deptId); |
| | | this.strictInsertFill(metaObject, "tenantId", Long.class, tenantId); |
| | | } |
| | | |
| | |
| | | /**
|
| | | * 宿¶ä»»å¡è¿è§çå符
|
| | | */
|
| | | public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
| | | public static final String[] JOB_ERROR_STR = { "java.net.URL", "jakarta.naming.InitialContext", "org.yaml.snakeyaml",
|
| | | "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.framework.config", "com.ruoyi.project.tool" };
|
| | | }
|
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum FileNameType { |
| | | |
| | | SALE(1), // éå® |
| | |
| | | SHIP(9),//åè´§å°è´¦ |
| | | INSPECTION_PRODUCTION_BEFORE(10), |
| | | INSPECTION_PRODUCTION_AFTER(11), |
| | | INSPECTION(12);//å·¡æ£ ç产å |
| | | INSPECTION(12),//å·¡æ£ ç产å |
| | | APP(13); |
| | | |
| | | private final int value; |
| | | |
| | | FileNameType(int value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int getValue() { |
| | | return value; |
| | | |
| | | } |
| | | |
| | | // æ ¹æ®æ´æ°å¼è·å对åºçæä¸¾å¼ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum SparePartsRequisitionRecordSourceTypeEnum implements BaseEnum<Integer> { |
| | | SparePartsRequisitionRecordSourceTypeRepair(0, "ç»´ä¿®"), |
| | | SparePartsRequisitionRecordSourceTypeMaintenance(1, "ä¿å
»"); |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | | |
| | | SparePartsRequisitionRecordSourceTypeEnum(Integer code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | | |
| | | public static SparePartsRequisitionRecordSourceTypeEnum getByCode(Integer code) { |
| | | for (SparePartsRequisitionRecordSourceTypeEnum type : SparePartsRequisitionRecordSourceTypeEnum.values()) { |
| | | if (type.getCode().equals(code)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | CUSTOMIZATION_STOCK_IN("0", "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT("1", "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN("2", "ç产æ¥å·¥-å
¥åº"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_SCRAP("4", "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | PRODUCTION_SCRAP("5", "ç产æ¥å·¥-æ¥åº"), |
| | | QUALITYINSPECT_STOCK_IN("6", "è´¨æ£-åæ ¼å
¥åº"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | CUSTOMIZATION_UNSTOCK_IN("9", "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | DEFECTIVE_PASS("11", "ä¸åæ ¼-è®©æ¥æ¾è¡"), |
| | | RETURN_HE_IN("14", "éå®éè´§-åæ ¼å
¥åº"); |
| | | QUALITYINSPECT_UNSTOCK_IN("12", "è´¨æ£-ä¸åæ ¼å
¥åº"), |
| | | SALE_SHIP_STOCK_OUT("13", "éå®-åè´§åºåº"), |
| | | RETURN_HE_IN("14", "éå®éè´§-åæ ¼å
¥åº"), |
| | | RETURN_UNSTOCK_IN("15", "éå®éè´§-ä¸åæ ¼å
¥åº"), |
| | | PICK_RETURN_IN("20", "éå®éè´§-åæ ¼å
¥åº"), |
| | | PURCHASE_RETURN_STOCK_OUT("21", "éè´éè´§"); |
| | | |
| | | |
| | | |
| | | |
| | | private final String code; |
| | |
| | | CUSTOMIZATION_STOCK_OUT("1", "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | PURCHASE_RETURN_STOCK_OUT("9", "éè´éè´§"), |
| | | SALE_SHIP_STOCK_OUT("13", "éå®-åè´§åºåº"); |
| | | |
| | | private final String code; |
| | |
| | | package com.ruoyi.common.filter;
|
| | |
|
| | | import java.io.IOException;
|
| | | import javax.servlet.Filter;
|
| | | import javax.servlet.FilterChain;
|
| | | import javax.servlet.FilterConfig;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.ServletRequest;
|
| | | import javax.servlet.ServletResponse;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | 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;
|
| | |
|
| | |
| | | import java.io.ByteArrayInputStream;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStreamReader;
|
| | | import javax.servlet.ReadListener;
|
| | | import javax.servlet.ServletInputStream;
|
| | | import javax.servlet.ServletResponse;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletRequestWrapper;
|
| | | 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;
|
| | |
|
| | |
| | | import java.io.IOException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import javax.servlet.Filter;
|
| | | import javax.servlet.FilterChain;
|
| | | import javax.servlet.FilterConfig;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.ServletRequest;
|
| | | import javax.servlet.ServletResponse;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | 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;
|
| | |
|
| | |
| | |
|
| | | import java.io.ByteArrayInputStream;
|
| | | import java.io.IOException;
|
| | | import javax.servlet.ReadListener;
|
| | | import javax.servlet.ServletInputStream;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletRequestWrapper;
|
| | | 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;
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.interceptor; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; |
| | | import com.ruoyi.common.config.IgnoreTableConfig; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.BoundSql; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.apache.ibatis.reflection.SystemMetaObject; |
| | | import org.apache.ibatis.session.ResultHandler; |
| | | import org.apache.ibatis.session.RowBounds; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.Locale; |
| | | import java.util.Set; |
| | | |
| | | @Component |
| | | public class DataScopeSqlInterceptor implements InnerInterceptor { |
| | | |
| | | private static final String DATA_SCOPE_ALL = "1"; |
| | | private static final String DATA_SCOPE_CUSTOM = "2"; |
| | | private static final String DATA_SCOPE_DEPT = "3"; |
| | | private static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; |
| | | private static final String DATA_SCOPE_SELF = "5"; |
| | | private static final String DATA_SCOPE_MARKER = "/*data_scope*/"; |
| | | |
| | | @Override |
| | | public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, |
| | | ResultHandler resultHandler, BoundSql boundSql) throws SQLException { |
| | | LoginUser loginUser; |
| | | try { |
| | | loginUser = SecurityUtils.getLoginUser(); |
| | | } catch (Exception ignored) { |
| | | return; |
| | | } |
| | | if (shouldSkip(loginUser, boundSql.getSql())) { |
| | | return; |
| | | } |
| | | // è·å主表 |
| | | TableSegment tableSegment = resolveMainTable(boundSql.getSql()); |
| | | // ====================== ã表ç½ååãç´æ¥æ¾è¡ ====================== |
| | | if (tableSegment == null || ignoreTable(tableSegment.tableName)) { |
| | | return; |
| | | } |
| | | String condition = buildCondition(tableSegment.qualifier, loginUser); |
| | | if (condition == null) { |
| | | return; |
| | | } |
| | | String newSql = appendCondition(boundSql.getSql(), condition); |
| | | if (newSql.equals(boundSql.getSql())) { |
| | | return; |
| | | } |
| | | MetaObject metaObject = SystemMetaObject.forObject(boundSql); |
| | | metaObject.setValue("sql", newSql); |
| | | System.out.println("[DataScopeSqlInterceptor] rewrite: " + ms.getId()); |
| | | System.out.println("[DataScopeSqlInterceptor] sql: " + newSql); |
| | | } |
| | | |
| | | private boolean shouldSkip(LoginUser loginUser, String sql) { |
| | | if (loginUser == null || loginUser.getUser() == null || loginUser.getUser().isAdmin()) { |
| | | return true; |
| | | } |
| | | if (sql == null || sql.trim().isEmpty()) { |
| | | return true; |
| | | } |
| | | String normalizedSql = sql.toLowerCase(Locale.ROOT); |
| | | if (!normalizedSql.startsWith("select")) { |
| | | return true; |
| | | } |
| | | if (normalizedSql.contains(DATA_SCOPE_MARKER)) { |
| | | return true; |
| | | } |
| | | return DATA_SCOPE_ALL.equals(loginUser.getDataScope()); |
| | | } |
| | | |
| | | private boolean ignoreTable(String tableName) { |
| | | Set<String> ignoreTables = IgnoreTableConfig.IGNORE_TABLES; |
| | | return ignoreTables.contains(tableName); |
| | | } |
| | | |
| | | private String buildCondition(String qualifier, LoginUser loginUser) { |
| | | String prefix = qualifier + "."; |
| | | String dataScope = loginUser.getDataScope(); |
| | | if (DATA_SCOPE_SELF.equals(dataScope)) { |
| | | return prefix + "create_user = " + loginUser.getUserId(); |
| | | } |
| | | if (DATA_SCOPE_DEPT.equals(dataScope)) { |
| | | Long deptId = resolveDeptId(loginUser); |
| | | return deptId == null ? null : prefix + "dept_id = " + deptId; |
| | | } |
| | | if (DATA_SCOPE_CUSTOM.equals(dataScope) || DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { |
| | | Long[] deptIds = loginUser.getDeptIds(); |
| | | if (deptIds == null || deptIds.length == 0) { |
| | | return null; |
| | | } |
| | | StringBuilder builder = new StringBuilder(prefix).append("dept_id in ("); |
| | | for (int i = 0; i < deptIds.length; i++) { |
| | | if (i > 0) { |
| | | builder.append(", "); |
| | | } |
| | | builder.append(deptIds[i]); |
| | | } |
| | | return builder.append(')').toString(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Long resolveDeptId(LoginUser loginUser) { |
| | | if (loginUser.getCurrentDeptId() != null) { |
| | | return loginUser.getCurrentDeptId(); |
| | | } |
| | | Long[] deptIds = loginUser.getDeptIds(); |
| | | return deptIds != null && deptIds.length > 0 ? deptIds[0] : null; |
| | | } |
| | | |
| | | private String appendCondition(String sql, String condition) { |
| | | int insertPos = findInsertPosition(sql); |
| | | String prefixSql = sql.substring(0, insertPos); |
| | | String suffixSql = sql.substring(insertPos); |
| | | if (hasTopLevelKeyword(prefixSql, "where")) { |
| | | return prefixSql + " AND " + DATA_SCOPE_MARKER + " " + condition + " " + suffixSql; |
| | | } |
| | | return prefixSql + " WHERE " + DATA_SCOPE_MARKER + " " + condition + " " + suffixSql; |
| | | } |
| | | |
| | | private int findInsertPosition(String sql) { |
| | | int orderBy = findTopLevelKeyword(sql, "order by"); |
| | | int groupBy = findTopLevelKeyword(sql, "group by"); |
| | | int having = findTopLevelKeyword(sql, "having"); |
| | | int limit = findTopLevelKeyword(sql, "limit"); |
| | | int union = findTopLevelKeyword(sql, "union"); |
| | | int insertPos = sql.length(); |
| | | insertPos = minPositive(insertPos, orderBy); |
| | | insertPos = minPositive(insertPos, groupBy); |
| | | insertPos = minPositive(insertPos, having); |
| | | insertPos = minPositive(insertPos, limit); |
| | | insertPos = minPositive(insertPos, union); |
| | | return insertPos; |
| | | } |
| | | |
| | | private int minPositive(int current, int candidate) { |
| | | return candidate >= 0 && candidate < current ? candidate : current; |
| | | } |
| | | |
| | | private boolean hasTopLevelKeyword(String sql, String keyword) { |
| | | return findTopLevelKeyword(sql, keyword) >= 0; |
| | | } |
| | | |
| | | private int findTopLevelKeyword(String sql, String keyword) { |
| | | String normalizedSql = sql.toLowerCase(Locale.ROOT); |
| | | String normalizedKeyword = keyword.toLowerCase(Locale.ROOT); |
| | | int depth = 0; |
| | | for (int i = 0; i <= normalizedSql.length() - normalizedKeyword.length(); i++) { |
| | | char current = normalizedSql.charAt(i); |
| | | if (current == '(') { |
| | | depth++; |
| | | continue; |
| | | } |
| | | if (current == ')') { |
| | | depth = Math.max(0, depth - 1); |
| | | continue; |
| | | } |
| | | if (depth > 0) { |
| | | continue; |
| | | } |
| | | if (matchesKeyword(normalizedSql, i, normalizedKeyword)) { |
| | | return i; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | private boolean matchesKeyword(String sql, int index, String keyword) { |
| | | if (!sql.regionMatches(index, keyword, 0, keyword.length())) { |
| | | return false; |
| | | } |
| | | boolean startOk = index == 0 || !Character.isLetterOrDigit(sql.charAt(index - 1)); |
| | | int endIndex = index + keyword.length(); |
| | | boolean endOk = endIndex >= sql.length() || !Character.isLetterOrDigit(sql.charAt(endIndex)); |
| | | return startOk && endOk; |
| | | } |
| | | |
| | | private TableSegment resolveMainTable(String sql) { |
| | | int fromIndex = findTopLevelKeyword(sql, "from"); |
| | | if (fromIndex < 0) { |
| | | return null; |
| | | } |
| | | String fromPart = sql.substring(fromIndex + 4).trim(); |
| | | if (fromPart.isEmpty() || fromPart.charAt(0) == '(') { |
| | | return null; |
| | | } |
| | | String[] tokens = fromPart.split("\\s+"); |
| | | if (tokens.length == 0) { |
| | | return null; |
| | | } |
| | | String rawTableName = trimToken(tokens[0]); |
| | | if (rawTableName.isEmpty()) { |
| | | return null; |
| | | } |
| | | String alias = null; |
| | | if (tokens.length > 1) { |
| | | String second = trimToken(tokens[1]); |
| | | if ("as".equalsIgnoreCase(second) && tokens.length > 2) { |
| | | alias = trimToken(tokens[2]); |
| | | } else if (!isClauseKeyword(second)) { |
| | | alias = second; |
| | | } |
| | | } |
| | | String tableName = normalizeTableName(rawTableName); |
| | | String qualifier = alias != null && !alias.isEmpty() ? alias : rawTableName; |
| | | return new TableSegment(tableName, qualifier.replace("`", "")); |
| | | } |
| | | |
| | | private String trimToken(String token) { |
| | | if (token == null) { |
| | | return ""; |
| | | } |
| | | return token.replace(",", "").trim(); |
| | | } |
| | | |
| | | private String normalizeTableName(String tableName) { |
| | | String normalized = tableName.replace("`", ""); |
| | | int dotIndex = normalized.lastIndexOf('.'); |
| | | if (dotIndex >= 0) { |
| | | normalized = normalized.substring(dotIndex + 1); |
| | | } |
| | | return normalized; |
| | | } |
| | | |
| | | private boolean isClauseKeyword(String token) { |
| | | String normalized = token.toLowerCase(Locale.ROOT); |
| | | return "left".equals(normalized) |
| | | || "right".equals(normalized) |
| | | || "inner".equals(normalized) |
| | | || "outer".equals(normalized) |
| | | || "join".equals(normalized) |
| | | || "where".equals(normalized) |
| | | || "order".equals(normalized) |
| | | || "group".equals(normalized) |
| | | || "limit".equals(normalized) |
| | | || "union".equals(normalized) |
| | | || "having".equals(normalized); |
| | | } |
| | | |
| | | private static class TableSegment { |
| | | private final String tableName; |
| | | private final String qualifier; |
| | | |
| | | private TableSegment(String tableName, String qualifier) { |
| | | this.tableName = tableName; |
| | | this.qualifier = qualifier; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.utils.uuid.UUID; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | /** |
| | | * List<Integer> 转æ¢ä¸º Long[] æ°ç» |
| | | * @param ids |
| | | * @return |
| | | * @param ids ids |
| | | * @return Long[] |
| | | */ |
| | | public static Long[] listIntegerToLongArray(List<Integer> ids) { |
| | | return ids.stream() |
| | | // å¤çnullå¼ï¼å¦æå
ç´ ä¸ºnullï¼è½¬æ¢ä¸º0Lï¼å¯æ ¹æ®ä¸å¡è°æ´ï¼æ¯å¦æå¼å¸¸ï¼ |
| | | .map(id -> id != null ? id.longValue() : -1L) |
| | | // å°Stream<Long>转æ¢ä¸ºLong[]æ°ç» |
| | | .toArray(Long[]::new); |
| | | } |
| | | |
| | | /** |
| | | * å¤æç®æ idæ¯å¦å¨éå·åéçåç¬¦ä¸²ä¸ |
| | | * @param targetId |
| | | * @param str |
| | | * @return |
| | | * @param targetId targetId |
| | | * @param str source |
| | | * @return boolean |
| | | */ |
| | | public boolean isStaffIdExist(Object targetId,String str) { |
| | | // ç©ºå¼æ ¡éªï¼é¿å
空æé |
| | | if (str == null || str.trim().isEmpty() || targetId == null) { |
| | | return false; |
| | | } |
| | | // æéå·å岿æ°ç» |
| | | String[] idArray = str.split(","); |
| | | // éåæ°ç»å¤ææ¯å¦å
å«ç®æ id |
| | | for (String id : idArray) { |
| | | // å»é¤ç©ºæ ¼ï¼é²æ¢åç¬¦ä¸²ä¸æå¤ä½ç©ºæ ¼ï¼å¦"1, 121"ï¼ |
| | | String cleanId = id.trim(); |
| | | // 转æ¢ä¸ºæ°åå¹¶æ¯è¾ |
| | | try { |
| | | if (cleanId.equals(String.valueOf(targetId))) { |
| | | return true; |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | // è¥åå¨éæ°åIDï¼ç´æ¥è¿åfalse |
| | | return false; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å½å¤©ï¼åºäºcreateTimeåæ®µï¼çè®°å½æ°é |
| | | * @param mapper å®ä½ç±»å¯¹åºçBaseMapper |
| | | * @param <T> å®ä½ç±»æ³å |
| | | * @return å½å¤©è®°å½æ°é |
| | | * æ¥è¯¢å½å¤©åºäº create_time çææ°ç¼å·ï¼å¹¶çæä¸ä¸ä¸ªç¼å· |
| | | * @param mapper mapper |
| | | * @param preFix ç¼å·åç¼ |
| | | * @param code ç¼å·å段 |
| | | * @param <T> å®ä½ç±»å |
| | | * @return 订åç¼å· |
| | | */ |
| | | public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix) { |
| | | // è·åå½å¤©å¼å§æ¶é´ï¼00:00:00ï¼ |
| | | LocalDateTime todayStart = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | LocalTime.MIN |
| | | ); |
| | | // è·åå½å¤©ç»ææ¶é´ï¼23:59:59.999ï¼ |
| | | LocalDateTime todayEnd = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | LocalTime.MAX |
| | | ); |
| | | public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix,String code) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime todayStart = today.atStartOfDay(); |
| | | LocalDateTime tomorrowStart = today.plusDays(1).atStartOfDay(); |
| | | String dateStr = today.format(DateTimeFormatter.BASIC_ISO_DATE); |
| | | String codePrefix = preFix + dateStr; |
| | | |
| | | // 转æ¢ä¸ºDateç±»åï¼å¦æå®ä½ç±»ä¸createTimeæ¯LocalDateTimeå¯ç´æ¥ä½¿ç¨ï¼ |
| | | Date startDate = Date.from(todayStart.atZone(ZoneId.systemDefault()).toInstant()); |
| | | Date endDate = Date.from(todayEnd.atZone(ZoneId.systemDefault()).toInstant()); |
| | | QueryWrapper<T> wrapper = new QueryWrapper<>(); |
| | | wrapper.select(code) |
| | | .ge("create_time", todayStart) |
| | | .lt("create_time", tomorrowStart) |
| | | .likeRight(code, codePrefix) |
| | | .orderByDesc(code) |
| | | .last("LIMIT 1"); |
| | | |
| | | // æå»ºæ¥è¯¢æ¡ä»¶ |
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ge("create_time", startDate) // 大äºçäºå½å¤©å¼å§ |
| | | .lt("create_time", endDate); // å°äºå½å¤©ç»æï¼é¿å
毫ç§ç²¾åº¦é®é¢ï¼ |
| | | long nextSeq = 1; |
| | | List<Map<String, Object>> records = mapper.selectMaps(wrapper); |
| | | if (!records.isEmpty()) { |
| | | Object lastCode = records.get(0).get(code); |
| | | if (lastCode != null) { |
| | | nextSeq = extractSequence(lastCode.toString(), codePrefix) + 1; |
| | | } |
| | | } |
| | | |
| | | // æ§è¡æ¥è¯¢ |
| | | Long aLong = mapper.selectCount(queryWrapper); |
| | | // æ¼æ¥è®¢åç¼å· preFix + æ¶é´ï¼yyyyMMddï¼ + è®¢åæ°é(001) |
| | | return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)) + "-" + new Date().getTime(); |
| | | return preFix + dateStr + String.format("%03d", nextSeq); |
| | | } |
| | | |
| | | private static long extractSequence(String fullCode, String codePrefix) { |
| | | if (!fullCode.startsWith(codePrefix)) { |
| | | return 0; |
| | | } |
| | | String seqStr = fullCode.substring(codePrefix.length()).trim(); |
| | | if (seqStr.isEmpty()) { |
| | | return 0; |
| | | } |
| | | try { |
| | | return Long.parseLong(seqStr); |
| | | } catch (NumberFormatException e) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½å¤©ï¼åºäºcreateTimeåæ®µï¼çè®°å½æ°é |
| | |
| | | * @return å½å¤©è®°å½æ°é |
| | | */ |
| | | public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix) { |
| | | // è·åå½å¤©å¼å§æ¶é´ï¼00:00:00ï¼ |
| | | LocalDateTime todayStart = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | LocalTime.MIN |
| | | ); |
| | | // è·åå½å¤©ç»ææ¶é´ï¼23:59:59.999ï¼ |
| | | LocalDateTime todayEnd = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | LocalTime.MAX |
| | | ); |
| | | |
| | | // 转æ¢ä¸ºDateç±»åï¼å¦æå®ä½ç±»ä¸createTimeæ¯LocalDateTimeå¯ç´æ¥ä½¿ç¨ï¼ |
| | | Date startDate = Date.from(todayStart.atZone(ZoneId.systemDefault()).toInstant()); |
| | | Date endDate = Date.from(todayEnd.atZone(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | // æå»ºæ¥è¯¢æ¡ä»¶ |
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ge("create_time", startDate) // 大äºçäºå½å¤©å¼å§ |
| | | .lt("create_time", endDate); // å°äºå½å¤©ç»æï¼é¿å
毫ç§ç²¾åº¦é®é¢ï¼ |
| | | queryWrapper.ge("create_time", startDate) |
| | | .lt("create_time", endDate); |
| | | |
| | | // æ§è¡æ¥è¯¢ |
| | | Long aLong = mapper.selectCount(queryWrapper); |
| | | // æ¼æ¥è®¢åç¼å· preFix + æ¶é´ï¼yyyyMMddï¼ + è®¢åæ°é(001) |
| | | return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)); |
| | | } |
| | | } |
| | |
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | | import javax.servlet.ServletRequest;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import javax.servlet.http.HttpSession;
|
| | | 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;
|
| | |
| | | package com.ruoyi.common.utils.bean;
|
| | |
|
| | | import java.util.Set;
|
| | | import javax.validation.ConstraintViolation;
|
| | | import javax.validation.ConstraintViolationException;
|
| | | import javax.validation.Validator;
|
| | | import jakarta.validation.ConstraintViolation;
|
| | | import jakarta.validation.ConstraintViolationException;
|
| | | import jakarta.validation.Validator;
|
| | |
|
| | | /**
|
| | | * beanå¯¹è±¡å±æ§éªè¯
|
| | |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.ServletOutputStream; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | |
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLEncoder;
|
| | | import java.nio.charset.StandardCharsets;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | 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 java.io.InputStream;
|
| | | import java.io.InputStreamReader;
|
| | | import java.nio.charset.StandardCharsets;
|
| | | import javax.servlet.ServletRequest;
|
| | | import jakarta.servlet.ServletRequest;
|
| | | import org.apache.commons.lang3.exception.ExceptionUtils;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
| | | 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 com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.http.MediaType;
|
| | |
|
| | | import javax.net.ssl.*;
|
| | | import java.io.*;
|
| | | 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åéæ¹æ³
|
| | |
| | |
|
| | | import java.net.InetAddress;
|
| | | import java.net.UnknownHostException;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | |
|
| | |
| | | import java.util.Set;
|
| | | import java.util.UUID;
|
| | | import java.util.stream.Collectors;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.apache.commons.lang3.RegExUtils;
|
| | | import org.apache.commons.lang3.reflect.FieldUtils;
|
| | |
| | | package com.ruoyi.common.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | @Data |
| | | public class FileVo { |
| | | |
| | | @ApiModelProperty(value = "æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æä»¶è·¯å¾") |
| | | @Schema(description = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private int fileSize; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | private Integer updateUser; |
| | | |
| | | private Long id; |
| | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.common.xss;
|
| | |
|
| | | import javax.validation.Constraint;
|
| | | import javax.validation.Payload;
|
| | | import jakarta.validation.Constraint;
|
| | | import jakarta.validation.Payload;
|
| | | import java.lang.annotation.ElementType;
|
| | | import java.lang.annotation.Retention;
|
| | | import java.lang.annotation.RetentionPolicy;
|
| | |
| | | package com.ruoyi.common.xss;
|
| | |
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import javax.validation.ConstraintValidator;
|
| | | import javax.validation.ConstraintValidatorContext;
|
| | | import jakarta.validation.ConstraintValidator;
|
| | | import jakarta.validation.ConstraintValidatorContext;
|
| | | import java.util.regex.Matcher;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | |
| | | package com.ruoyi.compensationperformance.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:56 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "èªé
¬ç»©æ") |
| | | @Tag(name = "èªé
¬ç»©æ") |
| | | @RequestMapping("/compensationPerformance") |
| | | @AllArgsConstructor |
| | | public class CompensationPerformanceController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompensationPerformanceService compensationPerformanceService; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "èªé
¬ç»©æ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("èªé
¬ç»©æ-å页æ¥è¯¢") |
| | | @Operation(summary = "èªé
¬ç»©æ-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, String staffName, String payDateStr) { |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, staffName, payDateStr); |
| | | return AjaxResult.success(listPage); |
| | |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "èªé
¬ç»©æ-æ·»å ", businessType = BusinessType.INSERT) |
| | | @ApiOperation("èªé
¬ç»©æ-æ·»å ") |
| | | @Operation(summary = "èªé
¬ç»©æ-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "èªé
¬ç»©æ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("èªé
¬ç»©æ-ä¿®æ¹") |
| | | @Operation(summary = "èªé
¬ç»©æ-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "èªé
¬ç»©æ-å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("èªé
¬ç»©æ-å é¤") |
| | | @Operation(summary = "èªé
¬ç»©æ-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("compensation_performance") |
| | | @ApiModel("èªé
¬ç»©ææç»") |
| | | @Schema(name = "èªé
¬ç»©ææç»") |
| | | public class CompensationPerformance implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @ApiModelProperty("主é®") |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | /** |
| | | * åå·¥id |
| | | */ |
| | | @ApiModelProperty("åå·¥id") |
| | | @Schema(description = "åå·¥id") |
| | | private Long staffId; |
| | | |
| | | /** |
| | | * åå·¥å§å |
| | | */ |
| | | @ApiModelProperty("åå·¥å§å") |
| | | @Schema(description = "åå·¥å§å") |
| | | @Excel(name = "åå·¥å§å") |
| | | @TableField(exist = false) |
| | | private String staffName; |
| | |
| | | /** |
| | | * å²ä½åç§° |
| | | */ |
| | | @ApiModelProperty("å²ä½åç§°") |
| | | @Schema(description = "å²ä½åç§°") |
| | | @Excel(name = "å²ä½åç§°") |
| | | @TableField(exist = false) |
| | | private String postName; |
| | |
| | | /** |
| | | * é¨é¨åç§° |
| | | */ |
| | | @ApiModelProperty("é¨é¨åç§°") |
| | | @Schema(description = "é¨é¨åç§°") |
| | | @Excel(name = "é¨é¨åç§°") |
| | | @TableField(exist = false) |
| | | private String deptName; |
| | |
| | | /** |
| | | * èªèµæä»½ |
| | | */ |
| | | @ApiModelProperty("èªèµæä»½") |
| | | @Schema(description = "èªèµæä»½") |
| | | @Excel(name = "æä»½", dateFormat = "yyyy-MM", width = 20) |
| | | @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM") |
| | |
| | | /** |
| | | * åºæ¬å·¥èµ |
| | | */ |
| | | @ApiModelProperty("åºæ¬å·¥èµ") |
| | | @Schema(description = "åºæ¬å·¥èµ") |
| | | @Excel(name = "åºæ¬å·¥èµ") |
| | | private BigDecimal basicSalary; |
| | | |
| | | /** |
| | | * è®¡ä»¶å·¥èµ |
| | | */ |
| | | @ApiModelProperty("计件工èµ") |
| | | @Schema(description = "计件工èµ") |
| | | @Excel(name = "计件工èµ") |
| | | private BigDecimal pieceworkSalary; |
| | | |
| | | /** |
| | | * 计æ¶å·¥èµ |
| | | */ |
| | | @ApiModelProperty("计æ¶å·¥èµ") |
| | | @Schema(description = "计æ¶å·¥èµ") |
| | | @Excel(name = "计æ¶å·¥èµ") |
| | | private BigDecimal hourlySalary; |
| | | |
| | | /** |
| | | * å
¶ä»æ¶å
¥ |
| | | */ |
| | | @ApiModelProperty("å
¶ä»æ¶å
¥") |
| | | @Schema(description = "å
¶ä»æ¶å
¥") |
| | | @Excel(name = "å
¶ä»æ¶å
¥") |
| | | private BigDecimal otherIncome; |
| | | |
| | | /** |
| | | * 社ä¿ä¸ªäºº |
| | | */ |
| | | @ApiModelProperty("社ä¿ä¸ªäºº") |
| | | @Schema(description = "社ä¿ä¸ªäºº") |
| | | @Excel(name = "社ä¿ä¸ªäºº") |
| | | private BigDecimal socialSecurityIndividuals; |
| | | |
| | | /** |
| | | * å
¬ç§¯é个人 |
| | | */ |
| | | @ApiModelProperty("å
¬ç§¯é个人") |
| | | @Schema(description = "å
¬ç§¯é个人") |
| | | @Excel(name = "å
¬ç§¯é个人") |
| | | private BigDecimal providentFundIndividuals; |
| | | |
| | | /** |
| | | * å·¥èµä¸ªç¨ |
| | | */ |
| | | @ApiModelProperty("å·¥èµä¸ªç¨") |
| | | @Schema(description = "å·¥èµä¸ªç¨") |
| | | @Excel(name = "å·¥èµä¸ªç¨") |
| | | private BigDecimal personalIncomeTax; |
| | | |
| | | /** |
| | | * å
¶ä»æ¯åº |
| | | */ |
| | | @ApiModelProperty("å
¶ä»æ¯åº") |
| | | @Schema(description = "å
¶ä»æ¯åº") |
| | | @Excel(name = "å
¶ä»æ¯åº") |
| | | private BigDecimal otherDeductions; |
| | | |
| | | /** |
| | | * åºåå·¥èµ |
| | | */ |
| | | @ApiModelProperty("åºåå·¥èµ") |
| | | @Schema(description = "åºåå·¥èµ") |
| | | @Excel(name = "åºåå·¥èµ") |
| | | private BigDecimal payableWages; |
| | | |
| | | /** |
| | | * åºæ£å·¥èµ |
| | | */ |
| | | @ApiModelProperty("åºæ£å·¥èµ") |
| | | @Schema(description = "åºæ£å·¥èµ") |
| | | @Excel(name = "åºæ£å·¥èµ") |
| | | private BigDecimal deductibleWages; |
| | | |
| | | /** |
| | | * å®åå·¥èµ |
| | | */ |
| | | @ApiModelProperty("å®åå·¥èµ") |
| | | @Schema(description = "å®åå·¥èµ") |
| | | @Excel(name = "å®åå·¥èµ") |
| | | private BigDecimal actualWages; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Schema(description = "夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.compensationperformance.mapper.CompensationPerformanceMapper; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.compensationperformance.service.CompensationPerformanceService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class CompensationPerformanceServiceImpl extends ServiceImpl<CompensationPerformanceMapper, CompensationPerformance> implements CompensationPerformanceService { |
| | | |
| | | @Autowired |
| | | private CompensationPerformanceMapper compensationPerformanceMapper; |
| | | private final CompensationPerformanceMapper compensationPerformanceMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @date : 2025/8/29 10:28 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "å®¢æ·æè®¿") |
| | | @Tag(name = "å®¢æ·æè®¿") |
| | | @RequestMapping("/customerVisits") |
| | | @AllArgsConstructor |
| | | public class CustomerVisitsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CustomerVisitsServiceImpl customerVisitsService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "å®¢æ·æè®¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("å®¢æ·æè®¿-å页æ¥è¯¢") |
| | | @Operation(summary = "å®¢æ·æè®¿-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, CustomerVisits customerVisits) { |
| | | IPage<CustomerVisits> listPage = customerVisitsService.listPage(page, customerVisits); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-æ·»å ", businessType = BusinessType.INSERT) |
| | | @ApiOperation("å®¢æ·æè®¿-æ·»å ") |
| | | @Operation(summary = "å®¢æ·æè®¿-æ·»å ") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CustomerVisits customerVisits) { |
| | |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-ç¼è¾", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("å®¢æ·æè®¿-ç¼è¾") |
| | | @Operation(summary = "å®¢æ·æè®¿-ç¼è¾") |
| | | @PostMapping("update") |
| | | public AjaxResult updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | boolean updateResult = customerVisitsService.updateCustomerVisit(customerVisits); |
| | |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("å®¢æ·æè®¿-å é¤") |
| | | @Operation(summary = "å®¢æ·æè®¿-å é¤") |
| | | @DeleteMapping("{customerId}") |
| | | public AjaxResult deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | if (customerId == null) { |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | @TableName("customer_visits") |
| | | @Data |
| | | @Builder |
| | | @ApiModel |
| | | @Schema |
| | | public class CustomerVisits { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | /** |
| | | * è系人 |
| | | */ |
| | | @ApiModelProperty("è系人") |
| | | @Schema(description = "è系人") |
| | | private String contact; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @ApiModelProperty("èç³»çµè¯") |
| | | @Schema(description = "èç³»çµè¯") |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * ä½ç½® |
| | | */ |
| | | @ApiModelProperty("ä½ç½®") |
| | | @Schema(description = "ä½ç½®") |
| | | private String location; |
| | | |
| | | /** |
| | | * æè®¿äºº |
| | | */ |
| | | @ApiModelProperty("æè®¿äºº") |
| | | @Schema(description = "æè®¿äºº") |
| | | private String visitingPeople; |
| | | |
| | | /** |
| | | * æè®¿ç®ç |
| | | */ |
| | | @ApiModelProperty("æè®¿ç®ç") |
| | | @Schema(description = "æè®¿ç®ç") |
| | | private String purposeVisit; |
| | | |
| | | /** |
| | | * æè®¿æ¶é´ |
| | | */ |
| | | @ApiModelProperty("æè®¿æ¶é´") |
| | | @Schema(description = "æè®¿æ¶é´") |
| | | private String purposeDate; |
| | | |
| | | /** |
| | | * æè®¿å°å |
| | | */ |
| | | @ApiModelProperty("æè®¿å°å") |
| | | @Schema(description = "æè®¿å°å") |
| | | private String visitAddress; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.customervisits.mapper.CustomerVisitsMapper; |
| | | import com.ruoyi.customervisits.pojo.CustomerVisits; |
| | | import com.ruoyi.customervisits.service.CustomerVisitsService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class CustomerVisitsServiceImpl extends ServiceImpl<CustomerVisitsMapper, CustomerVisits> implements CustomerVisitsService { |
| | | |
| | | @Autowired |
| | | private CustomerVisitsMapper customerVisitsMapper; |
| | | private final CustomerVisitsMapper customerVisitsMapper; |
| | | |
| | | @Override |
| | | public IPage<CustomerVisits> listPage(Page page, CustomerVisits customerVisits) { |
| | |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Api(tags = "设å¤ç¼ºé·è®°å½ç®¡ç") |
| | | @Tag(name = "设å¤ç¼ºé·è®°å½ç®¡ç") |
| | | @RequestMapping("/defect") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | public class DeviceDefectRecordController { |
| | | @Autowired |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @ApiOperation("设å¤ç¼ºé·è®°å½å表") |
| | | @Operation(summary = "设å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | } |
| | | @ApiOperation("设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @Operation(summary = "设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/find/{deviceLedgerId}") |
| | | public AjaxResult find(@PathVariable Long deviceLedgerId) { |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ·»å 设å¤ç¼ºé·è®°å½") |
| | | @Operation(summary = "æ·»å 设å¤ç¼ºé·è®°å½") |
| | | public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | } |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | @Operation(summary = "å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceDefectRecordService.removeById(id)); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.execl.DeviceLedgerExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "设å¤å°è´¦ç®¡ç") |
| | | @Tag(name = "设å¤å°è´¦ç®¡ç") |
| | | @RequestMapping("/device/ledger") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceLedgerController { |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | |
| | | |
| | | |
| | | @ApiOperation("设å¤å°è´¦å表") |
| | | @Operation(summary = "设å¤å°è´¦å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiOperation("æ·»å 设å¤å°è´¦") |
| | | @Operation(summary = "æ·»å 设å¤å°è´¦") |
| | | public AjaxResult add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceLedgerService.getById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiOperation("ä¿®æ¹è®¾å¤å°è´¦") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤å°è´¦") |
| | | public AjaxResult update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation("å é¤è®¾å¤å°è´¦") |
| | | @Operation(summary = "å é¤è®¾å¤å°è´¦") |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiOperation("导åºè®¾å¤å°è´¦") |
| | | @Operation(summary = "导åºè®¾å¤å°è´¦") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceLedgerService.export(response, ids); |
| | | } |
| | | |
| | | @PostMapping("import") |
| | | @ApiOperation("导å
¥è®¾å¤å°è´¦") |
| | | @Operation(summary = "ä¸è½½æ¨¡æ¿") |
| | | @PostMapping("/downloadTemplate") |
| | | public void downloadTemplate(HttpServletResponse response) { |
| | | ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<>(DeviceLedgerExeclDto.class); |
| | | util.importTemplateExcel(response, "设å¤å¯¼å
¥æ¨¡æ¿"); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥è®¾å¤å°è´¦") |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @ApiOperation("è·å设å¤å°è´¦") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | public AjaxResult getDeviceLedger( ) { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | } |
| | | |
| | | @GetMapping("scanDevice") |
| | | @ApiOperation("è·å设å¤å°è´¦") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | @Anonymous |
| | | public AjaxResult scanDevice(Long id) { |
| | | List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id); |
| | |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | @Api(tags = "设å¤ä¿å
»") |
| | | @Tag(name = "设å¤ä¿å
»") |
| | | @RestController |
| | | @RequestMapping("/device/maintenance") |
| | | @AllArgsConstructor |
| | | public class DeviceMaintenanceController { |
| | | |
| | | |
| | | @Autowired |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @ApiOperation("设å¤ä¿å
»å表") |
| | | @Operation(summary = "设å¤ä¿å
»å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiOperation("æ·»å 设å¤ä¿å
»") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | } |
| | | |
| | | @PostMapping ("maintenance") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation("å é¤è®¾å¤ä¿å
»") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiOperation("导åºè®¾å¤ä¿å
»") |
| | | @Operation(summary = "导åºè®¾å¤ä¿å
»") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceMaintenanceService.export(response, ids); |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import jakarta.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/maintenanceTaskFile") |
| | | @Api(tags = "设å¤ä¿å
»éä»¶") |
| | | @Tag(name = "设å¤ä¿å
»éä»¶") |
| | | public class DeviceMaintenanceFileController { |
| | | |
| | | @Resource |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | @Api(tags = "è®¾å¤æ¥ä¿®ç®¡ç") |
| | | @Tag(name = "è®¾å¤æ¥ä¿®ç®¡ç") |
| | | @RequestMapping("/device/repair") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceRepairController { |
| | | |
| | | @Autowired |
| | | private IDeviceRepairService deviceRepairService; |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @ApiOperation("è®¾å¤æ¥ä¿®å表") |
| | | @Operation(summary = "è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return AjaxResult.success(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiOperation("æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | @Operation(summary = "æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | DeviceRepairDto byId = deviceRepairService.detailById(id); |
| | | return AjaxResult.success(byId); |
| | | return AjaxResult.success(deviceRepairService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiOperation("ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | public AjaxResult update( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | public AjaxResult update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("repair") |
| | | @ApiOperation("设å¤ç»´ä¿®") |
| | | public AjaxResult repair( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | @Operation(summary = "设å¤ç»´ä¿®") |
| | | public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation("å é¤è®¾å¤æ¥ä¿®") |
| | | @Operation(summary = "å é¤è®¾å¤æ¥ä¿®") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiOperation("导åºè®¾å¤æ¥ä¿®") |
| | | @Operation(summary = "导åºè®¾å¤æ¥ä¿®") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceRepairService.export(response, ids); |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @author :yys |
| | | * @date : 2025/12/22 14:58 |
| | | */ |
| | | @Api(tags = "设å¤ä¿å
»å®æ¶ä»»å¡ç®¡ç") |
| | | @Tag(name = "设å¤ä¿å
»å®æ¶ä»»å¡ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/deviceMaintenanceTask") |
| | | @AllArgsConstructor |
| | | public class MaintenanceTaskController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskService maintenanceTaskService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | @Operation(summary = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.add(maintenanceTask); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation(value = "ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return maintenanceTaskService.delete(ids); |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DeviceDefectRecordDto extends DeviceDefectRecord { |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("设å¤åå·") |
| | | @Schema(description = "设å¤åå·") |
| | | private String deviceModel; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | /** |
| | | * 设å¤åç |
| | | */ |
| | | @ApiModelProperty("设å¤åç") |
| | | @Schema(description = "设å¤åç") |
| | | private String deviceBrand; |
| | | |
| | | /** |
| | | * åæ¾ä½ç½® |
| | | */ |
| | | @ApiModelProperty("åæ¾ä½ç½®") |
| | | @Schema(description = "åæ¾ä½ç½®") |
| | | private String storageLocation; |
| | | |
| | | |
| | |
| | | */ |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("计åè¿è¡æ¶é´") |
| | | @Schema(description = "计åè¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planRuntimeTime; |
| | | |
| | | @ApiModelProperty("å¼å§è¿è¡æ¶é´") |
| | | @Schema(description = "å¼å§è¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startRuntimeTime; |
| | | |
| | | @ApiModelProperty("ç»æè¿è¡æ¶é´") |
| | | @Schema(description = "ç»æè¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endRuntimeTime; |
| | | |
| | | @ApiModelProperty("è¿è¡æ¶é¿") |
| | | @Schema(description = "è¿è¡æ¶é¿") |
| | | private String runtimeDuration; |
| | | |
| | | |
| | | @ApiModelProperty("æ¯å¦ææ§ 1-æ¯ 2-å¦") |
| | | @Schema(description = "æ¯å¦ææ§ 1-æ¯ 2-å¦") |
| | | private Integer isDepr; |
| | | |
| | | @ApiModelProperty("æ¯å¹´ææ§éé¢") |
| | | @Schema(description = "æ¯å¹´ææ§éé¢") |
| | | private BigDecimal annualDepreciationAmount; |
| | | |
| | | @ApiModelProperty("设å¤ç±»å") |
| | | @Schema(description = "设å¤ç±»å") |
| | | private String type; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeviceMaintenanceDto { |
| | | public class DeviceMaintenanceDto extends DeviceMaintenance { |
| | | |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»id") |
| | | @Schema(description = "设å¤ä¿å
»id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | @Schema(description = "设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("计åä¿å
»æ¥æ") |
| | | private String maintenancePlanTimeReq; |
| | | |
| | | @ApiModelProperty("计åä¿å
»æ¥æ") |
| | | private String maintenancePlanTime; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»äºº") |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»æ¥æ") |
| | | private String maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»æ¥æ") |
| | | private String maintenanceActuallyTimeReq; |
| | | |
| | | @ApiModelProperty("ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | @Schema(description = "ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @Schema(description = "ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | @Schema(description = "æ´æ°äºº") |
| | | private String updateUserName; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @Schema(description = "ç§æ·id") |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("å建人åç§°") |
| | | @Schema(description = "å建人åç§°") |
| | | private String createUserName; |
| | | |
| | | @Schema(description = "ä¿å
»å¾ç") |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeviceRepairDto { |
| | | public class DeviceRepairDto extends DeviceRepair { |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("设å¤åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | | private Date repairTime; |
| | | |
| | | @Schema(description = "æ¥ä¿®æ¶é´å符串") |
| | | private String repairTimeStr; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®äºº") |
| | | private String repairName; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®å
容") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("维修人") |
| | | private String maintenanceName; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®æ¶é´") |
| | | private Date maintenanceTime; |
| | | |
| | | @Schema(description = "ç»´ä¿®æ¶é´å符串") |
| | | private String maintenanceTimeStr; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.device.execl; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class DeviceLedgerExeclDto { |
| | |
| | | */ |
| | | @Excel(name = "设å¤åç§°" ,sort = 1) |
| | | private String deviceName; |
| | | |
| | | /** |
| | | * 设å¤ç±»å |
| | | */ |
| | | @Excel(name = "设å¤ç±»å",sort = 0,combo = {"ç产设å¤","åå
¬è®¾å¤","æ£æ¥è®¾å¤","è¿è¾è®¾å¤","å
¶ä»è®¾å¤"}) |
| | | private String type; |
| | | |
| | | @Schema(description = "计åè¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "计åè¿è¡æ¶é´",sort = 10,dateFormat = "yyyy-MM-dd") |
| | | private Date planRuntimeTime; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é",sort = 5) |
| | | private BigDecimal number; |
| | | @Excel(name = "æ°é",sort = 5, type = Excel.Type.EXPORT) |
| | | private BigDecimal number = BigDecimal.ONE; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "å«ç¨æ»ä»·",sort = 7) |
| | | @Excel(name = "å«ç¨æ»ä»·",sort = 7, type = Excel.Type.EXPORT) |
| | | private BigDecimal taxIncludingPriceTotal; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·",sort = 9) |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·",sort = 9, type = Excel.Type.EXPORT) |
| | | private BigDecimal unTaxIncludingPriceTotal; |
| | | // |
| | | // /** |
| | | // * å½å
¥æ¶é´ |
| | | // * |
| | | // */ |
| | | // @Excel(name = "å½å
¥æ¶é´",sort = 10) |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private LocalDateTime createTime; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.device.execl; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | @Excel(name = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | @Schema(description = "项ç®") |
| | | @Excel(name = "项ç®") |
| | | private String machineryCategory; |
| | | |
| | | @Excel(name = "计åä¿å
»æ¥æ", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30) |
| | | @ApiModelProperty("计åä¿å
»æ¥æ") |
| | | @Schema(description = "计åä¿å
»æ¥æ") |
| | | private Date maintenancePlanTime; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»äºº") |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | @Excel(name = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»æ¥æ") |
| | | @Schema(description = "å®é
ä¿å
»æ¥æ") |
| | | @Excel(name = "å®é
ä¿å
»æ¥æ", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30) |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | @Schema(description = "ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | @Excel(name = "ä¿å
ȍȾ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @Schema(description = "ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @Excel(name = "ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @Excel(name = "å½å
¥æ¶é´", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30) |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @Schema(description = "å建人") |
| | | // @Excel(name = "å½å
¥äºº") |
| | | private String createUser; |
| | | |
| | |
| | | |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | @Data |
| | | public class DeviceRepairExeclDto { |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | @Excel(name = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("设å¤åå·") |
| | | @Schema(description = "设å¤åå·") |
| | | @Excel(name = "设å¤åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | | @Schema(description = "项ç®") |
| | | @Excel(name = "项ç®") |
| | | private String machineryCategory; |
| | | |
| | | @Schema(description = "æ¥ä¿®æ¶é´") |
| | | @Excel(name = "æ¥ä¿®æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date repairTime; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®äºº") |
| | | @Schema(description = "æ¥ä¿®äºº") |
| | | @Excel(name = "æ¥ä¿®äºº") |
| | | private String repairName; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®å
容") |
| | | @Schema(description = "æ¥ä¿®å
容") |
| | | @Excel(name = "æ¥ä¿®å
容") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("维修人") |
| | | @Schema(description = "维修人") |
| | | @Excel(name = "维修人") |
| | | private String maintenanceName; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®æ¶é´") |
| | | @Schema(description = "ç»´ä¿®æ¶é´") |
| | | @Excel(name = "ç»´ä¿®æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDateTime maintenanceTime; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | @Schema(description = "ç»´ä¿®ç»æ") |
| | | @Excel(name = "ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | @Excel(name = "ç¶æ") |
| | | private String statusStr; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @Excel(name = "å½å
¥æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDateTime createTime; |
| | | |
| | | // @Excel(name = "å½å
¥äºº") |
| | | @ApiModelProperty("å建人") |
| | | @Schema(description = "å建人") |
| | | private String createUser; |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | DeviceMaintenanceDto detailById(Long id); |
| | | DeviceMaintenanceVo detailById(Long id); |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | List<DeviceMaintenance> list1(Long id); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | @Mapper |
| | | public interface DeviceRepairMapper extends BaseMapper<DeviceRepair> { |
| | | IPage<DeviceRepairDto> queryPage(Page page, @Param("deviceRepairDto") DeviceRepairDto deviceRepairDto); |
| | | IPage<DeviceRepairVo> queryPage(Page page, @Param("deviceRepairDto") DeviceRepairDto deviceRepairDto); |
| | | |
| | | DeviceRepairDto detailById(Long id); |
| | | DeviceRepairVo detailById(Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | @Data |
| | | @TableName("device_defect_record") |
| | | public class DeviceDefectRecord { |
| | | @ApiModelProperty("设å¤ç¼ºé·è®°å½id") |
| | | @Schema(description = "设å¤ç¼ºé·è®°å½id") |
| | | private Long id; |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | @Schema(description = "设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | @ApiModelProperty("ç¼ºé·æè¿°") |
| | | @Schema(description = "ç¼ºé·æè¿°") |
| | | private String defectDescription; |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private String status; |
| | | @ApiModelProperty("æ¶é¤æ¶é´") |
| | | @Schema(description = "æ¶é¤æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime eliminateTime; |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("device_ledger") |
| | | @ApiModel |
| | | @Schema |
| | | public class DeviceLedger { |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | /** |
| | | * 设å¤åç |
| | | */ |
| | | @ApiModelProperty("设å¤åç") |
| | | @Schema(description = "设å¤åç") |
| | | private String deviceBrand; |
| | | |
| | | /** |
| | | * åæ¾ä½ç½® |
| | | */ |
| | | @ApiModelProperty("åæ¾ä½ç½®") |
| | | @Schema(description = "åæ¾ä½ç½®") |
| | | private String storageLocation; |
| | | |
| | | /** |
| | |
| | | |
| | | /* *************************** è¿è¡ç®¡ç *************************** */ |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("计åè¿è¡æ¶é´") |
| | | @Schema(description = "计åè¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planRuntimeTime; |
| | | |
| | | @ApiModelProperty("å¼å§è¿è¡æ¶é´") |
| | | @Schema(description = "å¼å§è¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startRuntimeTime; |
| | | |
| | | @ApiModelProperty("ç»æè¿è¡æ¶é´") |
| | | @Schema(description = "ç»æè¿è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endRuntimeTime; |
| | | |
| | | @ApiModelProperty("è¿è¡æ¶é¿") |
| | | @Schema(description = "è¿è¡æ¶é¿") |
| | | private String runtimeDuration; |
| | | |
| | | @ApiModelProperty("æ¯å¦ææ§ 1-æ¯ 2-å¦") |
| | | @Schema(description = "æ¯å¦ææ§ 1-æ¯ 2-å¦") |
| | | private Integer isDepr; |
| | | |
| | | @ApiModelProperty("æ¯å¹´ææ§éé¢") |
| | | @Schema(description = "æ¯å¹´ææ§éé¢") |
| | | private BigDecimal annualDepreciationAmount; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("ç´¯è®¡ææ§") |
| | | @Schema(description = "ç´¯è®¡ææ§") |
| | | private BigDecimal deprAmount; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("åå¼") |
| | | @Schema(description = "åå¼") |
| | | private BigDecimal netValue; |
| | | |
| | | @ApiModelProperty("设å¤ç±»å") |
| | | @Schema(description = "设å¤ç±»å") |
| | | private String type; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("device_maintenance") |
| | | @ApiModel("设å¤ä¿å
»è®°å½") |
| | | @Schema(name = "设å¤ä¿å
»è®°å½") |
| | | public class DeviceMaintenance { |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»id") |
| | | @Schema(description = "设å¤ä¿å
»id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | @Schema(description = "设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("ä¿å
»ä»»å¡id") |
| | | @Schema(description = "ä¿å
»ä»»å¡id") |
| | | private Long maintenanceTaskId; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | @Schema(description = "颿¬¡") |
| | | private String frequencyType; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡è¯¦æ
") |
| | | @Schema(description = "颿¬¡è¯¦æ
") |
| | | private String frequencyDetail; |
| | | |
| | | @ApiModelProperty(value = "䏿¬¡æ§è¡æ¶é´") |
| | | @Schema(description = "䏿¬¡æ§è¡æ¶é´") |
| | | private LocalDateTime nextExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æåæ§è¡æ¶é´") |
| | | @Schema(description = "æåæ§è¡æ¶é´") |
| | | private LocalDateTime lastExecutionTime; |
| | | |
| | | @Schema(description = "设å¤é¡¹ç®") |
| | | private String machineryCategory; |
| | | |
| | | |
| | | private String deviceName; |
| | | |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("计åä¿å
»æ¥æ") |
| | | @Schema(description = "计åä¿å
»æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenancePlanTime; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»äºº") |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @ApiModelProperty("å®é
ä¿å
»æ¥æ") |
| | | @Schema(description = "å®é
ä¿å
»æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | @Schema(description = "ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @Schema(description = "ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @Schema(description = "é¢ç¨å¤ä»¶ids") |
| | | private String sparePartsIds; |
| | | |
| | | @Schema(description = "使ç¨å¤ä»¶å表") |
| | | @TableField(exist = false) |
| | | private List<SparePartUse> sparePartsUseList; |
| | | |
| | | @Data |
| | | public static class SparePartUse { |
| | | private Long id; |
| | | private Integer quantity; |
| | | } |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_maintenance_file") |
| | | @ApiModel(value = "DeviceMaintenanceFile对象", description = "设å¤ä¿å
»è®°å½éä»¶") |
| | | @Schema(name = "DeviceMaintenanceFile对象", description = "设å¤ä¿å
»è®°å½éä»¶") |
| | | public class DeviceMaintenanceFile implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("æä»¶åç§°") |
| | | @Schema(description = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("æä»¶è·¯å¾") |
| | | @Schema(description = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty("æä»¶å¤§å°") |
| | | @Schema(description = "æä»¶å¤§å°") |
| | | private Integer fileSize; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»è®°å½ID") |
| | | @Schema(description = "设å¤ä¿å
»è®°å½ID") |
| | | private Integer deviceMaintenanceId; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("åå»ºç¨æ·") |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @Schema(description = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹ç¨æ·") |
| | | @Schema(description = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("device_repair") |
| | | public class DeviceRepair { |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®id") |
| | | @Schema(description = "è®¾å¤æ¥ä¿®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | @Schema(description = "设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | private String deviceName; |
| | | |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | | @Schema(description = "æ¥ä¿®æ¶é´") |
| | | private Date repairTime; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®äºº") |
| | | @Schema(description = "æ¥ä¿®äºº") |
| | | private String repairName; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®å
容") |
| | | @Schema(description = "æ¥ä¿®å
容") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("维修人") |
| | | @Schema(description = "设å¤é¡¹ç®") |
| | | private String machineryCategory; |
| | | |
| | | |
| | | @Schema(description = "维修人") |
| | | private String maintenanceName; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®æ¶é´") |
| | | @Schema(description = "ç»´ä¿®æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenanceTime; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | @Schema(description = "ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ç»´ä¿® 1å®ç» 2 失败") |
| | | @Schema(description = "ç¶æ 0 å¾
ç»´ä¿® 1å®ç» 2 失败") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @Schema(description = "ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @Schema(description = "é¢ç¨å¤ä»¶ids") |
| | | private String sparePartsIds; |
| | | |
| | | @Schema(description = "使ç¨å¤ä»¶å表") |
| | | @TableField(exist = false) |
| | | private List<SparePartUse> sparePartsUseList; |
| | | |
| | | @Data |
| | | public static class SparePartUse { |
| | | private Long id; |
| | | private Integer quantity; |
| | | } |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | * @date : 2025/9/19 10:27 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @Schema |
| | | @TableName("maintenance_task") |
| | | public class MaintenanceTask { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | /** |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | @Excel(name = "ä¿å
»ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | @Schema(description = "设å¤id") |
| | | private Long taskId; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | @Schema(description = "颿¬¡") |
| | | @Excel(name = "颿¬¡") |
| | | private String frequencyType; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡è¯¦æ
") |
| | | @Schema(description = "颿¬¡è¯¦æ
") |
| | | @Excel(name = "å¼å§æ¥æä¸æ¶é´") |
| | | private String frequencyDetail; |
| | | |
| | | @ApiModelProperty(value = "䏿¬¡æ§è¡æ¶é´") |
| | | @Schema(description = "䏿¬¡æ§è¡æ¶é´") |
| | | private LocalDateTime nextExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æåæ§è¡æ¶é´") |
| | | @Schema(description = "æåæ§è¡æ¶é´") |
| | | private LocalDateTime lastExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦æ¿æ´»") |
| | | @Schema(description = "æ¯å¦æ¿æ´»") |
| | | private boolean isActive; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @Schema(description = "夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥äººid") |
| | | @Schema(description = "å½å
¥äººid") |
| | | private Long registrantId; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥äºº") |
| | | @Schema(description = "å½å
¥äºº") |
| | | @Excel(name = "å½å
¥äºº") |
| | | private String registrant; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æ") |
| | | @Schema(description = "å½å
¥æ¥æ") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate registrationDate; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | @Schema(description = "ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | @Schema(description = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | private Integer deleted; |
| | | |
| | | @TableField(exist = false) |
| | | private String dateStr; |
| | | |
| | | @ApiModelProperty(value = "å建该记å½çç¨æ·") |
| | | @Schema(description = "å建该记å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½å建æ¶é´") |
| | | @Schema(description = "è®°å½å建æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | // @JsonFormat(pattern = "yyyy-MM-dd") |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @Schema(description = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½æåæ´æ°æ¶é´") |
| | | @Schema(description = "è®°å½æåæ´æ°æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | public interface IDeviceMaintenanceService extends IService<DeviceMaintenance> { |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance); |
| | | AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenance deviceMaintenance); |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceMaintenanceDto detailById(Long id); |
| | | DeviceMaintenanceVo detailById(Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | public interface IDeviceRepairService extends IService<DeviceRepair> { |
| | | |
| | | IPage<DeviceRepairDto> queryPage(Page page, DeviceRepairDto deviceRepairDto); |
| | | IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceRepair deviceRepair); |
| | | AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult updateDeviceRepair(DeviceRepair deviceRepair); |
| | | AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceRepairDto detailById(Long id); |
| | | DeviceRepairVo detailById(Long id); |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @RequiredArgsConstructor |
| | | public class DeviceDefectRecordServiceImpl extends ServiceImpl<DeviceDefectRecordMapper, DeviceDefectRecord> implements DeviceDefectRecordService { |
| | | @Autowired |
| | | private DeviceDefectRecordMapper deviceDefectRecordMapper; |
| | | |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | private final DeviceDefectRecordMapper deviceDefectRecordMapper; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | @Override |
| | | public IPage<DeviceDefectRecordDto> listPage(Page page, DeviceDefectRecordDto deviceDefectRecordDto) { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @RequiredArgsConstructor |
| | | @Slf4j |
| | | public class DeviceLedgerServiceImpl extends ServiceImpl<DeviceLedgerMapper, DeviceLedger> implements IDeviceLedgerService { |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) { |
| | |
| | | deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | } |
| | | BeanUtils.copyProperties(c,deviceLedger); |
| | | // éè¿å«ç¨åä»·ãæ°éãç¨ç计ç®å«ç¨æ»ä»·ï¼ä¸å«ç¨æ»ä»· |
| | | deviceLedger.setTaxIncludingPriceTotal(c.getTaxIncludingPriceUnit()); |
| | | deviceLedger.setNumber(BigDecimal.ONE); |
| | | deviceLedger.setPlanRuntimeTime(DateUtils.toLocalDate(c.getPlanRuntimeTime())); |
| | | deviceLedger.setUnTaxIncludingPriceTotal(deviceLedger.getTaxIncludingPriceTotal().divide(BigDecimal.ONE.add(c.getTaxRate()),2, RoundingMode.HALF_UP)); |
| | | deviceLedgerMapper.insert(deviceLedger); |
| | | }); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class DeviceMaintenanceServiceImpl extends ServiceImpl<DeviceMaintenanceMapper, DeviceMaintenance> implements IDeviceMaintenanceService { |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | private final DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | private final SparePartsMapper sparePartsMapper; |
| | | private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenance deviceMaintenance) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceMaintenance oldDeviceMaintenance = this.getById(deviceMaintenance.getId()); |
| | | // å¤çå¤ä»¶ä½¿ç¨æ
åµ |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(deviceMaintenance.getSparePartsUseList())) { |
| | | List<Long> sparePartIds = new ArrayList<>(); |
| | | for (DeviceMaintenance.SparePartUse sparePartUse : deviceMaintenance.getSparePartsUseList()) { |
| | | // è·åå¤ä»¶ä¿¡æ¯ |
| | | SpareParts spareParts = sparePartsMapper.selectById(sparePartUse.getId()); |
| | | if (spareParts != null) { |
| | | // æ£æ¥æ°éæ¯å¦è¶³å¤ |
| | | if (spareParts.getQuantity().compareTo(new BigDecimal(sparePartUse.getQuantity())) >= 0) { |
| | | // æ´æ°æ°é |
| | | spareParts.setQuantity(spareParts.getQuantity().subtract(new BigDecimal(sparePartUse.getQuantity()))); |
| | | sparePartsMapper.updateById(spareParts); |
| | | sparePartIds.add(sparePartUse.getId()); |
| | | |
| | | // å建å¤ä»¶é¢ç¨è®°å½ |
| | | SparePartsRequisitionRecord record = new SparePartsRequisitionRecord(); |
| | | record.setSourceType(1); // 1 ä¿å
» |
| | | record.setSourceId(deviceMaintenance.getId()); |
| | | record.setDeviceLedgerId(oldDeviceMaintenance.getDeviceLedgerId()); |
| | | record.setSparePartsId(sparePartUse.getId()); |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | | // æ´æ°å¤ä»¶IDsåæ®µ |
| | | if (!sparePartIds.isEmpty()) { |
| | | deviceMaintenance.setSparePartsIds(StringUtils.join(sparePartIds, ",")); |
| | | } |
| | | } |
| | | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DeviceMaintenanceDto detailById(Long id) { |
| | | |
| | | return deviceMaintenanceMapper.detailById(id); |
| | | public DeviceMaintenanceVo detailById(Long id) { |
| | | DeviceMaintenanceVo vo = deviceMaintenanceMapper.detailById(id); |
| | | vo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.DEVICE_MAINTENANCE, id)); |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.AllArgsConstructor; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @RequiredArgsConstructor |
| | | @Slf4j |
| | | public class DeviceRepairServiceImpl extends ServiceImpl<DeviceRepairMapper, DeviceRepair> implements IDeviceRepairService { |
| | | |
| | | @Autowired |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | @Override |
| | | public IPage<DeviceRepairDto> queryPage(Page page, DeviceRepairDto deviceRepairDto) { |
| | | private final DeviceDefectRecordService deviceDefectRecordService; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | private final IDeviceLedgerService deviceLedgerService; |
| | | private final SparePartsMapper sparePartsMapper; |
| | | private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | return deviceRepairMapper.queryPage(page, deviceRepairDto); |
| | | @Override |
| | | public IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto) { |
| | | IPage<DeviceRepairVo> pageDto = deviceRepairMapper.queryPage(page, deviceRepairDto); |
| | | for (DeviceRepairVo vo : pageDto.getRecords()) { |
| | | vo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.DEVICE_REPAIR, vo.getId())); |
| | | } |
| | | return pageDto; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceRepair(DeviceRepair deviceRepair) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceRepair.getDeviceLedgerId()); |
| | | deviceRepair.setDeviceName(byId.getDeviceName()); |
| | | deviceRepair.setDeviceModel(byId.getDeviceModel()); |
| | | boolean save = this.save(deviceRepair); |
| | | if (save){ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceRepairDto.getDeviceLedgerId()); |
| | | deviceRepairDto.setDeviceName(byId.getDeviceName()); |
| | | deviceRepairDto.setDeviceModel(byId.getDeviceModel()); |
| | | boolean save = this.save(deviceRepairDto); |
| | | if (save) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, deviceRepairDto.getId(), deviceRepairDto.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return AjaxResult.error("ä¿å失败"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceRepair(DeviceRepair deviceRepair) { |
| | | if (this.updateById(deviceRepair)) { |
| | | Long id = deviceRepair.getId(); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | // å¤çå¤ä»¶ä½¿ç¨æ
åµ |
| | | if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) { |
| | | List<Long> sparePartIds = new ArrayList<>(); |
| | | for (DeviceRepairDto.SparePartUse sparePartUse : deviceRepairDto.getSparePartsUseList()) { |
| | | // è·åå¤ä»¶ä¿¡æ¯ |
| | | SpareParts spareParts = sparePartsMapper.selectById(sparePartUse.getId()); |
| | | if (spareParts != null) { |
| | | // æ£æ¥æ°éæ¯å¦è¶³å¤ |
| | | if (spareParts.getQuantity().compareTo(new BigDecimal(sparePartUse.getQuantity())) >= 0) { |
| | | // æ´æ°æ°é |
| | | spareParts.setQuantity(spareParts.getQuantity().subtract(new BigDecimal(sparePartUse.getQuantity()))); |
| | | sparePartsMapper.updateById(spareParts); |
| | | sparePartIds.add(sparePartUse.getId()); |
| | | |
| | | // å建å¤ä»¶é¢ç¨è®°å½ |
| | | SparePartsRequisitionRecord record = new SparePartsRequisitionRecord(); |
| | | record.setSourceType(0); // 0 ç»´ä¿® |
| | | record.setSourceId(deviceRepairDto.getId()); |
| | | record.setDeviceLedgerId(oldDeviceRepair.getDeviceLedgerId()); |
| | | record.setSparePartsId(sparePartUse.getId()); |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | | // æ´æ°å¤ä»¶IDsåæ®µ |
| | | if (!sparePartIds.isEmpty()) { |
| | | deviceRepairDto.setSparePartsIds(StringUtils.join(sparePartIds, ",")); |
| | | } |
| | | } |
| | | |
| | | if (this.updateById(deviceRepairDto)) { |
| | | Long id = deviceRepairDto.getId(); |
| | | // |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | | deviceDefectRecordDto.setDeviceLedgerId(id); |
| | |
| | | deviceDefectRecordService.updateByDDR(deviceDefectRecord); |
| | | }); |
| | | } |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DeviceRepairDto detailById(Long id) { |
| | | |
| | | return deviceRepairMapper.detailById(id); |
| | | public DeviceRepairVo detailById(Long id) { |
| | | DeviceRepairVo vo = deviceRepairMapper.detailById(id); |
| | | vo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.DEVICE_REPAIR, id)); |
| | | return vo; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | | @RequiredArgsConstructor |
| | | public class MaintenanceTaskJob implements Job, Serializable { |
| | | private static final long serialVersionUID = 1L; // å¿
é¡»å®ä¹åºååID |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceServiceImpl deviceMaintenanceService; |
| | | private final DeviceMaintenanceServiceImpl deviceMaintenanceService; |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | private final JdbcTemplate jdbcTemplate; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalTime; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class MaintenanceTaskScheduler { |
| | | |
| | | @Autowired |
| | | private Scheduler scheduler; |
| | | private final Scheduler scheduler; |
| | | |
| | | /** |
| | | * æ·»å æ°ä»»å¡å°è°åº¦å¨ |
| | |
| | | import com.ruoyi.inspectiontask.service.impl.TimingTaskServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class MaintenanceTaskServiceImpl extends ServiceImpl<MaintenanceTaskMapper, MaintenanceTask> implements MaintenanceTaskService { |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskMapper maintenanceTaskMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private TimingTaskServiceImpl timingTaskService; |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | private final MaintenanceTaskMapper maintenanceTaskMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final TimingTaskServiceImpl timingTaskService; |
| | | private final MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.vo; |
| | | |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeviceMaintenanceVo extends DeviceMaintenance { |
| | | @Schema(description = "设å¤ä¿å
»id") |
| | | private Long id; |
| | | |
| | | @Schema(description = "设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @Schema(description = "ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | private String maintenanceResult; |
| | | |
| | | @Schema(description = "ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "æ´æ°äºº") |
| | | private String updateUserName; |
| | | |
| | | @Schema(description = "ç§æ·id") |
| | | private Long tenantId; |
| | | |
| | | @Schema(description = "å建人åç§°") |
| | | private String createUserName; |
| | | |
| | | @Schema(description = "ä¿å
»å¾çå表") |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.vo; |
| | | |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeviceRepairVo extends DeviceRepair { |
| | | |
| | | @Schema(description = "æ¥ä¿®æ¶é´å符串") |
| | | private String repairTimeStr; |
| | | |
| | | @Schema(description = "ç»´ä¿®æ¶é´å符串") |
| | | private String maintenanceTimeStr; |
| | | |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | } |
| | |
| | | package com.ruoyi.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | * @date : 2025/7/23 11:31 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @Schema |
| | | public class DateQueryDto { |
| | | |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | @Schema(description = "å¼å§æ¶é´") |
| | | @TableField(exist = false) |
| | | private String entryDateStart; |
| | | |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | @Schema(description = "ç»ææ¶é´") |
| | | @TableField(exist = false) |
| | | private String entryDateEnd; |
| | | |
| | |
| | | package com.ruoyi.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | * @date : 2025/7/25 10:37 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @Schema |
| | | public class MapDto { |
| | | |
| | | @ApiModelProperty(value = "åç§°") |
| | | @Schema(description = "åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æ°é") |
| | | @Schema(description = "æ°é") |
| | | private String value; |
| | | |
| | | @ApiModelProperty(value = "å æ¯") |
| | | @Schema(description = "å æ¯") |
| | | private String rate; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.equipmentenergyconsumption.dto.ElectricityConsumptionAreaTreeDto; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.ElectricityConsumptionArea; |
| | | import com.ruoyi.equipmentenergyconsumption.service.ElectricityConsumptionAreaService; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "ç¨çµåºå") |
| | | @Tag(name = "ç¨çµåºå") |
| | | @RequestMapping("/electricityConsumptionArea") |
| | | @AllArgsConstructor |
| | | public class ElectricityConsumptionAreaController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ElectricityConsumptionAreaService electricityConsumptionAreaService; |
| | | private final ElectricityConsumptionAreaService electricityConsumptionAreaService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ ç»æ |
| | |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("ç¨çµåºå-å页æ¥è¯¢") |
| | | @Operation(summary = "ç¨çµåºå-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµåºå-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | IPage<ElectricityConsumptionArea> listPage = electricityConsumptionAreaService.listPage(page, electricityConsumptionArea); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("ç¨çµåºå-æ°å¢") |
| | | @Operation(summary = "ç¨çµåºå-æ°å¢") |
| | | @Log(title = "ç¨çµåºå-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | boolean save = electricityConsumptionAreaService.saveOrUpdate(electricityConsumptionArea); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("ç¨çµåºå-å é¤") |
| | | @Operation(summary = "ç¨çµåºå-å é¤") |
| | | @Log(title = "ç¨çµåºå-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.ElectricityConsumptionArea; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EnergyPeriod; |
| | | import com.ruoyi.equipmentenergyconsumption.service.EnergyPeriodService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/energyPeriod") |
| | | @Api(tags = "ç¨çµæ¶æ®µ") |
| | | @Tag(name = "ç¨çµæ¶æ®µ") |
| | | @AllArgsConstructor |
| | | public class EnergyPeriodController extends BaseController { |
| | | @Autowired |
| | | private EnergyPeriodService energyPeriodService; |
| | | private final EnergyPeriodService energyPeriodService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("ç¨çµæ¶æ®µ-å页æ¥è¯¢") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EnergyPeriod energyPeriod) { |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("ç¨çµæ¶æ®µ-æ°å¢") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean save = energyPeriodService.save(energyPeriod); |
| | |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @ApiOperation("ç¨çµæ¶æ®µ-æ¹éæ°å¢") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ¹éæ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | boolean save = energyPeriodService.saveBatch(energyPeriods); |
| | |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("ç¨çµæ¶æ®µ-ä¿®æ¹") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-ä¿®æ¹") |
| | | @Log(title = "ç¨çµæ¶æ®µ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean update = energyPeriodService.updateById(energyPeriod); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("ç¨çµæ¶æ®µ-å é¤") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å é¤") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = energyPeriodService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | |
| | | */ |
| | | @Log(title = "导åºç¨çµæ¶æ®µ", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åºç¨çµæ¶æ®µ") |
| | | @Operation(summary = "导åºç¨çµæ¶æ®µ") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | Page page = new Page(-1, -1); |
| | | EnergyPeriod energyPeriod = new EnergyPeriod(); |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | | ExcelUtil<EnergyPeriod> util = new ExcelUtil<EnergyPeriod>(EnergyPeriod.class); |
| | | util.exportExcel(response, listPage.getRecords() , "ç¨çµæ¶æ®µæ°æ®"); |
| | | util.exportExcel(response, listPage.getRecords(), "ç¨çµæ¶æ®µæ°æ®"); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | * @date : 2025/7/29 13:19 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "设å¤è½è") |
| | | @Tag(name = "设å¤è½è") |
| | | @RequestMapping("/equipmentEnergyConsumption") |
| | | @AllArgsConstructor |
| | | public class EquipmentEnergyConsumptionController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private EquipmentEnergyConsumptionService equipmentEnergyConsumptionService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("设å¤è½è-å页æ¥è¯¢") |
| | | @Operation(summary = "设å¤è½è-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPage(page, equipmentEnergyConsumption); |
| | |
| | | } |
| | | |
| | | @GetMapping("/deviceList") |
| | | @ApiOperation("设å¤å°è´¦-æ¥è¯¢") |
| | | @Operation(summary = "设å¤å°è´¦-æ¥è¯¢") |
| | | @Log(title = "设å¤å°è´¦-æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult deviceList(DeviceLedger deviceLedger) { |
| | | List<DeviceLedger> listPage = equipmentEnergyConsumptionService.deviceList(deviceLedger); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("设å¤è½è-æ°å¢") |
| | | @Operation(summary = "设å¤è½è-æ°å¢") |
| | | @Log(title = "设å¤è½è-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean save = equipmentEnergyConsumptionService.save(equipmentEnergyConsumption); |
| | |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @ApiOperation("设å¤è½è-æ¹éæ°å¢") |
| | | @Operation(summary = "设å¤è½è-æ¹éæ°å¢") |
| | | @Log(title = "设å¤è½è-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | boolean save = equipmentEnergyConsumptionService.saveBatch(list); |
| | |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("设å¤è½è-ä¿®æ¹") |
| | | @Operation(summary = "设å¤è½è-ä¿®æ¹") |
| | | @Log(title = "设å¤è½è-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean update = equipmentEnergyConsumptionService.updateById(equipmentEnergyConsumption); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("设å¤è½è-å é¤") |
| | | @Operation(summary = "设å¤è½è-å é¤") |
| | | @Log(title = "设å¤è½è-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | |
| | | */ |
| | | @Log(title = "导å
¥è®¾å¤è½è", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @ApiOperation("导å
¥è®¾å¤è½è") |
| | | @Operation(summary = "导å
¥è®¾å¤è½è") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | return equipmentEnergyConsumptionService.importData(file); |
| | | } |
| | |
| | | */ |
| | | @Log(title = "导åºè®¾å¤è½è", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åºè®¾å¤è½è") |
| | | @Operation(summary = "导åºè®¾å¤è½è") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page<>(-1,-1); |
| | | EquipmentEnergyConsumption equipmentEnergyConsumption = new EquipmentEnergyConsumption(); |
| | |
| | | } |
| | | |
| | | @GetMapping("/listPageByTrend") |
| | | @ApiOperation("设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢") |
| | | @Operation(summary = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPageByTrend(page, equipmentEnergyConsumption); |
| | |
| | | */ |
| | | @Log(title = "导åºè½æºè¶å¿", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportTwo") |
| | | @ApiOperation("导åºè½æºè¶å¿") |
| | | @Operation(summary = "导åºè½æºè¶å¿") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | Page page = new Page<>(-1,-1); |
| | | EquipmentEnergyConsumption equipmentEnergyConsumption = new EquipmentEnergyConsumption(); |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @ApiModelProperty("设å¤ç¼å·") |
| | | @Schema(description = "设å¤ç¼å·") |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String code; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | @Excel(name = "设å¤åç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * é¢å®åç |
| | | */ |
| | | @ApiModelProperty("é¢å®åç") |
| | | @Schema(description = "é¢å®åç") |
| | | // @Excel(name = "é¢å®åç") |
| | | private String powerRating; |
| | | |
| | | /** |
| | | * å®é
åç |
| | | */ |
| | | @ApiModelProperty("å®é
åç") |
| | | @Schema(description = "å®é
åç") |
| | | // @Excel(name = "å®é
åç") |
| | | private String powerActual; |
| | | |
| | |
| | | /** |
| | | * 彿¥ç¨çµé |
| | | */ |
| | | @ApiModelProperty("彿¥ç¨çµé") |
| | | @Schema(description = "彿¥ç¨çµé") |
| | | // @Excel(name = "彿¥ç¨çµé") |
| | | private BigDecimal dayNum; |
| | | |
| | | /** |
| | | * æ¨ç¨çµé |
| | | */ |
| | | @ApiModelProperty("æ¨ç¨çµé") |
| | | @Schema(description = "æ¨ç¨çµé") |
| | | @TableField(exist = false) |
| | | @Excel(name = "æ¨ç¨çµé") |
| | | private BigDecimal toDayNum; |
| | |
| | | /** |
| | | * æ¬æå¹³åçµéï¼30天计ç®ï¼ |
| | | */ |
| | | @ApiModelProperty("æ¬æå¹³åçµéï¼30天计ç®ï¼") |
| | | @Schema(description = "æ¬æå¹³åçµéï¼30天计ç®ï¼") |
| | | @TableField(exist = false) |
| | | @Excel(name = "æ¬æå¹³åçµé") |
| | | private BigDecimal avgNum; |
| | |
| | | /** |
| | | * è¶å¿ |
| | | */ |
| | | @ApiModelProperty("è¶å¿") |
| | | @Schema(description = "è¶å¿") |
| | | @TableField(exist = false) |
| | | @Excel(name = "è¶å¿") |
| | | private String trend; |
| | |
| | | /** |
| | | * 累计ç¨çµé |
| | | */ |
| | | @ApiModelProperty("累计ç¨çµé") |
| | | @Schema(description = "累计ç¨çµé") |
| | | // @Excel(name = "累计ç¨çµé") |
| | | private BigDecimal sumNum; |
| | | /** |
| | | * è¿è¡æ¶é´ |
| | | */ |
| | | @ApiModelProperty("è¿è¡æ¶é´") |
| | | @Schema(description = "è¿è¡æ¶é´") |
| | | @Excel(name = "è¿è¡æ¶é´" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date runDate; |
| | |
| | | /** |
| | | * æ¯æ¥éå¶çµé |
| | | */ |
| | | @ApiModelProperty("æ¯æ¥éå¶çµé") |
| | | @Schema(description = "æ¯æ¥éå¶çµé") |
| | | // @Excel(name = "æ¯æ¥éå¶çµé") |
| | | private BigDecimal everyNum; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | @TableName("electricity_consumption_area") |
| | | @ApiModel |
| | | @Schema |
| | | public class ElectricityConsumptionArea { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | |
| | | /** |
| | | * åºååç§° |
| | | */ |
| | | @ApiModelProperty("åºååç§°") |
| | | @Schema(description = "åºååç§°") |
| | | private String areaName; |
| | | |
| | | /** |
| | | * åºåç±»å |
| | | */ |
| | | @ApiModelProperty("åºåç±»å") |
| | | @Schema(description = "åºåç±»å") |
| | | private String areaType; |
| | | /** |
| | | * æåº |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("energy_period") |
| | | @ApiModel |
| | | @Schema |
| | | public class EnergyPeriod { |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * æ¥æ |
| | | */ |
| | | @ApiModelProperty("æ¥æ") |
| | | @Schema(description = "æ¥æ") |
| | | @Excel(name = "æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date date; |
| | | /** |
| | | * åä»· |
| | | */ |
| | | @ApiModelProperty("åä»·") |
| | | @Schema(description = "åä»·") |
| | | @Excel(name = "åä»·") |
| | | private Double price; |
| | | /** |
| | |
| | | /** |
| | | * 峰段 |
| | | */ |
| | | @ApiModelProperty("峰段") |
| | | @Schema(description = "峰段") |
| | | @Excel(name = "峰段") |
| | | private Double peak; |
| | | /** |
| | | * 谷段 |
| | | */ |
| | | @ApiModelProperty("谷段") |
| | | @Schema(description = "谷段") |
| | | @Excel(name = "谷段") |
| | | private Double valley; |
| | | /** |
| | | * 平段 |
| | | */ |
| | | @ApiModelProperty("平段") |
| | | @Schema(description = "平段") |
| | | @Excel(name = "平段") |
| | | private Double flat; |
| | | /** |
| | | * å°æ®µ |
| | | */ |
| | | @ApiModelProperty("å°æ®µ") |
| | | @Schema(description = "å°æ®µ") |
| | | @Excel(name = "å°æ®µ") |
| | | private Double sharp; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("equipment_energy_consumption") |
| | | @ApiModel |
| | | @Schema |
| | | public class EquipmentEnergyConsumption { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @ApiModelProperty("设å¤ç¼å·") |
| | | @Schema(description = "设å¤ç¼å·") |
| | | @Excel(name = "设å¤ç¼å·") |
| | | private String code; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Schema(description = "设å¤åç§°") |
| | | @Excel(name = "设å¤åç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * é¢å®åç |
| | | */ |
| | | @ApiModelProperty("é¢å®åç") |
| | | @Schema(description = "é¢å®åç") |
| | | @Excel(name = "é¢å®åç") |
| | | private String powerRating; |
| | | |
| | | /** |
| | | * å®é
åç |
| | | */ |
| | | @ApiModelProperty("å®é
åç") |
| | | @Schema(description = "å®é
åç") |
| | | @Excel(name = "å®é
åç") |
| | | private String powerActual; |
| | | |
| | |
| | | /** |
| | | * 彿¥ç¨çµé |
| | | */ |
| | | @ApiModelProperty("彿¥ç¨çµé") |
| | | @Schema(description = "彿¥ç¨çµé") |
| | | @Excel(name = "彿¥ç¨çµé") |
| | | private BigDecimal dayNum; |
| | | |
| | | /** |
| | | * æ¨ç¨çµé |
| | | */ |
| | | @ApiModelProperty("æ¨ç¨çµé") |
| | | @Schema(description = "æ¨ç¨çµé") |
| | | @TableField(exist = false) |
| | | private BigDecimal toDayNum; |
| | | |
| | | /** |
| | | * æ¬æå¹³åçµéï¼30天计ç®ï¼ |
| | | */ |
| | | @ApiModelProperty("æ¬æå¹³åçµéï¼30天计ç®ï¼") |
| | | @Schema(description = "æ¬æå¹³åçµéï¼30天计ç®ï¼") |
| | | @TableField(exist = false) |
| | | private BigDecimal avgNum; |
| | | |
| | |
| | | /** |
| | | * è¶å¿ |
| | | */ |
| | | @ApiModelProperty("è¶å¿") |
| | | @Schema(description = "è¶å¿") |
| | | @TableField(exist = false) |
| | | private String trend; |
| | | |
| | | /** |
| | | * 累计ç¨çµé |
| | | */ |
| | | @ApiModelProperty("累计ç¨çµé") |
| | | @Schema(description = "累计ç¨çµé") |
| | | @Excel(name = "累计ç¨çµé") |
| | | private BigDecimal sumNum; |
| | | /** |
| | | * è¿è¡æ¶é´ |
| | | */ |
| | | @ApiModelProperty("è¿è¡æ¶é´") |
| | | @Schema(description = "è¿è¡æ¶é´") |
| | | @Excel(name = "è¿è¡æ¶é´" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date runDate; |
| | |
| | | /** |
| | | * æ¯æ¥éå¶çµé |
| | | */ |
| | | @ApiModelProperty("æ¯æ¥éå¶çµé") |
| | | @Schema(description = "æ¯æ¥éå¶çµé") |
| | | @Excel(name = "æ¯æ¥éå¶çµé") |
| | | private BigDecimal everyNum; |
| | | |
| | |
| | | *æå±ç¨çµåºåid |
| | | */ |
| | | private Long electricityConsumptionAreaId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.equipmentenergyconsumption.dto.ElectricityConsumptionAreaTreeDto; |
| | | import com.ruoyi.equipmentenergyconsumption.mapper.ElectricityConsumptionAreaMapper; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.ElectricityConsumptionArea; |
| | | import com.ruoyi.equipmentenergyconsumption.service.ElectricityConsumptionAreaService; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class ElectricityConsumptionAreaServiceImpl extends ServiceImpl<ElectricityConsumptionAreaMapper, ElectricityConsumptionArea> implements ElectricityConsumptionAreaService { |
| | | |
| | | @Autowired |
| | | private ElectricityConsumptionAreaMapper electricityConsumptionAreaMapper; |
| | | private final ElectricityConsumptionAreaMapper electricityConsumptionAreaMapper; |
| | | |
| | | @Override |
| | | public IPage<ElectricityConsumptionArea> listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | |
| | | import com.ruoyi.equipmentenergyconsumption.mapper.EnergyPeriodMapper; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EnergyPeriod; |
| | | import com.ruoyi.equipmentenergyconsumption.service.EnergyPeriodService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class EnergyPeriodServiceImpl extends ServiceImpl<EnergyPeriodMapper, EnergyPeriod> implements EnergyPeriodService { |
| | | @Autowired |
| | | private EnergyPeriodMapper energyPeriodMapper; |
| | | private final EnergyPeriodMapper energyPeriodMapper; |
| | | |
| | | @Override |
| | | public IPage<EnergyPeriod> listPage(Page page, EnergyPeriod energyPeriod) { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.equipmentenergyconsumption.service.EquipmentEnergyConsumptionService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class EquipmentEnergyConsumptionServiceImpl extends ServiceImpl<EquipmentEnergyConsumptionMapper, EquipmentEnergyConsumption> implements EquipmentEnergyConsumptionService { |
| | | |
| | | |
| | | @Autowired |
| | | private EquipmentEnergyConsumptionMapper equipmentEnergyConsumptionMapper; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | private final EquipmentEnergyConsumptionMapper equipmentEnergyConsumptionMapper; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public IPage<EquipmentEnergyConsumption> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | |
| | |
|
| | | import java.util.Collection;
|
| | | import java.util.Map;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.aspectj.lang.JoinPoint;
|
| | | import org.aspectj.lang.annotation.AfterReturning;
|
| | |
| | | package com.ruoyi.framework.aspectj;
|
| | |
|
| | | import java.lang.reflect.Method;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.ip.IpUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.RateLimiter;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.LimitType;
|
| | | import org.aspectj.lang.JoinPoint;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.aspectj.lang.annotation.Before;
|
| | |
| | | import org.springframework.data.redis.core.RedisTemplate;
|
| | | import org.springframework.data.redis.core.script.RedisScript;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.ip.IpUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.RateLimiter;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.LimitType;
|
| | |
|
| | | import java.lang.reflect.Method;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * éæµå¤ç
|
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | | import javax.servlet.Filter;
|
| | | import javax.servlet.FilterChain;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.ServletRequest;
|
| | | import javax.servlet.ServletResponse;
|
| | | import javax.sql.DataSource;
|
| | | import com.alibaba.druid.pool.DruidDataSource;
|
| | | import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder;
|
| | | import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
| | | import com.alibaba.druid.util.Utils;
|
| | | import com.ruoyi.common.utils.spring.SpringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
| | | import com.ruoyi.framework.config.properties.DruidProperties;
|
| | | import com.ruoyi.framework.datasource.DynamicDataSource;
|
| | | import jakarta.servlet.*;
|
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
| | | import org.springframework.boot.context.properties.ConfigurationProperties;
|
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.context.annotation.Primary;
|
| | | import com.alibaba.druid.pool.DruidDataSource;
|
| | | import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
| | | import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
| | | import com.alibaba.druid.util.Utils;
|
| | | import com.ruoyi.common.utils.spring.SpringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
| | | import com.ruoyi.framework.config.properties.DruidProperties;
|
| | | import com.ruoyi.framework.datasource.DynamicDataSource;
|
| | |
|
| | | import javax.sql.DataSource;
|
| | | import java.io.IOException;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * druid é
ç½®å¤æ°æ®æº
|
| | |
| | | Filter filter = new Filter()
|
| | | {
|
| | | @Override
|
| | | public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
| | | public void init(jakarta.servlet.FilterConfig filterConfig) throws ServletException
|
| | | {
|
| | | }
|
| | | @Override
|
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | | import javax.servlet.DispatcherType;
|
| | | import com.ruoyi.common.filter.RepeatableFilter;
|
| | | import com.ruoyi.common.filter.XssFilter;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import jakarta.servlet.DispatcherType;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import com.ruoyi.common.filter.RepeatableFilter;
|
| | | import com.ruoyi.common.filter.XssFilter;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * Filteré
ç½®
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Configuration
|
| | | @RequiredArgsConstructor
|
| | | public class FilterConfig
|
| | | {
|
| | | @Value("${xss.excludes}")
|
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import com.ruoyi.common.handler.CustomTenantLineHandler; |
| | | import com.ruoyi.common.interceptor.DataScopeSqlInterceptor; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.BoundSql; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.session.ResultHandler; |
| | | import org.apache.ibatis.session.RowBounds; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * Mybatis Plus é
ç½® |
| | | * |
| | | * @author ruoyi |
| | | * MyBatis Plus config. |
| | | */ |
| | | @EnableTransactionManagement(proxyTargetClass = true) |
| | | @Configuration |
| | | public class MybatisPlusConfig |
| | | { |
| | | public class MybatisPlusConfig { |
| | | |
| | | @Autowired |
| | | private DataScopeSqlInterceptor dataScopeSqlInterceptor; |
| | | |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() |
| | | { |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | // ç§æ·æä»¶ |
| | | // TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(new CustomTenantLineHandler()); |
| | | // interceptor.addInnerInterceptor(tenantLineInnerInterceptor); |
| | | // å页æä»¶ |
| | | // Rewrite the original SQL before pagination generates the count query. |
| | | interceptor.addInnerInterceptor(dataScopeSqlInterceptor); |
| | | interceptor.addInnerInterceptor(paginationInnerInterceptor()); |
| | | // ä¹è§éæä»¶ |
| | | interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); |
| | | // 黿æä»¶ |
| | | interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * å页æä»¶ï¼èªå¨è¯å«æ°æ®åºç±»å https://baomidou.com/guide/interceptor-pagination.html |
| | | * Pagination interceptor. |
| | | */ |
| | | // public PaginationInnerInterceptor paginationInnerInterceptor() |
| | | // { |
| | | // PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
| | | // // è®¾ç½®æ°æ®åºç±»å为mysql |
| | | // paginationInnerInterceptor.setDbType(DbType.MYSQL); |
| | | // // 设置æå¤§å页éå¶æ°éï¼é»è®¤ 500 æ¡ï¼-1 ä¸åéå¶ |
| | | // paginationInnerInterceptor.setMaxLimit(-1L); |
| | | // return paginationInnerInterceptor; |
| | | // } |
| | | |
| | | public PaginationInnerInterceptor paginationInnerInterceptor() { |
| | | PaginationInnerInterceptor interceptor = new PaginationInnerInterceptor(DbType.MYSQL) { |
| | | @Override |
| | | public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, |
| | | RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { |
| | | RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) { |
| | | IPage<?> page = ParameterUtils.findPage(parameter).orElse(null); |
| | | if (page != null && page.getSize() <= 0) { |
| | | // å½size<=0æ¶ï¼ä¸è¿è¡å页 |
| | | return; |
| | | } |
| | | super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); |
| | | } |
| | | }; |
| | | interceptor.setMaxLimit(1000L); // 建议设置åççæå¤§å¼ |
| | | interceptor.setMaxLimit(1000L); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * ä¹è§éæä»¶ https://baomidou.com/guide/interceptor-optimistic-locker.html |
| | | * Optimistic lock interceptor. |
| | | */ |
| | | public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() |
| | | { |
| | | public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() { |
| | | return new OptimisticLockerInnerInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 妿æ¯å¯¹å
¨è¡¨çå é¤ææ´æ°æä½ï¼å°±ä¼ç»æ¢è¯¥æä½ https://baomidou.com/guide/interceptor-block-attack.html |
| | | * Block full-table update and delete. |
| | | */ |
| | | public BlockAttackInnerInterceptor blockAttackInnerInterceptor() |
| | | { |
| | | public BlockAttackInnerInterceptor blockAttackInnerInterceptor() { |
| | | return new BlockAttackInnerInterceptor(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.http.CacheControl;
|
| | |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
|
| | |
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * éç¨é
ç½®
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Configuration
|
| | | @RequiredArgsConstructor
|
| | | public class ResourcesConfig implements WebMvcConfigurer
|
| | | {
|
| | | @Autowired
|
| | | private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
| | | private final RepeatSubmitInterceptor repeatSubmitInterceptor;
|
| | |
|
| | | @Override
|
| | | public void addResourceHandlers(ResourceHandlerRegistry registry)
|
| | |
| | | //import org.springframework.context.annotation.Bean;
|
| | | //import org.springframework.context.annotation.Configuration;
|
| | | //import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
| | | //import javax.sql.DataSource;
|
| | | //import jakarta.sql.DataSource;
|
| | | //import java.util.Properties;
|
| | | //
|
| | | ///**
|
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
|
| | | import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
|
| | | import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
|
| | | import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.http.HttpMethod;
|
| | |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
| | | import org.springframework.security.web.authentication.logout.LogoutFilter;
|
| | | import org.springframework.web.filter.CorsFilter;
|
| | | import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
|
| | | import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
|
| | | import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
|
| | | import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
| | |
|
| | | /**
|
| | | * spring securityé
ç½®
|
| | |
| | | */
|
| | | @EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
| | | @Configuration
|
| | | @RequiredArgsConstructor
|
| | | public class SecurityConfig
|
| | | {
|
| | | /**
|
| | | * èªå®ä¹ç¨æ·è®¤è¯é»è¾
|
| | | */
|
| | | @Autowired
|
| | | private UserDetailsService userDetailsService;
|
| | | private final UserDetailsService userDetailsService;
|
| | |
|
| | | /**
|
| | | * 认è¯å¤±è´¥å¤çç±»
|
| | | */
|
| | | @Autowired
|
| | | private AuthenticationEntryPointImpl unauthorizedHandler;
|
| | | private final AuthenticationEntryPointImpl unauthorizedHandler;
|
| | |
|
| | | /**
|
| | | * éåºå¤çç±»
|
| | | */
|
| | | @Autowired
|
| | | private LogoutSuccessHandlerImpl logoutSuccessHandler;
|
| | | private final LogoutSuccessHandlerImpl logoutSuccessHandler;
|
| | |
|
| | | /**
|
| | | * token认è¯è¿æ»¤å¨
|
| | | */
|
| | | @Autowired
|
| | | private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
| | | private final JwtAuthenticationTokenFilter authenticationTokenFilter;
|
| | |
|
| | | /**
|
| | | * è·¨åè¿æ»¤å¨
|
| | | */
|
| | | @Autowired
|
| | | private CorsFilter corsFilter;
|
| | | private final CorsFilter corsFilter;
|
| | |
|
| | | /**
|
| | | * å
许å¿å访é®çå°å
|
| | | */
|
| | | @Autowired
|
| | | private PermitAllUrlProperties permitAllUrl;
|
| | | private final PermitAllUrlProperties permitAllUrl;
|
| | |
|
| | | /**
|
| | | * 身份éªè¯å®ç°
|
| | |
| | | // åºäºtokenï¼æä»¥ä¸éè¦session
|
| | | .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
| | | // 注解æ è®°å
许å¿å访é®çurl
|
| | | .authorizeHttpRequests((requests) -> {
|
| | | permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
| | | // 对äºç»å½login 注åregister éªè¯ç captchaImage å
许å¿å访é®
|
| | | requests.antMatchers("/login", "/register", "/captchaImage","/loginCheck","/userLoginFacotryList/**","/loginCheckFactory").permitAll()
|
| | | // éæèµæºï¼å¯å¿å访é®
|
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/javaWork/**","/**/*.pdf").permitAll()
|
| | | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
| | | // é¤ä¸é¢å¤çææè¯·æ±å
¨é¨éè¦é´æè®¤è¯
|
| | | .anyRequest().authenticated();
|
| | | })
|
| | | // todo aiçæï¼ åæè¥æé®é¢è¯·èªè¡ä¼å
|
| | | .authorizeHttpRequests(requests -> {
|
| | |
|
| | | // 1. æ¾è¡å¨æé
ç½®ç URL
|
| | | permitAllUrl.getUrls().forEach(url ->
|
| | | requests.requestMatchers(url).permitAll()
|
| | | );
|
| | |
|
| | | // 2. ç»å½ / 注å / éªè¯ç / çæ¾è¡
|
| | | requests.requestMatchers(
|
| | | "/login",
|
| | | "/register",
|
| | | "/captchaImage",
|
| | | "/loginCheck",
|
| | | "/userLoginFacotryList/**",
|
| | | "/loginCheckFactory"
|
| | | ).permitAll();
|
| | |
|
| | | // 3. éæèµæºæ¾è¡
|
| | | requests.requestMatchers(HttpMethod.GET,
|
| | | "/",
|
| | | "/*.html",
|
| | | "/**/*.html",
|
| | | "/**/*.css",
|
| | | "/**/*.js",
|
| | | "/profile/**",
|
| | | "/javaWork/**",
|
| | | "/**/*.pdf"
|
| | | ).permitAll();
|
| | |
|
| | | // 4. swagger / druid æ¾è¡
|
| | | requests.requestMatchers( |
| | | "/swagger-ui.html", |
| | | "/doc.html", |
| | | "/swagger-ui/**", |
| | | "/swagger-resources/**", |
| | | "/v3/api-docs/**", |
| | | "/webjars/**", |
| | | "/*/api-docs", |
| | | "/druid/**" |
| | | ).permitAll();
|
| | |
|
| | | // 5. å
¶ä»å
¨é¨æ¦æª
|
| | | requests.anyRequest().authenticated();
|
| | | })
|
| | | // æ·»å Logout filter
|
| | | .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
| | | // æ·»å JWT filter
|
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | |
|
| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import io.swagger.models.auth.In;
|
| | | import springfox.documentation.builders.ApiInfoBuilder;
|
| | | import springfox.documentation.builders.PathSelectors;
|
| | | import springfox.documentation.builders.RequestHandlerSelectors;
|
| | | import springfox.documentation.service.ApiInfo;
|
| | | import springfox.documentation.service.ApiKey;
|
| | | import springfox.documentation.service.AuthorizationScope;
|
| | | import springfox.documentation.service.Contact;
|
| | | import springfox.documentation.service.SecurityReference;
|
| | | import springfox.documentation.service.SecurityScheme;
|
| | | import springfox.documentation.spi.DocumentationType;
|
| | | import springfox.documentation.spi.service.contexts.SecurityContext;
|
| | | import springfox.documentation.spring.web.plugins.Docket;
|
| | |
|
| | | /**
|
| | | * Swagger2çæ¥å£é
ç½®
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @Configuration
|
| | | public class SwaggerConfig
|
| | | {
|
| | | /** ç³»ç»åºç¡é
ç½® */
|
| | | @Autowired
|
| | | private RuoYiConfig ruoyiConfig;
|
| | |
|
| | | /** æ¯å¦å¼å¯swagger */
|
| | | @Value("${swagger.enabled}")
|
| | | private boolean enabled;
|
| | |
|
| | | /** 设置请æ±çç»ä¸åç¼ */
|
| | | @Value("${swagger.pathMapping}")
|
| | | private String pathMapping;
|
| | |
|
| | | /**
|
| | | * å建API
|
| | | */
|
| | | @Bean
|
| | | public Docket createRestApi()
|
| | | {
|
| | | return new Docket(DocumentationType.OAS_30)
|
| | | // æ¯å¦å¯ç¨Swagger
|
| | | .enable(enabled)
|
| | | // ç¨æ¥å建该APIçåºæ¬ä¿¡æ¯ï¼å±ç¤ºå¨ææ¡£ç页é¢ä¸ï¼èªå®ä¹å±ç¤ºçä¿¡æ¯ï¼
|
| | | .apiInfo(apiInfo())
|
| | | // 设置åªäºæ¥å£æ´é²ç»Swaggerå±ç¤º
|
| | | .select()
|
| | | // æ«æææææ³¨è§£çapiï¼ç¨è¿ç§æ¹å¼æ´çµæ´»
|
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
| | | // æ«ææå®å
ä¸çswagger注解
|
| | | // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
| | | // æ«æææ .apis(RequestHandlerSelectors.any())
|
| | | .paths(PathSelectors.any())
|
| | | .build()
|
| | | /* 设置å®å
¨æ¨¡å¼ï¼swaggerå¯ä»¥è®¾ç½®è®¿é®token */
|
| | | .securitySchemes(securitySchemes())
|
| | | .securityContexts(securityContexts());
|
| | | // .pathMapping(pathMapping);
|
| | | }
|
| | |
|
| | | /**
|
| | | * å®å
¨æ¨¡å¼ï¼è¿éæå®tokenéè¿Authorization头请æ±å¤´ä¼ é
|
| | | */
|
| | | private List<SecurityScheme> securitySchemes()
|
| | | {
|
| | | List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
| | | apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
| | | return apiKeyList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * å®å
¨ä¸ä¸æ
|
| | | */
|
| | | private List<SecurityContext> securityContexts()
|
| | | {
|
| | | List<SecurityContext> securityContexts = new ArrayList<>();
|
| | | securityContexts.add(
|
| | | SecurityContext.builder()
|
| | | .securityReferences(defaultAuth())
|
| | | .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
| | | .build());
|
| | | return securityContexts;
|
| | | }
|
| | |
|
| | | /**
|
| | | * é»è®¤çå®å
¨ä¸å¼ç¨
|
| | | */
|
| | | private List<SecurityReference> defaultAuth()
|
| | | {
|
| | | AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
| | | AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
| | | authorizationScopes[0] = authorizationScope;
|
| | | List<SecurityReference> securityReferences = new ArrayList<>();
|
| | | securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
| | | return securityReferences;
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ·»å æè¦ä¿¡æ¯
|
| | | */
|
| | | private ApiInfo apiInfo()
|
| | | {
|
| | | // ç¨ApiInfoBuilderè¿è¡å®å¶
|
| | | return new ApiInfoBuilder()
|
| | | // 设置æ é¢
|
| | | .title("æ é¢ï¼è¥ä¾ç®¡çç³»ç»_æ¥å£ææ¡£")
|
| | | // æè¿°
|
| | | .description("æè¿°ï¼ç¨äºç®¡çé墿ä¸å
¬å¸ç人åä¿¡æ¯,å
·ä½å
æ¬XXX,XXX模å...")
|
| | | // ä½è
ä¿¡æ¯
|
| | | .contact(new Contact(ruoyiConfig.getName(), null, null))
|
| | | // çæ¬
|
| | | .version("çæ¬å·:" + ruoyiConfig.getVersion())
|
| | | .build();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.framework.config; |
| | | |
| | | 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; |
| | | import org.springdoc.core.models.GroupedOpenApi; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * OpenAPI ææ¡£é
ç½®ã |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "swagger", name = "enabled", havingValue = "true", matchIfMissing = true) |
| | | public class SwaggerConfig |
| | | { |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | @Bean |
| | | public OpenAPI openAPI() |
| | | { |
| | | String schemeName = "Authorization"; |
| | | return new OpenAPI() |
| | | .info(new Info() |
| | | .title("æ é¢ï¼è¥ä¾ç®¡çç³»ç»æ¥å£ææ¡£") |
| | | .description("æè¿°ï¼ç¨äºç®¡çé墿ä¸å
¬å¸ç人åä¿¡æ¯ï¼å
·ä½å
æ¬ XXXãXXX 模åã") |
| | | .version("çæ¬å·ï¼" + ruoyiConfig.getVersion()) |
| | | .contact(new Contact().name(ruoyiConfig.getName()))) |
| | | .components(new Components().addSecuritySchemes(schemeName, |
| | | new SecurityScheme() |
| | | .name(schemeName) |
| | | .type(SecurityScheme.Type.APIKEY) |
| | | .in(SecurityScheme.In.HEADER))) |
| | | .addSecurityItem(new SecurityRequirement().addList(schemeName)); |
| | | } |
| | | |
| | | @Bean |
| | | public GroupedOpenApi defaultOpenApi() |
| | | { |
| | | return GroupedOpenApi.builder() |
| | | .group("default") |
| | | // æ«æé¡¹ç®ç宿´é²çæ¥å£è·¯å¾ï¼ä¸ç¨ swagger.pathMapping åäºæ¬¡è¿æ»¤ï¼ |
| | | // å¦åå /dev-api è¿ç±»ç½å
³åç¼ä¼ææ¬å° Controller å
¨é¨è¿æ»¤æã |
| | | .pathsToMatch("/**") |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.framework.config.properties;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Objects;
|
| | | import java.util.Optional;
|
| | | import java.util.regex.Pattern;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
|
| | | import org.apache.commons.lang3.RegExUtils;
|
| | | import org.springframework.beans.BeansException;
|
| | | import org.springframework.beans.factory.InitializingBean;
|
| | |
| | | import org.springframework.web.method.HandlerMethod;
|
| | | import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
| | | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
|
| | |
|
| | | import java.util.*;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | | /**
|
| | | * 设置Anonymous注解å
许å¿å访é®çurl
|
| | |
| | | RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class);
|
| | | Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
|
| | |
|
| | | // map.keySet().forEach(info -> {
|
| | | // HandlerMethod handlerMethod = map.get(info);
|
| | | //
|
| | | // // è·åæ¹æ³ä¸è¾¹ç注解 æ¿ä»£path variable 为 *
|
| | | // Anonymous method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class);
|
| | | // Optional.ofNullable(method).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
|
| | | // .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
|
| | | //
|
| | | // // è·åç±»ä¸è¾¹ç注解, æ¿ä»£path variable 为 *
|
| | | // Anonymous controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Anonymous.class);
|
| | | // Optional.ofNullable(controller).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
|
| | | // .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
|
| | | // });
|
| | |
|
| | | map.keySet().forEach(info -> {
|
| | | HandlerMethod handlerMethod = map.get(info);
|
| | | // è·åæ¹æ³ä¸çå¿åè®¿é®æ³¨è§£
|
| | | Anonymous anonymous = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class);
|
| | | if (Objects.nonNull(anonymous)) {
|
| | | // éç¹ï¼Spring Boot 3 å
¼å®¹æ§åæ³
|
| | | Set<String> patterns = new HashSet<>();
|
| | | if (info.getPatternsCondition() != null) {
|
| | | patterns.addAll(info.getPatternsCondition().getPatterns());
|
| | | }
|
| | | if (info.getPathPatternsCondition() != null) {
|
| | | patterns.addAll(info.getPathPatternsCondition().getPatternValues());
|
| | | }
|
| | |
|
| | | // è·åæ¹æ³ä¸è¾¹ç注解 æ¿ä»£path variable 为 *
|
| | | Anonymous method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class);
|
| | | Optional.ofNullable(method).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
|
| | | .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
|
| | |
|
| | | // è·åç±»ä¸è¾¹ç注解, æ¿ä»£path variable 为 *
|
| | | Anonymous controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Anonymous.class);
|
| | | Optional.ofNullable(controller).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
|
| | | .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
|
| | | patterns.forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, "*")));
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | package com.ruoyi.framework.datasource;
|
| | |
|
| | | import java.util.Map;
|
| | | import javax.sql.DataSource;
|
| | | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
| | |
|
| | | import javax.sql.DataSource;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * å¨ææ°æ®æº
|
| | | *
|
| | |
| | | package com.ruoyi.framework.interceptor;
|
| | |
|
| | | import java.lang.reflect.Method;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.web.method.HandlerMethod;
|
| | | import org.springframework.web.servlet.HandlerInterceptor;
|
| | |
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | | package com.ruoyi.framework.manager;
|
| | |
|
| | | import jakarta.annotation.PreDestroy;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.stereotype.Component;
|
| | | import javax.annotation.PreDestroy;
|
| | |
|
| | | /**
|
| | | * ç¡®ä¿åºç¨éåºæ¶è½å
³éåå°çº¿ç¨
|
| | |
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | /**
|
| | | * å½åé¨é¨id
|
| | | */
|
| | | private Long currentDeptId;
|
| | | /** |
| | | * å½åé¨é¨id |
| | | */ |
| | | private Long currentDeptId; |
| | | |
| | | /** |
| | | * æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼ |
| | | */ |
| | | private Integer aiEnabled; |
| | | |
| | | private String dataScope; |
| | |
|
| | | public LoginUser()
|
| | | {
|
| | | }
|
| | |
|
| | | public LoginUser(SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(SysUser user, Set<String> permissions) |
| | | { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptId;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptId; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | this.currentDeptId = currentDeptId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.currentDeptId = currentDeptId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public Long getUserId()
|
| | | {
|
| | |
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(SysUser user)
|
| | | {
|
| | | this.user = user;
|
| | | }
|
| | | public void setUser(SysUser user) |
| | | { |
| | | this.user = user; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | @Override
|
| | | public Collection<? extends GrantedAuthority> getAuthorities()
|
| | |
| | | return currentDeptId;
|
| | | }
|
| | |
|
| | | public void setCurrentDeptId(Long currentDeptId) {
|
| | | this.currentDeptId = currentDeptId;
|
| | | }
|
| | | }
|
| | | public void setCurrentDeptId(Long currentDeptId) { |
| | | this.currentDeptId = currentDeptId; |
| | | } |
| | | |
| | | public Integer getAiEnabled() { |
| | | if (aiEnabled != null) { |
| | | return aiEnabled; |
| | | } |
| | | if (user != null && user.getAiEnabled() != null) { |
| | | return user.getAiEnabled(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public void setAiEnabled(Integer aiEnabled) { |
| | | this.aiEnabled = aiEnabled; |
| | | } |
| | | |
| | | public String getDataScope() { |
| | | return dataScope; |
| | | } |
| | | |
| | | public void setDataScope(String dataScope) { |
| | | this.dataScope = dataScope; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.framework.security.filter;
|
| | |
|
| | | import java.io.IOException;
|
| | | import javax.servlet.FilterChain;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.FilterChain;
|
| | | import jakarta.servlet.ServletException;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
| | | import org.springframework.security.core.context.SecurityContextHolder;
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
| | | {
|
| | | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter |
| | | { |
| | | @Autowired
|
| | | private TokenService tokenService;
|
| | |
|
| | | @Override
|
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
| | | throws ServletException, IOException
|
| | | {
|
| | | LoginUser loginUser = tokenService.getLoginUser(request);
|
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) |
| | | throws ServletException, IOException |
| | | { |
| | | LoginUser loginUser = tokenService.getLoginUser(request); |
| | | if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
|
| | | {
|
| | | tokenService.verifyToken(loginUser);
|
| | | UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
| | | authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
| | | SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
| | | }
|
| | | chain.doFilter(request, response);
|
| | | }
|
| | | }
|
| | | } |
| | | chain.doFilter(request, response); |
| | | } |
| | | |
| | | @Override |
| | | protected boolean shouldNotFilterAsyncDispatch() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean shouldNotFilterErrorDispatch() |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.Serializable;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.springframework.security.core.AuthenticationException;
|
| | | import org.springframework.security.web.AuthenticationEntryPoint;
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | | package com.ruoyi.framework.security.handle;
|
| | |
|
| | | import java.io.IOException;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
| | | import com.alibaba.fastjson2.JSON;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | |
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import jakarta.servlet.ServletException;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
| | |
|
| | | import java.io.IOException;
|
| | |
|
| | | /**
|
| | | * èªå®ä¹éåºå¤çç±» è¿åæå
|
| | | * |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @Configuration
|
| | | @RequiredArgsConstructor
|
| | | public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
|
| | | {
|
| | | @Autowired
|
| | | private TokenService tokenService;
|
| | | private final TokenService tokenService;
|
| | |
|
| | | /**
|
| | | * éåºå¤ç
|
| | | * |
| | | *
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | |
| | | package com.ruoyi.framework.security.service;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.authentication.AuthenticationManager;
|
| | | import org.springframework.security.authentication.BadCredentialsException;
|
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.security.core.context.SecurityContextHolder;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.exception.user.BlackListException;
|
| | | import com.ruoyi.common.exception.user.CaptchaException;
|
| | | import com.ruoyi.common.exception.user.CaptchaExpireException;
|
| | | import com.ruoyi.common.exception.user.UserNotExistsException;
|
| | | import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
| | | import com.ruoyi.common.exception.user.*;
|
| | | import com.ruoyi.common.utils.DateUtils;
|
| | | import com.ruoyi.common.utils.MessageUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | |
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.context.AuthenticationContextHolder;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import jakarta.annotation.Resource;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.security.authentication.AuthenticationManager;
|
| | | import org.springframework.security.authentication.BadCredentialsException;
|
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.security.core.context.SecurityContextHolder;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | @RequiredArgsConstructor
|
| | | public class SysLoginService
|
| | | {
|
| | | @Autowired
|
| | | private TokenService tokenService;
|
| | | private final TokenService tokenService;
|
| | |
|
| | | @Resource
|
| | | private AuthenticationManager authenticationManager;
|
| | |
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | | private final RedisCache redisCache;
|
| | | private final ISysUserService userService;
|
| | | private final ISysConfigService configService;
|
| | | private final SysUserMapper sysUserMapper;
|
| | |
|
| | | @Autowired
|
| | | private ISysUserService userService;
|
| | |
|
| | | @Autowired
|
| | | private ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * ç»å½éªè¯
|
| | |
| | | return loginUser.getUserId();
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private SysUserMapper sysUserMapper;
|
| | |
|
| | | /**
|
| | | * ç»å½éªè¯
|
| | |
| | | package com.ruoyi.framework.security.service;
|
| | |
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
| | | import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
|
| | |
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.security.context.AuthenticationContextHolder;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * ç»å½å¯ç æ¹æ³
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | @RequiredArgsConstructor
|
| | | public class SysPasswordService
|
| | | {
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | | private final RedisCache redisCache;
|
| | |
|
| | | @Value(value = "${user.password.maxRetryCount}")
|
| | | private int maxRetryCount;
|
| | |
| | | package com.ruoyi.framework.security.service;
|
| | |
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.CollectionUtils;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import com.ruoyi.project.system.service.ISysRoleService;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.CollectionUtils;
|
| | |
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | /**
|
| | | * ç¨æ·æéå¤ç
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | @RequiredArgsConstructor
|
| | | public class SysPermissionService
|
| | | {
|
| | | @Autowired
|
| | | private ISysRoleService roleService;
|
| | |
|
| | | @Autowired
|
| | | private ISysMenuService menuService;
|
| | | private final ISysRoleService roleService;
|
| | | private final ISysMenuService menuService;
|
| | |
|
| | | /**
|
| | | * è·åè§è²æ°æ®æé
|
| | |
| | | package com.ruoyi.framework.security.service;
|
| | |
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | |
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | /**
|
| | | * æ³¨åæ ¡éªæ¹æ³
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | @RequiredArgsConstructor
|
| | | public class SysRegisterService
|
| | | {
|
| | | @Autowired
|
| | | private ISysUserService userService;
|
| | |
|
| | | @Autowired
|
| | | private ISysConfigService configService;
|
| | |
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | | private final ISysUserService userService;
|
| | | private final ISysConfigService configService;
|
| | | private final RedisCache redisCache;
|
| | |
|
| | | /**
|
| | | * 注å
|
| | |
| | | package com.ruoyi.framework.security.service;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import java.util.stream.Collectors;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.ruoyi.project.system.domain.SysUserDept;
|
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper;
|
| | | 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.stereotype.Component;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | |
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUserDept;
|
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper;
|
| | | import eu.bitwalker.useragentutils.UserAgent;
|
| | | import io.jsonwebtoken.Claims;
|
| | | import io.jsonwebtoken.Jwts;
|
| | | import io.jsonwebtoken.SignatureAlgorithm;
|
| | | import io.jsonwebtoken.security.Keys;
|
| | | import jakarta.servlet.http.HttpServletRequest;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.CollectionUtils;
|
| | |
|
| | | import javax.crypto.SecretKey;
|
| | | import java.nio.charset.StandardCharsets;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * tokenéªè¯å¤ç
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | @RequiredArgsConstructor
|
| | | public class TokenService
|
| | | {
|
| | | private static final Logger log = LoggerFactory.getLogger(TokenService.class);
|
| | |
| | |
|
| | | private static final Long MILLIS_MINUTE_TWENTY = 20 * 60 * 1000L;
|
| | |
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | | private final RedisCache redisCache;
|
| | |
|
| | | /**
|
| | | * è·åç¨æ·èº«ä»½ä¿¡æ¯
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private SysUserDeptMapper sysUserDeptMapper;
|
| | | private final SysUserDeptMapper sysUserDeptMapper;
|
| | |
|
| | | /**
|
| | | * å·æ°ä»¤çæææ
|
| | |
| | | loginUser.setLoginTime(System.currentTimeMillis());
|
| | | loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
| | | loginUser.setDeptIds(getDeptIdsByUserId(loginUser.getUserId()));
|
| | | loginUser.setCurrentDeptId(loginUser.getDeptIds()[0]);
|
| | | if (loginUser.getDeptIds() != null && loginUser.getDeptIds().length > 0)
|
| | | {
|
| | | loginUser.setCurrentDeptId(loginUser.getDeptIds()[0]);
|
| | | }
|
| | | loginUser.setDataScope(resolveDataScope(loginUser));
|
| | | // æ ¹æ®uuidå°loginUserç¼å
|
| | | String userKey = getTokenKey(loginUser.getToken());
|
| | | redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
| | | }
|
| | |
|
| | | public String resolveDataScope(LoginUser loginUser)
|
| | | {
|
| | | if (loginUser == null || loginUser.getUser() == null || CollectionUtils.isEmpty(loginUser.getUser().getRoles()))
|
| | | {
|
| | | return null;
|
| | | }
|
| | | boolean hasCustom = false;
|
| | | boolean hasDeptAndChild = false;
|
| | | boolean hasDept = false;
|
| | | boolean hasSelf = false;
|
| | | for (SysRole role : loginUser.getUser().getRoles())
|
| | | {
|
| | | if (role == null || !"0".equals(role.getStatus()))
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if ("1".equals(role.getDataScope()))
|
| | | {
|
| | | return "1";
|
| | | }
|
| | | if ("2".equals(role.getDataScope()))
|
| | | {
|
| | | hasCustom = true;
|
| | | }
|
| | | else if ("4".equals(role.getDataScope()))
|
| | | {
|
| | | hasDeptAndChild = true;
|
| | | }
|
| | | else if ("3".equals(role.getDataScope()))
|
| | | {
|
| | | hasDept = true;
|
| | | }
|
| | | else if ("5".equals(role.getDataScope()))
|
| | | {
|
| | | hasSelf = true;
|
| | | }
|
| | | }
|
| | | if (hasCustom)
|
| | | {
|
| | | return "2";
|
| | | }
|
| | | if (hasDeptAndChild)
|
| | | {
|
| | | return "4";
|
| | | }
|
| | | if (hasDept)
|
| | | {
|
| | | return "3";
|
| | | }
|
| | | if (hasSelf)
|
| | | {
|
| | | return "5";
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public Long[] getDeptIdsByUserId(Long userId){
|
| | |
| | | loginUser.setOs(userAgent.getOperatingSystem().getName());
|
| | | }
|
| | |
|
| | | private SecretKey getSigningKey() {
|
| | | byte[] keyBytes = secret.getBytes(StandardCharsets.UTF_8);
|
| | | return Keys.hmacShaKeyFor(keyBytes);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 仿°æ®å£°æçæä»¤ç
|
| | | *
|
| | |
| | | */
|
| | | private String createToken(Map<String, Object> claims)
|
| | | {
|
| | | String token = Jwts.builder()
|
| | | .setClaims(claims)
|
| | | .signWith(SignatureAlgorithm.HS512, secret).compact();
|
| | | return token;
|
| | | return Jwts.builder()
|
| | | .claims(claims) // 注æï¼æ°çæ¹æ³ååäºï¼ä¸åæ¯ setClaims
|
| | | .signWith(getSigningKey(), Jwts.SIG.HS512) // ä½¿ç¨æ°çç¾å常é
|
| | | .compact();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | private Claims parseToken(String token)
|
| | | {
|
| | | return Jwts.parser()
|
| | | .setSigningKey(secret)
|
| | | .parseClaimsJws(token)
|
| | | .getBody();
|
| | | .verifyWith(getSigningKey()) // æ°çä½¿ç¨ verifyWith
|
| | | .build()
|
| | | .parseSignedClaims(token)
|
| | | .getPayload();
|
| | | }
|
| | |
|
| | | /**
|
| src/main/java/com/ruoyi/framework/security/service/UserDetailsServiceImpl.java
src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.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/CustomerContributionRankingDto.java
src/main/java/com/ruoyi/home/dto/CustomerRevenueAnalysisDto.java
src/main/java/com/ruoyi/home/dto/DeptStaffDistributionDto.java
src/main/java/com/ruoyi/home/dto/HomeBusinessDto.java
src/main/java/com/ruoyi/home/dto/HomeSummaryDto.java
src/main/java/com/ruoyi/home/dto/ProductCategoryDistributionDto.java
src/main/java/com/ruoyi/home/dto/ProductionProgressDto.java
src/main/java/com/ruoyi/home/dto/ProductionProgressOrderDto.java
src/main/java/com/ruoyi/home/dto/ProductionTaskStatisticsDto.java
src/main/java/com/ruoyi/home/dto/ProductionTurnoverDto.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/dto/SupplierPurchaseRankingDto.java
src/main/java/com/ruoyi/home/dto/WorkOrderEfficiencyDto.java
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.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/QrCodeScanRecordDto.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/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/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/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/controller/SparePartsRequisitionRecordController.java
src/main/java/com/ruoyi/measuringinstrumentledger/dto/MeasuringInstrumentLedgerDto.java
src/main/java/com/ruoyi/measuringinstrumentledger/dto/SparePartsRequisitionRecordDto.java
src/main/java/com/ruoyi/measuringinstrumentledger/mapper/SparePartsRequisitionRecordMapper.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/pojo/SparePartsRequisitionRecord.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/SparePartsRequisitionRecordService.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/SparePartsRequisitionRecordServiceImpl.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/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/OaProjectService.java
src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseServiceImpl.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/pojo/OfficeSupplies.java
src/main/java/com/ruoyi/officesupplies/service/impl/OfficeSuppliesServiceImpl.java
src/main/java/com/ruoyi/other/controller/PdaVersionController.java
src/main/java/com/ruoyi/other/controller/TempFileController.java (已删除)
src/main/java/com/ruoyi/other/dto/PdaVersionDTO.java
src/main/java/com/ruoyi/other/mapper/PdaVersionMapper.java
src/main/java/com/ruoyi/other/pojo/PdaVersion.java
src/main/java/com/ruoyi/other/pojo/TempFile.java
src/main/java/com/ruoyi/other/service/PdaVersionService.java
src/main/java/com/ruoyi/other/service/TempFileService.java (已删除)
src/main/java/com/ruoyi/other/service/impl/PdaVersionServiceImpl.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/ProcurementExceptionRecordController.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/ProcurementPageDto.java
src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java
src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java
src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.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/ProcurementExceptionRecord.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/pojo/ReturnSaleProduct.java
src/main/java/com/ruoyi/procurementrecord/service/GasTankWarningService.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/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/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
src/main/java/com/ruoyi/production/bean/dto/BomImportDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductStructureDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionBomStructureDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOrderDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOrderPickDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOrderPickRecordDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOrderRoutingOperationParamDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionOrderRoutingOperationParamSyncDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionPlanSummaryDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionProductInputDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java
src/main/java/com/ruoyi/production/bean/dto/ProductionProductOutputDto.java
src/main/java/com/ruoyi/production/bean/dto/SalesLedgerProductionAccountingDto.java
src/main/java/com/ruoyi/production/bean/dto/UserAccountDto.java
src/main/java/com/ruoyi/production/bean/dto/UserProductionAccountingDto.java
src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionBomStructureVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderPickRecordVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderPickVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderRoutingOperationParamVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderRoutingOperationVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
src/main/java/com/ruoyi/production/bean/vo/ProductionPlanVo.java
src/main/java/com/ruoyi/production/controller/ProcessRouteController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProcessRouteItemController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductBomController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductOrderController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductProcessController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductProcessRouteController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductProcessRouteItemController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductStructureController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductWorkOrderController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductWorkOrderFileController.java (已删除)
src/main/java/com/ruoyi/production/controller/ProductionAccountController.java
src/main/java/com/ruoyi/production/controller/ProductionBomStructureController.java
src/main/java/com/ruoyi/production/controller/ProductionOperationMainParamController.java
src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderBomController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderPickController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderPickRecordController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingOperationController.java
src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingOperationParamController.java
src/main/java/com/ruoyi/production/controller/ProductionPlanController.java
src/main/java/com/ruoyi/production/controller/ProductionProductInputController.java
src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java
src/main/java/com/ruoyi/production/controller/ProductionProductOutputController.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/BomImportDto.java (已删除)
src/main/java/com/ruoyi/production/dto/DaiDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProcessRouteDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProcessRouteItemDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProcessSchedulingDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductBomDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductOrderDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductProcessDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductProcessRouteItemDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductStructureDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductWorkOrderDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionDispatchAddDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionProductInputDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionProductMainDto.java (已删除)
src/main/java/com/ruoyi/production/dto/ProductionProductOutputDto.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/dto/UserAccountDto.java (已删除)
src/main/java/com/ruoyi/production/dto/UserProductionAccountingDto.java (已删除)
src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java
src/main/java/com/ruoyi/production/mapper/ProcessRouteItemMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProcessRouteMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductBomMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductProcessRouteItemMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductProcessRouteMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductStructureMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductWorkOrderFileMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductWorkOrderMapper.java (已删除)
src/main/java/com/ruoyi/production/mapper/ProductionAccountMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionBomStructureMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOperationMainParamMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderBomMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderPickMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderPickRecordMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderRoutingMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderRoutingOperationMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionOrderRoutingOperationParamMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionPlanMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionProductInputMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionProductMainMapper.java
src/main/java/com/ruoyi/production/mapper/ProductionProductOutputMapper.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/mapper/SpeculativeTradingInfoMapper.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProcessRoute.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProcessRouteItem.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductBom.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductOrder.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductProcess.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductProcessRoute.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductProcessRouteItem.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductStructure.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductWorkOrder.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductWorkOrderFile.java (已删除)
src/main/java/com/ruoyi/production/pojo/ProductionAccount.java
src/main/java/com/ruoyi/production/pojo/ProductionBomStructure.java
src/main/java/com/ruoyi/production/pojo/ProductionOperationMainParam.java
src/main/java/com/ruoyi/production/pojo/ProductionOperationTask.java
src/main/java/com/ruoyi/production/pojo/ProductionOrder.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderBom.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderPick.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderPickRecord.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderRouting.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java
src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperationParam.java
src/main/java/com/ruoyi/production/pojo/ProductionPlan.java
src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java
src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java
src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.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/pojo/SpeculativeTradingInfo.java (已删除)
src/main/java/com/ruoyi/production/service/ProcessRouteItemService.java (已删除)
src/main/java/com/ruoyi/production/service/ProcessRouteService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductBomService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductOrderService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductProcessRouteItemService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductProcessRouteService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductProcessService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductStructureService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductWorkOrderFileService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductWorkOrderService.java (已删除)
src/main/java/com/ruoyi/production/service/ProductionAccountService.java
src/main/java/com/ruoyi/production/service/ProductionBomStructureService.java
src/main/java/com/ruoyi/production/service/ProductionOperationMainParamService.java
src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java
src/main/java/com/ruoyi/production/service/ProductionOrderBomService.java
src/main/java/com/ruoyi/production/service/ProductionOrderPickRecordService.java
src/main/java/com/ruoyi/production/service/ProductionOrderPickService.java
src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationParamService.java
src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java
src/main/java/com/ruoyi/production/service/ProductionOrderRoutingService.java
src/main/java/com/ruoyi/production/service/ProductionOrderService.java
src/main/java/com/ruoyi/production/service/ProductionPlanService.java
src/main/java/com/ruoyi/production/service/ProductionProductInputService.java
src/main/java/com/ruoyi/production/service/ProductionProductMainService.java
src/main/java/com/ruoyi/production/service/ProductionProductOutputService.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/ProcessRouteItemServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProcessRouteServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductBomServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductProcessRouteItemServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductProcessRouteServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductWorkOrderFileServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductWorkOrderServiceImpl.java (已删除)
src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOperationMainParamServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderBomServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.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/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/SysJob.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/SysUserClientController.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/SysUser.java
src/main/java/com/ruoyi/project/system/domain/SysUserDept.java
src/main/java/com/ruoyi/project/system/domain/vo/SysUserDeptVo.java
src/main/java/com/ruoyi/project/system/mapper/SysRoleMapper.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/SysUserServiceImpl.java
src/main/java/com/ruoyi/project/system/service/impl/UnipushService.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/service/GenTableColumnServiceImpl.java
src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java
src/main/java/com/ruoyi/project/tool/swagger/TestController.java
src/main/java/com/ruoyi/projectManagement/controller/InfoController.java
src/main/java/com/ruoyi/projectManagement/controller/PlanController.java
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
src/main/java/com/ruoyi/projectManagement/dto/InfoStageDto.java
src/main/java/com/ruoyi/projectManagement/dto/RoleDto.java
src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java
src/main/java/com/ruoyi/projectManagement/dto/UpdateStateInfo.java
src/main/java/com/ruoyi/projectManagement/pojo/ContractInfo.java
src/main/java/com/ruoyi/projectManagement/pojo/Info.java
src/main/java/com/ruoyi/projectManagement/pojo/InfoStage.java
src/main/java/com/ruoyi/projectManagement/pojo/Plan.java
src/main/java/com/ruoyi/projectManagement/pojo/PlanNode.java
src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
src/main/java/com/ruoyi/projectManagement/pojo/ShippingAddress.java
src/main/java/com/ruoyi/projectManagement/service/InfoService.java
src/main/java/com/ruoyi/projectManagement/service/PlanService.java
src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java
src/main/java/com/ruoyi/projectManagement/service/impl/handle/ContractInfoHandleService.java
src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java
src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java
src/main/java/com/ruoyi/projectManagement/service/impl/handle/ShippingAddressHandleService.java
src/main/java/com/ruoyi/projectManagement/vo/InfoStageVo.java
src/main/java/com/ruoyi/projectManagement/vo/PlanVo.java
src/main/java/com/ruoyi/projectManagement/vo/SaveInfoStageVo.java
src/main/java/com/ruoyi/projectManagement/vo/SaveInfoVo.java
src/main/java/com/ruoyi/projectManagement/vo/SavePlanNodeVo.java
src/main/java/com/ruoyi/projectManagement/vo/SavePlanVo.java
src/main/java/com/ruoyi/projectManagement/vo/SearchPlanVo.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/ProcurementBusinessSummaryController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerTemplateController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrderProductsController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java
src/main/java/com/ruoyi/purchase/dto/ProcurementBusinessSummaryDto.java
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerImportDto.java
src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderDto.java
src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java
src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrderProductsMapper.java
src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.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/PurchaseLedgerTemplate.java
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java
src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java
src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.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/ProcurementBusinessSummaryServiceImpl.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/PurchaseLedgerTemplateServiceImpl.java
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.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/QualityReportController.java
src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java
src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java
src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.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/dto/QualityInspectStatDto.java
src/main/java/com/ruoyi/quality/dto/QualityMonthlyDetailDto.java
src/main/java/com/ruoyi/quality/dto/QualityMonthlyPassRateDto.java
src/main/java/com/ruoyi/quality/dto/QualityMonthlyPassRateWrapperDto.java
src/main/java/com/ruoyi/quality/dto/QualityParameterStatDto.java
src/main/java/com/ruoyi/quality/dto/QualityPassRateDto.java
src/main/java/com/ruoyi/quality/dto/QualityTopParameterDto.java
src/main/java/com/ruoyi/quality/mapper/QualityInspectMapper.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/QualityTestStandardBinding.java
src/main/java/com/ruoyi/quality/pojo/QualityTestStandardParam.java
src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java
src/main/java/com/ruoyi/quality/service/IQualityInspectService.java
src/main/java/com/ruoyi/quality/service/IQualityUnqualifiedService.java
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
src/main/java/com/ruoyi/quality/service/impl/QualityReportServiceImpl.java
src/main/java/com/ruoyi/quality/service/impl/QualityTestStandardBindingServiceImpl.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/safe/controller/SafeAccidentController.java
src/main/java/com/ruoyi/safe/controller/SafeCertificationController.java
src/main/java/com/ruoyi/safe/controller/SafeCertificationFileController.java
src/main/java/com/ruoyi/safe/controller/SafeContingencyPlanController.java
src/main/java/com/ruoyi/safe/controller/SafeHazardController.java
src/main/java/com/ruoyi/safe/controller/SafeHazardRecordController.java
src/main/java/com/ruoyi/safe/controller/SafeHiddenController.java
src/main/java/com/ruoyi/safe/controller/SafeHiddenFileController.java
src/main/java/com/ruoyi/safe/controller/SafeTrainingController.java
src/main/java/com/ruoyi/safe/controller/SafeTrainingDetailsController.java
src/main/java/com/ruoyi/safe/controller/SafeTrainingFileController.java
src/main/java/com/ruoyi/safe/dto/SafeHazardRecordDto.java
src/main/java/com/ruoyi/safe/dto/SafeHiddenDto.java
src/main/java/com/ruoyi/safe/dto/SafeTrainingDetailsDto.java
src/main/java/com/ruoyi/safe/dto/SafeTrainingDto.java
src/main/java/com/ruoyi/safe/pojo/SafeAccident.java
src/main/java/com/ruoyi/safe/pojo/SafeCertification.java
src/main/java/com/ruoyi/safe/pojo/SafeCertificationFile.java
src/main/java/com/ruoyi/safe/pojo/SafeContingencyPlan.java
src/main/java/com/ruoyi/safe/pojo/SafeHazard.java
src/main/java/com/ruoyi/safe/pojo/SafeHazardRecord.java
src/main/java/com/ruoyi/safe/pojo/SafeHidden.java
src/main/java/com/ruoyi/safe/pojo/SafeHiddenFile.java
src/main/java/com/ruoyi/safe/pojo/SafeTraining.java
src/main/java/com/ruoyi/safe/pojo/SafeTrainingDetails.java
src/main/java/com/ruoyi/safe/pojo/SafeTrainingFile.java
src/main/java/com/ruoyi/safe/service/SafeTrainingDetailsService.java
src/main/java/com/ruoyi/safe/service/SafeTrainingService.java
src/main/java/com/ruoyi/safe/service/impl/SafeAccidentServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeCertificationServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeContingencyPlanServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeHazardRecordServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeHazardServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeHiddenServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeTrainingDetailsServiceImpl.java
src/main/java/com/ruoyi/safe/service/impl/SafeTrainingServiceImpl.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/MetricStatisticsController.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/ShipmentApprovalController.java
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
src/main/java/com/ruoyi/sales/controller/ShippingProductDetailController.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/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/SalesLedgerImportDto.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/dto/ShippingInfoDto.java
src/main/java/com/ruoyi/sales/dto/ShippingProductDetailDto.java
src/main/java/com/ruoyi/sales/dto/StatisticsTableDto.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/SalesLedgerMapper.java
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.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/Loss.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/ShipmentApproval.java
src/main/java/com/ruoyi/sales/pojo/ShippingInfo.java
src/main/java/com/ruoyi/sales/pojo/ShippingProductDetail.java
src/main/java/com/ruoyi/sales/service/ICommonFileService.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/ReceiptPaymentService.java
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
src/main/java/com/ruoyi/sales/service/ShippingProductDetailService.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/MetricStatisticsServiceImpl.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/SalesQuotationServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/SalespersonManagementServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/ShipmentApprovalServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/ShippingProductDetailServiceImpl.java
src/main/java/com/ruoyi/sales/vo/SalesLedgerVo.java
src/main/java/com/ruoyi/staff/controller/AnalyticsController.java
src/main/java/com/ruoyi/staff/controller/BankController.java
src/main/java/com/ruoyi/staff/controller/HolidayApplicationController.java
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceRecordsController.java
src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
src/main/java/com/ruoyi/staff/controller/SchemeApplicableStaffController.java
src/main/java/com/ruoyi/staff/controller/StaffContractController.java
src/main/java/com/ruoyi/staff/controller/StaffLeaveController.java
src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java
src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java
src/main/java/com/ruoyi/staff/controller/StaffSchedulingController.java
src/main/java/com/ruoyi/staff/dto/PerformanceShiftAddDto.java
src/main/java/com/ruoyi/staff/dto/PersonalAttendanceRecordsDto.java
src/main/java/com/ruoyi/staff/dto/SaveStaffSchedulingDto.java
src/main/java/com/ruoyi/staff/dto/StaffOnJobExcelDto.java
src/main/java/com/ruoyi/staff/pojo/Bank.java
src/main/java/com/ruoyi/staff/pojo/HolidayApplication.java
src/main/java/com/ruoyi/staff/pojo/PersonalAttendanceLocationConfig.java
src/main/java/com/ruoyi/staff/pojo/PersonalAttendanceRecords.java
src/main/java/com/ruoyi/staff/pojo/PersonalShift.java
src/main/java/com/ruoyi/staff/pojo/SchemeApplicableStaff.java
src/main/java/com/ruoyi/staff/pojo/SchemeInsuranceDetail.java
src/main/java/com/ruoyi/staff/pojo/StaffContract.java
src/main/java/com/ruoyi/staff/pojo/StaffEducation.java
src/main/java/com/ruoyi/staff/pojo/StaffEmergencyContact.java
src/main/java/com/ruoyi/staff/pojo/StaffLeave.java
src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java
src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java
src/main/java/com/ruoyi/staff/pojo/StaffSalaryMain.java
src/main/java/com/ruoyi/staff/pojo/StaffScheduling.java
src/main/java/com/ruoyi/staff/pojo/StaffWorkExperience.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/StaffLeaveService.java
src/main/java/com/ruoyi/staff/service/impl/AnalyticsServiceImpl.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/PersonalShiftServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffSchedulingServiceImpl.java
src/main/java/com/ruoyi/staff/task/PersonalAttendanceRecordsTask.java
src/main/java/com/ruoyi/staff/vo/MonthlyTurnoverRateVo.java
src/main/java/com/ruoyi/staff/vo/TotalTurnoverRateVo.java
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java
src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java
src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
src/main/java/com/ruoyi/stock/mapper/StockUninventoryMapper.java
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
src/main/java/com/ruoyi/stock/pojo/StockInventory.java
src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
src/main/java/com/ruoyi/stock/pojo/StockUninventory.java
src/main/java/com/ruoyi/stock/service/StockInRecordService.java
src/main/java/com/ruoyi/stock/service/StockInventoryService.java
src/main/java/com/ruoyi/stock/service/StockOutRecordService.java
src/main/java/com/ruoyi/stock/service/StockUninventoryService.java
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
src/main/java/com/ruoyi/technology/bean/dto/BomImportDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyBomDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyBomStructureDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyOperationDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyOperationParamDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyParamDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyRoutingDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyRoutingOperationDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyRoutingOperationParamDto.java
src/main/java/com/ruoyi/technology/bean/dto/TechnologyRoutingOperationParamSyncDto.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyOperationParamVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyOperationVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyParamVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyRoutingOperationParamVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyRoutingOperationVo.java
src/main/java/com/ruoyi/technology/bean/vo/TechnologyRoutingVo.java
src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
src/main/java/com/ruoyi/technology/controller/TechnologyBomStructureController.java
src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java
src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java
src/main/java/com/ruoyi/technology/controller/TechnologyParamController.java
src/main/java/com/ruoyi/technology/controller/TechnologyRoutingController.java
src/main/java/com/ruoyi/technology/controller/TechnologyRoutingOperationController.java
src/main/java/com/ruoyi/technology/controller/TechnologyRoutingOperationParamController.java
src/main/java/com/ruoyi/technology/mapper/TechnologyBomMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyBomStructureMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyOperationMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyOperationParamMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyParamMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyRoutingMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyRoutingOperationMapper.java
src/main/java/com/ruoyi/technology/mapper/TechnologyRoutingOperationParamMapper.java
src/main/java/com/ruoyi/technology/pojo/TechnologyBom.java
src/main/java/com/ruoyi/technology/pojo/TechnologyBomStructure.java
src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java
src/main/java/com/ruoyi/technology/pojo/TechnologyOperationParam.java
src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java
src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java
src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java
src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperationParam.java
src/main/java/com/ruoyi/technology/service/TechnologyBomService.java
src/main/java/com/ruoyi/technology/service/TechnologyBomStructureService.java
src/main/java/com/ruoyi/technology/service/TechnologyOperationParamService.java
src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java
src/main/java/com/ruoyi/technology/service/TechnologyParamService.java
src/main/java/com/ruoyi/technology/service/TechnologyRoutingOperationParamService.java
src/main/java/com/ruoyi/technology/service/TechnologyRoutingOperationService.java
src/main/java/com/ruoyi/technology/service/TechnologyRoutingService.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyBomStructureServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingOperationParamServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingOperationServiceImpl.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.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/DocumentationBorrowManagementDto.java
src/main/java/com/ruoyi/warehouse/dto/ReturnExportDto.java
src/main/java/com/ruoyi/warehouse/mapper/DocumentationBorrowManagementMapper.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/DocumentationBorrowManagementService.java
src/main/java/com/ruoyi/warehouse/service/DocumentationService.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/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/pojo/WaterRecord.java
src/main/java/com/ruoyi/waterrecord/service/impl/WaterRecordServiceImpl.java
src/main/resources/application-demo.yml
src/main/resources/application-dev-pro.yml
src/main/resources/application-dev.yml
src/main/resources/application-hbtmblc.yml
src/main/resources/application-new-pro.yml
src/main/resources/application.yml
src/main/resources/approve-todo-agent-prompt.txt
src/main/resources/mapper/account/AccountExpenseMapper.xml
src/main/resources/mapper/account/AccountIncomeMapper.xml
src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
src/main/resources/mapper/approve/ApproveProcessConfigNodeMapper.xml
src/main/resources/mapper/approve/ApproveProcessMapper.xml
src/main/resources/mapper/basic/CustomerMapper.xml
src/main/resources/mapper/basic/ProductModelMapper.xml
src/main/resources/mapper/basic/StorageAttachmentMapper.xml
src/main/resources/mapper/basic/StorageBlobMapper.xml
src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
src/main/resources/mapper/device/DeviceRepairMapper.xml
src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml
src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml
src/main/resources/mapper/production/ProcessRouteItemMapper.xml (已删除)
src/main/resources/mapper/production/ProcessRouteMapper.xml (已删除)
src/main/resources/mapper/production/ProductBomMapper.xml (已删除)
src/main/resources/mapper/production/ProductOrderMapper.xml (已删除)
src/main/resources/mapper/production/ProductProcessMapper.xml (已删除)
src/main/resources/mapper/production/ProductProcessRouteItemMapper.xml (已删除)
src/main/resources/mapper/production/ProductProcessRouteMapper.xml (已删除)
src/main/resources/mapper/production/ProductStructureMapper.xml (已删除)
src/main/resources/mapper/production/ProductWorkOrderFileMapper.xml (已删除)
src/main/resources/mapper/production/ProductWorkOrderMapper.xml (已删除)
src/main/resources/mapper/production/ProductionAccountMapper.xml
src/main/resources/mapper/production/ProductionBomStructureMapper.xml
src/main/resources/mapper/production/ProductionOperationMainParamMapper.xml
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
src/main/resources/mapper/production/ProductionOrderBomMapper.xml
src/main/resources/mapper/production/ProductionOrderMapper.xml
src/main/resources/mapper/production/ProductionOrderPickMapper.xml
src/main/resources/mapper/production/ProductionOrderPickRecordMapper.xml
src/main/resources/mapper/production/ProductionOrderRoutingMapper.xml
src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml
src/main/resources/mapper/production/ProductionOrderRoutingOperationParamMapper.xml
src/main/resources/mapper/production/ProductionPlanMapper.xml
src/main/resources/mapper/production/ProductionProductInputMapper.xml
src/main/resources/mapper/production/ProductionProductMainMapper.xml
src/main/resources/mapper/production/ProductionProductOutputMapper.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/PaymentRegistrationMapper.xml
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
src/main/resources/mapper/quality/QualityInspectMapper.xml
src/main/resources/mapper/quality/QualityTestStandardMapper.xml
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
src/main/resources/mapper/sales/SalesLedgerMapper.xml
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
src/main/resources/mapper/sales/SalesQuotationMapper.xml
src/main/resources/mapper/sales/ShippingInfoMapper.xml
src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
src/main/resources/mapper/staff/PersonalShiftMapper.xml
src/main/resources/mapper/staff/StaffOnJobMapper.xml
src/main/resources/mapper/stock/StockInRecordMapper.xml
src/main/resources/mapper/stock/StockInventoryMapper.xml
src/main/resources/mapper/stock/StockOutRecordMapper.xml
src/main/resources/mapper/stock/StockUninventoryMapper.xml
src/main/resources/mapper/system/SysRoleMapper.xml
src/main/resources/mapper/system/SysUserMapper.xml
src/main/resources/mapper/technology/TechnologyBomMapper.xml
src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml
src/main/resources/mapper/technology/TechnologyOperationMapper.xml
src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml
src/main/resources/mapper/technology/TechnologyParamMapper.xml
src/main/resources/mapper/technology/TechnologyRoutingMapper.xml
src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml
src/main/resources/mapper/technology/TechnologyRoutingOperationParamMapper.xml
src/main/resources/my-prompt-template.txt
src/main/resources/my-prompt-template3.txt
src/main/resources/mybatis/mybatis-config.xml
src/main/resources/purchase-agent-prompt.txt
src/main/resources/static/work-order-template.docx
src/main/resources/vm/java/controller.java.vm |