feat(crm): 新增开票功能并完善权限查询
- 添加 CRM 开票功能枚举和编号前缀
- 完善权限查询方法,增加空集合判断防止 NPE
- 在回款服务中注入发票服务依赖
- 更新业务数据清理脚本,扩展清理范围到基础数据
- 新增 JHHG 环境配置文件,包含数据库、Redis、消息队列等完整配置
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # CRM å¼ç¥¨åè½ - å端èè°æ¹æ¡ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - æ°å¢ï¼`views/crm/invoice/index.vue`ï¼å¼ç¥¨å表ï¼ã`views/crm/invoice/modules/form.vue`ï¼å¼ç¥¨è¡¨åï¼ã`views/crm/invoice/detail/index.vue`ï¼å¼ç¥¨è¯¦æ
ï¼ |
| | | - æ°å¢ï¼`src/api/crm/invoice/index.ts`ï¼å¼ç¥¨æ¥å£ï¼ |
| | | - ä¿®æ¹ï¼`views/crm/receivable/modules/form.vue`ï¼å款表åå¢å ãå
å¼ç¥¨å忬¾ãæç¤ºä¸æ ¡éªï¼ |
| | | - ä¿®æ¹ï¼å款å表/详æ
ï¼å±ç¤ºå¼ç¥¨æ
åµæç¤ºï¼æè·³è½¬å¼ç¥¨ï¼ |
| | | |
| | | > å端èåå·²æ°å¢ãè¥é管ç -> å¼ç¥¨ç®¡çãï¼component = `crm/invoice/index`ï¼ï¼å端åªéå建对åºç®å½ä¸é¡µé¢ç»ä»¶ã |
| | | |
| | | ## ä¸å¡æµç¨ä¸æ°æ®å¸¦å
¥ |
| | | |
| | | 1. åå审æ¹éè¿ -> å建å¼ç¥¨ï¼å¼ç¥¨æ¶éæ©ååï¼å®¢æ·ãåååç§°ä»åå带å
¥ |
| | | 2. å¼ç¥¨æäº¤å®¡æ¹ -> 审æ¹éè¿ï¼å®¡æ¹éè¿åå¼ç¥¨æçæï¼æå
许åä¸åæ¬¾æ ¡éª |
| | | 3. 审æ¹éè¿ -> ä¸ä¼ å票éä»¶ï¼éè¿éä»¶æºå¶ä¸ä¼ åç¥¨æ«æä»¶/çµå票 |
| | | 4. å票已ä¸ä¼ éä»¶ -> åå»ºåæ¬¾ï¼å款å建æ¶åç«¯æ ¡éªãåå累计已å¼ç¥¨ä¸å·²ä¸ä¼ éä»¶çéé¢ >= ç´¯è®¡åæ¬¾éé¢ï¼å«æ¬æ¬¡ï¼ã |
| | | |
| | | ## API |
| | | |
| | | ### å¼ç¥¨æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | `/crm/invoice/create` | å建å¼ç¥¨ | |
| | | | PUT | `/crm/invoice/update` | æ´æ°å¼ç¥¨ï¼ä»
è稿/审æ¹ä¸ï¼ | |
| | | | DELETE | `/crm/invoice/delete` | å é¤å¼ç¥¨ï¼å®¡æ¹éè¿ä¸å¯å ï¼ | |
| | | | GET | `/crm/invoice/get` | è·å¾å¼ç¥¨è¯¦æ
ï¼å«éä»¶åè¡¨ï¼ | |
| | | | GET | `/crm/invoice/page` | è·å¾å¼ç¥¨å页 | |
| | | | GET | `/crm/invoice/page-by-customer` | åºäºå®¢æ·çå¼ç¥¨å页 | |
| | | | GET | `/crm/invoice/export-excel` | 导åºå¼ç¥¨ Excel | |
| | | | PUT | `/crm/invoice/submit` | æäº¤å¼ç¥¨å®¡æ¹ | |
| | | | GET | `/crm/invoice/audit-count` | å¾
å®¡æ ¸å¼ç¥¨æ°é | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ | æ´æ°æ¶å¿
å¡« | |
| | | | contractId | Long | æ¯ | ååç¼å·ï¼éæ©ååå客æ·èªå¨å¸¦å
¥ | |
| | | | ownerUserId | Long | å¦ | è´è´£äººï¼é»è®¤å½åç¨æ· | |
| | | | invoiceType | Integer | æ¯ | å票类åï¼åå
¸ `crm_invoice_type`ï¼1ä¸ç¨ 2æ®é 3çµåï¼ | |
| | | | invoiceNo | String | å¦ | å票å·ç | |
| | | | invoiceTitle | String | å¦ | å票æ¬å¤´ | |
| | | | price | BigDecimal | æ¯ | å¼ç¥¨éé¢ï¼å
ï¼ | |
| | | | invoiceTime | LocalDateTime | æ¯ | å¼ç¥¨æ¥æ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | | blobIds | Long[] | å¦ | å票éä»¶ BlobId å表 | |
| | | |
| | | **ååºå段æ°å¢ï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | no | String | å¼ç¥¨ç¼å·ï¼KP+æ¥æ+åºå·ï¼ä¿åæ¶å端çæï¼ | |
| | | | customerId / customerName | Long / String | å®¢æ· | |
| | | | contract | CrmContractRespVO | ååä¿¡æ¯ | |
| | | | ownerUserName / ownerUserDeptName | String | è´è´£äºº/é¨é¨ | |
| | | | auditStatus | Integer | 审æ¹ç¶æï¼åå
¸ `crm_audit_status`ï¼ | |
| | | | attachmentList | StorageBlobRespDTO[] | å票éä»¶å表 | |
| | | | processInstanceId | String | 工使µç¼å· | |
| | | |
| | | **ååºç¤ºä¾ï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 0, |
| | | "data": { |
| | | "id": 1, |
| | | "no": "KP20260810000001", |
| | | "contractId": 100, |
| | | "contract": { "id": 100, "no": "HT2026...", "name": "..." }, |
| | | "customerId": 200, |
| | | "customerName": "XXç§æ", |
| | | "invoiceType": 1, |
| | | "invoiceNo": "02564178", |
| | | "invoiceTitle": "XXç§ææéå
¬å¸", |
| | | "price": 9000.00, |
| | | "invoiceTime": "2026-08-10", |
| | | "auditStatus": 0, |
| | | "attachmentList": [{ "id": 1, "url": "...", "name": "å票.pdf" }] |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ### éä»¶æ¥å£ï¼æ²¿ç¨ system 模åï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | `/system/storage-blob/upload` | ä¸ä¼ å票æä»¶ï¼è·å¾ `blobId` | |
| | | | POST | `/system/storage-attachment/bind` | ç»å®éä»¶å°å¼ç¥¨ï¼`recordType=crm_invoice`ã`recordId=å¼ç¥¨id`ï¼ | |
| | | | GET | `/system/storage-attachment/list` | æ¥è¯¢å¼ç¥¨éä»¶å表 | |
| | | | DELETE | `/system/storage-attachment/delete` | å é¤éä»¶ | |
| | | |
| | | > ä¸ä¼ ä¸ä¿åå离ï¼è¡¨åå
éæä»¶ä¸ä¼ æ¿å° `blobId`ï¼éå建/æ´æ°æ¥å£ä¸èµ·æäº¤ `blobIds`ï¼å端ç»å®ã详æ
æ¥å£è¿åç `attachmentList` å¯ç´æ¥å±ç¤º/é¢è§ã |
| | | |
| | | ## åæ®µå±ç¤ºè§å |
| | | |
| | | | åæ®µ | å±ç¤ºä½ç½® | 说æ | |
| | | |------|----------|------| |
| | | | no å¼ç¥¨ç¼å· | å表ã详æ
| 跳转详æ
| |
| | | | customerName å®¢æ· | å表ã详æ
| 跳转客æ·è¯¦æ
| |
| | | | contract åå | å表ã详æ
| 跳转åå详æ
| |
| | | | invoiceType å票类å | å表ã详æ
| åå
¸å±ç¤º | |
| | | | invoiceNo å票å·ç | å表ã详æ
| - | |
| | | | price å¼ç¥¨éé¢ | å表ã详æ
| é颿 ¼å¼å | |
| | | | invoiceTime å¼ç¥¨æ¥æ | å表ã详æ
| æ¥ææ ¼å¼å | |
| | | | auditStatus 审æ¹ç¶æ | å表ã详æ
| åå
¸ `crm_audit_status` | |
| | | | attachmentList å票éä»¶ | 详æ
| éä»¶å表ï¼å¯é¢è§/ä¸è½½ | |
| | | | ownerUserName è´è´£äºº | å表 | - | |
| | | | remark 夿³¨ | å表ã详æ
| - | |
| | | |
| | | ## ä¸å¡è§å说æ |
| | | |
| | | | åºæ¯ | è§å | |
| | | |------|------| |
| | | | åå»ºåæ¬¾ | åç«¯æ ¡éªï¼åååã审æ¹éè¿ä¸å·²ä¸ä¼ å票éä»¶ãç累计å¼ç¥¨éé¢ >= ç´¯è®¡åæ¬¾éé¢ï¼å«æ¬æ¬¡ï¼ï¼å¦åæ¥éãåå累计å¼ç¥¨éé¢ä¸è¶³ï¼ç®åå¯å款 X å
ã | |
| | | | å¼ç¥¨éé¢ | åç«¯æ ¡éªï¼å¼ç¥¨éé¢ä¸è½è¶
è¿ååéé¢åå»å·²å®¡æ¹éè¿çå¼ç¥¨éé¢ | |
| | | | å¼ç¥¨ç¼è¾ | ä»
è稿ã审æ¹ä¸å¯ç¼è¾ï¼å®¢æ·ãååãè´è´£äººä¸å¯ä¿®æ¹ | |
| | | | å¼ç¥¨å é¤ | 审æ¹éè¿åä¸å¯å é¤ | |
| | | | å¼ç¥¨å®¡æ¹ | æäº¤åèµ° BPM æµç¨ï¼key=`crm-invoice-audit`ï¼ï¼å®¡æ¹éè¿æçæ | |
| | | | å¾
å | å端 `audit-count` å¯ç¨äºå¾
åçº¢ç¹ | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - å票类ååå
¸ `crm_invoice_type` å端已é
ç½®ï¼å端éå¨å¸¸é/åå
¸ä¸æ³¨åï¼1å¢å¼ç¨ä¸ç¨ 2å¢å¼ç¨æ®é 3çµåï¼ |
| | | - èåæéï¼ç®¡çåéå°æ°èåï¼`crm:invoice:*`ï¼åé
ç»ç¸åºè§è² |
| | | - 忬¾è¡¨åå¨ç¨æ·éæ©åååï¼å¯æç¤ºã请å
宿å¼ç¥¨å¹¶ä¸ä¼ å票éä»¶ãï¼è¥æªå¼ç¥¨ååå»ºåæ¬¾ä¼æ¶å°å端é误æç¤º |
| | | - éä»¶å¿
须走 `/system/storage-*` æ¥å£ï¼`recordType` åºå®ä¸º `crm_invoice`ï¼ç¦æ¢å¨ä¸å¡è¡¨æ°å¢æä»¶å°ååæ®µ |
| | | - ä¸ä¼ çå票æä»¶å»ºè®®éå¶å¾ç/PDF æ ¼å¼ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å工信æ¯å¯¼å
¥ - å端èè°æ¹æ¡ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - 人åèµæº > å工管ç å表页ï¼`src/views/hrm/employee/index.vue`ï¼ |
| | | - åå·¥æ°å¢/ç¼è¾å¼¹çªï¼`src/views/hrm/employee/modules/form.vue`ã`src/views/hrm/employee/data.ts`ï¼ |
| | | - å工详æ
ï¼`src/views/hrm/employee/modules/detail.vue`ï¼ |
| | | - æ°å¢ï¼å工导å
¥å¼¹çªï¼å«ä¸è½½æ¨¡æ¿ãä¸ä¼ æä»¶ãå±ç¤ºå¯¼å
¥ç»æï¼ |
| | | |
| | | ## ä¸å¡æµç¨ä¸æ°æ®å¸¦å
¥ |
| | | |
| | | 1. **ä¸è½½æ¨¡æ¿** -> å端è°ç¨ `GET /hrm/employee/import-template` ä¸è½½ Excel 模æ¿ï¼æ¨¡æ¿å
å«ç¤ºä¾è¡ä¾åèã |
| | | 2. **填忍¡æ¿** -> ç¨æ·ææ¨¡æ¿å¡«åå工信æ¯ï¼å
¶ä¸"é¨é¨åç§°/å²ä½åç§°/ç¨æ·è§è²"ä¸åå¡«**åç§°**ï¼ç¨æ·è§è²å¤ä¸ªç¨ä¸æéå·åéï¼ï¼ç±å端èªå¨è½¬æ¢ä¸º IDã |
| | | 3. **ä¸ä¼ 导å
¥** -> å端è°ç¨ `POST /hrm/employee/import`ï¼multipart 表åï¼file + updateSupportï¼ä¸ä¼ æä»¶ã |
| | | 4. **å±ç¤ºç»æ** -> å端è¿å导å
¥ç»æï¼å建æååå / æ´æ°æååå / 失败ååååå ï¼ï¼åç«¯éæ¡å±ç¤ºã |
| | | |
| | | ## API |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | `/hrm/employee/import-template` | ä¸è½½å工导å
¥æ¨¡æ¿ï¼å«ç¤ºä¾æ°æ®ï¼ | |
| | | | POST | `/hrm/employee/import` | 导å
¥åå·¥ Excel | |
| | | |
| | | ### ä¸è½½æ¨¡æ¿ |
| | | |
| | | **ååºï¼** Excel æä»¶ï¼`å工导å
¥æ¨¡æ¿.xls`ï¼ï¼è¡¨å¤´å¦ä¸ï¼ |
| | | |
| | | | åå·¥å§å | æ§å« | ææºå· | é¨é¨åç§° | å²ä½åç§° | ç¨æ·è§è² | å
¥èæ¥æ | åå·¥ç¶æ | 身份è¯å· | åºçæ¥æ | æ°æ | å©å§»ç¶æ | å¹´é¾ | å¦å | æ¿æ²»é¢è² | é®ç®± | 夿³¨ | |
| | | |---------|------|--------|---------|---------|---------|---------|---------|---------|---------|------|---------|------|------|---------|------|------| |
| | | |
| | | - æ§å«ï¼å¡«"ç·"/"女"ï¼åå
¸ `hrm_gender`ï¼å¼ 1/2ï¼ |
| | | - åå·¥ç¶æï¼å¡«"å¨è"/"è¯ç¨"/"离è"ï¼åå
¸ `hrm_employee_status`ï¼å¼ 1/2/3ï¼ |
| | | - ç¨æ·è§è²ï¼å¡«è§è²åç§°ï¼å¤ä¸ªç¨**䏿éå·**åéï¼å¦"æ®é管çå,æ®éåå·¥"ï¼ |
| | | |
| | | ### 导å
¥åå·¥ |
| | | |
| | | **请æ±åæ°ï¼multipart/form-dataï¼ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | file | MultipartFile | æ¯ | ä¸ä¼ ç Excel æä»¶ | |
| | | | updateSupport | Boolean | å¦ | æ¯å¦æ¯ææ´æ°ï¼é»è®¤ falseã为 true æ¶ææºå·å·²åå¨çåå·¥ä¼è¢«æ´æ°ï¼å¦å记为失败 | |
| | | |
| | | **ååºï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 0, |
| | | "data": { |
| | | "createNames": ["å¼ ä¸", "æå"], |
| | | "updateNames": ["çäº"], |
| | | "failureNames": { |
| | | "èµµå
": "ææºå·å·²åå¨ï¼è¯·æ´æ¢ææºå·", |
| | | "åä¸": "é¨é¨ãä¸åå¨çé¨é¨ãä¸åå¨" |
| | | } |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | **ååºå段ï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | createNames | List\<String\> | å建æåçåå·¥å§åæ°ç» | |
| | | | updateNames | List\<String\> | æ´æ°æåçåå·¥å§åæ°ç» | |
| | | | failureNames | Map\<String, String\> | 导å
¥å¤±è´¥éåï¼key 为åå·¥å§åï¼value 为失败åå | |
| | | |
| | | ## åæ®µå±ç¤ºè§å |
| | | |
| | | ### 导å
¥æ¨¡æ¿ï¼æ°å¢åæ®µï¼ |
| | | |
| | | | åæ®µ | å±ç¤ºä½ç½® | 说æ | |
| | | |------|----------|------| |
| | | | åå·¥å§å | 模æ¿å | å¿
å¡« | |
| | | | æ§å« | 模æ¿å | å¿
å¡«ï¼é»è®¤ç· | |
| | | | ææºå· | 模æ¿å | å¿
å¡«ï¼å°ä½ä¸ºç³»ç»ç»å½è´¦å· | |
| | | | é¨é¨åç§° | 模æ¿å | å¿
å¡«ï¼å¡«åç§°ï¼å端转 ID | |
| | | | å²ä½åç§° | 模æ¿å | å¿
å¡«ï¼å¡«åç§°ï¼å端转 ID | |
| | | | ç¨æ·è§è² | 模æ¿å | éå¡«ï¼å¡«åç§°ï¼å¤ä¸ªç¨ä¸æéå·åé | |
| | | | å
¥èæ¥æ | 模æ¿å | å¿
å¡«ï¼æ ¼å¼ YYYY-MM-DD | |
| | | | åå·¥ç¶æ | 模æ¿å | å¿
å¡«ï¼é»è®¤å¨è | |
| | | | 身份è¯å· | 模æ¿å | éå¡« | |
| | | | åºçæ¥æ | 模æ¿å | éå¡«ï¼æ ¼å¼ YYYY-MM-DD | |
| | | | æ°æ | 模æ¿å | éå¡«ï¼ææ¬ï¼å¦"æ±æ"ï¼ | |
| | | | å©å§»ç¶æ | 模æ¿å | éå¡«ï¼ææ¬ï¼å¦"å·²å©"ï¼ | |
| | | | å¹´é¾ | 模æ¿å | éå¡«ï¼æ°å | |
| | | | å¦å | 模æ¿å | éå¡«ï¼ææ¬ï¼å¦"æ¬ç§"ï¼ | |
| | | | æ¿æ²»é¢è² | 模æ¿å | éå¡«ï¼ææ¬ï¼å¦"ä¸å
±å
å"ï¼ | |
| | | | é®ç®± | 模æ¿å | éå¡« | |
| | | | 夿³¨ | 模æ¿å | éå¡« | |
| | | |
| | | ### æ°å¢/ç¼è¾è¡¨åï¼æ°å¢åæ®µï¼ |
| | | |
| | | | åæ®µ | å±ç¤ºä½ç½® | 说æ | |
| | | |------|----------|------| |
| | | | æ°æ | 表å | ææ¬è¾å
¥æ¡ | |
| | | | å©å§»ç¶æ | 表å | ææ¬è¾å
¥æ¡ | |
| | | | å¹´é¾ | 表å | æ°åè¾å
¥æ¡ | |
| | | | å¦å | 表å | ææ¬è¾å
¥æ¡ | |
| | | | æ¿æ²»é¢è² | 表å | ææ¬è¾å
¥æ¡ | |
| | | |
| | | ### å表 / 详æ
/ å¯¼åº |
| | | |
| | | - æ°å¢åæ®µä¸ºçº¯ææ¬ï¼æ éåå
¸è½¬ç ï¼å¯ç´æ¥å±ç¤º |
| | | - å¯¼åº Excelï¼`GET /hrm/employee/export-excel`ï¼å·²å
å«ä¸è¿°å段å |
| | | |
| | | ## ä¸å¡è§å说æ |
| | | |
| | | | åºæ¯ | è§å | |
| | | |------|------| |
| | | | ææºå·å·²åå¨ä¸ updateSupport=false | 该è¡å¯¼å
¥å¤±è´¥ï¼åå "ææºå·å·²åå¨ï¼è¯·æ´æ¢ææºå·" | |
| | | | ææºå·å·²åå¨ä¸ updateSupport=true | æ´æ°è¯¥å工信æ¯ï¼å«æ°å¢åæ®µï¼ | |
| | | | é¨é¨åç§° / å²ä½åç§°å¡«éæä¸åå¨ | 该è¡å¯¼å
¥å¤±è´¥ï¼åå "é¨é¨ãxxãä¸åå¨" / "å²ä½ãxxãä¸åå¨" | |
| | | | ç¨æ·è§è²åç§°å¡«éæä¸åå¨ | 该è¡å¯¼å
¥å¤±è´¥ï¼åå "è§è²ãxxãä¸åå¨" | |
| | | | åå·¥å§åãææºå·ãå
¥èæ¥æä¸ºç©º | 该è¡å¯¼å
¥å¤±è´¥ï¼åå "导å
¥å段ãxxãä¸è½ä¸ºç©º" | |
| | | | æ§å«ãåå·¥ç¶æä¸ºç©º | é»è®¤æç· / å¨èå¤ç | |
| | | | 导å
¥æ¶åå·¥ç¼å· | ç±ç³»ç»èªå¨çæï¼æ é卿¨¡æ¿ä¸å¡«å | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - 导å
¥æ¥å£æéç 为 `hrm:employee:import`ï¼éå¨èåæéä¸é
ç½®ã |
| | | - ç¨æ·è§è²åç§°éä¸ç³»ç»è§è²å®å
¨ä¸è´ï¼ç²¾ç¡®å¹é
ï¼ä¸å模ç³ï¼ã |
| | | - åä¸è¡å
ï¼é¨é¨ / å²ä½ / è§è²è§£æå¤±è´¥åè¯¥è¡æ´ä½å¤±è´¥ï¼ä¸ä¼é¨å导å
¥ã |
| | | - 导å
¥å建åå·¥æ¶ä¼åæ¥å建系ç»ç»å½è´¦å·ï¼ç¨æ·åä¸ºææºå·ï¼é»è®¤å¯ç ä¸ºææºå·ï¼ï¼è¯·æéä½¿ç¨æ¹æ³¨æè´¦å·å®å
¨ã |
| | | - 模æ¿ä¸ç¤ºä¾è¡çé¨é¨ / å²ä½ / è§è²åç§°ä¸ºç¤ºä¾æ°æ®ï¼æ£å¼å¯¼å
¥åéæ¿æ¢ä¸ºç³»ç»ä¸çå®åå¨çåç§°ã |
| | |
| | | -- ============================================================ |
| | | -- ç³»ç»ä¸å¡æ°æ®æ¸
çåå¨è¿ç¨ |
| | | -- |
| | | -- ç¨éï¼æ¸
空ææä¸å¡åæ®æ°æ®ï¼ä¿çç³»ç»é
ç½®ååºç¡æ°æ® |
| | | -- ç¨éï¼æ¸
空ææä¸å¡æ°æ® + åºç¡æ°æ®ï¼ç©æ/客æ·/ä¾åºå/ä»åºçï¼ |
| | | -- ä¿çï¼ç³»ç»è¡¨ã工使µå¼æã宿¶ä»»å¡ãç¼ç è§åãåºç¡è®¾æ½é
ç½® |
| | | -- 注æï¼æ¤æä½ä¸å¯éï¼æ§è¡å请确认已å¤ä»½æ°æ®åº |
| | | -- |
| | | -- ä½¿ç¨æ¹å¼ï¼CALL sp_clean_business_data(); |
| | |
| | | |
| | | CREATE PROCEDURE sp_clean_business_data() |
| | | BEGIN |
| | | -- å
³éå¤é®æ£æ¥ï¼é¿å
å 表é´å¼ç¨å¯¼è´å é¤å¤±è´¥ |
| | | SET FOREIGN_KEY_CHECKS = 0; |
| | | |
| | | -- ============================================================ |
| | | -- 1. ç³»ç»æ¥å¿ä¸Tokenï¼å¯å®å
¨æ¸
çï¼ |
| | | -- 1. ç³»ç»æ¥å¿ä¸Token |
| | | -- ============================================================ |
| | | TRUNCATE TABLE system_login_log; |
| | | TRUNCATE TABLE system_operate_log; |
| | |
| | | TRUNCATE TABLE infra_job_log; |
| | | |
| | | -- ============================================================ |
| | | -- 2. æä»¶ä¸éä»¶ï¼ä¸å¡æä»¶ï¼æ¸
çåä¸å½±åç³»ç»è¿è¡ï¼ |
| | | -- 2. æä»¶ä¸éä»¶ |
| | | -- ============================================================ |
| | | TRUNCATE TABLE system_storage_attachment; |
| | | TRUNCATE TABLE system_storage_blob; |
| | |
| | | -- ============================================================ |
| | | -- 4. MES ä»åºæ¨¡å â ä¸å¡åæ® |
| | | -- ============================================================ |
| | | -- åºåäº¤ææµæ°´ï¼åºå±ï¼å
æ¸
ï¼ |
| | | TRUNCATE TABLE mes_wm_transaction; |
| | | TRUNCATE TABLE mes_wm_stock_reserve; |
| | | TRUNCATE TABLE mes_wm_material_stock; |
| | | |
| | | -- åºåå· / æ¹æ¬¡ / æ¡ç |
| | | TRUNCATE TABLE mes_wm_sn; |
| | | TRUNCATE TABLE mes_wm_batch; |
| | | TRUNCATE TABLE mes_wm_barcode; |
| | | |
| | | -- çç¹ |
| | | TRUNCATE TABLE mes_wm_stock_taking_task_result; |
| | | TRUNCATE TABLE mes_wm_stock_taking_task_line; |
| | | TRUNCATE TABLE mes_wm_stock_taking_task; |
| | | TRUNCATE TABLE mes_wm_stock_taking_plan_param; |
| | | TRUNCATE TABLE mes_wm_stock_taking_plan; |
| | | |
| | | -- å
è£
|
| | | TRUNCATE TABLE mes_wm_package_line; |
| | | TRUNCATE TABLE mes_wm_package; |
| | | |
| | | -- åºå
¥åºæç»/è¡ï¼å
æ¸
detail/lineï¼åæ¸
ä¸»è¡¨ï¼ |
| | | TRUNCATE TABLE mes_wm_item_receipt_detail; |
| | | TRUNCATE TABLE mes_wm_item_receipt_line; |
| | | TRUNCATE TABLE mes_wm_item_receipt; |
| | |
| | | TRUNCATE TABLE mes_wm_arrival_notice; |
| | | |
| | | -- ============================================================ |
| | | -- 5. MES è´¨æ£æ¨¡å â ä¸å¡æ°æ® |
| | | -- 5. MES è´¨æ£æ¨¡å â ä¸å¡åæ® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_qc_indicator_result_detail; |
| | | TRUNCATE TABLE mes_qc_indicator_result; |
| | |
| | | TRUNCATE TABLE mes_pd_document; |
| | | TRUNCATE TABLE mes_pd_project; |
| | | |
| | | -- ç¼ç çæè®°å½ï¼è§åæ¬èº«ä¿çï¼ |
| | | -- ============================================================ |
| | | -- 8. MES åºç¡æ°æ® â ç©æ/产å/BOM/SOP/SIP |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_md_product_bom; |
| | | TRUNCATE TABLE mes_md_product_sip; |
| | | TRUNCATE TABLE mes_md_product_sop; |
| | | TRUNCATE TABLE mes_md_item; |
| | | TRUNCATE TABLE mes_md_item_batch_config; |
| | | TRUNCATE TABLE mes_md_item_type; |
| | | TRUNCATE TABLE mes_md_unit_measure; |
| | | TRUNCATE TABLE mes_md_vendor; |
| | | TRUNCATE TABLE mes_md_auto_code_record; |
| | | |
| | | -- ============================================================ |
| | | -- 8. CRM 模å â ä¸å¡åæ® |
| | | -- 9. MES åºç¡æ°æ® â 车é´/å·¥ä½ç«/èµæº |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_md_workstation_machine; |
| | | TRUNCATE TABLE mes_md_workstation_tool; |
| | | TRUNCATE TABLE mes_md_workstation_worker; |
| | | TRUNCATE TABLE mes_md_workstation; |
| | | TRUNCATE TABLE mes_md_workshop; |
| | | |
| | | -- ============================================================ |
| | | -- 10. MES åºç¡æ°æ® â çç»/æç |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_cal_plan_team; |
| | | TRUNCATE TABLE mes_cal_plan_shift; |
| | | TRUNCATE TABLE mes_cal_plan; |
| | | TRUNCATE TABLE mes_cal_team_shift; |
| | | TRUNCATE TABLE mes_cal_team_member; |
| | | TRUNCATE TABLE mes_cal_team; |
| | | TRUNCATE TABLE mes_cal_holiday; |
| | | |
| | | -- ============================================================ |
| | | -- 11. MES åºç¡æ°æ® â 设å¤/å·¥å
·å°è´¦ |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_dv_check_plan_subject; |
| | | TRUNCATE TABLE mes_dv_check_plan_machinery; |
| | | TRUNCATE TABLE mes_dv_check_plan; |
| | | TRUNCATE TABLE mes_dv_machinery; |
| | | TRUNCATE TABLE mes_dv_machinery_type; |
| | | TRUNCATE TABLE mes_dv_subject; |
| | | TRUNCATE TABLE mes_tm_tool; |
| | | TRUNCATE TABLE mes_tm_tool_type; |
| | | |
| | | -- ============================================================ |
| | | -- 12. MES åºç¡æ°æ® â å·¥èºè·¯çº¿/å·¥åº/åæ° |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_pro_route_product_bom; |
| | | TRUNCATE TABLE mes_pro_route_product; |
| | | TRUNCATE TABLE mes_pro_route_process; |
| | | TRUNCATE TABLE mes_pro_route; |
| | | TRUNCATE TABLE mes_pro_process_content; |
| | | TRUNCATE TABLE mes_pro_process; |
| | | TRUNCATE TABLE mes_pd_process_param_template_detail; |
| | | TRUNCATE TABLE mes_pd_process_param_template; |
| | | TRUNCATE TABLE mes_pd_process_param; |
| | | |
| | | -- ============================================================ |
| | | -- 13. MES åºç¡æ°æ® â è´¨æ£æ¹æ¡/缺é·/ææ |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_qc_template_item; |
| | | TRUNCATE TABLE mes_qc_template_indicator; |
| | | TRUNCATE TABLE mes_qc_template; |
| | | TRUNCATE TABLE mes_qc_defect; |
| | | TRUNCATE TABLE mes_qc_indicator; |
| | | |
| | | -- ============================================================ |
| | | -- 14. MES åºç¡æ°æ® â ä»åº/åºåº/åºä½ |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_wm_warehouse_location; |
| | | TRUNCATE TABLE mes_wm_warehouse_area; |
| | | TRUNCATE TABLE mes_wm_warehouse; |
| | | |
| | | -- ============================================================ |
| | | -- 15. MES åºç¡é
ç½® â ç¼ç è®°å½/æ¡ç /å®ç¯é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mes_wm_barcode_config; |
| | | TRUNCATE TABLE mes_pro_andon_config; |
| | | |
| | | -- ============================================================ |
| | | -- 16. MDM ä¸»æ°æ® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE mdm_item_sku; |
| | | TRUNCATE TABLE mdm_item_migration_map; |
| | | TRUNCATE TABLE mdm_item_batch_config; |
| | | TRUNCATE TABLE mdm_item; |
| | | TRUNCATE TABLE mdm_item_category; |
| | | TRUNCATE TABLE mdm_brand; |
| | | TRUNCATE TABLE mdm_unit_measure; |
| | | TRUNCATE TABLE mdm_warehouse; |
| | | |
| | | -- ============================================================ |
| | | -- 17. CRM 模å â ä¸å¡åæ® + å®¢æ· + é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE after_sale_return_item; |
| | | TRUNCATE TABLE after_sale_return; |
| | |
| | | TRUNCATE TABLE crm_follow_up_record; |
| | | TRUNCATE TABLE crm_customer; |
| | | TRUNCATE TABLE crm_permission; |
| | | TRUNCATE TABLE crm_business_status; |
| | | TRUNCATE TABLE crm_business_status_type; |
| | | TRUNCATE TABLE crm_contract_config; |
| | | TRUNCATE TABLE crm_customer_limit_config; |
| | | TRUNCATE TABLE crm_customer_pool_config; |
| | | |
| | | -- ============================================================ |
| | | -- 9. ERP 模å â ä¸å¡åæ® |
| | | -- 18. ERP 模å â ä¸å¡åæ® + ä¾åºå + ç»ç®è´¦æ· |
| | | -- ============================================================ |
| | | TRUNCATE TABLE erp_finance_payment_item; |
| | | TRUNCATE TABLE erp_finance_payment; |
| | |
| | | TRUNCATE TABLE erp_purchase_request; |
| | | TRUNCATE TABLE erp_sale_order_items; |
| | | TRUNCATE TABLE erp_sale_order; |
| | | TRUNCATE TABLE erp_supplier; |
| | | TRUNCATE TABLE erp_account; |
| | | |
| | | -- ============================================================ |
| | | -- 10. HRM 模å â ä¸å¡åæ® |
| | | -- 19. SRM 模å â ä¸å¡åæ® + ä¾åºå + é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE srm_bid_award; |
| | | TRUNCATE TABLE srm_bid_evaluation; |
| | | TRUNCATE TABLE srm_bid_open; |
| | | TRUNCATE TABLE srm_tender_bid; |
| | | TRUNCATE TABLE srm_tender_material; |
| | | TRUNCATE TABLE srm_tender_project; |
| | | TRUNCATE TABLE srm_delivery_plan; |
| | | TRUNCATE TABLE srm_purchase_collaboration; |
| | | TRUNCATE TABLE srm_supplier_quote; |
| | | TRUNCATE TABLE srm_supplier_evaluation; |
| | | TRUNCATE TABLE srm_supplier_certificate; |
| | | TRUNCATE TABLE srm_supplier_contact; |
| | | TRUNCATE TABLE srm_supplier_apply; |
| | | TRUNCATE TABLE srm_supplier_category; |
| | | TRUNCATE TABLE srm_supplier; |
| | | TRUNCATE TABLE srm_tender_config; |
| | | |
| | | -- ============================================================ |
| | | -- 20. HRM 模å â ä¸å¡åæ® + é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE hrm_salary_payment_detail; |
| | | TRUNCATE TABLE hrm_salary_payment; |
| | |
| | | TRUNCATE TABLE hrm_employee_social_security; |
| | | TRUNCATE TABLE hrm_employee_salary; |
| | | TRUNCATE TABLE hrm_employee; |
| | | TRUNCATE TABLE hrm_attendance_holiday; |
| | | TRUNCATE TABLE hrm_attendance_rule; |
| | | TRUNCATE TABLE hrm_leave_type_config; |
| | | TRUNCATE TABLE hrm_salary_structure; |
| | | TRUNCATE TABLE hrm_social_security_scheme; |
| | | TRUNCATE TABLE hrm_tax_rate_config; |
| | | |
| | | -- ============================================================ |
| | | -- 11. SRM 模å â ä¸å¡åæ® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE srm_bid_award; |
| | | TRUNCATE TABLE srm_bid_evaluation; |
| | | TRUNCATE TABLE srm_bid_open; |
| | | TRUNCATE TABLE srm_tender_bid; |
| | | TRUNCATE TABLE srm_tender_material; |
| | | TRUNCATE TABLE srm_tender_project; |
| | | TRUNCATE TABLE srm_delivery_plan; |
| | | TRUNCATE TABLE srm_purchase_collaboration; |
| | | TRUNCATE TABLE srm_supplier_quote; |
| | | TRUNCATE TABLE srm_supplier_evaluation; |
| | | TRUNCATE TABLE srm_supplier_certificate; |
| | | TRUNCATE TABLE srm_supplier_contact; |
| | | TRUNCATE TABLE srm_supplier_apply; |
| | | |
| | | -- ============================================================ |
| | | -- 12. BPM 模å â ä¸å¡åæ® |
| | | -- 21. BPM 模å â ä¸å¡æ°æ® + æµç¨å®ä¹ |
| | | -- ============================================================ |
| | | TRUNCATE TABLE bpm_oa_leave; |
| | | TRUNCATE TABLE bpm_process_instance_copy; |
| | | TRUNCATE TABLE bpm_process_definition_info; |
| | | TRUNCATE TABLE bpm_process_expression; |
| | | TRUNCATE TABLE bpm_process_listener; |
| | | TRUNCATE TABLE bpm_user_group; |
| | | TRUNCATE TABLE bpm_form; |
| | | TRUNCATE TABLE bpm_category; |
| | | |
| | | -- ============================================================ |
| | | -- 13. AI 模å â ä¼è¯/å
å®¹æ°æ® |
| | | -- 22. AI 模å â æ°æ® + é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE ai_chat_message; |
| | | TRUNCATE TABLE ai_chat_conversation; |
| | |
| | | TRUNCATE TABLE ai_music; |
| | | TRUNCATE TABLE ai_write; |
| | | TRUNCATE TABLE ai_workflow; |
| | | TRUNCATE TABLE ai_api_key; |
| | | TRUNCATE TABLE ai_model; |
| | | TRUNCATE TABLE ai_tool; |
| | | TRUNCATE TABLE ai_chat_role; |
| | | |
| | | -- ============================================================ |
| | | -- 14. IM 模å â ä¼è¯/æ¶æ¯æ°æ® |
| | | -- 23. IM 模å â æ°æ® + é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE im_group_message_receipt; |
| | | TRUNCATE TABLE im_group_message; |
| | |
| | | TRUNCATE TABLE im_rtc_participant; |
| | | TRUNCATE TABLE im_rtc_call; |
| | | TRUNCATE TABLE im_user_online; |
| | | TRUNCATE TABLE im_sensitive_word; |
| | | TRUNCATE TABLE im_face_user_item; |
| | | TRUNCATE TABLE im_face_pack_item; |
| | | TRUNCATE TABLE im_face_pack; |
| | | |
| | | -- ============================================================ |
| | | -- 15. OA éç¥å
¬å â ä¸å¡æ°æ® |
| | | -- 24. BI æ¥è¡¨é
ç½® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE bi_warehouse_coordinate; |
| | | TRUNCATE TABLE bi_chart_config; |
| | | TRUNCATE TABLE bi_dashboard; |
| | | TRUNCATE TABLE bi_data_source_config; |
| | | |
| | | -- ============================================================ |
| | | -- 25. å
¶ä»æ¨¡åæ°æ® |
| | | -- ============================================================ |
| | | TRUNCATE TABLE oa_notice_read; |
| | | TRUNCATE TABLE oa_notice_user; |
| | | TRUNCATE TABLE oa_notice; |
| | | TRUNCATE TABLE system_notice; |
| | | TRUNCATE TABLE system_notify_template; |
| | | TRUNCATE TABLE system_mail_log; |
| | | TRUNCATE TABLE system_mail_template; |
| | | TRUNCATE TABLE system_mail_account; |
| | | TRUNCATE TABLE system_sms_code; |
| | | TRUNCATE TABLE system_sms_log; |
| | | TRUNCATE TABLE system_sms_template; |
| | | TRUNCATE TABLE system_sms_channel; |
| | | TRUNCATE TABLE system_social_user_bind; |
| | | TRUNCATE TABLE system_social_user; |
| | | TRUNCATE TABLE system_social_client; |
| | | TRUNCATE TABLE report_go_view_project; |
| | | |
| | | -- ============================================================ |
| | | -- æ¢å¤å¤é®æ£æ¥ |
| | | -- ============================================================ |
| | | SET FOREIGN_KEY_CHECKS = 1; |
| | | |
| | | -- è¿åæ¸
çç»æ |
| | | SELECT 'ä¸å¡æ°æ®æ¸
ç宿' AS result; |
| | | END$$ |
| | | |
| | | DELIMITER ; |
| | | |
| | | -- ============================================================ |
| | | -- æ§è¡ç¤ºä¾ï¼ |
| | | -- CALL sp_clean_business_data(); |
| | | -- ä¿çç表ï¼ä¸ä¼è¢«æ¸
çï¼ï¼ |
| | | -- |
| | | -- ãç³»ç»æ ¸å¿ã |
| | | -- system_users / system_dept / system_post |
| | | -- system_role / system_role_menu |
| | | -- system_menu |
| | | -- system_dict_type / system_dict_data |
| | | -- system_tenant / system_tenant_package |
| | | -- system_user_post / system_user_role |
| | | -- system_oauth2_client |
| | | -- system_notify_template â å·²æ¸
ç |
| | | -- |
| | | -- ãåºç¡è®¾æ½ã |
| | | -- infra_config / infra_job |
| | | -- infra_codegen_table / infra_codegen_column |
| | | -- infra_data_source_config / infra_file_config |
| | | -- |
| | | -- ã工使µå¼æã |
| | | -- act_* (Activiti å¼æè¡¨) |
| | | -- flw_* (Flowable å¼æè¡¨) |
| | | -- |
| | | -- ã宿¶ä»»å¡ã |
| | | -- qrtz_* (Quartz å¼æè¡¨) |
| | | -- |
| | | -- ãç¼ç è§åï¼ä¿çï¼ã |
| | | -- mes_md_auto_code_rule |
| | | -- mes_md_auto_code_part |
| | | -- |
| | | -- ã示ä¾è¡¨ã |
| | | -- yudao_demo01_contact |
| | | -- yudao_demo02_category |
| | | -- yudao_demo03_course / yudao_demo03_grade / yudao_demo03_student |
| | | -- ============================================================ |
| | | |
| | | -- æ§è¡ï¼CALL sp_clean_business_data(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ===================================================== |
| | | -- CRM å¼ç¥¨åè½åå§åèæ¬ |
| | | -- 1. 建表 crm_invoice |
| | | -- 2. æ°æ®åå
¸ crm_invoice_typeï¼å票类åï¼ |
| | | -- 3. èå䏿鮿éï¼è¥é管ç -> å¼ç¥¨ç®¡çï¼ |
| | | -- ===================================================== |
| | | |
| | | -- 1. 建表 |
| | | CREATE TABLE IF NOT EXISTS `crm_invoice` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', |
| | | `no` varchar(64) NOT NULL COMMENT 'å¼ç¥¨ç¼å·', |
| | | `customer_id` bigint NOT NULL COMMENT '客æ·ç¼å·', |
| | | `contract_id` bigint NOT NULL COMMENT 'ååç¼å·', |
| | | `owner_user_id` bigint NOT NULL COMMENT 'è´è´£äººç¼å·', |
| | | `invoice_type` int NOT NULL COMMENT 'å票类åï¼åå
¸ crm_invoice_typeï¼', |
| | | `invoice_no` varchar(64) DEFAULT NULL COMMENT 'å票å·ç ', |
| | | `invoice_title` varchar(255) DEFAULT NULL COMMENT 'å票æ¬å¤´', |
| | | `price` decimal(18,2) NOT NULL COMMENT 'å¼ç¥¨éé¢ï¼å
ï¼', |
| | | `invoice_time` datetime DEFAULT NULL COMMENT 'å¼ç¥¨æ¥æ', |
| | | `remark` varchar(255) DEFAULT NULL COMMENT '夿³¨', |
| | | `process_instance_id` varchar(64) DEFAULT NULL COMMENT '工使µç¼å·', |
| | | `audit_status` int NOT NULL COMMENT '审æ¹ç¶æï¼crm_audit_statusï¼', |
| | | `creator` varchar(64) DEFAULT NULL COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT NULL COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æåæ´æ°æ¶é´', |
| | | `deleted` tinyint NOT NULL DEFAULT 0 COMMENT 'æ¯å¦å é¤', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM å¼ç¥¨'; |
| | | |
| | | -- 2. æ°æ®åå
¸ç±»åï¼crm_invoice_type |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) |
| | | VALUES (1061500, 'CRM å票类å', 'crm_invoice_type', 0, 'å¼ç¥¨è®°å½çå票类å', '1', NOW(), '1', NOW(), b'0', NULL); |
| | | |
| | | -- 2.1 æ°æ®åå
¸æ°æ® |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) |
| | | VALUES |
| | | (1061600, 1, 'å¢å¼ç¨ä¸ç¨å票', '1', 'crm_invoice_type', 0, 'primary', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1061601, 2, 'å¢å¼ç¨æ®éå票', '2', 'crm_invoice_type', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1061602, 3, 'çµåå票', '3', 'crm_invoice_type', 0, 'warning', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- 3. èåï¼è¥é管ç(id=2617) -> å¼ç¥¨ç®¡ç |
| | | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) |
| | | VALUES (1064000, 'å¼ç¥¨ç®¡ç', '', 2, 59, 2617, 'invoice', '#', 'crm/invoice/index', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- 3.1 å¼ç¥¨ç®¡çæé®æé |
| | | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) |
| | | VALUES |
| | | (1064001, 'å¼ç¥¨ç®¡çæ¥è¯¢', 'crm:invoice:query', 3, 1, 1064000, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'), |
| | | (1064002, 'å¼ç¥¨ç®¡çå建', 'crm:invoice:create', 3, 2, 1064000, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'), |
| | | (1064003, 'å¼ç¥¨ç®¡çæ´æ°', 'crm:invoice:update', 3, 3, 1064000, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'), |
| | | (1064004, 'å¼ç¥¨ç®¡çå é¤', 'crm:invoice:delete', 3, 4, 1064000, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'), |
| | | (1064005, 'å¼ç¥¨ç®¡ç导åº', 'crm:invoice:export', 3, 5, 1064000, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- å工信æ¯å¯¼å
¥åè½ - æ°å¢å段 |
| | | -- ç¨äº hrm_employee è¡¨ï¼æ°æãå©å§»ç¶æãå¹´é¾ãå¦åãæ¿æ²»é¢è² |
| | | |
| | | ALTER TABLE hrm_employee ADD COLUMN nation VARCHAR(32) COMMENT 'æ°æ' AFTER id_card; |
| | | ALTER TABLE hrm_employee ADD COLUMN marriage_status VARCHAR(16) COMMENT 'å©å§»ç¶æ' AFTER nation; |
| | | ALTER TABLE hrm_employee ADD COLUMN age INT COMMENT 'å¹´é¾' AFTER marriage_status; |
| | | ALTER TABLE hrm_employee ADD COLUMN education VARCHAR(32) COMMENT 'å¦å' AFTER age; |
| | | ALTER TABLE hrm_employee ADD COLUMN political_status VARCHAR(32) COMMENT 'æ¿æ²»é¢è²' AFTER education; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.invoice; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoicePageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoiceRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoiceSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceService; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | @Tag(name = "管çåå° - CRM å¼ç¥¨") |
| | | @RestController |
| | | @RequestMapping("/crm/invoice") |
| | | @Validated |
| | | public class CrmInvoiceController { |
| | | |
| | | @Resource |
| | | private CrmInvoiceService invoiceService; |
| | | @Resource |
| | | private CrmContractService contractService; |
| | | @Resource |
| | | private CrmCustomerService customerService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private DeptApi deptApi; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建å¼ç¥¨") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:create')") |
| | | public CommonResult<Long> createInvoice(@Valid @RequestBody CrmInvoiceSaveReqVO createReqVO) { |
| | | return success(invoiceService.createInvoice(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å¼ç¥¨") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:update')") |
| | | public CommonResult<Boolean> updateInvoice(@Valid @RequestBody CrmInvoiceSaveReqVO updateReqVO) { |
| | | invoiceService.updateInvoice(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å¼ç¥¨") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:delete')") |
| | | public CommonResult<Boolean> deleteInvoice(@RequestParam("id") Long id) { |
| | | invoiceService.deleteInvoice(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å¼ç¥¨") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:query')") |
| | | public CommonResult<CrmInvoiceRespVO> getInvoice(@RequestParam("id") Long id) { |
| | | CrmInvoiceDO invoice = invoiceService.getInvoice(id); |
| | | return success(buildInvoiceDetail(invoice)); |
| | | } |
| | | |
| | | private CrmInvoiceRespVO buildInvoiceDetail(CrmInvoiceDO invoice) { |
| | | if (invoice == null) { |
| | | return null; |
| | | } |
| | | return buildInvoiceDetailList(Collections.singletonList(invoice)).get(0); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å¼ç¥¨å页") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:query')") |
| | | public CommonResult<PageResult<CrmInvoiceRespVO>> getInvoicePage(@Valid CrmInvoicePageReqVO pageReqVO) { |
| | | PageResult<CrmInvoiceDO> pageResult = invoiceService.getInvoicePage(pageReqVO, getLoginUserId()); |
| | | return success(new PageResult<>(buildInvoiceDetailList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/page-by-customer") |
| | | @Operation(summary = "è·å¾å¼ç¥¨å页ï¼åºäºæå®å®¢æ·") |
| | | public CommonResult<PageResult<CrmInvoiceRespVO>> getInvoicePageByCustomer(@Valid CrmInvoicePageReqVO pageReqVO) { |
| | | Assert.notNull(pageReqVO.getCustomerId(), "客æ·ç¼å·ä¸è½ä¸ºç©º"); |
| | | PageResult<CrmInvoiceDO> pageResult = invoiceService.getInvoicePageByCustomerId(pageReqVO); |
| | | return success(new PageResult<>(buildInvoiceDetailList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºå¼ç¥¨ Excel") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportInvoiceExcel(@Valid CrmInvoicePageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | exportReqVO.setPageSize(PAGE_SIZE_NONE); |
| | | List<CrmInvoiceDO> list = invoiceService.getInvoicePage(exportReqVO, getLoginUserId()).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "å¼ç¥¨.xls", "æ°æ®", CrmInvoiceRespVO.class, |
| | | buildInvoiceDetailList(list)); |
| | | } |
| | | |
| | | private List<CrmInvoiceRespVO> buildInvoiceDetailList(List<CrmInvoiceDO> invoiceList) { |
| | | if (CollUtil.isEmpty(invoiceList)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1.1 è·å客æ·å表 |
| | | Map<Long, CrmCustomerDO> customerMap = customerService.getCustomerMap( |
| | | convertSet(invoiceList, CrmInvoiceDO::getCustomerId)); |
| | | // 1.2 è·åå建人ãè´è´£äººå表 |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(invoiceList, |
| | | invoice -> Stream.of(NumberUtils.parseLong(invoice.getCreator()), invoice.getOwnerUserId()))); |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| | | // 1.3 è·å¾ååå表 |
| | | Map<Long, CrmContractDO> contractMap = contractService.getContractMap( |
| | | convertSet(invoiceList, CrmInvoiceDO::getContractId)); |
| | | // 2. æ¼æ¥ç»æ |
| | | return BeanUtils.toBean(invoiceList, CrmInvoiceRespVO.class, (invoiceVO) -> { |
| | | // 2.1 æ¼æ¥å®¢æ·åç§° |
| | | findAndThen(customerMap, invoiceVO.getCustomerId(), customer -> invoiceVO.setCustomerName(customer.getName())); |
| | | // 2.2 æ¼æ¥è´è´£äººãå建人åç§° |
| | | MapUtils.findAndThen(userMap, NumberUtils.parseLong(invoiceVO.getCreator()), |
| | | user -> invoiceVO.setCreatorName(user.getNickname())); |
| | | MapUtils.findAndThen(userMap, invoiceVO.getOwnerUserId(), user -> { |
| | | invoiceVO.setOwnerUserName(user.getNickname()); |
| | | MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> invoiceVO.setOwnerUserDeptName(dept.getName())); |
| | | }); |
| | | // 2.3 æ¼æ¥ååä¿¡æ¯ |
| | | findAndThen(contractMap, invoiceVO.getContractId(), contract -> |
| | | invoiceVO.setContract(BeanUtils.toBean(contract, CrmContractRespVO.class))); |
| | | // 2.4 æ¼æ¥å票éä»¶ |
| | | invoiceVO.setAttachmentList(storageAttachmentApi.listAttachments("crm_invoice", invoiceVO.getId())); |
| | | }); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤å¼ç¥¨å®¡æ¹") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:update')") |
| | | public CommonResult<Boolean> submitInvoice(@RequestParam("id") Long id) { |
| | | invoiceService.submitInvoice(id, getLoginUserId()); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/audit-count") |
| | | @Operation(summary = "è·å¾å¾
å®¡æ ¸å¼ç¥¨æ°é") |
| | | @PreAuthorize("@ss.hasPermission('crm:invoice:query')") |
| | | public CommonResult<Long> getAuditInvoiceCount() { |
| | | return success(invoiceService.getAuditInvoiceCount(getLoginUserId())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - CRM å¼ç¥¨å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class CrmInvoicePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "å¼ç¥¨ç¼å·") |
| | | private String no; |
| | | |
| | | @Schema(description = "客æ·ç¼å·", example = "4963") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "ååç¼å·", example = "4963") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "åºæ¯ç±»å", example = "1") |
| | | @InEnum(CrmSceneTypeEnum.class) |
| | | private Integer sceneType; // åºæ¯ç±»åï¼ä¸º null æ¶å表示å
¨é¨ |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", example = "20") |
| | | @InEnum(CrmAuditStatusEnum.class) |
| | | private Integer auditStatus; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; |
| | | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.system.api.storage.dto.StorageBlobRespDTO; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - CRM å¼ç¥¨ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class CrmInvoiceRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "25787") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å¼ç¥¨ç¼å·", example = "31177") |
| | | @ExcelProperty("å¼ç¥¨ç¼å·") |
| | | private String no; |
| | | |
| | | @Schema(description = "å票类å", example = "1") |
| | | @ExcelProperty(value = "å票类å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.CRM_INVOICE_TYPE) |
| | | private Integer invoiceType; |
| | | |
| | | @Schema(description = "å票å·ç ", example = "02564178") |
| | | @ExcelProperty("å票å·ç ") |
| | | private String invoiceNo; |
| | | |
| | | @Schema(description = "å票æ¬å¤´", example = "XXç§ææéå
¬å¸") |
| | | @ExcelProperty("å票æ¬å¤´") |
| | | private String invoiceTitle; |
| | | |
| | | @Schema(description = "å¼ç¥¨éé¢", requiredMode = Schema.RequiredMode.REQUIRED, example = "9000") |
| | | @ExcelProperty("å¼ç¥¨éé¢") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "å¼ç¥¨æ¥æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-02-02") |
| | | @ExcelProperty("å¼ç¥¨æ¥æ") |
| | | private LocalDateTime invoiceTime; |
| | | |
| | | @Schema(description = "客æ·ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| | | private Long customerId; |
| | | @Schema(description = "客æ·åå", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") |
| | | @ExcelProperty("客æ·åå") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ååç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| | | @ExcelProperty("ååç¼å·") |
| | | private Long contractId; |
| | | @Schema(description = "ååä¿¡æ¯") |
| | | private CrmContractRespVO contract; |
| | | |
| | | @Schema(description = "è´è´£äººçç¨æ·ç¼å·", example = "25682") |
| | | private Long ownerUserId; |
| | | @Schema(description = "è´è´£äººåå", example = "25682") |
| | | @ExcelProperty("è´è´£äººåå") |
| | | private String ownerUserName; |
| | | @Schema(description = "è´è´£äººé¨é¨") |
| | | @ExcelProperty("è´è´£äººé¨é¨") |
| | | private String ownerUserDeptName; |
| | | |
| | | @Schema(description = "工使µç¼å·", example = "1043") |
| | | @ExcelProperty("工使µç¼å·") |
| | | private String processInstanceId; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") |
| | | @ExcelProperty(value = "审æ¹ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.CRM_AUDIT_STATUS) |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å票éä»¶å表") |
| | | private List<StorageBlobRespDTO> attachmentList; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "å建人", example = "25682") |
| | | private String creator; |
| | | @Schema(description = "å建人åå", example = "test") |
| | | @ExcelProperty("å建人åå") |
| | | private String creatorName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - CRM å¼ç¥¨æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class CrmInvoiceSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "25787") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å¼ç¥¨ç¼å·", example = "31177") |
| | | private String no; |
| | | |
| | | @Schema(description = "客æ·ç¼å·", example = "2") |
| | | private Long customerId; // è¯¥åæ®µä¸éè¿åç«¯ä¼ éï¼èæ¯ contractId æ¥è¯¢åºæ¥è®¾ç½®è¿å» |
| | | |
| | | @Schema(description = "ååç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @NotNull(message = "ååç¼å·ä¸è½ä¸ºç©º") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "è´è´£äººç¼å·", example = "25682") |
| | | private Long ownerUserId; |
| | | |
| | | @Schema(description = "å票类å", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å票类åä¸è½ä¸ºç©º") |
| | | private Integer invoiceType; |
| | | |
| | | @Schema(description = "å票å·ç ", example = "02564178") |
| | | private String invoiceNo; |
| | | |
| | | @Schema(description = "å票æ¬å¤´", example = "XXç§ææéå
¬å¸") |
| | | private String invoiceTitle; |
| | | |
| | | @Schema(description = "å¼ç¥¨éé¢", requiredMode = Schema.RequiredMode.REQUIRED, example = "9000") |
| | | @NotNull(message = "å¼ç¥¨éé¢ä¸è½ä¸ºç©º") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "å¼ç¥¨æ¥æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-02-02") |
| | | @NotNull(message = "å¼ç¥¨æ¥æä¸è½ä¸ºç©º") |
| | | private LocalDateTime invoiceTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å票éä»¶ BlobId å表") |
| | | private List<Long> blobIds; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.dataobject.invoice; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * å¼ç¥¨ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("crm_invoice") |
| | | @KeySequence("crm_invoice_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class CrmInvoiceDO extends BaseDO { |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * å¼ç¥¨ç¼å· |
| | | */ |
| | | private String no; |
| | | /** |
| | | * 客æ·ç¼å· |
| | | * |
| | | * å
³è {@link CrmCustomerDO#getId()} |
| | | */ |
| | | private Long customerId; |
| | | /** |
| | | * ååç¼å· |
| | | * |
| | | * å
³è {@link CrmContractDO#getId()} |
| | | */ |
| | | private Long contractId; |
| | | /** |
| | | * è´è´£äººç¼å·ï¼å
³è {@link AdminUserRespDTO#getId()} |
| | | */ |
| | | private Long ownerUserId; |
| | | |
| | | /** |
| | | * å票类å |
| | | * |
| | | * åå
¸ {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_INVOICE_TYPE} |
| | | */ |
| | | private Integer invoiceType; |
| | | /** |
| | | * å票å·ç |
| | | */ |
| | | private String invoiceNo; |
| | | /** |
| | | * å票æ¬å¤´ |
| | | */ |
| | | private String invoiceTitle; |
| | | /** |
| | | * å¼ç¥¨éé¢ï¼åä½ï¼å
|
| | | */ |
| | | private BigDecimal price; |
| | | /** |
| | | * å¼ç¥¨æ¥æ |
| | | */ |
| | | private LocalDateTime invoiceTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 工使µç¼å· |
| | | * |
| | | * å
³è ProcessInstance ç id 屿§ |
| | | */ |
| | | private String processInstanceId; |
| | | /** |
| | | * 审æ¹ç¶æ |
| | | * |
| | | * æä¸¾ {@link CrmAuditStatusEnum} |
| | | */ |
| | | private Integer auditStatus; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.invoice; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoicePageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| | | import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| | | |
| | | /** |
| | | * å¼ç¥¨ Mapper |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Mapper |
| | | public interface CrmInvoiceMapper extends BaseMapperX<CrmInvoiceDO> { |
| | | |
| | | default CrmInvoiceDO selectByNo(String no) { |
| | | return selectOne(CrmInvoiceDO::getNo, no); |
| | | } |
| | | |
| | | default PageResult<CrmInvoiceDO> selectPageByCustomerId(CrmInvoicePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<CrmInvoiceDO>() |
| | | .eq(CrmInvoiceDO::getCustomerId, reqVO.getCustomerId()) // å¿
é¡»ä¼ é |
| | | .eqIfPresent(CrmInvoiceDO::getNo, reqVO.getNo()) |
| | | .eqIfPresent(CrmInvoiceDO::getContractId, reqVO.getContractId()) |
| | | .orderByDesc(CrmInvoiceDO::getId)); |
| | | } |
| | | |
| | | default PageResult<CrmInvoiceDO> selectPage(CrmInvoicePageReqVO pageReqVO, Long userId) { |
| | | MPJLambdaWrapperX<CrmInvoiceDO> query = new MPJLambdaWrapperX<>(); |
| | | // æ¼æ¥æ°æ®æéçæ¥è¯¢æ¡ä»¶ |
| | | CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_INVOICE.getType(), |
| | | CrmInvoiceDO::getId, userId, pageReqVO.getSceneType()); |
| | | // æ¼æ¥èªèº«çæ¥è¯¢æ¡ä»¶ |
| | | query.selectAll(CrmInvoiceDO.class) |
| | | .eqIfPresent(CrmInvoiceDO::getNo, pageReqVO.getNo()) |
| | | .eqIfPresent(CrmInvoiceDO::getContractId, pageReqVO.getContractId()) |
| | | .eqIfPresent(CrmInvoiceDO::getAuditStatus, pageReqVO.getAuditStatus()) |
| | | .orderByDesc(CrmInvoiceDO::getId); |
| | | return selectJoinPage(pageReqVO, CrmInvoiceDO.class, query); |
| | | } |
| | | |
| | | default Long selectCountByAudit(Long userId) { |
| | | MPJLambdaWrapperX<CrmInvoiceDO> query = new MPJLambdaWrapperX<>(); |
| | | // æè´è´£ç + éå
¬æµ· |
| | | CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_INVOICE.getType(), |
| | | CrmInvoiceDO::getId, userId, CrmSceneTypeEnum.OWNER.getType()); |
| | | // æªå®¡æ ¸ |
| | | query.eq(CrmInvoiceDO::getAuditStatus, CrmAuditStatusEnum.PROCESS.getStatus()); |
| | | return selectCount(query); |
| | | } |
| | | |
| | | default List<CrmInvoiceDO> selectListByContractIdAndStatus(Long contractId, Collection<Integer> auditStatuses) { |
| | | return selectList(new LambdaQueryWrapperX<CrmInvoiceDO>() |
| | | .eq(CrmInvoiceDO::getContractId, contractId) |
| | | .in(CrmInvoiceDO::getAuditStatus, auditStatuses)); |
| | | } |
| | | |
| | | default Map<Long, BigDecimal> selectInvoicePriceMapByContractId(Collection<Long> contractIds) { |
| | | if (CollUtil.isEmpty(contractIds)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | // SQL sum æ¥è¯¢ |
| | | List<Map<String, Object>> result = selectMaps(new QueryWrapper<CrmInvoiceDO>() |
| | | .select("contract_id, SUM(price) AS total_price") |
| | | .eq("audit_status", CrmAuditStatusEnum.APPROVE.getStatus()) |
| | | .groupBy("contract_id") |
| | | .in("contract_id", contractIds)); |
| | | // è·å¾éé¢ |
| | | return convertMap(result, obj -> (Long) obj.get("contract_id"), obj -> (BigDecimal) obj.get("total_price")); |
| | | } |
| | | |
| | | default Long selectCountByContractId(Long contractId) { |
| | | return selectCount(CrmInvoiceDO::getContractId, contractId); |
| | | } |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.permission; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | default List<CrmPermissionDO> selectByBizTypeAndBizIds(Integer bizType, Collection<Long> bizIds) { |
| | | if (CollUtil.isEmpty(bizIds)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return selectList(new LambdaQueryWrapperX<CrmPermissionDO>() |
| | | .eq(CrmPermissionDO::getBizType, bizType) |
| | | .in(CrmPermissionDO::getBizId, bizIds)); |
| | |
| | | } |
| | | |
| | | default Long selectListByBiz(Collection<Integer> bizTypes, Collection<Long> bizIds, Collection<Long> userIds) { |
| | | if (CollUtil.isEmpty(bizTypes) || CollUtil.isEmpty(bizIds) || CollUtil.isEmpty(userIds)) { |
| | | return 0L; |
| | | } |
| | | return selectCount(new LambdaQueryWrapperX<CrmPermissionDO>() |
| | | .in(CrmPermissionDO::getBizType, bizTypes) |
| | | .in(CrmPermissionDO::getBizId, bizIds) |
| | |
| | | */ |
| | | public static final String SALE_QUOTATION_NO_PREFIX = "QT"; |
| | | |
| | | /** |
| | | * å¼ç¥¨ {@link cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO} |
| | | */ |
| | | public static final String INVOICE_PREFIX = "KP"; |
| | | |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | |
| | | String CRM_PRODUCT_STATUS = "crm_product_status"; // CRM 产åç¶æ |
| | | String CRM_FOLLOW_UP_TYPE = "crm_follow_up_type"; // CRM è·è¿æ¹å¼ |
| | | String CRM_RECEIVABLE_RETURN_TYPE = "crm_receivable_return_type"; // CRM 忬¾æ¹å¼ |
| | | String CRM_INVOICE_TYPE = "crm_invoice_type"; // CRM å票类å |
| | | |
| | | } |
| | |
| | | ErrorCode SALE_QUOTATION_ITEM_NOT_EXISTS = new ErrorCode(1_020_015_005, "ç©æä¸å卿æªå¯ç¨"); |
| | | ErrorCode SALE_QUOTATION_CONTRACT_EXISTS = new ErrorCode(1_020_015_006, "é宿¥ä»·å已转ååï¼è¯·å¿é夿ä½"); |
| | | |
| | | // ========== å¼ç¥¨ 1_020_016_000 ========== |
| | | ErrorCode INVOICE_NOT_EXISTS = new ErrorCode(1_020_016_000, "å¼ç¥¨ä¸åå¨"); |
| | | ErrorCode INVOICE_NO_EXISTS = new ErrorCode(1_020_016_001, "çæå¼ç¥¨åºåå·éå¤ï¼è¯·éè¯"); |
| | | ErrorCode INVOICE_UPDATE_FAIL_EDITING_PROHIBITED = new ErrorCode(1_020_016_002, "æ´æ°å¼ç¥¨å¤±è´¥ï¼åå ï¼ç¦æ¢ç¼è¾"); |
| | | ErrorCode INVOICE_DELETE_FAIL_IS_APPROVE = new ErrorCode(1_020_016_003, "å é¤å¼ç¥¨å¤±è´¥ï¼åå ï¼å¼ç¥¨å®¡æ¹å·²éè¿"); |
| | | ErrorCode INVOICE_SUBMIT_FAIL_NOT_DRAFT = new ErrorCode(1_020_016_004, "å¼ç¥¨æäº¤å®¡æ ¸å¤±è´¥ï¼åå ï¼å¼ç¥¨æ²¡å¤å¨æªæäº¤ç¶æ"); |
| | | ErrorCode INVOICE_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS = new ErrorCode(1_020_016_005, "æ´æ°å¼ç¥¨å®¡æ ¸ç¶æå¤±è´¥ï¼åå ï¼å¼ç¥¨ä¸æ¯å®¡æ ¸ä¸ç¶æ"); |
| | | ErrorCode INVOICE_CREATE_FAIL_CONTRACT_NOT_APPROVE = new ErrorCode(1_020_016_006, "å建å¼ç¥¨å¤±è´¥ï¼åå ï¼åå䏿¯å®¡æ ¸éè¿ç¶æ"); |
| | | ErrorCode INVOICE_CREATE_FAIL_PRICE_EXCEEDS_LIMIT = new ErrorCode(1_020_016_007, "å建å¼ç¥¨å¤±è´¥ï¼åå ï¼å¼ç¥¨éé¢è¶
åºååéé¢ï¼ç®åå¯å¼ç¥¨ï¼{} å
"); |
| | | ErrorCode RECEIVABLE_CREATE_FAIL_INVOICE_NOT_ENOUGH = new ErrorCode(1_020_016_008, "åå»ºåæ¬¾å¤±è´¥ï¼åå ï¼åå累计å¼ç¥¨éé¢ä¸è¶³ï¼ç®åå¯å款ï¼{} å
"); |
| | | |
| | | } |
| | |
| | | String CRM_RECEIVABLE_PLAN_DELETE_SUB_TYPE = "å é¤å款计å"; |
| | | String CRM_RECEIVABLE_PLAN_DELETE_SUCCESS = "å é¤äºååã{getContractById{#receivablePlan.contractId}}ãç第ã{{#receivablePlan.period}}ãæå款计å"; |
| | | |
| | | // ======================= CRM_INVOICE å¼ç¥¨ ======================= |
| | | |
| | | String CRM_INVOICE_TYPE = "CRM å¼ç¥¨"; |
| | | String CRM_INVOICE_CREATE_SUB_TYPE = "å建å¼ç¥¨"; |
| | | String CRM_INVOICE_CREATE_SUCCESS = "å建äºååã{getContractById{#invoice.contractId}}ãçç¼å·ä¸ºã{{#invoice.no}}ãçå¼ç¥¨"; |
| | | String CRM_INVOICE_UPDATE_SUB_TYPE = "æ´æ°å¼ç¥¨"; |
| | | String CRM_INVOICE_UPDATE_SUCCESS = "æ´æ°äºååã{getContractById{#invoice.contractId}}ãçç¼å·ä¸ºã{{#invoice.no}}ãçå¼ç¥¨: {_DIFF{#updateReqVO}}"; |
| | | String CRM_INVOICE_DELETE_SUB_TYPE = "å é¤å¼ç¥¨"; |
| | | String CRM_INVOICE_DELETE_SUCCESS = "å é¤äºååã{getContractById{#invoice.contractId}}ãçç¼å·ä¸ºã{{#invoice.no}}ãçå¼ç¥¨"; |
| | | String CRM_INVOICE_SUBMIT_SUB_TYPE = "æäº¤å¼ç¥¨å®¡æ¹"; |
| | | String CRM_INVOICE_SUBMIT_SUCCESS = "æäº¤ç¼å·ä¸ºã{{#invoiceNo}}ãçå¼ç¥¨å®¡æ¹æå"; |
| | | |
| | | } |
| | |
| | | CRM_PRODUCT(6, "产å"), |
| | | CRM_RECEIVABLE(7, "忬¾"), |
| | | CRM_RECEIVABLE_PLAN(8, "忬¾è®¡å"), |
| | | CRM_SALE_QUOTATION(9, "é宿¥ä»·") |
| | | CRM_SALE_QUOTATION(9, "é宿¥ä»·"), |
| | | CRM_INVOICE(10, "å¼ç¥¨") |
| | | ; |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(CrmBizTypeEnum::getType).toArray(Integer[]::new); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.invoice; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoicePageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoiceSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| | | |
| | | /** |
| | | * CRM å¼ç¥¨ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface CrmInvoiceService { |
| | | |
| | | /** |
| | | * å建å¼ç¥¨ |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createInvoice(@Valid CrmInvoiceSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å¼ç¥¨ |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateInvoice(@Valid CrmInvoiceSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å¼ç¥¨æµç¨å®¡æ¹ç»æ |
| | | * |
| | | * @param id å¼ç¥¨ç¼å· |
| | | * @param bpmResult BPM 审æ¹ç»æ |
| | | */ |
| | | void updateInvoiceAuditStatus(Long id, Integer bpmResult); |
| | | |
| | | /** |
| | | * å é¤å¼ç¥¨ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteInvoice(Long id); |
| | | |
| | | /** |
| | | * åèµ·å¼ç¥¨å®¡æ¹æµç¨ |
| | | * |
| | | * @param id å¼ç¥¨ç¼å· |
| | | * @param userId ç¨æ·ç¼å· |
| | | */ |
| | | void submitInvoice(Long id, Long userId); |
| | | |
| | | /** |
| | | * è·å¾å¼ç¥¨ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å¼ç¥¨ |
| | | */ |
| | | CrmInvoiceDO getInvoice(Long id); |
| | | |
| | | /** |
| | | * è·å¾å¼ç¥¨å表 |
| | | * |
| | | * @param ids ç¼å· |
| | | * @return å¼ç¥¨å表 |
| | | */ |
| | | List<CrmInvoiceDO> getInvoiceList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å¼ç¥¨ Map |
| | | * |
| | | * @param ids ç¼å· |
| | | * @return å¼ç¥¨ Map |
| | | */ |
| | | default Map<Long, CrmInvoiceDO> getInvoiceMap(Collection<Long> ids) { |
| | | return convertMap(getInvoiceList(ids), CrmInvoiceDO::getId); |
| | | } |
| | | |
| | | /** |
| | | * è·å¾å¼ç¥¨å页 |
| | | * |
| | | * æ°æ®æéï¼åºäº {@link CrmInvoiceDO} 读å |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @param userId ç¨æ·ç¼å· |
| | | * @return å¼ç¥¨å页 |
| | | */ |
| | | PageResult<CrmInvoiceDO> getInvoicePage(CrmInvoicePageReqVO pageReqVO, Long userId); |
| | | |
| | | /** |
| | | * è·å¾å¼ç¥¨å页ï¼åºäºæå®å®¢æ· |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return å¼ç¥¨å页 |
| | | */ |
| | | PageResult<CrmInvoiceDO> getInvoicePageByCustomerId(CrmInvoicePageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾å¾
å®¡æ ¸å¼ç¥¨æ°é |
| | | * |
| | | * @param userId ç¨æ·ç¼å· |
| | | * @return å¾
å®¡æ¹æ°é |
| | | */ |
| | | Long getAuditInvoiceCount(Long userId); |
| | | |
| | | /** |
| | | * æ ¹æ®ååç¼å·æ¥è¯¢å¼ç¥¨å表 |
| | | * |
| | | * @param contractId ååç¼å· |
| | | * @param auditStatuses 审æ¹ç¶æéå |
| | | * @return å¼ç¥¨å表 |
| | | */ |
| | | List<CrmInvoiceDO> getInvoiceListByContractIdAndStatus(Long contractId, Collection<Integer> auditStatuses); |
| | | |
| | | /** |
| | | * è·å¾ååå·²å¼ç¥¨éé¢ Mapï¼ä»
审æ¹éè¿ï¼ |
| | | * |
| | | * @param contractIds ååç¼å· |
| | | * @return å¼ç¥¨éé¢ Map |
| | | */ |
| | | Map<Long, BigDecimal> getInvoicePriceMapByContractId(Collection<Long> contractIds); |
| | | |
| | | /** |
| | | * æ ¹æ®ååç¼å·æ¥è¯¢å¼ç¥¨æ°é |
| | | * |
| | | * @param contractId ååç¼å· |
| | | * @return å¼ç¥¨æ°é |
| | | */ |
| | | Long getInvoiceCountByContractId(Long contractId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.invoice; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoicePageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoiceSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.invoice.CrmInvoiceMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.redis.no.CrmNoRedisDAO; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| | | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| | | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import com.mzt.logapi.context.LogRecordContext; |
| | | import com.mzt.logapi.service.impl.DiffParseFunction; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; |
| | | import static cn.iocoder.yudao.module.crm.util.CrmAuditStatusUtils.convertBpmResultToAuditStatus; |
| | | |
| | | /** |
| | | * CRM å¼ç¥¨ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class CrmInvoiceServiceImpl implements CrmInvoiceService { |
| | | |
| | | /** |
| | | * BPM å¼ç¥¨å®¡æ¹æµç¨æ è¯ |
| | | */ |
| | | public static final String BPM_PROCESS_DEFINITION_KEY = "crm-invoice-audit"; |
| | | |
| | | /** |
| | | * å票éä»¶çä¸å¡è®°å½ç±»åï¼å¯¹åº {@link cn.iocoder.yudao.module.system.enums.storage.StorageRecordTypeEnum#CRM_INVOICE} |
| | | */ |
| | | private static final String INVOICE_RECORD_TYPE = "crm_invoice"; |
| | | |
| | | @Resource |
| | | private CrmInvoiceMapper invoiceMapper; |
| | | |
| | | @Resource |
| | | private CrmNoRedisDAO noRedisDAO; |
| | | |
| | | @Resource |
| | | private CrmContractService contractService; |
| | | @Resource |
| | | private CrmPermissionService permissionService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private BpmProcessInstanceApi bpmProcessInstanceApi; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_INVOICE_TYPE, subType = CRM_INVOICE_CREATE_SUB_TYPE, bizNo = "{{#invoice.id}}", |
| | | success = CRM_INVOICE_CREATE_SUCCESS) |
| | | public Long createInvoice(CrmInvoiceSaveReqVO createReqVO) { |
| | | // 1.1 æ ¡éªå¯å¼ç¥¨éé¢è¶
è¿ä¸é |
| | | validateInvoicePriceExceedsLimit(createReqVO); |
| | | // 1.2 æ ¡éªå
³èæ°æ®åå¨ |
| | | validateRelationDataExists(createReqVO); |
| | | // 1.3 çæå¼ç¥¨ç¼å· |
| | | String no = noRedisDAO.generate(CrmNoRedisDAO.INVOICE_PREFIX); |
| | | if (invoiceMapper.selectByNo(no) != null) { |
| | | throw exception(INVOICE_NO_EXISTS); |
| | | } |
| | | |
| | | // 2.1 æå
¥å¼ç¥¨ |
| | | CrmInvoiceDO invoice = BeanUtils.toBean(createReqVO, CrmInvoiceDO.class) |
| | | .setNo(no).setAuditStatus(CrmAuditStatusEnum.DRAFT.getStatus()); |
| | | invoiceMapper.insert(invoice); |
| | | |
| | | // 2.2 ç»å®å票éä»¶ |
| | | if (CollUtil.isNotEmpty(createReqVO.getBlobIds())) { |
| | | storageAttachmentApi.bindAttachments("file", INVOICE_RECORD_TYPE, invoice.getId(), createReqVO.getBlobIds()); |
| | | } |
| | | |
| | | // 3. åå»ºæ°æ®æé |
| | | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_INVOICE.getType()) |
| | | .setBizId(invoice.getId()).setUserId(createReqVO.getOwnerUserId()) |
| | | .setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置å½åæä½ç人为è´è´£äºº |
| | | |
| | | // 4. è®°å½æä½æ¥å¿ä¸ä¸æ |
| | | LogRecordContext.putVariable("invoice", invoice); |
| | | return invoice.getId(); |
| | | } |
| | | |
| | | private void validateInvoicePriceExceedsLimit(CrmInvoiceSaveReqVO reqVO) { |
| | | // 1. 计ç®å©ä½å¯å¼ç¥¨éé¢ï¼ä¸å
æ¬ reqVO èªèº« |
| | | CrmContractDO contract = contractService.validateContract(reqVO.getContractId()); |
| | | List<CrmInvoiceDO> invoices = invoiceMapper.selectListByContractIdAndStatus(reqVO.getContractId(), |
| | | List.of(CrmAuditStatusEnum.APPROVE.getStatus())); |
| | | if (reqVO.getId() != null) { |
| | | invoices.removeIf(invoice -> ObjectUtil.equal(invoice.getId(), reqVO.getId())); |
| | | } |
| | | BigDecimal notInvoicePrice = contract.getTotalPrice().subtract( |
| | | CollectionUtils.getSumValue(invoices, CrmInvoiceDO::getPrice, BigDecimal::add, BigDecimal.ZERO)); |
| | | // 2. æ ¡éªé颿¯å¦è¶
è¿ |
| | | if (reqVO.getPrice().compareTo(notInvoicePrice) > 0) { |
| | | throw exception(INVOICE_CREATE_FAIL_PRICE_EXCEEDS_LIMIT, notInvoicePrice); |
| | | } |
| | | } |
| | | |
| | | private void validateRelationDataExists(CrmInvoiceSaveReqVO reqVO) { |
| | | if (reqVO.getOwnerUserId() != null) { |
| | | adminUserApi.validateUser(reqVO.getOwnerUserId()); // æ ¡éªè´è´£äººåå¨ |
| | | } |
| | | if (reqVO.getContractId() != null) { |
| | | CrmContractDO contract = contractService.validateContract(reqVO.getContractId()); |
| | | if (ObjectUtil.notEqual(contract.getAuditStatus(), CrmAuditStatusEnum.APPROVE.getStatus())) { |
| | | throw exception(INVOICE_CREATE_FAIL_CONTRACT_NOT_APPROVE); |
| | | } |
| | | reqVO.setCustomerId(contract.getCustomerId()); // 设置客æ·ç¼å· |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_INVOICE_TYPE, subType = CRM_INVOICE_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", |
| | | success = CRM_INVOICE_UPDATE_SUCCESS) |
| | | @CrmPermission(bizType = CrmBizTypeEnum.CRM_INVOICE, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| | | public void updateInvoice(CrmInvoiceSaveReqVO updateReqVO) { |
| | | Assert.notNull(updateReqVO.getId(), "å¼ç¥¨ç¼å·ä¸è½ä¸ºç©º"); |
| | | updateReqVO.setOwnerUserId(null).setCustomerId(null).setContractId(null); // ä¸å
许修æ¹çåæ®µ |
| | | // 1.1 æ ¡éªåå¨ |
| | | CrmInvoiceDO oldInvoice = validateInvoiceExists(updateReqVO.getId()); |
| | | updateReqVO.setOwnerUserId(oldInvoice.getOwnerUserId()).setCustomerId(oldInvoice.getCustomerId()) |
| | | .setContractId(oldInvoice.getContractId()); // 设置已åå¨çå¼ |
| | | // 1.2 æ ¡éªå¯å¼ç¥¨éé¢è¶
è¿ä¸é |
| | | validateInvoicePriceExceedsLimit(updateReqVO); |
| | | |
| | | // 1.3 åªæè稿ã审æ¹ä¸ï¼å¯ä»¥ç¼è¾ï¼ |
| | | if (!ObjectUtils.equalsAny(oldInvoice.getAuditStatus(), CrmAuditStatusEnum.DRAFT.getStatus(), |
| | | CrmAuditStatusEnum.PROCESS.getStatus())) { |
| | | throw exception(INVOICE_UPDATE_FAIL_EDITING_PROHIBITED); |
| | | } |
| | | |
| | | // 2. æ´æ°å¼ç¥¨ |
| | | CrmInvoiceDO updateObj = BeanUtils.toBean(updateReqVO, CrmInvoiceDO.class); |
| | | invoiceMapper.updateById(updateObj); |
| | | |
| | | // 3. å¢éæ´æ°å票éä»¶ |
| | | storageAttachmentApi.updateAttachments("file", INVOICE_RECORD_TYPE, updateReqVO.getId(), updateReqVO.getBlobIds()); |
| | | |
| | | // 4. è®°å½æä½æ¥å¿ä¸ä¸æ |
| | | updateReqVO.setOwnerUserId(oldInvoice.getOwnerUserId()); // é¿å
æä½æ¥å¿åºç°âå é¤è´è´£äººâçæ
åµ |
| | | LogRecordContext.putVariable("invoice", oldInvoice); |
| | | LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldInvoice, CrmInvoiceSaveReqVO.class)); |
| | | } |
| | | |
| | | @Override |
| | | public void updateInvoiceAuditStatus(Long id, Integer bpmResult) { |
| | | // 1.1 æ ¡éªåå¨ |
| | | CrmInvoiceDO invoice = validateInvoiceExists(id); |
| | | // 1.2 åªæå®¡æ¹ä¸ï¼å¯ä»¥æ´æ°å®¡æ¹ç»æ |
| | | if (ObjUtil.notEqual(invoice.getAuditStatus(), CrmAuditStatusEnum.PROCESS.getStatus())) { |
| | | log.error("[updateInvoiceAuditStatus][invoice({}) ä¸å¤äºå®¡æ¹ä¸ï¼æ æ³æ´æ°å®¡æ¹ç»æ({})]", |
| | | invoice.getId(), bpmResult); |
| | | throw exception(INVOICE_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS); |
| | | } |
| | | |
| | | // 2. æ´æ°å¼ç¥¨å®¡æ¹ç¶æ |
| | | Integer auditStatus = convertBpmResultToAuditStatus(bpmResult); |
| | | invoiceMapper.updateById(new CrmInvoiceDO().setId(id).setAuditStatus(auditStatus)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_INVOICE_TYPE, subType = CRM_INVOICE_DELETE_SUB_TYPE, bizNo = "{{#id}}", |
| | | success = CRM_INVOICE_DELETE_SUCCESS) |
| | | @CrmPermission(bizType = CrmBizTypeEnum.CRM_INVOICE, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) |
| | | public void deleteInvoice(Long id) { |
| | | // 1.1 æ ¡éªåå¨ |
| | | CrmInvoiceDO invoice = validateInvoiceExists(id); |
| | | // 1.2 审æ¹éè¿æ¶ï¼ä¸å
许å é¤ |
| | | if (ObjUtil.equal(invoice.getAuditStatus(), CrmAuditStatusEnum.APPROVE.getStatus())) { |
| | | throw exception(INVOICE_DELETE_FAIL_IS_APPROVE); |
| | | } |
| | | |
| | | // 2.1 å é¤å票éä»¶ |
| | | storageAttachmentApi.deleteAttachmentsByRecord(INVOICE_RECORD_TYPE, id); |
| | | // 2.2 å é¤å¼ç¥¨ |
| | | invoiceMapper.deleteById(id); |
| | | // 2.3 å 餿°æ®æé |
| | | permissionService.deletePermission(CrmBizTypeEnum.CRM_INVOICE.getType(), id); |
| | | |
| | | // 3. è®°å½æä½æ¥å¿ä¸ä¸æ |
| | | LogRecordContext.putVariable("invoice", invoice); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_INVOICE_TYPE, subType = CRM_INVOICE_SUBMIT_SUB_TYPE, bizNo = "{{#id}}", |
| | | success = CRM_INVOICE_SUBMIT_SUCCESS) |
| | | public void submitInvoice(Long id, Long userId) { |
| | | // 1. æ ¡éªå¼ç¥¨æ¯å¦å¨å®¡æ¹ |
| | | CrmInvoiceDO invoice = validateInvoiceExists(id); |
| | | if (ObjUtil.notEqual(invoice.getAuditStatus(), CrmAuditStatusEnum.DRAFT.getStatus())) { |
| | | throw exception(INVOICE_SUBMIT_FAIL_NOT_DRAFT); |
| | | } |
| | | |
| | | // 2. å建å¼ç¥¨å®¡æ¹æµç¨å®ä¾ |
| | | String processInstanceId = bpmProcessInstanceApi.createProcessInstance(userId, new BpmProcessInstanceCreateReqDTO() |
| | | .setProcessDefinitionKey(BPM_PROCESS_DEFINITION_KEY).setBusinessKey(String.valueOf(id))); |
| | | |
| | | // 3. æ´æ°å¼ç¥¨å·¥ä½æµç¼å· |
| | | invoiceMapper.updateById(new CrmInvoiceDO().setId(id).setProcessInstanceId(processInstanceId) |
| | | .setAuditStatus(CrmAuditStatusEnum.PROCESS.getStatus())); |
| | | |
| | | // 4. è®°å½æ¥å¿ |
| | | LogRecordContext.putVariable("invoiceNo", invoice.getNo()); |
| | | } |
| | | |
| | | private CrmInvoiceDO validateInvoiceExists(Long id) { |
| | | CrmInvoiceDO invoice = invoiceMapper.selectById(id); |
| | | if (invoice == null) { |
| | | throw exception(INVOICE_NOT_EXISTS); |
| | | } |
| | | return invoice; |
| | | } |
| | | |
| | | @Override |
| | | @CrmPermission(bizType = CrmBizTypeEnum.CRM_INVOICE, bizId = "#id", level = CrmPermissionLevelEnum.READ) |
| | | public CrmInvoiceDO getInvoice(Long id) { |
| | | return invoiceMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmInvoiceDO> getInvoiceList(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return ListUtil.empty(); |
| | | } |
| | | return invoiceMapper.selectByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmInvoiceDO> getInvoicePage(CrmInvoicePageReqVO pageReqVO, Long userId) { |
| | | return invoiceMapper.selectPage(pageReqVO, userId); |
| | | } |
| | | |
| | | @Override |
| | | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ) |
| | | public PageResult<CrmInvoiceDO> getInvoicePageByCustomerId(CrmInvoicePageReqVO pageReqVO) { |
| | | return invoiceMapper.selectPageByCustomerId(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public Long getAuditInvoiceCount(Long userId) { |
| | | return invoiceMapper.selectCountByAudit(userId); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmInvoiceDO> getInvoiceListByContractIdAndStatus(Long contractId, Collection<Integer> auditStatuses) { |
| | | return invoiceMapper.selectListByContractIdAndStatus(contractId, auditStatuses); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, BigDecimal> getInvoicePriceMapByContractId(Collection<Long> contractIds) { |
| | | return invoiceMapper.selectInvoicePriceMapByContractId(contractIds); |
| | | } |
| | | |
| | | @Override |
| | | public Long getInvoiceCountByContractId(Long contractId) { |
| | | return invoiceMapper.selectCountByContractId(contractId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.invoice.listener; |
| | | |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; |
| | | import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceService; |
| | | import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceServiceImpl; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * å¼ç¥¨å®¡æ¹çç»æççå¬å¨å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Component |
| | | public class CrmInvoiceStatusListener extends BpmProcessInstanceStatusEventListener { |
| | | |
| | | @Resource |
| | | private CrmInvoiceService invoiceService; |
| | | |
| | | @Override |
| | | public String getProcessDefinitionKey() { |
| | | return CrmInvoiceServiceImpl.BPM_PROCESS_DEFINITION_KEY; |
| | | } |
| | | |
| | | @Override |
| | | public void onEvent(BpmProcessInstanceStatusEvent event) { |
| | | invoiceService.updateInvoiceAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.invoice.CrmInvoiceDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper; |
| | |
| | | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| | | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.enums.storage.StorageRecordTypeEnum; |
| | | import com.mzt.logapi.context.LogRecordContext; |
| | | import com.mzt.logapi.service.impl.DiffParseFunction; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | |
| | | private CrmReceivablePlanService receivablePlanService; |
| | | @Resource |
| | | private CrmPermissionService permissionService; |
| | | @Resource |
| | | private CrmInvoiceService invoiceService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private BpmProcessInstanceApi bpmProcessInstanceApi; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | public Long createReceivable(CrmReceivableSaveReqVO createReqVO) { |
| | | // 1.1 æ ¡éªå¯å款éé¢è¶
è¿ä¸é |
| | | validateReceivablePriceExceedsLimit(createReqVO); |
| | | // 1.2 æ ¡éªå
³èæ°æ®åå¨ |
| | | // 1.2 æ ¡éªå¯å款éé¢ä¸è¶
è¿ç´¯è®¡å·²å¼ç¥¨éé¢ï¼å
å¼ç¥¨å忬¾ï¼ |
| | | validateReceivablePriceExceedsInvoiceLimit(createReqVO); |
| | | // 1.3 æ ¡éªå
³èæ°æ®åå¨ |
| | | validateRelationDataExists(createReqVO); |
| | | // 1.3 çæå款ç¼å· |
| | | // 1.4 çæå款ç¼å· |
| | | String no = noRedisDAO.generate(CrmNoRedisDAO.RECEIVABLE_PREFIX); |
| | | if (receivableMapper.selectByNo(no) != null) { |
| | | throw exception(RECEIVABLE_NO_EXISTS); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªç´¯è®¡å款éé¢ä¸è¶
è¿ç´¯è®¡å·²å¼ç¥¨ä¸å·²ä¸ä¼ å票éä»¶çéé¢ï¼å
å¼ç¥¨å忬¾ï¼ |
| | | */ |
| | | private void validateReceivablePriceExceedsInvoiceLimit(CrmReceivableSaveReqVO reqVO) { |
| | | // 1. 计ç®ååç´¯è®¡åæ¬¾éé¢ï¼ä¸å«æ¬æ¬¡ï¼ç»è®¡å£å¾åååé颿 ¡éªï¼å®¡æ¹éè¿ + 审æ¹ä¸ï¼ |
| | | List<CrmReceivableDO> receivables = receivableMapper.selectListByContractIdAndStatus(reqVO.getContractId(), |
| | | Arrays.asList(CrmAuditStatusEnum.APPROVE.getStatus(), CrmAuditStatusEnum.PROCESS.getStatus())); |
| | | if (reqVO.getId() != null) { |
| | | receivables.removeIf(receivable -> ObjectUtil.equal(receivable.getId(), reqVO.getId())); |
| | | } |
| | | BigDecimal receivablePriceSum = CollectionUtils.getSumValue(receivables, CrmReceivableDO::getPrice, |
| | | BigDecimal::add, BigDecimal.ZERO); |
| | | |
| | | // 2. 计ç®ååä¸ã审æ¹éè¿ä¸å·²ä¸ä¼ å票éä»¶ãç累计å¼ç¥¨éé¢ |
| | | List<CrmInvoiceDO> invoices = invoiceService.getInvoiceListByContractIdAndStatus(reqVO.getContractId(), |
| | | List.of(CrmAuditStatusEnum.APPROVE.getStatus())); |
| | | BigDecimal invoicePriceSum = BigDecimal.ZERO; |
| | | for (CrmInvoiceDO invoice : invoices) { |
| | | if (CollUtil.isNotEmpty(storageAttachmentApi.listAttachments( |
| | | StorageRecordTypeEnum.CRM_INVOICE.getType(), invoice.getId()))) { |
| | | invoicePriceSum = invoicePriceSum.add(invoice.getPrice()); |
| | | } |
| | | } |
| | | |
| | | // 3. æ ¡éªæ¬æ¬¡å款éé¢ä¸è¶
è¿å©ä½å¯å款éé¢ï¼å·²å¼ç¥¨éé¢ - 已忬¾éé¢ï¼ |
| | | BigDecimal availablePrice = invoicePriceSum.subtract(receivablePriceSum); |
| | | if (reqVO.getPrice().compareTo(availablePrice) > 0) { |
| | | throw exception(RECEIVABLE_CREATE_FAIL_INVOICE_NOT_ENOUGH, availablePrice); |
| | | } |
| | | } |
| | | |
| | | private void validateRelationDataExists(CrmReceivableSaveReqVO reqVO) { |
| | | if (reqVO.getOwnerUserId() != null) { |
| | | adminUserApi.validateUser(reqVO.getOwnerUserId()); // æ ¡éªè´è´£äººåå¨ |
| | |
| | | .setContractId(oldReceivable.getContractId()).setPlanId(oldReceivable.getPlanId()); // 设置已åå¨çå¼ |
| | | // 1.2 æ ¡éªå¯å款éé¢è¶
è¿ä¸é |
| | | validateReceivablePriceExceedsLimit(updateReqVO); |
| | | // 1.3 æ ¡éªå¯å款éé¢ä¸è¶
è¿ç´¯è®¡å·²å¼ç¥¨éé¢ï¼å
å¼ç¥¨å忬¾ï¼ |
| | | validateReceivablePriceExceedsInvoiceLimit(updateReqVO); |
| | | |
| | | // 1.3 åªæè稿ã审æ¹ä¸ï¼å¯ä»¥ç¼è¾ï¼ |
| | | // 1.4 åªæè稿ã审æ¹ä¸ï¼å¯ä»¥ç¼è¾ï¼ |
| | | if (!ObjectUtils.equalsAny(oldReceivable.getAuditStatus(), CrmAuditStatusEnum.DRAFT.getStatus(), |
| | | CrmAuditStatusEnum.PROCESS.getStatus())) { |
| | | throw exception(RECEIVABLE_UPDATE_FAIL_EDITING_PROHIBITED); |
| | |
| | | ErrorCode EMPLOYEE_EDUCATION_NOT_EXISTS = new ErrorCode(1_030_000_003, "æè²ç»åä¸åå¨"); |
| | | ErrorCode EMPLOYEE_WORK_HISTORY_NOT_EXISTS = new ErrorCode(1_030_000_004, "å·¥ä½ç»åä¸åå¨"); |
| | | ErrorCode EMPLOYEE_EMERGENCY_CONTACT_NOT_EXISTS = new ErrorCode(1_030_000_005, "ç´§æ¥è系人ä¸åå¨"); |
| | | ErrorCode EMPLOYEE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_030_000_006, "导å
¥åå·¥æ°æ®ä¸è½ä¸ºç©º"); |
| | | ErrorCode EMPLOYEE_DEPT_NAME_NOT_EXISTS = new ErrorCode(1_030_000_007, "é¨é¨ã{}ãä¸åå¨"); |
| | | ErrorCode EMPLOYEE_POST_NAME_NOT_EXISTS = new ErrorCode(1_030_000_008, "å²ä½ã{}ãä¸åå¨"); |
| | | ErrorCode EMPLOYEE_ROLE_NAME_NOT_EXISTS = new ErrorCode(1_030_000_009, "è§è²ã{}ãä¸åå¨"); |
| | | ErrorCode EMPLOYEE_IMPORT_FIELD_REQUIRED = new ErrorCode(1_030_000_010, "导å
¥å段ã{}ãä¸è½ä¸ºç©º"); |
| | | |
| | | // ========== 请åç³è¯· 1-030-001-000 ========== |
| | | ErrorCode LEAVE_APPLICATION_NOT_EXISTS = new ErrorCode(1_030_001_000, "请åç³è¯·ä¸åå¨"); |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportExcelVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeSaveReqVO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | ExcelUtils.write(response, "å工信æ¯.xls", "æ°æ®", HrmEmployeeRespVO.class, list); |
| | | } |
| | | |
| | | @GetMapping("/import-template") |
| | | @Operation(summary = "ä¸è½½å工导å
¥æ¨¡æ¿") |
| | | @PreAuthorize("@ss.hasPermission('hrm:employee:import')") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // è¾åºç¤ºä¾æ°æ®ï¼æ¹ä¾¿ä½¿ç¨è
åè |
| | | List<HrmEmployeeImportExcelVO> list = Arrays.asList( |
| | | HrmEmployeeImportExcelVO.builder().name("å¼ ä¸").gender(1).phone("13800138000") |
| | | .deptName("ç åé¨").postName("é¨é¨ç»ç").roleNames("æ®é管çå") |
| | | .hireDate(LocalDate.of(2020, 3, 1)).employeeStatus(1) |
| | | .idCard("320102199001150011").birthday(LocalDate.of(1990, 1, 15)) |
| | | .nation("æ±æ").marriageStatus("å·²å©").age(36).education("æ¬ç§").politicalStatus("ä¸å
±å
å") |
| | | .email("zhangsan@example.com").build() |
| | | ); |
| | | ExcelUtils.write(response, "å工导å
¥æ¨¡æ¿.xls", "åå·¥å表", HrmEmployeeImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥åå·¥") |
| | | @PreAuthorize("@ss.hasPermission('hrm:employee:import')") |
| | | public CommonResult<HrmEmployeeImportRespVO> importExcel(@Valid HrmEmployeeImportReqVO importReqVO) |
| | | throws Exception { |
| | | List<HrmEmployeeImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), HrmEmployeeImportExcelVO.class); |
| | | return success(employeeService.importEmployeeList(list, importReqVO)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.employee.vo; |
| | | |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * åå·¥ Excel 导å
¥ VO |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class HrmEmployeeImportExcelVO { |
| | | |
| | | @ExcelProperty("åå·¥å§å") |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "æ§å«", converter = DictConvert.class) |
| | | @DictFormat("hrm_gender") |
| | | private Integer gender; |
| | | |
| | | @ExcelProperty("ææºå·") |
| | | private String phone; |
| | | |
| | | @ExcelProperty("é¨é¨åç§°") |
| | | private String deptName; |
| | | |
| | | @ExcelProperty("å²ä½åç§°") |
| | | private String postName; |
| | | |
| | | @ExcelProperty("ç¨æ·è§è²") |
| | | private String roleNames; |
| | | |
| | | @ExcelProperty("å
¥èæ¥æ") |
| | | private LocalDate hireDate; |
| | | |
| | | @ExcelProperty(value = "åå·¥ç¶æ", converter = DictConvert.class) |
| | | @DictFormat("hrm_employee_status") |
| | | private Integer employeeStatus; |
| | | |
| | | @ExcelProperty("身份è¯å·") |
| | | private String idCard; |
| | | |
| | | @ExcelProperty("åºçæ¥æ") |
| | | private LocalDate birthday; |
| | | |
| | | @ExcelProperty("æ°æ") |
| | | private String nation; |
| | | |
| | | @ExcelProperty("å©å§»ç¶æ") |
| | | private String marriageStatus; |
| | | |
| | | @ExcelProperty("å¹´é¾") |
| | | private Integer age; |
| | | |
| | | @ExcelProperty("å¦å") |
| | | private String education; |
| | | |
| | | @ExcelProperty("æ¿æ²»é¢è²") |
| | | private String politicalStatus; |
| | | |
| | | @ExcelProperty("é®ç®±") |
| | | private String email; |
| | | |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.employee.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Schema(description = "管çåå° - å工导å
¥ Request VO") |
| | | @Data |
| | | public class HrmEmployeeImportReqVO { |
| | | |
| | | @Schema(description = "Excel æä»¶", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "Excel æä»¶ä¸è½ä¸ºç©º") |
| | | private MultipartFile file; |
| | | |
| | | @Schema(description = "æ¯å¦æ¯ææ´æ°ï¼é»è®¤ false", example = "true") |
| | | private Boolean updateSupport = false; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.employee.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Schema(description = "管çåå° - å工导å
¥ Response VO") |
| | | @Data |
| | | @Builder |
| | | public class HrmEmployeeImportRespVO { |
| | | |
| | | @Schema(description = "å建æåçå工忰ç»", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private List<String> createNames; |
| | | |
| | | @Schema(description = "æ´æ°æåçå工忰ç»", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private List<String> updateNames; |
| | | |
| | | @Schema(description = "导å
¥å¤±è´¥çåå·¥éåï¼key 为åå·¥åï¼value 为失败åå ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Map<String, String> failureNames; |
| | | |
| | | } |
| | |
| | | @ExcelProperty("身份è¯å·") |
| | | private String idCard; |
| | | |
| | | @Schema(description = "æ°æ") |
| | | @ExcelProperty("æ°æ") |
| | | private String nation; |
| | | |
| | | @Schema(description = "å©å§»ç¶æ") |
| | | @ExcelProperty("å©å§»ç¶æ") |
| | | private String marriageStatus; |
| | | |
| | | @Schema(description = "å¹´é¾") |
| | | @ExcelProperty("å¹´é¾") |
| | | private Integer age; |
| | | |
| | | @Schema(description = "å¦å") |
| | | @ExcelProperty("å¦å") |
| | | private String education; |
| | | |
| | | @Schema(description = "æ¿æ²»é¢è²") |
| | | @ExcelProperty("æ¿æ²»é¢è²") |
| | | private String politicalStatus; |
| | | |
| | | @Schema(description = "å
¥èæ¥æ") |
| | | @ExcelProperty("å
¥èæ¥æ") |
| | | private LocalDate hireDate; |
| | |
| | | message = "身份è¯å·æ ¼å¼ä¸æ£ç¡®") |
| | | private String idCard; |
| | | |
| | | @Schema(description = "æ°æ", example = "æ±æ") |
| | | private String nation; |
| | | |
| | | @Schema(description = "å©å§»ç¶æ", example = "å·²å©") |
| | | private String marriageStatus; |
| | | |
| | | @Schema(description = "å¹´é¾", example = "30") |
| | | private Integer age; |
| | | |
| | | @Schema(description = "å¦å", example = "æ¬ç§") |
| | | private String education; |
| | | |
| | | @Schema(description = "æ¿æ²»é¢è²", example = "ä¸å
±å
å") |
| | | private String politicalStatus; |
| | | |
| | | @Schema(description = "å
¥èæ¥æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "2020-03-01") |
| | | @NotNull(message = "å
¥èæ¥æä¸è½ä¸ºç©º") |
| | | private LocalDate hireDate; |
| | |
| | | private String idCard; |
| | | |
| | | /** |
| | | * æ°æ |
| | | */ |
| | | private String nation; |
| | | |
| | | /** |
| | | * å©å§»ç¶æ |
| | | */ |
| | | private String marriageStatus; |
| | | |
| | | /** |
| | | * å¹´é¾ |
| | | */ |
| | | private Integer age; |
| | | |
| | | /** |
| | | * å¦å |
| | | */ |
| | | private String education; |
| | | |
| | | /** |
| | | * æ¿æ²»é¢è² |
| | | */ |
| | | private String politicalStatus; |
| | | |
| | | /** |
| | | * å
¥èæ¥æ |
| | | */ |
| | | private LocalDate hireDate; |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.employee; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportExcelVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeSaveReqVO; |
| | |
| | | */ |
| | | HrmEmployeeDO getEmployeeByUserId(Long userId); |
| | | |
| | | /** |
| | | * 导å
¥åå·¥å表 |
| | | * |
| | | * @param importEmployees å工导å
¥å表 |
| | | * @param importReqVO 导å
¥è¯·æ± |
| | | * @return 导å
¥ç»æ |
| | | */ |
| | | HrmEmployeeImportRespVO importEmployeeList(List<HrmEmployeeImportExcelVO> importEmployees, |
| | | HrmEmployeeImportReqVO importReqVO); |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeEducationSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeEmergencyContactSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportExcelVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserCreateReqDTO; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private RoleApi roleApi; |
| | | @Resource |
| | | @Lazy // èªæ³¨å
¥éå»¶è¿å è½½ï¼å¦å bean 被代çå
è£
åæ³¨å
¥åå§çæ¬å¯¼è´å¯å¨å¤±è´¥ |
| | | private HrmEmployeeService self; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return employeeMapper.selectByUserId(userId); |
| | | } |
| | | |
| | | @Override |
| | | public HrmEmployeeImportRespVO importEmployeeList(List<HrmEmployeeImportExcelVO> importEmployees, |
| | | HrmEmployeeImportReqVO importReqVO) { |
| | | // 1. æ ¡éªé空 |
| | | importEmployees = filterList(importEmployees, item -> Objects.nonNull(item.getName())); |
| | | if (CollUtil.isEmpty(importEmployees)) { |
| | | throw exception(EMPLOYEE_IMPORT_LIST_IS_EMPTY); |
| | | } |
| | | // 2. é¢å è½½é¨é¨/å²ä½/è§è² åç§° -> å®ä½ æ å° |
| | | Map<String, DeptRespDTO> deptMap = deptApi.getDeptList().stream() |
| | | .collect(Collectors.toMap(DeptRespDTO::getName, dept -> dept, (v1, v2) -> v1)); |
| | | Map<String, PostRespDTO> postMap = postApi.getPostList().stream() |
| | | .collect(Collectors.toMap(PostRespDTO::getName, post -> post, (v1, v2) -> v1)); |
| | | Map<String, RoleRespDTO> roleMap = roleApi.getRoleList().stream() |
| | | .collect(Collectors.toMap(RoleRespDTO::getName, role -> role, (v1, v2) -> v1)); |
| | | // 3. éæ¡å¤ç |
| | | HrmEmployeeImportRespVO respVO = HrmEmployeeImportRespVO.builder() |
| | | .createNames(new ArrayList<>()) |
| | | .updateNames(new ArrayList<>()) |
| | | .failureNames(new LinkedHashMap<>()) |
| | | .build(); |
| | | for (HrmEmployeeImportExcelVO importEmployee : importEmployees) { |
| | | String name = importEmployee.getName(); |
| | | try { |
| | | // 3.1 å称转 ID |
| | | Long deptId = parseDeptId(importEmployee.getDeptName(), deptMap); |
| | | Long postId = parsePostId(importEmployee.getPostName(), postMap); |
| | | Set<Long> roleIds = parseRoleIds(importEmployee.getRoleNames(), roleMap); |
| | | // 3.2 æå»ºä¿åè¯·æ± |
| | | HrmEmployeeSaveReqVO saveReqVO = buildImportSaveReqVO(importEmployee, deptId, postId, roleIds); |
| | | // 3.3 夿å卿§ï¼æææºå· |
| | | HrmEmployeeDO existEmployee = employeeMapper.selectByPhone(importEmployee.getPhone()); |
| | | if (existEmployee == null) { |
| | | self.createEmployee(saveReqVO); |
| | | respVO.getCreateNames().add(name); |
| | | } else { |
| | | if (!Boolean.TRUE.equals(importReqVO.getUpdateSupport())) { |
| | | respVO.getFailureNames().put(name, EMPLOYEE_PHONE_EXISTS.getMsg()); |
| | | continue; |
| | | } |
| | | saveReqVO.setId(existEmployee.getId()); |
| | | self.updateEmployee(saveReqVO); |
| | | respVO.getUpdateNames().add(name); |
| | | } |
| | | } catch (ServiceException ex) { |
| | | respVO.getFailureNames().put(name, ex.getMessage()); |
| | | } catch (Exception ex) { |
| | | respVO.getFailureNames().put(name, ex.getMessage()); |
| | | } |
| | | } |
| | | return respVO; |
| | | } |
| | | |
| | | private HrmEmployeeSaveReqVO buildImportSaveReqVO(HrmEmployeeImportExcelVO importEmployee, |
| | | Long deptId, Long postId, Set<Long> roleIds) { |
| | | if (StrUtil.isBlank(importEmployee.getName())) { |
| | | throw exception(EMPLOYEE_IMPORT_FIELD_REQUIRED, "åå·¥å§å"); |
| | | } |
| | | if (StrUtil.isBlank(importEmployee.getPhone())) { |
| | | throw exception(EMPLOYEE_IMPORT_FIELD_REQUIRED, "ææºå·"); |
| | | } |
| | | if (importEmployee.getHireDate() == null) { |
| | | throw exception(EMPLOYEE_IMPORT_FIELD_REQUIRED, "å
¥èæ¥æ"); |
| | | } |
| | | HrmEmployeeSaveReqVO reqVO = new HrmEmployeeSaveReqVO(); |
| | | reqVO.setName(importEmployee.getName()); |
| | | reqVO.setGender(importEmployee.getGender() != null ? importEmployee.getGender() : 1); // é»è®¤ç· |
| | | reqVO.setPhone(importEmployee.getPhone()); |
| | | reqVO.setDeptId(deptId); |
| | | reqVO.setPostId(postId); |
| | | reqVO.setRoleIds(CollUtil.isEmpty(roleIds) ? null : new ArrayList<>(roleIds)); |
| | | reqVO.setHireDate(importEmployee.getHireDate()); |
| | | reqVO.setEmployeeStatus(importEmployee.getEmployeeStatus() != null |
| | | ? importEmployee.getEmployeeStatus() : 1); // é»è®¤å¨è |
| | | reqVO.setEmail(importEmployee.getEmail()); |
| | | reqVO.setBirthday(importEmployee.getBirthday()); |
| | | reqVO.setIdCard(importEmployee.getIdCard()); |
| | | reqVO.setNation(importEmployee.getNation()); |
| | | reqVO.setMarriageStatus(importEmployee.getMarriageStatus()); |
| | | reqVO.setAge(importEmployee.getAge()); |
| | | reqVO.setEducation(importEmployee.getEducation()); |
| | | reqVO.setPoliticalStatus(importEmployee.getPoliticalStatus()); |
| | | reqVO.setRemark(importEmployee.getRemark()); |
| | | return reqVO; |
| | | } |
| | | |
| | | private Long parseDeptId(String deptName, Map<String, DeptRespDTO> deptMap) { |
| | | if (StrUtil.isBlank(deptName)) { |
| | | throw exception(EMPLOYEE_IMPORT_FIELD_REQUIRED, "é¨é¨åç§°"); |
| | | } |
| | | DeptRespDTO dept = deptMap.get(deptName.trim()); |
| | | if (dept == null) { |
| | | throw exception(EMPLOYEE_DEPT_NAME_NOT_EXISTS, deptName.trim()); |
| | | } |
| | | return dept.getId(); |
| | | } |
| | | |
| | | private Long parsePostId(String postName, Map<String, PostRespDTO> postMap) { |
| | | if (StrUtil.isBlank(postName)) { |
| | | throw exception(EMPLOYEE_IMPORT_FIELD_REQUIRED, "å²ä½åç§°"); |
| | | } |
| | | PostRespDTO post = postMap.get(postName.trim()); |
| | | if (post == null) { |
| | | throw exception(EMPLOYEE_POST_NAME_NOT_EXISTS, postName.trim()); |
| | | } |
| | | return post.getId(); |
| | | } |
| | | |
| | | private Set<Long> parseRoleIds(String roleNames, Map<String, RoleRespDTO> roleMap) { |
| | | if (StrUtil.isBlank(roleNames)) { |
| | | return Collections.emptySet(); |
| | | } |
| | | Set<Long> roleIds = new LinkedHashSet<>(); |
| | | for (String roleName : roleNames.split("[,ï¼]")) { |
| | | String trimmed = roleName.trim(); |
| | | if (StrUtil.isBlank(trimmed)) { |
| | | continue; |
| | | } |
| | | RoleRespDTO role = roleMap.get(trimmed); |
| | | if (role == null) { |
| | | throw exception(EMPLOYEE_ROLE_NAME_NOT_EXISTS, trimmed); |
| | | } |
| | | roleIds.add(role.getId()); |
| | | } |
| | | return roleIds; |
| | | } |
| | | |
| | | } |
| | |
| | | List<DeptRespDTO> getDeptList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å
¨é¨é¨é¨å表 |
| | | * |
| | | * @return é¨é¨ä¿¡æ¯æ°ç» |
| | | */ |
| | | List<DeptRespDTO> getDeptList(); |
| | | |
| | | /** |
| | | * æ ¡éªé¨é¨ä»¬æ¯å¦ææãå¦ä¸æ
åµï¼è§ä¸ºæ æï¼ |
| | | * 1. é¨é¨ç¼å·ä¸åå¨ |
| | | * 2. é¨é¨è¢«ç¦ç¨ |
| | |
| | | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; |
| | | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; |
| | | import cn.iocoder.yudao.module.system.service.dept.DeptService; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptRespDTO> getDeptList() { |
| | | List<DeptDO> depts = deptService.getDeptList(new DeptListReqVO()); |
| | | return BeanUtils.toBean(depts, DeptRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public void validateDeptList(Collection<Long> ids) { |
| | | deptService.validateDeptList(ids); |
| | | } |
| | |
| | | |
| | | List<PostRespDTO> getPostList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å
¨é¨å²ä½å表 |
| | | * |
| | | * @return å²ä½ä¿¡æ¯æ°ç» |
| | | */ |
| | | List<PostRespDTO> getPostList(); |
| | | |
| | | default Map<Long, PostRespDTO> getPostMap(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return MapUtil.empty(); |
| | |
| | | return BeanUtils.toBean(list, PostRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PostRespDTO> getPostList() { |
| | | List<PostDO> list = postService.getPostList(null, null); |
| | | return BeanUtils.toBean(list, PostRespDTO.class); |
| | | } |
| | | |
| | | } |
| | |
| | | List<RoleRespDTO> getRoleList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å
¨é¨è§è²å表 |
| | | * |
| | | * @return è§è²ä¿¡æ¯æ°ç» |
| | | */ |
| | | List<RoleRespDTO> getRoleList(); |
| | | |
| | | /** |
| | | * è·å¾æå®ç¼å·çè§è² Map |
| | | * |
| | | * @param ids è§è²ç¼å·æ°ç» |
| | |
| | | List<RoleDO> list = roleService.getRoleList(ids); |
| | | return BeanUtils.toBean(list, RoleRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<RoleRespDTO> getRoleList() { |
| | | List<RoleDO> list = roleService.getRoleList(); |
| | | return BeanUtils.toBean(list, RoleRespDTO.class); |
| | | } |
| | | } |
| | |
| | | // ===== CRM ===== |
| | | CRM_SALE_QUOTATION("crm_sale_quotation", "CRM é宿¥ä»·å"), |
| | | CRM_FOLLOW_UP_RECORD("crm_follow_up_record", "CRM è·è¿è®°å½"), |
| | | CRM_INVOICE("crm_invoice", "CRM å¼ç¥¨"), |
| | | |
| | | // ===== HRM ===== |
| | | HRM_LEAVE_APPLICATION("hrm_leave_application", "HRM 请åç³è¯·"), |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | server: |
| | | port: 48080 |
| | | |
| | | --- #################### æ°æ®åºç¸å
³é
ç½® #################### |
| | | spring: |
| | | autoconfigure: |
| | | # noinspection SpringBootApplicationYaml |
| | | exclude: |
| | | - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # é»è®¤ local ç¯å¢ï¼ä¸å¼å¯ Quartz çèªå¨é
ç½® |
| | | - org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration # ç¦ç¨ AI 模åç Qdrantï¼æå¨å建 |
| | | - org.springframework.ai.vectorstore.redis.autoconfigure.RedisVectorStoreAutoConfiguration # ç¦ç¨ AI 模åç Redisï¼æå¨å建 |
| | | - org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration # ç¦ç¨ AI 模åç Milvusï¼æå¨å建 |
| | | - org.dromara.trans.config.TransServiceConfig # TODO èè¿ï¼easy-trans å
¼å®¹ Spring Boot 4 åç§»é¤ï¼TransServiceConfig å¼ç¨äºå·²ç§»é¤ç RestTemplateBuilderï¼ |
| | | # ç¦ç¨æªé
ç½® API Key çæ¨¡åèªå¨é
ç½®ï¼åªä¿çéä¹åé® Embedding çæå¨é
ç½®ï¼ |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiChatAutoConfiguration |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiEmbeddingAutoConfiguration |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiImageAutoConfiguration |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiAudioSpeechAutoConfiguration |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiAudioTranscriptionAutoConfiguration |
| | | - org.springframework.ai.model.openai.autoconfigure.OpenAiModerationAutoConfiguration |
| | | - org.springframework.ai.model.deepseek.autoconfigure.DeepSeekChatAutoConfiguration |
| | | - org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatAutoConfiguration |
| | | - org.springframework.ai.model.google.genai.autoconfigure.chat.GoogleGenAiChatAutoConfiguration |
| | | - org.springframework.ai.model.google.genai.autoconfigure.embedding.GoogleGenAiEmbeddingConnectionAutoConfiguration |
| | | - org.springframework.ai.model.google.genai.autoconfigure.embedding.GoogleGenAiTextEmbeddingAutoConfiguration |
| | | - org.springframework.ai.model.ollama.autoconfigure.OllamaApiAutoConfiguration |
| | | - org.springframework.ai.model.ollama.autoconfigure.OllamaChatAutoConfiguration |
| | | - org.springframework.ai.model.ollama.autoconfigure.OllamaEmbeddingAutoConfiguration |
| | | - org.springframework.ai.model.stabilityai.autoconfigure.StabilityAiImageAutoConfiguration |
| | | # æ°æ®æºé
置项 |
| | | datasource: |
| | | druid: # Druid ãçæ§ãç¸å
³çå
¨å±é
ç½® |
| | | web-stat-filter: |
| | | enabled: true |
| | | stat-view-servlet: |
| | | enabled: true |
| | | allow: # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | url-pattern: /druid/* |
| | | login-username: # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-password: |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | log-slow-sql: true # æ
¢ SQL è®°å½ |
| | | slow-sql-millis: 100 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | dynamic: # 夿°æ®æºé
ç½® |
| | | druid: # Druid ãè¿æ¥æ± ãç¸å
³çå
¨å±é
ç½® |
| | | initial-size: 1 # åå§è¿æ¥æ° |
| | | min-idle: 1 # æå°è¿æ¥æ± æ°é |
| | | max-active: 20 # æå¤§è¿æ¥æ± æ°é |
| | | max-wait: 60000 # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ï¼åä½ï¼æ¯«ç§ï¼1 åéï¼ |
| | | time-between-eviction-runs-millis: 60000 # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼åä½ï¼æ¯«ç§ï¼1 åéï¼ |
| | | min-evictable-idle-time-millis: 600000 # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼åä½ï¼æ¯«ç§ï¼10 åéï¼ |
| | | max-evictable-idle-time-millis: 1800000 # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼åä½ï¼æ¯«ç§ï¼30 åéï¼ |
| | | validation-query: SELECT 1 FROM DUAL # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | test-while-idle: true |
| | | test-on-borrow: false |
| | | test-on-return: false |
| | | pool-prepared-statements: true # æ¯å¦å¼å¯ PreparedStatement ç¼å |
| | | max-pool-prepared-statement-per-connection-size: 20 # æ¯ä¸ªè¿æ¥ç¼åç PreparedStatement æ°é |
| | | primary: master |
| | | datasource: |
| | | master: |
| | | url: jdbc:mysql://172.17.0.1:9002/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true;useUnicode=true;characterEncoding=utf-8 # SQLServer è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大éä» KingbaseES è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss è¿æ¥çç¤ºä¾ |
| | | # url: jdbc:postgresql://127.0.0.1:5866/ruoyi-vue-pro # çé« HighGo è¿æ¥çç¤ºä¾ |
| | | username: root |
| | | password: jhhg@123456.. |
| | | # username: sa # SQL Server è¿æ¥çç¤ºä¾ |
| | | # password: Yudao@2024 # SQL Server è¿æ¥çç¤ºä¾ |
| | | # username: SYSDBA # DM è¿æ¥çç¤ºä¾ |
| | | # password: SYSDBA001 # DM è¿æ¥çç¤ºä¾ |
| | | # username: root # OpenGauss è¿æ¥çç¤ºä¾ |
| | | # password: Yudao@2024 # OpenGauss è¿æ¥çç¤ºä¾ |
| | | # username: root # çé« HighGo è¿æ¥çç¤ºä¾ |
| | | # password: 123456 # çé« HighGo è¿æ¥çç¤ºä¾ |
| | | slave: # 模æä»åºï¼å¯æ ¹æ®èªå·±éè¦ä¿®æ¹ |
| | | lazy: true # å¼å¯æå è½½ï¼ä¿è¯å¯å¨é度 |
| | | url: jdbc:mysql://172.17.0.1:9002/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: jhhg@123456 |
| | | # tdengine: # IoT æ°æ®åºï¼éè¦ IoT ç©èç½åå¼å¯å¢ï¼ï¼ |
| | | # lazy: true # å¼å¯æå è½½ï¼ä¿è¯å¯å¨é度 |
| | | # url: jdbc:TAOS-WS://127.0.0.1:6041/ruoyi_vue_pro?varcharAsString=true&enableAutoReconnect=true # åè§ï¼https://t.zsxq.com/qaX9cï¼å¼å¯ TDengine WebSocket èªå¨éè¿ |
| | | # driver-class-name: com.taosdata.jdbc.ws.WebSocketDriver |
| | | # username: root |
| | | # password: taosdata |
| | | # druid: |
| | | # validation-query: SELECT SERVER_STATUS() # TDengine æ°æ®æºçæææ§æ£æ¥ SQL |
| | | |
| | | # Redis é
ç½®ãRedisson é»è®¤çé
置足å¤ä½¿ç¨ï¼ä¸è¬ä¸éè¦è¿è¡è°ä¼ |
| | | data: |
| | | redis: |
| | | host: 172.17.0.1 # å°å |
| | | port: 6379 # ç«¯å£ |
| | | database: 1 # æ°æ®åºç´¢å¼ |
| | | # password: dev # å¯ç ï¼å»ºè®®ç产ç¯å¢å¼å¯ |
| | | |
| | | --- #################### 宿¶ä»»å¡ç¸å
³é
ç½® #################### |
| | | |
| | | # Quartz é
置项ï¼å¯¹åº QuartzProperties é
置类 |
| | | spring: |
| | | quartz: |
| | | auto-startup: true # æ¬å°å¼åç¯å¢ï¼å°½éä¸è¦å¼å¯ Job |
| | | scheduler-name: schedulerName # Scheduler ååãé»è®¤ä¸º schedulerName |
| | | job-store-type: jdbc # Job åå¨å¨ç±»åãé»è®¤ä¸º memory 表示å
åï¼å¯é jdbc ä½¿ç¨æ°æ®åºã |
| | | wait-for-jobs-to-complete-on-shutdown: true # åºç¨å
³éæ¶ï¼æ¯å¦çå¾
宿¶ä»»å¡æ§è¡å®æãé»è®¤ä¸º false ï¼å»ºè®®è®¾ç½®ä¸º true |
| | | properties: # æ·»å Quartz Scheduler éå 屿§ï¼æ´å¤å¯ä»¥ç http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html ææ¡£ |
| | | org: |
| | | quartz: |
| | | # Scheduler ç¸å
³é
ç½® |
| | | scheduler: |
| | | instanceName: schedulerName |
| | | instanceId: AUTO # èªå¨çæ instance ID |
| | | # JobStore ç¸å
³é
ç½® |
| | | jobStore: |
| | | # JobStore å®ç°ç±»ãå¯è§å客ï¼https://blog.csdn.net/weixin_42458219/article/details/122247162 |
| | | class: org.springframework.scheduling.quartz.LocalDataSourceJobStore |
| | | isClustered: true # æ¯éç¾¤æ¨¡å¼ |
| | | clusterCheckinInterval: 15000 # éç¾¤æ£æ¥é¢çï¼åä½ï¼æ¯«ç§ãé»è®¤ä¸º 15000ï¼å³ 15 ç§ |
| | | misfireThreshold: 60000 # misfire éå¼ï¼åä½ï¼æ¯«ç§ã |
| | | # çº¿ç¨æ± ç¸å
³é
ç½® |
| | | threadPool: |
| | | threadCount: 25 # çº¿ç¨æ± 大å°ãé»è®¤ä¸º 10 ã |
| | | threadPriority: 5 # 线ç¨ä¼å
级 |
| | | class: org.quartz.simpl.SimpleThreadPool # çº¿ç¨æ± ç±»å |
| | | jdbc: # ä½¿ç¨ JDBC ç JobStore çæ¶åï¼JDBC çé
ç½® |
| | | initialize-schema: NEVER # æ¯å¦èªå¨ä½¿ç¨ SQL åå§å Quartz è¡¨ç»æãè¿é设置æ never ï¼æä»¬æå¨åå»ºè¡¨ç»æã |
| | | |
| | | --- #################### æ¶æ¯éåç¸å
³ #################### |
| | | |
| | | # rocketmq é
置项ï¼å¯¹åº RocketMQProperties é
置类 |
| | | rocketmq: |
| | | name-server: 127.0.0.1:9876 # RocketMQ Namesrv |
| | | |
| | | spring: |
| | | # RabbitMQ é
置项ï¼å¯¹åº RabbitProperties é
置类 |
| | | rabbitmq: |
| | | host: 127.0.0.1 # RabbitMQ æå¡çå°å |
| | | port: 5672 # RabbitMQ æå¡çç«¯å£ |
| | | username: rabbit # RabbitMQ æå¡çè´¦å· |
| | | password: rabbit # RabbitMQ æå¡çå¯ç |
| | | # Kafka é
置项ï¼å¯¹åº KafkaProperties é
置类 |
| | | kafka: |
| | | bootstrap-servers: 127.0.0.1:9092 # æå® Kafka Broker å°åï¼å¯ä»¥è®¾ç½®å¤ä¸ªï¼ä»¥éå·åé |
| | | |
| | | --- #################### æå¡ä¿éç¸å
³é
ç½® #################### |
| | | |
| | | # Lock4j é
置项 |
| | | lock4j: |
| | | acquire-timeout: 3000 # è·ååå¸å¼éè¶
æ¶æ¶é´ï¼é»è®¤ä¸º 3000 æ¯«ç§ |
| | | expire: 30000 # åå¸å¼éçè¶
æ¶æ¶é´ï¼é»è®¤ä¸º 30000 æ¯«ç§ |
| | | |
| | | --- #################### çæ§ç¸å
³é
ç½® #################### |
| | | |
| | | # Actuator çæ§ç«¯ç¹çé
置项 |
| | | management: |
| | | endpoints: |
| | | web: |
| | | base-path: /actuator # Actuator æä¾ç API æ¥å£çæ ¹ç®å½ãé»è®¤ä¸º /actuator |
| | | exposure: |
| | | include: '*' # éè¦å¼æ¾ç端ç¹ãé»è®¤å¼åªæå¼ health å info 两个端ç¹ãéè¿è®¾ç½® * ï¼å¯ä»¥å¼æ¾ææç«¯ç¹ã |
| | | |
| | | # Spring Boot Admin é
置项 |
| | | spring: |
| | | boot: |
| | | admin: |
| | | # Spring Boot Admin Client 客æ·ç«¯çç¸å
³é
ç½® |
| | | client: |
| | | url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server å°å |
| | | instance: |
| | | service-host-type: IP # 注åå®ä¾æ¶ï¼ä¼å
ä½¿ç¨ IP [IP, HOST_NAME, CANONICAL_HOST_NAME] |
| | | username: admin |
| | | password: admin |
| | | # Spring Boot Admin Server æå¡ç«¯çç¸å
³é
ç½® |
| | | context-path: /admin # é
ç½® Spring |
| | | # å
许åµå
¥ iframe çååï¼æ¯æéé
符ï¼ï¼å®é
é¨ç½²æ¶ï¼å¯ä»¥æ¹ä¸º "'self' [ä½ çå
¬ç½åå]" |
| | | frame-ancestors: "'self' localhost localhost:48080 127.0.0.1 127.0.0.1:48080" |
| | | |
| | | # æ¥å¿æä»¶é
ç½® |
| | | logging: |
| | | file: |
| | | name: logs/${spring.application.name}.log # æ¥å¿æä»¶åï¼ç¸å¯¹äºé¡¹ç®æ ¹ç®å½ |
| | | level: |
| | | # é
ç½®èªå·±åç MyBatis Mapper æå°æ¥å¿ |
| | | cn.iocoder.yudao.module.bpm.dal.mysql: debug |
| | | cn.iocoder.yudao.module.infra.dal.mysql: debug |
| | | cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper: INFO # é
ç½® ApiErrorLogMapper çæ¥å¿çº§å«ä¸º infoï¼é¿å
å GlobalExceptionHandler éå¤æå° |
| | | cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # é
ç½® JobLogMapper çæ¥å¿çº§å«ä¸º info |
| | | cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper: INFO # é
ç½® FileConfigMapper çæ¥å¿çº§å«ä¸º info |
| | | cn.iocoder.yudao.module.pay.dal.mysql: debug |
| | | cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyTaskMapper: INFO # é
ç½® PayNotifyTaskMapper çæ¥å¿çº§å«ä¸º info |
| | | cn.iocoder.yudao.module.system.dal.mysql: debug |
| | | cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper: INFO # é
ç½® SmsChannelMapper çæ¥å¿çº§å«ä¸º info |
| | | cn.iocoder.yudao.module.tool.dal.mysql: debug |
| | | cn.iocoder.yudao.module.member.dal.mysql: debug |
| | | cn.iocoder.yudao.module.trade.dal.mysql: debug |
| | | cn.iocoder.yudao.module.promotion.dal.mysql: debug |
| | | cn.iocoder.yudao.module.statistics.dal.mysql: debug |
| | | cn.iocoder.yudao.module.crm.dal.mysql: debug |
| | | cn.iocoder.yudao.module.erp.dal.mysql: debug |
| | | cn.iocoder.yudao.module.mes.dal.mysql: debug |
| | | cn.iocoder.yudao.module.wms.dal.mysql: debug |
| | | cn.iocoder.yudao.module.iot.dal.mysql: debug |
| | | cn.iocoder.yudao.module.iot.dal.tdengine: DEBUG |
| | | cn.iocoder.yudao.module.iot.service.rule: debug |
| | | cn.iocoder.yudao.module.ai.dal.mysql: debug |
| | | cn.iocoder.yudao.module.im.dal.mysql: debug |
| | | org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO èè¿ï¼å
ç¦ç¨ï¼Spring Boot 3.X åå¨é¨åé误ç WARN æç¤º |
| | | |
| | | debug: false |
| | | |
| | | yudao: |
| | | ai: |
| | | vector-store: |
| | | type: milvus # åéåºç±»åï¼milvus |
| | | milvus: |
| | | initialize-schema: true |
| | | database-name: test |
| | | collection-name: knowledge_segment_jhhg |
| | | host: 36.213.180.217 |
| | | port: 19530 |
| | | |
| | | --- #################### 微信å
¬ä¼å·ãå°ç¨åºç¸å
³é
ç½® #################### |
| | | wx: |
| | | mp: # å
¬ä¼å·é
ç½®ï¼å¿
å¡«ï¼ï¼åè§ https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md ææ¡£ |
| | | # app-id: wx041349c6f39b268b # æµè¯å·ï¼çå¸å°§æä¾çï¼ |
| | | # secret: 5abee519483bc9f8cb37ce280e814bd0 |
| | | # app-id: wx5b23ba7a5589ecbb # æµè¯å·ï¼èªå·±çï¼ |
| | | # secret: 2a7b3b20c537e52e74afd395eb85f61f |
| | | app-id: wxf56b1542b9e85f8a # æµè¯å·ï¼Kongdy æä¾çï¼ |
| | | secret: 496379dcef1ba869e9234de8d598cfd3 |
| | | # åå¨é
ç½®ï¼è§£å³ AccessToken çè·¨èç¹çå
񄧮 |
| | | config-storage: |
| | | type: RedisTemplate # éç¨ RedisTemplate æä½ Redisï¼ä¼èªå¨ä» Spring ä¸è·å |
| | | key-prefix: wx # Redis Key çåç¼ |
| | | http-client-type: HttpComponents # éç¨ HttpComponentsï¼HttpClient 5ï¼è¯·æ±å¾®ä¿¡å
¬ä¼å·å¹³å° |
| | | miniapp: # å°ç¨åºé
ç½®ï¼å¿
å¡«ï¼ï¼åè§ https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md ææ¡£ |
| | | # appid: wx62056c0d5e8db250 # æµè¯å·ï¼çå¸å°§æä¾çï¼ |
| | | # secret: 333ae72f41552af1e998fe1f54e1584a |
| | | # appid: wx63c280fe3248a3e7 # wenhualiançæ¥å£æµè¯å· |
| | | # secret: 6f270509224a7ae1296bbf1c8cb97aed |
| | | appid: wxc4598c446f8a9cb3 # æµè¯å·ï¼Kongdy æä¾çï¼ |
| | | secret: 4a1a04e07f6a4a0751b39c3064a92c8b |
| | | # appid: wx66186af0759f47c9 # æµè¯å·ï¼puhui æä¾çï¼ |
| | | # secret: 3218bcbd112cbc614c7264ceb20144ac |
| | | config-storage: |
| | | type: RedisTemplate # éç¨ RedisTemplate æä½ Redisï¼ä¼èªå¨ä» Spring ä¸è·å |
| | | key-prefix: wa # Redis Key çåç¼ |
| | | http-client-type: HttpComponents # éç¨ HttpComponentsï¼HttpClient 5ï¼è¯·æ±å¾®ä¿¡å°ç¨åºå¹³å° |
| | | |
| | | --- #################### è¶
级管çåç¸å
³é
ç½® #################### |
| | | |
| | | # è¶
级管çåé
置项ï¼è®¾ç½®å½åé¡¹ç®ææèªå®ä¹çé
ç½® |
| | | yudao: |
| | | captcha: |
| | | enable: false # æ¬å°ç¯å¢ï¼ææ¶å
³éå¾çéªè¯ç ï¼æ¹ä¾¿ç»å½çæ¥å£çæµè¯ï¼ |
| | | security: |
| | | mock-enable: true |
| | | pay: |
| | | order-notify-url: https://yutou.mynatapp.cc/admin-api/pay/notify/order # æ¯ä»æ¸ éçãæ¯ä»ãåè°å°å |
| | | refund-notify-url: https://yutou.mynatapp.cc/admin-api/pay/notify/refund # æ¯ä»æ¸ éçã鿬¾ãåè°å°å |
| | | transfer-notify-url: https://yutou.mynatapp.cc/admin-api/pay/notify/transfer # æ¯ä»æ¸ éçã转账ãåè°å°å |
| | | access-log: # è®¿é®æ¥å¿çé
置项 |
| | | enable: false |
| | | demo: false # å
³éæ¼ç¤ºæ¨¡å¼ |
| | | wxa-code: |
| | | env-version: develop # å°ç¨åºçæ¬: æ£å¼ç为 "release"ï¼ä½éªç为 "trial"ï¼å¼åç为 "develop" |
| | | wxa-subscribe-message: |
| | | miniprogram-state: developer # 跳转å°ç¨åºç±»åï¼å¼åç为 âdeveloperâï¼ä½éªç为 âtrialâä¸ºï¼æ£å¼ç为 âformalâ |
| | | tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ å°å¾çå¯é¥ https://lbs.qq.com/service/staticV2/staticGuide/staticDoc |
| | | storage: # æä»¶ä¸ä¼ é
ç½® |
| | | path: /data/javaWork/mom/file # æä»¶å卿 ¹ç®å½ |
| | | url-prefix: /admin-api/system/storage-blob # URLè·¯å¾åç¼ |
| | | domain: http://42.63.70.90:9003 # åååç¼ï¼æå®é
ååé
ç½®ï¼ï¼å端é
置好åä¸å¤ªå¯¹ç°å¨æ¯ç´è¿åç«¯ï¼ææè¦åç«¯ç«¯å£ |
| | | expired: 120 # tokenè¿ææ¶é´ï¼åéï¼ |
| | | use-limit: 10 # tokenä½¿ç¨æ¬¡æ°ä¸é |
| | | jwt-secret: abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG # JWTå¯é¥ |
| | | compress: true # æ¯å¦å缩å¾ç |
| | | need-compress-size: 10MB # 触åå缩çæä»¶å¤§å°éå¼ |
| | | compress-quality: 0.5 # å缩质é(0.0-1.0) |
| | | |
| | | justauth: |
| | | enabled: true |
| | | type: |
| | | DINGTALK: # éé |
| | | client-id: dingvrnreaje3yqvzhxg |
| | | client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI |
| | | ignore-check-redirect-uri: true |
| | | WECHAT_ENTERPRISE: # ä¼ä¸å¾®ä¿¡ |
| | | client-id: wwd411c69a39ad2e54 |
| | | client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw |
| | | agent-id: 1000004 |
| | | ignore-check-redirect-uri: true |
| | | # noinspection SpringBootApplicationYaml |
| | | WECHAT_MINI_PROGRAM: # 微信å°ç¨åº |
| | | client-id: ${wx.miniapp.appid} |
| | | client-secret: ${wx.miniapp.secret} |
| | | ignore-check-redirect-uri: true |
| | | ignore-check-state: true # 微信å°ç¨åºï¼ä¸ä¼ä½¿ç¨å° stateï¼æä»¥ä¸è¿è¡æ ¡éª |
| | | WECHAT_MP: # 微信å
¬ä¼å· |
| | | client-id: ${wx.mp.app-id} |
| | | client-secret: ${wx.mp.secret} |
| | | ignore-check-redirect-uri: true |
| | | ALIPAY: # æ¯ä»å®å°ç¨åº |
| | | client-id: xx |
| | | client-secret: xx |
| | | alipay-public-key: xx |
| | | ignore-check-redirect-uri: true |
| | | ignore-check-state: true |
| | | cache: |
| | | type: REDIS |
| | | prefix: 'social_auth_state:' # ç¼ååç¼ï¼ç®ååªå¯¹ Redis ç¼åçæï¼é»è®¤ JUSTAUTH::STATE:: |
| | | timeout: 24h # è¶
æ¶æ¶é¿ï¼ç®ååªå¯¹ Redis ç¼åçæï¼é»è®¤ 3 åé |