Merge branch 'refs/heads/dev_New_pro' into dev_宁夏_英泽防锈
# Conflicts:
# src/main/resources/application-dev.yml
# src/main/resources/mapper/system/SysUserMapper.xml
已添加183个文件
已重命名1个文件
已修改284个文件
已删除84个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # StockInRecord å表æºåå·å端èè°ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-22 |
| | | éç¨æ¥å£ï¼`GET /stockInRecord/listPage` |
| | | |
| | | ## 1. åæ´è¯´æ |
| | | |
| | | æ¬æ¬¡å¯¹å
¥åºç®¡çå表æ¥å£å¢å è¿ååæ®µ `sourceOrderNo`ï¼æºåå·ï¼ï¼ç¨äºåææåºæ¯å±ç¤ºéè´æ¥æºåå·ã |
| | | |
| | | çææ¡ä»¶ï¼ |
| | | |
| | | - å½è¯·æ±åæ° `topParentProductId = 278` æ¶ï¼å端è¿å `sourceOrderNo`ã |
| | | - å
¶ä» `topParentProductId` åºæ¯ä¸ï¼è¯¥å段è¿å `null`ï¼æä¸å±ç¤ºï¼ã |
| | | |
| | | ## 2. åæ®µå®ä¹ |
| | | |
| | | æ°å¢åæ®µï¼ |
| | | |
| | | - `sourceOrderNo`ï¼`string`ï¼æºåå·ï¼éè´ååå·ï¼ã |
| | | |
| | | ## 3. åå¼è§å |
| | | |
| | | ä»
å¨ `topParentProductId = 278` æ¶æâæ¥æºâ计ç®ï¼ |
| | | |
| | | 1. æ¥æº = `éè´-å
¥åº`ï¼`recordType = 7`ï¼ |
| | | - å
æ `recordId` æ¥éè´äº§å表 `sales_ledger_product`ï¼`type=2`ï¼ï¼ |
| | | - åéè¿ `sales_ledger_product.sales_ledger_id` æ¥éè´å°è´¦è¡¨ `purchase_ledger`ï¼ |
| | | - è¿å `purchase_ledger.purchase_contract_number` ä½ä¸º `sourceOrderNo`ã |
| | | - å
¼å®¹å
åºï¼è¥æªå½ä¸éè´äº§åé¾è·¯ï¼åæ `recordId` ç´æ¥æ¥ `purchase_ledger.id` ååå·ã |
| | | |
| | | 2. æ¥æº = `éè´-è´¨æ£-åæ ¼å
¥åº`ï¼`recordType = 10`ï¼ |
| | | - å
æ `recordId` æ¥è´¨æ£è¡¨ `quality_inspect`ï¼ |
| | | - åéè¿ `quality_inspect.purchase_ledger_id` æ¥éè´å°è´¦è¡¨ `purchase_ledger`ï¼ |
| | | - è¿å `purchase_ledger.purchase_contract_number` ä½ä¸º `sourceOrderNo`ã |
| | | |
| | | ## 4. è¿åç¤ºä¾ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": { |
| | | "records": [ |
| | | { |
| | | "id": 1024, |
| | | "recordType": "7", |
| | | "productName": "éæ", |
| | | "model": "T2-30x3", |
| | | "sourceOrderNo": "CG-2026-00128" |
| | | }, |
| | | { |
| | | "id": 1025, |
| | | "recordType": "10", |
| | | "productName": "éæ", |
| | | "model": "T2-30x3", |
| | | "sourceOrderNo": "CG-2026-00131" |
| | | } |
| | | ], |
| | | "total": 2 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ## 5. å端èè°å»ºè®® |
| | | |
| | | 1. åè¡¨åæ°å¢âæºåå·âï¼è¯»ååæ®µ `sourceOrderNo`ã |
| | | 2. 建议ä»
å¨ `topParentProductId = 278` ç页é¢/ç鿡件ä¸å±ç¤ºè¯¥åã |
| | | 3. å½ `sourceOrderNo` 为空æ¶å±ç¤º `--`ï¼é¿å
空ç½ã |
| | | |
| | | ## 6. å彿¸
å |
| | | |
| | | 1. `topParentProductId=278` + `recordType=7`ï¼åºè¿åéè´ååå·ã |
| | | 2. `topParentProductId=278` + `recordType=10`ï¼åºè¿åéè´ååå·ï¼ç»è´¨æ£é¾è·¯ï¼ã |
| | | 3. `topParentProductId!=278`ï¼`sourceOrderNo` åºä¸º `null` æå端ä¸å±ç¤ºã |
| | | 4. åæå段ï¼`productName/model/unit/createBy` çï¼ä¸åå½±åã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # StockInRecord å表æºåå·å端èè°ææ¡£ï¼`topParentProductId=276`è¡¥å
ï¼ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-22 |
| | | éç¨æ¥å£ï¼`GET /stockInRecord/listPage` |
| | | |
| | | ## 1. åæ´è¯´æ |
| | | |
| | | å¨å·²æ `sourceOrderNo` åºç¡ä¸ï¼æ°å¢ `topParentProductId = 276` çæºåå·æº¯æºé»è¾ï¼ |
| | | |
| | | - æ ¹æ®âæ¥æºï¼recordTypeï¼+ recordIdâæº¯æºï¼ |
| | | - ä¼å
è¿åéå®åå·ï¼éå®ååå·ï¼ï¼ |
| | | - è¥éå®åå·ä¸ºç©ºï¼ååéè¿åç产订åå·ï¼ |
| | | - ä¸èèèªå®ä¹å
¥åºï¼`recordType=0/9`ï¼ã |
| | | |
| | | ## 2. è¿ååæ®µ |
| | | |
| | | åæ®µæ æ°å¢ï¼ç»§ç»ä½¿ç¨ï¼ |
| | | |
| | | - `sourceOrderNo`ï¼`string`ï¼æºåå·ã |
| | | |
| | | ## 3. 276 åºæ¯åå¼è§å |
| | | |
| | | 请æ±åæ°æ»¡è¶³ `topParentProductId = 276` æ¶ï¼ |
| | | |
| | | 1. `recordType = 14/15`ï¼éå®éè´§-åæ ¼/ä¸åæ ¼å
¥åºï¼ |
| | | - `stock_in_record.record_id -> return_sale_product.id -> return_management.shipping_id -> shipping_info.sales_ledger_id -> sales_ledger.sales_contract_no` |
| | | - è¿åéå®ååå·ã |
| | | |
| | | 2. `recordType = 2/5`ï¼ç产æ¥å·¥-å
¥åº/æ¥åºï¼ |
| | | - `stock_in_record.record_id -> production_product_main.id -> production_operation_task.production_order_id -> production_order` |
| | | - å
å该ç产订åå
³èéå®ååå·ï¼ç±ç产计åå
³èéå®å°è´¦èåï¼ï¼ |
| | | - éå®ååå·ä¸ºç©ºæ¶ï¼è¿å `production_order.nps_no`ã |
| | | |
| | | 3. `recordType = 6`ï¼è´¨æ£-åæ ¼å
¥åºï¼ |
| | | - `stock_in_record.record_id -> quality_inspect.id -> quality_inspect.product_main_id -> production_product_main -> production_operation_task -> production_order` |
| | | - å
åéå®ååå·ï¼ç©ºååé `production_order.nps_no`ã |
| | | |
| | | 4. `recordType = 4/11`ï¼ä¸åæ ¼å¤ç-æ¥åº/è®©æ¥æ¾è¡ï¼ |
| | | - `stock_in_record.record_id -> quality_unqualified.id -> quality_unqualified.inspect_id -> quality_inspect -> production_product_main -> production_operation_task -> production_order` |
| | | - å
åéå®ååå·ï¼ç©ºååé `production_order.nps_no`ã |
| | | |
| | | 5. `recordType = 20/22`ï¼é¢æéæ/ç产éæ-åæ ¼å
¥åºï¼ |
| | | - `stock_in_record.record_id -> production_order_pick.id -> production_order` |
| | | - å
åéå®ååå·ï¼ç©ºååé `production_order.nps_no`ã |
| | | |
| | | 6. `recordType = 0/9`ï¼èªå®ä¹å
¥åºï¼ |
| | | - ä¸å䏿º¯æºï¼`sourceOrderNo = null`ã |
| | | |
| | | ## 4. å
¶ä»åºæ¯è¯´æ |
| | | |
| | | - `topParentProductId = 278` çéè´é¾è·¯æºåå·é»è¾ä¿æä¸åã |
| | | - å
¶ä» `topParentProductId` ä¸è§¦åæ¬æ¬¡ 276 è§åï¼`sourceOrderNo` 为空ã |
| | | |
| | | ## 5. å端èè°å»ºè®® |
| | | |
| | | 1. å¨ `topParentProductId=276` çåè¡¨åºæ¯å±ç¤ºâæºåå·âåï¼è¯»å `sourceOrderNo`ã |
| | | 2. 建议空å¼ç»ä¸å±ç¤º `--`ã |
| | | 3. ä¸éè¦æ°å¢è¯·æ±åæ°ï¼æ²¿ç¨ç°æ `/stockInRecord/listPage`ã |
| | | |
| | | ## 6. å彿¸
å |
| | | |
| | | 1. `topParentProductId=276` + `recordType=14/15`ï¼åºè¿åéå®ååå·ã |
| | | 2. `topParentProductId=276` + `recordType=2/5/6/4/11/20/22`ï¼ä¼å
éå®ååå·ï¼ç¼ºå¤±æ¶è¿åç产订åå·ã |
| | | 3. `topParentProductId=276` + `recordType=0/9`ï¼`sourceOrderNo` 为空ã |
| | | 4. `topParentProductId=278`ï¼ä»æéè´é¾è·¯è¿åéè´ååå·ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # è´¢å¡å©ææé®ä¼ååç«¯åæ´ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-22 |
| | | éç¨æ¨¡åï¼è´¢å¡æºè½å©æï¼`/financial-ai`ï¼ |
| | | |
| | | ## 1. èæ¯ |
| | | |
| | | å½åé¦é¡µè´¢å¡å©æå¿«æ·æé®ä¸ºï¼ |
| | | |
| | | 1. `çææ¬å¨ç»è¥å¨æ¥` |
| | | 2. `为ä»ä¹å©æ¶¦ä¸é` |
| | | 3. `åªä¸ªå®¢æ·æèµé±` |
| | | |
| | | é®é¢ç¹ï¼ |
| | | |
| | | - 第 3 æ¡é®æ³å¨é¨ååºæ¯ä¸æå¾å½ä¸ä¸ç¨³å®ï¼å®¹æèµ°æ®éææ¬åçï¼å¯¼è´å¾è¡¨é¾æ¥ä»¥åå§ Markdown ææ¬å±ç¤ºï¼å¦ ``ï¼ã |
| | | - å¿«æ·æé®ç¼ºå°æ¶é´èå´ååæç®æ ï¼ç»æç¨³å®æ§ä¸å¯è§£éæ§è¾å¼±ã |
| | | |
| | | ## 2. åç«¯å¿«æ·æé®ææ¡ä¼åï¼å¿
æ¹ï¼ |
| | | |
| | | 建议å°é»è®¤ä¸æ¡å¿«æ·æé®è°æ´ä¸ºï¼ |
| | | |
| | | 1. `çææ¬å¨ç»è¥å¨æ¥ï¼å©æ¶¦ä¸ç°éæµï¼` |
| | | 2. `åææ¬æå©æ¶¦ä¸éåå ` |
| | | 3. `è¿30天åªä¸ªå®¢æ·å©æ¶¦è´¡ç®æé«` |
| | | |
| | | 说æï¼ |
| | | |
| | | - 䏿¡é®æ³å带æ¶é´èå´æåæç®æ ï¼å端å½ä¸æ´ç¨³å®ã |
| | | - 第 3 æ¡ä¸âæèµé±å®¢æ·âè¯ä¹ä¸è´ï¼ä½â婿¶¦è´¡ç®æé«âæ´æç¡®ï¼éåç´æ¥é©±å¨å©æ¶¦åæç»æé¡µã |
| | | |
| | | ## 3. ä¸å端è½åæ å° |
| | | |
| | | | å¿«æ·æé® | 颿å½ä¸è½å | 颿 `type` | |
| | | | --- | --- | --- | |
| | | | çææ¬å¨ç»è¥å¨æ¥ï¼å©æ¶¦ä¸ç°éæµï¼ | ç»è¥æ¥åçæ | `financial_operation_report` | |
| | | | åææ¬æå©æ¶¦ä¸éåå | 订å婿¶¦åæ | `financial_order_profit_analysis` | |
| | | | è¿30天åªä¸ªå®¢æ·å©æ¶¦è´¡ç®æé« | 订å婿¶¦åæ | `financial_order_profit_analysis` | |
| | | |
| | | åç«¯å·²åæ¥å¢å¼ºâæèµé±å®¢æ·/客æ·å©æ¶¦æé«/婿¶¦è´¡ç®æé«âçåä¹é®æ³è¯å«ï¼å端æä»¥ä¸ææ¡æ¹é åå¯ç´æ¥èè°ã |
| | | |
| | | ## 4. è天å
容渲æå
åºï¼å»ºè®®æ¹ï¼ |
| | | |
| | | é对è天è¿åææ¬ä¸åºç°çå¾è¡¨ Markdown 龿¥ï¼`https://local/generate_chart?options=...`ï¼ï¼å»ºè®®å端å¢å å
åºå¤çï¼ |
| | | |
| | | 1. è¯å« Markdown å¾çè¯æ³ä¸ç `local/generate_chart` 龿¥ã |
| | | 2. è§£æ `options` åæ°å¹¶è½¬æ¢ä¸º ECharts `option` 忏²æå¾è¡¨ç»ä»¶ã |
| | | 3. è§£æå¤±è´¥æ¶ä¸å±ç¤ºåå§é¿é¾æ¥ææ¬ï¼å±ç¤ºç»ä¸ç©ºææç¤ºã |
| | | |
| | | ## 5. èè°å彿¸
å |
| | | |
| | | 1. ç¹å»å¿«æ·æé® `çææ¬å¨ç»è¥å¨æ¥ï¼å©æ¶¦ä¸ç°éæµï¼` |
| | | - æ ¡éªè¿å `type=financial_operation_report`ï¼å¹¶æ£å¸¸æ¸²ææè¦/建议/å¾è¡¨ã |
| | | 2. ç¹å»å¿«æ·æé® `åææ¬æå©æ¶¦ä¸éåå ` |
| | | - æ ¡éªè¿å `type=financial_order_profit_analysis`ï¼å¹¶å±ç¤ºäºæè®¢åä¸å®¢æ·å©æ¶¦æè¡ã |
| | | 3. ç¹å»å¿«æ·æé® `è¿30天åªä¸ªå®¢æ·å©æ¶¦è´¡ç®æé«` |
| | | - æ ¡éªè¿å `type=financial_order_profit_analysis`ï¼`summary.topCustomerByProfit` æå¼ã |
| | | 4. æå·¥è¾å
¥ `åªä¸ªå®¢æ·æèµé±`ã`åªä¸ªå®¢æ·å©æ¶¦æé«` |
| | | - æ ¡éªä»å½ä¸ `financial_order_profit_analysis`ï¼ä¸ååºç°åå§å¾è¡¨ Markdown 龿¥ç´åºã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # è´¢å¡æ¨¡åå级å AI 模ååç«¯åæ´èè°ææ¡£ï¼éè´/éå®/ç产/å¾
åï¼ |
| | | |
| | | æ´æ°æ¥æï¼2026-05-22 |
| | | éç¨èå´ï¼`/sales-ai`ã`/purchase-ai`ã`/manufacturing-ai`ã`/xiaozhi`ï¼å®¡æ¹å¾
åï¼ |
| | | |
| | | ## 1. åæ´æ»è§ |
| | | |
| | | | 模å | 坹夿¥å£ | æ¯å¦éè¦å端æ¹é | ç»è®º | |
| | | | --- | --- | --- | --- | |
| | | | éå® AI | `POST /sales-ai/chat` | æ¯ | è´¢å¡å£å¾åæ¢å°æ°æ¶æ¬¾æ¨¡åï¼é¨å `type` çåæ®µè¯ä¹åå | |
| | | | éè´ AI | `POST /purchase-ai/chat` | æ¯ | 仿¬¾/å票/å¾
仿¬¾è®¡ç®åæ¢å°æ°è´¢å¡é¾è·¯ï¼ç»è®¡å¼ä»å 使¹ä¸ºçå®å¼ | |
| | | | ç产 AI | `POST /manufacturing-ai/chat` | å¦ | å·²æ ¸æ¥ï¼æ æ§è´¢å¡é»è¾ä¾èµï¼æ åæ®µåæ´ | |
| | | | å¾
å AI | `POST /xiaozhi/chat` | å¦ | å·²æ ¸æ¥ï¼æ æ§è´¢å¡é»è¾ä¾èµï¼æ åæ®µåæ´ | |
| | | |
| | | ## 2. éå® AI åæ´ï¼`/sales-ai/chat`ï¼ |
| | | |
| | | ### 2.1 `type = sales_return_list`ï¼éå®é款/忬¾è®°å½ï¼ |
| | | |
| | | å½åè¿åæ°æ®æ¥æºç»ä¸ä¸ºæ°è´¢å¡è¡¨ `account_sales_collection`ï¼ä¸åèµ°æ§æ¶æ¬¾éè´§é»è¾ã |
| | | |
| | | `data.items[]` å
³é®åæ®µï¼ |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | | --- | --- | --- | |
| | | | id | number | æ¶æ¬¾è®°å½ID | |
| | | | refundId | string | æ å° `collectionNumber`ï¼å端å¯ç»§ç»ä½ä¸ºâ鿬¾/忬¾åå·âå±ç¤º | |
| | | | collectionNumber | string | æ¶æ¬¾åå· | |
| | | | paymentMethod | string | æ¶æ¬¾æ¹å¼ | |
| | | | actualAmount | number | æ¶æ¬¾éé¢ï¼ä¸ `collectionAmount` åå¼ï¼ | |
| | | | collectionAmount | number | æ¶æ¬¾éé¢ï¼æ¨è主å±ç¤ºåæ®µï¼ | |
| | | | customerId | number | 客æ·ID | |
| | | | remark | string | 夿³¨ | |
| | | | createTime | string | æ¶æ¬¾æ¥æï¼yyyy-MM-ddï¼ | |
| | | |
| | | `summary` å¢éå
³æ³¨ï¼ |
| | | - `returnAmount`ï¼æ¶é´èå´å
é颿±æ»ï¼æ `collectionAmount` ç»è®¡ï¼ |
| | | |
| | | ### 2.2 `type = sales_customer_interaction_list`ï¼å®¢æ·å¾æ¥ï¼ |
| | | |
| | | å½åè¿ååºäºæ°é¾è·¯ï¼ |
| | | `account_sales_collection.stock_out_record_ids -> stock_out_record(record_type=13) -> shipping_info -> sales_ledger` |
| | | |
| | | è¿å约å®ï¼ |
| | | - æ æ°æ®æ¶ï¼`description = "no_customer_interactions"` |
| | | - ææ°æ®æ¶ï¼`description = "ok"` |
| | | |
| | | `summary` å
³é®åæ®µï¼ |
| | | - `totalReceiptAmount` |
| | | - `customerCount` |
| | | |
| | | `data.items[]` å
³é®åæ®µï¼ |
| | | - `salesLedgerId` |
| | | - `salesContractNo` |
| | | - `customerName` |
| | | - `projectName` |
| | | - `receiptPaymentDate` |
| | | - `receiptPaymentAmount` |
| | | - `receiptPaymentType` |
| | | - `collectionNumber` |
| | | - `registrant` |
| | | - `remark` |
| | | |
| | | ### 2.3 `type = sales_ledger_list`ï¼éå®å°è´¦ï¼ |
| | | |
| | | åæ®µç»æä¸åï¼ä½éé¢å£å¾å·²åæ¢ï¼ |
| | | - `receivedAmount` ç±æ°æ¶æ¬¾æ¨¡åæ±æ»å¾å°ï¼ |
| | | - `pendingAmount = max(0, invoicedAmount - receivedAmount)`ï¼ |
| | | - è¥æ¶æ¬¾è®°å½æªæ¾å¼å
³èå°è´¦ï¼åæå®¢æ·ç»´åº¦å
åºå½éã |
| | | |
| | | å端æ¹é å»ºè®®ï¼ |
| | | - 䏿¹å段åï¼ |
| | | - éç¹åå½âå·²æ¶éé¢/å¾
忬¾éé¢âæ¯å¦ä¸è´¢å¡å°è´¦ä¸è´ã |
| | | |
| | | ## 3. éè´ AI åæ´ï¼`/purchase-ai/chat`ï¼ |
| | | |
| | | ### 3.1 `type = purchase_stats`ï¼éè´ç»è®¡ï¼ |
| | | |
| | | 以ä¸å段已ä»å ä½å¼æ¹ä¸ºçå®ç»è®¡å¼ï¼ |
| | | - `summary.paymentCount` |
| | | - `summary.invoiceCount` |
| | | - `summary.paymentAmount` |
| | | - `summary.invoiceAmount` |
| | | |
| | | å票éé¢å£å¾ï¼ |
| | | - ä¼å
`taxInclusivePrice` |
| | | - è¥ä¸ºç©º/0ï¼åä½¿ç¨ `taxExclusivelPrice + taxPrice` |
| | | |
| | | ### 3.2 `type = purchase_pending_payment_list`ï¼å¾
仿¬¾éè´åï¼ |
| | | |
| | | æ ¸å¿è®¡ç®å·²åæ¢å°æ°è´¢å¡é¾è·¯ï¼ |
| | | |
| | | `account_purchase_payment -> account_payment_application -> stock_in_record -> (purchase_ledger / quality_inspect) -> purchase_ledger_id` |
| | | |
| | | æ å°è§åï¼ |
| | | 1. `stock_in_record.record_type = 7`ï¼`record_id` ç´æ¥è§ä¸º `purchase_ledger_id` |
| | | 2. `stock_in_record.record_type = 10`ï¼éè¿ `quality_inspect.id = record_id` å `quality_inspect.purchase_ledger_id` |
| | | |
| | | éé¢å段å£å¾ï¼ |
| | | - `paidAmount`ï¼æ°é¾è·¯ç´¯è®¡å·²ä»æ¬¾éé¢ |
| | | - `pendingAmount = contractAmount - paidAmount`ï¼<=0 çè®°å½ä¸è¿åï¼ |
| | | |
| | | `summary` å
³é®å段ï¼å为çå®å¼ï¼ï¼ |
| | | - `pendingOrderCount` |
| | | - `totalContractAmount` |
| | | - `totalPaidAmount` |
| | | - `totalPendingAmount` |
| | | |
| | | ### 3.3 æ°æ®æ¸
æ´ä¿®å¤ |
| | | |
| | | å·²ä¿®å¤ `record_type` å¸¦ç©ºæ ¼å¯¼è´çæ å°ä¸¢å¤±é®é¢ï¼å端ç»ä¸ `trim()` åå夿 `7/10`ï¼ã |
| | | |
| | | ## 4. ç产 AI / å¾
å AI æ ¸æ¥ç»è®º |
| | | |
| | | å·²æ ¸æ¥ä»¥ä¸æ¨¡å代ç ï¼æªåç°æ§è´¢å¡é»è¾è¦åç¹ï¼ |
| | | - `ManufacturingAgentTools`ï¼çäº§ï¼ |
| | | - `ApproveTodoTools`ï¼å¾
å审æ¹ï¼ |
| | | |
| | | ç»è®ºï¼ |
| | | - å¯¹å¤ `type` ä¸åæ®µç»ææ åæ´ï¼ |
| | | - å端æ éåå
¼å®¹æ¹é ï¼ä»
éå䏿¬¡åå½éªè¯ã |
| | | |
| | | ## 5. å端èè°è¦ç¹ |
| | | |
| | | 1. `/sales-ai/chat`ã`/purchase-ai/chat` ç»§ç»æ SSE ææ¬æµæ¼æ¥åå JSON è§£æã |
| | | 2. æ `type` è·¯ç±æ¸²æï¼ä¸è¦ä»
ä¾èµ `description` ææ¡ã |
| | | 3. `sales_customer_interaction_list` éå
¼å®¹ `description` æä¸¾ï¼`ok` / `no_customer_interactions`ã |
| | | 4. `sales_return_list` éé¢å±ç¤ºç»ä¸ç¨ `collectionAmount`ï¼`actualAmount` ä¿çå
¼å®¹ï¼ã |
| | | 5. `purchase_pending_payment_list` çæ±æ»å¡çè¯·ç´æ¥è¯»å `summary.totalPendingAmount` çåæ®µï¼ä¸ååç«¯äºæ¬¡ä¼°ç®ã |
| | | |
| | | ## 6. å彿¸
åï¼å»ºè®®ï¼ |
| | | |
| | | ### éå® |
| | | 1. æé®ï¼âè¿30天åªä¸ªè®¢å忬¾æå°â |
| | | - æ ¡éª `sales_ledger_list` ç `receivedAmount/pendingAmount`ã |
| | | 2. æé®ï¼âæ¥è¯¢æ¬æéå®é款â |
| | | - æ ¡éª `sales_return_list` ç `collectionNumber/collectionAmount/returnAmount`ã |
| | | 3. æé®ï¼âæ¥è¯¢æ¬æå®¢æ·å¾æ¥â |
| | | - æ ¡éª `sales_customer_interaction_list` ç `totalReceiptAmount/customerCount`ã |
| | | |
| | | ### éè´ |
| | | 1. æé®ï¼âç»è®¡æ¬æéè´æ°æ®â |
| | | - æ ¡éª `purchase_stats` ç `paymentCount/invoiceCount/paymentAmount/invoiceAmount` éåºå®0ã |
| | | 2. æé®ï¼âååºå¾
仿¬¾éè´åâ |
| | | - æ ¡éª `purchase_pending_payment_list` ç `paidAmount/pendingAmount` ä¸è´¢å¡å®é
ä¸è´ã |
| | | |
| | | ### ç产/å¾
å |
| | | 1. ç产æé®ï¼âæ¥è¯¢æ¬å¨è®¾å¤ç»´ä¿®è®°å½â |
| | | 2. å¾
åæé®ï¼âæ¥è¯¢æçå¾
审æ¹å表â |
| | | - æ ¡éªè¿åç»æä¸å级åä¸è´ï¼æ åæ®µç ´åï¼ã |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # éè´å
¥åºç¶æå端èè°ææ¡£ |
| | | æ´æ°æ¶é´ï¼2026-05-22 |
| | | éç¨çæ¬ï¼æ¬æ¬¡åç«¯åæ´å |
| | | |
| | | ## 1. åæ´èå´ |
| | | |
| | | 1. `GET /purchaseLedger/listPage` |
| | | - æ°å¢æ¥è¯¢æ¡ä»¶ï¼`stockInStatus`ï¼å
¥åºç¶æï¼ |
| | | - æ°å¢è¿ååæ®µï¼`stockInStatus`ï¼å
¥åºç¶æï¼ |
| | | 2. `GET /salesLedgerProduct/list` |
| | | - æ°å¢è¿ååæ®µï¼`stockInApprovalStatus`ï¼æ¯ä¸ªäº§åçå
¥åºå®¡æ ¸ç¶æï¼ |
| | | |
| | | --- |
| | | |
| | | ## 2. å
¥åºç¶ææä¸¾ï¼ä¸¤æ¥å£ä¸è´ï¼ |
| | | |
| | | - `å¾
å
¥åº` |
| | | - `å
¥åºä¸` |
| | | - `å®å
¨å
¥åº` |
| | | |
| | | 说æï¼å端çéå¼è¯·ç´æ¥ä½¿ç¨ä»¥ä¸ä¸ææä¸¾å¼ã |
| | | |
| | | --- |
| | | |
| | | ## 3. æ¥å£ä¸ï¼`GET /purchaseLedger/listPage` |
| | | |
| | | ### 3.1 æ°å¢è¯·æ±åæ° |
| | | |
| | | - `stockInStatus`ï¼`string`ï¼å¯é |
| | | å¯ä¼ å¼ï¼`å¾
å
¥åº` / `å
¥åºä¸` / `å®å
¨å
¥åº` |
| | | |
| | | ### 3.2 æ°å¢è¿ååæ®µ |
| | | |
| | | - `stockInStatus`ï¼`string`ï¼éè´å°è´¦ç»´åº¦å
¥åºç¶æ |
| | | |
| | | ### 3.3 ç¶æè®¡ç®è§åï¼éè´å°è´¦ç»´åº¦ï¼ |
| | | |
| | | 以该éè´å°è´¦ä¸ `sales_ledger_product.type = 2` çéè´äº§å为计ç®èå´ï¼ |
| | | |
| | | 1. å
¨é¨äº§åé½è¾¾å°âå®å
¨å
¥åºâ => å°è´¦ç¶æ `å®å
¨å
¥åº` |
| | | 2. è³å°æä¸ä¸ªäº§ååå¨âå®¡æ ¸éè¿å
¥åºâï¼ä½æªå
¨é¨å®å
¨å
¥åº => å°è´¦ç¶æ `å
¥åºä¸` |
| | | 3. 没æä»»ä½äº§ååå¨âå®¡æ ¸éè¿å
¥åºâ => å°è´¦ç¶æ `å¾
å
¥åº` |
| | | |
| | | âå®¡æ ¸éè¿å
¥åºâç»è®¡å£å¾ï¼`stock_in_record.approval_status = 1`ï¼å¹¶æä»¥ä¸æ¥æºæº¯æºï¼ |
| | | - `record_type = 7`ï¼éè´-å
¥åºï¼ï¼æéè´å°è´¦+产åå
³èç»è®¡ |
| | | - `record_type = 10`ï¼éè´-è´¨æ£-åæ ¼å
¥åºï¼ï¼éè¿ `quality_inspect` åæº¯å°éè´å°è´¦+产åç»è®¡ |
| | | |
| | | ### 3.4 è¿å示ä¾ï¼èéï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": { |
| | | "records": [ |
| | | { |
| | | "id": 1201, |
| | | "purchaseContractNumber": "CG20260522001", |
| | | "supplierName": "XXä¾åºå", |
| | | "stockInStatus": "å
¥åºä¸" |
| | | } |
| | | ], |
| | | "total": 1 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## 4. æ¥å£äºï¼`GET /salesLedgerProduct/list` |
| | | |
| | | ### 4.1 æ°å¢è¿ååæ®µ |
| | | |
| | | - `stockInApprovalStatus`ï¼`string`ï¼å½å产åè¡çå
¥åºå®¡æ ¸ç¶æ |
| | | |
| | | ### 4.2 ç¶æè®¡ç®è§åï¼äº§åç»´åº¦ï¼ |
| | | |
| | | ä»
å½äº§å `type = 2`ï¼éè´äº§åï¼æ¶è®¡ç®å¹¶è¿åï¼ |
| | | |
| | | 1. å®¡æ ¸éè¿å
¥åºæ°é `<= 0` => `å¾
å
¥åº` |
| | | 2. å®¡æ ¸éè¿å
¥åºæ°é `>= 产åéè´æ°é` => `å®å
¨å
¥åº` |
| | | 3. å
¶ä»æ
åµ => `å
¥åºä¸` |
| | | |
| | | å
¶ä¸âå®¡æ ¸éè¿å
¥åºæ°éâç»è®¡åæ ·åºäºï¼ |
| | | - `stock_in_record.approval_status = 1` |
| | | - æ¥æº `record_type = 7 / 10` çæº¯æºå
³èé»è¾ |
| | | |
| | | `type != 2` ç产åï¼è¯¥å段è¿å `null`ã |
| | | |
| | | ### 4.3 è¿å示ä¾ï¼èéï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": [ |
| | | { |
| | | "id": 5566, |
| | | "type": 2, |
| | | "productCategory": "éæ", |
| | | "specificationModel": "T2-30x3", |
| | | "quantity": 100, |
| | | "stockInApprovalStatus": "å¾
å
¥åº" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## 5. å端æ¹é 建议 |
| | | |
| | | 1. éè´å°è´¦å表æ°å¢âå
¥åºç¶æâçé项ï¼å¼åºå®ï¼`å¾
å
¥åº/å
¥åºä¸/å®å
¨å
¥åº`ã |
| | | 2. éè´å°è´¦å表æ°å¢âå
¥åºç¶æâåï¼å±ç¤º `stockInStatus`ã |
| | | 3. éè´äº§åå表æ°å¢âå
¥åºå®¡æ ¸ç¶æâåï¼å±ç¤º `stockInApprovalStatus`ã |
| | | 4. 空å¼ï¼å¦ `type != 2`ï¼å»ºè®®å±ç¤ºä¸º `--`ã |
| | | |
| | | --- |
| | | |
| | | ## 6. èè°æ£æ¥æ¸
å |
| | | |
| | | 1. `/purchaseLedger/listPage` ä¸ä¼ `stockInStatus`ï¼åºæ£å¸¸è¿åå
¨é¨æ°æ®ï¼å¹¶å¸¦ `stockInStatus`ã |
| | | 2. `/purchaseLedger/listPage?stockInStatus=å¾
å
¥åº`ï¼ä»
è¿åå¾
å
¥åºå°è´¦ã |
| | | 3. `/purchaseLedger/listPage?stockInStatus=å
¥åºä¸`ï¼ä»
è¿åå
¥åºä¸å°è´¦ã |
| | | 4. `/purchaseLedger/listPage?stockInStatus=å®å
¨å
¥åº`ï¼ä»
è¿åå®å
¨å
¥åºå°è´¦ã |
| | | 5. `/salesLedgerProduct/list` å¨éè´äº§åï¼`type=2`ï¼ä¸è¿å `stockInApprovalStatus`ã |
| | | 6. `/salesLedgerProduct/list` å¨ééè´äº§åï¼`type!=2`ï¼ä¸ `stockInApprovalStatus` 为 `null`ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # é¦é¡µè´¢å¡æ¥å£å级åç«¯åæ´ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-22 |
| | | éç¨æ¨¡åï¼é¦é¡µï¼`/home`ï¼ |
| | | |
| | | ## 1. åæ´æ¦è§ |
| | | |
| | | æ¬æ¬¡ä¸º **å
¼å®¹å¼å级**ï¼æ¥å£ URLã请æ±åæ°ãè¿ååæ®µä¿æä¸åã |
| | | 主è¦åæ´æ¯é¦é¡µè´¢å¡æ°æ®ä»å ä½/åæåé»è¾ï¼åæ¢ä¸ºæè´¢å¡ç宿°æ®å£å¾è®¡ç®ã |
| | | |
| | | æ¶åæ¥å£ï¼ |
| | | |
| | | 1. `GET /home/statisticsReceivablePayable` |
| | | 2. `GET /home/monthlyIncome` |
| | | 3. `GET /home/monthlyExpenditure` |
| | | |
| | | ## 2. åæ°è¯´æï¼æ æ°å¢ï¼ |
| | | |
| | | ### 2.1 `GET /home/statisticsReceivablePayable` |
| | | |
| | | - `type`ï¼`1` æ¬å¨ï¼`2` æ¬æï¼`3` æ¬å£åº¦ï¼é»è®¤ `1`ï¼ |
| | | |
| | | ### 2.2 `GET /home/monthlyIncome` |
| | | |
| | | - æ åæ° |
| | | |
| | | ### 2.3 `GET /home/monthlyExpenditure` |
| | | |
| | | - æ åæ° |
| | | |
| | | ## 3. è¿ååæ®µå£å¾åæ´ |
| | | |
| | | ### 3.1 åºæ¶åºä»ç»è®¡ `statisticsReceivablePayable` |
| | | |
| | | è¿ååæ®µä¸åï¼ |
| | | |
| | | - `receivableMoney` |
| | | - `payableMoney` |
| | | - `advanceMoney` |
| | | - `prepayMoney` |
| | | |
| | | æ°å£å¾ï¼ |
| | | |
| | | - `receivableMoney = max(éå®ååéé¢å计 - æ¶æ¬¾éé¢å计, 0)` |
| | | - `payableMoney = max(éè´ååéé¢å计 - 仿¬¾éé¢å计, 0)` |
| | | - `advanceMoney = æ¶æ¬¾éé¢å计` |
| | | - `prepayMoney = 仿¬¾éé¢å计` |
| | | |
| | | 以ä¸éé¢åæ `type` å¯¹åºæ¶é´èå´ç»è®¡ï¼ä¿ç两ä½å°æ°ã |
| | | |
| | | è¿å示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "receivableMoney": 128000.00, |
| | | "payableMoney": 76000.00, |
| | | "advanceMoney": 42000.00, |
| | | "prepayMoney": 31000.00 |
| | | } |
| | | ``` |
| | | |
| | | ### 3.2 æåº¦æ¶å
¥ `monthlyIncome` |
| | | |
| | | è¿ååæ®µä¸åï¼ |
| | | |
| | | - `monthlyIncome` |
| | | - `collectionRate` |
| | | - `overdueNum` |
| | | - `overdueRate` |
| | | |
| | | æ°å£å¾ï¼ |
| | | |
| | | - `monthlyIncome`ï¼å½ææ¶æ¬¾å计 |
| | | - `collectionRate`ï¼`å½ææ¶æ¬¾å计 / 彿éå®ååéé¢å计 * 100` |
| | | - `overdueNum`ï¼åå²åºæ¶å¯¹è´¦åï¼`account_statement.account_type=1`ï¼ä¸ï¼æ©äºå½æä¸ `closing_balance > 0` çæ°é |
| | | - `overdueRate`ï¼`overdueNum / åå²åºæ¶å¯¹è´¦åæ»æ° * 100` |
| | | |
| | | è¿å示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "monthlyIncome": 89500.00, |
| | | "collectionRate": "62.80", |
| | | "overdueNum": 4, |
| | | "overdueRate": "18.18" |
| | | } |
| | | ``` |
| | | |
| | | ### 3.3 æåº¦æ¯åº `monthlyExpenditure` |
| | | |
| | | è¿ååæ®µä¸åï¼ |
| | | |
| | | - `monthlyExpenditure` |
| | | - `paymentRate` |
| | | - `grossProfit` |
| | | - `profitMarginRate` |
| | | |
| | | æ°å£å¾ï¼ |
| | | |
| | | - `monthlyExpenditure`ï¼å½æä»æ¬¾å计 |
| | | - `paymentRate`ï¼`彿仿¬¾å计 / 彿éè´ååéé¢å计 * 100` |
| | | - `grossProfit`ï¼`å½ææ¶æ¬¾å计 - 彿仿¬¾å计` |
| | | - `profitMarginRate`ï¼`grossProfit / å½ææ¶æ¬¾å计 * 100` |
| | | |
| | | è¿å示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "monthlyExpenditure": 73400.00, |
| | | "paymentRate": "57.34", |
| | | "grossProfit": 16100.00, |
| | | "profitMarginRate": "17.99" |
| | | } |
| | | ``` |
| | | |
| | | ## 4. å端èè°è¯´æ |
| | | |
| | | 1. åç«¯åæ®µæ å°æ éè°æ´ï¼å¯ç´æ¥æ²¿ç¨ç°æè§£æé»è¾ã |
| | | 2. ç¾åæ¯å段ä»ä¸ºä¸å¸¦ `%` çå符串ï¼å端å¦éå±ç¤º `%` 请继ç»åç«¯æ¼æ¥ã |
| | | 3. æ¬æ¬¡å端è¿åå¼ç±çå®è´¢å¡æ°æ®é©±å¨ï¼å»ºè®®éç¹åå½å¡çæ±æ»ä¸è¶å¿å¾çæ°å¼èå¨ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | ALTER TABLE approve_process |
| | | ADD COLUMN start_date_time datetime DEFAULT NULL COMMENT 'åºå·®å¼å§æ¶é´', |
| | | ADD COLUMN end_date_time datetime DEFAULT NULL COMMENT 'åºå·®ç»ææ¶é´'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # è´¢å¡æºè½ä½å端èè°ææ¡£ |
| | | |
| | | ## 1. 模å说æ |
| | | |
| | | è´¢å¡æºè½ä½å端已æ°å¢ç»ä¸å
¥å£ `financial-ai`ï¼ç¨äºä¸è´¢ä¸ä½ååæï¼è¦çï¼ |
| | | |
| | | - æºè½ææ¬æ ¸ç® |
| | | - 订å婿¶¦åæ |
| | | - åºåèµéåæ |
| | | - åºæ¶åºä»ä¸ç°éæµé¢æµ |
| | | - ç»è¥å¼å¸¸é¢è¦ |
| | | - AI ç»è¥é©¾é©¶è± |
| | | - æ¥æ¥/卿¥èªå¨çæ |
| | | - è´¢å¡ç¥è¯æ£ç´¢ï¼è½»é RAG ä¸ä¸æï¼ |
| | | |
| | | æ¥å£éç¨ **SSE æµå¼è¾åº**ï¼å·¥å
·å½ä¸æ¶è¿åç»æå JSON å符串ã |
| | | |
| | | ## 2. æ¥å£æ¸
å |
| | | |
| | | ### 2.1 å¯¹è¯æ¥å£ï¼SSEï¼ |
| | | |
| | | - `POST /financial-ai/chat` |
| | | - `Content-Type: application/json` |
| | | - `Accept: text/stream;charset=utf-8` |
| | | |
| | | 请æ±ä½ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "memoryId": "finance-uuid-001", |
| | | "message": "æ¥è¯¢è¿30å¤©äºæè®¢å" |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | - `memoryId`ï¼ä¼è¯å¯ä¸æ è¯ï¼åç«¯çæ UUIDï¼åä¼è¯å¤ç¨ï¼ |
| | | - `message`ï¼èªç¶è¯è¨é®é¢ |
| | | |
| | | --- |
| | | |
| | | ### 2.2 ä¼è¯å表 |
| | | |
| | | - `GET /financial-ai/history/sessions` |
| | | |
| | | --- |
| | | |
| | | ### 2.3 ä¼è¯æ¶æ¯ |
| | | |
| | | - `GET /financial-ai/history/messages/{memoryId}` |
| | | |
| | | --- |
| | | |
| | | ### 2.4 å é¤ä¼è¯ |
| | | |
| | | - `DELETE /financial-ai/history/{memoryId}` |
| | | |
| | | ## 3. SSE è¿åå¤çè§è |
| | | |
| | | ### 3.1 è¿åå½¢æ |
| | | |
| | | - æ®éé®çï¼æµå¼ææ¬ç段 |
| | | - å·¥å
·å½ä¸ï¼å®æ´ JSON å符串ï¼é叏䏿¬¡æ§è¾åºï¼ä¹å¯è½åçï¼ |
| | | |
| | | å端建议å¤çæµç¨ï¼ |
| | | |
| | | 1. å° SSE åçæé¡ºåºæ¼æ¥æ `rawText` |
| | | 2. 对 `rawText` å°è¯ `JSON.parse` |
| | | 3. è¥å¯è§£æï¼æ `type` å忏²æå¾è¡¨/è¡¨æ ¼ |
| | | 4. è¥ä¸å¯è§£æï¼ææ®éææ¬å±ç¤º |
| | | |
| | | ### 3.2 ç»æå JSON éç¨æ ¼å¼ |
| | | |
| | | ```json |
| | | { |
| | | "success": true, |
| | | "type": "financial_order_profit_analysis", |
| | | "description": "å·²å®æè®¢å婿¶¦åæ", |
| | | "summary": {}, |
| | | "data": {}, |
| | | "charts": {} |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | - `type`ï¼ç»æç±»åï¼å端渲æååé®ï¼ |
| | | - `summary`ï¼å¤´é¨ææ |
| | | - `data`ï¼è¡¨æ ¼æç»/建议å表 |
| | | - `charts`ï¼ECharts `option` æ°æ® |
| | | |
| | | ## 4. type ä¸åç«¯é¡µé¢æ å° |
| | | |
| | | 建议æ `type` å»ºç«æ¸²æçç¥ï¼ |
| | | |
| | | - `financial_cost_accounting`ï¼ææ¬æ ¸ç®é¡µ |
| | | - `financial_order_profit_analysis`ï¼è®¢å婿¶¦é¡µ |
| | | - `financial_inventory_capital_analysis`ï¼åºåèµé页 |
| | | - `financial_cashflow_forecast`ï¼ç°éæµé¡µ |
| | | - `financial_business_anomaly_warning`ï¼é£é©é¢è¦é¡µ |
| | | - `financial_business_cockpit`ï¼ç»è¥é©¾é©¶è± |
| | | - `financial_operation_report`ï¼æ¥æ¥å¨æ¥é¡µ |
| | | - `financial_rag_knowledge`ï¼ç¥è¯æ£ç´¢/å£å¾è¯´æå¡ç |
| | | |
| | | ## 5. å
³é®æ°æ®å段ï¼èè°éç¹ï¼ |
| | | |
| | | ### 5.1 ææ¬/婿¶¦ç±» |
| | | |
| | | - `data.orders[]`ï¼ |
| | | - `salesContractNo` |
| | | - `customerName` |
| | | - `revenue` |
| | | - `materialCost` |
| | | - `laborCost` |
| | | - `depreciationCost` |
| | | - `scrapCost` |
| | | - `totalCost` |
| | | - `profit` |
| | | - `profitRate` |
| | | - `riskLevel` |
| | | - `reasons` |
| | | - `suggestion` |
| | | |
| | | ### 5.2 åºåèµéç±» |
| | | |
| | | - `data.items[]`ï¼ |
| | | - `productName` |
| | | - `model` |
| | | - `quantity` |
| | | - `inventoryValue` |
| | | - `stagnantDays` |
| | | - `overstock` |
| | | - `riskLevel` |
| | | |
| | | ### 5.3 ç°éæµç±» |
| | | |
| | | - `data.actualMonthly[]` / `data.forecastMonthly[]`ï¼ |
| | | - `month` |
| | | - `income` |
| | | - `expense` |
| | | - `netFlow` |
| | | - `data.receivableRiskTop[]` / `data.payablePressureTop[]` |
| | | |
| | | ### 5.4 å¼å¸¸é¢è¦ç±» |
| | | |
| | | - `data.items[]`ï¼ |
| | | - `riskLevel` |
| | | - `type` |
| | | - `message` |
| | | - `detail` |
| | | |
| | | ### 5.5 æ¥åç±» |
| | | |
| | | - `data.headline` |
| | | - `data.conclusions[]` |
| | | - `data.riskSuggestions[]` |
| | | - `data.orderProfitTop[]` |
| | | |
| | | ## 6. å¾è¡¨èè°è§è |
| | | |
| | | `charts` å
åæ®µå为 ECharts `option`ï¼å¯ç´æ¥åç»å¾è¡¨ç»ä»¶ã |
| | | |
| | | 常è§åæ®µï¼ |
| | | |
| | | - æ±ç¶å¾ï¼`orderProfitBarOption` / `processCostBarOption` / `inventoryValueTopOption` |
| | | - 饼å¾ï¼`costCompositionPieOption` / `inventoryAgingPieOption` / `anomalyLevelPieOption` |
| | | - è¶å¿å¾ï¼`cashFlowTrendOption` |
| | | - 仪表çï¼`fundGapGaugeOption` / `inventoryTurnoverGauge` |
| | | |
| | | ## 7. æ¨èå端é®å¥ï¼å彿µè¯ï¼ |
| | | |
| | | 1. `æ¥çæ¬æç»è¥é©¾é©¶è±` |
| | | 2. `æ¥è¯¢è¿30å¤©äºæè®¢å` |
| | | 3. `åæè¿30天åºåèµéå ç¨` |
| | | 4. `颿µæªæ¥3个æç°éæµ` |
| | | 5. `çææ¬å¨ç»è¥å¨æ¥` |
| | | 6. `为ä»ä¹å©æ¶¦ä¸é` |
| | | 7. `åªä¸ªå®¢æ·æèµé±` |
| | | 8. `åªä¸ªå·¥åºææ¬æé«` |
| | | |
| | | ## 8. å¼å¸¸ä¸å
åºå¤ç |
| | | |
| | | - `memoryId` 为空ï¼è¿åææ¬ `memoryIdä¸è½ä¸ºç©º` |
| | | - `message` 为空ï¼è¿åææ¬ `messageä¸è½ä¸ºç©º` |
| | | - æ æ°æ®åºæ¯ï¼`success=true` ä¸ `data.items=[]`ï¼å端æç©ºæå±ç¤º |
| | | - é JSON æµè¿åï¼ææ®éèå¤©ææ¬å±ç¤º |
| | | |
| | | ## 9. èè°å»ºè®® |
| | | |
| | | 1. å
å `type` ååå¨ï¼ä¿è¯ææç»æåç»æå¯è½å°ï¼ |
| | | 2. ååæè¦å¡çï¼`summary`ï¼+ è¡¨æ ¼ï¼`data`ï¼+ å¾è¡¨ï¼`charts`ï¼ |
| | | 3. æåè¡¥ä¼è¯åå²ä¸å é¤è½åï¼å½¢æå®æ´å¯¹è¯éç¯ |
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://localhost:3300/product-inventory-management-new-pro"; |
| | | public static String database_url = "jdbc:mysql://localhost:3306/product-inventory-management-new-pro"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "root"; |
| | | public static String database_password= "123456"; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "sales"; // 模å |
| | | public static String model = "account"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/ReportDateDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2026/1/16 16:57 |
| | | */ |
| | | |
| | | @Data |
| | | public class ReportDateDto { |
| | | @Schema(name = "AccountReportDto", description = "è´¢å¡æ¥è¡¨--æ¥æåæ°") |
| | | public class AccountReportDto { |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateEnd; |
| | | |
| | | /** |
| | | * å¼å§æä»½ |
| | | */ |
| | | private Integer startMonth; |
| | | |
| | | /** |
| | | * ç»ææä»½ |
| | | */ |
| | | private Integer endMonth; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "StatementAccountDto", description = "è´¢å¡ç®¡ç--çæå¯¹è´¦å(ä¼ å)") |
| | | public class StatementAccountDto { |
| | | |
| | | //ä¸å¡ç±»å(1åºæ¶å¯¹è´¦;2åºä»å¯¹è´¦) |
| | | @Schema(name = "accountType", description = "ä¸å¡ç±»å(1åºæ¶å¯¹è´¦;2åºä»å¯¹è´¦)") |
| | | private Integer accountType; |
| | | |
| | | //éæ©ç客æ·(åºæ¶æ¯å®¢æ·,åºä»æ¯ä¾åºåsupplierId) |
| | | @Schema(name = "customerId", description = "客æ·ID") |
| | | private Long customerId; |
| | | |
| | | //对账æä»½yyyy-MM |
| | | @Schema(name = "statementMonth", description = "对账æä»½") |
| | | private String statementMonth; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.purchase; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPaymentApplicationDto", description = "è´¢å¡ç®¡ç--仿¬¾ç³è¯·å°è´¦(ä¼ å)") |
| | | public class AccountPaymentApplicationDto { |
| | | |
| | | @Schema(description = "ä¾åºåID") |
| | | private Integer supplierId; |
| | | |
| | | @Schema(description = "ç³è¯·åå·") |
| | | private String invoiceApplicationNo; |
| | | |
| | | @Schema(description = "å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.purchase; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPurchaseInvoiceDto", description = "è´¢å¡ç®¡ç--è¿é¡¹å票å°è´¦(ä¼ å)") |
| | | public class AccountPurchaseInvoiceDto { |
| | | |
| | | @Schema(description = "ä¾åºåID") |
| | | private Integer supplierId; |
| | | |
| | | @Schema(description = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | @Schema(description = "ç¶æ") |
| | | private Integer status; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.purchase; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPurchasePaymentDto", description = "è´¢å¡ç®¡ç--仿¬¾åå°è´¦(ä¼ å)") |
| | | public class AccountPurchasePaymentDto { |
| | | |
| | | @Schema(description = "ä¾åºåID") |
| | | private Integer supplierId; |
| | | |
| | | @Schema(description = "仿¬¾åå·") |
| | | private String paymentNumber; |
| | | |
| | | @Schema(description = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseInboundDto", description = "è´¢å¡ç®¡ç--éè´å
¥åºå°è´¦(ä¼ å)") |
| | |
| | | @Schema(description = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | private LocalDate endDate; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseReturnDto", description = "è´¢å¡ç®¡ç--éè´éè´§å°è´¦(ä¼ å)") |
| | |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | private LocalDate endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.sales; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountInvoiceApplicationDto", description = "è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯·å°è´¦(ä¼ å)") |
| | | public class AccountInvoiceApplicationDto { |
| | | |
| | | @Schema(description = "客æ·ID") |
| | | private Integer customerId; |
| | | |
| | | @Schema(description = "ç³è¯·åå·") |
| | | private String invoiceApplicationNo; |
| | | |
| | | @Schema(description = "å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.sales; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountSalesCollectionDto", description = "è´¢å¡ç®¡ç--æ¶æ¬¾åå°è´¦(ä¼ å)") |
| | | public class AccountSalesCollectionDto { |
| | | |
| | | @Schema(description = "客æ·ID") |
| | | private Integer customerId; |
| | | |
| | | @Schema(description = "æ¶æ¬¾åå·") |
| | | private String collectionNumber; |
| | | |
| | | @Schema(description = "æ¶æ¬¾æ¹å¼") |
| | | private String collectionMethod; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.sales; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountSalesInvoiceDto", description = "è´¢å¡ç®¡ç--é项å票å°è´¦(ä¼ å)") |
| | | public class AccountSalesInvoiceDto { |
| | | |
| | | @Schema(description = "客æ·ID") |
| | | private Integer customerId; |
| | | |
| | | @Schema(description = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | @Schema(description = "ç¶æ") |
| | | private Integer status; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesOutboundDto", description = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦(ä¼ å)") |
| | |
| | | @Schema(description = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | private LocalDate endDate; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesReturnDto", description = "è´¢å¡ç®¡ç--éå®éè´§å°è´¦(ä¼ å)") |
| | |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | private LocalDate endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Data |
| | | @Schema(name = "AccountReportVo", description = "è´¢å¡æ¥è¡¨--è¿ååæ°") |
| | | public class AccountReportVo { |
| | | |
| | | @Schema(description = "æ»è¥æ¶") |
| | | private BigDecimal totalIncome; |
| | | |
| | | @Schema(description = "æ»æ¯åº") |
| | | private BigDecimal totalExpense; |
| | | |
| | | @Schema(description = "åºæ¶è´¦æ¬¾") |
| | | private BigDecimal accountsReceivable; |
| | | |
| | | @Schema(description = "åºä»è´¦æ¬¾") |
| | | private BigDecimal accountsPayable; |
| | | |
| | | @Schema(description = "åæ¶å
¥") |
| | | private BigDecimal netRevenue; |
| | | |
| | | // --- æçº¿å¾ï¼æåº¦è¶å¿æ°æ® --- |
| | | @Schema(description = "æåº¦è¶å¿æ°æ®å表") |
| | | private List<MonthlyTrendVO> monthlyTrendList; |
| | | |
| | | // --- æ±ç¶å¾ï¼åºæ¶åºä»æåº¦æ°æ® --- |
| | | @Schema(description = "åºæ¶åºä»æåº¦æ°æ®å表") |
| | | private List<ReceivablePayableVO> receivablePayableList; |
| | | |
| | | @Data |
| | | @Schema(description = "æåº¦è¶å¿VOï¼æçº¿å¾ç¨ï¼") |
| | | public static class MonthlyTrendVO { |
| | | @Schema(description = "æä»½ï¼æ ¼å¼ï¼yyyy-MM") |
| | | private String month; |
| | | |
| | | @Schema(description = "å½æè¥æ¶") |
| | | private BigDecimal income; |
| | | |
| | | @Schema(description = "彿æ¯åº") |
| | | private BigDecimal expense; |
| | | |
| | | @Schema(description = "彿å婿¶¦") |
| | | private BigDecimal profit; |
| | | } |
| | | |
| | | @Data |
| | | @Schema(description = "åºæ¶åºä»æåº¦VOï¼æ±ç¶å¾ç¨ï¼") |
| | | public static class ReceivablePayableVO { |
| | | @Schema(description = "æä»½ï¼æ ¼å¼ï¼yyyy-MM") |
| | | private String month; |
| | | |
| | | @Schema(description = "åºæ¶è´¦æ¬¾éé¢") |
| | | private BigDecimal receivable; |
| | | |
| | | @Schema(description = "åºä»è´¦æ¬¾éé¢") |
| | | private BigDecimal payable; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Schema(name = "StatementAccountVo", description = "è´¢å¡ç®¡ç--对账å详æ
(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class StatementAccountVo extends AccountStatement { |
| | | |
| | | //客æ·åç§°(åºæ¶æ¯å®¢æ·,åºä»æ¯ä¾åºå) |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | //对账æç» |
| | | @Schema(description = "对账æç»") |
| | | private List<AccountStatementDetails> accountStatementDetails; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.purchase; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPaymentApplicationVo", description = "è´¢å¡ç®¡ç--仿¬¾ç³è¯·å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountPaymentApplicationVo extends AccountPaymentApplication { |
| | | |
| | | @Schema(description = "ä¾åºååç§°") |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å
¥åºåå·") |
| | | @Excel(name = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.purchase; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPurchaseInvoiceVo", description = "è´¢å¡ç®¡ç--è¿é¡¹å票å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountPurchaseInvoiceVo extends AccountPurchaseInvoice { |
| | | |
| | | @Schema(description = "ä¾åºååç§°") |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.purchase; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountPurchasePaymentVo", description = "è´¢å¡ç®¡ç--仿¬¾åå°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountPurchasePaymentVo extends AccountPurchasePayment { |
| | | |
| | | @Schema(description = "ä¾åºååç§°") |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "仿¬¾ç³è¯·åå·") |
| | | @Excel(name = "仿¬¾ç³è¯·åå·") |
| | | private String invoiceApplicationNo; |
| | | |
| | | @Schema(description = "弿·è¡") |
| | | @Excel(name = "弿·è¡") |
| | | private String bankAccountName; |
| | | |
| | | @Schema(description = "é¶è¡è´¦å·") |
| | | @Excel(name = "é¶è¡è´¦å·") |
| | | private String bankAccountNum; |
| | | |
| | | @Schema(description = "æ¯å¦çæäºå¯¹è´¦å") |
| | | private boolean isAccountStatemen; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseInboundVo", description = "è´¢å¡ç®¡ç--éè´å
¥åºå°è´¦(è¿å)") |
| | |
| | | @Schema(description = "å
¥åºæ¥æ") |
| | | @Excel(name = "å
¥åºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date InboundDate; |
| | | private LocalDate InboundDate; |
| | | |
| | | @Schema(description = "产ååç§°") |
| | | @Excel(name = "产ååç§°") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.sales; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.sales.AccountInvoiceApplication; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountInvoiceApplicationVo", description = "è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯·å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountInvoiceApplicationVo extends AccountInvoiceApplication { |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | @Excel(name = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.sales; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountSalesCollectionVo", description = "è´¢å¡ç®¡ç--æ¶æ¬¾åå°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountSalesCollectionVo extends AccountSalesCollection { |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | @Excel(name = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | @Schema(description = "æ¯å¦çæäºå¯¹è´¦å") |
| | | private boolean isAccountStatemen; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.sales; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "AccountSalesInvoiceVo", description = "è´¢å¡ç®¡ç--é项å票å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class AccountSalesInvoiceVo extends AccountSalesInvoice { |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "SalesOutboundVo", description = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦(è¿å)") |
| | |
| | | @Schema(description = "åºåºæ¥æ") |
| | | @Excel(name = "åºåºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date shippingDate; |
| | | private LocalDate shippingDate; |
| | | |
| | | @Schema(description = "产ååç§°") |
| | | @Excel(name = "产ååç§°") |
| | |
| | | @Excel(name = "éé¢") |
| | | private BigDecimal outboundAmount; |
| | | |
| | | @Schema(description = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | @Schema(description = "åè´§ç¼å·") |
| | | @Excel(name = "åè´§ç¼å·") |
| | | private String shippingNo; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.StatementAccountDto; |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.service.AccountStatementService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountStatement") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ç-对账å") |
| | | public class AccountStatementController { |
| | | |
| | | private final AccountStatementService accountStatementService; |
| | | |
| | | @GetMapping("/getAccountStatementDetailsByMonth") |
| | | @Log(title = "æ ¹æ®å®¢æ·åæä»½æ¥è¯¢å¯¹è´¦åæç»", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ ¹æ®å®¢æ·åæä»½æ¥è¯¢å¯¹è´¦åæç»") |
| | | public R getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto) { |
| | | return R.ok(accountStatementService.getAccountStatementDetailsByMonth(statementAccountDto)); |
| | | } |
| | | |
| | | @PostMapping("/addAccountStatement") |
| | | @Log(title = "æ°å¢å¯¹è´¦å", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢å¯¹è´¦å") |
| | | public R addAccountStatement(@RequestBody StatementAccountVo statementAccountVo) { |
| | | return R.ok(accountStatementService.addAccountStatement(statementAccountVo)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountStatement") |
| | | @Log(title = "å é¤å¯¹è´¦å", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤å¯¹è´¦å") |
| | | public R deleteAccountStatement(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountStatementService.deleteAccountStatement(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @GetMapping("/listPageAccountStatement") |
| | | @Log(title = "对账åå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--对账åå°è´¦") |
| | | public R<IPage<StatementAccountVo>> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto) { |
| | | IPage<StatementAccountVo> listPage = accountStatementService.listPageAccountStatement(page,statementAccountDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountStatement") |
| | | @Operation(summary = "导åºå¯¹è´¦åæä»¶") |
| | | @Log(title = "导åºå¯¹è´¦åæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto) { |
| | | accountStatementService.exportAccountStatement(response,statementAccountDto); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.service.impl.AccountingServiceImpl; |
| | | import com.ruoyi.account.bean.dto.AccountReportDto; |
| | | import com.ruoyi.account.service.AccountingService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | @Tag(name = "ä¼è®¡æ ¸ç®") |
| | | @RestController |
| | | @RequestMapping("/accounting") |
| | | @AllArgsConstructor |
| | | @RequiredArgsConstructor |
| | | public class AccountingController extends BaseController { |
| | | |
| | | |
| | | private AccountingServiceImpl accountingService; |
| | | private final AccountingService accountingService; |
| | | |
| | | @Operation(summary = "æ»è®¡") |
| | | @GetMapping("/total") |
| | | public R<?> total(@RequestParam Integer year) { |
| | | public AjaxResult total(@RequestParam Integer year) { |
| | | return accountingService.total(year); |
| | | } |
| | | |
| | | @Operation(summary = "设å¤ç±»ååå¸") |
| | | @GetMapping("/deviceTypeDistribution") |
| | | public R<?> deviceTypeDistribution(@RequestParam Integer year) { |
| | | public AjaxResult deviceTypeDistribution(@RequestParam Integer year) { |
| | | return accountingService.deviceTypeDistribution(year); |
| | | } |
| | | |
| | | @Operation(summary = "设å¤å页æ¥è¯¢è®¡ç®ææ§") |
| | | @GetMapping("/calculateDepreciation") |
| | | public R<?> calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | public AjaxResult calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | return accountingService.calculateDepreciation(page,year); |
| | | } |
| | | |
| | | /*****************************************è´¢å¡æ¥è¡¨******************************************************************************/ |
| | | |
| | | @GetMapping("/accountStatementDetailsByMonth") |
| | | @Log(title = "è´¢å¡æ¥è¡¨", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨") |
| | | public R getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) { |
| | | return R.ok(accountingService.getAccountStatementDetailsByMonth(accountReportDto)); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import com.ruoyi.account.service.purchase.AccountPaymentApplicationService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾ç³è¯· å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:44:22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountPaymentApplication") |
| | | @Tag(name = "è´¢å¡ç®¡ç--仿¬¾ç³è¯·") |
| | | @RequiredArgsConstructor |
| | | public class AccountPaymentApplicationController { |
| | | |
| | | private final AccountPaymentApplicationService accountPaymentApplicationService; |
| | | |
| | | @GetMapping("/listPageAccountPaymentApplication") |
| | | @Log(title = "仿¬¾ç³è¯·å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--仿¬¾ç³è¯·å°è´¦") |
| | | public R<IPage<AccountPaymentApplicationVo>> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto) { |
| | | IPage<AccountPaymentApplicationVo> listPage = accountPaymentApplicationService.listPageAccountPaymentApplication(page,accountPaymentApplicationDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/getInboundBatchesBySupplier") |
| | | @Log(title = "æ ¹æ®ä¾åºåæ¥è¯¢å
¥åºåå·(仿¬¾ç³è¯·)", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ ¹æ®ä¾åºåæ¥è¯¢å
¥åºåå·(仿¬¾ç³è¯·)") |
| | | public R getInboundBatchesBySupplier(Integer supplierId) { |
| | | return R.ok(accountPaymentApplicationService.getInboundBatchesBySupplier(supplierId)); |
| | | } |
| | | |
| | | @PostMapping("/addAccountPaymentApplication") |
| | | @Log(title = "æ°å¢ä»æ¬¾ç³è¯·", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢ä»æ¬¾ç³è¯·") |
| | | public R addAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) { |
| | | return R.ok(accountPaymentApplicationService.addAccountPaymentApplication(accountPaymentApplication)); |
| | | } |
| | | |
| | | @PutMapping("/updateAccountPaymentApplication") |
| | | @Log(title = "ä¿®æ¹ä»æ¬¾ç³è¯·", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ä¿®æ¹ä»æ¬¾ç³è¯·") |
| | | public R updateAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) { |
| | | return R.ok(accountPaymentApplicationService.updateById(accountPaymentApplication)); |
| | | } |
| | | |
| | | @PutMapping("/auditAccountPaymentApplication") |
| | | @Log(title = "å®¡æ ¸ä»æ¬¾ç³è¯·", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å®¡æ ¸ä»æ¬¾ç³è¯·") |
| | | public R auditAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) { |
| | | return R.ok(accountPaymentApplicationService.updateById(accountPaymentApplication)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountPaymentApplication") |
| | | @Log(title = "å é¤ä»æ¬¾ç³è¯·", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤ä»æ¬¾ç³è¯·") |
| | | public R deleteAccountPaymentApplication(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountPaymentApplicationService.deleteAccountPaymentApplication(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountPaymentApplication") |
| | | @Operation(summary = "导åºä»æ¬¾ç³è¯·æä»¶") |
| | | @Log(title = "导åºä»æ¬¾ç³è¯·æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto) { |
| | | accountPaymentApplicationService.exportAccountPaymentApplication(response,accountPaymentApplicationDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import com.ruoyi.account.service.purchase.AccountPurchaseInvoiceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--è¿é¡¹å票 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:06:17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountPurchaseInvoice") |
| | | @Tag(name = "è´¢å¡ç®¡ç--è¿é¡¹å票") |
| | | @RequiredArgsConstructor |
| | | public class AccountPurchaseInvoiceController { |
| | | |
| | | private final AccountPurchaseInvoiceService accountPurchaseInvoiceService; |
| | | |
| | | @GetMapping("/listPageAccountPurchaseInvoice") |
| | | @Log(title = "è¿é¡¹å票å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--è¿é¡¹å票å°è´¦") |
| | | public R<IPage<AccountPurchaseInvoiceVo>> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) { |
| | | IPage<AccountPurchaseInvoiceVo> listPage = accountPurchaseInvoiceService.listPageAccountPurchaseInvoice(page,accountPurchaseInvoiceDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/getInboundBatchesBySupplier") |
| | | @Log(title = "æ ¹æ®ä¾åºåæ¥è¯¢å
¥åºåå·(è¿é¡¹å票)", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ ¹æ®ä¾åºåæ¥è¯¢å
¥åºåå·(è¿é¡¹å票)") |
| | | public R getInboundBatchesBySupplier(Integer supplierId) { |
| | | return R.ok(accountPurchaseInvoiceService.getInboundBatchesBySupplier(supplierId)); |
| | | } |
| | | |
| | | @PostMapping("/addAccountPurchaseInvoice") |
| | | @Log(title = "æ°å¢è¿é¡¹å票", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢è¿é¡¹å票") |
| | | public R addAccountPurchaseInvoice(@RequestBody AccountPurchaseInvoice accountPurchaseInvoice) { |
| | | return R.ok(accountPurchaseInvoiceService.save(accountPurchaseInvoice)); |
| | | } |
| | | |
| | | @PutMapping("/cancelAccountPurchaseInvoice") |
| | | @Log(title = "ä½åºè¿é¡¹å票", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ä½åºé项å票") |
| | | public R cancelAccountPurchaseInvoice(@RequestBody AccountPurchaseInvoice accountPurchaseInvoice) { |
| | | return R.ok(accountPurchaseInvoiceService.updateById(accountPurchaseInvoice)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountPurchaseInvoice") |
| | | @Log(title = "å é¤è¿é¡¹å票", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤è¿é¡¹å票") |
| | | public R deleteAccountPurchaseInvoice(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountPurchaseInvoiceService.deleteAccountPurchaseInvoice(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountPurchaseInvoice") |
| | | @Operation(summary = "导åºè¿é¡¹å票æä»¶") |
| | | @Log(title = "导åºè¿é¡¹å票æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) { |
| | | accountPurchaseInvoiceService.exportAccountPurchaseInvoice(response,accountPurchaseInvoiceDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.service.purchase.AccountPurchasePaymentService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾å å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 04:14:51 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountPurchasePayment") |
| | | @Tag(name = "è´¢å¡ç®¡ç--仿¬¾å") |
| | | @RequiredArgsConstructor |
| | | public class AccountPurchasePaymentController { |
| | | |
| | | private final AccountPurchasePaymentService accountPurchasePaymentService; |
| | | |
| | | @GetMapping("/listPageAccountPurchasePayment") |
| | | @Log(title = "仿¬¾åå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--仿¬¾åå°è´¦") |
| | | public R<IPage<AccountPurchasePaymentVo>> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto) { |
| | | IPage<AccountPurchasePaymentVo> listPage = accountPurchasePaymentService.listPageAccountPurchasePayment(page,accountPurchasePaymentDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/addAccountPurchasePayment") |
| | | @Log(title = "æ°å¢ä»æ¬¾å", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢ä»æ¬¾å") |
| | | public R addAccountPurchasePayment(@RequestBody AccountPurchasePayment accountPurchasePayment) { |
| | | return R.ok(accountPurchasePaymentService.addAccountPurchasePayment(accountPurchasePayment)); |
| | | } |
| | | |
| | | @PutMapping("/updateAccountPurchasePayment") |
| | | @Log(title = "ç¼è¾ä»æ¬¾å", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ç¼è¾ä»æ¬¾å") |
| | | public R updateAccountPurchasePayment(@RequestBody AccountPurchasePayment accountPurchasePayment) { |
| | | return R.ok(accountPurchasePaymentService.updateById(accountPurchasePayment)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountPurchasePayment") |
| | | @Log(title = "å é¤ä»æ¬¾å", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤ä»æ¬¾å") |
| | | public R deleteAccountPurchasePayment(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountPurchasePaymentService.deleteAccountPurchasePayment(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountPurchasePayment") |
| | | @Operation(summary = "导åºä»æ¬¾åæä»¶") |
| | | @Log(title = "导åºä»æ¬¾åæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto) { |
| | | accountPurchasePaymentService.exportAccountPurchasePayment(response,accountPurchasePaymentDto); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo; |
| | | import com.ruoyi.account.pojo.sales.AccountInvoiceApplication; |
| | | import com.ruoyi.account.service.sales.AccountInvoiceApplicationService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯· å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 01:38:32 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountInvoiceApplication") |
| | | @Tag(name = "è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯·") |
| | | @RequiredArgsConstructor |
| | | public class AccountInvoiceApplicationController { |
| | | |
| | | private final AccountInvoiceApplicationService accountInvoiceApplicationService; |
| | | |
| | | @GetMapping("/listPageAccountInvoiceApplication") |
| | | @Log(title = "å¼ç¥¨ç³è¯·å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯·å°è´¦") |
| | | public R<IPage<AccountInvoiceApplicationVo>> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto) { |
| | | IPage<AccountInvoiceApplicationVo> listPage = accountInvoiceApplicationService.listPageAccountInvoiceApplication(page,accountInvoiceApplicationDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/getOutboundBatchesByCustomer") |
| | | @Log(title = "æ ¹æ®å®¢æ·æ¥è¯¢åºåºåå·(å¼ç¥¨ç³è¯·)", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ ¹æ®å®¢æ·æ¥è¯¢åºåºåå·(å¼ç¥¨ç³è¯·)") |
| | | public R getOutboundBatchesByCustomer(Integer customerId) { |
| | | return R.ok(accountInvoiceApplicationService.getOutboundBatchesByCustomer(customerId)); |
| | | } |
| | | |
| | | @PostMapping("/addAccountInvoiceApplication") |
| | | @Log(title = "æ°å¢å¼ç¥¨ç³è¯·", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢å¼ç¥¨ç³è¯·") |
| | | public R addAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) { |
| | | return R.ok(accountInvoiceApplicationService.addAccountInvoiceApplication(accountInvoiceApplication)); |
| | | } |
| | | |
| | | @PutMapping("/updateAccountInvoiceApplication") |
| | | @Log(title = "ä¿®æ¹å¼ç¥¨ç³è¯·", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ä¿®æ¹å¼ç¥¨ç³è¯·") |
| | | public R updateAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) { |
| | | return R.ok(accountInvoiceApplicationService.updateById(accountInvoiceApplication)); |
| | | } |
| | | |
| | | @PutMapping("/auditAccountInvoiceApplication") |
| | | @Log(title = "å®¡æ ¸å¼ç¥¨ç³è¯·", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å®¡æ ¸å¼ç¥¨ç³è¯·") |
| | | public R auditAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) { |
| | | return R.ok(accountInvoiceApplicationService.updateById(accountInvoiceApplication)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountInvoiceApplication") |
| | | @Log(title = "å é¤å¼ç¥¨ç³è¯·", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤å¼ç¥¨ç³è¯·") |
| | | public R deleteAccountInvoiceApplication(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountInvoiceApplicationService.deleteAccountInvoiceApplication(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountInvoiceApplication") |
| | | @Operation(summary = "导åºå¼ç¥¨ç³è¯·æä»¶") |
| | | @Log(title = "导åºå¼ç¥¨ç³è¯·æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto) { |
| | | accountInvoiceApplicationService.exportAccountInvoiceApplication(response,accountInvoiceApplicationDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.account.service.sales.AccountSalesCollectionService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--æ¶æ¬¾å å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:49:56 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountSalesCollection") |
| | | @Tag(name = "è´¢å¡ç®¡ç--æ¶æ¬¾å") |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesCollectionController { |
| | | |
| | | private final AccountSalesCollectionService accountSalesCollectionService; |
| | | |
| | | @GetMapping("/listPageAccountSalesCollection") |
| | | @Log(title = "æ¶æ¬¾åå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ¶æ¬¾åå°è´¦") |
| | | public R<IPage<AccountSalesCollectionVo>> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto) { |
| | | IPage<AccountSalesCollectionVo> listPage = accountSalesCollectionService.listPageAccountSalesCollection(page,accountSalesCollectionDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/getOutboundBatchesByCustomer") |
| | | @Log(title = "æ ¹æ®å®¢æ·æ¥è¯¢åºåºåå·(æ¶æ¬¾å)", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ ¹æ®å®¢æ·æ¥è¯¢åºåºåå·(æ¶æ¬¾å)") |
| | | public R getOutboundBatchesByCustomer(Integer customerId) { |
| | | return R.ok(accountSalesCollectionService.getOutboundBatchesByCustomer(customerId)); |
| | | } |
| | | |
| | | @PostMapping("/addAccountSalesCollection") |
| | | @Log(title = "æ°å¢æ¶æ¬¾å", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢æ¶æ¬¾å") |
| | | public R addAccountSalesCollection(@RequestBody AccountSalesCollection accountSalesCollection) { |
| | | return R.ok(accountSalesCollectionService.addAccountSalesCollection(accountSalesCollection)); |
| | | } |
| | | |
| | | @PutMapping("/updateAccountSalesCollection") |
| | | @Log(title = "ç¼è¾æ¶æ¬¾å", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ç¼è¾æ¶æ¬¾å") |
| | | public R updateAccountSalesCollection(@RequestBody AccountSalesCollection accountSalesCollection) { |
| | | return R.ok(accountSalesCollectionService.updateById(accountSalesCollection)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountSalesCollection") |
| | | @Log(title = "å 餿¶æ¬¾å", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å 餿¶æ¬¾å") |
| | | public R deleteAccountSalesCollection(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountSalesCollectionService.deleteAccountSalesCollection(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountSalesCollection") |
| | | @Operation(summary = "å¯¼åºæ¶æ¬¾åæä»¶") |
| | | @Log(title = "å¯¼åºæ¶æ¬¾åæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto) { |
| | | accountSalesCollectionService.exportAccountSalesCollection(response,accountSalesCollectionDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import com.ruoyi.account.service.sales.AccountSalesInvoiceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--é项å票 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:10:20 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountSalesInvoice") |
| | | @Tag(name = "è´¢å¡ç®¡ç--é项å票") |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesInvoiceController { |
| | | |
| | | private final AccountSalesInvoiceService accountSalesInvoiceService; |
| | | |
| | | @GetMapping("/listPageAccountSalesInvoice") |
| | | @Log(title = "é项å票å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--é项å票å°è´¦") |
| | | public R<IPage<AccountSalesInvoiceVo>> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto) { |
| | | IPage<AccountSalesInvoiceVo> listPage = accountSalesInvoiceService.listPageAccountSalesInvoice(page,accountSalesInvoiceDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/addAccountSalesInvoice") |
| | | @Log(title = "æ°å¢é项å票", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--æ°å¢é项å票") |
| | | public R addAccountSalesInvoice(@RequestBody AccountSalesInvoice accountSalesInvoice) { |
| | | return R.ok(accountSalesInvoiceService.save(accountSalesInvoice)); |
| | | } |
| | | |
| | | @PutMapping("/cancelAccountSalesInvoice") |
| | | @Log(title = "ä½åºé项å票", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--ä½åºé项å票") |
| | | public R cancelAccountSalesInvoice(@RequestBody AccountSalesInvoice accountSalesInvoice) { |
| | | return R.ok(accountSalesInvoiceService.updateById(accountSalesInvoice)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteAccountSalesInvoice") |
| | | @Log(title = "å é¤é项å票", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--å é¤é项å票") |
| | | public R deleteAccountSalesInvoice(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(accountSalesInvoiceService.deleteAccountSalesInvoice(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountSalesInvoice") |
| | | @Operation(summary = "导åºé项å票æä»¶") |
| | | @Log(title = "导åºé项å票æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto) { |
| | | accountSalesInvoiceService.exportAccountSalesInvoice(response,accountSalesInvoiceDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--对账åæç» Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 10:12:42 |
| | | */ |
| | | @Mapper |
| | | public interface AccountStatementDetailsMapper extends BaseMapper<AccountStatementDetails> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.StatementAccountDto; |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | @Mapper |
| | | public interface AccountStatementMapper extends BaseMapper<AccountStatement> { |
| | | |
| | | |
| | | IPage<StatementAccountVo> listPageAccountStatement(Page page, @Param("req") StatementAccountDto statementAccountDto); |
| | | |
| | | IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾ç³è¯· Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:44:22 |
| | | */ |
| | | @Mapper |
| | | public interface AccountPaymentApplicationMapper extends BaseMapper<AccountPaymentApplication> { |
| | | |
| | | IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, @Param("req") AccountPaymentApplicationDto accountPaymentApplicationDto); |
| | | |
| | | List<PurchaseInboundVo> getInboundBatchesBySupplier(@Param("supplierId") Integer supplierId); |
| | | |
| | | //å¤æè¯¥åºåºè®°å½æ¯å¦æå¼ç¥¨ç³è¯· |
| | | boolean existsByStockInRecordId(@Param("stockInRecordIds") List<Long> stockInRecordIds); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--è¿é¡¹å票 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:06:17 |
| | | */ |
| | | @Mapper |
| | | public interface AccountPurchaseInvoiceMapper extends BaseMapper<AccountPurchaseInvoice> { |
| | | |
| | | IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, @Param("req") AccountPurchaseInvoiceDto accountPurchaseInvoiceDto); |
| | | |
| | | List<PurchaseInboundVo> getInboundBatchesBySupplier(@Param("supplierId") Integer supplierId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾å Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 04:14:51 |
| | | */ |
| | | @Mapper |
| | | public interface AccountPurchasePaymentMapper extends BaseMapper<AccountPurchasePayment> { |
| | | |
| | | IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, @Param("req") AccountPurchasePaymentDto accountPurchasePaymentDto); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectPayment(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.pojo.sales.AccountInvoiceApplication; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯· Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 01:38:32 |
| | | */ |
| | | @Mapper |
| | | public interface AccountInvoiceApplicationMapper extends BaseMapper<AccountInvoiceApplication> { |
| | | |
| | | IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, @Param("req") AccountInvoiceApplicationDto accountInvoiceApplicationDto); |
| | | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(@Param("customerId") Integer customerId); |
| | | |
| | | //å¤æè¯¥åºåºè®°å½æ¯å¦æå¼ç¥¨ç³è¯· |
| | | boolean existsByStockOutRecordId(@Param("stockOutRecordIds") List<Long> stockOutRecordIds); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--æ¶æ¬¾å Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:49:56 |
| | | */ |
| | | @Mapper |
| | | public interface AccountSalesCollectionMapper extends BaseMapper<AccountSalesCollection> { |
| | | |
| | | IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, @Param("req") AccountSalesCollectionDto accountSalesCollectionDto); |
| | | |
| | | //å¤æè¯¥åºåºè®°å½æ¯å¦ææ¶æ¬¾å |
| | | boolean existsByStockOutRecordId(@Param("stockOutRecordIds") List<Long> stockOutRecordIds); |
| | | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(@Param("customerId") Integer customerId); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--é项å票 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:10:20 |
| | | */ |
| | | @Mapper |
| | | public interface AccountSalesInvoiceMapper extends BaseMapper<AccountSalesInvoice> { |
| | | |
| | | IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, @Param("req") AccountSalesInvoiceDto accountSalesInvoiceDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_statement") |
| | | @ApiModel(value = "AccountStatement对象", description = "è´¢å¡ç®¡ç--对账å") |
| | | public class AccountStatement implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 客æ·id(åºæ¶æ¯å®¢æ·customer,åºä»æ¯ä¾åºåsupplier) |
| | | */ |
| | | @ApiModelProperty("客æ·id") |
| | | private Integer customerId; |
| | | |
| | | /** |
| | | * 对账æä»½(yyyy-MM) |
| | | */ |
| | | @ApiModelProperty("对账æä»½(yyyy-MM)") |
| | | @Excel(name = "对账æä»½") |
| | | private String statementMonth; |
| | | |
| | | /** |
| | | * ä¸å¡ç±»å(1åºæ¶å¯¹è´¦;2åºä»å¯¹è´¦) |
| | | */ |
| | | @ApiModelProperty("ä¸å¡ç±»å(1åºæ¶å¯¹è´¦;2åºä»å¯¹è´¦)") |
| | | @Excel(name = "ä¸å¡ç±»å",readConverterExp = "1=åºæ¶å¯¹è´¦,2=åºä»å¯¹è´¦") |
| | | private Integer accountType; |
| | | |
| | | /** |
| | | * 对账åå· |
| | | */ |
| | | @ApiModelProperty("对账åå·") |
| | | @Excel(name = "对账åå·") |
| | | private String statementNumber; |
| | | |
| | | /** |
| | | * æåä½é¢ |
| | | */ |
| | | @ApiModelProperty("æåä½é¢") |
| | | @Excel(name = "æåä½é¢") |
| | | private BigDecimal openingBalance; |
| | | |
| | | /** |
| | | * æ¬æåºæ¶/åºä» |
| | | */ |
| | | @ApiModelProperty("æ¬æåºæ¶/åºä»") |
| | | @Excel(name = "æ¬æåºæ¶/åºä»") |
| | | private BigDecimal currentPlan; |
| | | |
| | | /** |
| | | * æ¬ææ¶æ¬¾/仿¬¾ |
| | | */ |
| | | @ApiModelProperty("æ¬ææ¶æ¬¾/仿¬¾") |
| | | @Excel(name = "æ¬ææ¶æ¬¾/仿¬¾") |
| | | private BigDecimal currentActually; |
| | | |
| | | /** |
| | | * ææ«ä½é¢ |
| | | */ |
| | | @ApiModelProperty("ææ«ä½é¢") |
| | | @Excel(name = "ææ«ä½é¢") |
| | | private BigDecimal closingBalance; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--对账åæç» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 10:12:42 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_statement_details") |
| | | @ApiModel(value = "AccountStatementDetails对象", description = "è´¢å¡ç®¡ç--对账åæç»") |
| | | public class AccountStatementDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³è对账åid |
| | | */ |
| | | @ApiModelProperty("å
³è对账åid") |
| | | private Integer accountStatementId; |
| | | |
| | | /** |
| | | * æ°æ®æ¥æ |
| | | */ |
| | | @ApiModelProperty("æ°æ®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate occurrenceDate; |
| | | |
| | | /** |
| | | * åæ®ç¼å· |
| | | */ |
| | | @ApiModelProperty("åæ®ç¼å·") |
| | | private String receiptNumber; |
| | | |
| | | /** |
| | | * æ°æ®ç±»å(1åºåº;2å
¥åº;3æ¶æ¬¾;4仿¬¾;5éè´§) |
| | | */ |
| | | @ApiModelProperty("æ°æ®ç±»å(1åºåº;2å
¥åº;3æ¶æ¬¾;4仿¬¾;5éè´§)") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | @ApiModelProperty("éé¢") |
| | | private BigDecimal amount; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾ç³è¯· |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:44:22 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_payment_application") |
| | | @ApiModel(value = "AccountPaymentApplication对象", description = "è´¢å¡ç®¡ç--仿¬¾ç³è¯·") |
| | | public class AccountPaymentApplication implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * ä¾åºåid |
| | | */ |
| | | @ApiModelProperty("ä¾åºåid") |
| | | private Integer supplierId; |
| | | |
| | | /** |
| | | * å
³èå
¥åºåid(å¤é) |
| | | */ |
| | | @ApiModelProperty("å
³èå
¥åºåid(å¤é)") |
| | | private String stockInRecordIds; |
| | | |
| | | /** |
| | | * 仿¬¾ç³è¯·åå· |
| | | */ |
| | | @ApiModelProperty("仿¬¾ç³è¯·åå·") |
| | | @Excel(name = "仿¬¾ç³è¯·åå·") |
| | | private String invoiceApplicationNo; |
| | | |
| | | /** |
| | | * 仿¬¾æ¹å¼ |
| | | */ |
| | | @ApiModelProperty("仿¬¾æ¹å¼") |
| | | @Excel(name = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | /** |
| | | * 仿¬¾äºç± |
| | | */ |
| | | @ApiModelProperty("仿¬¾äºç±") |
| | | @Excel(name = "仿¬¾äºç±") |
| | | private String paymentContent; |
| | | |
| | | /** |
| | | * ç³è¯·æ¥æ |
| | | */ |
| | | @ApiModelProperty("ç³è¯·æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç³è¯·æ¥æ") |
| | | private LocalDate applyDate; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿ |
| | | */ |
| | | @ApiModelProperty("å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿") |
| | | @Excel(name = "å®¡æ ¸ç¶æ",readConverterExp = "0=å¾
å®¡æ ¸,1=å®¡æ ¸éè¿,2=å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 仿¬¾éé¢ |
| | | */ |
| | | @ApiModelProperty("仿¬¾éé¢") |
| | | @Excel(name = "仿¬¾éé¢") |
| | | private BigDecimal paymentAmount; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--è¿é¡¹å票 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:06:17 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_purchase_invoice") |
| | | @ApiModel(value = "AccountPurchaseInvoice对象", description = "è´¢å¡ç®¡ç--è¿é¡¹å票") |
| | | public class AccountPurchaseInvoice implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * å票å·ç |
| | | */ |
| | | @ApiModelProperty("å票å·ç ") |
| | | @Excel(name = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @ApiModelProperty("ç¨ç") |
| | | @Excel(name = "ç¨ç") |
| | | private Integer taxRate; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | @ApiModelProperty("å票类å") |
| | | @Excel(name = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * å¼ç¥¨æ¥æ |
| | | */ |
| | | @ApiModelProperty("å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | private LocalDate issueDate; |
| | | |
| | | /** |
| | | * éé¢(ä¸å«ç¨) |
| | | */ |
| | | @ApiModelProperty("éé¢(ä¸å«ç¨)") |
| | | @Excel(name = "éé¢(ä¸å«ç¨)") |
| | | private BigDecimal taxExclusivelPrice; |
| | | |
| | | /** |
| | | * ç¨é¢ |
| | | */ |
| | | @ApiModelProperty("ç¨é¢") |
| | | @Excel(name = "ç¨é¢") |
| | | private BigDecimal taxPrice; |
| | | |
| | | /** |
| | | * ä»·ç¨å计 |
| | | */ |
| | | @ApiModelProperty("ä»·ç¨å计") |
| | | @Excel(name = "ä»·ç¨å计") |
| | | private BigDecimal taxInclusivePrice; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * å票å
容 |
| | | */ |
| | | @ApiModelProperty("å票å
容") |
| | | @Excel(name = "å票å
容") |
| | | private String invoiceContent; |
| | | |
| | | /** |
| | | * ä¾åºåid |
| | | */ |
| | | @ApiModelProperty("ä¾åºåid") |
| | | private Integer supplierId; |
| | | |
| | | /** |
| | | * å
³èä¸ä¼ çå票éä»¶id |
| | | */ |
| | | @ApiModelProperty("å
³èä¸ä¼ çå票éä»¶id") |
| | | private Integer storageAttachmentId; |
| | | |
| | | /** |
| | | * å
³èå
¥åºåid(å¤é) |
| | | */ |
| | | @ApiModelProperty("å
³èå
¥åºåid(å¤é)") |
| | | private String stockInRecordIds; |
| | | |
| | | /** |
| | | * ç¶æ 0å¯ç¨ 1ç¦ç¨ |
| | | */ |
| | | @ApiModelProperty("ç¶æ 0å¯ç¨ 1ç¦ç¨") |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=ä½åº") |
| | | private Integer status; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾å |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 04:14:51 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_purchase_payment") |
| | | @ApiModel(value = "AccountPurchasePayment对象", description = "è´¢å¡ç®¡ç--仿¬¾å") |
| | | public class AccountPurchasePayment implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³è仿¬¾ç³è¯·id |
| | | */ |
| | | @ApiModelProperty("å
³è仿¬¾ç³è¯·id") |
| | | private Integer accountPaymentApplicationId; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * ä¾åºåid |
| | | */ |
| | | @ApiModelProperty("ä¾åºåid") |
| | | private Integer supplierId; |
| | | |
| | | /** |
| | | * 仿¬¾æ¥æ |
| | | */ |
| | | @ApiModelProperty("仿¬¾æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "仿¬¾æ¥æ") |
| | | private LocalDate paymentDate; |
| | | |
| | | /** |
| | | * 仿¬¾æ¹å¼ |
| | | */ |
| | | @ApiModelProperty("仿¬¾æ¹å¼") |
| | | @Excel(name = "仿¬¾æ¹å¼",dictType = "checkout_payment") |
| | | private String paymentMethod; |
| | | |
| | | /** |
| | | * 仿¬¾éé¢ |
| | | */ |
| | | @ApiModelProperty("仿¬¾éé¢") |
| | | @Excel(name = "仿¬¾éé¢") |
| | | private BigDecimal paymentAmount; |
| | | |
| | | /** |
| | | * 仿¬¾åå· |
| | | */ |
| | | @ApiModelProperty("仿¬¾åå·") |
| | | @Excel(name = "仿¬¾åå·") |
| | | private String paymentNumber; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.sales; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯· |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 01:38:32 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_invoice_application") |
| | | @ApiModel(value = "AccountInvoiceApplication对象", description = "è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯·") |
| | | public class AccountInvoiceApplication implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 客æ·id |
| | | */ |
| | | @ApiModelProperty("客æ·id") |
| | | private Integer customerId; |
| | | |
| | | /** |
| | | * å
³èåºåºåid(å¤é) |
| | | */ |
| | | @ApiModelProperty("å
³èåºåºåid(å¤é)") |
| | | private String stockOutRecordIds; |
| | | |
| | | /** |
| | | * å¼ç¥¨ç³è¯·åå· |
| | | */ |
| | | @ApiModelProperty("å¼ç¥¨ç³è¯·åå·") |
| | | @Excel(name = "å¼ç¥¨ç³è¯·åå·") |
| | | private String invoiceApplicationNo; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | @ApiModelProperty("å票类å") |
| | | @Excel(name = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * ç³è¯·æ¥æ |
| | | */ |
| | | @ApiModelProperty("ç³è¯·æ¥æ") |
| | | @Excel(name = "ç³è¯·æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate applyDate; |
| | | |
| | | /** |
| | | * å票å
容 |
| | | */ |
| | | @ApiModelProperty("å票å
容") |
| | | @Excel(name = "å票å
容") |
| | | private String invoiceContent; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿ |
| | | */ |
| | | @ApiModelProperty("å®¡æ ¸ç¶æ:0å¾
å®¡æ ¸1å®¡æ ¸éè¿2å®¡æ ¸ä¸éè¿") |
| | | @Excel(name = "å®¡æ ¸ç¶æ",readConverterExp = "0=å¾
å®¡æ ¸,1=å®¡æ ¸éè¿,2=å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å¼ç¥¨éé¢") |
| | | @Excel(name = "å¼ç¥¨éé¢") |
| | | private BigDecimal invoiceAmount; |
| | | |
| | | @ApiModelProperty("ç¨ç") |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.sales; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--æ¶æ¬¾å |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:49:56 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_sales_collection") |
| | | @ApiModel(value = "AccountSalesCollection对象", description = "è´¢å¡ç®¡ç--æ¶æ¬¾å") |
| | | public class AccountSalesCollection implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³èåºåºåid(å¤é) |
| | | */ |
| | | @ApiModelProperty("å
³èåºåºåid(å¤é)") |
| | | private String stockOutRecordIds; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 客æ·id |
| | | */ |
| | | @ApiModelProperty("客æ·id") |
| | | private Integer customerId; |
| | | |
| | | /** |
| | | * æ¶æ¬¾æ¥æ |
| | | */ |
| | | @ApiModelProperty("æ¶æ¬¾æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "æ¶æ¬¾æ¥æ") |
| | | private LocalDate collectionDate; |
| | | |
| | | /** |
| | | * æ¶æ¬¾éé¢ |
| | | */ |
| | | @ApiModelProperty("æ¶æ¬¾éé¢") |
| | | @Excel(name = "æ¶æ¬¾éé¢") |
| | | private BigDecimal collectionAmount; |
| | | |
| | | /** |
| | | * æ¶æ¬¾æ¹å¼ |
| | | */ |
| | | @ApiModelProperty("æ¶æ¬¾æ¹å¼") |
| | | @Excel(name = "æ¶æ¬¾æ¹å¼",dictType = "payment_methods") |
| | | private String collectionMethod; |
| | | |
| | | /** |
| | | * æ¶æ¬¾åå· |
| | | */ |
| | | @ApiModelProperty("æ¶æ¬¾åå·") |
| | | @Excel(name = "æ¶æ¬¾åå·") |
| | | private String collectionNumber; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.sales; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--é项å票 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:10:20 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("account_sales_invoice") |
| | | @ApiModel(value = "AccountSalesInvoice对象", description = "è´¢å¡ç®¡ç--é项å票") |
| | | public class AccountSalesInvoice implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³èå¼ç¥¨ç³è¯·id |
| | | */ |
| | | @ApiModelProperty("å
³èå¼ç¥¨ç³è¯·id") |
| | | private Integer accountInvoiceApplicationId; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹äºº |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * å票å·ç |
| | | */ |
| | | @ApiModelProperty("å票å·ç ") |
| | | @Excel(name = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @ApiModelProperty("ç¨ç") |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | @ApiModelProperty("å票类å") |
| | | @Excel(name = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * å¼ç¥¨æ¥æ |
| | | */ |
| | | @ApiModelProperty("å¼ç¥¨æ¥æ") |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate issueDate; |
| | | |
| | | /** |
| | | * éé¢(ä¸å«ç¨) |
| | | */ |
| | | @ApiModelProperty("éé¢(ä¸å«ç¨)") |
| | | @Excel(name = "éé¢(ä¸å«ç¨)") |
| | | private BigDecimal taxExclusivelPrice; |
| | | |
| | | /** |
| | | * ç¨é¢ |
| | | */ |
| | | @ApiModelProperty("ç¨é¢") |
| | | @Excel(name = "ç¨é¢") |
| | | private BigDecimal taxPrice; |
| | | |
| | | /** |
| | | * ä»·ç¨å计 |
| | | */ |
| | | @ApiModelProperty("ä»·ç¨å计") |
| | | @Excel(name = "ä»·ç¨å计") |
| | | private BigDecimal taxInclusivePrice; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ApiModelProperty("夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * å票å
容 |
| | | */ |
| | | @ApiModelProperty("å票å
容") |
| | | @Excel(name = "å票å
容") |
| | | private String invoiceContent; |
| | | |
| | | /** |
| | | * 客æ·id |
| | | */ |
| | | @ApiModelProperty("客æ·id") |
| | | private Integer customerId; |
| | | |
| | | /** |
| | | * å
³èä¸ä¼ çå票éä»¶id |
| | | */ |
| | | @ApiModelProperty("å
³èä¸ä¼ çå票éä»¶id") |
| | | private Integer storageAttachmentId; |
| | | |
| | | /** |
| | | * ç¶æ 0å¯ç¨ 1ç¦ç¨ |
| | | */ |
| | | @ApiModelProperty("ç¶æ 0å¯ç¨ 1ç¦ç¨") |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=ä½åº") |
| | | private Integer status; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--对账åæç» æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 10:12:42 |
| | | */ |
| | | public interface AccountStatementDetailsService extends IService<AccountStatementDetails> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.StatementAccountDto; |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | public interface AccountStatementService extends IService<AccountStatement> { |
| | | |
| | | StatementAccountVo getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto); |
| | | |
| | | boolean addAccountStatement(StatementAccountVo statementAccountVo); |
| | | |
| | | boolean deleteAccountStatement(List<Long> ids); |
| | | |
| | | IPage<StatementAccountVo> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto); |
| | | |
| | | void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.AccountReportDto; |
| | | import com.ruoyi.account.bean.vo.AccountReportVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | public interface AccountingService { |
| | | |
| | | AjaxResult total(Integer year); |
| | | |
| | | AjaxResult deviceTypeDistribution(Integer year); |
| | | |
| | | AjaxResult calculateDepreciation(Page page, Integer year); |
| | | |
| | | AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.ruoyi.account.mapper.AccountStatementDetailsMapper; |
| | | import com.ruoyi.account.service.AccountStatementDetailsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--对账åæç» æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 10:12:42 |
| | | */ |
| | | @Service |
| | | public class AccountStatementDetailsServiceImpl extends ServiceImpl<AccountStatementDetailsMapper, AccountStatementDetails> implements AccountStatementDetailsService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.StatementAccountDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.account.mapper.AccountStatementDetailsMapper; |
| | | import com.ruoyi.account.mapper.AccountStatementMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.account.service.AccountStatementService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class AccountStatementServiceImpl extends ServiceImpl<AccountStatementMapper, AccountStatement> implements AccountStatementService { |
| | | |
| | | private final AccountStatementMapper accountStatementMapper; |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | private final StockInRecordMapper stockInRecordMapper; |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | private final AccountStatementDetailsMapper accountStatementDetailsMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd"); |
| | | |
| | | @Override |
| | | public StatementAccountVo getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto) { |
| | | //对账æä»½è½¬æ¢æå¼å§æ¥æåç»ææ¥æåºé´ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | YearMonth yearMonth = YearMonth.parse(statementAccountDto.getStatementMonth(), formatter); |
| | | statementAccountDto.setStartDate(yearMonth.atDay(1)); |
| | | statementAccountDto.setEndDate(yearMonth.atEndOfMonth()); |
| | | if (statementAccountDto.getAccountType() == 1){ |
| | | //åºæ¶å¯¹è´¦--Customer |
| | | return getAccountStatementDetailsByCustomerAndMonth(statementAccountDto); |
| | | }else { |
| | | //åºä»å¯¹è´¦--SupplierManage |
| | | return getAccountStatementDetailsBySupplierAndMonth(statementAccountDto); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean addAccountStatement(StatementAccountVo statementAccountVo) { |
| | | //åä¸å®¢æ·æè
åä¸ä¾åºå,ä¸ä¸ªæä»½åªè½æä¸ä¸ªå¯¹è´¦å |
| | | List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery() |
| | | .eq(AccountStatement::getStatementMonth, statementAccountVo.getStatementMonth()) |
| | | .eq(AccountStatement::getAccountType, statementAccountVo.getAccountType()) |
| | | .eq(AccountStatement::getCustomerId, statementAccountVo.getCustomerId())); |
| | | if (CollectionUtils.isNotEmpty(accountStatements)){ |
| | | throw new ServiceException("åä¸å®¢æ·æè
åä¸ä¾åºå,ä¸ä¸ªæä»½åªè½æä¸ä¸ªå¯¹è´¦å"); |
| | | } |
| | | AccountStatement accountStatement = new AccountStatement(); |
| | | BeanUtils.copyProperties(statementAccountVo, accountStatement); |
| | | accountStatement.setStatementNumber(genStatementAccountNo()); |
| | | boolean save = save(accountStatement); |
| | | statementAccountVo.getAccountStatementDetails().stream().forEach(accountStatementDetails -> { |
| | | accountStatementDetails.setAccountStatementId(accountStatement.getId()); |
| | | //æ·»å 对账åæç» |
| | | accountStatementDetailsMapper.insert(accountStatementDetails); |
| | | }); |
| | | return save; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountStatement(List<Long> ids) { |
| | | //å é¤å¯¹è´¦åæç» |
| | | accountStatementDetailsMapper.delete(Wrappers.<AccountStatementDetails>lambdaQuery().in(AccountStatementDetails::getAccountStatementId, ids)); |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StatementAccountVo> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto) { |
| | | return accountStatementMapper.listPageAccountStatement(page, statementAccountDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto) { |
| | | List<StatementAccountVo> list = accountStatementMapper.listPageAccountStatement(new Page(1,-1),statementAccountDto).getRecords(); |
| | | ExcelUtil<StatementAccountVo> util = new ExcelUtil<>(StatementAccountVo.class); |
| | | util.exportExcel(response, list , "对账å"); |
| | | } |
| | | |
| | | //æ ¹æ®å®¢æ·åæä»½è·å对账详æ
(éå®) |
| | | private StatementAccountVo getAccountStatementDetailsByCustomerAndMonth(StatementAccountDto statementAccountDto) { |
| | | StatementAccountVo statementAccountVo = new StatementAccountVo(); |
| | | statementAccountVo.setAccountType(1);//åºæ¶å¯¹è´¦ |
| | | List<AccountStatementDetails> accountStatementDetailsList = new ArrayList<>(); |
| | | /*æ¥è¯¢åºåºæç»*/ |
| | | SalesOutboundDto salesOutboundDto = new SalesOutboundDto(); |
| | | salesOutboundDto.setCustomerId(statementAccountDto.getCustomerId()); |
| | | salesOutboundDto.setStartDate(statementAccountDto.getStartDate()); |
| | | salesOutboundDto.setEndDate(statementAccountDto.getEndDate()); |
| | | List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords(); |
| | | salesOutboundVos.stream().forEach(salesOutboundVo -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=åºåºæ¥æ |
| | | accountStatementDetails.setOccurrenceDate(salesOutboundVo.getShippingDate()); |
| | | //åæ®ç¼å·=åºåºåå· |
| | | accountStatementDetails.setReceiptNumber(salesOutboundVo.getOutboundBatches()); |
| | | //ç±»å=åºåº |
| | | accountStatementDetails.setType(1); |
| | | //éé¢=åºåºéé¢ |
| | | accountStatementDetails.setAmount(salesOutboundVo.getOutboundAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("产åéå®åºåºï¼äº§åï¼"+salesOutboundVo.getProductName()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | /*æ¥è¯¢æ¶æ¬¾æç»*/ |
| | | List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(Wrappers.<AccountSalesCollection>lambdaQuery() |
| | | .eq(AccountSalesCollection::getCustomerId, statementAccountDto.getCustomerId()) |
| | | .between(AccountSalesCollection::getCollectionDate, statementAccountDto.getStartDate(), statementAccountDto.getEndDate())); |
| | | accountSalesCollections.stream().forEach(accountSalesCollection -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=æ¶æ¬¾æ¥æ |
| | | accountStatementDetails.setOccurrenceDate(accountSalesCollection.getCollectionDate()); |
| | | //åæ®ç¼å·=æ¶æ¬¾åå· |
| | | accountStatementDetails.setReceiptNumber(accountSalesCollection.getCollectionNumber()); |
| | | //ç±»å=æ¶æ¬¾ |
| | | accountStatementDetails.setType(3); |
| | | //éé¢=æ¶æ¬¾éé¢ |
| | | accountStatementDetails.setAmount(accountSalesCollection.getCollectionAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("客æ·å款ï¼å¤æ³¨ï¼"+accountSalesCollection.getRemark()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | /*æ¥è¯¢éè´§æç»*/ |
| | | SalesReturnDto salesReturnDto = new SalesReturnDto(); |
| | | salesReturnDto.setCustomerId(statementAccountDto.getCustomerId()); |
| | | salesReturnDto.setStartDate(statementAccountDto.getStartDate()); |
| | | salesReturnDto.setEndDate(statementAccountDto.getEndDate()); |
| | | List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords(); |
| | | salesReturnVos.stream().forEach(salesReturnVo -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=éè´§æ¥æ |
| | | accountStatementDetails.setOccurrenceDate(salesReturnVo.getMakeTime().toLocalDate()); |
| | | //åæ®ç¼å·=éè´§åå· |
| | | accountStatementDetails.setReceiptNumber(salesReturnVo.getReturnNo()); |
| | | //ç±»å=éè´§ |
| | | accountStatementDetails.setType(5); |
| | | //éé¢=鿬¾éé¢ |
| | | accountStatementDetails.setAmount(salesReturnVo.getRefundAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("产åéè´§ï¼åå ï¼"+salesReturnVo.getReturnReason()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | //æåä½é¢=ä¸ä¸ªæçææ«ä½é¢ |
| | | statementAccountVo.setOpeningBalance(BigDecimal.ZERO); |
| | | List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery() |
| | | .eq(AccountStatement::getAccountType, 1) |
| | | .eq(AccountStatement::getCustomerId, statementAccountDto.getCustomerId()) |
| | | .eq(AccountStatement::getStatementMonth, |
| | | YearMonth.parse(statementAccountDto.getStatementMonth()).minusMonths(1).toString())); |
| | | if (CollectionUtils.isNotEmpty(accountStatements)){ |
| | | statementAccountVo.setOpeningBalance(accountStatements.get(accountStatements.size() - 1).getClosingBalance()); |
| | | } |
| | | //æ¬æåºæ¶=åºåº-éè´§éé¢ç´¯è®¡ |
| | | statementAccountVo.setCurrentPlan(salesOutboundVos.stream().map(SalesOutboundVo::getOutboundAmount).reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .subtract(salesReturnVos.stream().map(SalesReturnVo::getRefundAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | //æ¬ææ¶æ¬¾=æ¶æ¬¾éé¢ç´¯è®¡ |
| | | statementAccountVo.setCurrentActually(accountSalesCollections.stream().map(AccountSalesCollection::getCollectionAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | //ææ«ä½é¢=æå+åºæ¶-æ¶æ¬¾ |
| | | statementAccountVo.setClosingBalance(statementAccountVo.getOpeningBalance().add(statementAccountVo.getCurrentPlan()).subtract(statementAccountVo.getCurrentActually())); |
| | | statementAccountVo.setAccountStatementDetails(accountStatementDetailsList); |
| | | return statementAccountVo; |
| | | } |
| | | |
| | | //æ ¹æ®ä¾åºååæä»½è·å对账详æ
(éè´) |
| | | private StatementAccountVo getAccountStatementDetailsBySupplierAndMonth(StatementAccountDto statementAccountDto) { |
| | | StatementAccountVo statementAccountVo = new StatementAccountVo(); |
| | | statementAccountVo.setAccountType(2);//åºä»å¯¹è´¦ |
| | | List<AccountStatementDetails> accountStatementDetailsList = new ArrayList<>(); |
| | | /*æ¥è¯¢å
¥åºæç»*/ |
| | | PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto(); |
| | | purchaseInboundDto.setSupplierId(statementAccountDto.getCustomerId()); |
| | | purchaseInboundDto.setStartDate(statementAccountDto.getStartDate()); |
| | | purchaseInboundDto.setEndDate(statementAccountDto.getEndDate()); |
| | | List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords(); |
| | | purchaseInboundVos.stream().forEach(purchaseInboundVo -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=å
¥åºæ¥æ |
| | | accountStatementDetails.setOccurrenceDate(purchaseInboundVo.getInboundDate()); |
| | | //åæ®ç¼å·=å
¥åºåå· |
| | | accountStatementDetails.setReceiptNumber(purchaseInboundVo.getInboundBatches()); |
| | | //ç±»å=å
¥åº |
| | | accountStatementDetails.setType(2); |
| | | //éé¢=å
¥åºéé¢ |
| | | accountStatementDetails.setAmount(purchaseInboundVo.getInboundAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("产åéè´å
¥åºï¼äº§åï¼"+purchaseInboundVo.getProductName()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | /*æ¥è¯¢ä»æ¬¾æç»*/ |
| | | List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery() |
| | | .eq(AccountPurchasePayment::getSupplierId, statementAccountDto.getCustomerId()) |
| | | .between(AccountPurchasePayment::getPaymentDate, statementAccountDto.getStartDate(), statementAccountDto.getEndDate())); |
| | | accountPurchasePayments.stream().forEach(accountPurchasePayment -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=仿¬¾æ¥æ |
| | | accountStatementDetails.setOccurrenceDate(accountPurchasePayment.getPaymentDate()); |
| | | //åæ®ç¼å·=仿¬¾åå· |
| | | accountStatementDetails.setReceiptNumber(accountPurchasePayment.getPaymentNumber()); |
| | | //ç±»å=仿¬¾ |
| | | accountStatementDetails.setType(4); |
| | | //éé¢=仿¬¾éé¢ |
| | | accountStatementDetails.setAmount(accountPurchasePayment.getPaymentAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("æ¯ä»è´§æ¬¾ï¼å¤æ³¨ï¼"+accountPurchasePayment.getRemark()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | /*æ¥è¯¢éè´§æç»*/ |
| | | PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto(); |
| | | purchaseReturnDto.setSupplierId(statementAccountDto.getCustomerId()); |
| | | purchaseReturnDto.setStartDate(statementAccountDto.getStartDate()); |
| | | purchaseReturnDto.setEndDate(statementAccountDto.getEndDate()); |
| | | List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords(); |
| | | purchaseReturnVos.stream().forEach(purchaseReturnVo -> { |
| | | AccountStatementDetails accountStatementDetails = new AccountStatementDetails(); |
| | | //æ°æ®æ¥æ=éè´§æ¥æ |
| | | accountStatementDetails.setOccurrenceDate(purchaseReturnVo.getPreparedAt().toLocalDate()); |
| | | //åæ®ç¼å·=éè´§åå· |
| | | accountStatementDetails.setReceiptNumber(purchaseReturnVo.getReturnNo()); |
| | | //ç±»å=éè´§ |
| | | accountStatementDetails.setType(5); |
| | | //éé¢=鿬¾éé¢ |
| | | accountStatementDetails.setAmount(purchaseReturnVo.getTotalAmount()); |
| | | //夿³¨ |
| | | accountStatementDetails.setRemark("产åéè´§ï¼éè´§æ¹å¼ï¼"+purchaseReturnVo.getReturnType()); |
| | | accountStatementDetailsList.add(accountStatementDetails); |
| | | }); |
| | | //æåä½é¢=ä¸ä¸ªæçææ«ä½é¢ |
| | | statementAccountVo.setOpeningBalance(BigDecimal.ZERO); |
| | | List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery() |
| | | .eq(AccountStatement::getAccountType, 2) |
| | | .eq(AccountStatement::getCustomerId, statementAccountDto.getCustomerId()) |
| | | .eq(AccountStatement::getStatementMonth, |
| | | YearMonth.parse(statementAccountDto.getStatementMonth()).minusMonths(1).toString())); |
| | | if (CollectionUtils.isNotEmpty(accountStatements)){ |
| | | statementAccountVo.setOpeningBalance(accountStatements.get(accountStatements.size() - 1).getClosingBalance()); |
| | | } |
| | | //æ¬æåºä»=å
¥åº-éè´§éé¢ç´¯è®¡ |
| | | statementAccountVo.setCurrentPlan(purchaseInboundVos.stream().map(PurchaseInboundVo::getInboundAmount).reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .subtract(purchaseReturnVos.stream().map(PurchaseReturnVo::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | //æ¬æä»æ¬¾=仿¬¾éé¢ç´¯è®¡ |
| | | statementAccountVo.setCurrentActually(accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | //ææ«ä½é¢=æå+åºæ¶-æ¶æ¬¾ |
| | | statementAccountVo.setClosingBalance(statementAccountVo.getOpeningBalance().add(statementAccountVo.getCurrentPlan()).subtract(statementAccountVo.getCurrentActually())); |
| | | statementAccountVo.setAccountStatementDetails(accountStatementDetailsList); |
| | | return statementAccountVo; |
| | | } |
| | | |
| | | private String genStatementAccountNo() { |
| | | return "DZ" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.AccountReportDto; |
| | | import com.ruoyi.account.bean.dto.DeviceTypeDetail; |
| | | import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO; |
| | | import com.ruoyi.account.mapper.BorrowInfoMapper; |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.AccountReportVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.account.service.AccountingService; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.Year; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class AccountingServiceImpl { |
| | | public class AccountingServiceImpl implements AccountingService { |
| | | |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final BorrowInfoMapper borrowInfoMapper; |
| | | private final CustomStorageMapper customStorageMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | private final StockInRecordMapper stockInRecordMapper; |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | public R<?> total(Integer year) { |
| | | |
| | | @Override |
| | | public AjaxResult total(Integer year) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("deprAmount",0); // ææ§éé¢ |
| | | map.put("deviceTotal",0); // è®¾å¤æ»æ° |
| | |
| | | map.put("netValue",reduce.subtract(total)); |
| | | } |
| | | // è´åº |
| | | LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | borrowInfoLambdaQueryWrapper.like(BorrowInfo::getCreateTime,year) |
| | | .eq(BorrowInfo::getStatus,1); |
| | | List<BorrowInfo> borrowInfos = borrowInfoMapper.selectList(borrowInfoLambdaQueryWrapper); |
| | | if(CollectionUtils.isNotEmpty(borrowInfos)){ |
| | | BigDecimal reduce = borrowInfos.stream() |
| | | .map(BorrowInfo::getBorrowAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map.put("debt",reduce); |
| | | } |
| | | map.put("debt",BigDecimal.ZERO); |
| | | |
| | | // åºåèµäº§ |
| | | LambdaQueryWrapper<ProcurementRecordStorage> procurementRecordStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordStorageLambdaQueryWrapper.like(ProcurementRecordStorage::getCreateTime,year); |
| | |
| | | }); |
| | | } |
| | | map.put("inventoryValue",procurementRecordTotal.add(customStorageTotal)); |
| | | return R.ok(map); |
| | | return AjaxResult.success( map); |
| | | } |
| | | |
| | | /** |
| | |
| | | return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | |
| | | public R<?> deviceTypeDistribution(Integer year) { |
| | | @Override |
| | | public AjaxResult deviceTypeDistribution(Integer year) { |
| | | // 2. ç»è£
è¿åVO |
| | | DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO(); |
| | | List<DeviceTypeDetail> details = deviceLedgerMapper.getDeviceTypeDistributionByYear( year); |
| | |
| | | .collect(Collectors.toList())); |
| | | vo.setTotalCount(vo.getCategories().size()); |
| | | } |
| | | return R.ok(vo); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | public R<?> calculateDepreciation(Page page, Integer year) { |
| | | @Override |
| | | public AjaxResult calculateDepreciation(Page page, Integer year) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year) |
| | | .eq(DeviceLedger::getIsDepr,1); |
| | |
| | | record.setDeprAmount(calculatePreciseDepreciation(record)); |
| | | record.setNetValue(record.getTaxIncludingPriceTotal().subtract(record.getDeprAmount())); |
| | | } |
| | | return R.ok(deviceLedgerIPage); |
| | | return AjaxResult.success(deviceLedgerIPage); |
| | | } |
| | | |
| | | @Override |
| | | public AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) { |
| | | AccountReportVo accountReportVo = new AccountReportVo(); |
| | | LocalDate start = accountReportDto.getEntryDateStart(); |
| | | LocalDate end = accountReportDto.getEntryDateEnd(); |
| | | DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | |
| | | // ========== 1. é¡¶é¨å¡çæ°æ® ========== |
| | | // 1.1 æ»è¥æ¶ = æ¶æ¬¾åæ»éé¢ |
| | | List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList( |
| | | Wrappers.<AccountSalesCollection>lambdaQuery() |
| | | .between(AccountSalesCollection::getCollectionDate, start, end) |
| | | ); |
| | | BigDecimal totalIncome = Optional.of( |
| | | accountSalesCollections.stream() |
| | | .map(AccountSalesCollection::getCollectionAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | accountReportVo.setTotalIncome(totalIncome); |
| | | // 1.2 æ»æ¯åº = 仿¬¾åæ»éé¢ |
| | | List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList( |
| | | Wrappers.<AccountPurchasePayment>lambdaQuery() |
| | | .between(AccountPurchasePayment::getPaymentDate, start, end) |
| | | ); |
| | | BigDecimal totalExpense = Optional.of( |
| | | accountPurchasePayments.stream() |
| | | .map(AccountPurchasePayment::getPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | accountReportVo.setTotalExpense(totalExpense); |
| | | // 1.3 åºæ¶è´¦æ¬¾ = éå®åºåºéé¢å计 - éå®éè´§éé¢å计 |
| | | SalesOutboundDto salesOutboundDto = new SalesOutboundDto(); |
| | | salesOutboundDto.setStartDate(accountReportDto.getEntryDateStart()); |
| | | salesOutboundDto.setEndDate(accountReportDto.getEntryDateEnd()); |
| | | List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords(); |
| | | BigDecimal salesOutAmount = Optional.of( |
| | | salesOutboundVos.stream() |
| | | .map(SalesOutboundVo::getOutboundAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | SalesReturnDto salesReturnDto = new SalesReturnDto(); |
| | | salesReturnDto.setStartDate(accountReportDto.getEntryDateStart()); |
| | | salesReturnDto.setEndDate(accountReportDto.getEntryDateEnd()); |
| | | List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords(); |
| | | BigDecimal salesReturnAmount = Optional.of( |
| | | salesReturnVos.stream() |
| | | .map(SalesReturnVo::getRefundAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | accountReportVo.setAccountsReceivable(salesOutAmount.subtract(salesReturnAmount)); |
| | | // 1.4 åºä»è´¦æ¬¾ = éè´å
¥åºéé¢å计 - éè´éè´§éé¢å计 |
| | | PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto(); |
| | | purchaseInboundDto.setStartDate(accountReportDto.getEntryDateStart()); |
| | | purchaseInboundDto.setEndDate(accountReportDto.getEntryDateEnd()); |
| | | List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords(); |
| | | BigDecimal purchaseInAmount = Optional.of( |
| | | purchaseInboundVos.stream() |
| | | .map(PurchaseInboundVo::getInboundAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto(); |
| | | purchaseReturnDto.setStartDate(accountReportDto.getEntryDateStart()); |
| | | purchaseReturnDto.setEndDate(accountReportDto.getEntryDateEnd()); |
| | | List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords(); |
| | | BigDecimal purchaseReturnAmount = Optional.of( |
| | | purchaseReturnVos.stream() |
| | | .map(PurchaseReturnVo::getTotalAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | ).orElse(BigDecimal.ZERO); |
| | | accountReportVo.setAccountsPayable(purchaseInAmount.subtract(purchaseReturnAmount)); |
| | | // 1.5 å婿¶¦ = æ»è¥æ¶ - æ»æ¯åº |
| | | BigDecimal netProfit = totalIncome.subtract(totalExpense); |
| | | accountReportVo.setNetRevenue(netProfit); |
| | | |
| | | // ========== 2. æçº¿å¾ï¼æåº¦è¥æ¶/æ¯åº/å婿¶¦è¶å¿ ========== |
| | | Map<String, BigDecimal> monthIncomeMap = new HashMap<>(); |
| | | Map<String, BigDecimal> monthExpenseMap = new HashMap<>(); |
| | | // æåº¦è¥æ¶ |
| | | accountSalesCollections.forEach(item -> { |
| | | String month = item.getCollectionDate().format(monthFormatter); |
| | | monthIncomeMap.put(month, monthIncomeMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .add(Optional.ofNullable(item.getCollectionAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | // æåº¦æ¯åº |
| | | accountPurchasePayments.forEach(item -> { |
| | | String month = item.getPaymentDate().format(monthFormatter); |
| | | monthExpenseMap.put(month, monthExpenseMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .add(Optional.ofNullable(item.getPaymentAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | // çæè¿ç»æä»½å表 |
| | | List<String> monthList = new ArrayList<>(); |
| | | LocalDate current = start.withDayOfMonth(1); |
| | | while (!current.isAfter(end.withDayOfMonth(1))) { |
| | | monthList.add(current.format(monthFormatter)); |
| | | current = current.plusMonths(1); |
| | | } |
| | | // ç»è£
è¶å¿æ°æ® |
| | | List<AccountReportVo.MonthlyTrendVO> trendList = new ArrayList<>(); |
| | | for (String month : monthList) { |
| | | BigDecimal income = monthIncomeMap.getOrDefault(month, BigDecimal.ZERO); |
| | | BigDecimal expense = monthExpenseMap.getOrDefault(month, BigDecimal.ZERO); |
| | | AccountReportVo.MonthlyTrendVO trend = new AccountReportVo.MonthlyTrendVO(); |
| | | trend.setMonth(month); |
| | | trend.setIncome(income); |
| | | trend.setExpense(expense); |
| | | trend.setProfit(income.subtract(expense)); |
| | | trendList.add(trend); |
| | | } |
| | | accountReportVo.setMonthlyTrendList(trendList); |
| | | |
| | | // ========== 3. æ±ç¶å¾ï¼æåº¦åºæ¶/åºä»æ°æ® ========== |
| | | Map<String, BigDecimal> monthReceivableMap = new HashMap<>(); |
| | | Map<String, BigDecimal> monthPayableMap = new HashMap<>(); |
| | | // æåº¦åºæ¶ï¼éå®åºåº-éè´§ï¼ |
| | | salesOutboundVos.forEach(item -> { |
| | | String month = item.getShippingDate().format(monthFormatter); |
| | | monthReceivableMap.put(month, monthReceivableMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .add(Optional.ofNullable(item.getOutboundAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | salesReturnVos.forEach(item -> { |
| | | String month = item.getMakeTime().format(monthFormatter); |
| | | monthReceivableMap.put(month, monthReceivableMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .subtract(Optional.ofNullable(item.getRefundAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | |
| | | // æåº¦åºä»ï¼éè´å
¥åº-éè´§ï¼ |
| | | purchaseInboundVos.forEach(item -> { |
| | | String month = item.getInboundDate().format(monthFormatter); |
| | | monthPayableMap.put(month, monthPayableMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .add(Optional.ofNullable(item.getInboundAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | purchaseReturnVos.forEach(item -> { |
| | | String month = item.getPreparedAt().format(monthFormatter); |
| | | monthPayableMap.put(month, monthPayableMap.getOrDefault(month, BigDecimal.ZERO) |
| | | .subtract(Optional.ofNullable(item.getTotalAmount()).orElse(BigDecimal.ZERO))); |
| | | }); |
| | | // ç»è£
åºæ¶åºä»æ°æ® |
| | | List<AccountReportVo.ReceivablePayableVO> rpList = new ArrayList<>(); |
| | | for (String month : monthList) { |
| | | AccountReportVo.ReceivablePayableVO rp = new AccountReportVo.ReceivablePayableVO(); |
| | | rp.setMonth(month); |
| | | rp.setReceivable(monthReceivableMap.getOrDefault(month, BigDecimal.ZERO)); |
| | | rp.setPayable(monthPayableMap.getOrDefault(month, BigDecimal.ZERO)); |
| | | rpList.add(rp); |
| | | } |
| | | accountReportVo.setReceivablePayableList(rpList); |
| | | return accountReportVo; |
| | | } |
| | | } |
| | |
| | | if (accountSubjectDto != null && accountSubjectDto.getStatus() != null) { |
| | | queryWrapper.eq(AccountSubject::getStatus, accountSubjectDto.getStatus()); |
| | | } |
| | | queryWrapper.orderByAsc(AccountSubject::getSubjectCode).orderByAsc(AccountSubject::getId); |
| | | queryWrapper.orderByDesc(AccountSubject::getSubjectCode).orderByDesc(AccountSubject::getId); |
| | | return queryWrapper; |
| | | } |
| | | |
| | |
| | | } |
| | | List<AccountSubject> sortedSubjects = new ArrayList<>(subjects); |
| | | sortedSubjects.sort(Comparator |
| | | .comparing(AccountSubject::getSubjectCode, Comparator.nullsLast(String::compareTo)) |
| | | .thenComparing(AccountSubject::getId, Comparator.nullsLast(Long::compareTo))); |
| | | .comparing(AccountSubject::getSubjectCode, Comparator.nullsFirst(String::compareTo)).reversed() |
| | | .thenComparing(AccountSubject::getId, Comparator.nullsFirst(Long::compareTo)).reversed()); |
| | | |
| | | Map<Long, AccountSubjectVo> subjectVoMap = new LinkedHashMap<>(); |
| | | for (AccountSubject subject : sortedSubjects) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.service.purchase.AccountPaymentApplicationService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾ç³è¯· æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:44:22 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountPaymentApplicationServiceImpl extends ServiceImpl<AccountPaymentApplicationMapper, AccountPaymentApplication> implements AccountPaymentApplicationService { |
| | | |
| | | private final AccountPaymentApplicationMapper accountPaymentApplicationMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss"); |
| | | |
| | | @Override |
| | | public IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto) { |
| | | return accountPaymentApplicationMapper.listPageAccountPaymentApplication(page, accountPaymentApplicationDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId) { |
| | | return accountPaymentApplicationMapper.getInboundBatchesBySupplier(supplierId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean addAccountPaymentApplication(AccountPaymentApplication accountPaymentApplication) { |
| | | if (StringUtils.isEmpty(accountPaymentApplication.getInvoiceApplicationNo())) { |
| | | accountPaymentApplication.setInvoiceApplicationNo(genPaymentApplicationNo()); |
| | | } |
| | | String stockInRecordIds= accountPaymentApplication.getStockInRecordIds(); |
| | | if (stockInRecordIds != null && !stockInRecordIds.isEmpty()) { |
| | | List<Long> ids = Arrays.stream(stockInRecordIds.split(",")) |
| | | .map(Long::valueOf) |
| | | .toList(); |
| | | if (accountPaymentApplicationMapper.existsByStockInRecordId(ids)){ |
| | | throw new ServiceException("åå¨éå¤çå
¥åºå"); |
| | | } |
| | | } |
| | | return save(accountPaymentApplication); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountPaymentApplication(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼è¯·éæ©è¦å é¤çæ°æ®"); |
| | | } |
| | | //夿æ¯å¦å·²ç»æå¯¹åºç仿¬¾å,妿æåæ æ³å é¤ |
| | | List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery().in(AccountPurchasePayment::getAccountPaymentApplicationId, ids)); |
| | | if (CollectionUtils.isNotEmpty(accountPurchasePayments)){ |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼å·²ç»æå
³èç仿¬¾å"); |
| | | } |
| | | //å é¤å¼ç¥¨ç³è¯· |
| | | return removeBatchByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto) { |
| | | List<AccountPaymentApplicationVo> list = accountPaymentApplicationMapper.listPageAccountPaymentApplication(new Page(1,-1),accountPaymentApplicationDto).getRecords(); |
| | | ExcelUtil<AccountPaymentApplicationVo> util = new ExcelUtil<>(AccountPaymentApplicationVo.class); |
| | | util.exportExcel(response, list , "仿¬¾ç³è¯·"); |
| | | } |
| | | |
| | | private String genPaymentApplicationNo() { |
| | | return "FK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchaseInvoiceMapper; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import com.ruoyi.account.service.purchase.AccountPurchaseInvoiceService; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--è¿é¡¹å票 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:06:17 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountPurchaseInvoiceServiceImpl extends ServiceImpl<AccountPurchaseInvoiceMapper, AccountPurchaseInvoice> implements AccountPurchaseInvoiceService { |
| | | |
| | | private final AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper; |
| | | private final StorageAttachmentMapper storageAttachmentMapper; |
| | | |
| | | @Override |
| | | public IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) { |
| | | return accountPurchaseInvoiceMapper.listPageAccountPurchaseInvoice(page, accountPurchaseInvoiceDto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountPurchaseInvoice(List<Long> ids) { |
| | | List<AccountPurchaseInvoice> accountPurchaseInvoices = accountPurchaseInvoiceMapper.selectByIds(ids); |
| | | //å é¤éä»¶ |
| | | storageAttachmentMapper.deleteBatchIds(accountPurchaseInvoices.stream().map(AccountPurchaseInvoice::getStorageAttachmentId).toList()); |
| | | return removeBatchByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) { |
| | | List<AccountPurchaseInvoiceVo> list = accountPurchaseInvoiceMapper.listPageAccountPurchaseInvoice(new Page(1,-1),accountPurchaseInvoiceDto).getRecords(); |
| | | ExcelUtil<AccountPurchaseInvoiceVo> util = new ExcelUtil<>(AccountPurchaseInvoiceVo.class); |
| | | util.exportExcel(response, list , "è¿é¡¹å票"); |
| | | } |
| | | |
| | | @Override |
| | | public List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId) { |
| | | return accountPurchaseInvoiceMapper.getInboundBatchesBySupplier(supplierId); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.mapper.AccountStatementDetailsMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.service.purchase.AccountPurchasePaymentService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 04:14:51 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountPurchasePaymentServiceImpl extends ServiceImpl<AccountPurchasePaymentMapper, AccountPurchasePayment> implements AccountPurchasePaymentService { |
| | | |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss"); |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final AccountStatementDetailsMapper accountStatementDetailsMapper; |
| | | private final AccountPaymentApplicationMapper accountPaymentApplicationMapper; |
| | | |
| | | @Override |
| | | public IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto) { |
| | | return accountPurchasePaymentMapper.listPageAccountPurchasePayment(page, accountPurchasePaymentDto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean addAccountPurchasePayment(AccountPurchasePayment accountPurchasePayment) { |
| | | if (StringUtils.isEmpty(accountPurchasePayment.getPaymentNumber())) { |
| | | accountPurchasePayment.setPaymentNumber(genAccountPurchasePaymentNo()); |
| | | } |
| | | //æ ¡éªç´¯è®¡ä»æ¬¾éé¢ä¸è½è¶
è¿ç³è¯·éé¢ |
| | | AccountPaymentApplication accountPaymentApplication = accountPaymentApplicationMapper.selectById(accountPurchasePayment.getAccountPaymentApplicationId()); |
| | | List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery().eq(AccountPurchasePayment::getAccountPaymentApplicationId, accountPurchasePayment.getAccountPaymentApplicationId())); |
| | | BigDecimal totalPaymentAmount = accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | if (accountPaymentApplication.getPaymentAmount().compareTo(totalPaymentAmount) < 0) { |
| | | throw new ServiceException("ç´¯è®¡ä»æ¬¾éé¢ä¸è½è¶
è¿ç³è¯·éé¢"); |
| | | } |
| | | return save(accountPurchasePayment); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto) { |
| | | List<AccountPurchasePaymentVo> list = accountPurchasePaymentMapper.listPageAccountPurchasePayment(new Page(1,-1),accountPurchasePaymentDto).getRecords(); |
| | | ExcelUtil<AccountPurchasePaymentVo> util = new ExcelUtil<>(AccountPurchasePaymentVo.class); |
| | | util.exportExcel(response, list , "仿¬¾å"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountPurchasePayment(List<Long> ids) { |
| | | //å¦æè¯¥ä»æ¬¾åå·²ç»çæå¯¹è´¦ååæ æ³å é¤ |
| | | List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectByIds(ids); |
| | | List<String> strings = accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentNumber).toList(); |
| | | List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsMapper.selectList(Wrappers.<AccountStatementDetails>lambdaQuery() |
| | | .in(AccountStatementDetails::getReceiptNumber, strings)); |
| | | if (CollectionUtils.isNotEmpty(accountStatementDetails)){ |
| | | throw new ServiceException("è¯¥ä»æ¬¾åå·²ç»çæå¯¹è´¦åï¼æ æ³å é¤"); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | private String genAccountPurchasePaymentNo() { |
| | | return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.mapper.sales.AccountInvoiceApplicationMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesInvoiceMapper; |
| | | import com.ruoyi.account.pojo.sales.AccountInvoiceApplication; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import com.ruoyi.account.service.sales.AccountInvoiceApplicationService; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯· æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 01:38:32 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountInvoiceApplicationServiceImpl extends ServiceImpl<AccountInvoiceApplicationMapper, AccountInvoiceApplication> implements AccountInvoiceApplicationService { |
| | | |
| | | private final AccountInvoiceApplicationMapper accountInvoiceApplicationMapper; |
| | | private final AccountSalesInvoiceMapper accountSalesInvoiceMapper; |
| | | private final StorageAttachmentMapper storageAttachmentMapper; |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss"); |
| | | |
| | | @Override |
| | | public IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto) { |
| | | return accountInvoiceApplicationMapper.listPageAccountInvoiceApplication(page, accountInvoiceApplicationDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId) { |
| | | return accountInvoiceApplicationMapper.getOutboundBatchesByCustomer(customerId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean addAccountInvoiceApplication(AccountInvoiceApplication accountInvoiceApplication) { |
| | | if (StringUtils.isEmpty(accountInvoiceApplication.getInvoiceApplicationNo())) { |
| | | accountInvoiceApplication.setInvoiceApplicationNo(genInvoiceApplicationNo()); |
| | | } |
| | | String stockOutRecordIds = accountInvoiceApplication.getStockOutRecordIds(); |
| | | if (stockOutRecordIds != null && !stockOutRecordIds.isEmpty()) { |
| | | List<Long> ids = Arrays.stream(stockOutRecordIds.split(",")) |
| | | .map(Long::valueOf) |
| | | .toList(); |
| | | if (accountInvoiceApplicationMapper.existsByStockOutRecordId(ids)){ |
| | | throw new ServiceException("åå¨éå¤çåºåºå"); |
| | | } |
| | | } |
| | | return save(accountInvoiceApplication); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto) { |
| | | List<AccountInvoiceApplicationVo> list = accountInvoiceApplicationMapper.listPageAccountInvoiceApplication(new Page(1,-1),accountInvoiceApplicationDto).getRecords(); |
| | | ExcelUtil<AccountInvoiceApplicationVo> util = new ExcelUtil<>(AccountInvoiceApplicationVo.class); |
| | | util.exportExcel(response, list , "å¼ç¥¨ç³è¯·"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountInvoiceApplication(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼è¯·éæ©è¦å é¤çæ°æ®"); |
| | | } |
| | | //å é¤ç¸å
³éä»¶ |
| | | List<AccountSalesInvoice> accountSalesInvoices = accountSalesInvoiceMapper.selectList(Wrappers.<AccountSalesInvoice>lambdaQuery().in(AccountSalesInvoice::getAccountInvoiceApplicationId,ids)); |
| | | storageAttachmentMapper.deleteBatchIds(accountSalesInvoices.stream().map(AccountSalesInvoice::getStorageAttachmentId).toList()); |
| | | //å é¤ç¸å
³çé项å票 |
| | | accountSalesInvoiceMapper.delete(Wrappers.<AccountSalesInvoice>lambdaQuery().in(AccountSalesInvoice::getAccountInvoiceApplicationId,ids)); |
| | | //å é¤å¼ç¥¨ç³è¯· |
| | | return removeBatchByIds(ids); |
| | | } |
| | | |
| | | private String genInvoiceApplicationNo() { |
| | | return "KP" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.mapper.AccountStatementDetailsMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.AccountStatementDetails; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.account.service.sales.AccountSalesCollectionService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--æ¶æ¬¾å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:49:56 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesCollectionServiceImpl extends ServiceImpl<AccountSalesCollectionMapper, AccountSalesCollection> implements AccountSalesCollectionService { |
| | | |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final AccountStatementDetailsMapper accountStatementDetailsMapper; |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss"); |
| | | |
| | | |
| | | @Override |
| | | public IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto) { |
| | | return accountSalesCollectionMapper.listPageAccountSalesCollection(page, accountSalesCollectionDto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean addAccountSalesCollection(AccountSalesCollection accountSalesCollection) { |
| | | if (StringUtils.isEmpty(accountSalesCollection.getCollectionNumber())) { |
| | | accountSalesCollection.setCollectionNumber(genAccountSalesCollectionNo()); |
| | | } |
| | | String stockOutRecordIds = accountSalesCollection.getStockOutRecordIds(); |
| | | if (stockOutRecordIds != null && !stockOutRecordIds.isEmpty()) { |
| | | List<Long> ids = Arrays.stream(stockOutRecordIds.split(",")) |
| | | .map(Long::valueOf) |
| | | .toList(); |
| | | if (accountSalesCollectionMapper.existsByStockOutRecordId(ids)){ |
| | | throw new ServiceException("åå¨éå¤çåºåºå"); |
| | | } |
| | | } |
| | | return save(accountSalesCollection); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto) { |
| | | List<AccountSalesCollectionVo> list = accountSalesCollectionMapper.listPageAccountSalesCollection(new Page(1,-1),accountSalesCollectionDto).getRecords(); |
| | | ExcelUtil<AccountSalesCollectionVo> util = new ExcelUtil<>(AccountSalesCollectionVo.class); |
| | | util.exportExcel(response, list , "æ¶æ¬¾å"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountSalesCollection(List<Long> ids) { |
| | | //å¦æè¯¥æ¶æ¬¾åå·²ç»çæå¯¹è´¦ååæ æ³å é¤ |
| | | List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectByIds(ids); |
| | | List<String> strings = accountSalesCollections.stream().map(AccountSalesCollection::getCollectionNumber).toList(); |
| | | List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsMapper.selectList(Wrappers.<AccountStatementDetails>lambdaQuery() |
| | | .in(AccountStatementDetails::getReceiptNumber, strings)); |
| | | if (CollectionUtils.isNotEmpty(accountStatementDetails)){ |
| | | throw new ServiceException("è¯¥æ¶æ¬¾åå·²ç»çæå¯¹è´¦åï¼æ æ³å é¤"); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId) { |
| | | return accountSalesCollectionMapper.getOutboundBatchesByCustomer(customerId); |
| | | } |
| | | |
| | | private String genAccountSalesCollectionNo() { |
| | | return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesInvoiceMapper; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import com.ruoyi.account.service.sales.AccountSalesInvoiceService; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--é项å票 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:10:20 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesInvoiceServiceImpl extends ServiceImpl<AccountSalesInvoiceMapper, AccountSalesInvoice> implements AccountSalesInvoiceService { |
| | | |
| | | private final AccountSalesInvoiceMapper accountSalesInvoiceMapper; |
| | | private final StorageAttachmentMapper storageAttachmentMapper; |
| | | |
| | | @Override |
| | | public IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto) { |
| | | return accountSalesInvoiceMapper.listPageAccountSalesInvoice(page, accountSalesInvoiceDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto) { |
| | | List<AccountSalesInvoiceVo> list = accountSalesInvoiceMapper.listPageAccountSalesInvoice(new Page(1,-1),accountSalesInvoiceDto).getRecords(); |
| | | ExcelUtil<AccountSalesInvoiceVo> util = new ExcelUtil<>(AccountSalesInvoiceVo.class); |
| | | util.exportExcel(response, list , "é项å票"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAccountSalesInvoice(List<Long> ids) { |
| | | List<AccountSalesInvoice> accountSalesInvoices = accountSalesInvoiceMapper.selectByIds(ids); |
| | | //å é¤éä»¶ |
| | | storageAttachmentMapper.deleteBatchIds(accountSalesInvoices.stream().map(AccountSalesInvoice::getStorageAttachmentId).toList()); |
| | | return removeBatchByIds(ids); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾ç³è¯· æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:44:22 |
| | | */ |
| | | public interface AccountPaymentApplicationService extends IService<AccountPaymentApplication> { |
| | | |
| | | IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto); |
| | | |
| | | List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId); |
| | | |
| | | boolean addAccountPaymentApplication(AccountPaymentApplication accountPaymentApplication); |
| | | |
| | | boolean deleteAccountPaymentApplication(List<Long> ids); |
| | | |
| | | void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--è¿é¡¹å票 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 03:06:17 |
| | | */ |
| | | public interface AccountPurchaseInvoiceService extends IService<AccountPurchaseInvoice> { |
| | | |
| | | IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto); |
| | | |
| | | boolean deleteAccountPurchaseInvoice(List<Long> ids); |
| | | |
| | | void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto); |
| | | |
| | | List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--仿¬¾å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 04:14:51 |
| | | */ |
| | | public interface AccountPurchasePaymentService extends IService<AccountPurchasePayment> { |
| | | |
| | | IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto); |
| | | |
| | | boolean addAccountPurchasePayment(AccountPurchasePayment accountPurchasePayment); |
| | | |
| | | void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto); |
| | | |
| | | boolean deleteAccountPurchasePayment(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.pojo.sales.AccountInvoiceApplication; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--å¼ç¥¨ç³è¯· æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 01:38:32 |
| | | */ |
| | | public interface AccountInvoiceApplicationService extends IService<AccountInvoiceApplication> { |
| | | |
| | | IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto); |
| | | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId); |
| | | |
| | | boolean addAccountInvoiceApplication(AccountInvoiceApplication accountInvoiceApplication); |
| | | |
| | | void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto); |
| | | |
| | | boolean deleteAccountInvoiceApplication(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--æ¶æ¬¾å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:49:56 |
| | | */ |
| | | public interface AccountSalesCollectionService extends IService<AccountSalesCollection> { |
| | | |
| | | IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto); |
| | | |
| | | boolean addAccountSalesCollection(AccountSalesCollection accountSalesCollection); |
| | | |
| | | void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto); |
| | | |
| | | boolean deleteAccountSalesCollection(List<Long> ids); |
| | | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto; |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesInvoice; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ç--é项å票 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:10:20 |
| | | */ |
| | | public interface AccountSalesInvoiceService extends IService<AccountSalesInvoice> { |
| | | |
| | | IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto); |
| | | |
| | | void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto); |
| | | |
| | | boolean deleteAccountSalesInvoice(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢ä¸´æå®å") |
| | | @Log(title = "æ°å¢ä¸´æå®å", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody AfterSalesNearExpiry entity) { |
| | | public AjaxResult add(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.add(entity); |
| | | return R.ok(null, "æ·»å æå"); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "æ´æ°ä¸´æå®å") |
| | | @Log(title = "æ´æ°ä¸´æå®å", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody AfterSalesNearExpiry entity) { |
| | | public AjaxResult update(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.update(entity); |
| | | return R.ok(null, "æ´æ°æå"); |
| | | return AjaxResult.success("æ´æ°æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤ä¸´æå®å") |
| | | @Log(title = "å é¤ä¸´æå®å", businessType = BusinessType.DELETE) |
| | | public R<?> delete(Long[] ids) { |
| | | public AjaxResult delete(Long[] ids) { |
| | | afterSalesNearExpiryService.delete(ids); |
| | | return R.ok(null, "å 餿å"); |
| | | return AjaxResult.success("å 餿å"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢ä¸´æå®å") |
| | | @Log(title = "å页æ¥è¯¢ä¸´æå®å", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | public AjaxResult listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | IPage<AfterSalesNearExpiry> listPage = afterSalesNearExpiryService.listPage(page, entity); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å®åæå¡-å页æ¥è¯¢") |
| | | @Log(title = "å®åæå¡-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @Log(title = "å®åæå¡-åé¦ç»è®°", businessType = BusinessType.EXPORT) |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "å®åæå¡-æ°å¢") |
| | | @Log(title = "å®åæå¡-æ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? R.ok() : R.fail(); |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "å®åæå¡-ä¿®æ¹") |
| | | @Log(title = "å®åæå¡-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) { |
| | | String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream() |
| | | .map(String::valueOf) |
| | |
| | | afterSalesServiceNewDto.setProductModelIds(productModelIds); |
| | | } |
| | | boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å®åæå¡-å é¤") |
| | | @Log(title = "å®åæå¡-å é¤", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | boolean delete = afterSalesServiceService.removeByIds(ids); |
| | | return delete ? R.ok() : R.fail(); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/dispose") |
| | | @Operation(summary = "å®åæå¡-å¤ç") |
| | | @Log(title = "å®åæå¡-å¤ç", businessType = BusinessType.UPDATE) |
| | | public R<?> dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | AfterSalesService byId = afterSalesServiceService.getById(afterSalesService.getId()); |
| | | if(byId == null) throw new RuntimeException("æªæ¾å°è¯¥æ°æ®"); |
| | | if(byId.getStatus().equals(2)) throw new RuntimeException("è¯¥æ°æ®å·²å¤ç"); |
| | |
| | | afterSalesService.setDisposeNickName(sysUser.getNickName()); |
| | | afterSalesService.setStatus(2); |
| | | boolean update = afterSalesServiceService.updateById(afterSalesService); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @Operation(summary = "å®åæå¡-è·åéå®å°è´¦") |
| | | public R<?> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return R.ok(list); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @Operation(summary = "å®åæå¡-æ ¹æ®idè·å详æ
") |
| | | public R<?> getById(Long id) { |
| | | return R.ok(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @Operation(summary = "å®åæå¡-ç»è®¡å·¥åæ
åµ") |
| | | @GetMapping("count") |
| | | public R<?> count() { |
| | | return R.ok(afterSalesServiceService.countAfterSalesService()); |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @PostMapping("/upload") |
| | | @Operation(summary = "å®åæå¡-æä»¶ä¸ä¼ ") |
| | | @Log(title = "å®åæå¡-æä»¶ä¸ä¼ ", businessType = BusinessType.INSERT) |
| | | public R<?> fileUpload(@RequestParam("file") MultipartFile file, |
| | | public AjaxResult fileUpload(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("id") Long afterSalesServiceId) { |
| | | afterSalesServiceFileService.fileUpload(file, afterSalesServiceId); |
| | | return R.ok(null, "ä¸ä¼ æå"); |
| | | return AjaxResult.success("ä¸ä¼ æå"); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å®åå¤ç-å®åéä»¶å表") |
| | | @Log(title = "å®åå¤ç-å®åéä»¶å表", businessType = BusinessType.OTHER) |
| | | public R<?> fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return R.ok(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | public AjaxResult fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return AjaxResult.success(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{fileId}") |
| | | @Operation(summary = "å®åå¤ç-å é¤éä»¶") |
| | | @Log(title = "å®åå¤ç-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public R<?> delFile(@PathVariable Long fileId) { |
| | | public AjaxResult delFile(@PathVariable Long fileId) { |
| | | afterSalesServiceFileService.delFile(fileId); |
| | | return R.ok(null, "å 餿å!"); |
| | | return AjaxResult.success("å 餿å!"); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.aftersalesservice.service.AfterSalesServiceService; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | if(sysUser == null) throw new RuntimeException("å®¡æ ¸äººä¸åå¨"); |
| | | afterSalesServiceNewDto.setCheckNickName(sysUser.getNickName()); |
| | | if (StringUtils.isEmpty(afterSalesServiceNewDto.getAfterSalesServiceNo())) { |
| | | String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_"); |
| | | String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_", afterSalesServiceNewDto.getCreateTime() != null ? afterSalesServiceNewDto.getCreateTime() : LocalDateTime.now()); |
| | | afterSalesServiceNewDto.setAfterSalesServiceNo(string); |
| | | } |
| | | return this.save(afterSalesServiceNewDto); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import dev.langchain4j.service.MemoryId; |
| | | import dev.langchain4j.service.SystemMessage; |
| | | import dev.langchain4j.service.UserMessage; |
| | | import dev.langchain4j.service.V; |
| | | import dev.langchain4j.service.spring.AiService; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; |
| | | |
| | | @AiService( |
| | | wiringMode = EXPLICIT, |
| | | streamingChatModel = "qwenStreamingChatModel", |
| | | chatMemoryProvider = "chatMemoryProviderFinancial", |
| | | tools = "financialAgentTools" |
| | | ) |
| | | public interface FinancialAgent { |
| | | |
| | | @SystemMessage(fromResource = "financial-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.assistant; |
| | | |
| | | import com.ruoyi.ai.tools.FinancialAgentTools; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Component |
| | | public class FinancialIntentExecutor { |
| | | |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final Pattern LIMIT_PATTERN = Pattern.compile("(?:å|æè¿|å±ç¤º|è¿å)?\\s*(\\d{1,2})\\s*(?:æ¡|个|å)"); |
| | | private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})"); |
| | | private static final Pattern RELATIVE_DAY_PATTERN = Pattern.compile("(?:è¿|æè¿)\\s*(\\d{1,3})\\s*天"); |
| | | private static final Pattern FUTURE_MONTH_PATTERN = Pattern.compile("(?:æªæ¥|åç»|æ¥ä¸æ¥)\\s*(\\d{1,2})\\s*(?:个)?æ"); |
| | | |
| | | private final FinancialAgentTools financialAgentTools; |
| | | |
| | | public FinancialIntentExecutor(FinancialAgentTools financialAgentTools) { |
| | | this.financialAgentTools = financialAgentTools; |
| | | } |
| | | |
| | | public String tryExecute(String memoryId, String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return null; |
| | | } |
| | | String text = message.trim(); |
| | | |
| | | String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text); |
| | | if (StringUtils.hasText(quickPromptResponse)) { |
| | | return quickPromptResponse; |
| | | } |
| | | |
| | | DateRange dateRange = extractDateRange(text); |
| | | Integer limit = extractLimit(text); |
| | | String keyword = extractKeyword(text); |
| | | String startDate = dateRange.startDate(); |
| | | String endDate = dateRange.endDate(); |
| | | String timeRange = dateRange.label(); |
| | | |
| | | if (containsAny(text, "ææ¬æ ¸ç®", "äº§åææ¬", "å·¥åºææ¬", "äººå·¥ææ¬", "ææ§", "æææè", "ææ¬æé«")) { |
| | | return financialAgentTools.calculateIntelligentCost(memoryId, startDate, endDate, timeRange, keyword, limit); |
| | | } |
| | | if (containsAny(text, "婿¶¦åæ", "订å婿¶¦", "äºæè®¢å", "ä½å©æ¶¦", "æèµé±å®¢æ·", "åªä¸ªå®¢æ·æèµé±", |
| | | "å®¢æ·æèµé±", "婿¶¦æé«å®¢æ·", "婿¶¦è´¡ç®æé«", "婿¶¦ä¸é")) { |
| | | return financialAgentTools.analyzeOrderProfit(memoryId, startDate, endDate, timeRange, keyword, limit); |
| | | } |
| | | if (containsAny(text, "åºåèµé", "åºå积å", "åæ»åºå", "èµéå ç¨", "å¨è½¬ç", "åºåå¨è½¬")) { |
| | | return financialAgentTools.analyzeInventoryCapital(memoryId, startDate, endDate, timeRange, keyword, limit); |
| | | } |
| | | if (containsAny(text, "ç°éæµ", "忬¾é£é©", "仿¬¾åå", "èµé缺å£", "åºæ¶", "åºä»", "忬¾é¢æµ")) { |
| | | return financialAgentTools.forecastCashFlow(memoryId, startDate, endDate, timeRange, extractForecastMonths(text)); |
| | | } |
| | | if (containsAny(text, "å¼å¸¸é¢è¦", "ç»è¥å¼å¸¸", "é£é©é¢è¦", "ææ¬å¼å¸¸", "婿¶¦å¼å¸¸", "忬¾å¼å¸¸", "订åé£é©")) { |
| | | return financialAgentTools.detectBusinessAnomalies(memoryId, startDate, endDate, timeRange, limit); |
| | | } |
| | | if (containsAny(text, "驾驶è±", "ç»è¥çæ¿", "ç»è¥æ»è§", "ç»è¥ä»ªè¡¨ç", "ç»è¥å¤§ç")) { |
| | | return financialAgentTools.getBusinessCockpit(memoryId, startDate, endDate, timeRange); |
| | | } |
| | | if (containsAny(text, "æ¥æ¥", "卿¥", "ç»è¥æ¥å", "åææ¥å")) { |
| | | return financialAgentTools.generateOperationReport(memoryId, startDate, endDate, timeRange, |
| | | containsAny(text, "卿¥") ? "weekly" : "daily"); |
| | | } |
| | | if (containsAny(text, "ä¸è´¢èå", "ä¸è´¢èå¨", "å£å¾", "ææ è§£é", "为ä»ä¹")) { |
| | | return financialAgentTools.retrieveFinancialKnowledge(memoryId, text); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String tryExecuteQuickPrompt(String memoryId, String text) { |
| | | String normalized = normalizeForMatch(text); |
| | | if ("çææ¬å¨ç»è¥å¨æ¥å©æ¶¦ä¸ç°éæµ".equals(normalized) || "çææ¬å¨ç»è¥å¨æ¥".equals(normalized) || "çæå¨æ¥".equals(normalized)) { |
| | | DateRange range = weekRange(); |
| | | return financialAgentTools.generateOperationReport(memoryId, range.startDate(), range.endDate(), range.label(), "weekly"); |
| | | } |
| | | if ("åææ¬æå©æ¶¦ä¸éåå ".equals(normalized)) { |
| | | DateRange range = monthRange(); |
| | | return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null); |
| | | } |
| | | if ("è¿30天åªä¸ªå®¢æ·å©æ¶¦è´¡ç®æé«".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null); |
| | | } |
| | | if ("æ¥çæ¬æç»è¥é©¾é©¶è±".equals(normalized) || "æ¥çç»è¥é©¾é©¶è±".equals(normalized)) { |
| | | DateRange range = monthRange(); |
| | | return financialAgentTools.getBusinessCockpit(memoryId, range.startDate(), range.endDate(), range.label()); |
| | | } |
| | | if ("æ¥è¯¢è¿30å¤©äºæè®¢å".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null); |
| | | } |
| | | if ("åæè¿30天åºåèµéå ç¨".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return financialAgentTools.analyzeInventoryCapital(memoryId, range.startDate(), range.endDate(), range.label(), null, null); |
| | | } |
| | | if ("颿µæªæ¥3个æç°éæµ".equals(normalized)) { |
| | | return financialAgentTools.forecastCashFlow(memoryId, null, null, null, 3); |
| | | } |
| | | if ("åªä¸ªå·¥åºææ¬æé«".equals(normalized)) { |
| | | return financialAgentTools.calculateIntelligentCost(memoryId, null, null, null, null, null); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private Integer extractLimit(String text) { |
| | | Matcher matcher = LIMIT_PATTERN.matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(1)) : null; |
| | | } |
| | | |
| | | private Integer extractForecastMonths(String text) { |
| | | Matcher matcher = FUTURE_MONTH_PATTERN.matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(1)) : null; |
| | | } |
| | | |
| | | private DateRange extractDateRange(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | if (matcher.find()) { |
| | | String first = matcher.group(1); |
| | | String second = matcher.find() ? matcher.group(1) : first; |
| | | return buildDateRange(first, second, first + "è³" + second); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | return monthRange(); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | return lastMonthRange(); |
| | | } |
| | | if (text.contains("ä»å¹´") || text.contains("æ¬å¹´")) { |
| | | return yearRange(); |
| | | } |
| | | if (text.contains("æ¬å¨")) { |
| | | return weekRange(); |
| | | } |
| | | Matcher relativeDayMatcher = RELATIVE_DAY_PATTERN.matcher(text); |
| | | if (relativeDayMatcher.find()) { |
| | | int days = Integer.parseInt(relativeDayMatcher.group(1)); |
| | | return recentDaysRange(days); |
| | | } |
| | | return new DateRange(null, null, null); |
| | | } |
| | | |
| | | private DateRange buildDateRange(String start, String end, String label) { |
| | | LocalDate startDate = parseDate(start); |
| | | LocalDate endDate = parseDate(end); |
| | | if (startDate == null || endDate == null) { |
| | | return new DateRange(null, null, null); |
| | | } |
| | | if (startDate.isAfter(endDate)) { |
| | | LocalDate temp = startDate; |
| | | startDate = endDate; |
| | | endDate = temp; |
| | | } |
| | | return new DateRange(formatDate(startDate), formatDate(endDate), label); |
| | | } |
| | | |
| | | private DateRange recentDaysRange(int days) { |
| | | LocalDate end = LocalDate.now(); |
| | | int safeDays = Math.max(days, 1); |
| | | LocalDate start = end.minusDays(safeDays - 1L); |
| | | return new DateRange(formatDate(start), formatDate(end), "è¿" + safeDays + "天"); |
| | | } |
| | | |
| | | private DateRange monthRange() { |
| | | LocalDate today = LocalDate.now(); |
| | | return new DateRange(formatDate(today.withDayOfMonth(1)), formatDate(today), "æ¬æ"); |
| | | } |
| | | |
| | | private DateRange weekRange() { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | return new DateRange(formatDate(start), formatDate(today), "æ¬å¨"); |
| | | } |
| | | |
| | | private DateRange lastMonthRange() { |
| | | YearMonth lastMonth = YearMonth.now().minusMonths(1); |
| | | return new DateRange(formatDate(lastMonth.atDay(1)), formatDate(lastMonth.atEndOfMonth()), "䏿"); |
| | | } |
| | | |
| | | private DateRange yearRange() { |
| | | LocalDate today = LocalDate.now(); |
| | | return new DateRange(formatDate(today.withDayOfYear(1)), formatDate(today), "ä»å¹´"); |
| | | } |
| | | |
| | | private LocalDate parseDate(String text) { |
| | | try { |
| | | return LocalDate.parse(text, DATE_FMT); |
| | | } catch (Exception ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String formatDate(LocalDate date) { |
| | | return date == null ? null : date.format(DATE_FMT); |
| | | } |
| | | |
| | | private String normalizeForMatch(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return ""; |
| | | } |
| | | return text.replace("ï¼", "") |
| | | .replace("ï¼", "") |
| | | .replace("(", "") |
| | | .replace(")", "") |
| | | .replace("ï¼", "") |
| | | .replace(",", "") |
| | | .replace("ã", "") |
| | | .replace(".", "") |
| | | .replace("ï¼", "") |
| | | .replace("!", "") |
| | | .replace("ï¼", "") |
| | | .replace("?", "") |
| | | .replace("ï¼", "") |
| | | .replace(":", "") |
| | | .replace("ï¼", "") |
| | | .replace(";", "") |
| | | .replace(" ", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private String extractKeyword(String text) { |
| | | String cleaned = text |
| | | .replaceAll("\\d{4}-\\d{2}-\\d{2}", "") |
| | | .replaceAll("(?:è¿|æè¿)\\s*\\d{1,3}\\s*天", "") |
| | | .replaceAll("(?:å|æè¿|å±ç¤º|è¿å)?\\s*\\d{1,2}\\s*(?:æ¡|个|å)", "") |
| | | .replace("æ¥è¯¢", "") |
| | | .replace("æ¥ç", "") |
| | | .replace("çä¸", "") |
| | | .replace("çç", "") |
| | | .replace("帮æ", "") |
| | | .replace("请", "") |
| | | .replace("ä¸ä¸ª", "") |
| | | .replace("为ä»ä¹", "") |
| | | .replace("åªä¸ªå®¢æ·æèµé±", "") |
| | | .replace("æè¿åªä¸ªå®¢æ·æèµé±", "") |
| | | .replace("æ¬æåªä¸ªå®¢æ·æèµé±", "") |
| | | .replace("è¿30天åªä¸ªå®¢æ·æèµé±", "") |
| | | .replace("æèµé±å®¢æ·", "") |
| | | .replace("å®¢æ·æèµé±", "") |
| | | .replace("åªä¸ªå®¢æ·å©æ¶¦æé«", "") |
| | | .replace("婿¶¦æé«å®¢æ·", "") |
| | | .replace("åªä¸ªå®¢æ·å©æ¶¦è´¡ç®æé«", "") |
| | | .replace("婿¶¦è´¡ç®æé«å®¢æ·", "") |
| | | .replace("æ¬æ", "") |
| | | .replace("æ¬å¨", "") |
| | | .replace("æ¬å¹´", "") |
| | | .replace("ä»å¹´", "") |
| | | .replace("䏿", "") |
| | | .replace("è¿30天", "") |
| | | .replace("è¿7天", "") |
| | | .replace("è¿90天", "") |
| | | .replace("å10æ¡", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .replace("å20æ¡", "") |
| | | .replace("æè¿20æ¡", "") |
| | | .replace("订å婿¶¦åæ", "") |
| | | .replace("婿¶¦åæ", "") |
| | | .replace("åºåèµéåæ", "") |
| | | .replace("ç°éæµé¢æµ", "") |
| | | .replace("ç»è¥é©¾é©¶è±", "") |
| | | .replace("æ¥æ¥", "") |
| | | .replace("卿¥", "") |
| | | .replace("å¼å¸¸é¢è¦", "") |
| | | .replace("æ¡", "") |
| | | .trim(); |
| | | return cleaned.length() >= 2 ? cleaned : null; |
| | | } |
| | | |
| | | private record DateRange(String startDate, String endDate, String label) { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.config; |
| | | |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import dev.langchain4j.memory.chat.ChatMemoryProvider; |
| | | import dev.langchain4j.memory.chat.MessageWindowChatMemory; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class FinancialAgentConfig { |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProviderFinancial(MongoChatMemoryStore mongoChatMemoryStore) { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(40) |
| | | .chatMemoryStore(mongoChatMemoryStore) |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.Duration; |
| | | import java.time.Instant; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | |
| | | public class AiSessionUserContext { |
| | | |
| | | private final Map<String, LoginUser> loginUserByMemoryId = new ConcurrentHashMap<>(); |
| | | private final Map<String, Instant> lastAccessTimeByMemoryId = new ConcurrentHashMap<>(); |
| | | private static final Duration SESSION_TIMEOUT = Duration.ofHours(24); |
| | | |
| | | public void bind(String memoryId, LoginUser loginUser) { |
| | | if (!StringUtils.hasText(memoryId) || loginUser == null) { |
| | | return; |
| | | } |
| | | loginUserByMemoryId.put(memoryId, loginUser); |
| | | lastAccessTimeByMemoryId.put(memoryId, Instant.now()); |
| | | } |
| | | |
| | | public LoginUser get(String memoryId) { |
| | | if (!StringUtils.hasText(memoryId)) { |
| | | return null; |
| | | } |
| | | if (isExpired(memoryId)) { |
| | | remove(memoryId); |
| | | return null; |
| | | } |
| | | lastAccessTimeByMemoryId.put(memoryId, Instant.now()); |
| | | return loginUserByMemoryId.get(memoryId); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | loginUserByMemoryId.remove(memoryId); |
| | | lastAccessTimeByMemoryId.remove(memoryId); |
| | | } |
| | | |
| | | public void cleanExpiredSessions() { |
| | | Instant now = Instant.now(); |
| | | lastAccessTimeByMemoryId.entrySet().removeIf(entry -> { |
| | | boolean expired = Duration.between(entry.getValue(), now).compareTo(SESSION_TIMEOUT) > 0; |
| | | if (expired) { |
| | | loginUserByMemoryId.remove(entry.getKey()); |
| | | } |
| | | return expired; |
| | | }); |
| | | } |
| | | |
| | | private boolean isExpired(String memoryId) { |
| | | Instant lastAccess = lastAccessTimeByMemoryId.get(memoryId); |
| | | if (lastAccess == null) { |
| | | return true; |
| | | } |
| | | return Duration.between(lastAccess, Instant.now()).compareTo(SESSION_TIMEOUT) > 0; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.controller; |
| | | |
| | | import com.ruoyi.ai.assistant.FinancialAgent; |
| | | import com.ruoyi.ai.assistant.FinancialIntentExecutor; |
| | | import com.ruoyi.ai.bean.ChatForm; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.ai.service.AiChatSessionService; |
| | | import com.ruoyi.ai.store.MongoChatMemoryStore; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @Tag(name = "è´¢å¡æºè½ä½") |
| | | @RestController |
| | | @RequestMapping("/financial-ai") |
| | | public class FinancialAiController extends BaseController { |
| | | |
| | | private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai"); |
| | | |
| | | private final FinancialAgent financialAgent; |
| | | private final FinancialIntentExecutor financialIntentExecutor; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | private final MongoChatMemoryStore mongoChatMemoryStore; |
| | | private final AiChatSessionService aiChatSessionService; |
| | | |
| | | public FinancialAiController(FinancialAgent financialAgent, |
| | | FinancialIntentExecutor financialIntentExecutor, |
| | | AiSessionUserContext aiSessionUserContext, |
| | | MongoChatMemoryStore mongoChatMemoryStore, |
| | | AiChatSessionService aiChatSessionService) { |
| | | this.financialAgent = financialAgent; |
| | | this.financialIntentExecutor = financialIntentExecutor; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | this.mongoChatMemoryStore = mongoChatMemoryStore; |
| | | this.aiChatSessionService = aiChatSessionService; |
| | | } |
| | | |
| | | @Operation(summary = "è´¢å¡æºè½ä½å¯¹è¯") |
| | | @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8") |
| | | public Flux<String> chat(@RequestBody ChatForm chatForm) { |
| | | if (!StringUtils.hasText(chatForm.getMemoryId())) { |
| | | return Flux.just("memoryIdä¸è½ä¸ºç©º"); |
| | | } |
| | | if (!StringUtils.hasText(chatForm.getMessage())) { |
| | | return Flux.just("messageä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String memoryId = chatForm.getMemoryId(); |
| | | String userMessage = chatForm.getMessage(); |
| | | |
| | | aiSessionUserContext.bind(memoryId, loginUser); |
| | | aiChatSessionService.touchSession(memoryId, loginUser, userMessage); |
| | | |
| | | String directResponse = financialIntentExecutor.tryExecute(memoryId, userMessage); |
| | | if (StringUtils.isNotEmpty(directResponse)) { |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(directResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | if (isBusinessDataIntent(userMessage)) { |
| | | String noGuessResponse = "æªè¯å«å°å¯æ§è¡çæ°æ®æ¥è¯¢æ¡ä»¶ã为ä¿è¯ç»æåç¡®ï¼å½åä¸ä¼æ¨æµæç¼é æ°æ®ï¼è¯·è¡¥å
æç¡®æ¶é´èå´ã客æ·ãä¾åºåæåå·ååæ¥è¯¢ã"; |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(noGuessResponse); |
| | | } |
| | | |
| | | return financialAgent.chat(memoryId, userMessage, currentDateForPrompt()) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "è´¢å¡æºè½ä½ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "è´¢å¡æºè½ä½ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤è´¢å¡æºè½ä½ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | | return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT); |
| | | } |
| | | |
| | | private boolean isBusinessDataIntent(String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return false; |
| | | } |
| | | String text = message.trim(); |
| | | return containsAny(text, |
| | | "æ¥è¯¢", "æ¥ç", "ç»è®¡", "åæ", "建议", "ææ¬æ ¸ç®", "äº§åææ¬", "å·¥åºææ¬", |
| | | "订å婿¶¦", "äºæè®¢å", "ä½å©æ¶¦", "åºåèµé", "åºå积å", "åæ»åºå", |
| | | "ç°éæµ", "忬¾é£é©", "仿¬¾åå", "èµé缺å£", "åºæ¶", "åºä»", |
| | | "å¼å¸¸é¢è¦", "ç»è¥å¼å¸¸", "é£é©é¢è¦", "驾驶è±", "ç»è¥çæ¿", "ç»è¥æ»è§", |
| | | "æ¥æ¥", "卿¥", "ç»è¥æ¥å", "åææ¥å", "ä¸è´¢èå", "å£å¾", "ææ è§£é"); |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @Operation(summary = "å¶é ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å¶é ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤å¶é ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | |
| | | |
| | | @Operation(summary = "éè´å¤æä»¶åæç¡®è®¤å¤ç") |
| | | @PostMapping("/analyze-files/confirm") |
| | | public R confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | public AjaxResult confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | return purchaseAiService.confirmAnalyzeResult(request); |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public R listSessions() { |
| | | public AjaxResult listSessions() { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return R.ok(purchaseAiService.listSessions(loginUser)); |
| | | return success(purchaseAiService.listSessions(loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return R.ok(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | return success(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤éè´ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return R.ok(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | return toAjax(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @Operation(summary = "éå®å©æä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "éå®å©æä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤éå®å©æä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private boolean isBusinessDataIntent(String message) { |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | |
| | | |
| | | @Operation(summary = "ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public R listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return R.ok(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private boolean isApproveTodoBusinessIntent(String message) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.schedule; |
| | | |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class AiSessionCleanupTask { |
| | | |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public AiSessionCleanupTask(AiSessionUserContext aiSessionUserContext) { |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | public void cleanupExpiredSessions() { |
| | | try { |
| | | aiSessionUserContext.cleanExpiredSessions(); |
| | | } catch (Exception e) { |
| | | System.err.println("æ¸
çè¿æAIä¼è¯å¤±è´¥: " + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.service.StorageBlobService; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.service.IPaymentRegistrationService; |
| | | import com.ruoyi.purchase.service.IPurchaseLedgerService; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import dev.langchain4j.data.image.Image; |
| | | import dev.langchain4j.data.message.*; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.Content; |
| | | import dev.langchain4j.data.message.ImageContent; |
| | | import dev.langchain4j.data.message.SystemMessage; |
| | | import dev.langchain4j.data.message.TextContent; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import dev.langchain4j.model.chat.StreamingChatLanguageModel; |
| | | import dev.langchain4j.model.chat.response.ChatResponse; |
| | | import dev.langchain4j.model.chat.response.StreamingChatResponseHandler; |
| | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.nio.file.Files; |
| | | import java.util.Base64; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | | import java.nio.file.Files; |
| | | |
| | | @Service |
| | | public class PurchaseAiService { |
| | |
| | | private final AiFileTextExtractor aiFileTextExtractor; |
| | | private final ObjectMapper objectMapper; |
| | | private final IPurchaseLedgerService purchaseLedgerService; |
| | | private final IPaymentRegistrationService paymentRegistrationService; |
| | | private final PurchaseReturnOrdersService purchaseReturnOrdersService; |
| | | private final StorageBlobService storageBlobService; |
| | | private final SupplierManageMapper supplierManageMapper; |
| | |
| | | AiFileTextExtractor aiFileTextExtractor, |
| | | ObjectMapper objectMapper, |
| | | IPurchaseLedgerService purchaseLedgerService, |
| | | IPaymentRegistrationService paymentRegistrationService, |
| | | PurchaseReturnOrdersService purchaseReturnOrdersService, |
| | | StorageBlobService storageBlobService, |
| | | SupplierManageMapper supplierManageMapper, |
| | |
| | | this.aiFileTextExtractor = aiFileTextExtractor; |
| | | this.objectMapper = objectMapper; |
| | | this.purchaseLedgerService = purchaseLedgerService; |
| | | this.paymentRegistrationService = paymentRegistrationService; |
| | | this.purchaseReturnOrdersService = purchaseReturnOrdersService; |
| | | this.storageBlobService = storageBlobService; |
| | | this.supplierManageMapper = supplierManageMapper; |
| | |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | public R confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | public AjaxResult confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | if (request == null || !StringUtils.hasText(request.getBusinessType())) { |
| | | return R.fail("businessTypeä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("businessTypeä¸è½ä¸ºç©º"); |
| | | } |
| | | if (request.getPayload() == null || request.getPayload().isEmpty()) { |
| | | return R.fail("payloadä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("payloadä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | try { |
| | | String businessType = request.getBusinessType().trim(); |
| | | return switch (businessType) { |
| | | case "purchase_ledger" -> processPurchaseLedger(request.getPayload()); |
| | | case "payment_registration" -> processPaymentRegistration(request.getPayload()); |
| | | case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload()); |
| | | default -> R.fail("æä¸æ¯æè¯¥ä¸å¡ç±»å: " + businessType); |
| | | default -> AjaxResult.error("æä¸æ¯æè¯¥ä¸å¡ç±»å: " + businessType); |
| | | }; |
| | | } catch (Exception ex) { |
| | | return R.fail(toCustomerMessage(ex)); |
| | | return AjaxResult.error(toCustomerMessage(ex)); |
| | | } |
| | | } |
| | | |
| | |
| | | è¾åºè¦æ±: |
| | | 1. åªè¾åºåæ³ JSONï¼ä¸è¦ Markdownï¼ä¸è¦é¢å¤è§£éã |
| | | 2. JSON é¡¶å±å段åºå®ä¸º: |
| | | - ok: boolean |
| | | - businessType: purchase_ledger | payment_registration | purchase_return_order | unknown |
| | | - success: boolean |
| | | - businessType: purchase_ledger | purchase_return_order | unknown |
| | | - action: confirm_required |
| | | - description: ä¸æè¯´æ |
| | | - confidence: 0å°1çå°æ° |
| | |
| | | entryDateStart, entryDateEnd, id, purchaseContractNumber, supplierId, supplierName, isWhite, recorderId, recorderName, salesContractNo, salesContractNoId, projectName, entryDate, executionDate, remarks, attachmentMaterials, createdAt, updatedAt, salesLedgerId, hasChildren, Type, productData, tempFileIds, SalesLedgerFiles, phoneNumber, businessPersonId, productId, productModelId, invoiceNumber, invoiceAmount, ticketRegistrationId, contractAmount, receiptPaymentAmount, unReceiptPaymentAmount, type, paymentMethod, approvalStatus, templateName |
| | | - productData æ¯æ¡äº§ååªä½¿ç¨è¿äº SalesLedgerProduct åæ®µå: |
| | | productCategory, specificationModel, unit, quantity, taxRate, taxInclusiveUnitPrice, taxInclusiveTotalPrice, taxExclusiveTotalPrice, invoiceType, productId, productModelId, isChecked, type |
| | | 4. 妿å¯å¤æä¸ºä»æ¬¾ç»è®°ï¼businessType ä½¿ç¨ payment_registrationï¼payload.records ä¸ºä»æ¬¾ç»è®°æ°ç»ï¼å段尽éå
å« purchaseLedgerIdãsalesLedgerProductIdãcurrentPaymentAmountãpaymentMethodãpaymentDateã |
| | | 4. 妿å¯å¤æä¸ºä»æ¬¾ç»è®°ï¼businessType ä½¿ç¨ payload.records ä¸ºä»æ¬¾ç»è®°æ°ç»ï¼å段尽éå
å« purchaseLedgerIdãsalesLedgerProductIdãcurrentPaymentAmountãpaymentMethodãpaymentDateã |
| | | 5. 妿å¯å¤æä¸ºéè´éè´§ï¼businessType ä½¿ç¨ purchase_return_orderï¼payload æ PurchaseReturnOrderDto ç»ç»ï¼æç»æ¾ purchaseReturnOrderProductsDtosã |
| | | 6. 缺å°ä¸å¡å¤çå¿
须忮µæ¶ï¼ä¸è¦ç¼é IDï¼æåæ®µæ¾å
¥ missingFieldsï¼å¹¶ä»è¿åå¯ç¡®è®¤çèç¨¿æ°æ®ã |
| | | 7. ææä¸æå
å®¹ç´æ¥ä¿çï¼ä¸è¦è½¬ä¹æ Unicodeã |
| | |
| | | """.formatted(message, fileContent); |
| | | } |
| | | |
| | | private R processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | if (payload.containsKey("purchaseLedgers")) { |
| | | return processPurchaseLedgerBatch(payload); |
| | | } |
| | | |
| | | Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class); |
| | | R ledgerResult = validatePurchaseLedger(dto, 0); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, 0); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | | R productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | | int result = purchaseLedgerService.addOrEditPurchase(dto); |
| | | return R.ok( result,"éè´å°è´¦å·²å¤ç"); |
| | | return AjaxResult.success("éè´å°è´¦å·²å¤ç", result); |
| | | } |
| | | |
| | | private R processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers")); |
| | | if (purchaseLedgers.isEmpty()) { |
| | | return R.fail("purchaseLedgersä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("purchaseLedgersä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<Map<String, Object>> topLevelProductData = toMapList(payload.get("productData")); |
| | |
| | | for (int i = 0; i < purchaseLedgers.size(); i++) { |
| | | Map<String, Object> ledgerMap = normalizePurchaseLedgerMap(purchaseLedgers.get(i)); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(ledgerMap, PurchaseLedgerDto.class); |
| | | R ledgerResult = validatePurchaseLedger(dto, i); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, i); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | |
| | | products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1); |
| | | dto.setProductData(products); |
| | | } |
| | | R productResult = validatePurchaseProducts(products, i); |
| | | AjaxResult productResult = validatePurchaseProducts(products, i); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | |
| | | item.put("result", result); |
| | | results.add(item); |
| | | } |
| | | return R.ok( results,"éè´å°è´¦å·²æ¹éå¤ç"); |
| | | return AjaxResult.success("éè´å°è´¦å·²æ¹éå¤ç", results); |
| | | } |
| | | |
| | | private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap, |
| | |
| | | } |
| | | } |
| | | |
| | | private R validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | if (products == null || products.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | SalesLedgerProduct product = products.get(i); |
| | | String prefix = "第" + (ledgerIndex + 1) + "个éè´å°è´¦ç第" + (i + 1) + "æ¡äº§å"; |
| | | if (!StringUtils.hasText(product.getProductCategory())) { |
| | | return R.fail(prefix + "缺å°äº§ååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°äº§ååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getSpecificationModel())) { |
| | | return R.fail(prefix + "缺å°è§æ ¼åå·ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°è§æ ¼åå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getUnit())) { |
| | | return R.fail(prefix + "缺å°åä½ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°åä½ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getQuantity() == null) { |
| | | return R.fail(prefix + "ç¼ºå°æ°é"); |
| | | return AjaxResult.error(prefix + "ç¼ºå°æ°é"); |
| | | } |
| | | if (product.getTaxInclusiveUnitPrice() == null) { |
| | | return R.fail(prefix + "缺å°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getTaxInclusiveTotalPrice() == null) { |
| | | return R.fail(prefix + "缺å°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private R validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | String prefix = "第" + (ledgerIndex + 1) + "个éè´å°è´¦"; |
| | | if (!StringUtils.hasText(dto.getPurchaseContractNumber())) { |
| | | return R.fail(prefix + "缺å°éè´ååå·ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°éè´ååå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) { |
| | | return R.fail(prefix + "缺å°ä¾åºååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | return AjaxResult.error(prefix + "缺å°ä¾åºååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | return "å¤ç失败ï¼" + message; |
| | | } |
| | | |
| | | private R fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | if (dto.getSupplierId() != null) { |
| | | return null; |
| | | } |
| | | if (!StringUtils.hasText(dto.getSupplierName())) { |
| | | return R.fail("ä¾åºåIDä¸è½ä¸ºç©ºï¼æªè¯å«å°ä¾åºååç§°ï¼æ æ³èªå¨å¹é
ä¾åºåID"); |
| | | return AjaxResult.error("ä¾åºåIDä¸è½ä¸ºç©ºï¼æªè¯å«å°ä¾åºååç§°ï¼æ æ³èªå¨å¹é
ä¾åºåID"); |
| | | } |
| | | |
| | | SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>() |
| | | .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim()) |
| | | .last("limit 1")); |
| | | if (supplier == null) { |
| | | return R.fail("æªæ¾å°ä¾åºåï¼" + dto.getSupplierName() + "ï¼è¯·å
ç»´æ¤ä¾åºåææå¨éæ©ä¾åºåID"); |
| | | return AjaxResult.error("æªæ¾å°ä¾åºåï¼" + dto.getSupplierName() + "ï¼è¯·å
ç»´æ¤ä¾åºåææå¨éæ©ä¾åºåID"); |
| | | } |
| | | dto.setSupplierId(supplier.getId()); |
| | | return null; |
| | | } |
| | | |
| | | private R processPaymentRegistration(Map<String, Object> payload) { |
| | | Object recordsValue = payload.get("records"); |
| | | List<PaymentRegistration> records; |
| | | if (recordsValue == null) { |
| | | records = Collections.singletonList(objectMapper.convertValue(payload, PaymentRegistration.class)); |
| | | } else { |
| | | records = objectMapper.convertValue(recordsValue, new TypeReference<List<PaymentRegistration>>() { |
| | | }); |
| | | } |
| | | int result = paymentRegistrationService.insertPaymentRegistration(records); |
| | | return R.ok( result,"仿¬¾ç»è®°å·²å¤ç"); |
| | | } |
| | | |
| | | private R processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class); |
| | | Boolean result = purchaseReturnOrdersService.add(dto); |
| | | return R.ok( result,"éè´éè´§åå·²å¤ç"); |
| | | return AjaxResult.success("éè´éè´§åå·²å¤ç", result); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 20; |
| | | private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); |
| | | private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | |
| | | } |
| | | |
| | | private String formatDate(Date value) { |
| | | return value == null ? "" : DATE_FORMAT.format(value); |
| | | if (value == null) { |
| | | return ""; |
| | | } |
| | | return value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(DATE_FORMATTER); |
| | | } |
| | | |
| | | private long countByStatus(List<ApproveProcess> processes, int status) { |
| | |
| | | |
| | | private Date parseDate(String dateText) { |
| | | try { |
| | | return DATE_FORMAT.parse(dateText); |
| | | } catch (ParseException e) { |
| | | LocalDate localDate = LocalDate.parse(dateText, DATE_FORMATTER); |
| | | return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } catch (Exception e) { |
| | | throw new IllegalArgumentException("æ¥ææ ¼å¼å¿
é¡»æ¯ yyyy-MM-dd"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.tools; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import com.ruoyi.account.mapper.AccountStatementMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.account.service.impl.AccountingServiceImpl; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.mapper.SupplierManageMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.production.mapper.ProductionAccountMapper; |
| | | import com.ruoyi.production.mapper.ProductionOperationTaskMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionPlanMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.pojo.ProductionAccount; |
| | | import com.ruoyi.production.pojo.ProductionOperationTask; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.pojo.ProductionPlan; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.technology.mapper.TechnologyOperationMapper; |
| | | import com.ruoyi.technology.pojo.TechnologyOperation; |
| | | import dev.langchain4j.agent.tool.P; |
| | | import dev.langchain4j.agent.tool.Tool; |
| | | import dev.langchain4j.agent.tool.ToolMemoryId; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class FinancialAgentTools { |
| | | |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final Pattern RELATIVE_PATTERN = Pattern.compile("(è¿|æè¿)?\\s*(\\d+)\\s*(天|å¨|个æ|æ|å¹´)"); |
| | | private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})"); |
| | | private static final BigDecimal ONE_HUNDRED = new BigDecimal("100"); |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 50; |
| | | |
| | | private static final BigDecimal DEFAULT_FALLBACK_MATERIAL_COST_RATE = new BigDecimal("0.60"); |
| | | private static final BigDecimal DEFAULT_LABOR_COST_RATE = new BigDecimal("0.15"); |
| | | private static final BigDecimal DEFAULT_OVERHEAD_COST_RATE = new BigDecimal("0.10"); |
| | | |
| | | private static final BigDecimal SME_RECEIVABLE_RISK_THRESHOLD = new BigDecimal("500000"); |
| | | private static final BigDecimal SME_INVENTORY_RISK_THRESHOLD = new BigDecimal("1000000"); |
| | | private static final BigDecimal SME_PROFIT_WARNING_RATE = new BigDecimal("0.08"); |
| | | |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ProductionAccountMapper productionAccountMapper; |
| | | private final ProductionProductMainMapper productionProductMainMapper; |
| | | private final ProductionOperationTaskMapper productionOperationTaskMapper; |
| | | private final ProductionOrderMapper productionOrderMapper; |
| | | private final ProductionPlanMapper productionPlanMapper; |
| | | private final ProductionProductOutputMapper productionProductOutputMapper; |
| | | private final TechnologyOperationMapper technologyOperationMapper; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final AccountStatementMapper accountStatementMapper; |
| | | private final CustomerMapper customerMapper; |
| | | private final SupplierManageMapper supplierManageMapper; |
| | | private final ProductModelMapper productModelMapper; |
| | | private final ProductMapper productMapper; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public FinancialAgentTools(SalesLedgerMapper salesLedgerMapper, |
| | | SalesLedgerProductMapper salesLedgerProductMapper, |
| | | ProductionAccountMapper productionAccountMapper, |
| | | ProductionProductMainMapper productionProductMainMapper, |
| | | ProductionOperationTaskMapper productionOperationTaskMapper, |
| | | ProductionOrderMapper productionOrderMapper, |
| | | ProductionPlanMapper productionPlanMapper, |
| | | ProductionProductOutputMapper productionProductOutputMapper, |
| | | TechnologyOperationMapper technologyOperationMapper, |
| | | DeviceLedgerMapper deviceLedgerMapper, |
| | | DeviceRepairMapper deviceRepairMapper, |
| | | ProcurementRecordMapper procurementRecordMapper, |
| | | ProcurementRecordOutMapper procurementRecordOutMapper, |
| | | StockInventoryMapper stockInventoryMapper, |
| | | AccountSalesCollectionMapper accountSalesCollectionMapper, |
| | | AccountPurchasePaymentMapper accountPurchasePaymentMapper, |
| | | AccountStatementMapper accountStatementMapper, |
| | | CustomerMapper customerMapper, |
| | | SupplierManageMapper supplierManageMapper, |
| | | ProductModelMapper productModelMapper, |
| | | ProductMapper productMapper, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.salesLedgerMapper = salesLedgerMapper; |
| | | this.salesLedgerProductMapper = salesLedgerProductMapper; |
| | | this.productionAccountMapper = productionAccountMapper; |
| | | this.productionProductMainMapper = productionProductMainMapper; |
| | | this.productionOperationTaskMapper = productionOperationTaskMapper; |
| | | this.productionOrderMapper = productionOrderMapper; |
| | | this.productionPlanMapper = productionPlanMapper; |
| | | this.productionProductOutputMapper = productionProductOutputMapper; |
| | | this.technologyOperationMapper = technologyOperationMapper; |
| | | this.deviceLedgerMapper = deviceLedgerMapper; |
| | | this.deviceRepairMapper = deviceRepairMapper; |
| | | this.procurementRecordMapper = procurementRecordMapper; |
| | | this.procurementRecordOutMapper = procurementRecordOutMapper; |
| | | this.stockInventoryMapper = stockInventoryMapper; |
| | | this.accountSalesCollectionMapper = accountSalesCollectionMapper; |
| | | this.accountPurchasePaymentMapper = accountPurchasePaymentMapper; |
| | | this.accountStatementMapper = accountStatementMapper; |
| | | this.customerMapper = customerMapper; |
| | | this.supplierManageMapper = supplierManageMapper; |
| | | this.productModelMapper = productModelMapper; |
| | | this.productMapper = productMapper; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | | @Tool(name = "è´¢å¡ç¥è¯æ£ç´¢", value = "æè´¢å¡ç»è¥é®é¢æ£ç´¢ä¸è´¢èåç¥è¯çæ®µä¸ææ å£å¾ï¼ä½ä¸ºRAGä¸ä¸æã") |
| | | public String retrieveFinancialKnowledge(@ToolMemoryId String memoryId, |
| | | @P(value = "é®é¢æå
³é®è¯ï¼ä¾å¦å©æ¶¦ä¸éãåºåå¨è½¬ãèµé缺å£") String question) { |
| | | List<KnowledgeDoc> knowledgeDocs = financeKnowledgeBase(); |
| | | String normalized = normalizeForMatch(question); |
| | | List<KnowledgeDoc> ranked = knowledgeDocs.stream() |
| | | .sorted(Comparator.comparingInt((KnowledgeDoc doc) -> keywordHitCount(doc.keywords(), normalized)).reversed()) |
| | | .filter(doc -> keywordHitCount(doc.keywords(), normalized) > 0 || !StringUtils.hasText(normalized)) |
| | | .limit(5) |
| | | .toList(); |
| | | |
| | | List<Map<String, Object>> items = ranked.stream().map(doc -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("topic", doc.topic()); |
| | | map.put("knowledge", doc.knowledge()); |
| | | map.put("relatedTables", doc.relatedTables()); |
| | | map.put("suggestedQuestions", doc.suggestedQuestions()); |
| | | return map; |
| | | }).toList(); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("question", safe(question)); |
| | | summary.put("hitCount", items.size()); |
| | | summary.put("retrievalMode", "keyword_rag"); |
| | | return jsonResponse(true, "financial_rag_knowledge", "å·²è¿åè´¢å¡ç¥è¯æ£ç´¢ç»æ", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æºè½ææ¬æ ¸ç®", value = "èªå¨æ ¸ç®äº§åææ¬ãå·¥åºææ¬ãäººå·¥ææ¬ãè®¾å¤ææ§ãæææèä¸è®¢å婿¶¦ã") |
| | | public String calculateIntelligentCost(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦æ¬æãè¿30天", required = false) String timeRange, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
ååå·/客æ·/项ç®", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§50", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | if (loginUser == null) { |
| | | return jsonResponse(false, "financial_cost_accounting", "ç¨æ·ä¿¡æ¯è·å失败", Map.of(), Map.of(), Map.of()); |
| | | } |
| | | |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "è¿30天"); |
| | | AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, keyword, limit); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("orderCount", bundle.orderMetrics().size()); |
| | | summary.put("totalRevenue", bundle.totalRevenue()); |
| | | summary.put("totalMaterialCost", bundle.totalMaterialCost()); |
| | | summary.put("totalLaborCost", bundle.totalLaborCost()); |
| | | summary.put("totalDepreciationCost", bundle.totalDepreciationCost()); |
| | | summary.put("totalScrapCost", bundle.totalScrapCost()); |
| | | summary.put("totalCost", bundle.totalCost()); |
| | | summary.put("totalProfit", bundle.totalProfit()); |
| | | summary.put("profitRate", toPercent(rate(bundle.totalProfit(), bundle.totalRevenue()))); |
| | | |
| | | List<Map<String, Object>> orderItems = bundle.orderMetrics().stream() |
| | | .map(this::toOrderCostItem) |
| | | .toList(); |
| | | List<Map<String, Object>> processItems = bundle.processCostRanking().entrySet().stream() |
| | | .map(entry -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("processName", entry.getKey()); |
| | | map.put("cost", entry.getValue()); |
| | | return map; |
| | | }).toList(); |
| | | |
| | | List<Map<String, Object>> topCustomerItems = buildCustomerProfitTop(bundle.orderMetrics(), 5); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("costCompositionPieOption", |
| | | buildCostCompositionPie(bundle.totalMaterialCost(), bundle.totalLaborCost(), bundle.totalDepreciationCost(), bundle.totalScrapCost())); |
| | | charts.put("orderProfitBarOption", buildOrderProfitBar(bundle.orderMetrics())); |
| | | charts.put("processCostBarOption", buildProcessCostBar(bundle.processCostRanking())); |
| | | |
| | | return jsonResponse(true, "financial_cost_accounting", "已宿æºè½ææ¬æ ¸ç®", summary, |
| | | Map.of( |
| | | "orders", orderItems, |
| | | "processCostRanking", processItems, |
| | | "topCustomers", topCustomerItems |
| | | ), |
| | | charts |
| | | ); |
| | | } |
| | | |
| | | @Tool(name = "订å婿¶¦åæ", value = "è¯å«ä½å©æ¶¦/äºæè®¢åï¼è¾åºåå åæåä¼å建议ã") |
| | | public String analyzeOrderProfit(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦æ¬æãè¿30天", required = false) String timeRange, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
ååå·/客æ·/项ç®", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§50", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | if (loginUser == null) { |
| | | return jsonResponse(false, "financial_order_profit_analysis", "ç¨æ·ä¿¡æ¯è·å失败", Map.of(), Map.of(), Map.of()); |
| | | } |
| | | |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "è¿30天"); |
| | | AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, keyword, limit); |
| | | List<OrderProfitMetric> metrics = bundle.orderMetrics(); |
| | | |
| | | List<OrderProfitMetric> riskyOrders = metrics.stream() |
| | | .filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0 || item.profitRate().compareTo(SME_PROFIT_WARNING_RATE) < 0) |
| | | .sorted(Comparator.comparing(OrderProfitMetric::profitRate) |
| | | .thenComparing(OrderProfitMetric::profit)) |
| | | .toList(); |
| | | |
| | | Map<String, BigDecimal> customerProfitMap = new LinkedHashMap<>(); |
| | | for (OrderProfitMetric metric : metrics) { |
| | | customerProfitMap.merge(metric.customerName(), metric.profit(), BigDecimal::add); |
| | | } |
| | | Map.Entry<String, BigDecimal> topCustomer = customerProfitMap.entrySet().stream() |
| | | .max(Map.Entry.comparingByValue()) |
| | | .orElse(Map.entry("ææ æ°æ®", BigDecimal.ZERO)); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("orderCount", metrics.size()); |
| | | summary.put("lossOrderCount", metrics.stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count()); |
| | | summary.put("lowProfitOrderCount", riskyOrders.size()); |
| | | summary.put("avgProfitRate", toPercent(avgRate(metrics))); |
| | | summary.put("topCustomerByProfit", topCustomer.getKey()); |
| | | summary.put("topCustomerProfit", topCustomer.getValue()); |
| | | |
| | | List<Map<String, Object>> riskyItems = riskyOrders.stream() |
| | | .limit(normalizeLimit(limit)) |
| | | .map(this::toRiskOrderItem) |
| | | .toList(); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("profitDistributionOption", buildProfitDistributionBar(metrics)); |
| | | charts.put("lossOrderTrendOption", buildLossOrderTrendLine(metrics)); |
| | | charts.put("customerProfitTopOption", buildCustomerProfitBar(customerProfitMap)); |
| | | |
| | | return jsonResponse(true, "financial_order_profit_analysis", "å·²å®æè®¢å婿¶¦åæ", summary, |
| | | Map.of( |
| | | "riskOrders", riskyItems, |
| | | "allOrders", metrics.stream().map(this::toOrderCostItem).toList(), |
| | | "customerProfitTop", buildCustomerProfitTop(metrics, 10) |
| | | ), |
| | | charts |
| | | ); |
| | | } |
| | | |
| | | @Tool(name = "åºåèµéåæ", value = "åæåºå积åãåæ»åºåãèµéå ç¨ä¸å¨è½¬çã") |
| | | public String analyzeInventoryCapital(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦æ¬æãè¿30天", required = false) String timeRange, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
产ååç§°/åå·", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§50", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "è¿30天"); |
| | | int finalLimit = normalizeLimit(limit); |
| | | |
| | | List<StockInventory> inventoryRows = queryStockInventory(loginUser); |
| | | if (inventoryRows.isEmpty()) { |
| | | return jsonResponse(true, "financial_inventory_capital_analysis", "å½åæ åºåæ°æ®", |
| | | rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | Set<Long> modelIds = inventoryRows.stream() |
| | | .map(StockInventory::getProductModelId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, ProductModel> productModelMap = queryProductModels(modelIds); |
| | | Map<Long, Product> productMap = queryProducts(productModelMap.values()); |
| | | Map<Long, BigDecimal> avgUnitCostByModelId = queryAverageUnitCostByModel(loginUser, modelIds); |
| | | OutboundStats outboundStats = queryOutboundStats(loginUser, modelIds, range); |
| | | |
| | | List<InventoryMetric> metrics = buildInventoryMetrics(inventoryRows, productModelMap, productMap, avgUnitCostByModelId, outboundStats) |
| | | .stream() |
| | | .filter(metric -> matchInventoryKeyword(metric, keyword)) |
| | | .sorted(Comparator.comparing(InventoryMetric::inventoryValue).reversed()) |
| | | .toList(); |
| | | |
| | | BigDecimal totalInventoryValue = metrics.stream().map(InventoryMetric::inventoryValue).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal stagnantValue = metrics.stream() |
| | | .filter(metric -> metric.stagnantDays() >= 90) |
| | | .map(InventoryMetric::inventoryValue) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | long stagnantCount = metrics.stream().filter(metric -> metric.stagnantDays() >= 90).count(); |
| | | long overstockCount = metrics.stream().filter(InventoryMetric::overstock).count(); |
| | | BigDecimal totalOutboundCost = outboundStats.totalOutboundCost(); |
| | | BigDecimal turnoverDays = totalOutboundCost.compareTo(BigDecimal.ZERO) > 0 |
| | | ? totalInventoryValue.multiply(BigDecimal.valueOf(daysBetween(range.start(), range.end()) + 1L)) |
| | | .divide(totalOutboundCost, 2, RoundingMode.HALF_UP) |
| | | : BigDecimal.ZERO; |
| | | |
| | | List<Map<String, Object>> items = metrics.stream() |
| | | .limit(finalLimit) |
| | | .map(this::toInventoryItem) |
| | | .toList(); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, metrics.size(), keyword); |
| | | summary.put("totalInventoryValue", totalInventoryValue); |
| | | summary.put("stagnantValue", stagnantValue); |
| | | summary.put("stagnantCount", stagnantCount); |
| | | summary.put("overstockCount", overstockCount); |
| | | summary.put("turnoverDays", turnoverDays); |
| | | summary.put("capitalOccupation", totalInventoryValue); |
| | | summary.put("totalOutboundCost", totalOutboundCost); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("inventoryValueTopOption", buildInventoryTopBar(metrics)); |
| | | charts.put("inventoryAgingPieOption", buildInventoryAgingPie(metrics)); |
| | | charts.put("inventoryTurnoverGauge", buildTurnoverGauge(turnoverDays)); |
| | | |
| | | return jsonResponse(true, "financial_inventory_capital_analysis", "已宿åºåèµéåæ", summary, Map.of("items", items), charts); |
| | | } |
| | | |
| | | @Tool(name = "åºæ¶åºä»ä¸ç°éæµé¢æµ", value = "颿µæªæ¥ç°éæµã忬¾é£é©ã仿¬¾ååä¸èµé缺å£ã") |
| | | public String forecastCashFlow(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦è¿90å¤©ãæ¬å¹´", required = false) String timeRange, |
| | | @P(value = "颿µæä»½æ°ï¼é»è®¤3ï¼æå¤§6", required = false) Integer forecastMonths) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "è¿90天"); |
| | | int months = forecastMonths == null || forecastMonths <= 0 ? 3 : Math.min(forecastMonths, 6); |
| | | |
| | | List<AccountSalesCollection> collections = queryCollections(loginUser, range); |
| | | List<AccountPurchasePayment> payments = queryPayments(loginUser, range); |
| | | List<MonthlyCashFlow> monthlyActual = buildMonthlyCashFlow(range, collections, payments); |
| | | List<MonthlyCashFlow> monthlyForecast = forecastMonthlyCashFlow(monthlyActual, months); |
| | | |
| | | StatementSnapshot snapshot = buildStatementSnapshot(loginUser); |
| | | BigDecimal receivableTotal = snapshot.receivableTotal(); |
| | | BigDecimal payableTotal = snapshot.payableTotal(); |
| | | BigDecimal forecastNetSum = monthlyForecast.stream().map(MonthlyCashFlow::netFlow).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal coverage = receivableTotal.add(maxZero(forecastNetSum)); |
| | | BigDecimal fundGap = maxZero(payableTotal.subtract(coverage)); |
| | | |
| | | Map<String, String> customerNameMap = queryCustomerNameMap(snapshot.receivableTop().stream().map(StatementMetric::entityId).collect(Collectors.toSet())); |
| | | Map<String, String> supplierNameMap = querySupplierNameMap(snapshot.payableTop().stream().map(StatementMetric::entityId).collect(Collectors.toSet())); |
| | | |
| | | List<Map<String, Object>> receivableRiskItems = snapshot.receivableTop().stream().map(item -> toStatementRiskItem(item, customerNameMap, "customer")).toList(); |
| | | List<Map<String, Object>> payablePressureItems = snapshot.payableTop().stream().map(item -> toStatementRiskItem(item, supplierNameMap, "supplier")).toList(); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("actualIncomeTotal", collections.stream().map(AccountSalesCollection::getCollectionAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | summary.put("actualExpenseTotal", payments.stream().map(AccountPurchasePayment::getPaymentAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | summary.put("receivableBalance", receivableTotal); |
| | | summary.put("payableBalance", payableTotal); |
| | | summary.put("forecastNetSum", forecastNetSum); |
| | | summary.put("fundGap", fundGap); |
| | | summary.put("forecastMonths", months); |
| | | summary.put("collectionRiskLevel", riskLevelByAmount(receivableTotal)); |
| | | summary.put("paymentPressureLevel", riskLevelByAmount(payableTotal)); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("cashFlowTrendOption", buildCashflowTrend(monthlyActual, monthlyForecast)); |
| | | charts.put("receivablePayableBarOption", buildReceivablePayableBar(receivableTotal, payableTotal)); |
| | | charts.put("fundGapGaugeOption", buildFundGapGauge(fundGap)); |
| | | |
| | | return jsonResponse(true, "financial_cashflow_forecast", "å·²å®æåºæ¶åºä»ä¸ç°éæµé¢æµ", summary, |
| | | Map.of( |
| | | "actualMonthly", monthlyActual.stream().map(this::toMonthlyCashFlowItem).toList(), |
| | | "forecastMonthly", monthlyForecast.stream().map(this::toMonthlyCashFlowItem).toList(), |
| | | "receivableRiskTop", receivableRiskItems, |
| | | "payablePressureTop", payablePressureItems |
| | | ), |
| | | charts |
| | | ); |
| | | } |
| | | |
| | | @Tool(name = "ç»è¥å¼å¸¸é¢è¦", value = "è¯å«ææ¬å¼å¸¸ã婿¶¦å¼å¸¸ã忬¾å¼å¸¸ã订åé£é©ãåºåå¼å¸¸ã") |
| | | public String detectBusinessAnomalies(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦è¿30天", required = false) String timeRange, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§50", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "è¿30天"); |
| | | int finalLimit = normalizeLimit(limit); |
| | | |
| | | AnalysisBundle currentBundle = buildOrderProfitBundle(loginUser, range, null, Math.max(finalLimit, 30)); |
| | | DateRange prevRange = previousSameLengthRange(range); |
| | | AnalysisBundle prevBundle = buildOrderProfitBundle(loginUser, prevRange, null, 50); |
| | | |
| | | BigDecimal currentCostRate = rate(currentBundle.totalCost(), currentBundle.totalRevenue()); |
| | | BigDecimal prevCostRate = rate(prevBundle.totalCost(), prevBundle.totalRevenue()); |
| | | BigDecimal costRateDiff = currentCostRate.subtract(prevCostRate); |
| | | |
| | | StatementSnapshot snapshot = buildStatementSnapshot(loginUser); |
| | | List<InventoryMetric> inventoryMetrics = buildInventoryMetrics( |
| | | queryStockInventory(loginUser), |
| | | queryProductModels(Collections.emptySet()), |
| | | Map.of(), |
| | | queryAverageUnitCostByModel(loginUser, Collections.emptySet()), |
| | | queryOutboundStats(loginUser, Collections.emptySet(), range) |
| | | ); |
| | | |
| | | List<Map<String, Object>> anomalyItems = new ArrayList<>(); |
| | | if (costRateDiff.compareTo(new BigDecimal("0.10")) > 0) { |
| | | anomalyItems.add(anomalyItem("high", "ææ¬å¼å¸¸", "å使¶å
¥ææ¬çè¾ä¸å¨æä¸åè¶
è¿10%", Map.of( |
| | | "currentCostRate", toPercent(currentCostRate), |
| | | "previousCostRate", toPercent(prevCostRate), |
| | | "delta", toPercent(costRateDiff) |
| | | ))); |
| | | } |
| | | long lossCount = currentBundle.orderMetrics().stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count(); |
| | | if (lossCount > 0) { |
| | | anomalyItems.add(anomalyItem("high", "婿¶¦å¼å¸¸", "æ£æµå°äºæè®¢å", Map.of("lossOrderCount", lossCount))); |
| | | } |
| | | if (snapshot.receivableTotal().compareTo(snapshot.payableTotal().multiply(new BigDecimal("1.2"))) > 0) { |
| | | anomalyItems.add(anomalyItem("medium", "忬¾å¼å¸¸", "åºæ¶ä½é¢æ¾èé«äºåºä»ï¼å款ååå大", Map.of( |
| | | "receivableBalance", snapshot.receivableTotal(), |
| | | "payableBalance", snapshot.payableTotal() |
| | | ))); |
| | | } |
| | | long overdueOrderCount = currentBundle.orderMetrics().stream() |
| | | .filter(item -> item.deliveryDate() != null && item.deliveryDate().isBefore(LocalDate.now()) && item.profitRate().compareTo(new BigDecimal("0.10")) < 0) |
| | | .count(); |
| | | if (overdueOrderCount > 0) { |
| | | anomalyItems.add(anomalyItem("medium", "订åé£é©", "åå¨ä½å©æ¶¦ä¸äº¤ä»å·²é¾æè®¢å", Map.of("overdueRiskOrderCount", overdueOrderCount))); |
| | | } |
| | | long stagnantCount = inventoryMetrics.stream().filter(item -> item.stagnantDays() >= 90).count(); |
| | | if (stagnantCount > 0) { |
| | | anomalyItems.add(anomalyItem("medium", "åºåå¼å¸¸", "åå¨è¶
è¿90天æªå¨è½¬åºå", Map.of("stagnantCount", stagnantCount))); |
| | | } |
| | | |
| | | List<Map<String, Object>> topAnomalies = anomalyItems.stream().limit(finalLimit).toList(); |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("anomalyCount", topAnomalies.size()); |
| | | summary.put("highRiskCount", topAnomalies.stream().filter(item -> "high".equals(item.get("riskLevel"))).count()); |
| | | summary.put("mediumRiskCount", topAnomalies.stream().filter(item -> "medium".equals(item.get("riskLevel"))).count()); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("anomalyLevelPieOption", buildAnomalyLevelPie(topAnomalies)); |
| | | charts.put("anomalyTypeBarOption", buildAnomalyTypeBar(topAnomalies)); |
| | | return jsonResponse(true, "financial_business_anomaly_warning", "已宿ç»è¥å¼å¸¸é¢è¦åæ", summary, |
| | | Map.of("items", topAnomalies), charts); |
| | | } |
| | | |
| | | @Tool(name = "AIç»è¥é©¾é©¶è±", value = "宿¶å±ç¤ºäº§å¼ã婿¶¦ãåºåã忬¾ã设å¤å©ç¨çã订å婿¶¦ççæ ¸å¿ç»è¥ææ ã") |
| | | public String getBusinessCockpit(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦æ¬æãè¿30天", required = false) String timeRange) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, "æ¬æ"); |
| | | |
| | | AnalysisBundle profitBundle = buildOrderProfitBundle(loginUser, range, null, 30); |
| | | StatementSnapshot snapshot = buildStatementSnapshot(loginUser); |
| | | List<StockInventory> inventories = queryStockInventory(loginUser); |
| | | BigDecimal inventoryValue = estimateInventoryValue(loginUser, inventories); |
| | | |
| | | long deviceTotal = countDevices(loginUser); |
| | | long repairingCount = countRepairingDevices(loginUser); |
| | | BigDecimal deviceUtilization = deviceTotal > 0 |
| | | ? new BigDecimal(deviceTotal - repairingCount).multiply(ONE_HUNDRED).divide(new BigDecimal(deviceTotal), 2, RoundingMode.HALF_UP) |
| | | : BigDecimal.ZERO; |
| | | |
| | | BigDecimal outputValue = profitBundle.totalRevenue(); |
| | | BigDecimal profitRate = rate(profitBundle.totalProfit(), profitBundle.totalRevenue()); |
| | | BigDecimal collectionRate = snapshot.receivableTotal().compareTo(BigDecimal.ZERO) > 0 |
| | | ? ONE_HUNDRED.subtract(rate(snapshot.receivableTotal(), snapshot.receivableTotal().add(snapshot.payableTotal())).multiply(ONE_HUNDRED)) |
| | | : BigDecimal.ZERO; |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("outputValue", outputValue); |
| | | summary.put("profit", profitBundle.totalProfit()); |
| | | summary.put("profitRate", toPercent(profitRate)); |
| | | summary.put("inventoryValue", inventoryValue); |
| | | summary.put("receivableBalance", snapshot.receivableTotal()); |
| | | summary.put("payableBalance", snapshot.payableTotal()); |
| | | summary.put("collectionRate", toPercent(collectionRate.divide(ONE_HUNDRED, 4, RoundingMode.HALF_UP))); |
| | | summary.put("deviceUtilizationRate", deviceUtilization + "%"); |
| | | summary.put("orderProfitRate", toPercent(avgRate(profitBundle.orderMetrics()))); |
| | | |
| | | Map<String, Object> indicators = new LinkedHashMap<>(); |
| | | indicators.put("产å¼", outputValue); |
| | | indicators.put("婿¶¦", profitBundle.totalProfit()); |
| | | indicators.put("åºåèµéå ç¨", inventoryValue); |
| | | indicators.put("åºæ¶ä½é¢", snapshot.receivableTotal()); |
| | | indicators.put("设å¤å©ç¨ç", deviceUtilization + "%"); |
| | | indicators.put("订åå¹³å婿¶¦ç", toPercent(avgRate(profitBundle.orderMetrics()))); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("kpiCardData", indicators); |
| | | charts.put("profitTrendOption", buildOrderProfitBar(profitBundle.orderMetrics())); |
| | | charts.put("receivablePayableBarOption", buildReceivablePayableBar(snapshot.receivableTotal(), snapshot.payableTotal())); |
| | | charts.put("inventoryProfitGaugeOption", buildInventoryProfitGauge(inventoryValue, profitBundle.totalProfit())); |
| | | |
| | | return jsonResponse(true, "financial_business_cockpit", "å·²çæAIç»è¥é©¾é©¶è±æ°æ®", summary, |
| | | Map.of( |
| | | "orderProfitTop", profitBundle.orderMetrics().stream() |
| | | .sorted(Comparator.comparing(OrderProfitMetric::profit).reversed()) |
| | | .limit(10) |
| | | .map(this::toOrderCostItem) |
| | | .toList(), |
| | | "indicators", indicators |
| | | ), |
| | | charts |
| | | ); |
| | | } |
| | | |
| | | @Tool(name = "æ¥æ¥å¨æ¥èªå¨çæ", value = "èªå¨è¾åºç»è¥åææ¥æ¥/卿¥ä¸é£é©å»ºè®®ã") |
| | | public String generateOperationReport(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦ä»å¤©ãæ¬å¨", required = false) String timeRange, |
| | | @P(value = "æ¥åç±»å daily/weekly", required = false) String reportType) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange, |
| | | "weekly".equalsIgnoreCase(reportType) ? "æ¬å¨" : "ä»å¤©"); |
| | | String type = "weekly".equalsIgnoreCase(reportType) ? "weekly" : "daily"; |
| | | |
| | | AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, null, 30); |
| | | StatementSnapshot snapshot = buildStatementSnapshot(loginUser); |
| | | BigDecimal inventoryValue = estimateInventoryValue(loginUser, queryStockInventory(loginUser)); |
| | | long lossCount = bundle.orderMetrics().stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count(); |
| | | |
| | | List<String> conclusions = new ArrayList<>(); |
| | | conclusions.add("è¥æ¶" + bundle.totalRevenue() + "ï¼å©æ¶¦" + bundle.totalProfit() + "ï¼å©æ¶¦ç" + toPercent(rate(bundle.totalProfit(), bundle.totalRevenue())) + "ã"); |
| | | conclusions.add("åºæ¶ä½é¢" + snapshot.receivableTotal() + "ï¼åºä»ä½é¢" + snapshot.payableTotal() + "ï¼åºåèµéå ç¨" + inventoryValue + "ã"); |
| | | if (lossCount > 0) { |
| | | conclusions.add("åç°äºæè®¢å" + lossCount + "个ï¼å»ºè®®ä¼å
夿 ¸æææèåå·¥åºäººå·¥æçã"); |
| | | } else { |
| | | conclusions.add("å½åæªåç°äºæè®¢åï¼å»ºè®®æç»è·è¸ªä½äº8%婿¶¦ç订åã"); |
| | | } |
| | | if (snapshot.receivableTotal().compareTo(snapshot.payableTotal()) > 0) { |
| | | conclusions.add("忬¾åååé«ï¼å»ºè®®é对é«åºæ¶å®¢æ·æ§è¡åå±å¬æ¶ä¸è´¦æä¼åã"); |
| | | } else { |
| | | conclusions.add("èµéåå坿§ï¼å»ºè®®ä¿æä»æ¬¾è®¡åä¸éè´èå¥èå¨ã"); |
| | | } |
| | | |
| | | List<Map<String, Object>> riskSuggestions = new ArrayList<>(); |
| | | if (lossCount > 0) { |
| | | riskSuggestions.add(riskSuggestion("婿¶¦é£é©", "é«", "夿 ¸äºæè®¢åBOMåå·¥åºå·¥èµå®é¢ï¼å¿
è¦æ¶è°æ´æ¥ä»·ä¸äº¤ä»èå¥ã")); |
| | | } |
| | | if (snapshot.receivableTotal().compareTo(SME_RECEIVABLE_RISK_THRESHOLD) > 0) { |
| | | riskSuggestions.add(riskSuggestion("忬¾é£é©", "ä¸", "å¯¹åºæ¶TOP客æ·å»ºç«å¨åº¦å款计åï¼å¹¶è®¾ç½®é¢è¦éå¼ã")); |
| | | } |
| | | if (inventoryValue.compareTo(SME_INVENTORY_RISK_THRESHOLD) > 0) { |
| | | riskSuggestions.add(riskSuggestion("åºåé£é©", "ä¸", "对é«éé¢åæ»åºåæ§è¡éä»·ãæ¿ä»£åç产æ¶èçç¥ã")); |
| | | } |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("reportType", type); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("orderCount", bundle.orderMetrics().size()); |
| | | summary.put("lossOrderCount", lossCount); |
| | | summary.put("riskSuggestionCount", riskSuggestions.size()); |
| | | |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("headline", "weekly".equals(type) ? "ç»è¥å¨æ¥" : "ç»è¥æ¥æ¥"); |
| | | data.put("conclusions", conclusions); |
| | | data.put("riskSuggestions", riskSuggestions); |
| | | data.put("orderProfitTop", bundle.orderMetrics().stream() |
| | | .sorted(Comparator.comparing(OrderProfitMetric::profitRate)) |
| | | .limit(10) |
| | | .map(this::toRiskOrderItem) |
| | | .toList()); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("reportProfitBarOption", buildOrderProfitBar(bundle.orderMetrics())); |
| | | charts.put("reportReceivablePayableOption", buildReceivablePayableBar(snapshot.receivableTotal(), snapshot.payableTotal())); |
| | | return jsonResponse(true, "financial_operation_report", "å·²èªå¨çæç»è¥åææ¥å", summary, data, charts); |
| | | } |
| | | |
| | | private AnalysisBundle buildOrderProfitBundle(LoginUser loginUser, DateRange range, String keyword, Integer limit) { |
| | | List<SalesLedger> ledgers = querySalesLedgers(loginUser, range, keyword, limit); |
| | | if (ledgers.isEmpty()) { |
| | | return AnalysisBundle.empty(); |
| | | } |
| | | |
| | | List<Long> ledgerIds = ledgers.stream().map(SalesLedger::getId).filter(Objects::nonNull).toList(); |
| | | List<SalesLedgerProduct> ledgerProducts = queryLedgerProducts(loginUser, ledgerIds); |
| | | Map<Long, List<SalesLedgerProduct>> productsByLedgerId = ledgerProducts.stream() |
| | | .collect(Collectors.groupingBy(SalesLedgerProduct::getSalesLedgerId)); |
| | | |
| | | MaterialCostResult materialCostResult = calculateMaterialCost(loginUser, range, ledgerProducts); |
| | | ProductionCostContext productionCostContext = calculateProductionCost(loginUser, range, ledgers, ledgerProducts, materialCostResult.avgUnitCostByModelId()); |
| | | BigDecimal totalDepreciation = calculateTotalDepreciation(loginUser); |
| | | |
| | | BigDecimal totalRevenue = ledgers.stream() |
| | | .map(SalesLedger::getContractAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | Map<Long, BigDecimal> depreciationCostByLedger = allocateDepreciation(ledgers, totalDepreciation, totalRevenue); |
| | | |
| | | List<OrderProfitMetric> metrics = new ArrayList<>(); |
| | | for (SalesLedger ledger : ledgers) { |
| | | BigDecimal revenue = defaultDecimal(ledger.getContractAmount()); |
| | | BigDecimal materialCost = materialCostResult.materialCostByLedgerId().getOrDefault(ledger.getId(), fallbackMaterialCost(productsByLedgerId.get(ledger.getId()), revenue)); |
| | | BigDecimal laborCost = productionCostContext.laborCostByLedgerId().getOrDefault(ledger.getId(), BigDecimal.ZERO); |
| | | BigDecimal scrapCost = productionCostContext.scrapCostByLedgerId().getOrDefault(ledger.getId(), BigDecimal.ZERO); |
| | | BigDecimal depreciationCost = depreciationCostByLedger.getOrDefault(ledger.getId(), BigDecimal.ZERO); |
| | | BigDecimal totalCost = materialCost.add(laborCost).add(scrapCost).add(depreciationCost); |
| | | BigDecimal profit = revenue.subtract(totalCost); |
| | | BigDecimal profitRate = rate(profit, revenue); |
| | | String riskLevel = profit.compareTo(BigDecimal.ZERO) < 0 |
| | | ? "high" |
| | | : (profitRate.compareTo(new BigDecimal("0.08")) < 0 ? "medium" : "low"); |
| | | List<String> reasons = buildProfitReasons(revenue, materialCost, laborCost, scrapCost, profit, profitRate); |
| | | String suggestion = buildProfitSuggestion(riskLevel, reasons); |
| | | |
| | | metrics.add(new OrderProfitMetric( |
| | | ledger.getId(), |
| | | safe(ledger.getSalesContractNo()), |
| | | safe(ledger.getCustomerName()), |
| | | safe(ledger.getProjectName()), |
| | | toLocalDate(ledger.getEntryDate()), |
| | | ledger.getDeliveryDate(), |
| | | revenue, |
| | | materialCost, |
| | | laborCost, |
| | | depreciationCost, |
| | | scrapCost, |
| | | totalCost, |
| | | profit, |
| | | profitRate, |
| | | riskLevel, |
| | | reasons, |
| | | suggestion |
| | | )); |
| | | } |
| | | |
| | | metrics.sort(Comparator.comparing(OrderProfitMetric::entryDate, Comparator.nullsLast(Comparator.reverseOrder())) |
| | | .thenComparing(OrderProfitMetric::ledgerId, Comparator.nullsLast(Comparator.reverseOrder()))); |
| | | BigDecimal totalMaterialCost = metrics.stream().map(OrderProfitMetric::materialCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalLaborCost = metrics.stream().map(OrderProfitMetric::laborCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalScrapCost = metrics.stream().map(OrderProfitMetric::scrapCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalDepreciationCost = metrics.stream().map(OrderProfitMetric::depreciationCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalCost = metrics.stream().map(OrderProfitMetric::totalCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalProfit = metrics.stream().map(OrderProfitMetric::profit).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | return new AnalysisBundle( |
| | | metrics, |
| | | productionCostContext.processCostRanking(), |
| | | totalRevenue, |
| | | totalMaterialCost, |
| | | totalLaborCost, |
| | | totalDepreciationCost, |
| | | totalScrapCost, |
| | | totalCost, |
| | | totalProfit |
| | | ); |
| | | } |
| | | |
| | | private MaterialCostResult calculateMaterialCost(LoginUser loginUser, DateRange range, List<SalesLedgerProduct> ledgerProducts) { |
| | | if (ledgerProducts.isEmpty()) { |
| | | return new MaterialCostResult(Map.of(), Map.of()); |
| | | } |
| | | List<Long> ledgerProductIds = ledgerProducts.stream().map(SalesLedgerProduct::getId).filter(Objects::nonNull).toList(); |
| | | Set<Long> productModelIds = ledgerProducts.stream().map(SalesLedgerProduct::getProductModelId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| | | Map<Long, Long> productIdToLedgerId = ledgerProducts.stream() |
| | | .filter(item -> item.getId() != null && item.getSalesLedgerId() != null) |
| | | .collect(Collectors.toMap(SalesLedgerProduct::getId, SalesLedgerProduct::getSalesLedgerId, (a, b) -> a)); |
| | | |
| | | Map<Long, BigDecimal> avgUnitCostByModelId = queryAverageUnitCostByModel(loginUser, productModelIds); |
| | | LambdaQueryWrapper<ProcurementRecordOut> outWrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(outWrapper, loginUser.getTenantId(), ProcurementRecordOut::getTenantId); |
| | | applyDeptFilter(outWrapper, loginUser.getCurrentDeptId(), ProcurementRecordOut::getDeptId); |
| | | outWrapper.eq(ProcurementRecordOut::getType, 2) |
| | | .in(ProcurementRecordOut::getSalesLedgerProductId, ledgerProductIds); |
| | | if (range.hasDateFilter()) { |
| | | outWrapper.ge(ProcurementRecordOut::getCreateTime, range.start().atStartOfDay()) |
| | | .lt(ProcurementRecordOut::getCreateTime, range.end().plusDays(1).atStartOfDay()); |
| | | } |
| | | List<ProcurementRecordOut> outList = defaultList(procurementRecordOutMapper.selectList(outWrapper)); |
| | | |
| | | Set<Integer> storageIds = outList.stream() |
| | | .map(ProcurementRecordOut::getProcurementRecordStorageId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Integer, ProcurementRecordStorage> storageMap = storageIds.isEmpty() |
| | | ? Map.of() |
| | | : defaultList(procurementRecordMapper.selectBatchIds(storageIds)).stream() |
| | | .collect(Collectors.toMap(ProcurementRecordStorage::getId, item -> item, (a, b) -> a)); |
| | | |
| | | Map<Long, BigDecimal> materialCostByLedgerId = new HashMap<>(); |
| | | for (ProcurementRecordOut out : outList) { |
| | | Long ledgerId = productIdToLedgerId.get(out.getSalesLedgerProductId()); |
| | | if (ledgerId == null) { |
| | | continue; |
| | | } |
| | | ProcurementRecordStorage storage = storageMap.get(out.getProcurementRecordStorageId()); |
| | | BigDecimal unitPrice = storage == null ? BigDecimal.ZERO : defaultDecimal(storage.getUnitPrice()); |
| | | BigDecimal quantity = defaultDecimal(out.getInboundNum()); |
| | | BigDecimal cost = quantity.multiply(unitPrice); |
| | | materialCostByLedgerId.merge(ledgerId, cost, BigDecimal::add); |
| | | } |
| | | return new MaterialCostResult(materialCostByLedgerId, avgUnitCostByModelId); |
| | | } |
| | | |
| | | private ProductionCostContext calculateProductionCost(LoginUser loginUser, |
| | | DateRange range, |
| | | List<SalesLedger> ledgers, |
| | | List<SalesLedgerProduct> ledgerProducts, |
| | | Map<Long, BigDecimal> avgUnitCostByModelId) { |
| | | if (ledgers.isEmpty()) { |
| | | return ProductionCostContext.empty(); |
| | | } |
| | | |
| | | Set<Long> ledgerIds = ledgers.stream().map(SalesLedger::getId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| | | Map<Long, Set<Long>> productModelToLedgerIds = new HashMap<>(); |
| | | for (SalesLedgerProduct product : ledgerProducts) { |
| | | if (product.getProductModelId() == null || product.getSalesLedgerId() == null) { |
| | | continue; |
| | | } |
| | | productModelToLedgerIds.computeIfAbsent(product.getProductModelId(), key -> new HashSet<>()).add(product.getSalesLedgerId()); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductionPlan> planWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(planWrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId); |
| | | planWrapper.in(ProductionPlan::getSalesLedgerId, ledgerIds); |
| | | List<ProductionPlan> plans = defaultList(productionPlanMapper.selectList(planWrapper)); |
| | | Map<Long, Long> planIdToLedgerId = plans.stream() |
| | | .filter(item -> item.getId() != null && item.getSalesLedgerId() != null) |
| | | .collect(Collectors.toMap(ProductionPlan::getId, ProductionPlan::getSalesLedgerId, (a, b) -> a)); |
| | | |
| | | LambdaQueryWrapper<ProductionOrder> orderWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(orderWrapper, loginUser.getCurrentDeptId(), ProductionOrder::getDeptId); |
| | | if (range.hasDateFilter()) { |
| | | orderWrapper.ge(ProductionOrder::getCreateTime, range.start().atStartOfDay().minusMonths(2)) |
| | | .lt(ProductionOrder::getCreateTime, range.end().plusDays(1).atStartOfDay().plusMonths(1)); |
| | | } |
| | | List<ProductionOrder> orders = defaultList(productionOrderMapper.selectList(orderWrapper)); |
| | | |
| | | Map<Long, Set<Long>> orderIdToLedgerIds = new HashMap<>(); |
| | | for (ProductionOrder order : orders) { |
| | | Set<Long> orderLedgers = new HashSet<>(); |
| | | for (Long planId : parseIdList(order.getProductionPlanIds())) { |
| | | Long ledgerId = planIdToLedgerId.get(planId); |
| | | if (ledgerId != null) { |
| | | orderLedgers.add(ledgerId); |
| | | } |
| | | } |
| | | if (orderLedgers.isEmpty() && order.getProductModelId() != null) { |
| | | orderLedgers.addAll(productModelToLedgerIds.getOrDefault(order.getProductModelId(), Set.of())); |
| | | } |
| | | if (!orderLedgers.isEmpty()) { |
| | | orderIdToLedgerIds.put(order.getId(), orderLedgers); |
| | | } |
| | | } |
| | | if (orderIdToLedgerIds.isEmpty()) { |
| | | return ProductionCostContext.empty(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductionOperationTask> taskWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(taskWrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId); |
| | | taskWrapper.in(ProductionOperationTask::getProductionOrderId, orderIdToLedgerIds.keySet()); |
| | | List<ProductionOperationTask> tasks = defaultList(productionOperationTaskMapper.selectList(taskWrapper)); |
| | | Map<Long, Long> taskIdToOrderId = tasks.stream() |
| | | .filter(item -> item.getId() != null && item.getProductionOrderId() != null) |
| | | .collect(Collectors.toMap(ProductionOperationTask::getId, ProductionOperationTask::getProductionOrderId, (a, b) -> a)); |
| | | if (taskIdToOrderId.isEmpty()) { |
| | | return ProductionCostContext.empty(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductionProductMain> mainWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(mainWrapper, loginUser.getCurrentDeptId(), ProductionProductMain::getDeptId); |
| | | mainWrapper.in(ProductionProductMain::getProductionOperationTaskId, taskIdToOrderId.keySet()); |
| | | if (range.hasDateFilter()) { |
| | | mainWrapper.ge(ProductionProductMain::getCreateTime, range.start().atStartOfDay().minusMonths(2)) |
| | | .lt(ProductionProductMain::getCreateTime, range.end().plusDays(1).atStartOfDay().plusMonths(1)); |
| | | } |
| | | List<ProductionProductMain> mainList = defaultList(productionProductMainMapper.selectList(mainWrapper)); |
| | | Map<Long, Set<Long>> mainIdToLedgers = new HashMap<>(); |
| | | for (ProductionProductMain main : mainList) { |
| | | Long orderId = taskIdToOrderId.get(main.getProductionOperationTaskId()); |
| | | if (orderId == null) { |
| | | continue; |
| | | } |
| | | Set<Long> ledgerSet = orderIdToLedgerIds.get(orderId); |
| | | if (ledgerSet == null || ledgerSet.isEmpty()) { |
| | | continue; |
| | | } |
| | | mainIdToLedgers.put(main.getId(), ledgerSet); |
| | | } |
| | | if (mainIdToLedgers.isEmpty()) { |
| | | return ProductionCostContext.empty(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductionAccount> accountWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(accountWrapper, loginUser.getCurrentDeptId(), ProductionAccount::getDeptId); |
| | | accountWrapper.in(ProductionAccount::getProductionProductMainId, mainIdToLedgers.keySet()); |
| | | if (range.hasDateFilter()) { |
| | | accountWrapper.ge(ProductionAccount::getSchedulingDate, range.start().atStartOfDay()) |
| | | .lt(ProductionAccount::getSchedulingDate, range.end().plusDays(1).atStartOfDay()); |
| | | } |
| | | List<ProductionAccount> accountList = defaultList(productionAccountMapper.selectList(accountWrapper)); |
| | | |
| | | Map<String, BigDecimal> salaryQuotaByOperation = defaultList(technologyOperationMapper.selectList(new LambdaQueryWrapper<TechnologyOperation>() |
| | | .select(TechnologyOperation::getName, TechnologyOperation::getSalaryQuota))) |
| | | .stream() |
| | | .filter(item -> StringUtils.hasText(item.getName())) |
| | | .collect(Collectors.toMap(TechnologyOperation::getName, item -> defaultDecimal(item.getSalaryQuota()), (a, b) -> a)); |
| | | |
| | | Map<Long, BigDecimal> laborCostByLedger = new HashMap<>(); |
| | | Map<String, BigDecimal> processCostMap = new HashMap<>(); |
| | | for (ProductionAccount account : accountList) { |
| | | Set<Long> ledgerSet = mainIdToLedgers.get(account.getProductionProductMainId()); |
| | | if (ledgerSet == null || ledgerSet.isEmpty()) { |
| | | continue; |
| | | } |
| | | BigDecimal cost = estimateLaborCost(account, salaryQuotaByOperation); |
| | | if (cost.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | BigDecimal split = cost.divide(new BigDecimal(ledgerSet.size()), 4, RoundingMode.HALF_UP); |
| | | for (Long ledgerId : ledgerSet) { |
| | | laborCostByLedger.merge(ledgerId, split, BigDecimal::add); |
| | | } |
| | | processCostMap.merge(safe(account.getTechnologyOperationName()), cost, BigDecimal::add); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductionProductOutput> outputWrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(outputWrapper, loginUser.getCurrentDeptId(), ProductionProductOutput::getDeptId); |
| | | outputWrapper.in(ProductionProductOutput::getProductionProductMainId, mainIdToLedgers.keySet()); |
| | | if (range.hasDateFilter()) { |
| | | outputWrapper.ge(ProductionProductOutput::getCreateTime, range.start().atStartOfDay()) |
| | | .lt(ProductionProductOutput::getCreateTime, range.end().plusDays(1).atStartOfDay()); |
| | | } |
| | | List<ProductionProductOutput> outputList = defaultList(productionProductOutputMapper.selectList(outputWrapper)); |
| | | Map<Long, BigDecimal> scrapCostByLedger = new HashMap<>(); |
| | | for (ProductionProductOutput output : outputList) { |
| | | Set<Long> ledgerSet = mainIdToLedgers.get(output.getProductionProductMainId()); |
| | | if (ledgerSet == null || ledgerSet.isEmpty()) { |
| | | continue; |
| | | } |
| | | BigDecimal scrapQty = defaultDecimal(output.getScrapQty()); |
| | | if (scrapQty.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | BigDecimal unitCost = avgUnitCostByModelId.getOrDefault(output.getProductModelId(), BigDecimal.ZERO); |
| | | BigDecimal scrapCost = scrapQty.multiply(unitCost); |
| | | BigDecimal split = scrapCost.divide(new BigDecimal(ledgerSet.size()), 4, RoundingMode.HALF_UP); |
| | | for (Long ledgerId : ledgerSet) { |
| | | scrapCostByLedger.merge(ledgerId, split, BigDecimal::add); |
| | | } |
| | | } |
| | | |
| | | Map<String, BigDecimal> processCostRanking = processCostMap.entrySet().stream() |
| | | .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed()) |
| | | .limit(10) |
| | | .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new)); |
| | | |
| | | return new ProductionCostContext(laborCostByLedger, scrapCostByLedger, processCostRanking); |
| | | } |
| | | |
| | | private List<SalesLedger> querySalesLedgers(LoginUser loginUser, DateRange range, String keyword, Integer limit) { |
| | | LambdaQueryWrapper<SalesLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), SalesLedger::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedger::getDeptId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(SalesLedger::getSalesContractNo, keyword) |
| | | .or().like(SalesLedger::getCustomerContractNo, keyword) |
| | | .or().like(SalesLedger::getCustomerName, keyword) |
| | | .or().like(SalesLedger::getProjectName, keyword) |
| | | .or().like(SalesLedger::getSalesman, keyword)); |
| | | } |
| | | if (range.hasDateFilter()) { |
| | | wrapper.ge(SalesLedger::getEntryDate, toDate(range.start())) |
| | | .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end())); |
| | | } |
| | | wrapper.orderByDesc(SalesLedger::getEntryDate, SalesLedger::getId); |
| | | if (limit != null && limit > 0) { |
| | | wrapper.last("limit " + normalizeLimit(limit)); |
| | | } |
| | | return defaultList(salesLedgerMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<SalesLedgerProduct> queryLedgerProducts(LoginUser loginUser, List<Long> ledgerIds) { |
| | | if (ledgerIds == null || ledgerIds.isEmpty()) { |
| | | return List.of(); |
| | | } |
| | | LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedgerProduct::getDeptId); |
| | | wrapper.in(SalesLedgerProduct::getSalesLedgerId, ledgerIds) |
| | | .eq(SalesLedgerProduct::getType, 1); |
| | | return defaultList(salesLedgerProductMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<StockInventory> queryStockInventory(LoginUser loginUser) { |
| | | LambdaQueryWrapper<StockInventory> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), StockInventory::getDeptId); |
| | | return defaultList(stockInventoryMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<Long, ProductModel> queryProductModels(Set<Long> modelIds) { |
| | | if (modelIds == null || modelIds.isEmpty()) { |
| | | return defaultList(productModelMapper.selectList(null)).stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(ProductModel::getId, item -> item, (a, b) -> a)); |
| | | } |
| | | LambdaQueryWrapper<ProductModel> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.in(ProductModel::getId, modelIds); |
| | | return defaultList(productModelMapper.selectList(wrapper)).stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(ProductModel::getId, item -> item, (a, b) -> a)); |
| | | } |
| | | |
| | | private Map<Long, Product> queryProducts(Collection<ProductModel> models) { |
| | | Set<Long> productIds = models == null ? Set.of() : models.stream() |
| | | .map(ProductModel::getProductId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (productIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.in(Product::getId, productIds); |
| | | return defaultList(productMapper.selectList(wrapper)).stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(Product::getId, item -> item, (a, b) -> a)); |
| | | } |
| | | |
| | | private Map<Long, BigDecimal> queryAverageUnitCostByModel(LoginUser loginUser, Set<Long> productModelIds) { |
| | | LambdaQueryWrapper<ProcurementRecordStorage> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementRecordStorage::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementRecordStorage::getDeptId); |
| | | wrapper.in(ProcurementRecordStorage::getType, List.of(1, 2)); |
| | | if (productModelIds != null && !productModelIds.isEmpty()) { |
| | | wrapper.in(ProcurementRecordStorage::getProductModelId, productModelIds); |
| | | } |
| | | List<ProcurementRecordStorage> rows = defaultList(procurementRecordMapper.selectList(wrapper)); |
| | | Map<Long, BigDecimal> amountByModel = new HashMap<>(); |
| | | Map<Long, BigDecimal> qtyByModel = new HashMap<>(); |
| | | for (ProcurementRecordStorage row : rows) { |
| | | if (row.getProductModelId() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal qty = defaultDecimal(row.getInboundNum()); |
| | | if (qty.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | BigDecimal amount = defaultDecimal(row.getUnitPrice()).multiply(qty); |
| | | amountByModel.merge(row.getProductModelId(), amount, BigDecimal::add); |
| | | qtyByModel.merge(row.getProductModelId(), qty, BigDecimal::add); |
| | | } |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | for (Map.Entry<Long, BigDecimal> entry : amountByModel.entrySet()) { |
| | | BigDecimal qty = qtyByModel.get(entry.getKey()); |
| | | if (qty == null || qty.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | result.put(entry.getKey(), entry.getValue().divide(qty, 6, RoundingMode.HALF_UP)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private OutboundStats queryOutboundStats(LoginUser loginUser, Set<Long> productModelIds, DateRange range) { |
| | | LambdaQueryWrapper<ProcurementRecordOut> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementRecordOut::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementRecordOut::getDeptId); |
| | | if (productModelIds != null && !productModelIds.isEmpty()) { |
| | | wrapper.in(ProcurementRecordOut::getProductModelId, productModelIds); |
| | | } |
| | | if (range.hasDateFilter()) { |
| | | wrapper.ge(ProcurementRecordOut::getCreateTime, range.start().atStartOfDay()) |
| | | .lt(ProcurementRecordOut::getCreateTime, range.end().plusDays(1).atStartOfDay()); |
| | | } |
| | | List<ProcurementRecordOut> outList = defaultList(procurementRecordOutMapper.selectList(wrapper)); |
| | | if (outList.isEmpty()) { |
| | | return OutboundStats.empty(); |
| | | } |
| | | Set<Integer> storageIds = outList.stream() |
| | | .map(ProcurementRecordOut::getProcurementRecordStorageId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Integer, ProcurementRecordStorage> storageMap = storageIds.isEmpty() |
| | | ? Map.of() |
| | | : defaultList(procurementRecordMapper.selectBatchIds(storageIds)).stream() |
| | | .collect(Collectors.toMap(ProcurementRecordStorage::getId, item -> item, (a, b) -> a)); |
| | | |
| | | Map<Long, BigDecimal> outboundQtyByModel = new HashMap<>(); |
| | | Map<Long, LocalDateTime> lastOutboundTimeByModel = new HashMap<>(); |
| | | BigDecimal totalOutboundCost = BigDecimal.ZERO; |
| | | for (ProcurementRecordOut out : outList) { |
| | | Long modelId = out.getProductModelId(); |
| | | if (modelId == null) { |
| | | continue; |
| | | } |
| | | BigDecimal qty = defaultDecimal(out.getInboundNum()); |
| | | outboundQtyByModel.merge(modelId, qty, BigDecimal::add); |
| | | if (out.getCreateTime() != null) { |
| | | LocalDateTime existing = lastOutboundTimeByModel.get(modelId); |
| | | if (existing == null || out.getCreateTime().isAfter(existing)) { |
| | | lastOutboundTimeByModel.put(modelId, out.getCreateTime()); |
| | | } |
| | | } |
| | | ProcurementRecordStorage storage = storageMap.get(out.getProcurementRecordStorageId()); |
| | | BigDecimal unitPrice = storage == null ? BigDecimal.ZERO : defaultDecimal(storage.getUnitPrice()); |
| | | totalOutboundCost = totalOutboundCost.add(unitPrice.multiply(qty)); |
| | | } |
| | | return new OutboundStats(outboundQtyByModel, lastOutboundTimeByModel, totalOutboundCost); |
| | | } |
| | | |
| | | private List<InventoryMetric> buildInventoryMetrics(List<StockInventory> inventoryRows, |
| | | Map<Long, ProductModel> productModelMap, |
| | | Map<Long, Product> productMap, |
| | | Map<Long, BigDecimal> avgUnitCostByModelId, |
| | | OutboundStats outboundStats) { |
| | | Map<Long, InventoryMetricBuilder> metricBuilderByModel = new HashMap<>(); |
| | | for (StockInventory row : inventoryRows) { |
| | | if (row.getProductModelId() == null) { |
| | | continue; |
| | | } |
| | | InventoryMetricBuilder builder = metricBuilderByModel.computeIfAbsent(row.getProductModelId(), InventoryMetricBuilder::new); |
| | | builder.addQuantity(maxZero(defaultDecimal(row.getQualitity()).subtract(defaultDecimal(row.getLockedQuantity())))); |
| | | builder.addLockedQuantity(defaultDecimal(row.getLockedQuantity())); |
| | | builder.addWarnNum(defaultDecimal(row.getWarnNum())); |
| | | if (row.getCreateTime() != null) { |
| | | builder.updateFirstInTime(row.getCreateTime()); |
| | | } |
| | | } |
| | | |
| | | List<InventoryMetric> result = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | for (InventoryMetricBuilder builder : metricBuilderByModel.values()) { |
| | | Long modelId = builder.modelId(); |
| | | ProductModel model = productModelMap.get(modelId); |
| | | Product product = model == null ? null : productMap.get(model.getProductId()); |
| | | BigDecimal unitCost = avgUnitCostByModelId.getOrDefault(modelId, BigDecimal.ZERO); |
| | | BigDecimal value = builder.quantity().multiply(unitCost); |
| | | LocalDateTime lastOutTime = outboundStats.lastOutboundTimeByModel().get(modelId); |
| | | long stagnantDays; |
| | | if (lastOutTime != null) { |
| | | stagnantDays = daysBetween(lastOutTime.toLocalDate(), today); |
| | | } else if (builder.firstInTime() != null) { |
| | | stagnantDays = daysBetween(builder.firstInTime().toLocalDate(), today); |
| | | } else { |
| | | stagnantDays = 0; |
| | | } |
| | | BigDecimal outQty = outboundStats.outboundQtyByModel().getOrDefault(modelId, BigDecimal.ZERO); |
| | | boolean overstock = builder.warnNum().compareTo(BigDecimal.ZERO) > 0 |
| | | && builder.quantity().compareTo(builder.warnNum().multiply(new BigDecimal("3"))) > 0; |
| | | result.add(new InventoryMetric( |
| | | modelId, |
| | | product == null ? "æªç¥äº§å" : safe(product.getProductName()), |
| | | model == null ? "æªç¥åå·" : safe(model.getModel()), |
| | | builder.quantity(), |
| | | builder.lockedQuantity(), |
| | | unitCost, |
| | | value, |
| | | outQty, |
| | | stagnantDays, |
| | | overstock |
| | | )); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<AccountSalesCollection> queryCollections(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId); |
| | | if (range.hasDateFilter()) { |
| | | wrapper.ge(AccountSalesCollection::getCollectionDate, range.start()) |
| | | .le(AccountSalesCollection::getCollectionDate, range.end()); |
| | | } |
| | | wrapper.orderByAsc(AccountSalesCollection::getCollectionDate); |
| | | return defaultList(accountSalesCollectionMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<AccountPurchasePayment> queryPayments(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId); |
| | | if (range.hasDateFilter()) { |
| | | wrapper.ge(AccountPurchasePayment::getPaymentDate, range.start()) |
| | | .le(AccountPurchasePayment::getPaymentDate, range.end()); |
| | | } |
| | | wrapper.orderByAsc(AccountPurchasePayment::getPaymentDate); |
| | | return defaultList(accountPurchasePaymentMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<MonthlyCashFlow> buildMonthlyCashFlow(DateRange range, |
| | | List<AccountSalesCollection> collections, |
| | | List<AccountPurchasePayment> payments) { |
| | | Map<YearMonth, BigDecimal> incomeByMonth = new LinkedHashMap<>(); |
| | | Map<YearMonth, BigDecimal> expenseByMonth = new LinkedHashMap<>(); |
| | | DateRange monthlyRange = range.hasDateFilter() ? range : inferCashFlowRange(collections, payments); |
| | | if (!monthlyRange.hasDateFilter()) { |
| | | return List.of(); |
| | | } |
| | | YearMonth startMonth = YearMonth.from(monthlyRange.start()); |
| | | YearMonth endMonth = YearMonth.from(monthlyRange.end()); |
| | | for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) { |
| | | incomeByMonth.put(month, BigDecimal.ZERO); |
| | | expenseByMonth.put(month, BigDecimal.ZERO); |
| | | } |
| | | |
| | | for (AccountSalesCollection row : collections) { |
| | | if (row.getCollectionDate() == null) { |
| | | continue; |
| | | } |
| | | YearMonth month = YearMonth.from(row.getCollectionDate()); |
| | | if (incomeByMonth.containsKey(month)) { |
| | | incomeByMonth.put(month, incomeByMonth.get(month).add(defaultDecimal(row.getCollectionAmount()))); |
| | | } |
| | | } |
| | | for (AccountPurchasePayment row : payments) { |
| | | if (row.getPaymentDate() == null) { |
| | | continue; |
| | | } |
| | | YearMonth month = YearMonth.from(row.getPaymentDate()); |
| | | if (expenseByMonth.containsKey(month)) { |
| | | expenseByMonth.put(month, expenseByMonth.get(month).add(defaultDecimal(row.getPaymentAmount()))); |
| | | } |
| | | } |
| | | |
| | | List<MonthlyCashFlow> result = new ArrayList<>(); |
| | | for (YearMonth month : incomeByMonth.keySet()) { |
| | | BigDecimal income = incomeByMonth.get(month); |
| | | BigDecimal expense = expenseByMonth.getOrDefault(month, BigDecimal.ZERO); |
| | | result.add(new MonthlyCashFlow(month.toString(), income, expense, income.subtract(expense))); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private DateRange inferCashFlowRange(List<AccountSalesCollection> collections, |
| | | List<AccountPurchasePayment> payments) { |
| | | LocalDate min = null; |
| | | LocalDate max = null; |
| | | for (AccountSalesCollection row : defaultList(collections)) { |
| | | if (row.getCollectionDate() == null) { |
| | | continue; |
| | | } |
| | | min = min == null || row.getCollectionDate().isBefore(min) ? row.getCollectionDate() : min; |
| | | max = max == null || row.getCollectionDate().isAfter(max) ? row.getCollectionDate() : max; |
| | | } |
| | | for (AccountPurchasePayment row : defaultList(payments)) { |
| | | if (row.getPaymentDate() == null) { |
| | | continue; |
| | | } |
| | | min = min == null || row.getPaymentDate().isBefore(min) ? row.getPaymentDate() : min; |
| | | max = max == null || row.getPaymentDate().isAfter(max) ? row.getPaymentDate() : max; |
| | | } |
| | | return min == null || max == null ? new DateRange(null, null, "å
¨é¨") : new DateRange(min, max, "å
¨é¨"); |
| | | } |
| | | |
| | | private List<MonthlyCashFlow> forecastMonthlyCashFlow(List<MonthlyCashFlow> actual, int forecastMonths) { |
| | | if (actual.isEmpty()) { |
| | | List<MonthlyCashFlow> defaults = new ArrayList<>(); |
| | | YearMonth now = YearMonth.now(); |
| | | for (int i = 1; i <= forecastMonths; i++) { |
| | | YearMonth month = now.plusMonths(i); |
| | | defaults.add(new MonthlyCashFlow(month.toString(), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO)); |
| | | } |
| | | return defaults; |
| | | } |
| | | List<BigDecimal> series = actual.stream().map(MonthlyCashFlow::netFlow).toList(); |
| | | BigDecimal avg = series.stream().reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .divide(new BigDecimal(series.size()), 4, RoundingMode.HALF_UP); |
| | | BigDecimal slope = BigDecimal.ZERO; |
| | | if (series.size() > 1) { |
| | | slope = series.get(series.size() - 1).subtract(series.get(0)) |
| | | .divide(new BigDecimal(series.size() - 1), 4, RoundingMode.HALF_UP); |
| | | } |
| | | YearMonth lastMonth = YearMonth.parse(actual.get(actual.size() - 1).month()); |
| | | List<MonthlyCashFlow> forecast = new ArrayList<>(); |
| | | for (int i = 1; i <= forecastMonths; i++) { |
| | | YearMonth month = lastMonth.plusMonths(i); |
| | | BigDecimal net = avg.add(slope.multiply(new BigDecimal(i))).setScale(2, RoundingMode.HALF_UP); |
| | | BigDecimal income = net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO; |
| | | BigDecimal expense = net.compareTo(BigDecimal.ZERO) >= 0 ? BigDecimal.ZERO : net.abs(); |
| | | forecast.add(new MonthlyCashFlow(month.toString(), income, expense, net)); |
| | | } |
| | | return forecast; |
| | | } |
| | | |
| | | private StatementSnapshot buildStatementSnapshot(LoginUser loginUser) { |
| | | LambdaQueryWrapper<AccountStatement> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountStatement::getDeptId); |
| | | wrapper.orderByDesc(AccountStatement::getStatementMonth); |
| | | List<AccountStatement> rows = defaultList(accountStatementMapper.selectList(wrapper)); |
| | | if (rows.isEmpty()) { |
| | | return StatementSnapshot.empty(); |
| | | } |
| | | |
| | | Map<String, AccountStatement> latestByEntity = new HashMap<>(); |
| | | for (AccountStatement row : rows) { |
| | | if (row.getAccountType() == null || row.getCustomerId() == null || !StringUtils.hasText(row.getStatementMonth())) { |
| | | continue; |
| | | } |
| | | String key = row.getAccountType() + "::" + row.getCustomerId(); |
| | | AccountStatement existing = latestByEntity.get(key); |
| | | if (existing == null || row.getStatementMonth().compareTo(existing.getStatementMonth()) > 0) { |
| | | latestByEntity.put(key, row); |
| | | } |
| | | } |
| | | |
| | | BigDecimal receivableTotal = BigDecimal.ZERO; |
| | | BigDecimal payableTotal = BigDecimal.ZERO; |
| | | List<StatementMetric> receivableMetrics = new ArrayList<>(); |
| | | List<StatementMetric> payableMetrics = new ArrayList<>(); |
| | | for (AccountStatement row : latestByEntity.values()) { |
| | | BigDecimal closing = defaultDecimal(row.getClosingBalance()); |
| | | if (Objects.equals(row.getAccountType(), 1)) { |
| | | receivableTotal = receivableTotal.add(closing); |
| | | receivableMetrics.add(new StatementMetric(String.valueOf(row.getCustomerId()), closing, |
| | | defaultDecimal(row.getCurrentPlan()), defaultDecimal(row.getCurrentActually()), safe(row.getStatementMonth()))); |
| | | } else if (Objects.equals(row.getAccountType(), 2)) { |
| | | payableTotal = payableTotal.add(closing); |
| | | payableMetrics.add(new StatementMetric(String.valueOf(row.getCustomerId()), closing, |
| | | defaultDecimal(row.getCurrentPlan()), defaultDecimal(row.getCurrentActually()), safe(row.getStatementMonth()))); |
| | | } |
| | | } |
| | | receivableMetrics.sort(Comparator.comparing(StatementMetric::closingBalance).reversed()); |
| | | payableMetrics.sort(Comparator.comparing(StatementMetric::closingBalance).reversed()); |
| | | |
| | | return new StatementSnapshot( |
| | | receivableTotal, |
| | | payableTotal, |
| | | receivableMetrics.stream().limit(10).toList(), |
| | | payableMetrics.stream().limit(10).toList() |
| | | ); |
| | | } |
| | | |
| | | private BigDecimal calculateTotalDepreciation(LoginUser loginUser) { |
| | | LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId); |
| | | wrapper.eq(DeviceLedger::getIsDepr, 1); |
| | | List<DeviceLedger> devices = defaultList(deviceLedgerMapper.selectList(wrapper)); |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (DeviceLedger device : devices) { |
| | | total = total.add(defaultDecimal(AccountingServiceImpl.calculatePreciseDepreciation(device))); |
| | | } |
| | | return total; |
| | | } |
| | | |
| | | private Map<Long, BigDecimal> allocateDepreciation(List<SalesLedger> ledgers, BigDecimal totalDepreciation, BigDecimal totalRevenue) { |
| | | if (ledgers.isEmpty() || totalDepreciation.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return Map.of(); |
| | | } |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | if (totalRevenue.compareTo(BigDecimal.ZERO) <= 0) { |
| | | BigDecimal avg = totalDepreciation.divide(new BigDecimal(ledgers.size()), 4, RoundingMode.HALF_UP); |
| | | for (SalesLedger ledger : ledgers) { |
| | | result.put(ledger.getId(), avg); |
| | | } |
| | | return result; |
| | | } |
| | | for (SalesLedger ledger : ledgers) { |
| | | BigDecimal revenue = defaultDecimal(ledger.getContractAmount()); |
| | | BigDecimal ratio = revenue.divide(totalRevenue, 6, RoundingMode.HALF_UP); |
| | | result.put(ledger.getId(), totalDepreciation.multiply(ratio)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private BigDecimal fallbackMaterialCost(List<SalesLedgerProduct> products, BigDecimal revenue) { |
| | | if (products != null && !products.isEmpty()) { |
| | | BigDecimal productAmount = products.stream() |
| | | .map(SalesLedgerProduct::getTaxExclusiveTotalPrice) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | if (productAmount.compareTo(BigDecimal.ZERO) > 0) { |
| | | return productAmount; |
| | | } |
| | | } |
| | | |
| | | BigDecimal materialCost = revenue.multiply(DEFAULT_FALLBACK_MATERIAL_COST_RATE); |
| | | BigDecimal laborCost = revenue.multiply(DEFAULT_LABOR_COST_RATE); |
| | | BigDecimal overheadCost = revenue.multiply(DEFAULT_OVERHEAD_COST_RATE); |
| | | |
| | | return materialCost.add(laborCost).add(overheadCost); |
| | | } |
| | | |
| | | private BigDecimal estimateTotalCost(BigDecimal revenue, List<SalesLedgerProduct> products) { |
| | | if (revenue == null || revenue.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | BigDecimal materialCost = BigDecimal.ZERO; |
| | | if (products != null && !products.isEmpty()) { |
| | | materialCost = products.stream() |
| | | .map(SalesLedgerProduct::getTaxExclusiveTotalPrice) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | if (materialCost.compareTo(BigDecimal.ZERO) <= 0) { |
| | | materialCost = revenue.multiply(DEFAULT_FALLBACK_MATERIAL_COST_RATE); |
| | | } |
| | | |
| | | BigDecimal laborCost = revenue.multiply(DEFAULT_LABOR_COST_RATE); |
| | | BigDecimal overheadCost = revenue.multiply(DEFAULT_OVERHEAD_COST_RATE); |
| | | |
| | | return materialCost.add(laborCost).add(overheadCost); |
| | | } |
| | | |
| | | private Map<String, String> queryCustomerNameMap(Set<String> idSet) { |
| | | if (idSet == null || idSet.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | Set<Long> ids = idSet.stream() |
| | | .map(this::toLongOrNull) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (ids.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | LambdaQueryWrapper<Customer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.in(Customer::getId, ids); |
| | | return defaultList(customerMapper.selectList(wrapper)).stream() |
| | | .collect(Collectors.toMap(item -> String.valueOf(item.getId()), Customer::getCustomerName, (a, b) -> a)); |
| | | } |
| | | |
| | | private Map<String, String> querySupplierNameMap(Set<String> idSet) { |
| | | if (idSet == null || idSet.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | Set<Long> ids = idSet.stream() |
| | | .map(this::toLongOrNull) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (ids.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | LambdaQueryWrapper<SupplierManage> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.in(SupplierManage::getId, ids); |
| | | return defaultList(supplierManageMapper.selectList(wrapper)).stream() |
| | | .collect(Collectors.toMap(item -> String.valueOf(item.getId()), SupplierManage::getSupplierName, (a, b) -> a)); |
| | | } |
| | | |
| | | private String riskLevelByAmount(BigDecimal amount) { |
| | | if (amount.compareTo(new BigDecimal("5000000")) >= 0) { |
| | | return "high"; |
| | | } |
| | | if (amount.compareTo(new BigDecimal("1000000")) >= 0) { |
| | | return "medium"; |
| | | } |
| | | return "low"; |
| | | } |
| | | |
| | | private long countDevices(LoginUser loginUser) { |
| | | LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId); |
| | | return deviceLedgerMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | private long countRepairingDevices(LoginUser loginUser) { |
| | | LambdaQueryWrapper<DeviceRepair> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceRepair::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceRepair::getDeptId); |
| | | wrapper.in(DeviceRepair::getStatus, List.of(0, 3)); |
| | | return deviceRepairMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | private BigDecimal estimateInventoryValue(LoginUser loginUser, List<StockInventory> inventories) { |
| | | if (inventories == null || inventories.isEmpty()) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | Set<Long> modelIds = inventories.stream().map(StockInventory::getProductModelId).filter(Objects::nonNull).collect(Collectors.toSet()); |
| | | Map<Long, BigDecimal> costMap = queryAverageUnitCostByModel(loginUser, modelIds); |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (StockInventory inventory : inventories) { |
| | | BigDecimal qty = maxZero(defaultDecimal(inventory.getQualitity()).subtract(defaultDecimal(inventory.getLockedQuantity()))); |
| | | BigDecimal unit = costMap.getOrDefault(inventory.getProductModelId(), BigDecimal.ZERO); |
| | | total = total.add(qty.multiply(unit)); |
| | | } |
| | | return total; |
| | | } |
| | | |
| | | private DateRange previousSameLengthRange(DateRange range) { |
| | | if (!range.hasDateFilter()) { |
| | | return new DateRange(null, null, "å
¨é¨"); |
| | | } |
| | | long days = daysBetween(range.start(), range.end()) + 1L; |
| | | LocalDate prevEnd = range.start().minusDays(1); |
| | | LocalDate prevStart = prevEnd.minusDays(days - 1L); |
| | | return new DateRange(prevStart, prevEnd, prevStart + "è³" + prevEnd); |
| | | } |
| | | |
| | | private List<String> buildProfitReasons(BigDecimal revenue, |
| | | BigDecimal materialCost, |
| | | BigDecimal laborCost, |
| | | BigDecimal scrapCost, |
| | | BigDecimal profit, |
| | | BigDecimal profitRate) { |
| | | List<String> reasons = new ArrayList<>(); |
| | | BigDecimal materialRate = rate(materialCost, revenue); |
| | | if (materialRate.compareTo(new BigDecimal("0.70")) >= 0) { |
| | | reasons.add("ææææ¬å æ¯è¶
è¿70%"); |
| | | } else if (materialRate.compareTo(new BigDecimal("0.55")) >= 0) { |
| | | reasons.add("ææææ¬å æ¯åé«"); |
| | | } |
| | | BigDecimal laborRate = rate(laborCost, revenue); |
| | | if (laborRate.compareTo(new BigDecimal("0.20")) >= 0) { |
| | | reasons.add("äººå·¥ææ¬å æ¯è¶
è¿20%"); |
| | | } else if (laborRate.compareTo(new BigDecimal("0.12")) >= 0) { |
| | | reasons.add("äººå·¥ææ¬å¢é¿åå¿«"); |
| | | } |
| | | BigDecimal scrapRate = rate(scrapCost, revenue); |
| | | if (scrapRate.compareTo(new BigDecimal("0.05")) >= 0) { |
| | | reasons.add("æ¥åºæèå æ¯åé«"); |
| | | } |
| | | if (profit.compareTo(BigDecimal.ZERO) < 0) { |
| | | reasons.add("订åå¤äºäºæç¶æ"); |
| | | } else if (profitRate.compareTo(new BigDecimal("0.08")) < 0) { |
| | | reasons.add("婿¶¦çä½äº8%"); |
| | | } |
| | | if (reasons.isEmpty()) { |
| | | reasons.add("ææ¬ç»æå¤äºåçåºé´"); |
| | | } |
| | | return reasons; |
| | | } |
| | | |
| | | private String buildProfitSuggestion(String riskLevel, List<String> reasons) { |
| | | if ("high".equals(riskLevel)) { |
| | | return "ä¼å
夿 ¸BOMç¨éä¸å·¥åºå®é¢ï¼å¿
è¦æ¶è°æ´æ¥ä»·å仿¬¾æ¡æ¬¾ï¼å¹¶éå¶è¶
è´¦æäº¤ä»ã"; |
| | | } |
| | | if ("medium".equals(riskLevel)) { |
| | | return "建议ä¼åéè´æ¹æ¬¡åå·¥åºæäº§ï¼æå䏿¬¡åæ ¼ç并忥æ§è¡æ¯å©é¢è¦ã"; |
| | | } |
| | | if (reasons.stream().anyMatch(item -> item.contains("ææ"))) { |
| | | return "ä¿æææéè´ææ¬çæ¿ï¼æå¨è·è¸ªä¸»è¦ææåä»·æ³¢å¨ã"; |
| | | } |
| | | return "ç»´æå½åç»è¥èå¥ï¼ç»§ç»è·è¸ªè®¢å婿¶¦çå忬¾æçã"; |
| | | } |
| | | |
| | | private Map<String, Object> toOrderCostItem(OrderProfitMetric metric) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("ledgerId", metric.ledgerId()); |
| | | item.put("salesContractNo", metric.salesContractNo()); |
| | | item.put("customerName", metric.customerName()); |
| | | item.put("projectName", metric.projectName()); |
| | | item.put("entryDate", formatDate(metric.entryDate())); |
| | | item.put("deliveryDate", formatDate(metric.deliveryDate())); |
| | | item.put("revenue", metric.revenue()); |
| | | item.put("materialCost", metric.materialCost()); |
| | | item.put("laborCost", metric.laborCost()); |
| | | item.put("depreciationCost", metric.depreciationCost()); |
| | | item.put("scrapCost", metric.scrapCost()); |
| | | item.put("totalCost", metric.totalCost()); |
| | | item.put("profit", metric.profit()); |
| | | item.put("profitRate", toPercent(metric.profitRate())); |
| | | item.put("riskLevel", metric.riskLevel()); |
| | | item.put("reasons", metric.reasons()); |
| | | item.put("suggestion", metric.suggestion()); |
| | | return item; |
| | | } |
| | | |
| | | private Map<String, Object> toRiskOrderItem(OrderProfitMetric metric) { |
| | | Map<String, Object> map = toOrderCostItem(metric); |
| | | map.put("priority", "high".equals(metric.riskLevel()) ? "high" : ("medium".equals(metric.riskLevel()) ? "medium" : "low")); |
| | | return map; |
| | | } |
| | | |
| | | private List<Map<String, Object>> buildCustomerProfitTop(List<OrderProfitMetric> metrics, int topN) { |
| | | Map<String, BigDecimal> customerProfitMap = new HashMap<>(); |
| | | Map<String, BigDecimal> customerRevenueMap = new HashMap<>(); |
| | | for (OrderProfitMetric metric : metrics) { |
| | | customerProfitMap.merge(metric.customerName(), metric.profit(), BigDecimal::add); |
| | | customerRevenueMap.merge(metric.customerName(), metric.revenue(), BigDecimal::add); |
| | | } |
| | | return customerProfitMap.entrySet().stream() |
| | | .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed()) |
| | | .limit(topN) |
| | | .map(entry -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | BigDecimal revenue = customerRevenueMap.getOrDefault(entry.getKey(), BigDecimal.ZERO); |
| | | map.put("customerName", entry.getKey()); |
| | | map.put("profit", entry.getValue()); |
| | | map.put("revenue", revenue); |
| | | map.put("profitRate", toPercent(rate(entry.getValue(), revenue))); |
| | | return map; |
| | | }) |
| | | .toList(); |
| | | } |
| | | |
| | | private Map<String, Object> toInventoryItem(InventoryMetric metric) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("productModelId", metric.modelId()); |
| | | map.put("productName", metric.productName()); |
| | | map.put("model", metric.modelName()); |
| | | map.put("quantity", metric.quantity()); |
| | | map.put("lockedQuantity", metric.lockedQuantity()); |
| | | map.put("avgUnitCost", metric.avgUnitCost()); |
| | | map.put("inventoryValue", metric.inventoryValue()); |
| | | map.put("outboundQuantity", metric.outboundQuantity()); |
| | | map.put("stagnantDays", metric.stagnantDays()); |
| | | map.put("overstock", metric.overstock()); |
| | | map.put("riskLevel", metric.stagnantDays() >= 90 ? "high" : (metric.stagnantDays() >= 30 ? "medium" : "low")); |
| | | return map; |
| | | } |
| | | |
| | | private boolean matchInventoryKeyword(InventoryMetric metric, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | return metric.productName().contains(keyword.trim()) || metric.modelName().contains(keyword.trim()); |
| | | } |
| | | |
| | | private Map<String, Object> toMonthlyCashFlowItem(MonthlyCashFlow flow) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("month", flow.month()); |
| | | map.put("income", flow.income()); |
| | | map.put("expense", flow.expense()); |
| | | map.put("netFlow", flow.netFlow()); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> toStatementRiskItem(StatementMetric metric, Map<String, String> nameMap, String type) { |
| | | BigDecimal actualRate = rate(metric.actualAmount(), metric.planAmount()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put(type + "Id", metric.entityId()); |
| | | map.put(type + "Name", safe(nameMap.get(metric.entityId()))); |
| | | map.put("statementMonth", metric.statementMonth()); |
| | | map.put("closingBalance", metric.closingBalance()); |
| | | map.put("planAmount", metric.planAmount()); |
| | | map.put("actualAmount", metric.actualAmount()); |
| | | map.put("actualRate", toPercent(actualRate)); |
| | | map.put("riskLevel", metric.closingBalance().compareTo(new BigDecimal("1000000")) > 0 || actualRate.compareTo(new BigDecimal("0.50")) < 0 ? "high" : "medium"); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> anomalyItem(String level, String type, String message, Map<String, Object> detail) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("riskLevel", level); |
| | | map.put("type", type); |
| | | map.put("message", message); |
| | | map.put("detail", detail); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> riskSuggestion(String type, String level, String suggestion) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("type", type); |
| | | map.put("level", level); |
| | | map.put("suggestion", suggestion); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> buildCostCompositionPie(BigDecimal material, BigDecimal labor, BigDecimal depreciation, BigDecimal scrap) { |
| | | List<Map<String, Object>> data = List.of( |
| | | Map.of("name", "ææææ¬", "value", material), |
| | | Map.of("name", "äººå·¥ææ¬", "value", labor), |
| | | Map.of("name", "ææ§ææ¬", "value", depreciation), |
| | | Map.of("name", "æèææ¬", "value", scrap) |
| | | ); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "ææ¬ææ", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "item")); |
| | | option.put("series", List.of(Map.of("name", "ææ¬ææ", "type", "pie", "radius", "60%", "data", data))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildOrderProfitBar(List<OrderProfitMetric> metrics) { |
| | | List<OrderProfitMetric> top = metrics.stream() |
| | | .sorted(Comparator.comparing(OrderProfitMetric::profit)) |
| | | .limit(10) |
| | | .toList(); |
| | | List<String> xData = top.stream().map(OrderProfitMetric::salesContractNo).toList(); |
| | | List<BigDecimal> yData = top.stream().map(OrderProfitMetric::profit).toList(); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "订å婿¶¦åå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", xData)); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "婿¶¦", "type", "bar", "data", yData))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildProcessCostBar(Map<String, BigDecimal> processCosts) { |
| | | List<String> xData = new ArrayList<>(processCosts.keySet()); |
| | | List<BigDecimal> yData = new ArrayList<>(processCosts.values()); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "å·¥åºææ¬æå", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", xData)); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "ææ¬", "type", "bar", "data", yData))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildProfitDistributionBar(List<OrderProfitMetric> metrics) { |
| | | List<OrderProfitMetric> sorted = metrics.stream() |
| | | .sorted(Comparator.comparing(OrderProfitMetric::profitRate)) |
| | | .limit(15) |
| | | .toList(); |
| | | List<String> xData = sorted.stream().map(OrderProfitMetric::salesContractNo).toList(); |
| | | List<BigDecimal> yData = sorted.stream().map(metric -> metric.profitRate().multiply(ONE_HUNDRED).setScale(2, RoundingMode.HALF_UP)).toList(); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "订å婿¶¦çåå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", xData)); |
| | | option.put("yAxis", Map.of("type", "value", "name", "%")); |
| | | option.put("series", List.of(Map.of("name", "婿¶¦ç", "type", "bar", "data", yData))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildLossOrderTrendLine(List<OrderProfitMetric> metrics) { |
| | | Map<String, Long> lossByDate = new LinkedHashMap<>(); |
| | | List<OrderProfitMetric> sorted = metrics.stream() |
| | | .filter(metric -> metric.entryDate() != null) |
| | | .sorted(Comparator.comparing(OrderProfitMetric::entryDate)) |
| | | .toList(); |
| | | for (OrderProfitMetric metric : sorted) { |
| | | String day = formatDate(metric.entryDate()); |
| | | long inc = metric.profit().compareTo(BigDecimal.ZERO) < 0 ? 1L : 0L; |
| | | lossByDate.merge(day, inc, Long::sum); |
| | | } |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "äºæè®¢åè¶å¿", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", new ArrayList<>(lossByDate.keySet()))); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "äºæè®¢åæ°", "type", "line", "smooth", true, "data", new ArrayList<>(lossByDate.values())))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildCustomerProfitBar(Map<String, BigDecimal> customerProfitMap) { |
| | | List<Map.Entry<String, BigDecimal>> top = customerProfitMap.entrySet().stream() |
| | | .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed()) |
| | | .limit(10) |
| | | .toList(); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "客æ·å©æ¶¦è´¡ç®TOP10", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", top.stream().map(Map.Entry::getKey).toList())); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "婿¶¦", "type", "bar", "data", top.stream().map(Map.Entry::getValue).toList()))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildInventoryTopBar(List<InventoryMetric> metrics) { |
| | | List<InventoryMetric> top = metrics.stream() |
| | | .sorted(Comparator.comparing(InventoryMetric::inventoryValue).reversed()) |
| | | .limit(10) |
| | | .toList(); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "åºåèµéå ç¨TOP10", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", top.stream().map(item -> item.productName() + "/" + item.modelName()).toList())); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "èµéå ç¨", "type", "bar", "data", top.stream().map(InventoryMetric::inventoryValue).toList()))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildInventoryAgingPie(List<InventoryMetric> metrics) { |
| | | long normal = metrics.stream().filter(item -> item.stagnantDays() < 30).count(); |
| | | long slow = metrics.stream().filter(item -> item.stagnantDays() >= 30 && item.stagnantDays() < 90).count(); |
| | | long stagnant = metrics.stream().filter(item -> item.stagnantDays() >= 90).count(); |
| | | List<Map<String, Object>> data = List.of( |
| | | Map.of("name", "æ£å¸¸", "value", normal), |
| | | Map.of("name", "ç¼æ
¢", "value", slow), |
| | | Map.of("name", "åæ»", "value", stagnant) |
| | | ); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "åºååºé¾åå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "item")); |
| | | option.put("series", List.of(Map.of("type", "pie", "radius", "60%", "data", data))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildTurnoverGauge(BigDecimal turnoverDays) { |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "åºåå¨è½¬å¤©æ°", "left", "center")); |
| | | option.put("series", List.of(Map.of( |
| | | "type", "gauge", |
| | | "min", 0, |
| | | "max", 180, |
| | | "detail", Map.of("formatter", "{value}天"), |
| | | "data", List.of(Map.of("value", turnoverDays, "name", "å¨è½¬å¤©æ°")) |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildCashflowTrend(List<MonthlyCashFlow> actual, List<MonthlyCashFlow> forecast) { |
| | | List<String> labels = new ArrayList<>(); |
| | | List<BigDecimal> netActual = new ArrayList<>(); |
| | | List<BigDecimal> netForecast = new ArrayList<>(); |
| | | for (MonthlyCashFlow point : actual) { |
| | | labels.add(point.month()); |
| | | netActual.add(point.netFlow()); |
| | | netForecast.add(null); |
| | | } |
| | | for (MonthlyCashFlow point : forecast) { |
| | | labels.add(point.month()); |
| | | netActual.add(null); |
| | | netForecast.add(point.netFlow()); |
| | | } |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "ç°éæµè¶å¿ï¼å®é
+颿µï¼", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", labels)); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of( |
| | | Map.of("name", "å®é
åç°éæµ", "type", "line", "smooth", true, "data", netActual), |
| | | Map.of("name", "颿µåç°éæµ", "type", "line", "smooth", true, "data", netForecast) |
| | | )); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildReceivablePayableBar(BigDecimal receivable, BigDecimal payable) { |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "åºæ¶åºä»ä½é¢å¯¹æ¯", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", List.of("åºæ¶", "åºä»"))); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "ä½é¢", "type", "bar", "data", List.of(receivable, payable)))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildFundGapGauge(BigDecimal fundGap) { |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "èµé缺å£", "left", "center")); |
| | | option.put("series", List.of(Map.of( |
| | | "type", "gauge", |
| | | "min", 0, |
| | | "max", 10000000, |
| | | "detail", Map.of("formatter", "{value}"), |
| | | "data", List.of(Map.of("value", fundGap, "name", "èµé缺å£")) |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildAnomalyLevelPie(List<Map<String, Object>> anomalies) { |
| | | long high = anomalies.stream().filter(item -> "high".equals(item.get("riskLevel"))).count(); |
| | | long medium = anomalies.stream().filter(item -> "medium".equals(item.get("riskLevel"))).count(); |
| | | long low = anomalies.stream().filter(item -> "low".equals(item.get("riskLevel"))).count(); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "å¼å¸¸ç级åå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "item")); |
| | | option.put("series", List.of(Map.of("type", "pie", "radius", "60%", "data", List.of( |
| | | Map.of("name", "é«é£é©", "value", high), |
| | | Map.of("name", "ä¸é£é©", "value", medium), |
| | | Map.of("name", "ä½é£é©", "value", low) |
| | | )))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildAnomalyTypeBar(List<Map<String, Object>> anomalies) { |
| | | Map<String, Long> countByType = new LinkedHashMap<>(); |
| | | for (Map<String, Object> anomaly : anomalies) { |
| | | countByType.merge(String.valueOf(anomaly.get("type")), 1L, Long::sum); |
| | | } |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "å¼å¸¸ç±»ååå¸", "left", "center")); |
| | | option.put("tooltip", Map.of("trigger", "axis")); |
| | | option.put("xAxis", Map.of("type", "category", "data", new ArrayList<>(countByType.keySet()))); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "å¼å¸¸æ°", "type", "bar", "data", new ArrayList<>(countByType.values())))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildInventoryProfitGauge(BigDecimal inventoryValue, BigDecimal profit) { |
| | | BigDecimal ratio = inventoryValue.compareTo(BigDecimal.ZERO) <= 0 |
| | | ? BigDecimal.ZERO |
| | | : profit.divide(inventoryValue, 4, RoundingMode.HALF_UP).multiply(ONE_HUNDRED); |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "婿¶¦/åºåèµéæ¯", "left", "center")); |
| | | option.put("series", List.of(Map.of( |
| | | "type", "gauge", |
| | | "min", -100, |
| | | "max", 100, |
| | | "detail", Map.of("formatter", "{value}%"), |
| | | "data", List.of(Map.of("value", ratio.setScale(2, RoundingMode.HALF_UP), "name", "婿¶¦èµéæ¯")) |
| | | ))); |
| | | return option; |
| | | } |
| | | |
| | | private int normalizeLimit(Integer limit) { |
| | | if (limit == null || limit <= 0) { |
| | | return DEFAULT_LIMIT; |
| | | } |
| | | return Math.min(limit, MAX_LIMIT); |
| | | } |
| | | |
| | | private DateRange resolveDateRange(String startDate, String endDate, String timeRange, String defaultLabel) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate explicitStart = parseLocalDate(startDate); |
| | | LocalDate explicitEnd = parseLocalDate(endDate); |
| | | if (explicitStart != null || explicitEnd != null) { |
| | | LocalDate start = explicitStart != null ? explicitStart : explicitEnd; |
| | | LocalDate end = explicitEnd != null ? explicitEnd : explicitStart; |
| | | if (start.isAfter(end)) { |
| | | LocalDate temp = start; |
| | | start = end; |
| | | end = temp; |
| | | } |
| | | return new DateRange(start, end, start + "è³" + end); |
| | | } |
| | | |
| | | if (!StringUtils.hasText(timeRange)) { |
| | | return new DateRange(null, null, "å
¨é¨"); |
| | | } |
| | | |
| | | String text = timeRange.trim(); |
| | | if (text.contains("ä»å¤©")) { |
| | | return new DateRange(today, today, "ä»å¤©"); |
| | | } |
| | | if (text.contains("æ¨å¤©") || text.contains("æ¨æ¥")) { |
| | | LocalDate day = today.minusDays(1); |
| | | return new DateRange(day, day, "æ¨å¤©"); |
| | | } |
| | | if (text.contains("æ¬å¨")) { |
| | | LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | return new DateRange(start, today, "æ¬å¨"); |
| | | } |
| | | if (text.contains("ä¸å¨")) { |
| | | LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | LocalDate start = thisWeekStart.minusWeeks(1); |
| | | LocalDate end = thisWeekStart.minusDays(1); |
| | | return new DateRange(start, end, "ä¸å¨"); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | return new DateRange(today.withDayOfMonth(1), today, "æ¬æ"); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | YearMonth lastMonth = YearMonth.from(today).minusMonths(1); |
| | | return new DateRange(lastMonth.atDay(1), lastMonth.atEndOfMonth(), "䏿"); |
| | | } |
| | | if (text.contains("ä»å¹´") || text.contains("æ¬å¹´")) { |
| | | return new DateRange(today.withDayOfYear(1), today, "ä»å¹´"); |
| | | } |
| | | Matcher relativeMatcher = RELATIVE_PATTERN.matcher(text); |
| | | if (relativeMatcher.find()) { |
| | | int amount = Integer.parseInt(relativeMatcher.group(2)); |
| | | String unit = relativeMatcher.group(3); |
| | | LocalDate start = switch (unit) { |
| | | case "天" -> today.minusDays(Math.max(amount - 1L, 0)); |
| | | case "å¨" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1); |
| | | case "个æ", "æ" -> today.minusMonths(Math.max(amount, 1)).plusDays(1); |
| | | case "å¹´" -> today.minusYears(Math.max(amount, 1)).plusDays(1); |
| | | default -> today.minusDays(29); |
| | | }; |
| | | return new DateRange(start, today, "è¿" + amount + unit); |
| | | } |
| | | Matcher dateMatcher = DATE_PATTERN.matcher(text); |
| | | if (dateMatcher.find()) { |
| | | LocalDate start = parseLocalDate(dateMatcher.group(1)); |
| | | LocalDate end = dateMatcher.find() ? parseLocalDate(dateMatcher.group(1)) : start; |
| | | if (start != null && end != null) { |
| | | if (start.isAfter(end)) { |
| | | LocalDate temp = start; |
| | | start = end; |
| | | end = temp; |
| | | } |
| | | return new DateRange(start, end, start + "è³" + end); |
| | | } |
| | | } |
| | | return new DateRange(null, null, "å
¨é¨"); |
| | | } |
| | | |
| | | private LocalDate parseLocalDate(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | try { |
| | | return LocalDate.parse(text.trim(), DATE_FMT); |
| | | } catch (Exception ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private Date toDate(LocalDate localDate) { |
| | | return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private Date toExclusiveEndDate(LocalDate localDate) { |
| | | return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private LocalDate toLocalDate(Date date) { |
| | | if (date == null) { |
| | | return null; |
| | | } |
| | | return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | } |
| | | |
| | | private String formatDate(LocalDate date) { |
| | | return date == null ? "" : date.format(DATE_FMT); |
| | | } |
| | | |
| | | private String displayDate(LocalDate date) { |
| | | return date == null ? "" : date.format(DATE_FMT); |
| | | } |
| | | |
| | | private long daysBetween(LocalDate start, LocalDate end) { |
| | | if (start == null || end == null || start.isAfter(end)) { |
| | | return 0; |
| | | } |
| | | return end.toEpochDay() - start.toEpochDay(); |
| | | } |
| | | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private BigDecimal maxZero(BigDecimal value) { |
| | | return value == null || value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private BigDecimal rate(BigDecimal numerator, BigDecimal denominator) { |
| | | if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return defaultDecimal(numerator).divide(denominator, 6, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private String toPercent(BigDecimal decimal) { |
| | | if (decimal == null) { |
| | | return "0.00%"; |
| | | } |
| | | BigDecimal rate = decimal.multiply(ONE_HUNDRED).setScale(2, RoundingMode.HALF_UP); |
| | | return rate.toPlainString() + "%"; |
| | | } |
| | | |
| | | private BigDecimal avgRate(List<OrderProfitMetric> metrics) { |
| | | if (metrics == null || metrics.isEmpty()) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | BigDecimal sum = metrics.stream().map(OrderProfitMetric::profitRate).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | return sum.divide(new BigDecimal(metrics.size()), 6, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private BigDecimal estimateLaborCost(ProductionAccount account, Map<String, BigDecimal> salaryQuotaByOperation) { |
| | | BigDecimal salaryQuota = salaryQuotaByOperation.getOrDefault(safe(account.getTechnologyOperationName()), BigDecimal.ZERO); |
| | | BigDecimal finishedNum = defaultDecimal(account.getFinishedNum()); |
| | | BigDecimal workHours = defaultDecimal(account.getWorkHours()); |
| | | if (salaryQuota.compareTo(BigDecimal.ZERO) > 0 && finishedNum.compareTo(BigDecimal.ZERO) > 0) { |
| | | return finishedNum.multiply(salaryQuota); |
| | | } |
| | | if (salaryQuota.compareTo(BigDecimal.ZERO) > 0 && workHours.compareTo(BigDecimal.ZERO) > 0) { |
| | | return workHours.multiply(salaryQuota); |
| | | } |
| | | if (workHours.compareTo(BigDecimal.ZERO) > 0) { |
| | | return workHours; |
| | | } |
| | | return finishedNum; |
| | | } |
| | | |
| | | private List<Long> parseIdList(String raw) { |
| | | if (!StringUtils.hasText(raw)) { |
| | | return List.of(); |
| | | } |
| | | String text = raw.replace("[", "").replace("]", "").replace(" ", ""); |
| | | if (!StringUtils.hasText(text)) { |
| | | return List.of(); |
| | | } |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String part : text.split(",")) { |
| | | if (!StringUtils.hasText(part)) { |
| | | continue; |
| | | } |
| | | try { |
| | | result.add(Long.parseLong(part.trim())); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private int keywordHitCount(List<String> keywords, String question) { |
| | | if (!StringUtils.hasText(question) || keywords == null) { |
| | | return 0; |
| | | } |
| | | int count = 0; |
| | | for (String keyword : keywords) { |
| | | if (question.contains(keyword)) { |
| | | count++; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | private String normalizeForMatch(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return ""; |
| | | } |
| | | return text.replace("ï¼", "") |
| | | .replace(",", "") |
| | | .replace("ã", "") |
| | | .replace(".", "") |
| | | .replace("ï¼", "") |
| | | .replace("!", "") |
| | | .replace("ï¼", "") |
| | | .replace("?", "") |
| | | .replace("ï¼", "") |
| | | .replace(":", "") |
| | | .replace("ï¼", "") |
| | | .replace(";", "") |
| | | .replace(" ", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private String safe(Object value) { |
| | | return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' ').trim(); |
| | | } |
| | | |
| | | private LoginUser currentLoginUser(String memoryId) { |
| | | LoginUser loginUser = aiSessionUserContext.get(memoryId); |
| | | if (loginUser != null) { |
| | | return loginUser; |
| | | } |
| | | return SecurityUtils.getLoginUser(); |
| | | } |
| | | |
| | | private Map<String, Object> rangeSummary(DateRange range, int count, String keyword) { |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", displayDate(range.start())); |
| | | summary.put("endDate", displayDate(range.end())); |
| | | summary.put("count", count); |
| | | summary.put("keyword", safe(keyword)); |
| | | return summary; |
| | | } |
| | | |
| | | private Long toLongOrNull(String value) { |
| | | if (!StringUtils.hasText(value)) { |
| | | return null; |
| | | } |
| | | try { |
| | | return Long.valueOf(value.trim()); |
| | | } catch (Exception ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private <T> List<T> defaultList(List<T> list) { |
| | | return list == null ? List.of() : list; |
| | | } |
| | | |
| | | private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, SFunction<T, Long> field) { |
| | | if (tenantId != null) { |
| | | wrapper.eq(field, tenantId); |
| | | } |
| | | } |
| | | |
| | | private <T> void applyDeptFilter(LambdaQueryWrapper<T> wrapper, Long deptId, SFunction<T, Long> field) { |
| | | if (deptId != null) { |
| | | wrapper.eq(field, deptId); |
| | | } |
| | | } |
| | | |
| | | private List<KnowledgeDoc> financeKnowledgeBase() { |
| | | return List.of( |
| | | new KnowledgeDoc( |
| | | "婿¶¦ä¸éåææ¡æ¶", |
| | | List.of("婿¶¦ä¸é", "äºæè®¢å", "æ¯å©ç", "åå©ç"), |
| | | "å
çæ¶å
¥ç«¯ï¼è®¢åç»æãåä»·ã交ä»å»¶è¿ï¼ï¼åçææ¬ç«¯ï¼ææãäººå·¥ãææ§ãæèï¼ï¼æåçç°é端ï¼å款ãè´¦æãåè´¦é£é©ï¼ã", |
| | | List.of("sales_ledger", "sales_ledger_product", "production_account", "device_ledger", "account_statement"), |
| | | List.of("为ä»ä¹æ¬æå©æ¶¦ä¸éï¼", "åªäºè®¢åäºææä¸¥éï¼", "ææ¬ä¸åæ¥èªåªä¸ªå·¥åºï¼") |
| | | ), |
| | | new KnowledgeDoc( |
| | | "åºåèµéå ç¨è¯æ", |
| | | List.of("åºå积å", "åæ»åºå", "å¨è½¬ç", "èµéå ç¨"), |
| | | "åºåèµéè¯æéç¹çï¼åºåä»·å¼ãè¿30天åºåºææ¬ã忻天æ°ãè¶
卿¯ä¾ï¼å½¢æå»åºåä¸éè´èå¥èå¨çç¥ã", |
| | | List.of("stock_inventory", "procurement_record_storage", "procurement_record_out"), |
| | | List.of("åªäºç©æèµéå ç¨æé«ï¼", "åªäºåºåè¶
è¿90天æªå¨è½¬ï¼", "åºåå¨è½¬å¤©æ°æ¯å¦å¼å¸¸ï¼") |
| | | ), |
| | | new KnowledgeDoc( |
| | | "ç°éæµä¸è´¦æ¬¾é£é©", |
| | | List.of("ç°éæµ", "åºæ¶", "åºä»", "忬¾", "èµé缺å£"), |
| | | "ç°éæµå¤æè¦ç»åæ¶æ¬¾ã仿¬¾ãåºæ¶åºä»ä½é¢ä¸é¢æµåæµéï¼éç¹å
³æ³¨é«ä½é¢å®¢æ·åé«éä¸ä»æ¬¾ä¾åºåã", |
| | | List.of("account_sales_collection", "account_purchase_payment", "account_statement"), |
| | | List.of("æªæ¥ä¸ä¸ªææ¯å¦æèµé缺å£ï¼", "åªä¸ªå®¢æ·å款é£é©æé«ï¼", "仿¬¾ååæå¤§çæ¯åªäºä¾åºåï¼") |
| | | ), |
| | | new KnowledgeDoc( |
| | | "ä¸è´¢ä¸ä½åå£å¾", |
| | | List.of("ä¸è´¢èå", "ä¸è´¢èå¨", "å£å¾", "驾驶è±"), |
| | | "订å婿¶¦å£å¾=é宿¶å
¥-ææææ¬-äººå·¥ææ¬-è®¾å¤ææ§-æèææ¬ï¼ç»è¥é©¾é©¶è±èå¨è®¢åãç产ãåºåã设å¤ãè´¦æ¬¾æ°æ®ã", |
| | | List.of("sales_ledger", "production_operation_task", "production_product_main", "device_ledger", "stock_inventory", "account_statement"), |
| | | List.of("订å婿¶¦çå¦ä½è®¡ç®ï¼", "ç»è¥é©¾é©¶è±æ ¸å¿ææ æåªäºï¼") |
| | | ) |
| | | ); |
| | | } |
| | | |
| | | private String jsonResponse(boolean success, |
| | | String type, |
| | | String description, |
| | | Map<String, Object> summary, |
| | | Map<String, Object> data, |
| | | Map<String, Object> charts) { |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("success", success); |
| | | result.put("type", type); |
| | | result.put("description", description); |
| | | result.put("summary", summary == null ? Map.of() : summary); |
| | | result.put("data", data == null ? Map.of() : data); |
| | | result.put("charts", charts == null ? Map.of() : charts); |
| | | return JSON.toJSONString(result); |
| | | } |
| | | |
| | | private record DateRange(LocalDate start, LocalDate end, String label) { |
| | | private boolean hasDateFilter() { |
| | | return start != null && end != null; |
| | | } |
| | | } |
| | | |
| | | private record OrderProfitMetric(Long ledgerId, |
| | | String salesContractNo, |
| | | String customerName, |
| | | String projectName, |
| | | LocalDate entryDate, |
| | | LocalDate deliveryDate, |
| | | BigDecimal revenue, |
| | | BigDecimal materialCost, |
| | | BigDecimal laborCost, |
| | | BigDecimal depreciationCost, |
| | | BigDecimal scrapCost, |
| | | BigDecimal totalCost, |
| | | BigDecimal profit, |
| | | BigDecimal profitRate, |
| | | String riskLevel, |
| | | List<String> reasons, |
| | | String suggestion) { |
| | | } |
| | | |
| | | private record AnalysisBundle(List<OrderProfitMetric> orderMetrics, |
| | | Map<String, BigDecimal> processCostRanking, |
| | | BigDecimal totalRevenue, |
| | | BigDecimal totalMaterialCost, |
| | | BigDecimal totalLaborCost, |
| | | BigDecimal totalDepreciationCost, |
| | | BigDecimal totalScrapCost, |
| | | BigDecimal totalCost, |
| | | BigDecimal totalProfit) { |
| | | private static AnalysisBundle empty() { |
| | | return new AnalysisBundle(List.of(), Map.of(), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, |
| | | BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO); |
| | | } |
| | | } |
| | | |
| | | private record MaterialCostResult(Map<Long, BigDecimal> materialCostByLedgerId, |
| | | Map<Long, BigDecimal> avgUnitCostByModelId) { |
| | | } |
| | | |
| | | private record ProductionCostContext(Map<Long, BigDecimal> laborCostByLedgerId, |
| | | Map<Long, BigDecimal> scrapCostByLedgerId, |
| | | Map<String, BigDecimal> processCostRanking) { |
| | | private static ProductionCostContext empty() { |
| | | return new ProductionCostContext(Map.of(), Map.of(), Map.of()); |
| | | } |
| | | } |
| | | |
| | | private record InventoryMetric(Long modelId, |
| | | String productName, |
| | | String modelName, |
| | | BigDecimal quantity, |
| | | BigDecimal lockedQuantity, |
| | | BigDecimal avgUnitCost, |
| | | BigDecimal inventoryValue, |
| | | BigDecimal outboundQuantity, |
| | | long stagnantDays, |
| | | boolean overstock) { |
| | | } |
| | | |
| | | private static class InventoryMetricBuilder { |
| | | private final Long modelId; |
| | | private BigDecimal quantity = BigDecimal.ZERO; |
| | | private BigDecimal lockedQuantity = BigDecimal.ZERO; |
| | | private BigDecimal warnNum = BigDecimal.ZERO; |
| | | private LocalDateTime firstInTime; |
| | | |
| | | private InventoryMetricBuilder(Long modelId) { |
| | | this.modelId = modelId; |
| | | } |
| | | |
| | | private void addQuantity(BigDecimal quantity) { |
| | | this.quantity = this.quantity.add(quantity); |
| | | } |
| | | |
| | | private void addLockedQuantity(BigDecimal lockedQuantity) { |
| | | this.lockedQuantity = this.lockedQuantity.add(lockedQuantity); |
| | | } |
| | | |
| | | private void addWarnNum(BigDecimal warnNum) { |
| | | this.warnNum = this.warnNum.max(warnNum); |
| | | } |
| | | |
| | | private void updateFirstInTime(LocalDateTime createTime) { |
| | | if (this.firstInTime == null || createTime.isBefore(this.firstInTime)) { |
| | | this.firstInTime = createTime; |
| | | } |
| | | } |
| | | |
| | | private Long modelId() { |
| | | return modelId; |
| | | } |
| | | |
| | | private BigDecimal quantity() { |
| | | return quantity; |
| | | } |
| | | |
| | | private BigDecimal lockedQuantity() { |
| | | return lockedQuantity; |
| | | } |
| | | |
| | | private BigDecimal warnNum() { |
| | | return warnNum; |
| | | } |
| | | |
| | | private LocalDateTime firstInTime() { |
| | | return firstInTime; |
| | | } |
| | | } |
| | | |
| | | private record OutboundStats(Map<Long, BigDecimal> outboundQtyByModel, |
| | | Map<Long, LocalDateTime> lastOutboundTimeByModel, |
| | | BigDecimal totalOutboundCost) { |
| | | private static OutboundStats empty() { |
| | | return new OutboundStats(Map.of(), Map.of(), BigDecimal.ZERO); |
| | | } |
| | | } |
| | | |
| | | private record MonthlyCashFlow(String month, BigDecimal income, BigDecimal expense, BigDecimal netFlow) { |
| | | } |
| | | |
| | | private record StatementMetric(String entityId, |
| | | BigDecimal closingBalance, |
| | | BigDecimal planAmount, |
| | | BigDecimal actualAmount, |
| | | String statementMonth) { |
| | | } |
| | | |
| | | private record StatementSnapshot(BigDecimal receivableTotal, |
| | | BigDecimal payableTotal, |
| | | List<StatementMetric> receivableTop, |
| | | List<StatementMetric> payableTop) { |
| | | private static StatementSnapshot empty() { |
| | | return new StatementSnapshot(BigDecimal.ZERO, BigDecimal.ZERO, List.of(), List.of()); |
| | | } |
| | | } |
| | | |
| | | private record KnowledgeDoc(String topic, |
| | | List<String> keywords, |
| | | String knowledge, |
| | | List<String> relatedTables, |
| | | List<String> suggestedQuestions) { |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchaseInvoiceMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.pojo.purchase.AccountPaymentApplication; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.purchase.mapper.InvoicePurchaseMapper; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.procurementrecord.mapper.InboundManagementMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.InboundManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import dev.langchain4j.agent.tool.P; |
| | | import dev.langchain4j.agent.tool.Tool; |
| | | import dev.langchain4j.agent.tool.ToolMemoryId; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Comparator; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | |
| | | private static final int MAX_LIMIT = 30; |
| | | |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final PaymentRegistrationMapper paymentRegistrationMapper; |
| | | private final InvoicePurchaseMapper invoicePurchaseMapper; |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final InboundManagementMapper inboundManagementMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final AccountPaymentApplicationMapper accountPaymentApplicationMapper; |
| | | private final AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper; |
| | | private final StockInRecordMapper stockInRecordMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public PurchaseAgentTools(PurchaseLedgerMapper purchaseLedgerMapper, |
| | | PaymentRegistrationMapper paymentRegistrationMapper, |
| | | InvoicePurchaseMapper invoicePurchaseMapper, |
| | | PurchaseReturnOrdersMapper purchaseReturnOrdersMapper, |
| | | SalesLedgerProductMapper salesLedgerProductMapper, |
| | | ProcurementRecordMapper procurementRecordMapper, |
| | | InboundManagementMapper inboundManagementMapper, |
| | | AccountPurchasePaymentMapper accountPurchasePaymentMapper, |
| | | AccountPaymentApplicationMapper accountPaymentApplicationMapper, |
| | | AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper, |
| | | StockInRecordMapper stockInRecordMapper, |
| | | QualityInspectMapper qualityInspectMapper, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.purchaseLedgerMapper = purchaseLedgerMapper; |
| | | this.paymentRegistrationMapper = paymentRegistrationMapper; |
| | | this.invoicePurchaseMapper = invoicePurchaseMapper; |
| | | this.purchaseReturnOrdersMapper = purchaseReturnOrdersMapper; |
| | | this.salesLedgerProductMapper = salesLedgerProductMapper; |
| | | this.procurementRecordMapper = procurementRecordMapper; |
| | | this.inboundManagementMapper = inboundManagementMapper; |
| | | this.accountPurchasePaymentMapper = accountPurchasePaymentMapper; |
| | | this.accountPaymentApplicationMapper = accountPaymentApplicationMapper; |
| | | this.accountPurchaseInvoiceMapper = accountPurchaseInvoiceMapper; |
| | | this.stockInRecordMapper = stockInRecordMapper; |
| | | this.qualityInspectMapper = qualityInspectMapper; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange); |
| | | |
| | | List<PurchaseLedger> ledgers = queryLedgers(loginUser, range); |
| | | List<PaymentRegistration> payments = queryPayments(loginUser, range); |
| | | List<InvoicePurchase> invoices = queryInvoices(loginUser, range); |
| | | List<AccountPurchasePayment> payments = queryPayments(loginUser, range); |
| | | List<AccountPurchaseInvoice> invoices = queryInvoices(loginUser, range); |
| | | List<PurchaseReturnOrders> returns = queryReturns(loginUser, range); |
| | | |
| | | BigDecimal contractAmount = ledgers.stream() |
| | |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal paymentAmount = payments.stream() |
| | | .map(PaymentRegistration::getCurrentPaymentAmount) |
| | | .map(AccountPurchasePayment::getPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal invoiceAmount = invoices.stream() |
| | | .map(InvoicePurchase::getInvoiceAmount) |
| | | .map(this::invoiceAmountOf) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal returnAmount = returns.stream() |
| | |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | List<Map<String, Object>> items = queryLedgers(loginUser, range).stream() |
| | | List<PurchaseLedger> matchedLedgers = queryLedgers(loginUser, range).stream() |
| | | .filter(ledger -> matchLedgerKeyword(ledger, keyword)) |
| | | .map(ledger -> toPendingPaymentItem(loginUser, ledger)) |
| | | .collect(Collectors.toList()); |
| | | Map<Long, BigDecimal> paidAmountByLedgerId = sumPaymentAmountByLedgerId(loginUser, matchedLedgers.stream() |
| | | .map(PurchaseLedger::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList())); |
| | | List<Map<String, Object>> items = matchedLedgers.stream() |
| | | .map(ledger -> toPendingPaymentItem(ledger, paidAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO))) |
| | | .filter(Objects::nonNull) |
| | | .sorted(Comparator.comparing(item -> (BigDecimal) item.get("pendingAmount"), Comparator.reverseOrder())) |
| | | .limit(normalizeLimit(limit)) |
| | |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> toPendingPaymentItem(LoginUser loginUser, PurchaseLedger ledger) { |
| | | private Map<String, Object> toPendingPaymentItem(PurchaseLedger ledger, BigDecimal paidAmount) { |
| | | BigDecimal contractAmount = defaultDecimal(ledger.getContractAmount()); |
| | | BigDecimal paidAmount = sumPaymentAmount(loginUser, ledger.getId()); |
| | | BigDecimal pendingAmount = contractAmount.subtract(paidAmount); |
| | | BigDecimal safePaidAmount = defaultDecimal(paidAmount); |
| | | BigDecimal pendingAmount = contractAmount.subtract(safePaidAmount); |
| | | if (pendingAmount.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return null; |
| | | } |
| | | Map<String, Object> item = toLedgerItem(ledger); |
| | | item.put("paidAmount", paidAmount); |
| | | item.put("paidAmount", safePaidAmount); |
| | | item.put("pendingAmount", pendingAmount); |
| | | return item; |
| | | } |
| | | |
| | | private BigDecimal sumPaymentAmount(LoginUser loginUser, Long purchaseLedgerId) { |
| | | LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId); |
| | | wrapper.eq(PaymentRegistration::getPurchaseLedgerId, purchaseLedgerId); |
| | | return defaultList(paymentRegistrationMapper.selectList(wrapper)).stream() |
| | | .map(PaymentRegistration::getCurrentPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | private Map<Long, BigDecimal> sumPaymentAmountByLedgerId(LoginUser loginUser, List<Long> purchaseLedgerIds) { |
| | | if (purchaseLedgerIds == null || purchaseLedgerIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | List<AccountPurchasePayment> payments = queryPayments(loginUser); |
| | | if (payments.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | |
| | | Map<Integer, AccountPaymentApplication> applicationById = queryPaymentApplications(payments); |
| | | if (applicationById.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | |
| | | Map<Long, StockInRecord> stockInRecordById = queryStockInRecords(applicationById.values()); |
| | | Map<Long, Long> purchaseLedgerIdByQualityInspectId = queryPurchaseLedgerIdByQualityInspectId(stockInRecordById.values()); |
| | | Set<Long> targetLedgerIdSet = new HashSet<>(purchaseLedgerIds); |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | |
| | | for (AccountPurchasePayment payment : payments) { |
| | | if (payment.getAccountPaymentApplicationId() == null) { |
| | | continue; |
| | | } |
| | | AccountPaymentApplication application = applicationById.get(payment.getAccountPaymentApplicationId()); |
| | | if (application == null) { |
| | | continue; |
| | | } |
| | | Set<Long> ledgerIds = resolvePurchaseLedgerIds(application, stockInRecordById, purchaseLedgerIdByQualityInspectId); |
| | | if (ledgerIds.isEmpty()) { |
| | | continue; |
| | | } |
| | | BigDecimal amount = defaultDecimal(payment.getPaymentAmount()); |
| | | for (Long ledgerId : ledgerIds) { |
| | | if (targetLedgerIdSet.contains(ledgerId)) { |
| | | result.merge(ledgerId, amount, BigDecimal::add); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private Map<String, Object> toReturnItem(PurchaseReturnOrders item) { |
| | |
| | | if (value instanceof Number number) { |
| | | return new BigDecimal(String.valueOf(number)); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | try { |
| | | return new BigDecimal(String.valueOf(value)); |
| | | } catch (Exception ignored) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | private List<PaymentRegistration> queryPayments(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId); |
| | | wrapper.ge(PaymentRegistration::getPaymentDate, toDate(range.start())) |
| | | .lt(PaymentRegistration::getPaymentDate, toExclusiveEndDate(range.end())); |
| | | return defaultList(paymentRegistrationMapper.selectList(wrapper)); |
| | | private BigDecimal invoiceAmountOf(AccountPurchaseInvoice invoice) { |
| | | if (invoice == null) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | BigDecimal amount = defaultDecimal(invoice.getTaxInclusivePrice()); |
| | | if (amount.compareTo(BigDecimal.ZERO) > 0) { |
| | | return amount; |
| | | } |
| | | return defaultDecimal(invoice.getTaxExclusivelPrice()).add(defaultDecimal(invoice.getTaxPrice())); |
| | | } |
| | | |
| | | private List<InvoicePurchase> queryInvoices(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<InvoicePurchase> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), InvoicePurchase::getTenantId); |
| | | wrapper.ge(InvoicePurchase::getIssueDate, range.start()) |
| | | .le(InvoicePurchase::getIssueDate, range.end()); |
| | | return defaultList(invoicePurchaseMapper.selectList(wrapper)); |
| | | private List<AccountPurchasePayment> queryPayments(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId); |
| | | wrapper.ge(AccountPurchasePayment::getPaymentDate, range.start()) |
| | | .le(AccountPurchasePayment::getPaymentDate, range.end()) |
| | | .orderByDesc(AccountPurchasePayment::getPaymentDate, AccountPurchasePayment::getId); |
| | | return defaultList(accountPurchasePaymentMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<AccountPurchasePayment> queryPayments(LoginUser loginUser) { |
| | | LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId); |
| | | return defaultList(accountPurchasePaymentMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<AccountPurchaseInvoice> queryInvoices(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<AccountPurchaseInvoice> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchaseInvoice::getDeptId); |
| | | wrapper.ge(AccountPurchaseInvoice::getIssueDate, range.start()) |
| | | .le(AccountPurchaseInvoice::getIssueDate, range.end()) |
| | | .orderByDesc(AccountPurchaseInvoice::getIssueDate, AccountPurchaseInvoice::getId); |
| | | return defaultList(accountPurchaseInvoiceMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<Integer, AccountPaymentApplication> queryPaymentApplications(List<AccountPurchasePayment> payments) { |
| | | List<Integer> ids = payments.stream() |
| | | .map(AccountPurchasePayment::getAccountPaymentApplicationId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (ids.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | return defaultList(accountPaymentApplicationMapper.selectBatchIds(ids)).stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(AccountPaymentApplication::getId, item -> item, (a, b) -> a)); |
| | | } |
| | | |
| | | private Map<Long, StockInRecord> queryStockInRecords(Collection<AccountPaymentApplication> applications) { |
| | | Set<Long> stockInRecordIds = new HashSet<>(); |
| | | for (AccountPaymentApplication application : applications) { |
| | | stockInRecordIds.addAll(parseLongIds(application.getStockInRecordIds())); |
| | | } |
| | | if (stockInRecordIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | return defaultList(stockInRecordMapper.selectBatchIds(stockInRecordIds)).stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(StockInRecord::getId, item -> item, (a, b) -> a)); |
| | | } |
| | | |
| | | private Map<Long, Long> queryPurchaseLedgerIdByQualityInspectId(Collection<StockInRecord> stockInRecords) { |
| | | Set<Long> qualityInspectIds = stockInRecords.stream() |
| | | .filter(Objects::nonNull) |
| | | .filter(item -> item.getRecordId() != null && "10".equals(safe(item.getRecordType()).trim())) |
| | | .map(StockInRecord::getRecordId) |
| | | .collect(Collectors.toSet()); |
| | | if (qualityInspectIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | return defaultList(qualityInspectMapper.selectBatchIds(qualityInspectIds)).stream() |
| | | .filter(item -> item.getId() != null && item.getPurchaseLedgerId() != null) |
| | | .collect(Collectors.toMap(QualityInspect::getId, QualityInspect::getPurchaseLedgerId, (a, b) -> a)); |
| | | } |
| | | |
| | | private Set<Long> resolvePurchaseLedgerIds(AccountPaymentApplication application, |
| | | Map<Long, StockInRecord> stockInRecordById, |
| | | Map<Long, Long> purchaseLedgerIdByQualityInspectId) { |
| | | Set<Long> result = new LinkedHashSet<>(); |
| | | for (Long stockInRecordId : parseLongIds(application.getStockInRecordIds())) { |
| | | StockInRecord stockInRecord = stockInRecordById.get(stockInRecordId); |
| | | if (stockInRecord == null || stockInRecord.getRecordId() == null) { |
| | | continue; |
| | | } |
| | | if (stockInRecord.getApprovalStatus() != null && stockInRecord.getApprovalStatus() != 1) { |
| | | continue; |
| | | } |
| | | String recordType = safe(stockInRecord.getRecordType()).trim(); |
| | | if ("7".equals(recordType)) { |
| | | result.add(stockInRecord.getRecordId()); |
| | | } else if ("10".equals(recordType)) { |
| | | Long purchaseLedgerId = purchaseLedgerIdByQualityInspectId.get(stockInRecord.getRecordId()); |
| | | if (purchaseLedgerId != null) { |
| | | result.add(purchaseLedgerId); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<Long> parseLongIds(String raw) { |
| | | if (!StringUtils.hasText(raw)) { |
| | | return List.of(); |
| | | } |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String part : raw.split(",")) { |
| | | if (!StringUtils.hasText(part)) { |
| | | continue; |
| | | } |
| | | try { |
| | | result.add(Long.parseLong(part.trim())); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private List<PurchaseReturnOrders> queryReturns(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PurchaseReturnOrders> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), PurchaseReturnOrders::getDeptId); |
| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import com.ruoyi.account.mapper.SalesReceiptReturnMapper; |
| | | import com.ruoyi.account.pojo.SalesReceiptReturn; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.ai.context.AiSessionUserContext; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerMapper; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import dev.langchain4j.agent.tool.P; |
| | | import dev.langchain4j.agent.tool.Tool; |
| | | import dev.langchain4j.agent.tool.ToolMemoryId; |
| | |
| | | import java.time.YearMonth; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ReceiptPaymentMapper receiptPaymentMapper; |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | private final SalesReceiptReturnMapper salesReceiptReturnMapper; |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public SalesAgentTools(CustomerMapper customerMapper, |
| | | SalesLedgerMapper salesLedgerMapper, |
| | | SalesQuotationMapper salesQuotationMapper, |
| | | ShippingInfoMapper shippingInfoMapper, |
| | | ReceiptPaymentMapper receiptPaymentMapper, |
| | | InvoiceLedgerMapper invoiceLedgerMapper, |
| | | SalesReceiptReturnMapper salesReceiptReturnMapper, |
| | | AccountSalesCollectionMapper accountSalesCollectionMapper, |
| | | StockOutRecordMapper stockOutRecordMapper, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.customerMapper = customerMapper; |
| | | this.salesLedgerMapper = salesLedgerMapper; |
| | | this.salesQuotationMapper = salesQuotationMapper; |
| | | this.shippingInfoMapper = shippingInfoMapper; |
| | | this.receiptPaymentMapper = receiptPaymentMapper; |
| | | this.invoiceLedgerMapper = invoiceLedgerMapper; |
| | | this.salesReceiptReturnMapper = salesReceiptReturnMapper; |
| | | this.accountSalesCollectionMapper = accountSalesCollectionMapper; |
| | | this.stockOutRecordMapper = stockOutRecordMapper; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<SalesReceiptReturn> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesReceiptReturn::getDeptId); |
| | | LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(SalesReceiptReturn::getRefundId, keyword) |
| | | .or().like(SalesReceiptReturn::getTransactionNo, keyword) |
| | | .or().like(SalesReceiptReturn::getPaymentAccountName, keyword)); |
| | | wrapper.and(w -> w.like(AccountSalesCollection::getCollectionNumber, keyword) |
| | | .or().like(AccountSalesCollection::getCollectionMethod, keyword) |
| | | .or().like(AccountSalesCollection::getRemark, keyword)); |
| | | } |
| | | wrapper.ge(SalesReceiptReturn::getCreateTime, range.start().atStartOfDay()) |
| | | .le(SalesReceiptReturn::getCreateTime, range.end().atTime(23, 59, 59)) |
| | | .orderByDesc(SalesReceiptReturn::getCreateTime, SalesReceiptReturn::getId) |
| | | wrapper.ge(AccountSalesCollection::getCollectionDate, range.start()) |
| | | .le(AccountSalesCollection::getCollectionDate, range.end()) |
| | | .orderByDesc(AccountSalesCollection::getCollectionDate, AccountSalesCollection::getId) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | List<SalesReceiptReturn> rows = defaultList(salesReceiptReturnMapper.selectList(wrapper)); |
| | | List<AccountSalesCollection> rows = defaultList(accountSalesCollectionMapper.selectList(wrapper)); |
| | | |
| | | BigDecimal returnAmount = rows.stream() |
| | | .map(SalesReceiptReturn::getActualAmount) |
| | | .map(AccountSalesCollection::getCollectionAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | List<Map<String, Object>> items = rows.stream().map(item -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("refundId", safe(item.getRefundId())); |
| | | map.put("paymentAccount", safe(item.getPaymentAccount())); |
| | | map.put("paymentAccountName", safe(item.getPaymentAccountName())); |
| | | map.put("paymentMethod", item.getPaymentMethod()); |
| | | map.put("actualAmount", item.getActualAmount()); |
| | | map.put("fee", item.getFee()); |
| | | map.put("discountAmount", item.getDiscountAmount()); |
| | | map.put("transactionNo", safe(item.getTransactionNo())); |
| | | map.put("createTime", formatDateTime(item.getCreateTime())); |
| | | map.put("refundId", safe(item.getCollectionNumber())); |
| | | map.put("collectionNumber", safe(item.getCollectionNumber())); |
| | | map.put("paymentMethod", safe(item.getCollectionMethod())); |
| | | map.put("actualAmount", item.getCollectionAmount()); |
| | | map.put("collectionAmount", item.getCollectionAmount()); |
| | | map.put("customerId", item.getCustomerId()); |
| | | map.put("remark", safe(item.getRemark())); |
| | | map.put("createTime", formatDate(item.getCollectionDate())); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<ReceiptPayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ReceiptPayment::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ReceiptPayment::getDeptId); |
| | | wrapper.ge(ReceiptPayment::getReceiptPaymentDate, range.start()) |
| | | .le(ReceiptPayment::getReceiptPaymentDate, range.end()) |
| | | .orderByDesc(ReceiptPayment::getReceiptPaymentDate, ReceiptPayment::getId); |
| | | List<ReceiptPayment> payments = defaultList(receiptPaymentMapper.selectList(wrapper)); |
| | | if (payments.isEmpty()) { |
| | | return jsonResponse(true, "sales_customer_interaction_list", "æªæ¥è¯¢å°å®¢æ·å¾æ¥è®°å½", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | List<AccountSalesCollection> collections = queryCollections(loginUser, range); |
| | | if (collections.isEmpty()) { |
| | | return jsonResponse(true, "sales_customer_interaction_list", "no_customer_interactions", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<Long> ledgerIds = payments.stream() |
| | | .map(ReceiptPayment::getSalesLedgerId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | Map<Integer, Set<Long>> ledgerIdsByCollectionId = mapCollectionLedgerIds(loginUser, collections); |
| | | Set<Long> ledgerIds = ledgerIdsByCollectionId.values().stream() |
| | | .flatMap(Collection::stream) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, SalesLedger> ledgerMap = defaultList(salesLedgerMapper.selectBatchIds(ledgerIds)).stream() |
| | | .filter(ledger -> tenantMatched(ledger.getTenantId(), loginUser.getTenantId())) |
| | | .collect(Collectors.toMap(SalesLedger::getId, item -> item, (a, b) -> a, LinkedHashMap::new)); |
| | | |
| | | List<ReceiptPayment> filtered = payments.stream() |
| | | .filter(item -> matchInteractionKeyword(item, ledgerMap.get(item.getSalesLedgerId()), keyword)) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | int finalLimit = normalizeLimit(limit); |
| | | List<Map<String, Object>> items = new ArrayList<>(); |
| | | for (AccountSalesCollection collection : collections) { |
| | | Set<Long> relatedLedgerIds = ledgerIdsByCollectionId.get(collection.getId()); |
| | | if (relatedLedgerIds == null || relatedLedgerIds.isEmpty()) { |
| | | if (!matchInteractionKeyword(collection, null, keyword)) { |
| | | continue; |
| | | } |
| | | items.add(toInteractionItem(collection, null)); |
| | | if (items.size() >= finalLimit) { |
| | | break; |
| | | } |
| | | continue; |
| | | } |
| | | for (Long ledgerId : relatedLedgerIds) { |
| | | SalesLedger ledger = ledgerMap.get(ledgerId); |
| | | if (ledger == null || !matchInteractionKeyword(collection, ledger, keyword)) { |
| | | continue; |
| | | } |
| | | items.add(toInteractionItem(collection, ledger)); |
| | | if (items.size() >= finalLimit) { |
| | | break; |
| | | } |
| | | } |
| | | if (items.size() >= finalLimit) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | BigDecimal totalReceiptAmount = filtered.stream() |
| | | .map(ReceiptPayment::getReceiptPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | BigDecimal totalReceiptAmount = items.stream() |
| | | .map(item -> asBigDecimal(item.get("receiptPaymentAmount"))) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | List<Map<String, Object>> items = filtered.stream().map(item -> { |
| | | SalesLedger ledger = ledgerMap.get(item.getSalesLedgerId()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("salesLedgerId", item.getSalesLedgerId()); |
| | | map.put("salesContractNo", ledger == null ? "" : safe(ledger.getSalesContractNo())); |
| | | map.put("customerName", ledger == null ? "" : safe(ledger.getCustomerName())); |
| | | map.put("projectName", ledger == null ? "" : safe(ledger.getProjectName())); |
| | | map.put("receiptPaymentDate", formatDate(item.getReceiptPaymentDate())); |
| | | map.put("receiptPaymentAmount", item.getReceiptPaymentAmount()); |
| | | map.put("receiptPaymentType", safe(item.getReceiptPaymentType())); |
| | | map.put("registrant", safe(item.getRegistrant())); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("totalReceiptAmount", totalReceiptAmount); |
| | | summary.put("customerCount", items.stream().map(item -> String.valueOf(item.get("customerName"))).filter(StringUtils::hasText).distinct().count()); |
| | | return jsonResponse(true, "sales_customer_interaction_list", "å·²è¿å客æ·å¾æ¥æç»", summary, Map.of("items", items), Map.of()); |
| | | summary.put("customerCount", items.stream() |
| | | .map(item -> String.valueOf(item.get("customerName"))) |
| | | .filter(StringUtils::hasText) |
| | | .distinct() |
| | | .count()); |
| | | return jsonResponse(true, "sales_customer_interaction_list", "ok", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢åè´§å°è´¦", value = "æå
³é®è¯åæ¶é´èå´æ¥è¯¢åè´§å°è´¦") |
| | |
| | | List<SalesLedger> ledgers = querySalesLedgers(loginUser, range); |
| | | List<SalesQuotation> quotations = querySalesQuotations(loginUser, range); |
| | | List<ShippingInfo> shippings = queryShippings(loginUser, range); |
| | | List<ReceiptPayment> receipts = queryReceipts(loginUser, range); |
| | | |
| | | |
| | | BigDecimal contractAmountTotal = ledgers.stream() |
| | | .map(SalesLedger::getContractAmount) |
| | |
| | | .map(SalesQuotation::getTotalAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal receivedAmountTotal = receipts.stream() |
| | | .map(ReceiptPayment::getReceiptPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal pendingAmountTotal = maxZero(contractAmountTotal.subtract(receivedAmountTotal)); |
| | | |
| | | long shippingCount = shippings.size(); |
| | | long shippedCount = shippings.stream().filter(item -> isShippedStatus(item.getStatus())).count(); |
| | |
| | | summary.put("shipRate", shipRate); |
| | | summary.put("contractAmountTotal", contractAmountTotal); |
| | | summary.put("quotationAmountTotal", quotationAmountTotal); |
| | | summary.put("receivedAmountTotal", receivedAmountTotal); |
| | | summary.put("pendingAmountTotal", pendingAmountTotal); |
| | | summary.put("receivedAmountTotal", BigDecimal.ZERO); |
| | | summary.put("pendingAmountTotal", BigDecimal.ZERO); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, receivedAmountTotal, pendingAmountTotal)); |
| | | // charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, receivedAmountTotal, pendingAmountTotal)); |
| | | charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, BigDecimal.ONE, BigDecimal.ONE)); |
| | | charts.put("shippingPieOption", buildShippingPieOption(shippedCount, Math.max(shippingCount - shippedCount, 0))); |
| | | charts.put("customerTopBarOption", buildCustomerTopBarOption(topCustomers)); |
| | | charts.put("contractTrendLineOption", buildContractTrendLineOption(trendData.labels(), trendData.values())); |
| | |
| | | return defaultList(shippingInfoMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<ReceiptPayment> queryReceipts(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<ReceiptPayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ReceiptPayment::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ReceiptPayment::getDeptId); |
| | | if (range != null) { |
| | | wrapper.ge(ReceiptPayment::getReceiptPaymentDate, range.start()) |
| | | .le(ReceiptPayment::getReceiptPaymentDate, range.end()); |
| | | } |
| | | return defaultList(receiptPaymentMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<ReceiptPayment> queryReceiptsByLedgerIds(LoginUser loginUser, List<Long> ledgerIds) { |
| | | if (ledgerIds == null || ledgerIds.isEmpty()) { |
| | | return List.of(); |
| | | } |
| | | LambdaQueryWrapper<ReceiptPayment> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ReceiptPayment::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ReceiptPayment::getDeptId); |
| | | wrapper.in(ReceiptPayment::getSalesLedgerId, ledgerIds); |
| | | return defaultList(receiptPaymentMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<ShippingInfo> queryShippingsByLedgerIds(LoginUser loginUser, List<Long> ledgerIds) { |
| | | if (ledgerIds == null || ledgerIds.isEmpty()) { |
| | | return List.of(); |
| | |
| | | return Map.of(); |
| | | } |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | for (InvoiceLedgerDto item : defaultList(invoiceLedgerMapper.invoicedTotal(ledgerIds))) { |
| | | if (item.getSalesLedgerId() == null) { |
| | | continue; |
| | | } |
| | | result.merge(item.getSalesLedgerId().longValue(), defaultDecimal(item.getInvoiceTotal()), BigDecimal::add); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private Map<Long, BigDecimal> sumReceiptAmounts(LoginUser loginUser, List<Long> ledgerIds) { |
| | | if (ledgerIds == null || ledgerIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | List<SalesLedger> ledgers = defaultList(salesLedgerMapper.selectBatchIds(ledgerIds)).stream() |
| | | .filter(ledger -> tenantMatched(ledger.getTenantId(), loginUser.getTenantId())) |
| | | .collect(Collectors.toList()); |
| | | if (ledgers.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | |
| | | Set<Integer> customerIds = ledgers.stream() |
| | | .map(SalesLedger::getCustomerId) |
| | | .filter(Objects::nonNull) |
| | | .map(Long::intValue) |
| | | .collect(Collectors.toSet()); |
| | | if (customerIds.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId); |
| | | wrapper.in(AccountSalesCollection::getCustomerId, customerIds); |
| | | List<AccountSalesCollection> collections = defaultList(accountSalesCollectionMapper.selectList(wrapper)); |
| | | if (collections.isEmpty()) { |
| | | return Map.of(); |
| | | } |
| | | |
| | | Map<Integer, Set<Long>> ledgerIdsByCollectionId = mapCollectionLedgerIds(loginUser, collections); |
| | | Map<Long, List<Long>> ledgerIdsByCustomerId = ledgers.stream() |
| | | .filter(item -> item.getId() != null && item.getCustomerId() != null) |
| | | .collect(Collectors.groupingBy(item -> item.getCustomerId().longValue(), |
| | | Collectors.mapping(SalesLedger::getId, Collectors.toList()))); |
| | | Set<Long> targetLedgerIdSet = new HashSet<>(ledgerIds); |
| | | |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | for (ReceiptPayment item : queryReceiptsByLedgerIds(loginUser, ledgerIds)) { |
| | | if (item.getSalesLedgerId() == null) { |
| | | for (AccountSalesCollection collection : collections) { |
| | | BigDecimal amount = defaultDecimal(collection.getCollectionAmount()); |
| | | if (amount.compareTo(BigDecimal.ZERO) == 0) { |
| | | continue; |
| | | } |
| | | result.merge(item.getSalesLedgerId(), defaultDecimal(item.getReceiptPaymentAmount()), BigDecimal::add); |
| | | Set<Long> relatedLedgerIds = ledgerIdsByCollectionId.getOrDefault(collection.getId(), Set.of()); |
| | | if (!relatedLedgerIds.isEmpty()) { |
| | | for (Long ledgerId : relatedLedgerIds) { |
| | | if (targetLedgerIdSet.contains(ledgerId)) { |
| | | result.merge(ledgerId, amount, BigDecimal::add); |
| | | } |
| | | } |
| | | continue; |
| | | } |
| | | if (collection.getCustomerId() == null) { |
| | | continue; |
| | | } |
| | | List<Long> customerLedgerIds = ledgerIdsByCustomerId.get(collection.getCustomerId().longValue()); |
| | | if (customerLedgerIds == null || customerLedgerIds.isEmpty()) { |
| | | continue; |
| | | } |
| | | for (Long ledgerId : customerLedgerIds) { |
| | | if (targetLedgerIdSet.contains(ledgerId)) { |
| | | result.merge(ledgerId, amount, BigDecimal::add); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<AccountSalesCollection> queryCollections(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId); |
| | | if (range != null) { |
| | | wrapper.ge(AccountSalesCollection::getCollectionDate, range.start()) |
| | | .le(AccountSalesCollection::getCollectionDate, range.end()); |
| | | } |
| | | wrapper.orderByDesc(AccountSalesCollection::getCollectionDate, AccountSalesCollection::getId); |
| | | return defaultList(accountSalesCollectionMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<Integer, Set<Long>> mapCollectionLedgerIds(LoginUser loginUser, List<AccountSalesCollection> collections) { |
| | | Map<Integer, Set<Long>> result = new HashMap<>(); |
| | | if (collections == null || collections.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | Map<Integer, List<Long>> stockOutRecordIdsByCollection = new HashMap<>(); |
| | | Set<Long> allStockOutRecordIds = new HashSet<>(); |
| | | for (AccountSalesCollection collection : collections) { |
| | | if (collection.getId() == null) { |
| | | continue; |
| | | } |
| | | List<Long> stockOutRecordIds = parseLongIds(collection.getStockOutRecordIds()); |
| | | if (stockOutRecordIds.isEmpty()) { |
| | | continue; |
| | | } |
| | | stockOutRecordIdsByCollection.put(collection.getId(), stockOutRecordIds); |
| | | allStockOutRecordIds.addAll(stockOutRecordIds); |
| | | } |
| | | if (allStockOutRecordIds.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | List<StockOutRecord> stockOutRecords = defaultList(stockOutRecordMapper.selectList(new LambdaQueryWrapper<StockOutRecord>() |
| | | .in(StockOutRecord::getId, allStockOutRecordIds))); |
| | | if (stockOutRecords.isEmpty()) { |
| | | return result; |
| | | } |
| | | Map<Long, StockOutRecord> stockOutRecordMap = stockOutRecords.stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(StockOutRecord::getId, item -> item, (a, b) -> a)); |
| | | |
| | | Set<Long> shippingIds = stockOutRecords.stream() |
| | | .filter(this::isSalesOutboundRecord) |
| | | .map(StockOutRecord::getRecordId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (shippingIds.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | LambdaQueryWrapper<ShippingInfo> shippingWrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(shippingWrapper, loginUser.getTenantId(), ShippingInfo::getTenantId); |
| | | applyDeptFilter(shippingWrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId); |
| | | shippingWrapper.in(ShippingInfo::getId, shippingIds); |
| | | Map<Long, Long> ledgerIdByShippingId = defaultList(shippingInfoMapper.selectList(shippingWrapper)).stream() |
| | | .filter(item -> item.getId() != null && item.getSalesLedgerId() != null) |
| | | .collect(Collectors.toMap(ShippingInfo::getId, ShippingInfo::getSalesLedgerId, (a, b) -> a)); |
| | | |
| | | for (Map.Entry<Integer, List<Long>> entry : stockOutRecordIdsByCollection.entrySet()) { |
| | | Set<Long> ledgerIds = new LinkedHashSet<>(); |
| | | for (Long stockOutRecordId : entry.getValue()) { |
| | | StockOutRecord stockOutRecord = stockOutRecordMap.get(stockOutRecordId); |
| | | if (!isSalesOutboundRecord(stockOutRecord)) { |
| | | continue; |
| | | } |
| | | Long ledgerId = ledgerIdByShippingId.get(stockOutRecord.getRecordId()); |
| | | if (ledgerId != null) { |
| | | ledgerIds.add(ledgerId); |
| | | } |
| | | } |
| | | if (!ledgerIds.isEmpty()) { |
| | | result.put(entry.getKey(), ledgerIds); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean isSalesOutboundRecord(StockOutRecord stockOutRecord) { |
| | | if (stockOutRecord == null || !StringUtils.hasText(stockOutRecord.getRecordType())) { |
| | | return false; |
| | | } |
| | | if (stockOutRecord.getApprovalStatus() != null && stockOutRecord.getApprovalStatus() != 1) { |
| | | return false; |
| | | } |
| | | return "13".equals(stockOutRecord.getRecordType().trim()); |
| | | } |
| | | |
| | | private List<Long> parseLongIds(String raw) { |
| | | if (!StringUtils.hasText(raw)) { |
| | | return List.of(); |
| | | } |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String part : raw.split(",")) { |
| | | if (!StringUtils.hasText(part)) { |
| | | continue; |
| | | } |
| | | try { |
| | | result.add(Long.parseLong(part.trim())); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean matchInteractionKeyword(AccountSalesCollection collection, SalesLedger ledger, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | if (safe(collection.getCollectionNumber()).contains(text) |
| | | || safe(collection.getCollectionMethod()).contains(text) |
| | | || safe(collection.getRemark()).contains(text)) { |
| | | return true; |
| | | } |
| | | if (ledger == null) { |
| | | return false; |
| | | } |
| | | return safe(ledger.getSalesContractNo()).contains(text) |
| | | || safe(ledger.getCustomerName()).contains(text) |
| | | || safe(ledger.getProjectName()).contains(text); |
| | | } |
| | | |
| | | private Map<String, Object> toInteractionItem(AccountSalesCollection collection, SalesLedger ledger) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", collection.getId()); |
| | | map.put("salesLedgerId", ledger == null ? null : ledger.getId()); |
| | | map.put("salesContractNo", ledger == null ? "" : safe(ledger.getSalesContractNo())); |
| | | map.put("customerName", ledger == null ? "" : safe(ledger.getCustomerName())); |
| | | map.put("projectName", ledger == null ? "" : safe(ledger.getProjectName())); |
| | | map.put("receiptPaymentDate", formatDate(collection.getCollectionDate())); |
| | | map.put("receiptPaymentAmount", collection.getCollectionAmount()); |
| | | map.put("receiptPaymentType", safe(collection.getCollectionMethod())); |
| | | map.put("collectionNumber", safe(collection.getCollectionNumber())); |
| | | map.put("registrant", collection.getCreateUser()); |
| | | map.put("remark", safe(collection.getRemark())); |
| | | return map; |
| | | } |
| | | |
| | | private boolean isLedgerFullyShipped(Long ledgerId, Map<Long, List<ShippingInfo>> shippingByLedgerId) { |
| | |
| | | || safe(customer.getContactPhone()).contains(text) |
| | | || safe(customer.getCompanyPhone()).contains(text) |
| | | || safe(customer.getUsageUserName()).contains(text); |
| | | } |
| | | |
| | | private boolean matchInteractionKeyword(ReceiptPayment payment, SalesLedger ledger, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | return safe(payment.getRegistrant()).contains(text) |
| | | || (ledger != null && (safe(ledger.getCustomerName()).contains(text) |
| | | || safe(ledger.getSalesContractNo()).contains(text) |
| | | || safe(ledger.getProjectName()).contains(text))); |
| | | } |
| | | |
| | | private boolean matchLedgerCustomerKeyword(SalesLedger ledger, String keyword) { |
| | |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private BigDecimal asBigDecimal(Object value) { |
| | | if (value == null) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | if (value instanceof BigDecimal decimal) { |
| | | return decimal; |
| | | } |
| | | if (value instanceof Number number) { |
| | | return new BigDecimal(String.valueOf(number)); |
| | | } |
| | | try { |
| | | return new BigDecimal(String.valueOf(value)); |
| | | } catch (Exception ignored) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | private BigDecimal maxZero(BigDecimal value) { |
| | | return value == null || value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalInstanceDto extends ApprovalInstance { |
| | | |
| | | private String approveAction; |
| | | |
| | | private String approveComment; |
| | | |
| | | private String createTimeEnd; |
| | | |
| | | private String createTimeStart; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateDto extends ApprovalTemplate { |
| | | |
| | | private List<ApprovalTemplateNodeDto> nodes; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateNodeApproverDto extends ApprovalTemplateNodeApprover { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateNodeDto extends ApprovalTemplateNode { |
| | | |
| | | private List<ApprovalTemplateNodeApproverDto> approvers; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.ruoyi.approve.pojo.FinReimbursement; |
| | | import com.ruoyi.approve.pojo.FinReimbursementDetail; |
| | | import com.ruoyi.approve.pojo.FinReimbursementTravel; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FinReimbursementDto extends FinReimbursement { |
| | | |
| | | private String createTimeStart; |
| | | private String createTimeEnd; |
| | | |
| | | private FinReimbursementTravel travel; |
| | | private List<FinReimbursementDetail> details; |
| | | private List<ApprovalTemplateNodeDto> nodes; |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import com.ruoyi.approve.pojo.ApprovalRecord; |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalInstanceVo extends ApprovalInstance { |
| | | //å½åç¨æ·æ¯å¦å¯ä»¥å®¡æ¹ |
| | | @Schema(description = "å½åç¨æ·æ¯å¦å¯ä»¥å®¡æ¹") |
| | | private Boolean isApprove; |
| | | |
| | | //å®¡æ¹æµç¨ |
| | | private List<ApprovalTask> tasks; |
| | | |
| | | //审æ¹è®°å½ |
| | | private List<ApprovalRecord> records; |
| | | |
| | | @Schema(description = "ä¸å¡åç§°") |
| | | private String businessName; |
| | | |
| | | private List<StorageBlobVO> storageBlobVOList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateNodeApproverVo extends ApprovalTemplateNodeApprover { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateNodeVo extends ApprovalTemplateNode { |
| | | |
| | | private List<ApprovalTemplateNodeApproverVo> approvers; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApprovalTemplateVo extends ApprovalTemplate { |
| | | |
| | | private List<ApprovalTemplateNodeVo> nodes; |
| | | |
| | | private String createdUserName; |
| | | } |
| | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®å¼å§æ¶é´") |
| | | private LocalDateTime startDateTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®ç»ææ¶é´") |
| | | private LocalDateTime endDateTime; |
| | | |
| | | private BigDecimal price; |
| | | |
| | | private String location; |
| | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®å¼å§æ¶é´") |
| | | private LocalDateTime startDateTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®ç»ææ¶é´") |
| | | private LocalDateTime endDateTime; |
| | | |
| | | private BigDecimal price; |
| | | |
| | | private String location; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FinReimbursementVo extends FinReimbursement { |
| | | |
| | | |
| | | private String createTimeStart; |
| | | private String createTimeEnd; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | private FinReimbursementTravel travel; |
| | | private List<FinReimbursementDetail> details; |
| | | //å®¡æ¹æµç¨ |
| | | private List<ApprovalTask> tasks; |
| | | |
| | | //审æ¹è®°å½ |
| | | private List<ApprovalRecord> records; |
| | | private List<StorageBlobVO> storageBlobVOList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalInstanceDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalInstanceVo; |
| | | import com.ruoyi.approve.service.ApprovalInstanceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹å®ä¾è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:46 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalInstance") |
| | | @Tag(name = "审æ¹å®ä¾è¡¨") |
| | | @AllArgsConstructor |
| | | public class ApprovalInstanceController extends BaseController { |
| | | |
| | | private final ApprovalInstanceService approvalInstanceService; |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | @Log(title = "审æ¹å表å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) { |
| | | return approvalInstanceService.listPage(page, approvalInstanceDto); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "ä¿å") |
| | | @Log(title = "审æ¹å表ä¿å", businessType = BusinessType.INSERT) |
| | | public R save(@RequestBody ApprovalInstanceDto approvalInstanceDto) { |
| | | return approvalInstanceService.add(approvalInstanceDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°") |
| | | @Log(title = "审æ¹åè¡¨æ´æ°", businessType = BusinessType.UPDATE) |
| | | public R update(@RequestBody ApprovalInstanceDto approvalInstanceDto) { |
| | | return approvalInstanceService.update(approvalInstanceDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "审æ¹å表å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤") |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return approvalInstanceService.delete(ids) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @Operation(summary = "审æ¹") |
| | | @PostMapping("/approve") |
| | | @Log(title = "审æ¹å表审æ¹", businessType = BusinessType.UPDATE) |
| | | public R approve(@RequestBody ApprovalInstanceDto approvalInstanceDto) { |
| | | return approvalInstanceService.approve(approvalInstanceDto); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹èç¹å®ä¾è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:54 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalInstanceNode") |
| | | public class ApprovalInstanceNodeController extends BaseController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹è®°å½è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:28:21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalRecord") |
| | | public class ApprovalRecordController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹ä»»å¡è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:32:37 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalTask") |
| | | public class ApprovalTaskController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateVo; |
| | | import com.ruoyi.approve.service.ApprovalTemplateService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author èéè½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalTemplate") |
| | | @Tag(name = "å®¡æ¹æ¨¡æ¿è¡¨") |
| | | @AllArgsConstructor |
| | | public class ApprovalTemplateController extends BaseController { |
| | | |
| | | private final ApprovalTemplateService approvalTemplateService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | @Log(title = "å®¡æ¹æ¨¡æ¿å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto) { |
| | | return R.ok(approvalTemplateService.listPage(page, approvalTemplateDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å ") |
| | | @Log(title = "æ·»å å®¡æ¹æ¨¡æ¿", businessType = BusinessType.INSERT) |
| | | public R add(@RequestBody ApprovalTemplateDto approvalTemplateDto) { |
| | | return R.ok(approvalTemplateService.saveApprovalTemplateDto(approvalTemplateDto)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | @Log(title = "ä¿®æ¹å®¡æ¹æ¨¡æ¿", businessType = BusinessType.UPDATE) |
| | | public R update(@RequestBody ApprovalTemplateDto approvalTemplateDto) { |
| | | return R.ok(approvalTemplateService.updateApprovalTemplateDto(approvalTemplateDto)); |
| | | } |
| | | |
| | | @PostMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | @Log(title = "å é¤å®¡æ¹æ¨¡æ¿", businessType = BusinessType.DELETE) |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return R.ok(approvalTemplateService.delete(ids)); |
| | | } |
| | | |
| | | @GetMapping("/list/{type}") |
| | | @Operation(summary = "æ¥è¯¢ææå®¡æ¹æ¨¡æ¿") |
| | | public R list(@PathVariable("type") Integer type) { |
| | | return R.ok(approvalTemplateService.listApprovalTemplateVo(type)); |
| | | } |
| | | |
| | | @GetMapping("/detail/{id}") |
| | | @Operation(summary = "æ¥è¯¢å®¡æ¹æ¨¡æ¿è¯¦æ
") |
| | | @Log(title = "æ¥è¯¢å®¡æ¹æ¨¡æ¿è¯¦æ
", businessType = BusinessType.OTHER) |
| | | public R detail(@PathVariable("id") Long id) { |
| | | return R.ok(approvalTemplateService.getApprovalTemplateVoById(id)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:30 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalTemplateNodeApprover") |
| | | public class ApprovalTemplateNodeApproverController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:19 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/approvalTemplateNode") |
| | | public class ApprovalTemplateNodeController { |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RestController |
| | | @RequestMapping("/approveNode") |
| | | @AllArgsConstructor |
| | | public class ApproveNodeController extends BaseController { |
| | | public class ApproveNodeController { |
| | | |
| | | private IApproveNodeService approveNodeService; |
| | | |
| | |
| | | */ |
| | | @GetMapping("/details/{id}") |
| | | @Operation(summary = "æµç¨ç¶æè¯¦æ
") |
| | | public R<?> details(@PathVariable String id) { |
| | | return R.ok(approveNodeService.details(id)); |
| | | public AjaxResult details(@PathVariable String id) { |
| | | return AjaxResult.success(approveNodeService.details(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/updateApproveNode") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "审æ¹èç¹") |
| | | public R<?> updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | approveNodeService.updateApproveNode(approveNode); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/init") |
| | | public R<?> init(String id) { |
| | | public AjaxResult init(String id) { |
| | | approveNodeService.initApproveNodes("",id,1L); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @RequestMapping("/approveProcess") |
| | | @AllArgsConstructor |
| | | @Tag(name = "审æ¹") |
| | | public class ApproveProcessController extends BaseController { |
| | | public class ApproveProcessController { |
| | | |
| | | private IApproveProcessService approveProcessService; |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDept") |
| | | public R<?> getDept() { |
| | | public AjaxResult getDept() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LoginUser user = SecurityUtils.getLoginUser(); |
| | | Long[] deptIds = SecurityUtils.getDeptId(); |
| | | |
| | | List<SysDept> sysDeptList = approveProcessService.selectDeptListByDeptIds(deptIds); |
| | | return R.ok(sysDeptList); |
| | | return AjaxResult.success(sysDeptList); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "æ·»å 审æ¹") |
| | | public R<?> add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | public AjaxResult add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | if (approveProcessVO == null) { |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | return R.ok(null, "æ·»å æå"); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/get") |
| | | @Operation(summary = "审æ¹è¯¦æ
") |
| | | public R<?> get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | public AjaxResult get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | if (approveGetAndUpdateVo.getId() == null || approveGetAndUpdateVo.getId().isEmpty()) { |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | return R.ok(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | return AjaxResult.success(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "æ´æ°å®¡æ¹") |
| | | public R<?> update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | public AjaxResult update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | if (approveGetAndUpdateVo == null) { |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | approveProcessService.updateByApproveId(approveGetAndUpdateVo); |
| | | return R.ok(null, "æä½æå"); |
| | | return AjaxResult.success("æä½æå"); |
| | | } |
| | | /** |
| | | * è·å审æ¹å表 |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "è·å审æ¹å表") |
| | | public R<?> list(Page page, ApproveProcess approveProcess) { |
| | | return R.ok(approveProcessService.listAll(page, approveProcess)); |
| | | public AjaxResult list(Page page, ApproveProcess approveProcess) { |
| | | return AjaxResult.success(approveProcessService.listAll(page, approveProcess)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/deleteIds") |
| | | @Operation(summary = "å é¤å®¡æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> deleteIds(@RequestBody List<Long> ids) { |
| | | public AjaxResult deleteIds(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.size() == 0) { |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | approveProcessService.delApprove(ids); |
| | | return R.ok(null, "æä½æå"); |
| | | return AjaxResult.success("æä½æå"); |
| | | } |
| | | |
| | | @Operation(summary = "å
¬åºç®¡ç导åº") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.FinReimbursementDto; |
| | | import com.ruoyi.approve.bean.vo.FinReimbursementVo; |
| | | import com.ruoyi.approve.service.FinReimbursementService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éå主表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:15 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/finReimbursement") |
| | | @Tag(name = "æ¥éå主表", description = "æ¥éå主表") |
| | | @AllArgsConstructor |
| | | public class FinReimbursementController { |
| | | |
| | | private final FinReimbursementService finReimbursementService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R listPage(Page<FinReimbursementVo> page, FinReimbursementDto finReimbursementDto) { |
| | | return R.ok(finReimbursementService.listPage(finReimbursementDto, page)); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "ä¿å") |
| | | public R save(@RequestBody FinReimbursementDto finReimbursementDto) { |
| | | return R.ok(finReimbursementService.add(finReimbursementDto)); |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | | @Operation(summary = "详æ
") |
| | | public R detail(Long id) { |
| | | return R.ok(finReimbursementService.detail(id)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public R update(@RequestBody FinReimbursementDto finReimbursementDto) { |
| | | return R.ok(finReimbursementService.update(finReimbursementDto)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return R.ok(finReimbursementService.delete(ids)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éåæç»è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:38 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/finReimbursementDetail") |
| | | public class FinReimbursementDetailController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å·®æ
æ¥éæ©å±è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:47 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/finReimbursementTravel") |
| | | public class FinReimbursementTravelController { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.approve.mapper.WorkingHoursSettingMapper; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.approve.service.HolidaySettingsService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/holidaySettings") |
| | | @AllArgsConstructor |
| | | public class HolidaySettingsController extends BaseController { |
| | | public class HolidaySettingsController { |
| | | private HolidaySettingsService holidaySettingsService; |
| | | private AnnualLeaveSettingMapper annualLeaveSettingMapper; |
| | | private OvertimeSettingMapper overtimeSettingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, HolidaySettings holidaySettings) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(holidaySettingsService.listpage(page,holidaySettings)); |
| | | return AjaxResult.success(holidaySettingsService.listpage(page,holidaySettings)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.save(holidaySettings)); |
| | | public AjaxResult add(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.save(holidaySettings)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public R<?> update(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.updateById(holidaySettings)); |
| | | public AjaxResult update(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.updateById(holidaySettings)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(holidaySettingsService.removeByIds(ids)); |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(holidaySettingsService.removeByIds(ids)); |
| | | } |
| | | /**ã |
| | | * è·åå¹´åè§åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAnnualLeaveSettingList") |
| | | public R<?> getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, AnnualLeaveSetting annualLeaveSetting) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | return AjaxResult.success(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»å¹´åè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addAnnualLeaveSetting") |
| | | public R<?> addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | public AjaxResult addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°å¹´åè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateAnnualLeaveSetting") |
| | | public R<?> updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | public AjaxResult updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤å¹´åè§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteAnnualLeaveSetting") |
| | | public R<?> deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | public AjaxResult deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOvertimeSettingList") |
| | | public R<?> getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, OvertimeSetting overtimeSetting) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | return AjaxResult.success(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»å çè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOvertimeSetting") |
| | | public R<?> addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.insert(overtimeSetting)); |
| | | public AjaxResult addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.insert(overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°å çè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateOvertimeSetting") |
| | | public R<?> updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | public AjaxResult updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤å çè§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteOvertimeSetting") |
| | | public R<?> deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | public AjaxResult deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | /**ã |
| | | * è·åä¸çæ¶é´è®¾ç½®-çå¶è§åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getWorkingHoursSettingList") |
| | | public R<?> getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, WorkingHoursSetting workingHoursSetting) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | return AjaxResult.success(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»çå¶è§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addWorkingHoursSetting") |
| | | public R<?> addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | public AjaxResult addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°çå¶è§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateWorkingHoursSetting") |
| | | public R<?> updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | public AjaxResult updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤çå¶è§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteWorkingHoursSetting") |
| | | public R<?> deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(workingHoursSettingMapper.deleteBatchIds(ids)); |
| | | public AjaxResult deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(workingHoursSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.approve.service.KnowledgeBaseService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/knowledgeBase") |
| | | @AllArgsConstructor |
| | | @Tag(name = "ç¥è¯åºç®¡ç") |
| | | public class KnowledgeBaseController extends BaseController { |
| | | public class KnowledgeBaseController { |
| | | private KnowledgeBaseService knowledgeBaseService; |
| | | |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | return AjaxResult.success(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.save(knowledgeBase)); |
| | | public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.save(knowledgeBase)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public R<?> update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.updateById(knowledgeBase)); |
| | | public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(knowledgeBaseService.removeByIds(ids)); |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(knowledgeBaseService.removeByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "ç¥è¯åºç®¡ç导åº") |
| | |
| | | import com.ruoyi.approve.pojo.NotificationManagement; |
| | | import com.ruoyi.approve.pojo.OnlineMeeting; |
| | | import com.ruoyi.approve.service.NotificationManagementService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/notificationManagement") |
| | | @AllArgsConstructor |
| | | public class NotificationManagementController extends BaseController { |
| | | public class NotificationManagementController { |
| | | private NotificationManagementService notificationManagementService ; |
| | | private OnlineMeetingMapper onlineMeetingMapper; |
| | | private FileSharingMapper fileSharingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, NotificationManagement notificationManagement) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(notificationManagementService.listpage(page,notificationManagement)); |
| | | return AjaxResult.success(notificationManagementService.listpage(page,notificationManagement)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.save(notificationManagement)); |
| | | public AjaxResult add(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.save(notificationManagement)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public R<?> update(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.updateById(notificationManagement)); |
| | | public AjaxResult update(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.updateById(notificationManagement)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(notificationManagementService.removeByIds(ids)); |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(notificationManagementService.removeByIds(ids)); |
| | | } |
| | | /** |
| | | *æ°å¢ä¼è®® |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOnlineMeeting") |
| | | public R<?> addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return R.ok(onlineMeetingMapper.insert(onlineMeeting)); |
| | | public AjaxResult addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return AjaxResult.success(onlineMeetingMapper.insert(onlineMeeting)); |
| | | } |
| | | /** |
| | | *æ°å¢æä»¶å
񄧮 |
| | | * |
| | | */ |
| | | @PostMapping("/addFileSharing") |
| | | public R<?> addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return R.ok(fileSharingMapper.insert(fileSharing)); |
| | | public AjaxResult addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return AjaxResult.success(fileSharingMapper.insert(fileSharing)); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.approve.pojo.RpaProcessAutomation; |
| | | import com.ruoyi.approve.service.RpaProcessAutomationService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/rpaProcessAutomation") |
| | | @AllArgsConstructor |
| | | @Tag(name = "RPAæµç¨èªå¨å") |
| | | public class RpaProcessAutomationController extends BaseController { |
| | | public class RpaProcessAutomationController { |
| | | private RpaProcessAutomationService rpaProcessAutomationService; |
| | | /**ã |
| | | * è·åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "100") long size, RpaProcessAutomation rpaProcessAutomation) { |
| | | Page page = new Page(current, size); |
| | | return R.ok(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | return AjaxResult.success(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | public AjaxResult add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public R<?> update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | public AjaxResult update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(rpaProcessAutomationService.removeByIds(ids)); |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(rpaProcessAutomationService.removeByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "RPAæµç¨èªå¨å导åº") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalInstanceDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalInstanceVo; |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹å®ä¾è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:46 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance> { |
| | | |
| | | IPage<ApprovalInstanceVo> listPage(Page<ApprovalInstanceVo> page,@Param("ew") ApprovalInstanceDto approvalInstanceDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalInstanceNode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹èç¹å®ä¾è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:54 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalInstanceNodeMapper extends BaseMapper<ApprovalInstanceNode> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹è®°å½è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:28:21 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalRecordMapper extends BaseMapper<ApprovalRecord> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹ä»»å¡è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:32:37 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateVo; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:08 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalTemplateMapper extends BaseMapper<ApprovalTemplate> { |
| | | |
| | | IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page,@Param("ew") ApprovalTemplateDto approvalTemplateDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:30 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalTemplateNodeApproverMapper extends BaseMapper<ApprovalTemplateNodeApprover> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:19 |
| | | */ |
| | | @Mapper |
| | | public interface ApprovalTemplateNodeMapper extends BaseMapper<ApprovalTemplateNode> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.FinReimbursementDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éåæç»è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:38 |
| | | */ |
| | | @Mapper |
| | | public interface FinReimbursementDetailMapper extends BaseMapper<FinReimbursementDetail> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.FinReimbursementDto; |
| | | import com.ruoyi.approve.bean.vo.FinReimbursementVo; |
| | | import com.ruoyi.approve.pojo.FinReimbursement; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éå主表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:15 |
| | | */ |
| | | @Mapper |
| | | public interface FinReimbursementMapper extends BaseMapper<FinReimbursement> { |
| | | |
| | | IPage<FinReimbursementVo> listPage(@Param("ew") FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.FinReimbursementTravel; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å·®æ
æ¥éæ©å±è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:47 |
| | | */ |
| | | @Mapper |
| | | public interface FinReimbursementTravelMapper extends BaseMapper<FinReimbursementTravel> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹å®ä¾è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:46 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_instance") |
| | | @ApiModel(value = "ApprovalInstance对象", description = "审æ¹å®ä¾è¡¨") |
| | | public class ApprovalInstance implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 审æ¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="审æ¹å®ä¾ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 审æ¹ç¼å· |
| | | */ |
| | | @Schema(description ="审æ¹ç¼å·") |
| | | private String instanceNo; |
| | | |
| | | /** |
| | | * 模æ¿ID |
| | | */ |
| | | @Schema(description ="模æ¿ID") |
| | | private Long templateId; |
| | | |
| | | /** |
| | | * 模æ¿åç§° |
| | | */ |
| | | @Schema(description ="模æ¿åç§°") |
| | | private String templateName; |
| | | |
| | | /** |
| | | * ä¸å¡ID |
| | | */ |
| | | @Schema(description ="ä¸å¡ID") |
| | | private Long businessId; |
| | | |
| | | /** |
| | | * ä¸å¡ç±»å |
| | | */ |
| | | @Schema(description ="ä¸å¡ç±»å") |
| | | private Long businessType; |
| | | |
| | | /** |
| | | * å®¡æ¹æ é¢ |
| | | */ |
| | | @Schema(description ="å®¡æ¹æ é¢") |
| | | private String title; |
| | | |
| | | /** |
| | | * 审æ¹ç¶æ |
| | | */ |
| | | @Schema(description ="审æ¹ç¶æ PENDING - å¾
审æ¹/è¿è¡ä¸ APPROVED - å·²éè¿/已宿 REJECTED - 已驳å") |
| | | private String status; |
| | | |
| | | /** |
| | | * å½å审æ¹çº§å« |
| | | */ |
| | | @Schema(description ="å½å审æ¹çº§å«") |
| | | private Integer currentLevel; |
| | | |
| | | /** |
| | | * ç³è¯·äººID |
| | | */ |
| | | @Schema(description ="ç³è¯·äººID") |
| | | private Long applicantId; |
| | | |
| | | /** |
| | | * ç³è¯·äººåç§° |
| | | */ |
| | | @Schema(description ="ç³è¯·äººåç§°") |
| | | private String applicantName; |
| | | |
| | | /** |
| | | * ç³è¯·æ¶é´ |
| | | */ |
| | | @Schema(description ="ç³è¯·æ¶é´") |
| | | private LocalDateTime applyTime; |
| | | |
| | | /** |
| | | * 宿æ¶é´ |
| | | */ |
| | | @Schema(description ="宿æ¶é´") |
| | | private LocalDateTime finishTime; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description ="å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description ="å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description ="æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description ="æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | /** |
| | | * é»è¾å é¤ |
| | | */ |
| | | @Schema(description ="é»è¾å é¤") |
| | | private Byte deleted; |
| | | |
| | | @Schema(description = "è¡¨åæ°æ®") |
| | | private String formConfig; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹èç¹å®ä¾è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:54 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_instance_node") |
| | | @ApiModel(value = "ApprovalInstanceNode对象", description = "审æ¹èç¹å®ä¾è¡¨") |
| | | public class ApprovalInstanceNode implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * èç¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="èç¹å®ä¾ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 审æ¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="审æ¹å®ä¾ID") |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * 审æ¹çº§å« |
| | | */ |
| | | @Schema(description ="审æ¹çº§å«") |
| | | private Integer levelNo; |
| | | |
| | | /** |
| | | * 审æ¹ç±»å |
| | | */ |
| | | @Schema(description ="审æ¹ç±»å") |
| | | private String approveType; |
| | | |
| | | /** |
| | | * èç¹ç¶æ |
| | | */ |
| | | @Schema(description ="èç¹ç¶æ PENDING - å¾
å¤ç APPROVED - å·²éè¿ REJECTED - 已驳å") |
| | | private String status; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @Schema(description ="å¼å§æ¶é´") |
| | | private LocalDateTime startTime; |
| | | |
| | | /** |
| | | * 宿æ¶é´ |
| | | */ |
| | | @Schema(description ="宿æ¶é´") |
| | | private LocalDateTime finishTime; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description ="å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description ="å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description ="æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description ="æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é»è¾å é¤ |
| | | */ |
| | | @Schema(description ="é»è¾å é¤") |
| | | private Byte deleted; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹è®°å½è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:28:21 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_record") |
| | | @ApiModel(value = "ApprovalRecord对象", description = "审æ¹è®°å½è¡¨") |
| | | public class ApprovalRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 审æ¹è®°å½ID |
| | | */ |
| | | @Schema(description ="审æ¹è®°å½ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 审æ¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="审æ¹å®ä¾ID") |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * èç¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="èç¹å®ä¾ID") |
| | | private Long nodeId; |
| | | |
| | | /** |
| | | * 审æ¹ä»»å¡ID |
| | | */ |
| | | @Schema(description ="审æ¹ä»»å¡ID") |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * æä½äººID |
| | | */ |
| | | @Schema(description ="æä½äººID") |
| | | private Long operatorId; |
| | | |
| | | /** |
| | | * æä½äººåç§° |
| | | */ |
| | | @Schema(description ="æä½äººåç§°") |
| | | private String operatorName; |
| | | |
| | | /** |
| | | * æä½ç±»å |
| | | */ |
| | | @Schema(description ="æä½ç±»å") |
| | | private String action; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | @Schema(description ="å®¡æ¹æè§") |
| | | private String comment; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description ="å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description ="å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * é»è¾å é¤ |
| | | */ |
| | | @Schema(description ="é»è¾å é¤") |
| | | private Byte deleted; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹ä»»å¡è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:32:37 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_task") |
| | | @ApiModel(value = "ApprovalTask对象", description = "审æ¹ä»»å¡è¡¨") |
| | | public class ApprovalTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 审æ¹ä»»å¡ID |
| | | */ |
| | | @Schema(description ="审æ¹ä»»å¡ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 审æ¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="审æ¹å®ä¾ID") |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * èç¹å®ä¾ID |
| | | */ |
| | | @Schema(description ="èç¹å®ä¾ID") |
| | | private Long nodeId; |
| | | |
| | | /** |
| | | * 审æ¹çº§å« |
| | | */ |
| | | @Schema(description ="审æ¹çº§å«") |
| | | private Integer levelNo; |
| | | |
| | | /** |
| | | * 审æ¹äººID |
| | | */ |
| | | @Schema(description ="审æ¹äººID") |
| | | private Long approverId; |
| | | |
| | | /** |
| | | * 审æ¹äººåç§° |
| | | */ |
| | | @Schema(description ="审æ¹äººåç§°") |
| | | private String approverName; |
| | | |
| | | /** |
| | | * ä»»å¡ç¶æ |
| | | */ |
| | | @Schema(description ="ä»»å¡ç¶æ PENDING - å¾
å®¡æ¹ APPROVED - å·²åæ REJECTED - å·²æç»") |
| | | private String taskStatus; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¶é´ |
| | | */ |
| | | @Schema(description ="å®¡æ¹æ¶é´") |
| | | private LocalDateTime approveTime; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | @Schema(description ="å®¡æ¹æè§") |
| | | private String comment; |
| | | |
| | | /** |
| | | * æ¯å¦å·²è¯» |
| | | */ |
| | | @Schema(description ="æ¯å¦å·²è¯»") |
| | | private Byte isRead; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description ="å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description ="å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description ="æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description ="æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é»è¾å é¤ |
| | | */ |
| | | @Schema(description ="é»è¾å é¤") |
| | | private Byte deleted; |
| | | |
| | | @Schema(description ="é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:08 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_template") |
| | | @ApiModel(value = "ApprovalTemplate对象", description = "å®¡æ¹æ¨¡æ¿è¡¨") |
| | | public class ApprovalTemplate implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 模æ¿ID |
| | | */ |
| | | @Schema(description ="模æ¿ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 模æ¿åç§° |
| | | */ |
| | | @Schema(description ="模æ¿åç§°") |
| | | private String templateName; |
| | | |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨ï¼0åç¨ |
| | | */ |
| | | @Schema(description ="å¯ç¨ç¶æï¼1å¯ç¨ï¼0åç¨") |
| | | private Byte enabled; |
| | | |
| | | /** |
| | | * 模æ¿è¯´æ |
| | | */ |
| | | @Schema(description ="模æ¿è¯´æ") |
| | | private String description; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description ="å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description ="å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description ="æ´æ°äºº") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description ="æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼0å¦ï¼1æ¯ |
| | | */ |
| | | @Schema(description ="é»è¾å é¤ï¼0å¦ï¼1æ¯") |
| | | private Integer deleted; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "表åé
ç½®") |
| | | private String formConfig; |
| | | |
| | | @Schema(description = "模æ¿ç±»åï¼0ç³»ç»å
ç½®ï¼1èªå®ä¹") |
| | | private Integer templateType; |
| | | |
| | | @Schema(description = "ä¸å¡ç±»å") |
| | | private Long businessType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:19 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_template_node") |
| | | @ApiModel(value = "ApprovalTemplateNode对象", description = "å®¡æ¹æ¨¡æ¿èç¹è¡¨") |
| | | public class ApprovalTemplateNode implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * èç¹ID |
| | | */ |
| | | @Schema(description ="èç¹ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¨¡æ¿ID |
| | | */ |
| | | @Schema(description ="å®¡æ¹æ¨¡æ¿ID") |
| | | private Long templateId; |
| | | |
| | | /** |
| | | * 审æ¹çº§å«ï¼ä»1å¼å§ |
| | | */ |
| | | @Schema(description ="审æ¹çº§å«ï¼ä»1å¼å§") |
| | | private Integer levelNo; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¹å¼ï¼ANDä¼ç¾ï¼ORæç¾ |
| | | */ |
| | | @Schema(description ="å®¡æ¹æ¹å¼ï¼ANDä¼ç¾ï¼ORæç¾") |
| | | private String approveType; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:30 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("approval_template_node_approver") |
| | | @ApiModel(value = "ApprovalTemplateNodeApprover对象", description = "å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨") |
| | | public class ApprovalTemplateNodeApprover implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @Schema(description = "主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 审æ¹èç¹ID |
| | | */ |
| | | @Schema(description ="审æ¹èç¹ID") |
| | | private Long nodeId; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¨¡æ¿ID |
| | | */ |
| | | @Schema(description ="å®¡æ¹æ¨¡æ¿ID") |
| | | private Long templateId; |
| | | |
| | | /** |
| | | * 审æ¹äººID |
| | | */ |
| | | @Schema(description ="审æ¹äººID") |
| | | private Long approverId; |
| | | |
| | | /** |
| | | * 审æ¹äººåç§°åä½ |
| | | */ |
| | | @Schema(description ="审æ¹äººåç§°åä½") |
| | | private String approverName; |
| | | |
| | | /** |
| | | * 审æ¹äººæåº |
| | | */ |
| | | @Schema(description ="审æ¹äººæåº") |
| | | private Integer sortNo; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deleted ; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | @Excel(name = "åºå·®å¼å§æ¶é´", dateFormat = "yyyy-MM-dd HH:mm", width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®å¼å§æ¶é´") |
| | | private LocalDateTime startDateTime; |
| | | |
| | | @Excel(name = "åºå·®ç»ææ¶é´", dateFormat = "yyyy-MM-dd HH:mm", width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @Schema(description = "åºå·®ç»ææ¶é´") |
| | | private LocalDateTime endDateTime; |
| | | |
| | | private BigDecimal price; |
| | | |
| | | private String location; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éå主表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:15 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_reimbursement") |
| | | @ApiModel(value = "FinReimbursement对象", description = "æ¥éå主表") |
| | | public class FinReimbursement implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @Schema(description = "主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥éåå· |
| | | */ |
| | | @Schema(description = "æ¥éåå·") |
| | | private String billNo; |
| | | |
| | | /** |
| | | * æ¥éç±»åï¼1-å·®æ
æ¥éï¼2-è´¹ç¨æ¥é |
| | | */ |
| | | @Schema(description = "æ¥éç±»åï¼1-å·®æ
æ¥éï¼2-è´¹ç¨æ¥é") |
| | | private Byte reimbursementType; |
| | | |
| | | /** |
| | | * è´¹ç¨ç±»åï¼å·®æ
è´¹/åå
¬éè´/ä¸å¡æå¾
/交éè´¹/é讯费/å
¶ä» |
| | | */ |
| | | @Schema(description = "è´¹ç¨ç±»åï¼å·®æ
è´¹/åå
¬éè´/ä¸å¡æå¾
/交éè´¹/é讯费/å
¶ä»") |
| | | private String expenseType; |
| | | |
| | | /** |
| | | * ç³è¯·äººID |
| | | */ |
| | | @Schema(description = "ç³è¯·äººID") |
| | | private Long applicantId; |
| | | |
| | | /** |
| | | * åå·¥ç¼å· |
| | | */ |
| | | @Schema(description = "åå·¥ç¼å·") |
| | | private String applicantCode; |
| | | |
| | | /** |
| | | * åå·¥å§å |
| | | */ |
| | | @Schema(description = "åå·¥å§å") |
| | | private String applicantName; |
| | | |
| | | /** |
| | | * ç³è¯·é¨é¨ID |
| | | */ |
| | | @Schema(description = "ç³è¯·é¨é¨ID") |
| | | private Long applicantDeptId; |
| | | |
| | | /** |
| | | * ç³è¯·é¨é¨åç§° |
| | | */ |
| | | @Schema(description = "ç³è¯·é¨é¨åç§°") |
| | | private String applicantDeptName; |
| | | |
| | | /** |
| | | * æ¥éåå |
| | | */ |
| | | @Schema(description = "æ¥éåå ") |
| | | private String reason; |
| | | |
| | | /** |
| | | * ç³è¯·éé¢ |
| | | */ |
| | | @Schema(description = "ç³è¯·éé¢") |
| | | private BigDecimal applyAmount; |
| | | |
| | | /** |
| | | * æç»æ±æ»éé¢ |
| | | */ |
| | | @Schema(description = "æç»æ±æ»éé¢") |
| | | private BigDecimal detailTotalAmount; |
| | | |
| | | /** |
| | | * æ¶æ¬¾äºº |
| | | */ |
| | | @Schema(description = "æ¶æ¬¾äºº") |
| | | private String payeeName; |
| | | |
| | | /** |
| | | * æ¶æ¬¾è´¦å· |
| | | */ |
| | | @Schema(description = "æ¶æ¬¾è´¦å·") |
| | | private String payeeAccount; |
| | | |
| | | /** |
| | | * 弿·æ¯è¡ |
| | | */ |
| | | @Schema(description = "弿·æ¯è¡") |
| | | private String payeeBank; |
| | | |
| | | /** |
| | | * 审æ¹å®ä¾IDï¼å¯¹åº approval_instance.id |
| | | */ |
| | | @Schema(description = "审æ¹å®ä¾IDï¼å¯¹åº approval_instance.id") |
| | | private Long approvalInstanceId; |
| | | |
| | | /** |
| | | * å®¡æ¹æµç¨IDï¼å¯¹åº approve_process.id |
| | | */ |
| | | @Schema(description = "å®¡æ¹æµç¨IDï¼å¯¹åº approve_process.id") |
| | | private Long approveProcessId; |
| | | |
| | | /** |
| | | * åæ®ç¶æï¼DRAFT-è稿ï¼IN_APPROVAL-审æ¹ä¸ï¼APPROVED-审æ¹éè¿ï¼REJECTED-审æ¹é©³åï¼WITHDRAWN-å·²æ¤åï¼PAID-已仿¬¾ |
| | | */ |
| | | @Schema(description = "åæ®ç¶æï¼DRAFT-è稿ï¼IN_APPROVAL-审æ¹ä¸ï¼APPROVED-审æ¹éè¿ï¼REJECTED-审æ¹é©³åï¼WITHDRAWN-å·²æ¤åï¼PAID-已仿¬¾") |
| | | private String billStatus; |
| | | |
| | | /** |
| | | * 审æ¹éè¿æ¶é´ |
| | | */ |
| | | @Schema(description = "审æ¹éè¿æ¶é´") |
| | | private LocalDateTime approvedTime; |
| | | |
| | | /** |
| | | * 仿¬¾æ¶é´ |
| | | */ |
| | | @Schema(description = "仿¬¾æ¶é´") |
| | | private LocalDateTime paidTime; |
| | | |
| | | /** |
| | | * çæçè´¢å¡æ¯åºè®°å½IDï¼å¯¹åº account_expense.id |
| | | */ |
| | | @Schema(description = "çæçè´¢å¡æ¯åºè®°å½IDï¼å¯¹åº account_expense.id") |
| | | private Long accountExpenseId; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @Schema(description = "ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å½å±é¨é¨ID |
| | | */ |
| | | @Schema(description = "å½å±é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼0-å¦ï¼1-æ¯ |
| | | */ |
| | | @Schema(description = "é»è¾å é¤ï¼0-å¦ï¼1-æ¯") |
| | | private Byte deleted; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éåæç»è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:38 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_reimbursement_detail") |
| | | @ApiModel(value = "FinReimbursementDetail对象", description = "æ¥éåæç»è¡¨") |
| | | public class FinReimbursementDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @Schema(description = "主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥éåIDï¼å¯¹åº fin_reimbursement.id |
| | | */ |
| | | @Schema(description = "æ¥éåIDï¼å¯¹åº fin_reimbursement.id") |
| | | private Long reimbursementId; |
| | | |
| | | /** |
| | | * æç»è¡å· |
| | | */ |
| | | @Schema(description = "æç»è¡å·") |
| | | private Integer rowNo; |
| | | |
| | | /** |
| | | * åç¥¨æ¥æ |
| | | */ |
| | | @Schema(description = "åç¥¨æ¥æ") |
| | | private LocalDate invoiceDate; |
| | | |
| | | /** |
| | | * è´¹ç¨ç§ç® |
| | | */ |
| | | @Schema(description = "è´¹ç¨ç§ç®") |
| | | private String expenseCategory; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | @Schema(description = "éé¢") |
| | | private BigDecimal amount; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | @Schema(description = "æè¿°") |
| | | private String description; |
| | | |
| | | /** |
| | | * å票å·ç |
| | | */ |
| | | @Schema(description = "å票å·ç ") |
| | | private String invoiceNo; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | @Schema(description = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * 票é¢éé¢ |
| | | */ |
| | | @Schema(description = "票é¢éé¢") |
| | | private BigDecimal invoiceAmount; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @Schema(description = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ç¨é¢ |
| | | */ |
| | | @Schema(description = "ç¨é¢") |
| | | private BigDecimal taxAmount; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @Schema(description = "ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å½å±é¨é¨ID |
| | | */ |
| | | @Schema(description = "å½å±é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼0-å¦ï¼1-æ¯ |
| | | */ |
| | | @Schema(description = "é»è¾å é¤ï¼0-å¦ï¼1-æ¯") |
| | | private Byte deleted; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * å·®æ
æ¥éæ©å±è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:47 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_reimbursement_travel") |
| | | @ApiModel(value = "FinReimbursementTravel对象", description = "å·®æ
æ¥éæ©å±è¡¨") |
| | | public class FinReimbursementTravel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @Schema(description = "主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥éåIDï¼å¯¹åº fin_reimbursement.id |
| | | */ |
| | | @Schema(description = "æ¥éåIDï¼å¯¹åº fin_reimbursement.id") |
| | | private Long reimbursementId; |
| | | |
| | | /** |
| | | * åºå·®å¼å§æ¶é´ |
| | | */ |
| | | @Schema(description = "åºå·®å¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | /** |
| | | * åºå·®ç»ææ¶é´ |
| | | */ |
| | | @Schema(description = "åºå·®ç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | /** |
| | | * åºå·®å¤©æ° |
| | | */ |
| | | @Schema(description = "åºå·®å¤©æ°") |
| | | private BigDecimal travelDays; |
| | | |
| | | /** |
| | | * åºå·®å°/åºååå¸ |
| | | */ |
| | | @Schema(description = "åºå·®å°/åºååå¸") |
| | | private String departureCity; |
| | | |
| | | /** |
| | | * ç®çå°/ç®çåå¸ |
| | | */ |
| | | @Schema(description = "ç®çå°/ç®çåå¸") |
| | | private String destinationCity; |
| | | |
| | | /** |
| | | * é
åºæ å |
| | | */ |
| | | @Schema(description = "é
åºæ å") |
| | | private BigDecimal hotelStandard; |
| | | |
| | | /** |
| | | * ä½å®¿å¤©æ° |
| | | */ |
| | | @Schema(description = "ä½å®¿å¤©æ°") |
| | | private BigDecimal lodgingDays; |
| | | |
| | | /** |
| | | * çæ´»è¡¥è´´ |
| | | */ |
| | | @Schema(description = "çæ´»è¡¥è´´") |
| | | private BigDecimal mealAllowance; |
| | | |
| | | /** |
| | | * 交é补贴 |
| | | */ |
| | | @Schema(description = "交é补贴") |
| | | private BigDecimal transportAllowance; |
| | | |
| | | /** |
| | | * ä½å®¿éé¢ |
| | | */ |
| | | @Schema(description = "ä½å®¿éé¢") |
| | | private BigDecimal lodgingLimit; |
| | | |
| | | /** |
| | | * ç¹æ¹æ è®°ææ¬ï¼å¦å¨æ åèå´å
/è¶
æ ç¹æ¹ |
| | | */ |
| | | @Schema(description = "ç¹æ¹æ è®°ææ¬ï¼å¦å¨æ åèå´å
/è¶
æ ç¹æ¹") |
| | | private String standardTag; |
| | | |
| | | /** |
| | | * æ¯å¦å¨æ åå
ï¼1-æ¯ï¼0-å¦ |
| | | */ |
| | | @Schema(description = "æ¯å¦å¨æ åå
ï¼1-æ¯ï¼0-å¦") |
| | | private Byte withinStandard; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @Schema(description = "ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Schema(description = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Schema(description = "æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å½å±é¨é¨ID |
| | | */ |
| | | @Schema(description = "å½å±é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalInstanceNode; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹èç¹å®ä¾è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:54 |
| | | */ |
| | | public interface ApprovalInstanceNodeService extends IService<ApprovalInstanceNode> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalInstanceDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalInstanceVo; |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹å®ä¾è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:46 |
| | | */ |
| | | public interface ApprovalInstanceService extends IService<ApprovalInstance> { |
| | | |
| | | R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto); |
| | | |
| | | Boolean add(ApprovalInstanceDto approvalInstanceDto); |
| | | |
| | | Boolean update(ApprovalInstanceDto approvalInstanceDto); |
| | | |
| | | Boolean delete(List<Long> ids); |
| | | |
| | | R approve(ApprovalInstanceDto approvalInstanceDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalRecord; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹è®°å½è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:28:21 |
| | | */ |
| | | public interface ApprovalRecordService extends IService<ApprovalRecord> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹ä»»å¡è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:32:37 |
| | | */ |
| | | public interface ApprovalTaskService extends IService<ApprovalTask> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:30 |
| | | */ |
| | | public interface ApprovalTemplateNodeApproverService extends IService<ApprovalTemplateNodeApprover> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:19 |
| | | */ |
| | | public interface ApprovalTemplateNodeService extends IService<ApprovalTemplateNode> { |
| | | |
| | | Boolean saveApprovalTemplateNode(Long id, List<ApprovalTemplateNodeDto> nodes); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateVo; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:08 |
| | | */ |
| | | public interface ApprovalTemplateService extends IService<ApprovalTemplate> { |
| | | |
| | | IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto); |
| | | |
| | | Boolean saveApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto); |
| | | |
| | | Boolean updateApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto); |
| | | |
| | | Boolean delete(List<Long> ids); |
| | | |
| | | List<ApprovalTemplateVo> listApprovalTemplateVo(Integer type); |
| | | |
| | | ApprovalTemplateVo getApprovalTemplateVoById(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.FinReimbursementDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éåæç»è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:38 |
| | | */ |
| | | public interface FinReimbursementDetailService extends IService<FinReimbursementDetail> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.dto.FinReimbursementDto; |
| | | import com.ruoyi.approve.bean.vo.FinReimbursementVo; |
| | | import com.ruoyi.approve.pojo.FinReimbursement; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éå主表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:15 |
| | | */ |
| | | public interface FinReimbursementService extends IService<FinReimbursement> { |
| | | |
| | | IPage<FinReimbursementVo> listPage(FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page); |
| | | |
| | | Boolean add(FinReimbursementDto finReimbursementDto); |
| | | |
| | | FinReimbursementVo detail(Long id); |
| | | |
| | | Boolean update(FinReimbursementDto finReimbursementDto); |
| | | |
| | | Boolean delete(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service; |
| | | |
| | | import com.ruoyi.approve.pojo.FinReimbursementTravel; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * å·®æ
æ¥éæ©å±è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:47 |
| | | */ |
| | | public interface FinReimbursementTravelService extends IService<FinReimbursementTravel> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalInstanceNode; |
| | | import com.ruoyi.approve.mapper.ApprovalInstanceNodeMapper; |
| | | import com.ruoyi.approve.service.ApprovalInstanceNodeService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹èç¹å®ä¾è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:27:54 |
| | | */ |
| | | @Service |
| | | public class ApprovalInstanceNodeServiceImpl extends ServiceImpl<ApprovalInstanceNodeMapper, ApprovalInstanceNode> implements ApprovalInstanceNodeService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.bean.dto.ApprovalInstanceDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalInstanceVo; |
| | | import com.ruoyi.approve.mapper.ApprovalInstanceMapper; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper; |
| | | import com.ruoyi.approve.mapper.FinReimbursementMapper; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.approve.service.*; |
| | | import com.ruoyi.approve.utils.ApproveProcessConfigNodeUtils; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeDeptMapper; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeUserMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser; |
| | | import com.ruoyi.common.enums.*; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.utils.QualityInspectHelper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.staff.mapper.HolidayApplicationMapper; |
| | | import com.ruoyi.staff.pojo.HolidayApplication; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹å®ä¾æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @since 2026-05-18 03:27:46 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApprovalInstanceServiceImpl extends ServiceImpl<ApprovalInstanceMapper, ApprovalInstance> implements ApprovalInstanceService { |
| | | |
| | | private static final String ENTERPRISE_NEWS_STATUS_PUBLISHED = "PUBLISHED"; |
| | | private static final String ENTERPRISE_NEWS_STATUS_REJECTED = "REJECTED"; |
| | | |
| | | private final ApprovalInstanceMapper approvalInstanceMapper; |
| | | private final ApproveProcessConfigNodeUtils approveProcessConfigNodeUtils; |
| | | private final ApprovalInstanceNodeService approvalInstanceNodeService; |
| | | private final ApprovalTaskService approvalTaskService; |
| | | private final ApprovalRecordService approvalRecordService; |
| | | private final ApprovalTemplateNodeService approvalTemplateNodeService; |
| | | private final FinReimbursementMapper finReimbursementMapper; |
| | | private final FileUtil fileUtil; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final QualityInspectHelper qualityInspectHelper; |
| | | private final EnterpriseNewsScopeUserMapper enterpriseNewsScopeUserMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final SysUserDeptMapper sysUserDeptMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final HolidayApplicationMapper holidayApplicationMapper; |
| | | private final EnterpriseNewsMapper enterpriseNewsMapper; |
| | | private final EnterpriseNewsScopeDeptMapper enterpriseNewsScopeDeptMapper; |
| | | private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper; |
| | | |
| | | @Override |
| | | public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) { |
| | | IPage<ApprovalInstanceVo> approvalInstanceVoIPage = approvalInstanceMapper.listPage(page, approvalInstanceDto); |
| | | |
| | | List<ApprovalInstanceVo> records = approvalInstanceVoIPage.getRecords(); |
| | | if (records == null || records.isEmpty()) { |
| | | return R.ok(approvalInstanceVoIPage); |
| | | } |
| | | records.forEach(vo -> { |
| | | vo.setBusinessName(TypeEnums.getLabelByValue(vo.getBusinessType())); |
| | | }); |
| | | Long currentUserId = SecurityUtils.getUserId(); |
| | | |
| | | List<Long> instanceIds = records.stream() |
| | | .map(ApprovalInstanceVo::getId) |
| | | .filter(id -> id != null) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!instanceIds.isEmpty()) { |
| | | Map<Long, List<ApprovalRecord>> recordMap = approvalRecordService.list( |
| | | Wrappers.<ApprovalRecord>lambdaQuery() |
| | | .in(ApprovalRecord::getInstanceId, instanceIds) |
| | | .eq(ApprovalRecord::getDeleted, 0) |
| | | ).stream().collect(Collectors.groupingBy(ApprovalRecord::getInstanceId)); |
| | | Map<Long, List<ApprovalTask>> taskMap = approvalTaskService.list( |
| | | Wrappers.<ApprovalTask>lambdaQuery() |
| | | .in(ApprovalTask::getInstanceId, instanceIds) |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | ).stream().collect(Collectors.groupingBy(ApprovalTask::getInstanceId)); |
| | | |
| | | for (ApprovalInstanceVo vo : records) { |
| | | vo.setIsApprove(approveProcessConfigNodeUtils.isCurrentApprover(vo.getId(), currentUserId)); |
| | | vo.setRecords(recordMap.getOrDefault(vo.getId(), new ArrayList<>())); |
| | | vo.setTasks(taskMap.getOrDefault(vo.getId(), new ArrayList<>())); |
| | | vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.APPROVAL_INSTANCE, vo.getId())); |
| | | } |
| | | |
| | | } |
| | | return R.ok(approvalInstanceVoIPage); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(ApprovalInstanceDto approvalInstanceDto) { |
| | | String instanceNo = OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", approvalInstanceDto.getCreateTime() != null ? approvalInstanceDto.getCreateTime() : LocalDateTime.now()); |
| | | approvalInstanceDto.setInstanceNo(instanceNo); |
| | | approvalInstanceDto.setStatus("PENDING"); |
| | | approvalInstanceDto.setCurrentLevel(1); |
| | | boolean saved = this.save(approvalInstanceDto); |
| | | if (!saved) { |
| | | return false; |
| | | } |
| | | approveProcessConfigNodeUtils.createCurrentNodeAndTasks(approvalInstanceDto); |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, approvalInstanceDto.getId(), approvalInstanceDto.getStorageBlobDTOs()); |
| | | sendApproveNotice(approvalInstanceDto, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstanceDto.getId())); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean update(ApprovalInstanceDto approvalInstanceDto) { |
| | | if (approvalInstanceDto == null || approvalInstanceDto.getId() == null) { |
| | | return false; |
| | | } |
| | | // 夿æ¯å¦ææ£å¨è¿è¡ç审æ¹ä»»å¡ï¼æåä¸å
è®¸ä¿®æ¹ |
| | | long pendingTaskCount = approvalTaskService.count( |
| | | Wrappers.<ApprovalTask>lambdaQuery() |
| | | .eq(ApprovalTask::getInstanceId, approvalInstanceDto.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | ); |
| | | if (pendingTaskCount > 0) { |
| | | throw new ServiceException("该审æ¹åææ£å¨è¿è¡ç审æ¹ä»»å¡ï¼ä¸å
许修æ¹"); |
| | | } |
| | | boolean updated = this.updateById(approvalInstanceDto); |
| | | if (!updated) { |
| | | return false; |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, approvalInstanceDto.getId(), approvalInstanceDto.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean delete(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return false; |
| | | } |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, ids); |
| | | |
| | | int instanceRows = approvalInstanceMapper.update( |
| | | null, |
| | | Wrappers.<ApprovalInstance>lambdaUpdate() |
| | | .in(ApprovalInstance::getId, ids) |
| | | .eq(ApprovalInstance::getDeleted, 0) |
| | | .set(ApprovalInstance::getDeleted, (byte) 1) |
| | | ); |
| | | |
| | | LambdaUpdateWrapper<ApprovalInstanceNode> nodeUpdateWrapper = Wrappers.lambdaUpdate(); |
| | | nodeUpdateWrapper.in(ApprovalInstanceNode::getInstanceId, ids) |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .set(ApprovalInstanceNode::getDeleted, (byte) 1); |
| | | approvalInstanceNodeService.update(nodeUpdateWrapper); |
| | | |
| | | LambdaUpdateWrapper<ApprovalTask> taskUpdateWrapper = Wrappers.lambdaUpdate(); |
| | | taskUpdateWrapper.in(ApprovalTask::getInstanceId, ids) |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .set(ApprovalTask::getDeleted, (byte) 1); |
| | | approvalTaskService.update(taskUpdateWrapper); |
| | | |
| | | LambdaUpdateWrapper<ApprovalRecord> recordUpdateWrapper = Wrappers.lambdaUpdate(); |
| | | recordUpdateWrapper.in(ApprovalRecord::getInstanceId, ids) |
| | | .eq(ApprovalRecord::getDeleted, 0) |
| | | .set(ApprovalRecord::getDeleted, (byte) 1); |
| | | approvalRecordService.update(recordUpdateWrapper); |
| | | |
| | | return instanceRows > 0; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R approve(ApprovalInstanceDto approvalInstanceDto) { |
| | | if (approvalInstanceDto == null || approvalInstanceDto.getId() == null) { |
| | | return R.fail("审æ¹å®ä¾ ID ä¸è½ä¸ºç©º"); |
| | | } |
| | | String approveAction = normalizeApproveAction(approvalInstanceDto.getApproveAction()); |
| | | if (approveAction == null) { |
| | | return R.fail("审æ¹å¨ä½åªæ¯æ APPROVED æ REJECTED"); |
| | | } |
| | | |
| | | ApprovalInstance instance = getPendingApprovalInstance(approvalInstanceDto.getId()); |
| | | if (instance == null) { |
| | | return R.fail("审æ¹å®ä¾ä¸åå¨"); |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = approveProcessConfigNodeUtils.getCurrentNode(instance.getId()); |
| | | if (currentNode == null) { |
| | | return R.fail("å½å没æå¾
å¤çç审æ¹èç¹"); |
| | | } |
| | | |
| | | Long currentUserId = SecurityUtils.getUserId(); |
| | | ApprovalTask currentTask = approveProcessConfigNodeUtils.getCurrentUserTask(instance.getId(), currentUserId); |
| | | if (currentTask == null) { |
| | | return R.fail("å½åç¨æ·æ²¡æå¯å®¡æ¹ä»»å¡"); |
| | | } |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String operatorName = loginUser.getUser() != null ? loginUser.getUser().getNickName() : SecurityUtils.getUsername(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | if (!updateCurrentTask(approvalInstanceDto, approveAction, currentTask, now)) { |
| | | return R.fail("å½åä»»å¡å·²è¢«å¤çï¼è¯·å·æ°åéè¯"); |
| | | } |
| | | |
| | | saveApprovalRecord( |
| | | instance.getId(), |
| | | currentNode.getId(), |
| | | currentTask.getId(), |
| | | currentUserId, |
| | | operatorName, |
| | | approveAction, |
| | | approvalInstanceDto.getApproveComment() |
| | | ); |
| | | //å®¡æ¹æç»çå¤ç |
| | | if ("REJECTED".equals(approveAction)) { |
| | | return rejectCurrentNode(instance, currentNode, now); |
| | | } |
| | | if (!approveProcessConfigNodeUtils.canProceedToNextLevel(instance.getId(), currentNode.getApproveType())) { |
| | | return R.ok("å®¡æ¹æåï¼çå¾
å
¶ä»å®¡æ¹äººå¤ç"); |
| | | } |
| | | |
| | | return approveAndMoveNext(instance, currentNode, approvalInstanceDto, now); |
| | | } |
| | | |
| | | private String normalizeApproveAction(String approveAction) { |
| | | if (!StringUtils.hasText(approveAction)) { |
| | | return null; |
| | | } |
| | | String normalizedAction = approveAction.trim().toUpperCase(Locale.ROOT); |
| | | return "APPROVED".equals(normalizedAction) || "REJECTED".equals(normalizedAction) |
| | | ? normalizedAction |
| | | : null; |
| | | } |
| | | |
| | | private ApprovalInstance getPendingApprovalInstance(Long instanceId) { |
| | | return this.getOne( |
| | | new LambdaQueryWrapper<ApprovalInstance>() |
| | | .eq(ApprovalInstance::getId, instanceId) |
| | | .eq(ApprovalInstance::getDeleted, 0) |
| | | .last("LIMIT 1") |
| | | ); |
| | | } |
| | | |
| | | private boolean updateCurrentTask(ApprovalInstanceDto approvalInstanceDto, |
| | | String approveAction, |
| | | ApprovalTask currentTask, |
| | | LocalDateTime now) { |
| | | // ä»
å
许å¾
审æ¹ä»»å¡è¢«æåå¤ç䏿¬¡ï¼é¿å
å¹¶åä¸éå¤å®¡æ¹æåã |
| | | return approvalTaskService.update( |
| | | Wrappers.<ApprovalTask>lambdaUpdate() |
| | | .eq(ApprovalTask::getId, currentTask.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .set(ApprovalTask::getTaskStatus, approveAction) |
| | | .set(ApprovalTask::getComment, approvalInstanceDto.getApproveComment()) |
| | | .set(ApprovalTask::getApproveTime, now) |
| | | .set(ApprovalTask::getIsRead, (byte) 1) |
| | | ); |
| | | } |
| | | |
| | | private R rejectCurrentNode(ApprovalInstance instance, ApprovalInstanceNode currentNode, LocalDateTime now) { |
| | | if (!updateCurrentNodeStatus(currentNode.getId(), "REJECTED", now)) { |
| | | return R.ok("å½åèç¹å·²å¤ç宿"); |
| | | } |
| | | |
| | | closePendingTasks(instance.getId(), currentNode.getId()); |
| | | instance.setStatus("REJECTED"); |
| | | instance.setFinishTime(now); |
| | | this.updateById(instance); |
| | | // 驳å对åºçä¼ä¸æ°é»ï¼ å·®æ
æ¥é |
| | | if (instance.getBusinessType().equals(TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode())) { |
| | | enterpriseNewsMapper.update( |
| | | new LambdaUpdateWrapper<EnterpriseNews>() |
| | | .eq(EnterpriseNews::getId, instance.getBusinessId()) |
| | | .set(EnterpriseNews::getStatus, "REJECTED") |
| | | ); |
| | | }else if (instance.getBusinessType().equals(TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode())||instance.getBusinessType().equals(TypeEnums.EXPENSE_APPROVAL.getCode())) { |
| | | finReimbursementMapper.update( |
| | | new LambdaUpdateWrapper<FinReimbursement>() |
| | | .eq(FinReimbursement::getId, instance.getBusinessId()) |
| | | .set(FinReimbursement::getBillStatus, "REJECTED") |
| | | ); |
| | | } |
| | | return R.ok("审æ¹å·²é©³å"); |
| | | } |
| | | |
| | | private R approveAndMoveNext(ApprovalInstance instance, |
| | | ApprovalInstanceNode currentNode, |
| | | ApprovalInstanceDto approvalInstanceDto, |
| | | LocalDateTime now) { |
| | | if (!updateCurrentNodeStatus(currentNode.getId(), "APPROVED", now)) { |
| | | return R.ok("å½åèç¹å·²å¤ç宿"); |
| | | } |
| | | |
| | | closePendingTasks(instance.getId(), currentNode.getId()); |
| | | |
| | | int nextLevel = currentNode.getLevelNo() + 1; |
| | | ApprovalInstanceNode nextInstanceNode = approvalInstanceNodeService.getOne( |
| | | new LambdaQueryWrapper<ApprovalInstanceNode>() |
| | | .eq(ApprovalInstanceNode::getInstanceId, instance.getId()) |
| | | .eq(ApprovalInstanceNode::getLevelNo, nextLevel) |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .orderByAsc(ApprovalInstanceNode::getId) |
| | | .last("LIMIT 1") |
| | | ); |
| | | |
| | | if (nextInstanceNode != null) { |
| | | if (!activateNextInstanceNode(nextInstanceNode.getId(), now)) { |
| | | return R.ok("ä¸ä¸å®¡æ¹èç¹å·²è¢«æ¿æ´»ï¼è¯·å·æ°åéè¯"); |
| | | } |
| | | instance.setCurrentLevel(nextLevel); |
| | | instance.setStatus("PENDING"); |
| | | this.updateById(instance); |
| | | List<ApprovalTask> nextTasks = approvalTaskService.list( |
| | | Wrappers.<ApprovalTask>lambdaQuery() |
| | | .eq(ApprovalTask::getInstanceId, instance.getId()) |
| | | .eq(ApprovalTask::getNodeId, nextInstanceNode.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | ); |
| | | sendApproveNotice(instance, nextTasks); |
| | | return R.ok("å®¡æ¹æåï¼å·²æµè½¬å°ä¸ä¸èç¹"); |
| | | } |
| | | |
| | | ApprovalTemplateNode nextTemplateNode = approvalTemplateNodeService.getOne( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .eq(ApprovalTemplateNode::getTemplateId, instance.getTemplateId()) |
| | | .eq(ApprovalTemplateNode::getLevelNo, nextLevel) |
| | | .orderByAsc(ApprovalTemplateNode::getId) |
| | | .last("LIMIT 1") |
| | | ); |
| | | |
| | | if (nextTemplateNode == null) { |
| | | instance.setStatus("APPROVED"); |
| | | instance.setFinishTime(now); |
| | | this.updateById(instance); |
| | | handleBusinessAfterApprovalFinished(instance); |
| | | return R.ok("审æ¹å·²å®æ"); |
| | | } |
| | | |
| | | instance.setCurrentLevel(nextLevel); |
| | | instance.setStatus("PENDING"); |
| | | this.updateById(instance); |
| | | approveProcessConfigNodeUtils.createCurrentNodeAndTasks(instance, false); |
| | | sendApproveNotice(instance, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstanceDto.getId())); |
| | | return R.ok("å®¡æ¹æåï¼å·²æµè½¬å°ä¸ä¸èç¹"); |
| | | } |
| | | |
| | | private boolean activateNextInstanceNode(Long nodeId, LocalDateTime now) { |
| | | return approvalInstanceNodeService.update( |
| | | Wrappers.<ApprovalInstanceNode>lambdaUpdate() |
| | | .eq(ApprovalInstanceNode::getId, nodeId) |
| | | .eq(ApprovalInstanceNode::getStatus, "WAITING") |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .set(ApprovalInstanceNode::getStatus, "PENDING") |
| | | .set(ApprovalInstanceNode::getStartTime, now) |
| | | ); |
| | | } |
| | | |
| | | private boolean updateCurrentNodeStatus(Long nodeId, String targetStatus, LocalDateTime now) { |
| | | // ä»
å
许ä¸ä¸ªè¯·æ±å°å½åèç¹ä»å¾
å¤çæ¨è¿å°ç®æ ç¶æï¼é¿å
é夿µè½¬ã |
| | | return approvalInstanceNodeService.update( |
| | | Wrappers.<ApprovalInstanceNode>lambdaUpdate() |
| | | .eq(ApprovalInstanceNode::getId, nodeId) |
| | | .eq(ApprovalInstanceNode::getStatus, "PENDING") |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .set(ApprovalInstanceNode::getStatus, targetStatus) |
| | | .set(ApprovalInstanceNode::getFinishTime, now) |
| | | ); |
| | | } |
| | | |
| | | private void handleBusinessAfterApprovalFinished(ApprovalInstance instance) { |
| | | String status = instance.getStatus(); |
| | | Long businessType = instance.getBusinessType(); |
| | | if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(businessType)) { |
| | | handlePurchaseApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.QUOTATION_APPROVAL.getCode().equals(businessType)) { |
| | | handleSalesQuotationApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.SHIPPING_APPROVAL.getCode().equals(businessType)) { |
| | | handleShippingApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType) |
| | | || TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) { |
| | | handleReimbursementApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | // 驳å对åºçä¼ä¸æ°é»ãå çç³è¯·ã请åç³è¯·å¯ä»¥éæ°åæäº¤ |
| | | if (TypeEnums.LEAVE_APPROVAL.getCode().equals(businessType) |
| | | || TypeEnums.OVERTIME_APPROVAL.getCode().equals(businessType)) { |
| | | handleHolidayApplicationApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode().equals(businessType)) { |
| | | handleNewsApprovalFinished(instance, status); |
| | | } |
| | | } |
| | | |
| | | private void handleReimbursementApprovalFinished(ApprovalInstance instance, String status) { |
| | | if (instance == null || instance.getBusinessId() == null) { |
| | | return; |
| | | } |
| | | |
| | | FinReimbursement reimbursement = new FinReimbursement(); |
| | | reimbursement.setId(instance.getBusinessId()); |
| | | if ("APPROVED".equals(status)) { |
| | | reimbursement.setBillStatus("APPROVED"); |
| | | reimbursement.setApprovedTime(instance.getFinishTime()); |
| | | } else if ("REJECTED".equals(status)) { |
| | | reimbursement.setBillStatus("REJECTED"); |
| | | } else if ("PENDING".equals(status)) { |
| | | reimbursement.setBillStatus("IN_APPROVAL"); |
| | | } else { |
| | | return; |
| | | } |
| | | finReimbursementMapper.updateById(reimbursement); |
| | | } |
| | | |
| | | private void handleNewsApprovalFinished(ApprovalInstance instance, String status) { |
| | | if (instance == null || instance.getBusinessId() == null) { |
| | | return; |
| | | } |
| | | EnterpriseNews enterpriseNews = new EnterpriseNews(); |
| | | enterpriseNews.setId(instance.getBusinessId()); |
| | | if ("APPROVED".equals(status)) { |
| | | enterpriseNews.setStatus(ENTERPRISE_NEWS_STATUS_PUBLISHED); |
| | | enterpriseNewsMapper.updateById(enterpriseNews); |
| | | sendEnterpriseNewsNotice(instance.getBusinessId()); |
| | | return; |
| | | } |
| | | if ("REJECTED".equals(status)) { |
| | | enterpriseNews.setStatus(ENTERPRISE_NEWS_STATUS_REJECTED); |
| | | enterpriseNewsMapper.updateById(enterpriseNews); |
| | | } |
| | | } |
| | | |
| | | private void handleHolidayApplicationApprovalFinished(ApprovalInstance instance, String status) { |
| | | if (instance == null || instance.getBusinessId() == null) { |
| | | return; |
| | | } |
| | | HolidayApplication holidayApplication = new HolidayApplication(); |
| | | holidayApplication.setId(instance.getBusinessId()); |
| | | if ("APPROVED".equals(status)) { |
| | | holidayApplication.setStatus("APPROVED"); |
| | | } else if ("REJECTED".equals(status)) { |
| | | holidayApplication.setStatus("REJECTED"); |
| | | } else if ("PENDING".equals(status)) { |
| | | holidayApplication.setStatus("PENDING"); |
| | | } else { |
| | | return; |
| | | } |
| | | holidayApplicationMapper.updateById(holidayApplication); |
| | | } |
| | | |
| | | private void handlePurchaseApprovalFinished(ApprovalInstance instance, String status) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne( |
| | | new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getId, instance.getBusinessId()) |
| | | .last("limit 1") |
| | | ); |
| | | if (purchaseLedger == null) { |
| | | return; |
| | | } |
| | | |
| | | if ("APPROVED".equals(status)) { |
| | | purchaseLedger.setApprovalStatus(ApprovalStatusEnum.APPROVED.getCode()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList( |
| | | new QueryWrapper<SalesLedgerProduct>().lambda() |
| | | .eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()) |
| | | .eq(SalesLedgerProduct::getType, 2) |
| | | ); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | qualityInspectHelper.addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | stockUtils.addStockWithBatchNo( |
| | | salesLedgerProduct.getProductModelId(), |
| | | salesLedgerProduct.getQuantity(), |
| | | StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), |
| | | purchaseLedger.getId(), |
| | | purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId() |
| | | ); |
| | | } |
| | | } |
| | | } else if ("REJECTED".equals(status)) { |
| | | purchaseLedger.setApprovalStatus(ApprovalStatusEnum.REJECTED.getCode()); |
| | | } else if ("PENDING".equals(status)) { |
| | | purchaseLedger.setApprovalStatus(ApprovalStatusEnum.IN_PROGRESS.getCode()); |
| | | } |
| | | purchaseLedgerMapper.updateById(purchaseLedger); |
| | | } |
| | | |
| | | private void handleSalesQuotationApprovalFinished(ApprovalInstance instance, String status) { |
| | | SalesQuotation salesQuote = salesQuotationMapper.selectOne( |
| | | new LambdaQueryWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getId, instance.getBusinessId()) |
| | | .last("limit 1") |
| | | ); |
| | | if (salesQuote == null) { |
| | | return; |
| | | } |
| | | |
| | | if ("APPROVED".equals(status)) { |
| | | salesQuote.setStatus(SalesQuotationStatusEnum.APPROVED.getCode()); |
| | | } else if ("REJECTED".equals(status)) { |
| | | salesQuote.setStatus(SalesQuotationStatusEnum.REJECTED.getCode()); |
| | | } else if ("PENDING".equals(status)) { |
| | | salesQuote.setStatus(SalesQuotationStatusEnum.IN_PROGRESS.getCode()); |
| | | } |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | |
| | | private void handleShippingApprovalFinished(ApprovalInstance instance, String status) { |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne( |
| | | new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getId, instance.getTitle()) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1") |
| | | ); |
| | | if (shippingInfo == null) { |
| | | return; |
| | | } |
| | | |
| | | if ("APPROVED".equals(status)) { |
| | | shippingInfo.setStatus(ShippingStatusEnum.APPROVED.getCode()); |
| | | shippingInfo.setShippingDate(new Date()); |
| | | stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId()); |
| | | } else if ("REJECTED".equals(status)) { |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | shippingInfo.setStatus(ShippingStatusEnum.REJECTED.getCode()); |
| | | } else if ("PENDING".equals(status)) { |
| | | shippingInfo.setStatus(ShippingStatusEnum.IN_PROGRESS.getCode()); |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | |
| | | private List<ApprovalTask> createNodeAndTasks(ApprovalInstance instance, ApprovalTemplateNode templateNode) { |
| | | List<ApprovalTemplateNodeApprover> approvers = approvalTemplateNodeApproverMapper.selectList( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .eq(ApprovalTemplateNodeApprover::getTemplateId, instance.getTemplateId()) |
| | | .eq(ApprovalTemplateNodeApprover::getNodeId, templateNode.getId()) |
| | | .eq(ApprovalTemplateNodeApprover::getDeleted, 0L) |
| | | .orderByAsc(ApprovalTemplateNodeApprover::getSortNo) |
| | | ); |
| | | if (approvers == null || approvers.isEmpty()) { |
| | | throw new RuntimeException("ä¸ä¸å®¡æ¹èç¹æªé
置审æ¹äºº"); |
| | | } |
| | | |
| | | ApprovalInstanceNode instanceNode = new ApprovalInstanceNode(); |
| | | instanceNode.setInstanceId(instance.getId()); |
| | | instanceNode.setLevelNo(templateNode.getLevelNo()); |
| | | instanceNode.setApproveType(templateNode.getApproveType()); |
| | | instanceNode.setStatus("PENDING"); |
| | | instanceNode.setStartTime(LocalDateTime.now()); |
| | | instanceNode.setDeleted((byte) 0); |
| | | approvalInstanceNodeService.save(instanceNode); |
| | | |
| | | List<ApprovalTask> taskList = new ArrayList<>(approvers.size()); |
| | | for (ApprovalTemplateNodeApprover approver : approvers) { |
| | | ApprovalTask task = new ApprovalTask(); |
| | | task.setInstanceId(instance.getId()); |
| | | task.setNodeId(instanceNode.getId()); |
| | | task.setLevelNo(instanceNode.getLevelNo()); |
| | | task.setApproverId(approver.getApproverId()); |
| | | task.setApproverName(approver.getApproverName()); |
| | | task.setTaskStatus("PENDING"); |
| | | task.setIsRead((byte) 0); |
| | | task.setDeleted((byte) 0); |
| | | taskList.add(task); |
| | | } |
| | | approvalTaskService.saveBatch(taskList); |
| | | return taskList; |
| | | } |
| | | |
| | | private void sendApproveNotice(ApprovalInstance instance, List<ApprovalTask> tasks) { |
| | | if (instance == null || tasks == null || tasks.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | List<Long> approverIds = tasks.stream() |
| | | .map(ApprovalTask::getApproverId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (approverIds.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | String title = StringUtils.hasText(instance.getTemplateName()) ? instance.getTemplateName() : "å®¡æ¹æé"; |
| | | String message = "审æ¹åå· " + instance.getInstanceNo() + " éè¦æ¨å®¡æ¹"; |
| | | String jumpPath = "/officeProcessAutomation/ApproveManage/approve-list?id=" + instance.getId(); |
| | | sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath); |
| | | } |
| | | |
| | | private void sendEnterpriseNewsNotice(Long newsId) { |
| | | EnterpriseNews enterpriseNews = enterpriseNewsMapper.selectById(newsId); |
| | | if (enterpriseNews == null) { |
| | | return; |
| | | } |
| | | List<Long> userIds = getEnterpriseNewsNoticeUserIds(enterpriseNews); |
| | | if (userIds == null || userIds.isEmpty()) { |
| | | return; |
| | | } |
| | | String title = "ä¼ä¸æ°é»"; |
| | | String message = "æ¨ææ°çä¼ä¸æ°é»ã" + enterpriseNews.getTitle() + "ãè¯·åæ¶æ¥é
"; |
| | | String jumpPath = "/officeProcessAutomation/EnterpriseNews?id=" + newsId; |
| | | sysNoticeService.simpleNoticeByUser(title, message, userIds, jumpPath); |
| | | } |
| | | |
| | | private List<Long> getEnterpriseNewsNoticeUserIds(EnterpriseNews enterpriseNews) { |
| | | if (enterpriseNews == null || !org.springframework.util.StringUtils.hasText(enterpriseNews.getReadScope())) { |
| | | return Collections.emptyList(); |
| | | } |
| | | String readScope = enterpriseNews.getReadScope().trim(); |
| | | if ("all".equals(readScope)) { |
| | | return sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getUserId) |
| | | .eq(SysUser::getDelFlag, "0")) |
| | | .stream() |
| | | .map(SysUser::getUserId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if ("dept".equals(readScope)) { |
| | | List<Long> deptIds = enterpriseNewsScopeDeptMapper.selectList( |
| | | new LambdaQueryWrapper<EnterpriseNewsScopeDept>() |
| | | .eq(EnterpriseNewsScopeDept::getNewsId, enterpriseNews.getId())) |
| | | .stream() |
| | | .map(EnterpriseNewsScopeDept::getDeptId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (deptIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return sysUserDeptMapper.selectDistinctUserIdsByDeptIds(collectDeptIdsWithChildren(deptIds)); |
| | | } |
| | | if ("custom".equals(readScope)) { |
| | | return enterpriseNewsScopeUserMapper.selectList( |
| | | new LambdaQueryWrapper<EnterpriseNewsScopeUser>() |
| | | .eq(EnterpriseNewsScopeUser::getNewsId, enterpriseNews.getId())) |
| | | .stream() |
| | | .map(EnterpriseNewsScopeUser::getUserId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | private List<Long> collectDeptIdsWithChildren(List<Long> deptIds) { |
| | | Set<Long> allDeptIds = new LinkedHashSet<>(); |
| | | for (Long deptId : deptIds) { |
| | | if (deptId == null) { |
| | | continue; |
| | | } |
| | | allDeptIds.add(deptId); |
| | | List<SysDept> children = sysDeptMapper.selectChildrenDeptById(deptId); |
| | | if (children != null && !children.isEmpty()) { |
| | | for (SysDept child : children) { |
| | | if (child != null && child.getDeptId() != null) { |
| | | allDeptIds.add(child.getDeptId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return new ArrayList<>(allDeptIds); |
| | | } |
| | | |
| | | private void closePendingTasks(Long instanceId, Long nodeId) { |
| | | LambdaUpdateWrapper<ApprovalTask> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, nodeId) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .set(ApprovalTask::getDeleted, (byte) 1); |
| | | approvalTaskService.update(updateWrapper); |
| | | } |
| | | |
| | | private void saveApprovalRecord(Long instanceId, |
| | | Long nodeId, |
| | | Long taskId, |
| | | Long operatorId, |
| | | String operatorName, |
| | | String action, |
| | | String comment) { |
| | | ApprovalRecord record = new ApprovalRecord(); |
| | | record.setInstanceId(instanceId); |
| | | record.setNodeId(nodeId); |
| | | record.setTaskId(taskId); |
| | | record.setOperatorId(operatorId); |
| | | record.setOperatorName(operatorName); |
| | | record.setAction(action); |
| | | record.setComment(comment); |
| | | record.setDeleted((byte) 0); |
| | | approvalRecordService.save(record); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalRecord; |
| | | import com.ruoyi.approve.mapper.ApprovalRecordMapper; |
| | | import com.ruoyi.approve.service.ApprovalRecordService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹è®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:28:21 |
| | | */ |
| | | @Service |
| | | public class ApprovalRecordServiceImpl extends ServiceImpl<ApprovalRecordMapper, ApprovalRecord> implements ApprovalRecordService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import com.ruoyi.approve.mapper.ApprovalTaskMapper; |
| | | import com.ruoyi.approve.service.ApprovalTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 审æ¹ä»»å¡è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 03:32:37 |
| | | */ |
| | | @Service |
| | | public class ApprovalTaskServiceImpl extends ServiceImpl<ApprovalTaskMapper, ApprovalTask> implements ApprovalTaskService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹å®¡æ¹äººè¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:30 |
| | | */ |
| | | @Service |
| | | public class ApprovalTemplateNodeApproverServiceImpl extends ServiceImpl<ApprovalTemplateNodeApproverMapper, ApprovalTemplateNodeApprover> implements ApprovalTemplateNodeApproverService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeApproverDto; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateNodeMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿èç¹è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-18 11:20:19 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApprovalTemplateNodeServiceImpl extends ServiceImpl<ApprovalTemplateNodeMapper, ApprovalTemplateNode> implements ApprovalTemplateNodeService { |
| | | |
| | | private final ApprovalTemplateNodeMapper approvalTemplateNodeMapper; |
| | | private final ApprovalTemplateNodeApproverService approvalTemplateNodeApproverService; |
| | | @Override |
| | | public Boolean saveApprovalTemplateNode(Long templateId, List<ApprovalTemplateNodeDto> nodes) { |
| | | if (nodes == null || nodes.isEmpty()) { |
| | | throw new RuntimeException("èç¹å表ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<ApprovalTemplateNodeApprover> approverList = new ArrayList<>(); |
| | | |
| | | for (ApprovalTemplateNodeDto nodeDto : nodes) { |
| | | ApprovalTemplateNode node = new ApprovalTemplateNode(); |
| | | BeanUtils.copyProperties(nodeDto, node); |
| | | node.setTemplateId(templateId); |
| | | approvalTemplateNodeMapper.insert(node); |
| | | |
| | | List<ApprovalTemplateNodeApproverDto> approvers = nodeDto.getApprovers(); |
| | | if (approvers == null || approvers.isEmpty()) { |
| | | throw new RuntimeException("èç¹å®¡æ¹äººä¸è½ä¸ºç©º"); |
| | | } |
| | | for (ApprovalTemplateNodeApproverDto approverDto : approvers) { |
| | | ApprovalTemplateNodeApprover approver = new ApprovalTemplateNodeApprover(); |
| | | BeanUtils.copyProperties(approverDto, approver); |
| | | approver.setNodeId(node.getId()); |
| | | approver.setTemplateId(templateId); |
| | | approver.setDeleted(0L); |
| | | approverList.add(approver); |
| | | } |
| | | } |
| | | approvalTemplateNodeApproverService.saveBatch(approverList); |
| | | return true; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateDto; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateNodeApproverVo; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateNodeVo; |
| | | import com.ruoyi.approve.bean.vo.ApprovalTemplateVo; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateMapper; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeService; |
| | | import com.ruoyi.approve.service.ApprovalTemplateService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¡æ¹æ¨¡æ¿æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @since 2026-05-18 11:20:08 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApprovalTemplateServiceImpl extends ServiceImpl<ApprovalTemplateMapper, ApprovalTemplate> implements ApprovalTemplateService { |
| | | |
| | | private final ApprovalTemplateMapper approvalTemplateMapper; |
| | | private final ApprovalTemplateNodeService approvalTemplateNodeService; |
| | | private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper; |
| | | |
| | | @Override |
| | | public IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto) { |
| | | IPage<ApprovalTemplateVo> approvalTemplateVoIPage = approvalTemplateMapper.listPage(page, approvalTemplateDto); |
| | | fillTemplateVoNodes(approvalTemplateVoIPage.getRecords()); |
| | | return approvalTemplateVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean saveApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto) { |
| | | approvalTemplateMapper.insert(approvalTemplateDto); |
| | | approvalTemplateNodeService.remove( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .eq(ApprovalTemplateNode::getTemplateId, approvalTemplateDto.getId()) |
| | | ); |
| | | approvalTemplateNodeApproverMapper.delete( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .eq(ApprovalTemplateNodeApprover::getTemplateId, approvalTemplateDto.getId()) |
| | | ); |
| | | return approvalTemplateNodeService.saveApprovalTemplateNode( |
| | | approvalTemplateDto.getId(), |
| | | approvalTemplateDto.getNodes() |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto) { |
| | | approvalTemplateMapper.updateById(approvalTemplateDto); |
| | | approvalTemplateNodeService.remove( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .eq(ApprovalTemplateNode::getTemplateId, approvalTemplateDto.getId()) |
| | | ); |
| | | approvalTemplateNodeApproverMapper.delete( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .eq(ApprovalTemplateNodeApprover::getTemplateId, approvalTemplateDto.getId()) |
| | | ); |
| | | return approvalTemplateNodeService.saveApprovalTemplateNode( |
| | | approvalTemplateDto.getId(), |
| | | approvalTemplateDto.getNodes() |
| | | ); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean delete(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return false; |
| | | } |
| | | ApprovalTemplate updateEntity = new ApprovalTemplate(); |
| | | updateEntity.setDeleted(1); |
| | | LambdaUpdateWrapper<ApprovalTemplate> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.in(ApprovalTemplate::getId, ids) |
| | | .eq(ApprovalTemplate::getDeleted, 0); |
| | | |
| | | int rows = approvalTemplateMapper.update(updateEntity, updateWrapper); |
| | | return rows == ids.size(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApprovalTemplateVo> listApprovalTemplateVo(Integer type) { |
| | | List<ApprovalTemplate> templateList = this.list( |
| | | new LambdaQueryWrapper<ApprovalTemplate>() |
| | | .eq(ApprovalTemplate::getDeleted, 0) |
| | | .eq(ApprovalTemplate::getEnabled, 1) |
| | | .orderByDesc(ApprovalTemplate::getTemplateType) |
| | | .orderByDesc(ApprovalTemplate::getId) |
| | | ); |
| | | if (CollUtil.isEmpty(templateList)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | List<ApprovalTemplateVo> templateVos = templateList.stream() |
| | | .map(template -> { |
| | | ApprovalTemplateVo templateVo = new ApprovalTemplateVo(); |
| | | BeanUtils.copyProperties(template, templateVo); |
| | | return templateVo; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | fillTemplateVoNodes(templateVos); |
| | | return templateVos; |
| | | } |
| | | |
| | | @Override |
| | | public ApprovalTemplateVo getApprovalTemplateVoById(Long id) { |
| | | if (id == null) { |
| | | throw new IllegalArgumentException("åæ° id ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | ApprovalTemplate template = this.getOne( |
| | | new LambdaQueryWrapper<ApprovalTemplate>() |
| | | .eq(ApprovalTemplate::getId, id) |
| | | .eq(ApprovalTemplate::getDeleted, 0) |
| | | ); |
| | | if (template == null) { |
| | | throw new IllegalArgumentException("模æ¿ä¸åå¨"); |
| | | } |
| | | |
| | | List<ApprovalTemplateNode> nodeList = approvalTemplateNodeService.list( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .eq(ApprovalTemplateNode::getTemplateId, id) |
| | | .orderByAsc(ApprovalTemplateNode::getLevelNo) |
| | | ); |
| | | |
| | | List<ApprovalTemplateNodeApprover> approverList = approvalTemplateNodeApproverMapper.selectList( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .eq(ApprovalTemplateNodeApprover::getTemplateId, id) |
| | | .eq(ApprovalTemplateNodeApprover::getDeleted, 0L) |
| | | ); |
| | | |
| | | Map<Long, List<ApprovalTemplateNode>> nodeMap = nodeList.stream() |
| | | .collect(Collectors.groupingBy(ApprovalTemplateNode::getTemplateId)); |
| | | |
| | | Map<Long, List<ApprovalTemplateNodeApprover>> approverMap = approverList.stream() |
| | | .collect(Collectors.groupingBy(ApprovalTemplateNodeApprover::getNodeId)); |
| | | |
| | | return buildTemplateVo(template, nodeMap, approverMap); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå¡«å
模æ¿èç¹åèç¹å®¡æ¹äººï¼é¿å
å¾ªç¯æ¥åºã |
| | | */ |
| | | private void fillTemplateVoNodes(List<ApprovalTemplateVo> templateVos) { |
| | | if (CollUtil.isEmpty(templateVos)) { |
| | | return; |
| | | } |
| | | |
| | | List<Long> templateIds = templateVos.stream() |
| | | .map(ApprovalTemplateVo::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<ApprovalTemplateNode> nodeList = approvalTemplateNodeService.list( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .in(ApprovalTemplateNode::getTemplateId, templateIds) |
| | | .orderByAsc(ApprovalTemplateNode::getLevelNo) |
| | | ); |
| | | |
| | | List<ApprovalTemplateNodeApprover> approverList = approvalTemplateNodeApproverMapper.selectList( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .in(ApprovalTemplateNodeApprover::getTemplateId, templateIds) |
| | | .eq(ApprovalTemplateNodeApprover::getDeleted, 0L) |
| | | ); |
| | | |
| | | Map<Long, List<ApprovalTemplateNode>> nodeMap = nodeList.stream() |
| | | .collect(Collectors.groupingBy(ApprovalTemplateNode::getTemplateId)); |
| | | |
| | | Map<Long, List<ApprovalTemplateNodeApprover>> approverMap = approverList.stream() |
| | | .collect(Collectors.groupingBy(ApprovalTemplateNodeApprover::getNodeId)); |
| | | |
| | | templateVos.forEach(templateVo -> templateVo.setNodes( |
| | | nodeMap.getOrDefault(templateVo.getId(), Collections.emptyList()) |
| | | .stream() |
| | | .sorted(Comparator.comparing( |
| | | ApprovalTemplateNode::getLevelNo, |
| | | Comparator.nullsLast(Integer::compareTo) |
| | | )) |
| | | .map(node -> buildNodeVo(node, approverMap)) |
| | | .collect(Collectors.toList()) |
| | | )); |
| | | } |
| | | |
| | | private ApprovalTemplateVo buildTemplateVo(ApprovalTemplate template, |
| | | Map<Long, List<ApprovalTemplateNode>> nodeMap, |
| | | Map<Long, List<ApprovalTemplateNodeApprover>> approverMap) { |
| | | ApprovalTemplateVo templateVo = new ApprovalTemplateVo(); |
| | | BeanUtils.copyProperties(template, templateVo); |
| | | |
| | | List<ApprovalTemplateNodeVo> nodeVos = nodeMap |
| | | .getOrDefault(template.getId(), Collections.emptyList()) |
| | | .stream() |
| | | .sorted(Comparator.comparing( |
| | | ApprovalTemplateNode::getLevelNo, |
| | | Comparator.nullsLast(Integer::compareTo) |
| | | )) |
| | | .map(node -> buildNodeVo(node, approverMap)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | templateVo.setNodes(nodeVos); |
| | | return templateVo; |
| | | } |
| | | |
| | | private ApprovalTemplateNodeVo buildNodeVo(ApprovalTemplateNode node, |
| | | Map<Long, List<ApprovalTemplateNodeApprover>> approverMap) { |
| | | ApprovalTemplateNodeVo nodeVo = new ApprovalTemplateNodeVo(); |
| | | BeanUtils.copyProperties(node, nodeVo); |
| | | |
| | | List<ApprovalTemplateNodeApproverVo> approverVos = approverMap |
| | | .getOrDefault(node.getId(), Collections.emptyList()) |
| | | .stream() |
| | | .sorted(Comparator.comparing( |
| | | ApprovalTemplateNodeApprover::getSortNo, |
| | | Comparator.nullsLast(Integer::compareTo) |
| | | )) |
| | | .map(this::buildApproverVo) |
| | | .collect(Collectors.toList()); |
| | | |
| | | nodeVo.setApprovers(approverVos); |
| | | return nodeVo; |
| | | } |
| | | |
| | | private ApprovalTemplateNodeApproverVo buildApproverVo(ApprovalTemplateNodeApprover approver) { |
| | | ApprovalTemplateNodeApproverVo approverVo = new ApprovalTemplateNodeApproverVo(); |
| | | BeanUtils.copyProperties(approver, approverVo); |
| | | return approverVo; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardParamMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApproveBusinessStatusService { |
| | | |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | | /** |
| | | * ç»ä¸åæ¥å®¡æ¹ç»æå¯¹åºçä¸å¡åæ®ç¶æã |
| | | * statusï¼1-å®¡æ ¸ä¸ï¼2-å®¡æ ¸å®æï¼3-å®¡æ ¸æªéè¿ã |
| | | */ |
| | | public void syncBusinessStatus(Integer approveType, String approveReason, Integer status) { |
| | | if (approveType == null || status == null || !StringUtils.hasText(approveReason)) { |
| | | return; |
| | | } |
| | | switch (approveType) { |
| | | case 5: |
| | | syncPurchaseStatus(approveReason, status); |
| | | break; |
| | | case 6: |
| | | syncSalesQuotationStatus(approveReason, status); |
| | | break; |
| | | case 7: |
| | | syncShippingStatus(approveReason, status); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // éè´å®¡æ¹éè¿æ¶ï¼æäº§åè´¨æ£é
ç½®å³å®çæè´¨æ£åæç´æ¥å
¥åºã |
| | | private void syncPurchaseStatus(String approveReason, Integer status) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveReason) |
| | | .last("limit 1")); |
| | | if (purchaseLedger == null) { |
| | | return; |
| | | } |
| | | if (status.equals(2)) { |
| | | purchaseLedger.setApprovalStatus(3); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | if (Boolean.TRUE.equals(salesLedgerProduct.getIsChecked())) { |
| | | addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | stockUtils.addStockWithBatchNo( |
| | | salesLedgerProduct.getProductModelId(), |
| | | salesLedgerProduct.getQuantity(), |
| | | StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), |
| | | purchaseLedger.getId(), |
| | | purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | | purchaseLedger.setApprovalStatus(4); |
| | | } else if (status.equals(1)) { |
| | | purchaseLedger.setApprovalStatus(2); |
| | | } else { |
| | | return; |
| | | } |
| | | purchaseLedgerMapper.updateById(purchaseLedger); |
| | | } |
| | | |
| | | // æ¥ä»·å®¡æ¹ç¶æååå°é宿¥ä»·åç¶æã |
| | | private void syncSalesQuotationStatus(String approveReason, Integer status) { |
| | | SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getQuotationNo, approveReason) |
| | | .last("limit 1")); |
| | | if (salesQuote == null) { |
| | | return; |
| | | } |
| | | if (status.equals(2)) { |
| | | salesQuote.setStatus("éè¿"); |
| | | } else if (status.equals(3)) { |
| | | salesQuote.setStatus("æç»"); |
| | | } else if (status.equals(1)) { |
| | | salesQuote.setStatus("å®¡æ ¸ä¸"); |
| | | } else { |
| | | return; |
| | | } |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | |
| | | // å货审æ¹éè¿æ¶åæ¥åè´§ç¶æååºåºå®¡æ¹ç¶æï¼æç»æ¶å é¤å¾
确认åºåºè®°å½ã |
| | | private void syncShippingStatus(String approveReason, Integer status) { |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, approveReason) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if (shippingInfo == null) { |
| | | return; |
| | | } |
| | | if (status.equals(2)) { |
| | | shippingInfo.setStatus("å®¡æ ¸éè¿"); |
| | | shippingInfo.setShippingDate(new Date()); |
| | | stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId()); |
| | | } else if (status.equals(3)) { |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | shippingInfo.setStatus("å®¡æ ¸æç»"); |
| | | } else if (status.equals(1)) { |
| | | shippingInfo.setStatus("å®¡æ ¸ä¸"); |
| | | } else { |
| | | return; |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | |
| | | // çæéè´è´¨æ£åï¼å¹¶æäº§åè´¨æ£æ ååå§åè´¨æ£åæ°ã |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getProductId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null); |
| | | if (qualityTestStandard.size() > 0) { |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId())) |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardParamMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final CommonFileMapper fileMapper; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ShippingProductDetailMapper shippingProductDetailMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final StockUtils stockUtils; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | private final ApproveBusinessStatusService approveBusinessStatusService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | |
| | |
| | | } |
| | | approveProcessMapper.updateById(approveProcess); |
| | | |
| | | //éè´å®¡æ ¸ |
| | | if (approveProcess.getApproveType().equals(5)) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcess.getApproveReason()) |
| | | .last("limit 1")); |
| | | if (purchaseLedger != null) { |
| | | if (status.equals(2)) { |
| | | // åæ |
| | | purchaseLedger.setApprovalStatus(3); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | // è´¨æ£ |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | | // æç» |
| | | purchaseLedger.setApprovalStatus(4); |
| | | } else if (status.equals(1)) { |
| | | // å®¡æ ¸ä¸ |
| | | purchaseLedger.setApprovalStatus(2); |
| | | } |
| | | purchaseLedgerMapper.updateById(purchaseLedger); |
| | | } |
| | | } |
| | | // é宿¥ä»·ç¶æä¿®æ¹ |
| | | if (approveProcess.getApproveType().equals(6)) { |
| | | SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getQuotationNo, approveProcess.getApproveReason()) |
| | | .last("limit 1")); |
| | | // åæ |
| | | if (status.equals(2) && salesQuote != null) { |
| | | salesQuote.setStatus("éè¿"); |
| | | } else if (status.equals(3) && salesQuote != null) { |
| | | salesQuote.setStatus("æç»"); |
| | | } else if (status.equals(1) && salesQuote != null) { |
| | | salesQuote.setStatus("å®¡æ ¸ä¸"); |
| | | } |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | // åºåºå®¡æ¹ä¿®æ¹=åè´§å®¡æ¹ |
| | | if (approveProcess.getApproveType().equals(7)) { |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, approveProcess.getApproveReason()) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if (shippingInfo != null) { |
| | | if (status.equals(2)) { |
| | | shippingInfo.setStatus("å®¡æ ¸éè¿"); |
| | | shippingInfo.setShippingDate(new Date()); |
| | | //æ´æ¹åºåºå®¡æ ¸ç¶æï¼å¾
ç¡®è®¤æ¹æå¾
å®¡æ ¸ï¼ |
| | | stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId()); |
| | | } else if (status.equals(3)) { |
| | | //å é¤åæ¬ï¼å¾
确认ï¼çåºåºå®¡æ ¸ç¶æ |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | shippingInfo.setStatus("å®¡æ ¸æç»"); |
| | | } else if (status.equals(1)) { |
| | | shippingInfo.setStatus("å®¡æ ¸ä¸"); |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | |
| | | } |
| | | approveBusinessStatusService.syncBusinessStatus(approveProcess.getApproveType(), approveProcess.getApproveReason(), status); |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_NODE, approveNode.getId(), approveNode.getStorageBlobDTOS()); |
| | | } |
| | | |
| | |
| | | return "åå
¬ç¨å审æ¹"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getProductId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null); |
| | | if (qualityTestStandard.size() > 0) { |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId())) |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApproveProcessServiceImpl extends ServiceImpl<ApproveProcessMapper, ApproveProcess> implements IApproveProcessService { |
| | | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final IApproveNodeService approveNodeService; |
| | | private final SysUserMapper sysUserMapper; |
| | |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveProcessConfigNodeService approveProcessConfigNodeService; |
| | | private final ApproveBusinessStatusService approveBusinessStatusService; |
| | | private final FileUtil fileUtil; |
| | | private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper; |
| | | |
| | |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(SecurityUtils.getLoginUser().getCurrentDeptId()); |
| | | List<ApproveProcessConfigNodeVo> list = approveProcessConfigNodeService.listNode(approveProcessVO.getApproveType()); |
| | | if (sysDept == null) throw new RuntimeException("é¨é¨ä¸åå¨"); |
| | | if (sysUser == null) throw new RuntimeException("ç³è¯·äººä¸åå¨"); |
| | | |
| | | List<ApproveProcessConfigNodeVo> list = Optional.ofNullable(approveProcessConfigNodeService.listNode(approveProcessVO.getApproveType())) |
| | | .orElse(Collections.emptyList()); |
| | | List<Long> nodeIds = list.stream() |
| | | .map(ApproveProcessConfigNodeVo::getApproverId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | // æ å®¡æ ¸äººé»è¾æ·»å |
| | | |
| | | // 审æ¹é
ç½®æ²¡æææå®¡æ ¸äººæ¶ï¼ä¸æ°å¢ååå®¡æ¹æµç¨ï¼ç´æ¥æ§è¡ä¸å¡å®¡æ ¸éè¿é»è¾ã |
| | | if (CollectionUtils.isEmpty(nodeIds)) { |
| | | autoPassPurchaseApproveIfNoApprover(approveProcessVO); // éè´åæ å®¡æ ¸äººé»è¾ |
| | | approveBusinessStatusService.syncBusinessStatus(approveProcessVO.getApproveType(), approveProcessVO.getApproveReason(), 2); |
| | | return; |
| | | } |
| | | |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(nodeIds); |
| | | if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | if (sysDept == null) throw new RuntimeException("é¨é¨ä¸åå¨"); |
| | | if (sysUser == null) throw new RuntimeException("ç³è¯·äººä¸åå¨"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id"); |
| | | approveProcess.setApproveId(no); |
| | | approveProcess.setApproveUser(sysUser.getUserId()); |
| | | approveProcess.setApproveUserName(sysUser.getNickName()); |
| | | approveProcess.setApproveDeptId(sysDept.getDeptId()); |
| | | approveProcess.setApproveUserIds(nodeIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveDeptName(sysDept.getDeptName()); |
| | | approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? new Date() : dateFormat.parse(approveProcessVO.getApproveTime())); |
| | | approveProcess.setApproveReason(approveProcessVO.getApproveReason()); |
| | | approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId()); |
| | | approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice()); |
| | | approveProcess.setPrice(approveProcessVO.getPrice()); |
| | | approveProcess.setStartDate(approveProcessVO.getStartDate()); |
| | | approveProcess.setEndDate(approveProcessVO.getEndDate()); |
| | | approveProcess.setApproveStatus(0); |
| | | approveProcess.setApproveDelete(0); |
| | | approveProcess.setApproveType(approveProcessVO.getApproveType()); |
| | | approveProcess.setCreateTime(LocalDateTime.now()); |
| | | approveProcess.setTenantId(approveProcessVO.getApproveDeptId()); |
| | | approveProcess.setApproveUserCurrentId(nodeIds.get(0)); |
| | | approveProcess.setApproveUserCurrentName(sysUsers |
| | | .stream() |
| | | .filter(SysUser -> SysUser.getUserId().equals(nodeIds.get(0))) |
| | | .collect(Collectors.toList()) |
| | | .get(0) |
| | | .getNickName()); |
| | | // è®¾ç½®ç¶æä¸ºéæ°æäº¤ |
| | | if (approveProcessVO.getId() != null) { |
| | | ApproveProcess approveProcess1 = approveProcessMapper.selectById(approveProcessVO.getId()); |
| | | approveProcess1.setApproveStatus(4); |
| | | approveProcessMapper.updateById(approveProcess1); |
| | | } |
| | | |
| | | // æå®¡æ ¸äººæ¶ï¼ææ£å¸¸ååå®¡æ¹æµç¨å建审æ¹ä¸»è¡¨ã审æ¹èç¹å¹¶éç¥é¦ä¸ªå®¡æ ¸äººã |
| | | ApproveProcess approveProcess = buildApproveProcess(approveProcessVO, sysUser, sysDept, nodeIds, sysUsers, 0); |
| | | markResubmitted(approveProcessVO); |
| | | save(approveProcess); |
| | | //åå§å审æ¹èç¹ |
| | | String nodeIdStr = nodeIds.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | approveNodeService.initApproveNodes(nodeIdStr, no, approveProcessVO.getApproveDeptId()); |
| | | approveNodeService.initApproveNodes(nodeIdStr, approveProcess.getApproveId(), approveProcessVO.getApproveDeptId()); |
| | | // éä»¶ç»å® |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOS()); |
| | | /*æ¶æ¯éç¥*/ |
| | |
| | | } |
| | | } |
| | | |
| | | private void autoPassPurchaseApproveIfNoApprover(ApproveProcessVO approveProcessVO) { |
| | | if (!Objects.equals(approveProcessVO.getApproveType(), 5) |
| | | || !StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | private ApproveProcess buildApproveProcess(ApproveProcessVO approveProcessVO, SysUser sysUser, SysDept sysDept, |
| | | List<Long> nodeIds, List<SysUser> sysUsers, Integer approveStatus) throws Exception { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id", approveProcess.getCreateTime() != null ? approveProcess.getCreateTime() : LocalDateTime.now()); |
| | | approveProcess.setApproveId(no); |
| | | approveProcess.setApproveUser(sysUser.getUserId()); |
| | | approveProcess.setApproveUserName(sysUser.getNickName()); |
| | | approveProcess.setApproveDeptId(sysDept.getDeptId()); |
| | | approveProcess.setApproveDeptName(sysDept.getDeptName()); |
| | | approveProcess.setApproveUserIds(nodeIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? new Date() : dateFormat.parse(approveProcessVO.getApproveTime())); |
| | | approveProcess.setApproveReason(approveProcessVO.getApproveReason()); |
| | | approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId()); |
| | | approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice()); |
| | | approveProcess.setPrice(approveProcessVO.getPrice()); |
| | | approveProcess.setStartDate(approveProcessVO.getStartDate()); |
| | | approveProcess.setEndDate(approveProcessVO.getEndDate()); |
| | | approveProcess.setStartDateTime(approveProcessVO.getStartDateTime()); |
| | | approveProcess.setEndDateTime(approveProcessVO.getEndDateTime()); |
| | | approveProcess.setApproveStatus(approveStatus); |
| | | approveProcess.setApproveDelete(0); |
| | | approveProcess.setApproveType(approveProcessVO.getApproveType()); |
| | | approveProcess.setCreateTime(LocalDateTime.now()); |
| | | approveProcess.setTenantId(approveProcessVO.getApproveDeptId()); |
| | | if (!CollectionUtils.isEmpty(nodeIds)) { |
| | | SysUser currentUser = sysUsers.stream() |
| | | .filter(user -> user.getUserId().equals(nodeIds.get(0))) |
| | | .findFirst() |
| | | .orElseThrow(() -> new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨")); |
| | | approveProcess.setApproveUserCurrentId(currentUser.getUserId()); |
| | | approveProcess.setApproveUserCurrentName(currentUser.getNickName()); |
| | | } |
| | | if (approveStatus.equals(2) || approveStatus.equals(3) || approveStatus.equals(4)) { |
| | | approveProcess.setApproveOverTime(new Date()); |
| | | } |
| | | return approveProcess; |
| | | } |
| | | |
| | | purchaseLedgerMapper.update(null, new LambdaUpdateWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason()) |
| | | .set(PurchaseLedger::getApprovalStatus, 3)); |
| | | //éè´å
¥åº |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason()) |
| | | .last("limit 1")); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(),purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | private void markResubmitted(ApproveProcessVO approveProcessVO) { |
| | | if (approveProcessVO.getId() == null) { |
| | | return; |
| | | } |
| | | ApproveProcess approveProcess = approveProcessMapper.selectById(approveProcessVO.getId()); |
| | | if (approveProcess == null) { |
| | | return; |
| | | } |
| | | approveProcess.setApproveStatus(4); |
| | | approveProcessMapper.updateById(approveProcess); |
| | | } |
| | | |
| | | @Override |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.FinReimbursementDetail; |
| | | import com.ruoyi.approve.mapper.FinReimbursementDetailMapper; |
| | | import com.ruoyi.approve.service.FinReimbursementDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éåæç»è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:38 |
| | | */ |
| | | @Service |
| | | public class FinReimbursementDetailServiceImpl extends ServiceImpl<FinReimbursementDetailMapper, FinReimbursementDetail> implements FinReimbursementDetailService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.bean.dto.ApprovalInstanceDto; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeApproverDto; |
| | | import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto; |
| | | import com.ruoyi.approve.bean.dto.FinReimbursementDto; |
| | | import com.ruoyi.approve.bean.vo.FinReimbursementVo; |
| | | import com.ruoyi.approve.mapper.ApprovalInstanceMapper; |
| | | import com.ruoyi.approve.mapper.FinReimbursementDetailMapper; |
| | | import com.ruoyi.approve.mapper.FinReimbursementMapper; |
| | | import com.ruoyi.approve.mapper.FinReimbursementTravelMapper; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.approve.service.*; |
| | | import com.ruoyi.common.enums.TypeEnums; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ¥éå主表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:15 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FinReimbursementServiceImpl extends ServiceImpl<FinReimbursementMapper, FinReimbursement> implements FinReimbursementService { |
| | | |
| | | private static final String BILL_STATUS_DRAFT = "DRAFT"; |
| | | private static final String BILL_STATUS_IN_APPROVAL = "IN_APPROVAL"; |
| | | private static final String NODE_STATUS_WAITING = "WAITING"; |
| | | |
| | | private final ApprovalInstanceMapper approvalInstanceMapper; |
| | | private final ApprovalInstanceService approvalInstanceService; |
| | | private final ApprovalInstanceNodeService approvalInstanceNodeService; |
| | | private final ApprovalTaskService approvalTaskService; |
| | | private final ApprovalRecordService approvalRecordService; |
| | | private final FinReimbursementMapper finReimbursementMapper; |
| | | private final FinReimbursementTravelMapper finReimbursementTravelMapper; |
| | | private final FinReimbursementDetailMapper finReimbursementDetailMapper; |
| | | private final FileUtil fileUtil; |
| | | private final ISysNoticeService sysNoticeService; |
| | | @Override |
| | | public IPage<FinReimbursementVo> listPage(FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page) { |
| | | IPage<FinReimbursementVo> finReimbursementVoIPage = finReimbursementMapper.listPage(finReimbursementDto, page); |
| | | finReimbursementVoIPage.getRecords().forEach(vo -> { |
| | | vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_REIMBURSEMENT, vo.getId())); |
| | | }); |
| | | |
| | | return finReimbursementVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(FinReimbursementDto finReimbursementDto) { |
| | | String billStatus = validateAddParam(finReimbursementDto); |
| | | |
| | | // çææ¥éåå· |
| | | String billNo = OrderUtils.countTodayByCreateTime(finReimbursementMapper, "BXD", "bill_no", finReimbursementDto.getCreateTime() != null ? finReimbursementDto.getCreateTime() : LocalDateTime.now()); |
| | | List<FinReimbursementDetail> details = finReimbursementDto.getDetails(); |
| | | BigDecimal totalAmount = details.stream() |
| | | .map(FinReimbursementDetail::getAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | FinReimbursement reimbursement = buildReimbursement(finReimbursementDto, billNo, totalAmount, billStatus); |
| | | // ä¿åæ¥éå主表 |
| | | boolean saved = this.save(reimbursement); |
| | | if (!saved || reimbursement.getId() == null) { |
| | | throw new ServiceException("æ°å¢æ¥éå失败"); |
| | | } |
| | | Long reimbursementId = reimbursement.getId(); |
| | | |
| | | // ä¿åå·®æ
æ¥éæ©å±ä¿¡æ¯ï¼æ¥éç±»å为差æ
æ¥éæ¶ï¼ |
| | | FinReimbursementTravel travel = finReimbursementDto.getTravel(); |
| | | if (isTravelReimbursement(finReimbursementDto.getReimbursementType())) { |
| | | travel.setReimbursementId(reimbursementId); |
| | | int travelRows = finReimbursementTravelMapper.insert(travel); |
| | | if (travelRows != 1) { |
| | | throw new ServiceException("æ°å¢å·®æ
æ¥éæ©å±ä¿¡æ¯å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | // ä¿åæ¥éåæç» |
| | | for (int i = 0; i < details.size(); i++) { |
| | | FinReimbursementDetail detail = details.get(i); |
| | | detail.setId(null); |
| | | detail.setReimbursementId(reimbursementId); |
| | | detail.setRowNo(i + 1); |
| | | int detailRows = finReimbursementDetailMapper.insert(detail); |
| | | if (detailRows != 1) { |
| | | throw new ServiceException("æ°å¢æ¥éåæç»å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) { |
| | | startApproval(reimbursement, finReimbursementDto); |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, reimbursementId, finReimbursementDto.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean update(FinReimbursementDto finReimbursementDto) { |
| | | String billStatus = validateUpdateParam(finReimbursementDto); |
| | | |
| | | Long reimbursementId = finReimbursementDto.getId(); |
| | | FinReimbursement existing = finReimbursementMapper.selectById(reimbursementId); |
| | | if (existing == null) { |
| | | throw new ServiceException("æ¥éåä¸åå¨"); |
| | | } |
| | | |
| | | // è®¡ç®æç»æ±æ»éé¢ |
| | | List<FinReimbursementDetail> details = finReimbursementDto.getDetails(); |
| | | BigDecimal totalAmount = details.stream() |
| | | .map(FinReimbursementDetail::getAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // æ´æ°ä¸»è¡¨ |
| | | FinReimbursement reimbursement = buildReimbursement( |
| | | finReimbursementDto, |
| | | existing.getBillNo(), |
| | | totalAmount, |
| | | billStatus |
| | | ); |
| | | reimbursement.setId(reimbursementId); |
| | | int mainRows = finReimbursementMapper.updateById(reimbursement); |
| | | if (mainRows != 1) { |
| | | throw new ServiceException("æ´æ°æ¥éå主表失败"); |
| | | } |
| | | |
| | | // æ¥è¯¢æ°æ®åºä¸å·²æçæç» |
| | | List<FinReimbursementDetail> existingDetails = finReimbursementDetailMapper.selectList( |
| | | new LambdaQueryWrapper<FinReimbursementDetail>() |
| | | .eq(FinReimbursementDetail::getReimbursementId, reimbursementId)); |
| | | Set<Long> existingDetailIds = existingDetails.stream() |
| | | .map(FinReimbursementDetail::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | // æ°æç»ä¸æIDç â æ´æ°ï¼æ IDç â æ°å¢ |
| | | Set<Long> submittedDetailIds = new HashSet<>(); |
| | | for (int i = 0; i < details.size(); i++) { |
| | | FinReimbursementDetail detail = details.get(i); |
| | | detail.setReimbursementId(reimbursementId); |
| | | detail.setRowNo(i + 1); |
| | | if (detail.getId() != null && existingDetailIds.contains(detail.getId())) { |
| | | finReimbursementDetailMapper.updateById(detail); |
| | | submittedDetailIds.add(detail.getId()); |
| | | } else { |
| | | detail.setId(null); |
| | | finReimbursementDetailMapper.insert(detail); |
| | | } |
| | | } |
| | | |
| | | // æ°æ®åºä¸å·²æä½æ°æç»ä¸æ²¡æç â å é¤ |
| | | for (Long existingId : existingDetailIds) { |
| | | if (!submittedDetailIds.contains(existingId)) { |
| | | finReimbursementDetailMapper.deleteById(existingId); |
| | | } |
| | | } |
| | | |
| | | // å·®æ
æ©å±ï¼æåæ´æ°ï¼æ åæ°å¢ |
| | | FinReimbursementTravel existingTravel = finReimbursementTravelMapper.selectOne( |
| | | new LambdaQueryWrapper<FinReimbursementTravel>() |
| | | .eq(FinReimbursementTravel::getReimbursementId, reimbursementId) |
| | | .last("LIMIT 1")); |
| | | FinReimbursementTravel travel = finReimbursementDto.getTravel(); |
| | | if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && travel != null) { |
| | | travel.setReimbursementId(reimbursementId); |
| | | if (existingTravel != null) { |
| | | travel.setId(existingTravel.getId()); |
| | | finReimbursementTravelMapper.updateById(travel); |
| | | } else { |
| | | travel.setId(null); |
| | | finReimbursementTravelMapper.insert(travel); |
| | | } |
| | | } |
| | | |
| | | resetApprovalFlow(existing, reimbursementId); |
| | | if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) { |
| | | reimbursement.setApprovalInstanceId(null); |
| | | startApproval(reimbursement, finReimbursementDto); |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, reimbursementId, finReimbursementDto.getStorageBlobDTOs()); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public FinReimbursementVo detail(Long id) { |
| | | if (id == null ) { |
| | | throw new ServiceException("æ¥éåIDä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | FinReimbursement reimbursement = finReimbursementMapper.selectById(id); |
| | | if (reimbursement == null) { |
| | | throw new ServiceException("æ¥éåä¸åå¨"); |
| | | } |
| | | |
| | | FinReimbursementVo vo = new FinReimbursementVo(); |
| | | vo.setId(reimbursement.getId()); |
| | | vo.setBillNo(reimbursement.getBillNo()); |
| | | vo.setReimbursementType(reimbursement.getReimbursementType()); |
| | | vo.setExpenseType(reimbursement.getExpenseType()); |
| | | vo.setApplicantId(reimbursement.getApplicantId()); |
| | | vo.setApplicantCode(reimbursement.getApplicantCode()); |
| | | vo.setApplicantName(reimbursement.getApplicantName()); |
| | | vo.setApplicantDeptId(reimbursement.getApplicantDeptId()); |
| | | vo.setApplicantDeptName(reimbursement.getApplicantDeptName()); |
| | | vo.setReason(reimbursement.getReason()); |
| | | vo.setApplyAmount(reimbursement.getApplyAmount()); |
| | | vo.setDetailTotalAmount(reimbursement.getDetailTotalAmount()); |
| | | vo.setPayeeName(reimbursement.getPayeeName()); |
| | | vo.setPayeeAccount(reimbursement.getPayeeAccount()); |
| | | vo.setPayeeBank(reimbursement.getPayeeBank()); |
| | | vo.setApprovalInstanceId(reimbursement.getApprovalInstanceId()); |
| | | vo.setApproveProcessId(reimbursement.getApproveProcessId()); |
| | | vo.setBillStatus(reimbursement.getBillStatus()); |
| | | vo.setApprovedTime(reimbursement.getApprovedTime()); |
| | | vo.setPaidTime(reimbursement.getPaidTime()); |
| | | vo.setAccountExpenseId(reimbursement.getAccountExpenseId()); |
| | | vo.setRemark(reimbursement.getRemark()); |
| | | vo.setTenantId(reimbursement.getTenantId()); |
| | | vo.setCreateUser(reimbursement.getCreateUser()); |
| | | vo.setCreateTime(reimbursement.getCreateTime()); |
| | | vo.setUpdateUser(reimbursement.getUpdateUser()); |
| | | vo.setUpdateTime(reimbursement.getUpdateTime()); |
| | | vo.setDeptId(reimbursement.getDeptId()); |
| | | vo.setDeleted(reimbursement.getDeleted()); |
| | | |
| | | vo.setDetails(finReimbursementDetailMapper.selectList( |
| | | new LambdaQueryWrapper<FinReimbursementDetail>() |
| | | .eq(FinReimbursementDetail::getReimbursementId, reimbursement.getId()) |
| | | .orderByAsc(FinReimbursementDetail::getRowNo) |
| | | )); |
| | | |
| | | if (isTravelReimbursement(reimbursement.getReimbursementType())) { |
| | | vo.setTravel(finReimbursementTravelMapper.selectOne( |
| | | new LambdaQueryWrapper<FinReimbursementTravel>() |
| | | .eq(FinReimbursementTravel::getReimbursementId, reimbursement.getId()) |
| | | .last("LIMIT 1") |
| | | )); |
| | | } |
| | | vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_REIMBURSEMENT, reimbursement.getId())); |
| | | //审æ¹è®°å½è¿å |
| | | vo.setTasks(approvalTaskService.list(new LambdaQueryWrapper<ApprovalTask>().eq(ApprovalTask::getInstanceId, reimbursement.getApprovalInstanceId()))); |
| | | vo.setRecords(approvalRecordService.list(new LambdaQueryWrapper<ApprovalRecord>().eq(ApprovalRecord::getInstanceId, reimbursement.getApprovalInstanceId()))); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean delete(List<Long> ids) { |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, ids); |
| | | //å
å é¤æç» |
| | | finReimbursementDetailMapper.delete(new LambdaQueryWrapper<FinReimbursementDetail>().in(FinReimbursementDetail::getReimbursementId, ids)); |
| | | //å é¤å·®æ
|
| | | finReimbursementTravelMapper.delete(new LambdaQueryWrapper<FinReimbursementTravel>().in(FinReimbursementTravel::getReimbursementId, ids)); |
| | | //å é¤ä¸»è¡¨ |
| | | int rows = finReimbursementMapper.delete(new LambdaQueryWrapper<FinReimbursement>().in(FinReimbursement::getId, ids)); |
| | | return rows == ids.size(); |
| | | } |
| | | |
| | | private String validateUpdateParam(FinReimbursementDto finReimbursementDto) { |
| | | if (finReimbursementDto == null || finReimbursementDto.getId() == null) { |
| | | throw new ServiceException("æ¥éåIDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (finReimbursementDto.getReimbursementType() == null) { |
| | | throw new ServiceException("æ¥éç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | String billStatus = normalizeBillStatus(finReimbursementDto.getBillStatus()); |
| | | if (billStatus == null) { |
| | | throw new ServiceException("åæ®ç¶æåªæ¯æ DRAFT æ IN_APPROVAL"); |
| | | } |
| | | if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) { |
| | | validateApprovalNodes(finReimbursementDto.getNodes()); |
| | | } |
| | | List<FinReimbursementDetail> details = finReimbursementDto.getDetails(); |
| | | if (details == null || details.isEmpty()) { |
| | | throw new ServiceException("æ¥éåæç»ä¸è½ä¸ºç©º"); |
| | | } |
| | | for (FinReimbursementDetail detail : details) { |
| | | if (detail == null) { |
| | | throw new ServiceException("æ¥éåæç»ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (detail.getAmount() == null || detail.getAmount().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("æ¥éåæç»éé¢å¿
须大äº0"); |
| | | } |
| | | } |
| | | if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() == null) { |
| | | throw new ServiceException("å·®æ
æ¥éå¿
须填åå·®æ
æ©å±ä¿¡æ¯"); |
| | | } |
| | | if (!isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() != null) { |
| | | throw new ServiceException("éå·®æ
æ¥éä¸å
许填åå·®æ
æ©å±ä¿¡æ¯"); |
| | | } |
| | | return billStatus; |
| | | } |
| | | |
| | | private String validateAddParam(FinReimbursementDto finReimbursementDto) { |
| | | if (finReimbursementDto == null) { |
| | | throw new ServiceException("æ¥éåæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (finReimbursementDto.getReimbursementType() == null) { |
| | | throw new ServiceException("æ¥éç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | String billStatus = normalizeBillStatus(finReimbursementDto.getBillStatus()); |
| | | if (billStatus == null) { |
| | | throw new ServiceException("åæ®ç¶æåªæ¯æ DRAFT æ IN_APPROVAL"); |
| | | } |
| | | if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) { |
| | | validateApprovalNodes(finReimbursementDto.getNodes()); |
| | | } |
| | | List<FinReimbursementDetail> details = finReimbursementDto.getDetails(); |
| | | if (details == null || details.isEmpty()) { |
| | | throw new ServiceException("æ¥éåæç»ä¸è½ä¸ºç©º"); |
| | | } |
| | | for (FinReimbursementDetail detail : details) { |
| | | if (detail == null) { |
| | | throw new ServiceException("æ¥éåæç»ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (detail.getAmount() == null || detail.getAmount().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("æ¥éåæç»éé¢å¿
须大äº0"); |
| | | } |
| | | } |
| | | if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() == null) { |
| | | throw new ServiceException("å·®æ
æ¥éå¿
须填åå·®æ
æ©å±ä¿¡æ¯"); |
| | | } |
| | | if (!isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() != null) { |
| | | throw new ServiceException("éå·®æ
æ¥éä¸å
许填åå·®æ
æ©å±ä¿¡æ¯"); |
| | | } |
| | | return billStatus; |
| | | } |
| | | |
| | | private FinReimbursement buildReimbursement(FinReimbursementDto finReimbursementDto, String billNo, BigDecimal totalAmount, String billStatus) { |
| | | FinReimbursement reimbursement = new FinReimbursement(); |
| | | reimbursement.setId(null); |
| | | reimbursement.setBillNo(billNo); |
| | | reimbursement.setReimbursementType(finReimbursementDto.getReimbursementType()); |
| | | reimbursement.setExpenseType(finReimbursementDto.getExpenseType()); |
| | | reimbursement.setApplicantId(finReimbursementDto.getApplicantId()); |
| | | reimbursement.setApplicantCode(finReimbursementDto.getApplicantCode()); |
| | | reimbursement.setApplicantName(finReimbursementDto.getApplicantName()); |
| | | reimbursement.setApplicantDeptId(finReimbursementDto.getApplicantDeptId()); |
| | | reimbursement.setApplicantDeptName(finReimbursementDto.getApplicantDeptName()); |
| | | reimbursement.setReason(finReimbursementDto.getReason()); |
| | | reimbursement.setApplyAmount(finReimbursementDto.getApplyAmount()); |
| | | reimbursement.setDetailTotalAmount(totalAmount); |
| | | reimbursement.setPayeeName(finReimbursementDto.getPayeeName()); |
| | | reimbursement.setPayeeAccount(finReimbursementDto.getPayeeAccount()); |
| | | reimbursement.setPayeeBank(finReimbursementDto.getPayeeBank()); |
| | | reimbursement.setRemark(finReimbursementDto.getRemark()); |
| | | reimbursement.setTenantId(finReimbursementDto.getTenantId()); |
| | | reimbursement.setApproveProcessId(null); |
| | | reimbursement.setBillStatus(billStatus); |
| | | return reimbursement; |
| | | } |
| | | |
| | | private void startApproval(FinReimbursement reimbursement, FinReimbursementDto finReimbursementDto) { |
| | | Long businessType = resolveBusinessType(finReimbursementDto.getReimbursementType()); |
| | | ApprovalInstanceDto approvalInstanceDto = new ApprovalInstanceDto(); |
| | | approvalInstanceDto.setInstanceNo(OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", approvalInstanceDto.getCreateTime() != null ? approvalInstanceDto.getCreateTime() : LocalDateTime.now())); |
| | | approvalInstanceDto.setBusinessId(reimbursement.getId()); |
| | | approvalInstanceDto.setTemplateId(null); |
| | | approvalInstanceDto.setTemplateName(TypeEnums.getLabelByValue(businessType) + "审æ¹"); |
| | | approvalInstanceDto.setBusinessType(businessType); |
| | | approvalInstanceDto.setTitle("æ¥éåå·ï¼" + reimbursement.getBillNo()); |
| | | approvalInstanceDto.setApplicantId(reimbursement.getApplicantId() != null ? reimbursement.getApplicantId() : SecurityUtils.getUserId()); |
| | | approvalInstanceDto.setApplicantName(reimbursement.getApplicantName() != null ? reimbursement.getApplicantName() : SecurityUtils.getLoginUser().getNickName()); |
| | | approvalInstanceDto.setApplyTime(LocalDateTime.now()); |
| | | approvalInstanceDto.setStatus("PENDING"); |
| | | approvalInstanceDto.setCurrentLevel(1); |
| | | |
| | | boolean approvalSaved = approvalInstanceService.save(approvalInstanceDto); |
| | | if (!approvalSaved || approvalInstanceDto.getId() == null) { |
| | | throw new ServiceException("å起审æ¹å¤±è´¥"); |
| | | } |
| | | List<ApprovalTask> firstTasks = createApprovalNodes(approvalInstanceDto, finReimbursementDto.getNodes()); |
| | | sendApproveNotice(approvalInstanceDto, firstTasks); |
| | | |
| | | FinReimbursement update = new FinReimbursement(); |
| | | update.setId(reimbursement.getId()); |
| | | update.setApprovalInstanceId(approvalInstanceDto.getId()); |
| | | update.setBillStatus(BILL_STATUS_IN_APPROVAL); |
| | | int rows = finReimbursementMapper.updateById(update); |
| | | if (rows != 1) { |
| | | throw new ServiceException("å填审æ¹å®ä¾å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | private List<ApprovalTask> createApprovalNodes(ApprovalInstanceDto approvalInstanceDto, List<ApprovalTemplateNodeDto> nodes) { |
| | | List<ApprovalTask> firstTasks = Collections.emptyList(); |
| | | for (int i = 0; i < nodes.size(); i++) { |
| | | ApprovalTemplateNodeDto nodeDto = nodes.get(i); |
| | | ApprovalInstanceNode instanceNode = new ApprovalInstanceNode(); |
| | | instanceNode.setInstanceId(approvalInstanceDto.getId()); |
| | | instanceNode.setLevelNo(nodeDto.getLevelNo()); |
| | | instanceNode.setApproveType(nodeDto.getApproveType()); |
| | | instanceNode.setStatus(i == 0 ? "PENDING" : NODE_STATUS_WAITING); |
| | | instanceNode.setStartTime(i == 0 ? LocalDateTime.now() : null); |
| | | instanceNode.setDeleted((byte) 0); |
| | | approvalInstanceNodeService.save(instanceNode); |
| | | |
| | | List<ApprovalTask> tasks = nodeDto.getApprovers().stream().map(approver -> { |
| | | ApprovalTask task = new ApprovalTask(); |
| | | task.setInstanceId(approvalInstanceDto.getId()); |
| | | task.setNodeId(instanceNode.getId()); |
| | | task.setLevelNo(instanceNode.getLevelNo()); |
| | | task.setApproverId(approver.getApproverId()); |
| | | task.setApproverName(approver.getApproverName()); |
| | | task.setTaskStatus("PENDING"); |
| | | task.setIsRead((byte) 0); |
| | | task.setDeleted((byte) 0); |
| | | return task; |
| | | }).collect(Collectors.toList()); |
| | | approvalTaskService.saveBatch(tasks); |
| | | |
| | | if (i == 0) { |
| | | firstTasks = tasks; |
| | | ApprovalRecord record = new ApprovalRecord(); |
| | | record.setInstanceId(approvalInstanceDto.getId()); |
| | | record.setNodeId(instanceNode.getId()); |
| | | record.setOperatorId(approvalInstanceDto.getApplicantId()); |
| | | record.setOperatorName(approvalInstanceDto.getApplicantName()); |
| | | record.setAction("SUBMIT"); |
| | | record.setComment("å起审æ¹"); |
| | | record.setDeleted((byte) 0); |
| | | approvalRecordService.save(record); |
| | | } |
| | | } |
| | | return firstTasks; |
| | | } |
| | | |
| | | private void validateApprovalNodes(List<ApprovalTemplateNodeDto> nodes) { |
| | | if (nodes == null || nodes.isEmpty()) { |
| | | throw new ServiceException("æäº¤å®¡æ¹æ¶å®¡æ¹èç¹ä¸è½ä¸ºç©º"); |
| | | } |
| | | for (int i = 0; i < nodes.size(); i++) { |
| | | ApprovalTemplateNodeDto node = nodes.get(i); |
| | | if (node == null) { |
| | | throw new ServiceException("审æ¹èç¹ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (node.getLevelNo() == null) { |
| | | node.setLevelNo(i + 1); |
| | | } |
| | | if (!StringUtils.hasText(node.getApproveType())) { |
| | | throw new ServiceException("审æ¹èç¹å®¡æ¹æ¹å¼ä¸è½ä¸ºç©º"); |
| | | } |
| | | List<ApprovalTemplateNodeApproverDto> approvers = node.getApprovers(); |
| | | if (approvers == null || approvers.isEmpty()) { |
| | | throw new ServiceException("审æ¹èç¹å®¡æ¹äººä¸è½ä¸ºç©º"); |
| | | } |
| | | for (ApprovalTemplateNodeApproverDto approver : approvers) { |
| | | if (approver == null || approver.getApproverId() == null) { |
| | | throw new ServiceException("审æ¹äººä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void sendApproveNotice(ApprovalInstanceDto instance, List<ApprovalTask> tasks) { |
| | | if (instance == null || tasks == null || tasks.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> approverIds = tasks.stream() |
| | | .map(ApprovalTask::getApproverId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (approverIds.isEmpty()) { |
| | | return; |
| | | } |
| | | String title = "æ¥é审æ¹"; |
| | | String message = "审æ¹åå· " + instance.getInstanceNo() + " éè¦æ¨å®¡æ¹"; |
| | | String jumpPath = "/approvalInstance?id=" + instance.getId(); |
| | | sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath); |
| | | } |
| | | |
| | | private void resetApprovalFlow(FinReimbursement existing, Long reimbursementId) { |
| | | if (existing == null || existing.getApprovalInstanceId() == null) { |
| | | return; |
| | | } |
| | | Long approvalInstanceId = existing.getApprovalInstanceId(); |
| | | if (!"REJECTED".equals(existing.getBillStatus())) { |
| | | approvalInstanceService.delete(Collections.singletonList(approvalInstanceId)); |
| | | } |
| | | clearApprovalBinding(reimbursementId); |
| | | } |
| | | |
| | | private void clearApprovalBinding(Long reimbursementId) { |
| | | int rows = finReimbursementMapper.update( |
| | | null, |
| | | Wrappers.<FinReimbursement>lambdaUpdate() |
| | | .eq(FinReimbursement::getId, reimbursementId) |
| | | .set(FinReimbursement::getApprovalInstanceId, null) |
| | | ); |
| | | if (rows != 1) { |
| | | throw new ServiceException("éç½®å®¡æ¹æµç¨å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | private Long resolveBusinessType(Byte reimbursementType) { |
| | | return isTravelReimbursement(reimbursementType) |
| | | ? TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode() |
| | | : TypeEnums.EXPENSE_APPROVAL.getCode(); |
| | | } |
| | | |
| | | private String normalizeBillStatus(String billStatus) { |
| | | if (billStatus == null) { |
| | | return BILL_STATUS_DRAFT; |
| | | } |
| | | String normalized = billStatus.trim().toUpperCase(); |
| | | if (BILL_STATUS_DRAFT.equals(normalized) || BILL_STATUS_IN_APPROVAL.equals(normalized)) { |
| | | return normalized; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean isTravelReimbursement(Byte reimbursementType) { |
| | | return Byte.valueOf((byte) 1).equals(reimbursementType); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.ruoyi.approve.pojo.FinReimbursementTravel; |
| | | import com.ruoyi.approve.mapper.FinReimbursementTravelMapper; |
| | | import com.ruoyi.approve.service.FinReimbursementTravelService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * å·®æ
æ¥éæ©å±è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-21 09:56:47 |
| | | */ |
| | | @Service |
| | | public class FinReimbursementTravelServiceImpl extends ServiceImpl<FinReimbursementTravelMapper, FinReimbursementTravel> implements FinReimbursementTravelService { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.approve.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import com.ruoyi.approve.pojo.ApprovalInstanceNode; |
| | | import com.ruoyi.approve.pojo.ApprovalRecord; |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNode; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover; |
| | | import com.ruoyi.approve.service.ApprovalInstanceNodeService; |
| | | import com.ruoyi.approve.service.ApprovalRecordService; |
| | | import com.ruoyi.approve.service.ApprovalTaskService; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService; |
| | | import com.ruoyi.approve.service.ApprovalTemplateNodeService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å®¡æ¹æµç¨èç¹å·¥å
·ç±» |
| | | */ |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class ApproveProcessConfigNodeUtils { |
| | | |
| | | private final ApprovalInstanceNodeService instanceNodeService; |
| | | private final ApprovalTaskService approvalTaskService; |
| | | private final ApprovalRecordService approvalRecordService; |
| | | private final ApprovalTemplateNodeService approvalTemplateNodeService; |
| | | private final ApprovalTemplateNodeApproverService approvalTemplateNodeApproverService; |
| | | |
| | | } |
| | | /** |
| | | * æå½åå±çº§å建审æ¹èç¹å审æ¹ä»»å¡ã |
| | | * 该éè½½ä¼åæ¶åå
¥ä¸æ¡å起审æ¹è®°å½ã |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ApprovalInstanceNode createCurrentNodeAndTasks(ApprovalInstance instance) { |
| | | return createCurrentNodeAndTasks(instance, true); |
| | | } |
| | | |
| | | /** |
| | | * æå½åå±çº§å建审æ¹èç¹å审æ¹ä»»å¡ã |
| | | * |
| | | * @param instance 审æ¹å®ä¾ |
| | | * @param createSubmitRecord æ¯å¦å建å起审æ¹è®°å½ |
| | | * @return å建åºçå½åèç¹å®ä¾ |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ApprovalInstanceNode createCurrentNodeAndTasks(ApprovalInstance instance, boolean createSubmitRecord) { |
| | | if (instance == null || instance.getId() == null) { |
| | | throw new RuntimeException("审æ¹å®ä¾ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (instance.getTemplateId() == null) { |
| | | throw new RuntimeException("å®¡æ¹æ¨¡æ¿ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | Integer currentLevel = instance.getCurrentLevel() == null ? 1 : instance.getCurrentLevel(); |
| | | |
| | | ApprovalInstanceNode existsNode = instanceNodeService.getOne( |
| | | new LambdaQueryWrapper<ApprovalInstanceNode>() |
| | | .eq(ApprovalInstanceNode::getInstanceId, instance.getId()) |
| | | .eq(ApprovalInstanceNode::getLevelNo, currentLevel) |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .last("LIMIT 1") |
| | | ); |
| | | if (existsNode != null) { |
| | | return existsNode; |
| | | } |
| | | |
| | | ApprovalTemplateNode templateNode = approvalTemplateNodeService.getOne( |
| | | new LambdaQueryWrapper<ApprovalTemplateNode>() |
| | | .eq(ApprovalTemplateNode::getTemplateId, instance.getTemplateId()) |
| | | .eq(ApprovalTemplateNode::getLevelNo, currentLevel) |
| | | .orderByAsc(ApprovalTemplateNode::getId) |
| | | .last("LIMIT 1") |
| | | ); |
| | | if (templateNode == null) { |
| | | throw new RuntimeException("æªæ¾å°å½åå±çº§å¯¹åºçå®¡æ¹æ¨¡æ¿èç¹"); |
| | | } |
| | | |
| | | List<ApprovalTemplateNodeApprover> approvers = approvalTemplateNodeApproverService.list( |
| | | new LambdaQueryWrapper<ApprovalTemplateNodeApprover>() |
| | | .eq(ApprovalTemplateNodeApprover::getTemplateId, instance.getTemplateId()) |
| | | .eq(ApprovalTemplateNodeApprover::getNodeId, templateNode.getId()) |
| | | .eq(ApprovalTemplateNodeApprover::getDeleted, 0L) |
| | | .orderByAsc(ApprovalTemplateNodeApprover::getSortNo) |
| | | ); |
| | | if (approvers == null || approvers.isEmpty()) { |
| | | throw new RuntimeException("å½å审æ¹èç¹æªé
置审æ¹äºº"); |
| | | } |
| | | |
| | | ApprovalInstanceNode instanceNode = new ApprovalInstanceNode(); |
| | | instanceNode.setInstanceId(instance.getId()); |
| | | instanceNode.setLevelNo(templateNode.getLevelNo()); |
| | | instanceNode.setApproveType(templateNode.getApproveType()); |
| | | instanceNode.setStatus("PENDING"); |
| | | instanceNode.setStartTime(LocalDateTime.now()); |
| | | instanceNode.setDeleted((byte) 0); |
| | | instanceNodeService.save(instanceNode); |
| | | |
| | | List<ApprovalTask> taskList = new ArrayList<>(approvers.size()); |
| | | for (ApprovalTemplateNodeApprover approver : approvers) { |
| | | ApprovalTask task = new ApprovalTask(); |
| | | task.setInstanceId(instance.getId()); |
| | | task.setNodeId(instanceNode.getId()); |
| | | task.setLevelNo(instanceNode.getLevelNo()); |
| | | task.setApproverId(approver.getApproverId()); |
| | | task.setApproverName(approver.getApproverName()); |
| | | task.setTaskStatus("PENDING"); |
| | | task.setIsRead((byte) 0); |
| | | task.setDeleted((byte) 0); |
| | | taskList.add(task); |
| | | } |
| | | approvalTaskService.saveBatch(taskList); |
| | | |
| | | if (createSubmitRecord) { |
| | | ApprovalRecord record = new ApprovalRecord(); |
| | | record.setInstanceId(instance.getId()); |
| | | record.setNodeId(instanceNode.getId()); |
| | | record.setOperatorId(instance.getApplicantId()); |
| | | record.setOperatorName(instance.getApplicantName()); |
| | | record.setAction("SUBMIT"); |
| | | record.setComment("å起审æ¹"); |
| | | record.setDeleted((byte) 0); |
| | | approvalRecordService.save(record); |
| | | } |
| | | |
| | | return instanceNode; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åå¾
å¤çèç¹ã |
| | | */ |
| | | public ApprovalInstanceNode getCurrentNode(Long instanceId) { |
| | | if (instanceId == null) { |
| | | return null; |
| | | } |
| | | |
| | | return instanceNodeService.getOne( |
| | | new LambdaQueryWrapper<ApprovalInstanceNode>() |
| | | .eq(ApprovalInstanceNode::getInstanceId, instanceId) |
| | | .eq(ApprovalInstanceNode::getStatus, "PENDING") |
| | | .eq(ApprovalInstanceNode::getDeleted, 0) |
| | | .orderByAsc(ApprovalInstanceNode::getLevelNo) |
| | | .last("LIMIT 1") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½å审æ¹å±çº§ã |
| | | */ |
| | | public Integer getCurrentLevel(Long instanceId) { |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | return currentNode != null ? currentNode.getLevelNo() : null; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åèç¹ä¸çå¾
审æ¹ä»»å¡ã |
| | | */ |
| | | public List<ApprovalTask> getCurrentPendingTasks(Long instanceId) { |
| | | if (instanceId == null) { |
| | | return List.of(); |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return List.of(); |
| | | } |
| | | |
| | | return approvalTaskService.list( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, currentNode.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .orderByAsc(ApprovalTask::getLevelNo) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·å¨å½åèç¹ä¸çå¾
审æ¹ä»»å¡ã |
| | | */ |
| | | public ApprovalTask getCurrentUserTask(Long instanceId, Long userId) { |
| | | if (instanceId == null || userId == null) { |
| | | return null; |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return null; |
| | | } |
| | | |
| | | return approvalTaskService.getOne( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, currentNode.getId()) |
| | | .eq(ApprovalTask::getApproverId, userId) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .last("LIMIT 1") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 夿å½åç¨æ·æ¯å¦æ¯å½å审æ¹äººã |
| | | */ |
| | | public boolean isCurrentApprover(Long instanceId, Long userId) { |
| | | return getCurrentUserTask(instanceId, userId) != null; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åèç¹ç审æ¹äºº ID å表ã |
| | | */ |
| | | public List<Long> getCurrentNodeApproverIds(Long instanceId) { |
| | | return getCurrentPendingTasks(instanceId).stream() |
| | | .map(ApprovalTask::getApproverId) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åèç¹å©ä½å¾
审æ¹äººæ°ã |
| | | */ |
| | | public int getRemainingApproverCount(Long instanceId) { |
| | | return getCurrentPendingTasks(instanceId).size(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åèç¹å·²åæäººæ°ã |
| | | */ |
| | | public int getApprovedCount(Long instanceId) { |
| | | if (instanceId == null) { |
| | | return 0; |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return 0; |
| | | } |
| | | |
| | | return Math.toIntExact(approvalTaskService.count( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, currentNode.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "APPROVED") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | )); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åèç¹å·²æç»äººæ°ã |
| | | */ |
| | | public int getRejectedCount(Long instanceId) { |
| | | if (instanceId == null) { |
| | | return 0; |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return 0; |
| | | } |
| | | |
| | | return Math.toIntExact(approvalTaskService.count( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, currentNode.getId()) |
| | | .eq(ApprovalTask::getTaskStatus, "REJECTED") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | )); |
| | | } |
| | | |
| | | /** |
| | | * 夿å½åèç¹æ¯å¦å¯ä»¥æµè½¬å°ä¸ä¸å±ã |
| | | */ |
| | | public boolean canProceedToNextLevel(Long instanceId, String approveType) { |
| | | if (instanceId == null || approveType == null) { |
| | | return false; |
| | | } |
| | | |
| | | if (getRejectedCount(instanceId) > 0) { |
| | | return false; |
| | | } |
| | | |
| | | int totalApproverCount = getCurrentPendingTasks(instanceId).size() + getApprovedCount(instanceId); |
| | | int approvedCount = getApprovedCount(instanceId); |
| | | |
| | | if ("AND".equalsIgnoreCase(approveType)) { |
| | | return approvedCount > 0 && approvedCount == totalApproverCount; |
| | | } |
| | | if ("OR".equalsIgnoreCase(approveType)) { |
| | | return approvedCount > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·å¨å½åèç¹ä¸çä»»å¡ç¶æã |
| | | */ |
| | | public String getUserTaskStatus(Long instanceId, Long userId) { |
| | | if (instanceId == null || userId == null) { |
| | | return null; |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return null; |
| | | } |
| | | |
| | | ApprovalTask task = approvalTaskService.getOne( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getInstanceId, instanceId) |
| | | .eq(ApprovalTask::getNodeId, currentNode.getId()) |
| | | .eq(ApprovalTask::getApproverId, userId) |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .last("LIMIT 1") |
| | | ); |
| | | |
| | | return task != null ? task.getTaskStatus() : null; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®ç¨æ·çå
¨é¨å¾
审æ¹ä»»å¡ã |
| | | */ |
| | | public List<ApprovalTask> getUserAllPendingTasks(Long userId) { |
| | | if (userId == null) { |
| | | return List.of(); |
| | | } |
| | | |
| | | return approvalTaskService.list( |
| | | new LambdaQueryWrapper<ApprovalTask>() |
| | | .eq(ApprovalTask::getApproverId, userId) |
| | | .eq(ApprovalTask::getTaskStatus, "PENDING") |
| | | .eq(ApprovalTask::getDeleted, 0) |
| | | .orderByDesc(ApprovalTask::getCreateTime) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¡æ¹å®ä¾çè¿åº¦æè¦ã |
| | | */ |
| | | public String getApprovalProgress(Long instanceId) { |
| | | if (instanceId == null) { |
| | | return "æ æç审æ¹å®ä¾"; |
| | | } |
| | | |
| | | ApprovalInstanceNode currentNode = getCurrentNode(instanceId); |
| | | if (currentNode == null) { |
| | | return "审æ¹å·²å®ææå°æªå¼å§"; |
| | | } |
| | | |
| | | int approvedCount = getApprovedCount(instanceId); |
| | | int rejectedCount = getRejectedCount(instanceId); |
| | | int pendingCount = getRemainingApproverCount(instanceId); |
| | | int totalCount = approvedCount + rejectedCount + pendingCount; |
| | | |
| | | return String.format( |
| | | "第%d级审æ¹ï¼æ»äººæ°=%dï¼å·²åæ=%dï¼å·²æç»=%dï¼å¾
审æ¹=%d", |
| | | currentNode.getLevelNo(), |
| | | totalCount, |
| | | approvedCount, |
| | | rejectedCount, |
| | | pendingCount |
| | | ); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @Operation(summary = "è·å客æ·è·è¿è¯¦ç»ä¿¡æ¯") |
| | | @GetMapping(value = "/{id}") |
| | | public R getInfo(@PathVariable("id") Integer id) { |
| | | return R.ok(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | public AjaxResult getInfo(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-æ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PutMapping("/edit") |
| | | @Operation(summary = "ä¿®æ¹å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "ä¸ä¼ è·è¿éä»¶") |
| | | @PostMapping("/upload/{followUpId}") |
| | | @Log(title = "客æ·è·è¿-ä¸ä¼ éä»¶", businessType = BusinessType.INSERT) |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return R.ok(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return AjaxResult.success(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "ä¸ä¼ éä»¶(å¤ç¨)") |
| | | @PostMapping("/upload") |
| | | @Log(title = "ä¸ä¼ éä»¶(å¤ç¨)", businessType = BusinessType.INSERT) |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | List<CustomerFollowUpFileDto> uploadedFiles = customerFollowUpService.addFollowUpFiles(files, null); |
| | | return R.ok(uploadedFiles); |
| | | return AjaxResult.success(uploadedFiles); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "æ¹éæ¥è¯¢éä»¶å表") |
| | | @PostMapping("/file/list") |
| | | public R getFileList(@RequestBody List<Long> ids) { |
| | | return R.ok(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | public AjaxResult getFileList(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "å é¤è·è¿éä»¶") |
| | | @DeleteMapping("/file/{fileId}") |
| | | @Log(title = "客æ·è·è¿-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public R deleteFile(@PathVariable Integer fileId) { |
| | | public AjaxResult deleteFile(@PathVariable Integer fileId) { |
| | | customerFollowUpService.deleteFollowUpFile(fileId); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "å é¤å®¢æ·è·è¿") |
| | | @DeleteMapping("/{id}") |
| | | @Log(title = "客æ·è·è¿-å é¤", businessType = BusinessType.DELETE) |
| | | public R remove(@PathVariable Integer id) { |
| | | return R.ok(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | public AjaxResult remove(@PathVariable Integer id) { |
| | | return toAjax(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "æ°å¢/æ´æ°å访æé") |
| | | @PostMapping("/return-visit") |
| | | @Log(title = "å访æé-æ°å¢/æ´æ°", businessType = BusinessType.UPDATE) |
| | | public R saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return R.ok(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return toAjax(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·åå访æé详æ
") |
| | | @GetMapping("/return-visit/{customerId}") |
| | | public R getReturnVisit(@PathVariable Integer customerId) { |
| | | return R.ok(customerReturnVisitService.getByCustomerId(customerId)); |
| | | public AjaxResult getReturnVisit(@PathVariable Integer customerId) { |
| | | return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "æ è®°å访æé已读") |
| | | @PutMapping("/return-visit/read/{id}") |
| | | @Log(title = "å访æé-æ 记已读", businessType = BusinessType.UPDATE) |
| | | public R markAsRead(@PathVariable Long id) { |
| | | public AjaxResult markAsRead(@PathVariable Long id) { |
| | | customerReturnVisitService.markAsRead(id); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | */ |
| | | @Log(title = "产å", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProduct") |
| | | public R<?> addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | productService.addOrEditProduct(productDto); |
| | | return R.ok(); |
| | | public AjaxResult addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | return toAjax(productService.addOrEditProduct(productDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProductModel") |
| | | public R<?> addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | productModelService.addOrEditProductModel(productModelDto); |
| | | return R.ok(); |
| | | public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | return toAjax(productModelService.addOrEditProductModel(productModelDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProduct") |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | // æ£æ¥æ¯å¦æéå®ååè®°å½å
³è该产å |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return R.fail("该产ååå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | return AjaxResult.error("该产ååå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | } |
| | | productService.delProductByIds(ids); |
| | | return R.ok(); |
| | | return toAjax(productService.delProductByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProductModel") |
| | | public R<?> delProductModel(@RequestBody Long[] ids) { |
| | | public AjaxResult delProductModel(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | // æ£æ¥æ¯å¦æéå®ååè®°å½å
³è该产åè§æ ¼åå· |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductModelId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return R.fail("该产åè§æ ¼åå·åå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | return AjaxResult.error("该产åè§æ ¼åå·åå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | } |
| | | productModelService.delProductModel(ids); |
| | | return R.ok(); |
| | | return toAjax(productModelService.delProductModel(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "导å
¥äº§å", businessType = BusinessType.IMPORT) |
| | | public R<?> importProductModel(@RequestParam("file") MultipartFile file, Integer productId) { |
| | | public AjaxResult importProductModel(@RequestParam("file") MultipartFile file, Integer productId) { |
| | | return productModelService.importProductModel(file, productId); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R add(@RequestBody SupplierManage supplierManage) { |
| | | public AjaxResult add(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.saveSupplier(supplierManage); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public R delSupplier(@RequestBody List<Integer> ids) { |
| | | public AjaxResult delSupplier(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | supplierService.delSupplier(ids); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public R supplierDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(supplierService.supplierDetail(id)); |
| | | public AjaxResult supplierDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(supplierService.supplierDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public R update(@RequestBody SupplierManage supplierManage) { |
| | | public AjaxResult update(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.supplierUpdate(supplierManage); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public R supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return R.ok(supplierService.supplierListPage(page, supplierManageDto)); |
| | | public AjaxResult supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return AjaxResult.success(supplierService.supplierListPage(page, supplierManageDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "ä¾åºå导å
¥", businessType = BusinessType.IMPORT) |
| | | public R importData(MultipartFile file) throws Exception { |
| | | return supplierService.importData(file); |
| | | public AjaxResult importData(MultipartFile file) { |
| | | Boolean b = supplierService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导å
¥æå"); |
| | | } |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOptions") |
| | | public R getOptions() { |
| | | return R.ok(supplierService.list()); |
| | | public AjaxResult getOptions() { |
| | | return AjaxResult.success(supplierService.list()); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.SupplierManageFile; |
| | | import com.ruoyi.basic.service.SupplierManageFileService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/basic/supplierManageFile") |
| | | public class SupplierManageFileController extends BaseController { |
| | | public class SupplierManageFileController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.save(supplierManageFile)); |
| | | public AjaxResult add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.save(supplierManageFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public R<?> delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | public AjaxResult delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return R.ok(supplierManageFileService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(supplierManageFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public R<?> supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | public AjaxResult supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | } |
| | | |
| | | |
| | |
| | | SALES_QUOTATION("sales_quotation"), |
| | | SALES_LEDGER_PRODUCT("sales_ledger_product"), |
| | | PURCHASE_LEDGER_FILE("purchase_ledger_file"), |
| | | RECEIPT_PAYMENT("receipt_payment"), |
| | | PAYMENT_SHIPPING("payment_shipping"), |
| | | INVOICE_REGISTRATION_PRODUCT("invoice_registration_product"), |
| | | LOSS("loss"), |
| | | INVOICE_REGISTRATION("invoice_registration"), |
| | | INVOICE_LEDGER_FILE("invoice_ledger_file"), |
| | | INVOICE_LEDGER("invoice_ledger"), |
| | | COMMON_FILE("common_file"), |
| | |
| | | QUALITY_INSPECT_PARAM("quality_inspect_param"), |
| | | QUALITY_INSPECT("quality_inspect"), |
| | | // Purchase |
| | | TICKET_REGISTRATION("ticket_registration"), |
| | | PURCHASE_RETURN_ORDER_PRODUCTS("purchase_return_order_products"), |
| | | PURCHASE_RETURN_ORDERS("purchase_return_orders"), |
| | | SALES_LEDGER_PRODUCT_TEMPLATE("sales_ledger_product_template"), |
| | | PURCHASE_LEDGER("purchase_ledger"), |
| | | PURCHASE_LEDGER_TEMPLATE("purchase_ledger_template"), |
| | | PRODUCT_RECORD("product_record"), |
| | | PAYMENT_REGISTRATION("payment_registration"), |
| | | INVOICE_PURCHASE("invoice_purchase"), |
| | | // Project Management |
| | | SHIPPING_ADDRESS("shipping_address"), |
| | | ROLES("roles"), |
| | |
| | | AFTER_SALES_SERVICE_FILE("after_sales_service_file"), |
| | | AFTER_SALES_NEAR_EXPIRY("after_sales_near_expiry"), |
| | | // Account |
| | | ACCOUNT_INCOME("account_income"), |
| | | BORROW_INFO("borrow_info"), |
| | | SALES_REFUND_AMOUNT_ORDER("sales_refund_amount_order"), |
| | | SALES_RECEIPT_RETURN("sales_receipt_return"), |
| | | ACCOUNT_EXPENSE("account_expense"), |
| | | FIN_REIMBURSEMENT("fin_reimbursement"), |
| | | FIN_VOUCHER("fin_voucher"), |
| | | ACCOUNT_FILE("account_file"); |
| | | ACCOUNT_FILE("account_file"), |
| | | ENTERPRISE_NEWS("enterprise_news"), |
| | | APPROVAL_INSTANCE("approval_instance"), |
| | | ACCOUNT_INVOICE_APPLICATION("account_invoice_application"), |
| | | ACCOUNT_PURCHASE_INVOICE("account_purchase_invoice"); |
| | | |
| | | private final String type; |
| | | RecordTypeEnum(String type) { this.type = type; } |
| | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Excel(name = "ä¾åºåç±»å") |
| | | private String supplierType; |
| | | |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | | |
| | |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | /** |
| | | * å®¢æ·æ¡£æ¡Mapperæ¥å£ |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-07 |
| | | */ |
| | |
| | | { |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡ |
| | | * |
| | | * |
| | | * @param id å®¢æ·æ¡£æ¡ä¸»é® |
| | | * @return å®¢æ·æ¡£æ¡ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | | * |
| | | * |
| | | * @param customer å®¢æ·æ¡£æ¡ |
| | | * @return å®¢æ·æ¡£æ¡éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢å®¢æ·æ¡£æ¡ |
| | | * |
| | | * |
| | | * @param customer å®¢æ·æ¡£æ¡ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹å®¢æ·æ¡£æ¡ |
| | | * |
| | | * |
| | | * @param customer å®¢æ·æ¡£æ¡ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * å é¤å®¢æ·æ¡£æ¡ |
| | | * |
| | | * |
| | | * @param id å®¢æ·æ¡£æ¡ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤å®¢æ·æ¡£æ¡ |
| | | * |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | |
| | | IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | |
| | | List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | } |
| | | |
| | | IPage<CustomerTransactionsVo> customewTransactions(Page page, @Param("customerName") String customerName); |
| | | |
| | | IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, @Param("customerId") Long customerId); |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | IPage<SupplierManage> supplierListPage(Page page, @Param("supplierManageDto") SupplierManageDto supplierManageDto); |
| | | |
| | | List<SupplierManageExcelDto> supplierExportList(@Param("supplierManageDto") SupplierManageDto supplierManageDto); |
| | | |
| | | IPage<SupplierTransactionsVo> supplierTransactions(Page page, @Param("supplierName") String supplierName); |
| | | |
| | | IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, @Param("supplierId") Long supplierId); |
| | | } |
| | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | /** |
| | | * çäº§çæº |
| | | */ |
| | | @Excel(name = "çäº§çæº") |
| | | private String speculativeTradingName; |
| | | |
| | | @Schema(description = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "ä¾åºåç±»å") |
| | | @TableField(value = "supplier_type") |
| | | @Excel(name = "ä¾åºåç±»å") |
| | | private String supplierType; |
| | | |
| | | @Schema(description = "纳ç¨äººè¯å«å·") |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @Schema(description = "ä¾åºåç±»å") |
| | | @TableField(value = "supplier_type") |
| | | private String supplierType; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsVo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | void together(CustomerDto customerDto); |
| | | |
| | | Boolean back(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·å¾æ¥å表 |
| | | * @param page |
| | | * @param customerName |
| | | * @return |
| | | */ |
| | | IPage<CustomerTransactionsVo> customewTransactions(Page page, String customerName); |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·å¾æ¥æç»å表 |
| | | * @param page |
| | | * @param customerId |
| | | * @return |
| | | */ |
| | | IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long customerId); |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | | import com.ruoyi.basic.dto.ProductModelDto; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | IPage<ProductModel> modelListPage(Page page , ProductDto productDto); |
| | | |
| | | R<?> importProductModel(MultipartFile file, Integer productId); |
| | | AjaxResult importProductModel(MultipartFile file, Integer productId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsVo; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface ISupplierService extends IService<SupplierManage> { |
| | |
| | | */ |
| | | void supplierExport(HttpServletResponse response, SupplierManageDto supplierManageDto); |
| | | |
| | | R importData(MultipartFile file); |
| | | Boolean importData(MultipartFile file); |
| | | |
| | | /** |
| | | * ä¾åºå徿¥ |
| | | * @param page |
| | | * @param supplierName |
| | | * @return |
| | | */ |
| | | IPage<SupplierTransactionsVo> supplierTransactions(Page page, String supplierName); |
| | | |
| | | /** |
| | | * ä¾åºå徿¥è¯¦æ
|
| | | * @param page |
| | | * @param supplierId |
| | | * @return |
| | | */ |
| | | IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, Long supplierId); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo; |
| | | import com.ruoyi.sales.vo.CustomerTransactionsVo; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @Slf4j |
| | | public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService { |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private SalesQuotationMapper salesQuotationMapper; |
| | | @Autowired |
| | | private ReturnManagementMapper returnManagementMapper; |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteCustomerByIds(Long[] ids) { |
| | | List<Long> idList = Arrays.asList(ids); |
| | | // æ£æ¥æ¯å¦æéå®å°è´¦å
³è |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, idList)); |
| | | if (!salesLedgers.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æéå®ååï¼è¯·å
å é¤éå®åå"); |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æéå®å°è´¦ï¼è¯·å
å é¤éå®å°è´¦"); |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦æéå®éè´§å
³è |
| | | List<ReturnManagement> returnManagements = returnManagementMapper.selectList(new QueryWrapper<ReturnManagement>().lambda().in(ReturnManagement::getCustomerId, idList)); |
| | | if (!returnManagements.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æéå®éè´§ï¼è¯·å
å é¤éå®éè´§"); |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦æé宿¥ä»·å
³è |
| | | List<SalesQuotation> salesQuotations = salesQuotationMapper.selectList(new QueryWrapper<SalesQuotation>().lambda().in(SalesQuotation::getCustomerId, idList)); |
| | | if (!salesQuotations.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æé宿¥ä»·ï¼è¯·å
å é¤é宿¥ä»·"); |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦æå·²åé
çå
¬æµ·å®¢æ· |
| | | List<Customer> assignedPools = customerMapper.selectList( |
| | | new QueryWrapper<Customer>().lambda() |
| | |
| | | return this.updateById(customer); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CustomerTransactionsVo> customewTransactions(Page page, String customerName) { |
| | | return customerMapper.customewTransactions(page, customerName); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long customerId) { |
| | | return customerMapper.customewTransactionsDetails(page, customerId); |
| | | } |
| | | |
| | | /** |
| | | * ä¸å线å½å转驼峰å½å |
| | | */ |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> importProductModel(MultipartFile file, Integer productId) { |
| | | public AjaxResult importProductModel(MultipartFile file, Integer productId) { |
| | | if (productId == null) { |
| | | return R.fail("请å
éæ©äº§åå导å
¥è§æ ¼åå·"); |
| | | return AjaxResult.error("请å
éæ©äº§åå导å
¥è§æ ¼åå·"); |
| | | } |
| | | |
| | | Product product = productMapper.selectById(productId); |
| | | if (product == null) { |
| | | return R.fail("éæ©ç产åä¸åå¨"); |
| | | return AjaxResult.error("éæ©ç产åä¸åå¨"); |
| | | } |
| | | |
| | | try { |
| | |
| | | List<ProductModel> productModelList = productModelExcelUtil.importExcel(file.getInputStream()); |
| | | |
| | | if (CollectionUtils.isEmpty(productModelList)) { |
| | | return R.fail("导å
¥æ°æ®ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("导å
¥æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // è·åå½å产å䏿æçè§æ ¼åå·å |
| | |
| | | int rowNum = i + 2; |
| | | |
| | | if (StringUtils.isEmpty(item.getProductCode())) { |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [产åç¼ç ] ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [产åç¼ç ] ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getModel())) { |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [è§æ ¼åå·] ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [è§æ ¼åå·] ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getUnit())) { |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [åä½] ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [åä½] ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // å»é,妿已å
å«è¯¥åå·,åè·³è¿ |
| | |
| | | } |
| | | |
| | | if (skipCount == 0) { |
| | | return R.ok(null, String.format("æå导å
¥ %d æ¡æ°æ®", waitToSaveList.size())); |
| | | return AjaxResult.success(String.format("æå导å
¥ %d æ¡æ°æ®", waitToSaveList.size())); |
| | | } else { |
| | | return R.ok(null, String.format("æå导å
¥ %d æ¡ï¼è·³è¿å·²å卿°æ® %d æ¡", waitToSaveList.size(), skipCount)); |
| | | return AjaxResult.success(String.format("æå导å
¥ %d æ¡ï¼è·³è¿å·²å卿°æ® %d æ¡", waitToSaveList.size(), skipCount)); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("导å
¥äº§åè§æ ¼å¼å¸¸", e); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | |
| | | import com.ruoyi.basic.service.ISupplierService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.mapper.SysDictDataMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo; |
| | | import com.ruoyi.purchase.vo.SupplierTransactionsVo; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | private final SupplierManageMapper supplierMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SysDictDataMapper sysDictDataMapper; |
| | | |
| | | /** |
| | | * ä¾åºåæ°å¢ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R importData(MultipartFile file) { |
| | | public Boolean importData(MultipartFile file) { |
| | | |
| | | try { |
| | | ExcelUtil<SupplierManageExcelDto> util = new ExcelUtil<SupplierManageExcelDto>(SupplierManageExcelDto.class); |
| | | List<SupplierManageExcelDto> list = util.importExcel(file.getInputStream()); |
| | | |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return R.fail("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | ArrayList<SupplierManage> supplierManages = new ArrayList<>(); |
| | | list.stream().forEach(dto -> { |
| | | // ä¾åºåç±»åæ¯å¦åå¨ ï¼ç²ä¹ä¸ä¸ï¼ |
| | | String supplierType = dto.getSupplierType(); |
| | | if (!supplierType.equals("ç²") && !supplierType.equals("ä¹") && !supplierType.equals("ä¸") && !supplierType.equals("ä¸")) { |
| | | throw new RuntimeException("ä¾åºåç±»å " + supplierType + " ä¸åå¨ï¼"); |
| | | } |
| | | SupplierManage supplierManage = new SupplierManage(); |
| | | BeanUtils.copyProperties(dto,supplierManage); |
| | | supplierManage.setMaintainTime(LocalDate.now()); |
| | |
| | | }); |
| | | |
| | | this.saveOrUpdateBatch(supplierManages); |
| | | return R.ok("导å
¥æå"); |
| | | return true; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SupplierTransactionsVo> supplierTransactions(Page page, String supplierName) { |
| | | return supplierMapper.supplierTransactions(page,supplierName); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, Long supplierId) { |
| | | return supplierMapper.supplierTransactionsDetails(page,supplierId); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagement; |
| | | import com.ruoyi.collaborativeApproval.service.DutyPlanService; |
| | | import com.ruoyi.common.utils.excel.ExcelUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @RestController |
| | | @RequestMapping("/dutyPlan") |
| | | @AllArgsConstructor |
| | | public class DutyPlanController extends BaseController { |
| | | public class DutyPlanController { |
| | | private DutyPlanService dutyPlanService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return R.ok(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | public AjaxResult listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return AjaxResult.success(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | } |
| | | @GetMapping("/getNum") |
| | | @Operation(summary = "è·åççº§æ°æ®") |
| | | public R<?> getNum(){ |
| | | return R.ok(dutyPlanService.getNum()); |
| | | public AjaxResult getNum(){ |
| | | return AjaxResult.success(dutyPlanService.getNum()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public R<?> add(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.save(dutyPlan)); |
| | | public AjaxResult add(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.save(dutyPlan)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public R<?> update(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.updateById(dutyPlan)); |
| | | public AjaxResult update(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.updateById(dutyPlan)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return R.ok(dutyPlanService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(dutyPlanService.removeBatchByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @Operation(summary = "导åº") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsService; |
| | | import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:50:59 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/enterpriseNews") |
| | | @Tag(name = "ä¼ä¸æ°é»è¡¨") |
| | | @AllArgsConstructor |
| | | public class EnterpriseNewsController { |
| | | |
| | | private final EnterpriseNewsService enterpriseNewsService; |
| | | |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ä¼ä¸æ°é»å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R listPage(Page<EnterpriseNewsVo> page , EnterpriseNewsDto enterpriseNewsDto) { |
| | | return R.ok(enterpriseNewsService.listPage(page, enterpriseNewsDto)); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "ä¿å") |
| | | @Log(title = "ä¿åä¼ä¸æ°é»", businessType = BusinessType.INSERT) |
| | | public R save(@RequestBody EnterpriseNewsDto enterpriseNewsDto) { |
| | | return R.ok(enterpriseNewsService.add(enterpriseNewsDto)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°") |
| | | @Log(title = "æ´æ°ä¼ä¸æ°é»", businessType = BusinessType.UPDATE) |
| | | public R update(@RequestBody EnterpriseNewsDto enterpriseNewsDto) { |
| | | return R.ok(enterpriseNewsService.updateEnterpriseNewsDto(enterpriseNewsDto)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | @Log(title = "å é¤ä¼ä¸æ°é»", businessType = BusinessType.DELETE) |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return R.ok(enterpriseNewsService.delete(ids)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:12 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/enterpriseNewsScopeDept") |
| | | public class EnterpriseNewsScopeDeptController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:23 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/enterpriseNewsScopeUser") |
| | | public class EnterpriseNewsScopeUserController { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @GetMapping("/page") |
| | | @Log(title = "å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, NoticeDTO noticeDTO){ |
| | | return R.ok(noticeService.listPage(page, noticeDTO)); |
| | | public AjaxResult listPage(Page page, NoticeDTO noticeDTO){ |
| | | return AjaxResult.success(noticeService.listPage(page, noticeDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢") |
| | | public R<?> add(@RequestBody NoticeDTO noticeDTO){ |
| | | public AjaxResult add(@RequestBody NoticeDTO noticeDTO){ |
| | | if (noticeDTO.getStatus()==1){ |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | | sysNoticeService.simpleNoticeAll("éç¥å
Œ", |
| | | noticeDTO.getTitle(), |
| | | "/collaborativeApproval/noticeManagement?type="+noticeDTO.getType()); |
| | | } |
| | | return R.ok(noticeService.save(noticeDTO)); |
| | | return AjaxResult.success(noticeService.save(noticeDTO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public R<?> update(@RequestBody NoticeDTO noticeDTO){ |
| | | public AjaxResult update(@RequestBody NoticeDTO noticeDTO){ |
| | | if (ObjectUtils.isNotNull(noticeDTO.getStatus()) && noticeDTO.getStatus()==1){ |
| | | Notice notice = noticeService.getById(noticeDTO.getId()); |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | |
| | | notice.getTitle(), |
| | | "/collaborativeApproval/noticeManagement?type="+notice.getType()); |
| | | } |
| | | return R.ok(noticeService.updateById(noticeDTO)); |
| | | return AjaxResult.success(noticeService.updateById(noticeDTO)); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤") |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return R.ok(noticeService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(noticeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/count") |
| | | @Log(title = "è·åå
¬åæ°é", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è·åå
¬åæ°é") |
| | | public R<?> count(){ |
| | | return R.ok(noticeService.selectCount()); |
| | | public AjaxResult count(){ |
| | | return AjaxResult.success(noticeService.selectCount()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.collaborativeApproval.pojo.NoticeType; |
| | | import com.ruoyi.collaborativeApproval.service.NoticeTypeService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/noticeType") |
| | | @AllArgsConstructor |
| | | public class NoticeTypeController extends BaseController { |
| | | public class NoticeTypeController { |
| | | |
| | | private NoticeTypeService noticeTypeService; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody NoticeType noticeType) { |
| | | return R.ok(noticeTypeService.saveOrUpdate(noticeType)); |
| | | public AjaxResult add(@RequestBody NoticeType noticeType) { |
| | | return AjaxResult.success(noticeTypeService.saveOrUpdate(noticeType)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public R<?> delNoticeType(@RequestBody List<Integer> ids) { |
| | | public AjaxResult delNoticeType(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return R.ok(noticeTypeService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(noticeTypeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public R<?> noticeTypeList() { |
| | | return R.ok(noticeTypeService.list()); |
| | | public AjaxResult noticeTypeList() { |
| | | return AjaxResult.success(noticeTypeService.list()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RequestMapping("/rulesRegulationsManagement") |
| | | @AllArgsConstructor |
| | | @Tag(name = "å¶åº¦ç®¡ç") |
| | | public class RulesRegulationsManagementController extends BaseController { |
| | | public class RulesRegulationsManagementController { |
| | | private RulesRegulationsManagementService rulesRegulationsManagementService; |
| | | private ReadingStatusMapper readingStatusMapper; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public R<?> add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | rulesRegulationsManagementService.save(rulesRegulationsManagement); |
| | | return R.ok(rulesRegulationsManagement.getId()); |
| | | return AjaxResult.success(rulesRegulationsManagement.getId()); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public R<?> update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | public AjaxResult update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return R.ok(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | } |
| | | //è§åæ¥çæ¶æ°å¢é
è¯»ç¶æ |
| | | @PostMapping("/addReadingStatus") |
| | | @Operation(summary = "æ°å¢é
è¯»ç¶æ") |
| | | public R<?> addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.insert(readingStatus)); |
| | | public AjaxResult addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.insert(readingStatus)); |
| | | } |
| | | @PostMapping("/updateReadingStatus") |
| | | @Operation(summary = "ä¿®æ¹é
è¯»ç¶æ") |
| | | public R<?> updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.updateById(readingStatus)); |
| | | public AjaxResult updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.updateById(readingStatus)); |
| | | } |
| | | @GetMapping("/getReadingStatusList") |
| | | @Operation(summary = "å页æ¥è¯¢é
è¯»ç¶æ") |
| | | public R<?> listPage(Page page, ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | public AjaxResult listPage(Page page, ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | } |
| | | @GetMapping("/getReadingStatusByRuleId/{ruleId}") |
| | | @Operation(summary = "æ ¹æ®å¶åº¦idæ¥è¯¢é
è¯»ç¶æ") |
| | | public R<?> getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return R.ok(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | public AjaxResult getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return AjaxResult.success(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | } |
| | | |
| | | @Operation(summary = "è§ç« å¶åº¦ç®¡ç导åº") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagementFile; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementFileService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/rulesRegulationsManagementFile") |
| | | public class RulesRegulationsManagementFileController extends BaseController { |
| | | public class RulesRegulationsManagementFileController { |
| | | |
| | | @Resource |
| | | private RulesRegulationsManagementFileService rulesRegulationsManagementFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return R.ok(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public R<?> listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(rulesRegulationsManagementFileService.listPage(page, rulesRegulationsManagementFile)); |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.listPage(page, rulesRegulationsManagementFile)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @RestController |
| | | @RequestMapping("/sealApplicationManagement") |
| | | @Tag(name = "ç¨å°ç³è¯·ç®¡ç") |
| | | public class SealApplicationManagementController extends BaseController { |
| | | public class SealApplicationManagementController { |
| | | private SealApplicationManagementService sealApplicationManagementService; |
| | | private ISysNoticeService sysNoticeService; |
| | | private FileUtil fileUtil; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return R.ok(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | public AjaxResult listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return AjaxResult.success(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public R<?> add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public AjaxResult add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | sealApplicationManagementService.save(sealApplicationManagement); |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | |
| | | +"ç³è¯·æ é¢ï¼"+sealApplicationManagement.getTitle(), |
| | | Arrays.asList(sealApplicationManagement.getApproveUserId()), |
| | | "/collaborativeApproval/sealManagement?applicationNum="+sealApplicationManagement.getApplicationNum()); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public R<?> update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public AjaxResult update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | sealApplicationManagement.getId(), |
| | | sealApplicationManagement.getStorageBlobDTOs()); |
| | | return R.ok(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | ids); |
| | | return R.ok(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "ç¨å°ç³è¯·ç®¡ç导åº") |
| | |
| | | import com.ruoyi.collaborativeApproval.dto.StaffContactsPersonalDTO; |
| | | import com.ruoyi.collaborativeApproval.pojo.StaffContactsPersonal; |
| | | import com.ruoyi.collaborativeApproval.service.StaffContactsPersonalService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/staffContactsPersonal") |
| | | @AllArgsConstructor |
| | | public class StaffContactsPersonalController extends BaseController { |
| | | public class StaffContactsPersonalController { |
| | | private StaffContactsPersonalService staffContactsPersonalService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return R.ok(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | public AjaxResult listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return AjaxResult.success(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public R<?> add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return R.ok(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | public AjaxResult add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return AjaxResult.success(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "å é¤") |
| | | public R<?> delete(@PathVariable("id") Long id) { |
| | | public AjaxResult delete(@PathVariable("id") Long id) { |
| | | // if (CollectionUtils.isEmpty(id)) { |
| | | // throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | // } |
| | | return R.ok(staffContactsPersonalService.removeById(id)); |
| | | return AjaxResult.success(staffContactsPersonalService.removeById(id)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.dto; |
| | | |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class EnterpriseNewsDto extends EnterpriseNews { |
| | | |
| | | private String createUserName; |
| | | |
| | | private List<Long> deptIds; |
| | | |
| | | private List<Long> userIds; |
| | | |
| | | private Long templateId; |
| | | private String templateName; |
| | | |
| | | private String createTimeStart; |
| | | private String createTimeEnd; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:50:59 |
| | | */ |
| | | @Mapper |
| | | public interface EnterpriseNewsMapper extends BaseMapper<EnterpriseNews> { |
| | | |
| | | IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page,@Param("enterpriseNewsDto") EnterpriseNewsDto enterpriseNewsDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:12 |
| | | */ |
| | | @Mapper |
| | | public interface EnterpriseNewsScopeDeptMapper extends BaseMapper<EnterpriseNewsScopeDept> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:23 |
| | | */ |
| | | @Mapper |
| | | public interface EnterpriseNewsScopeUserMapper extends BaseMapper<EnterpriseNewsScopeUser> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * ä¼ä¸æ°é»è¡¨ |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:50:59 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("enterprise_news") |
| | | @ApiModel(value = "EnterpriseNews对象", description = "ä¼ä¸æ°é»è¡¨") |
| | | public class EnterpriseNews implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "ç¼å· ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ é¢ Title") |
| | | private String title; |
| | | |
| | | @Schema(description = "æè¦ Summary") |
| | | private String summary; |
| | | |
| | | @Schema(description = "æ£æ Content") |
| | | private String content; |
| | | |
| | | @Schema(description = "åç±» Category") |
| | | private String category; |
| | | |
| | | @Schema(description = "é
读èå´ Read scope: all å
¨å, dept é¨é¨, custom èªå®ä¹") |
| | | private String readScope; |
| | | |
| | | @Schema(description = "æ¯å¦å¿
读 Required flag: 0 å¦, 1 æ¯") |
| | | private Byte isRequired; |
| | | |
| | | @Schema(description = "ç¶æ Status: DRAFT è稿, PENDING å¾
审æ¹, PUBLISHED å·²åå¸, REJECTED 驳å, OFFLINE å·²ä¸çº¿") |
| | | private String status; |
| | | |
| | | @Schema(description = "åºè¯»äººæ° Required read count") |
| | | private Integer requiredReadCount; |
| | | |
| | | @Schema(description = "å·²è¯»äººæ° Read count") |
| | | private Integer readCount; |
| | | |
| | | @Schema(description = "å建人 Create user") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @Schema(description = "å建æ¶é´ Create time") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ´æ°äºº Update user") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´ Update time") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "é¨é¨ID Dept ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:12 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("enterprise_news_scope_dept") |
| | | @ApiModel(value = "EnterpriseNewsScopeDept对象", description = "ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨") |
| | | public class EnterpriseNewsScopeDept implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @ApiModelProperty("ç¼å·") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ä¼ä¸æ°é»ID |
| | | */ |
| | | @ApiModelProperty("ä¼ä¸æ°é»ID") |
| | | private Long newsId; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | @ApiModelProperty("é¨é¨ID") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:23 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("enterprise_news_scope_user") |
| | | @ApiModel(value = "EnterpriseNewsScopeUser对象", description = "ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨") |
| | | public class EnterpriseNewsScopeUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @ApiModelProperty("ç¼å·") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ä¼ä¸æ°é»ID |
| | | */ |
| | | @ApiModelProperty("ä¼ä¸æ°é»ID") |
| | | private Long newsId; |
| | | |
| | | /** |
| | | * ç¨æ·ID |
| | | */ |
| | | @ApiModelProperty("ç¨æ·ID") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service; |
| | | |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:12 |
| | | */ |
| | | public interface EnterpriseNewsScopeDeptService extends IService<EnterpriseNewsScopeDept> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service; |
| | | |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:23 |
| | | */ |
| | | public interface EnterpriseNewsScopeUserService extends IService<EnterpriseNewsScopeUser> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:50:59 |
| | | */ |
| | | public interface EnterpriseNewsService extends IService<EnterpriseNews> { |
| | | |
| | | IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page, EnterpriseNewsDto enterpriseNewsDto); |
| | | |
| | | Boolean add(EnterpriseNewsDto enterpriseNewsDto); |
| | | |
| | | Boolean updateEnterpriseNewsDto(EnterpriseNewsDto enterpriseNewsDto); |
| | | |
| | | Boolean delete(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service.impl; |
| | | |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeDeptMapper; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeDeptService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´é¨é¨è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:12 |
| | | */ |
| | | @Service |
| | | public class EnterpriseNewsScopeDeptServiceImpl extends ServiceImpl<EnterpriseNewsScopeDeptMapper, EnterpriseNewsScopeDept> implements EnterpriseNewsScopeDeptService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service.impl; |
| | | |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeUserMapper; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¼ä¸æ°é»é
读èå´ç¨æ·è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:51:23 |
| | | */ |
| | | @Service |
| | | public class EnterpriseNewsScopeUserServiceImpl extends ServiceImpl<EnterpriseNewsScopeUserMapper, EnterpriseNewsScopeUser> implements EnterpriseNewsScopeUserService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.ApprovalInstanceMapper; |
| | | import com.ruoyi.approve.mapper.ApprovalTemplateMapper; |
| | | import com.ruoyi.approve.pojo.ApprovalInstance; |
| | | import com.ruoyi.approve.pojo.ApprovalTask; |
| | | import com.ruoyi.approve.pojo.ApprovalTemplate; |
| | | import com.ruoyi.approve.service.ApprovalInstanceService; |
| | | import com.ruoyi.approve.utils.ApproveProcessConfigNodeUtils; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto; |
| | | import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeDeptService; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeUserService; |
| | | import com.ruoyi.collaborativeApproval.service.EnterpriseNewsService; |
| | | import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo; |
| | | import com.ruoyi.common.enums.TypeEnums; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä¼ä¸æ°é»è¡¨æå¡å®ç°ç±» |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-20 11:50:59 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class EnterpriseNewsServiceImpl extends ServiceImpl<EnterpriseNewsMapper, EnterpriseNews> implements EnterpriseNewsService { |
| | | |
| | | private static final String READ_SCOPE_ALL = "all"; |
| | | private static final String READ_SCOPE_DEPT = "dept"; |
| | | private static final String READ_SCOPE_CUSTOM = "custom"; |
| | | |
| | | private static final String STATUS_DRAFT = "DRAFT"; |
| | | private static final String STATUS_PENDING = "PENDING"; |
| | | private static final String STATUS_PUBLISHED = "PUBLISHED"; |
| | | private static final String STATUS_REJECTED = "REJECTED"; |
| | | private static final String STATUS_OFFLINE = "OFFLINE"; |
| | | |
| | | private final EnterpriseNewsMapper enterpriseNewsMapper; |
| | | private final EnterpriseNewsScopeDeptService enterpriseNewsScopeDeptService; |
| | | private final EnterpriseNewsScopeUserService enterpriseNewsScopeUserService; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final SysUserDeptMapper sysUserDeptMapper; |
| | | private final ApprovalInstanceMapper approvalInstanceMapper; |
| | | private final ApprovalInstanceService approvalInstanceService; |
| | | private final ApprovalTemplateMapper approvalTemplateMapper; |
| | | private final ApproveProcessConfigNodeUtils approveProcessConfigNodeUtils; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page, EnterpriseNewsDto enterpriseNewsDto) { |
| | | IPage<EnterpriseNewsVo> enterpriseNewsVoIPage = enterpriseNewsMapper.listPage(page, enterpriseNewsDto); |
| | | enterpriseNewsVoIPage.getRecords().forEach(enterpriseNewsVo -> { |
| | | enterpriseNewsVo.setStorageBlobDTOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNewsVo.getId())); |
| | | }); |
| | | return enterpriseNewsVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(EnterpriseNewsDto enterpriseNewsDto) { |
| | | validateForSave(enterpriseNewsDto); |
| | | String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope()); |
| | | List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds()); |
| | | List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds()); |
| | | |
| | | EnterpriseNews enterpriseNews = new EnterpriseNews(); |
| | | BeanUtils.copyProperties(enterpriseNewsDto, enterpriseNews); |
| | | enterpriseNews.setReadScope(readScope); |
| | | enterpriseNews.setIsRequired(enterpriseNewsDto.getIsRequired() == null ? (byte) 0 : enterpriseNewsDto.getIsRequired()); |
| | | enterpriseNews.setStatus(normalizeStatus(enterpriseNewsDto.getStatus(), STATUS_DRAFT)); |
| | | enterpriseNews.setReadCount(0); |
| | | enterpriseNews.setRequiredReadCount(calculateRequiredReadCount(readScope, deptIds, userIds)); |
| | | |
| | | Long[] loginDeptIds = SecurityUtils.getDeptId(); |
| | | if (StringUtils.isNotEmpty(loginDeptIds)) { |
| | | enterpriseNews.setDeptId(loginDeptIds[0]); |
| | | } |
| | | |
| | | if (!save(enterpriseNews) || enterpriseNews.getId() == null) { |
| | | throw new ServiceException("æ°å¢ä¼ä¸æ°é»å¤±è´¥"); |
| | | } |
| | | |
| | | saveReadScopeRelations(enterpriseNews.getId(), readScope, deptIds, userIds); |
| | | if (STATUS_PENDING.equals(enterpriseNews.getStatus())) { |
| | | startEnterpriseNewsApproval(enterpriseNews, enterpriseNewsDto); |
| | | } |
| | | //æ·»å éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNews.getId(), enterpriseNewsDto.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateEnterpriseNewsDto(EnterpriseNewsDto enterpriseNewsDto) { |
| | | if (enterpriseNewsDto == null || enterpriseNewsDto.getId() == null) { |
| | | throw new ServiceException("ä¼ä¸æ°é»IDä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | EnterpriseNews oldEnterpriseNews = getById(enterpriseNewsDto.getId()); |
| | | if (oldEnterpriseNews == null) { |
| | | throw new ServiceException("ä¼ä¸æ°é»ä¸åå¨"); |
| | | } |
| | | if (!STATUS_DRAFT.equals(oldEnterpriseNews.getStatus()) |
| | | && !STATUS_REJECTED.equals(oldEnterpriseNews.getStatus())) { |
| | | throw new ServiceException("å¾
å®¡æ¹æå·²åå¸çä¼ä¸æ°é»ä¸å
许修æ¹"); |
| | | } |
| | | |
| | | validateForSave(enterpriseNewsDto); |
| | | String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope()); |
| | | List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds()); |
| | | List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds()); |
| | | |
| | | EnterpriseNews enterpriseNews = new EnterpriseNews(); |
| | | BeanUtils.copyProperties(enterpriseNewsDto, enterpriseNews); |
| | | enterpriseNews.setReadScope(readScope); |
| | | enterpriseNews.setIsRequired(enterpriseNewsDto.getIsRequired() == null ? oldEnterpriseNews.getIsRequired() : enterpriseNewsDto.getIsRequired()); |
| | | enterpriseNews.setStatus(normalizeStatus(enterpriseNewsDto.getStatus(), oldEnterpriseNews.getStatus())); |
| | | enterpriseNews.setReadCount(oldEnterpriseNews.getReadCount()); |
| | | enterpriseNews.setRequiredReadCount(calculateRequiredReadCount(readScope, deptIds, userIds)); |
| | | enterpriseNews.setCreateUser(oldEnterpriseNews.getCreateUser()); |
| | | enterpriseNews.setCreateTime(oldEnterpriseNews.getCreateTime()); |
| | | enterpriseNews.setDeptId(oldEnterpriseNews.getDeptId()); |
| | | |
| | | if (!updateById(enterpriseNews)) { |
| | | throw new ServiceException("ä¿®æ¹ä¼ä¸æ°é»å¤±è´¥"); |
| | | } |
| | | |
| | | clearReadScopeRelations(enterpriseNews.getId()); |
| | | saveReadScopeRelations(enterpriseNews.getId(), readScope, deptIds, userIds); |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNews.getId(), enterpriseNewsDto.getStorageBlobDTOs()); |
| | | if (STATUS_PENDING.equals(enterpriseNews.getStatus())) { |
| | | resetEnterpriseNewsApprovalFlow(oldEnterpriseNews); |
| | | startEnterpriseNewsApproval(enterpriseNews, enterpriseNewsDto); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean delete(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return false; |
| | | } |
| | | if (!removeByIds(ids)) { |
| | | throw new ServiceException("å é¤ä¼ä¸æ°é»å¤±è´¥"); |
| | | } |
| | | ids.forEach(this::clearReadScopeRelations); |
| | | return true; |
| | | } |
| | | |
| | | private void validateForSave(EnterpriseNewsDto enterpriseNewsDto) { |
| | | if (enterpriseNewsDto == null) { |
| | | throw new ServiceException("ä¼ä¸æ°é»æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(enterpriseNewsDto.getTitle())) { |
| | | throw new ServiceException("æ é¢ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(enterpriseNewsDto.getContent())) { |
| | | throw new ServiceException("æ£æä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | normalizeStatus(enterpriseNewsDto.getStatus(), STATUS_DRAFT); |
| | | String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope()); |
| | | List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds()); |
| | | List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds()); |
| | | |
| | | if (READ_SCOPE_DEPT.equals(readScope) && StringUtils.isEmpty(deptIds)) { |
| | | throw new ServiceException("è¯·éæ©é
读èå´é¨é¨"); |
| | | } |
| | | if (READ_SCOPE_CUSTOM.equals(readScope) && StringUtils.isEmpty(userIds)) { |
| | | throw new ServiceException("è¯·éæ©èªå®ä¹é
读人å"); |
| | | } |
| | | |
| | | validateDeptIds(deptIds); |
| | | validateUserIds(userIds); |
| | | } |
| | | |
| | | private String normalizeReadScope(String readScope) { |
| | | String normalized = StringUtils.isEmpty(readScope) ? READ_SCOPE_ALL : readScope.trim(); |
| | | if (!READ_SCOPE_ALL.equals(normalized) |
| | | && !READ_SCOPE_DEPT.equals(normalized) |
| | | && !READ_SCOPE_CUSTOM.equals(normalized)) { |
| | | throw new ServiceException("é
读èå´ä¸åæ³"); |
| | | } |
| | | return normalized; |
| | | } |
| | | |
| | | private String normalizeStatus(String status, String defaultStatus) { |
| | | String normalized = StringUtils.isEmpty(status) ? defaultStatus : status.trim().toUpperCase(); |
| | | if (!STATUS_DRAFT.equals(normalized) |
| | | && !STATUS_PENDING.equals(normalized) |
| | | && !STATUS_PUBLISHED.equals(normalized) |
| | | && !STATUS_REJECTED.equals(normalized) |
| | | && !STATUS_OFFLINE.equals(normalized)) { |
| | | throw new ServiceException("ä¼ä¸æ°é»ç¶æä¸åæ³"); |
| | | } |
| | | return normalized; |
| | | } |
| | | |
| | | private void validateDeptIds(List<Long> deptIds) { |
| | | if (StringUtils.isEmpty(deptIds)) { |
| | | return; |
| | | } |
| | | for (Long deptId : deptIds) { |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(deptId); |
| | | if (deptId == null || sysDept == null) { |
| | | throw new ServiceException("é
读èå´é¨é¨ä¸åå¨"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void validateUserIds(List<Long> userIds) { |
| | | if (StringUtils.isEmpty(userIds)) { |
| | | return; |
| | | } |
| | | List<SysUser> users = sysUserMapper.selectUsersByIds(userIds); |
| | | if (users.size() != userIds.size()) { |
| | | throw new ServiceException("èªå®ä¹é
读人åå
嫿 æç¨æ·"); |
| | | } |
| | | } |
| | | |
| | | private Integer calculateRequiredReadCount(String readScope, List<Long> deptIds, List<Long> userIds) { |
| | | if (READ_SCOPE_ALL.equals(readScope)) { |
| | | Long count = sysUserMapper.selectCount(new LambdaQueryWrapper<SysUser>() |
| | | .eq(SysUser::getDelFlag, "0")); |
| | | return count == null ? 0 : count.intValue(); |
| | | } |
| | | if (READ_SCOPE_DEPT.equals(readScope)) { |
| | | List<Long> allDeptIds = collectDeptIdsWithChildren(deptIds); |
| | | if (StringUtils.isEmpty(allDeptIds)) { |
| | | return 0; |
| | | } |
| | | Long count = sysUserDeptMapper.countDistinctUserIdsByDeptIds(allDeptIds); |
| | | return count == null ? 0 : count.intValue(); |
| | | } |
| | | return userIds.size(); |
| | | } |
| | | |
| | | private List<Long> collectDeptIdsWithChildren(List<Long> deptIds) { |
| | | Set<Long> allDeptIds = new LinkedHashSet<>(); |
| | | for (Long deptId : deptIds) { |
| | | if (deptId == null) { |
| | | continue; |
| | | } |
| | | allDeptIds.add(deptId); |
| | | List<SysDept> children = sysDeptMapper.selectChildrenDeptById(deptId); |
| | | if (StringUtils.isNotEmpty(children)) { |
| | | for (SysDept child : children) { |
| | | allDeptIds.add(child.getDeptId()); |
| | | } |
| | | } |
| | | } |
| | | return new ArrayList<>(allDeptIds); |
| | | } |
| | | |
| | | private void saveReadScopeRelations(Long newsId, String readScope, List<Long> deptIds, List<Long> userIds) { |
| | | if (READ_SCOPE_DEPT.equals(readScope)) { |
| | | List<EnterpriseNewsScopeDept> scopeDeptList = new ArrayList<>(); |
| | | for (Long deptId : deptIds) { |
| | | EnterpriseNewsScopeDept scopeDept = new EnterpriseNewsScopeDept(); |
| | | scopeDept.setNewsId(newsId); |
| | | scopeDept.setDeptId(deptId); |
| | | scopeDeptList.add(scopeDept); |
| | | } |
| | | if (StringUtils.isNotEmpty(scopeDeptList)) { |
| | | enterpriseNewsScopeDeptService.saveBatch(scopeDeptList); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (READ_SCOPE_CUSTOM.equals(readScope)) { |
| | | List<EnterpriseNewsScopeUser> scopeUserList = new ArrayList<>(); |
| | | for (Long userId : userIds) { |
| | | EnterpriseNewsScopeUser scopeUser = new EnterpriseNewsScopeUser(); |
| | | scopeUser.setNewsId(newsId); |
| | | scopeUser.setUserId(userId); |
| | | scopeUserList.add(scopeUser); |
| | | } |
| | | if (StringUtils.isNotEmpty(scopeUserList)) { |
| | | enterpriseNewsScopeUserService.saveBatch(scopeUserList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void clearReadScopeRelations(Long newsId) { |
| | | enterpriseNewsScopeDeptService.remove(new LambdaQueryWrapper<EnterpriseNewsScopeDept>() |
| | | .eq(EnterpriseNewsScopeDept::getNewsId, newsId)); |
| | | enterpriseNewsScopeUserService.remove(new LambdaQueryWrapper<EnterpriseNewsScopeUser>() |
| | | .eq(EnterpriseNewsScopeUser::getNewsId, newsId)); |
| | | } |
| | | |
| | | private void resetEnterpriseNewsApprovalFlow(EnterpriseNews oldEnterpriseNews) { |
| | | if (oldEnterpriseNews == null || !STATUS_DRAFT.equals(oldEnterpriseNews.getStatus())) { |
| | | return; |
| | | } |
| | | List<Long> approvalInstanceIds = approvalInstanceMapper.selectList(new LambdaQueryWrapper<ApprovalInstance>() |
| | | .eq(ApprovalInstance::getBusinessId, oldEnterpriseNews.getId()) |
| | | .eq(ApprovalInstance::getBusinessType, TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode()) |
| | | .eq(ApprovalInstance::getDeleted, (byte) 0)) |
| | | .stream() |
| | | .map(ApprovalInstance::getId) |
| | | .filter(id -> id != null && id > 0) |
| | | .collect(Collectors.toList()); |
| | | if (StringUtils.isEmpty(approvalInstanceIds)) { |
| | | return; |
| | | } |
| | | approvalInstanceService.delete(approvalInstanceIds); |
| | | } |
| | | |
| | | private List<Long> distinctIds(List<Long> ids) { |
| | | if (StringUtils.isEmpty(ids)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | Set<Long> distinctSet = new LinkedHashSet<>(); |
| | | for (Long id : ids) { |
| | | if (id != null) { |
| | | distinctSet.add(id); |
| | | } |
| | | } |
| | | return new ArrayList<>(distinctSet); |
| | | } |
| | | |
| | | private void startEnterpriseNewsApproval(EnterpriseNews enterpriseNews, EnterpriseNewsDto enterpriseNewsDto) { |
| | | if (enterpriseNewsDto.getTemplateId() == null) { |
| | | throw new ServiceException("å®¡æ¹æ¨¡æ¿ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | String templateName = enterpriseNewsDto.getTemplateName(); |
| | | if (StringUtils.isEmpty(templateName)) { |
| | | ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectById(enterpriseNewsDto.getTemplateId()); |
| | | if (approvalTemplate == null) { |
| | | throw new ServiceException("å®¡æ¹æ¨¡æ¿ä¸åå¨"); |
| | | } |
| | | templateName = approvalTemplate.getTemplateName(); |
| | | } |
| | | |
| | | ApprovalInstance approvalInstance = new ApprovalInstance(); |
| | | approvalInstance.setInstanceNo(OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", enterpriseNews.getCreateTime() != null ? enterpriseNews.getCreateTime() : LocalDateTime.now())); |
| | | approvalInstance.setTemplateId(enterpriseNewsDto.getTemplateId()); |
| | | approvalInstance.setTemplateName(templateName); |
| | | approvalInstance.setBusinessId(enterpriseNews.getId()); |
| | | approvalInstance.setBusinessType(TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode()); |
| | | approvalInstance.setTitle(enterpriseNews.getTitle()); |
| | | approvalInstance.setStatus("PENDING"); |
| | | approvalInstance.setCurrentLevel(1); |
| | | approvalInstance.setApplicantId(SecurityUtils.getUserId()); |
| | | approvalInstance.setApplicantName(SecurityUtils.getLoginUser().getNickName()); |
| | | approvalInstance.setApplyTime(LocalDateTime.now()); |
| | | approvalInstance.setDeleted((byte) 0); |
| | | approvalInstance.setCreateUser(SecurityUtils.getUserId()); |
| | | approvalInstance.setUpdateUser(SecurityUtils.getUserId()); |
| | | approvalInstance.setDeptId(enterpriseNews.getDeptId()); |
| | | approvalInstanceMapper.insert(approvalInstance); |
| | | |
| | | approveProcessConfigNodeUtils.createCurrentNodeAndTasks(approvalInstance); |
| | | sendApproveNotice(approvalInstance, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstance.getId())); |
| | | } |
| | | |
| | | private void sendApproveNotice(ApprovalInstance instance, List<ApprovalTask> tasks) { |
| | | if (instance == null || tasks == null || tasks.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> approverIds = tasks.stream() |
| | | .map(ApprovalTask::getApproverId) |
| | | .filter(id -> id != null && id > 0) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (approverIds.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | String title = StringUtils.isNotEmpty(instance.getTemplateName()) ? instance.getTemplateName() : "å®¡æ¹æé"; |
| | | String message = "审æ¹åå· " + instance.getInstanceNo() + " éè¦æ¨å®¡æ¹"; |
| | | String jumpPath = "/officeProcessAutomation/ApproveManage/approve-list/?id=" + instance.getId(); |
| | | sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.collaborativeApproval.vo; |
| | | |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class EnterpriseNewsVo extends EnterpriseNews { |
| | | |
| | | private String createUserName; |
| | | |
| | | private List<StorageBlobVO> storageBlobDTOs; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 审æ¹ç¶ææä¸¾ |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ApprovalStatusEnum implements BaseEnum<Integer> { |
| | | |
| | | DRAFT(0, "è稿"), |
| | | PENDING(1, "å¾
审æ¹"), |
| | | IN_PROGRESS(2, "审æ¹ä¸"), |
| | | APPROVED(3, "å·²éè¿"), |
| | | REJECTED(4, "已驳å"); |
| | | |
| | | |
| | | private final Integer value; |
| | | private final String label; |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return label; |
| | | } |
| | | |
| | | public static ApprovalStatusEnum fromValue(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | for (ApprovalStatusEnum status : values()) { |
| | | if (status.getCode().equals(value)) { |
| | | return status; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getLabelByValue(Integer value) { |
| | | ApprovalStatusEnum statusEnum = fromValue(value); |
| | | return statusEnum != null ? statusEnum.getValue() : "æªç¥ç¶æ"; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * ä¼ä¸æ°é»ç¶ææä¸¾ç±» |
| | | * |
| | | * @author ruoyi |
| | | * @date 2026-05-20 |
| | | */ |
| | | @Schema(description = "ä¼ä¸æ°é»ç¶ææä¸¾") |
| | | public enum EnterpriseNewsStatusEnum implements BaseEnum<String> { |
| | | |
| | | /** |
| | | * è稿 |
| | | */ |
| | | @Schema(description = "è稿") |
| | | DRAFT("DRAFT", "è稿"), |
| | | |
| | | /** |
| | | * å¾
å®¡æ¹ |
| | | */ |
| | | @Schema(description = "å¾
审æ¹") |
| | | PENDING("PENDING", "å¾
审æ¹"), |
| | | |
| | | /** |
| | | * å·²åå¸ |
| | | */ |
| | | @Schema(description = "å·²åå¸") |
| | | PUBLISHED("PUBLISHED", "å·²åå¸"), |
| | | |
| | | /** |
| | | * 驳å |
| | | */ |
| | | @Schema(description = "驳å") |
| | | REJECTED("REJECTED", "驳å"), |
| | | |
| | | /** |
| | | * å·²ä¸çº¿ |
| | | */ |
| | | @Schema(description = "å·²ä¸çº¿") |
| | | OFFLINE("OFFLINE", "å·²ä¸çº¿"); |
| | | |
| | | /** |
| | | * ç¶æç |
| | | */ |
| | | private final String code; |
| | | |
| | | /** |
| | | * ç¶ææè¿° |
| | | * -- GETTER -- |
| | | * è·åç¶ææè¿° |
| | | * |
| | | * @return ç¶ææè¿° |
| | | |
| | | */ |
| | | @Getter |
| | | private final String description; |
| | | |
| | | EnterpriseNewsStatusEnum(String code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | |
| | | /** |
| | | * è·åç¶æç |
| | | * |
| | | * @return ç¶æç |
| | | */ |
| | | @JsonValue |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶æç è·åæä¸¾ |
| | | * |
| | | * @param code ç¶æç |
| | | * @return æä¸¾å¼ |
| | | */ |
| | | @JsonCreator |
| | | public static EnterpriseNewsStatusEnum getByCode(String code) { |
| | | for (EnterpriseNewsStatusEnum status : values()) { |
| | | if (status.code.equals(code)) { |
| | | return status; |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("Invalid enterprise news status code: " + code); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºèç¨¿ç¶æ |
| | | * |
| | | * @return æ¯å¦ä¸ºèç¨¿ç¶æ |
| | | */ |
| | | public boolean isDraft() { |
| | | return DRAFT.equals(this); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºå¾
审æ¹ç¶æ |
| | | * |
| | | * @return æ¯å¦ä¸ºå¾
审æ¹ç¶æ |
| | | */ |
| | | public boolean isPending() { |
| | | return PENDING.equals(this); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºå·²åå¸ç¶æ |
| | | * |
| | | * @return æ¯å¦ä¸ºå·²åå¸ç¶æ |
| | | */ |
| | | public boolean isPublished() { |
| | | return PUBLISHED.equals(this); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºé©³åç¶æ |
| | | * |
| | | * @return æ¯å¦ä¸ºé©³åç¶æ |
| | | */ |
| | | public boolean isRejected() { |
| | | return REJECTED.equals(this); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºå·²ä¸çº¿ç¶æ |
| | | * |
| | | * @return æ¯å¦ä¸ºå·²ä¸çº¿ç¶æ |
| | | */ |
| | | public boolean isOffline() { |
| | | return OFFLINE.equals(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * é宿¥ä»·ç¶ææä¸¾ |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum SalesQuotationStatusEnum implements BaseEnum<String> { |
| | | |
| | | DRAFT("è稿", "è稿"), |
| | | PENDING("å¾
审æ¹", "å¾
审æ¹"), |
| | | IN_PROGRESS("å®¡æ ¸ä¸", "å®¡æ ¸ä¸"), |
| | | APPROVED("éè¿", "éè¿"), |
| | | REJECTED("æç»", "æç»"); |
| | | |
| | | private final String value; |
| | | private final String label; |
| | | |
| | | @Override |
| | | public String getCode() { |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return label; |
| | | } |
| | | |
| | | public static SalesQuotationStatusEnum fromValue(String value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | for (SalesQuotationStatusEnum status : values()) { |
| | | if (status.getCode().equals(value)) { |
| | | return status; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * å货审æ¹ç¶ææä¸¾ |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ShippingStatusEnum implements BaseEnum<String> { |
| | | |
| | | PENDING("å¾
确认", "å¾
确认"), |
| | | IN_PROGRESS("å®¡æ ¸ä¸", "å®¡æ ¸ä¸"), |
| | | APPROVED("å®¡æ ¸éè¿", "å®¡æ ¸éè¿"), |
| | | REJECTED("å®¡æ ¸æç»", "å®¡æ ¸æç»"); |
| | | |
| | | private final String value; |
| | | private final String label; |
| | | |
| | | @Override |
| | | public String getCode() { |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return label; |
| | | } |
| | | |
| | | public static ShippingStatusEnum fromValue(String value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | for (ShippingStatusEnum status : values()) { |
| | | if (status.getCode().equals(value)) { |
| | | return status; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TypeEnums implements BaseEnum<Long> { |
| | | |
| | | PUBLIC_OUT(1L, "å
¬åºç®¡ç"), |
| | | LEAVE(2L, "请å管ç"), |
| | | BUSINESS_TRIP(3L, "åºå·®ç®¡ç"), |
| | | REIMBURSEMENT(4L, "æ¥é管ç"), |
| | | PURCHASE_APPROVAL(5L, "éè´å®¡æ¹"), |
| | | QUOTATION_APPROVAL(6L, "æ¥ä»·å®¡æ¹"), |
| | | SHIPPING_APPROVAL(7L, "å货审æ¹"), |
| | | DANGEROUS_OPERATION(8L, "å±é©ä½ä¸å®¡æ¹"), |
| | | OFFICE_SUPPLIES(9L, "åå
¬ç¨å审æ¹"), |
| | | REGULARIZATION_APPROVAL(10L, "转æ£å®¡æ¹"), |
| | | TRANSFER_APPROVAL(11L, "è°å¨å®¡æ¹"), |
| | | RESIGNATION_APPROVAL(12L, "离è审æ¹"), |
| | | WORK_HANDOVER_APPROVAL(13L, "å·¥ä½äº¤æ¥å®¡æ¹"), |
| | | LEAVE_APPROVAL(14L, "请å审æ¹"), |
| | | OVERTIME_APPROVAL(15L, "å ç审æ¹"), |
| | | TRAVEL_REIMBURSEMENT_APPROVAL(16L, "åºå·®æ¥é审æ¹"), |
| | | EXPENSE_APPROVAL(17L, "è´¹ç¨å®¡æ¹"), |
| | | ENTERPRISE_NEWS_APPROVAL(18L, "ä¼ä¸æ°é»å®¡æ¹"); |
| | | |
| | | |
| | | |
| | | private final Long value; |
| | | private final String label; |
| | | |
| | | @Override |
| | | public Long getCode() { |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return label; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¼è·å对åºçæä¸¾ |
| | | * @param value ä¸å¡ç±»åå¼ |
| | | * @return 对åºçæä¸¾ï¼æªå¹é
è¿ånull |
| | | */ |
| | | public static TypeEnums fromValue(Long value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | for (TypeEnums type : values()) { |
| | | if (type.getCode().equals(value)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¼è·åæè¿° |
| | | * @param value ä¸å¡ç±»åå¼ |
| | | * @return ä¸å¡ç±»åæè¿°ï¼æªå¹é
è¿å"èªå®ä¹å®¡æ¹" |
| | | */ |
| | | public static String getLabelByValue(Long value) { |
| | | TypeEnums typeEnum = fromValue(value); |
| | | return typeEnum != null ? typeEnum.getValue() : "èªå®ä¹å®¡æ¹"; |
| | | } |
| | | } |
| | |
| | | * @param <T> å®ä½ç±»å |
| | | * @return 订åç¼å· |
| | | */ |
| | | public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix,String code) { |
| | | LocalDate today = LocalDate.now(); |
| | | public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix,String code, LocalDateTime createTime) { |
| | | if (createTime == null) { |
| | | createTime = LocalDateTime.now(); |
| | | } |
| | | LocalDate today = createTime.toLocalDate(); |
| | | LocalDateTime todayStart = today.atStartOfDay(); |
| | | LocalDateTime tomorrowStart = today.plusDays(1).atStartOfDay(); |
| | | String dateStr = today.format(DateTimeFormatter.BASIC_ISO_DATE); |
| | |
| | | * @param <T> å®ä½ç±»æ³å |
| | | * @return å½å¤©è®°å½æ°é |
| | | */ |
| | | public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix) { |
| | | public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix, LocalDateTime createTime) { |
| | | if (createTime == null) { |
| | | createTime = LocalDateTime.now(); |
| | | } |
| | | LocalDate localDate = createTime.toLocalDate(); |
| | | LocalDateTime todayStart = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | localDate, |
| | | LocalTime.MIN |
| | | ); |
| | | LocalDateTime todayEnd = LocalDateTime.of( |
| | | LocalDateTime.now().toLocalDate(), |
| | | localDate, |
| | | LocalTime.MAX |
| | | ); |
| | | |
| | |
| | | .lt("create_time", endDate); |
| | | |
| | | Long aLong = mapper.selectCount(queryWrapper); |
| | | return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)); |
| | | return preFix + localDate.format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "èªé
¬ç»©æ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "èªé
¬ç»©æ-å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, String staffName, String payDateStr) { |
| | | public AjaxResult listPage(Page page, String staffName, String payDateStr) { |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, staffName, payDateStr); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "èªé
¬ç»©æ-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "èªé
¬ç»©æ-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | | return save ? R.ok(null, "æ·»å æå") : R.fail("æ·»å 失败"); |
| | | return save ? AjaxResult.success("æ·»å æå") : AjaxResult.error("æ·»å 失败"); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "èªé
¬ç»©æ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "èªé
¬ç»©æ-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | | return update ? R.ok(null, "ä¿®æ¹æå") : R.fail("ä¿®æ¹å¤±è´¥"); |
| | | return update ? AjaxResult.success("ä¿®æ¹æå") : AjaxResult.error("ä¿®æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "èªé
¬ç»©æ-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "èªé
¬ç»©æ-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | boolean delete = compensationPerformanceService.removeBatchByIds(ids); |
| | | return delete ? R.ok(null, "å 餿å") : R.fail("å é¤å¤±è´¥"); |
| | | return delete ? AjaxResult.success("å 餿å") : AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | @Log(title = "导åºèªèµç®¡çå表", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | @Log(title = "导å
¥èªèµç®¡çå表", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | ExcelUtil<CompensationPerformance> util = new ExcelUtil<>(CompensationPerformance.class); |
| | | List<CompensationPerformance> list = util.importExcel(file.getInputStream()); |
| | | list.forEach(item -> { |
| | |
| | | } |
| | | }); |
| | | boolean b = compensationPerformanceService.saveBatch(list); |
| | | return R.ok(b); |
| | | return AjaxResult.success(b); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "å®¢æ·æè®¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å®¢æ·æè®¿-å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, CustomerVisits customerVisits) { |
| | | public AjaxResult listPage(Page page, CustomerVisits customerVisits) { |
| | | IPage<CustomerVisits> listPage = customerVisitsService.listPage(page, customerVisits); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "å®¢æ·æè®¿-æ·»å ") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> add(@RequestBody CustomerVisits customerVisits) { |
| | | public AjaxResult add(@RequestBody CustomerVisits customerVisits) { |
| | | boolean save = customerVisitsService.save(customerVisits); |
| | | if (save) { |
| | | return R.ok(null, "æ·»å æå"); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | return R.fail("æ·»å 失败"); |
| | | return AjaxResult.error("æ·»å 失败"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-ç¼è¾", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "å®¢æ·æè®¿-ç¼è¾") |
| | | @PostMapping("update") |
| | | public R<?> updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | public AjaxResult updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | boolean updateResult = customerVisitsService.updateCustomerVisit(customerVisits); |
| | | if (updateResult) { |
| | | return R.ok(null, "ç¼è¾æå"); |
| | | return AjaxResult.success("ç¼è¾æå"); |
| | | } |
| | | return R.fail("ç¼è¾å¤±è´¥"); |
| | | return AjaxResult.error("ç¼è¾å¤±è´¥"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å®¢æ·æè®¿-å é¤") |
| | | @DeleteMapping("{customerId}") |
| | | public R<?> deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | public AjaxResult deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | if (customerId == null) { |
| | | return R.fail("客æ·IDä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | boolean deleteResult = customerVisitsService.removeById(customerId); |
| | | if (deleteResult) { |
| | | return R.ok(null, "å 餿å"); |
| | | return AjaxResult.success("å 餿å"); |
| | | } |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.customervisits.pojo.CustomerVisits; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | wrapper.like(CustomerVisits::getVisitingPeople, customerVisits.getVisitingPeople()); |
| | | } |
| | | } |
| | | |
| | | wrapper.orderByDesc(CustomerVisits::getId); |
| | | return customerVisitsMapper.selectPage(page, wrapper); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RequestMapping("/defect") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | public class DeviceDefectRecordController extends BaseController { |
| | | public class DeviceDefectRecordController { |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @Operation(summary = "设å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/page") |
| | | public R<?> page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return R.ok(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | } |
| | | @Operation(summary = "设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/find/{deviceLedgerId}") |
| | | public R<?> find(@PathVariable Long deviceLedgerId) { |
| | | public AjaxResult find(@PathVariable Long deviceLedgerId) { |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | | deviceDefectRecordDto.setDeviceLedgerId(deviceLedgerId); |
| | | return R.ok(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å 设å¤ç¼ºé·è®°å½") |
| | | public R<?> add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | public R<?> update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | public R<?> delete(@PathVariable Long id) { |
| | | return R.ok(deviceDefectRecordService.removeById(id)); |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceDefectRecordService.removeById(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/device/ledger") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceLedgerController extends BaseController { |
| | | public class DeviceLedgerController { |
| | | |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | |
| | | |
| | | |
| | | @Operation(summary = "设å¤å°è´¦å表") |
| | | @GetMapping("/page") |
| | | public R<?> page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return R.ok(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | public AjaxResult page(Page page, DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page, deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å 设å¤å°è´¦") |
| | | public R<?> add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | public AjaxResult add(@RequestBody DeviceLedgerDto deviceLedgerDto) { |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedgerDto); |
| | | } |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @GetMapping("/{id}") |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceLedgerService.getById(id)); |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | DeviceLedgerDto deviceLedgerDto = deviceLedgerService.getDeviceLedgerDetail(id); |
| | | return AjaxResult.success(deviceLedgerDto); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @PutMapping() |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤å°è´¦") |
| | | public R<?> update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedgerDto); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤å°è´¦") |
| | | public R<?> delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @Operation(summary = "导åºè®¾å¤å°è´¦") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceLedgerService.export(response, ids); |
| | | deviceLedgerService.export(response, ids); |
| | | } |
| | | |
| | | @Operation(summary = "ä¸è½½æ¨¡æ¿") |
| | |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥è®¾å¤å°è´¦") |
| | | public R<?> importData(MultipartFile file) throws IOException { |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | | return R.ok(null, "导å
¥æå"); |
| | | return AjaxResult.success("导å
¥æå"); |
| | | } |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | public R<?> getDeviceLedger( ) { |
| | | return R.ok(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | public AjaxResult getDeviceLedger() { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName, DeviceLedger::getDeviceModel))); |
| | | } |
| | | |
| | | @GetMapping("scanDevice") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | @Anonymous |
| | | public R<?> scanDevice(Long id) { |
| | | public AjaxResult scanDevice(Long id) { |
| | | List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id); |
| | | DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id); |
| | | if (list.size()>0){ |
| | | deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//æåç»´æ¤æ¶é´ |
| | | if (!list.isEmpty()) { |
| | | deviceLedger.setUpdateTime(list.getFirst().getMaintenanceActuallyTime());//æåç»´æ¤æ¶é´ |
| | | } |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//䏿¬¡ç»´æ¤æ¶é´ |
| | | return R.ok(deviceLedger); |
| | | return AjaxResult.success(deviceLedger); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/device/maintenance") |
| | | @AllArgsConstructor |
| | | public class DeviceMaintenanceController extends BaseController { |
| | | public class DeviceMaintenanceController { |
| | | |
| | | |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | |
| | | |
| | | @Operation(summary = "设å¤ä¿å
»å表") |
| | | @GetMapping("/page") |
| | | public R<?> page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return R.ok(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»") |
| | | public R<?> add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @GetMapping("/{id}") |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceMaintenanceService.detailById(id)); |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public R<?> update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public AjaxResult update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @PostMapping ("maintenance") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public R<?> maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»") |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/maintenanceTaskFile") |
| | | @Tag(name = "设å¤ä¿å
»éä»¶") |
| | | public class DeviceMaintenanceFileController extends BaseController { |
| | | public class DeviceMaintenanceFileController { |
| | | |
| | | @Resource |
| | | private DeviceMaintenanceFileService deviceMaintenanceFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public R<?> add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return R.ok(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public R<?> qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | public AjaxResult qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/device/repair") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceRepairController extends BaseController { |
| | | public class DeviceRepairController { |
| | | |
| | | private IDeviceRepairService deviceRepairService; |
| | | |
| | | @Operation(summary = "è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | | public R<?> page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return R.ok(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | public AjaxResult page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return AjaxResult.success(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å è®¾å¤æ¥ä¿®") |
| | | public R<?> add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @GetMapping("/{id}") |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceRepairService.detailById(id)); |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceRepairService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | public R<?> update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/repair") |
| | | @Operation(summary = "设å¤ç»´ä¿®") |
| | | public R<?> repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.confirmRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/acceptance") |
| | | @Operation(summary = "è®¾å¤æ¥ä¿®éªæ¶å®¡æ¹") |
| | | public R<?> acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.approveRepairAcceptance(deviceRepairDto); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤æ¥ä¿®") |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.add(maintenanceTask); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return maintenanceTaskService.delete(ids); |
| | | } |
| | | |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | |
| | | /** |
| | | * 设å¤å°è´¦å®ä½ç±» |
| | |
| | | private String supplierName; |
| | | |
| | | /** |
| | | * 设å¤éä»¶(ç¨äºæ¥æ¶) |
| | | */ |
| | | @TableField(exist = false) |
| | | @Schema(description = "设å¤éä»¶æ¥æ¶å表") |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | /** |
| | | * 设å¤éä»¶(ç¨äºè¿å) |
| | | */ |
| | | @TableField(exist = false) |
| | | @Schema(description = "设å¤éä»¶å±ç¤ºå表") |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | | IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger); |
| | | |
| | | R<?> saveDeviceLedger(DeviceLedger deviceLedger); |
| | | AjaxResult saveDeviceLedger(DeviceLedgerDto deviceLedgerDto); |
| | | |
| | | R<?> updateDeviceLedger(DeviceLedger deviceLedger); |
| | | AjaxResult updateDeviceLedger(DeviceLedgerDto deviceLedgerDto); |
| | | |
| | | DeviceLedgerDto getDeviceLedgerDetail(Long id); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | R<?> updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto); |
| | | |
| | | R<?> saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | R<?> confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | R<?> approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskService extends IService<MaintenanceTask> { |
| | | R<?> listPage(Page page, MaintenanceTask maintenanceTask); |
| | | AjaxResult listPage(Page page, MaintenanceTask maintenanceTask); |
| | | |
| | | R<?> add(MaintenanceTask maintenanceTask); |
| | | AjaxResult add(MaintenanceTask maintenanceTask); |
| | | |
| | | R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | |
| | | R<?> delete(List<Long> ids); |
| | | AjaxResult delete(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.device.execl.DeviceLedgerExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.basic.dto.StorageAttachmentDTO; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.service.StorageAttachmentService; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final StorageAttachmentService storageAttachmentService; |
| | | |
| | | @Override |
| | | public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<?> saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | public AjaxResult saveDeviceLedger(DeviceLedgerDto deviceLedgerDto) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedgerDto.getDeviceName()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | return R.fail("设å¤åç§°å·²åå¨"); |
| | | return AjaxResult.error("设å¤åç§°å·²åå¨"); |
| | | } |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | BeanUtils.copyProperties(deviceLedgerDto, deviceLedger); |
| | | boolean save = this.save(deviceLedger); |
| | | if (save){ |
| | | return R.ok(); |
| | | if (deviceLedgerDto.getStorageBlobDTOs() != null) { |
| | | StorageAttachmentDTO attachmentDTO = new StorageAttachmentDTO(); |
| | | attachmentDTO.setApplication("image"); |
| | | attachmentDTO.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType()); |
| | | attachmentDTO.setRecordId(deviceLedger.getId()); |
| | | attachmentDTO.setStorageBlobDTOs(deviceLedgerDto.getStorageBlobDTOs()); |
| | | storageAttachmentService.saveStorageAttachment(attachmentDTO); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | public AjaxResult updateDeviceLedger(DeviceLedgerDto deviceLedgerDto) { |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | BeanUtils.copyProperties(deviceLedgerDto, deviceLedger); |
| | | if (this.updateById(deviceLedger)) { |
| | | return R.ok(); |
| | | if (deviceLedgerDto.getStorageBlobDTOs() != null) { |
| | | StorageAttachmentDTO attachmentDTO = new StorageAttachmentDTO(); |
| | | attachmentDTO.setApplication("image"); |
| | | attachmentDTO.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType()); |
| | | attachmentDTO.setRecordId(deviceLedger.getId()); |
| | | attachmentDTO.setStorageBlobDTOs(deviceLedgerDto.getStorageBlobDTOs()); |
| | | storageAttachmentService.saveStorageAttachment(attachmentDTO); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | public DeviceLedgerDto getDeviceLedgerDetail(Long id) { |
| | | DeviceLedger deviceLedger = this.getById(id); |
| | | if (deviceLedger != null) { |
| | | DeviceLedgerDto deviceLedgerDto = new DeviceLedgerDto(); |
| | | BeanUtils.copyProperties(deviceLedger, deviceLedgerDto); |
| | | StorageAttachmentDTO dto = new StorageAttachmentDTO(); |
| | | dto.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType()); |
| | | dto.setRecordId(id); |
| | | dto.setApplication("image"); |
| | | deviceLedgerDto.setStorageBlobVOs(storageAttachmentService.list(dto)); |
| | | return deviceLedgerDto; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | util.exportExcel(response, deviceLedgerExeclDtos, "设å¤å°è´¦å¯¼åº"); |
| | | }else { |
| | | ArrayList<Long> arrayList = new ArrayList<>(); |
| | | Arrays.stream(ids).map(id -> { |
| | | return arrayList.add( id); |
| | | }); |
| | | Arrays.stream(ids).map(arrayList::add); |
| | | List<DeviceLedger> supplierManageList = deviceLedgerMapper.selectBatchIds(arrayList); |
| | | ArrayList<DeviceLedgerExeclDto> deviceLedgerExeclDtos = new ArrayList<>(); |
| | | supplierManageList.stream().forEach(deviceLedger -> { |
| | |
| | | deviceLedger.setTaxIncludingPriceTotal(c.getTaxIncludingPriceUnit()); |
| | | deviceLedger.setNumber(BigDecimal.ONE); |
| | | deviceLedger.setPlanRuntimeTime(DateUtils.toLocalDate(c.getPlanRuntimeTime())); |
| | | deviceLedger.setUnTaxIncludingPriceTotal(deviceLedger.getTaxIncludingPriceTotal().divide(BigDecimal.ONE.add(c.getTaxRate()),2, RoundingMode.HALF_UP)); |
| | | // 计ç®ä¸å«ç¨æ»ä»·ï¼å¤çç©ºå¼æ
åµ |
| | | if (deviceLedger.getTaxIncludingPriceTotal() != null && c.getTaxRate() != null) { |
| | | deviceLedger.setUnTaxIncludingPriceTotal(deviceLedger.getTaxIncludingPriceTotal().divide(BigDecimal.ONE.add(c.getTaxRate()), 2, RoundingMode.HALF_UP)); |
| | | } |
| | | deviceLedgerMapper.insert(deviceLedger); |
| | | }); |
| | | |
| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceMaintenance oldDeviceMaintenance = this.getById(deviceMaintenance.getId()); |
| | | // å¤çå¤ä»¶ä½¿ç¨æ
åµ |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(deviceMaintenance.getSparePartsUseList())) { |
| | |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return R.fail("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | return AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceRepairDto.getDeviceLedgerId()); |
| | | deviceRepairDto.setDeviceName(byId.getDeviceName()); |
| | | deviceRepairDto.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | if (save) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, deviceRepairDto.getId(), deviceRepairDto.getStorageBlobDTOs()); |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail("ä¿å失败"); |
| | | return AjaxResult.error("ä¿å失败"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (deviceRepairDto.getStatus() != null |
| | | && deviceRepairDto.getStatus() == STATUS_COMPLETED |
| | | && (oldDeviceRepair.getStatus() == null |
| | | || oldDeviceRepair.getStatus() != STATUS_COMPLETED)) { |
| | | return R.fail("请å
æäº¤éªæ¶å®¡æ¹ï¼éªæ¶éè¿åæå¯å®ç»"); |
| | | return AjaxResult.error("请å
æäº¤éªæ¶å®¡æ¹ï¼éªæ¶éè¿åæå¯å®ç»"); |
| | | } |
| | | // å¤çå¤ä»¶ä½¿ç¨æ
åµ |
| | | if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) { |
| | |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return R.fail("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | return AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (deviceRepairDto.getStorageBlobDTOs() != null) { |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs()); |
| | | } |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_COMPLETED) { |
| | | return R.fail("该æ¥ä¿®å·²å®ç»ï¼ä¸è½éå¤ç¡®è®¤ç»´ä¿®"); |
| | | return AjaxResult.error("该æ¥ä¿®å·²å®ç»ï¼ä¸è½éå¤ç¡®è®¤ç»´ä¿®"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_PENDING_ACCEPTANCE) { |
| | | return R.fail("该æ¥ä¿®å·²æäº¤éªæ¶å®¡æ¹"); |
| | | return AjaxResult.error("该æ¥ä¿®å·²æäº¤éªæ¶å®¡æ¹"); |
| | | } |
| | | deviceRepairDto.setStatus(STATUS_PENDING_ACCEPTANCE); |
| | | return updateDeviceRepair(deviceRepairDto); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | public AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | if (deviceRepairDto.getId() == null) { |
| | | return R.fail("æ¥ä¿®è®°å½idä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("æ¥ä¿®è®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() == null || oldDeviceRepair.getStatus() != STATUS_PENDING_ACCEPTANCE) { |
| | | return R.fail("该æ¥ä¿®æªè¿å
¥å¾
éªæ¶ç¶æï¼ä¸è½å®¡æ¹"); |
| | | return AjaxResult.error("该æ¥ä¿®æªè¿å
¥å¾
éªæ¶ç¶æï¼ä¸è½å®¡æ¹"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceName())) { |
| | | return R.fail("éªæ¶äººä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("éªæ¶äººä¸è½ä¸ºç©º"); |
| | | } |
| | | if (deviceRepairDto.getAcceptanceTime() == null) { |
| | | return R.fail("éªæ¶æ¶é´ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("éªæ¶æ¶é´ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceRemark())) { |
| | | return R.fail("éªæ¶å¤æ³¨ä¸è½ä¸ºç©º"); |
| | | return AjaxResult.error("éªæ¶å¤æ³¨ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | DeviceRepair update = new DeviceRepair(); |
| | |
| | | update.setAcceptanceRemark(deviceRepairDto.getAcceptanceRemark()); |
| | | update.setStatus(STATUS_COMPLETED); |
| | | if (this.updateById(update)) { |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail("éªæ¶å®¡æ¹å¤±è´¥"); |
| | | return AjaxResult.error("éªæ¶å®¡æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.device.mapper.MaintenanceTaskMapper; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inspectiontask.pojo.TimingTask; |
| | | import com.ruoyi.inspectiontask.service.impl.TimingTaskServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | private final MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | |
| | | @Override |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null); |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, new QueryWrapper<MaintenanceTask>().orderByDesc("create_time")); |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | | if (taskPage.getRecords().isEmpty()) { |
| | | return R.ok(taskPage); |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | | // 3. æ¶éææéè¦æ¥è¯¢çç¨æ·ID |
| | |
| | | task.setRegistrant(userNickNameMap.getOrDefault(task.getRegistrantId(), "æªç¥ç¨æ·")); |
| | | } |
| | | }); |
| | | return R.ok(taskPage); |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> add(MaintenanceTask maintenanceTask) { |
| | | public AjaxResult add(MaintenanceTask maintenanceTask) { |
| | | maintenanceTask.setActive(true); |
| | | // 计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | TimingTask task = new TimingTask(); |
| | |
| | | if (insert > 0) { |
| | | maintenanceTaskScheduler.scheduleMaintenanceTask(maintenanceTask); |
| | | } |
| | | return R.ok(null, "æ·»å æå"); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | public AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | MaintenanceTask maintenanceTask1 = maintenanceTaskMapper.selectById(maintenanceTask.getId()); |
| | | if (maintenanceTask1 == null) { |
| | | return R.fail(HttpStatus.WARN, "æ²¡ææ¤æ°æ®"); |
| | | return AjaxResult.warn("æ²¡ææ¤æ°æ®"); |
| | | } |
| | | BeanUtils.copyProperties(maintenanceTask, maintenanceTask1); |
| | | int update = maintenanceTaskMapper.updateById(maintenanceTask1); |
| | | if (update > 0) { |
| | | maintenanceTaskScheduler.rescheduleMaintenanceTask(maintenanceTask1); |
| | | } |
| | | return R.ok(null, "æ´æ°æå"); |
| | | return AjaxResult.success("æ´æ°æå"); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> delete(List<Long> ids) { |
| | | public AjaxResult delete(List<Long> ids) { |
| | | int delete = maintenanceTaskMapper.deleteBatchIds(ids); |
| | | if (delete > 0) { |
| | | ids.forEach(id -> { |
| | | maintenanceTaskScheduler.unscheduleMaintenanceTask(id); |
| | | }); |
| | | } |
| | | return R.ok(null, "å 餿å"); |
| | | return AjaxResult.success("å 餿å"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "ç¨çµåºå-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµåºå-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public AjaxResult listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | IPage<ElectricityConsumptionArea> listPage = electricityConsumptionAreaService.listPage(page, electricityConsumptionArea); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "ç¨çµåºå-æ°å¢") |
| | | @Log(title = "ç¨çµåºå-æ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public AjaxResult add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | boolean save = electricityConsumptionAreaService.saveOrUpdate(electricityConsumptionArea); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "ç¨çµåºå-å é¤") |
| | | @Log(title = "ç¨çµåºå-å é¤", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = electricityConsumptionAreaService.removeBatchByIds(ids); |
| | | return remove ? R.ok() : R.fail(); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page page, EnergyPeriod energyPeriod) { |
| | | public AjaxResult listPage(Page page, EnergyPeriod energyPeriod) { |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody EnergyPeriod energyPeriod) { |
| | | public AjaxResult add(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean save = energyPeriodService.save(energyPeriod); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ¹éæ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | public AjaxResult addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | boolean save = energyPeriodService.saveBatch(energyPeriods); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-ä¿®æ¹") |
| | | @Log(title = "ç¨çµæ¶æ®µ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody EnergyPeriod energyPeriod) { |
| | | public AjaxResult update(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean update = energyPeriodService.updateById(energyPeriod); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å é¤") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å é¤", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = energyPeriodService.removeBatchByIds(ids); |
| | | return remove ? R.ok() : R.fail("å é¤å¤±è´¥"); |
| | | return remove ? AjaxResult.success() : AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设å¤è½è-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public AjaxResult listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPage(page, equipmentEnergyConsumption); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @GetMapping("/deviceList") |
| | | @Operation(summary = "设å¤å°è´¦-æ¥è¯¢") |
| | | @Log(title = "设å¤å°è´¦-æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> deviceList(DeviceLedger deviceLedger) { |
| | | public AjaxResult deviceList(DeviceLedger deviceLedger) { |
| | | List<DeviceLedger> listPage = equipmentEnergyConsumptionService.deviceList(deviceLedger); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "设å¤è½è-æ°å¢") |
| | | @Log(title = "设å¤è½è-æ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public AjaxResult add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean save = equipmentEnergyConsumptionService.save(equipmentEnergyConsumption); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "设å¤è½è-æ¹éæ°å¢") |
| | | @Log(title = "设å¤è½è-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public R<?> addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | public AjaxResult addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | boolean save = equipmentEnergyConsumptionService.saveBatch(list); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "设å¤è½è-ä¿®æ¹") |
| | | @Log(title = "设å¤è½è-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public AjaxResult update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean update = equipmentEnergyConsumptionService.updateById(equipmentEnergyConsumption); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "设å¤è½è-å é¤") |
| | | @Log(title = "设å¤è½è-å é¤", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = equipmentEnergyConsumptionService.removeBatchByIds(ids); |
| | | return remove ? R.ok() : R.fail(); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导å
¥è®¾å¤è½è", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导å
¥è®¾å¤è½è") |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | return equipmentEnergyConsumptionService.importData(file); |
| | | } |
| | | |
| | |
| | | @GetMapping("/listPageByTrend") |
| | | @Operation(summary = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public AjaxResult listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPageByTrend(page, equipmentEnergyConsumption); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | IPage<EquipmentEnergyConsumption> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption); |
| | | |
| | | R<?> importData(MultipartFile file); |
| | | AjaxResult importData(MultipartFile file); |
| | | |
| | | IPage<EquipmentEnergyConsumption> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption); |
| | | |
| | |
| | | import com.ruoyi.equipmentenergyconsumption.mapper.EquipmentEnergyConsumptionMapper; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.equipmentenergyconsumption.service.EquipmentEnergyConsumptionService; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<?> importData(MultipartFile file) { |
| | | public AjaxResult importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<EquipmentEnergyConsumption> util = new ExcelUtil<EquipmentEnergyConsumption>(EquipmentEnergyConsumption.class); |
| | | List<EquipmentEnergyConsumption> userList = util.importExcel(file.getInputStream()); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return R.fail(HttpStatus.WARN, "模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | return AjaxResult.warn("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return R.ok(true); |
| | | return AjaxResult.success(true); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.sql.SqlUtil;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.PageDomain;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.framework.web.page.TableSupport;
|
| | |
| | | /**
|
| | | * è¿åæå
|
| | | */
|
| | | public R<?> success()
|
| | | public AjaxResult success()
|
| | | {
|
| | | return R.ok();
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åæåæ¶æ¯
|
| | | */
|
| | | public R<?> success(String message)
|
| | | public AjaxResult success(String message)
|
| | | {
|
| | | return R.ok(null, message);
|
| | | return AjaxResult.success(message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åæåæ¶æ¯
|
| | | */
|
| | | public R<?> success(Object data)
|
| | | public AjaxResult success(Object data)
|
| | | {
|
| | | return R.ok(data);
|
| | | return AjaxResult.success(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åå¤±è´¥æ¶æ¯
|
| | | */
|
| | | public R<?> error()
|
| | | public AjaxResult error()
|
| | | {
|
| | | return R.fail();
|
| | | return AjaxResult.error();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åå¤±è´¥æ¶æ¯
|
| | | */
|
| | | public R<?> error(String message)
|
| | | public AjaxResult error(String message)
|
| | | {
|
| | | return R.fail(message);
|
| | | return AjaxResult.error(message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åè¦åæ¶æ¯
|
| | | */
|
| | | public R<?> warn(String message)
|
| | | public AjaxResult warn(String message)
|
| | | {
|
| | | return R.fail(HttpStatus.WARN, message);
|
| | | return AjaxResult.warn(message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * ååºè¿åç»æ
|
| | | *
|
| | | * |
| | | * @param rows å½±åè¡æ°
|
| | | * @return æä½ç»æ
|
| | | */
|
| | | protected R<?> toAjax(int rows)
|
| | | protected AjaxResult toAjax(int rows)
|
| | | {
|
| | | return rows > 0 ? R.ok() : R.fail();
|
| | | return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
| | | }
|
| | |
|
| | | /**
|
| | | * ååºè¿åç»æ
|
| | | *
|
| | | * |
| | | * @param result ç»æ
|
| | | * @return æä½ç»æ
|
| | | */
|
| | | protected R<?> toAjax(boolean result)
|
| | | protected AjaxResult toAjax(boolean result)
|
| | | {
|
| | | return result ? success() : error();
|
| | | }
|
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Schema(description = "åºä»éé¢") |
| | | private BigDecimal payableMoney; |
| | | |
| | | @Schema(description = "颿¶éé¢") |
| | | @Schema(description = "æ¶æ¬¾éé¢") |
| | | private BigDecimal advanceMoney; |
| | | |
| | | @Schema(description = "é¢ä»éé¢") |
| | | @Schema(description = "仿¬¾éé¢") |
| | | private BigDecimal prepayMoney; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.account.mapper.AccountExpenseMapper; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.account.mapper.AccountStatementMapper; |
| | | import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper; |
| | | import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.mapper.HomeMapper; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.production.bean.dto.ProductionProductOutputDto; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public class HomeServiceImpl implements HomeService { |
| | | |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | private final StockInRecordMapper stockInRecordMapper; |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | |
| | | private final QualityInspectMapper qualityStatisticsMapper; |
| | | |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | |
| | | private final ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | private final PaymentRegistrationMapper paymentRegistrationMapper; |
| | | |
| | | private final SysDeptMapper sysDeptMapper; |
| | | |
| | |
| | | |
| | | private final ProductionOperationTaskMapper productionOperationTaskMapper; |
| | | |
| | | private final AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | private final AccountIncomeMapper accountIncomeMapper; |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final AccountStatementMapper accountStatementMapper; |
| | | |
| | | private final ProductionAccountMapper productionAccountMapper; |
| | | |
| | |
| | | salesLedgers.stream().map(SalesLedger::getId).collect(Collectors.toList())); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper |
| | | .selectList(salesLedgerProductMapperLambdaQueryWrapper); |
| | | // æªå¼ç¥¨éé¢ |
| | | BigDecimal noInvoiceAmountTotal = salesLedgerProducts.stream().map(SalesLedgerProduct::getNoInvoiceAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // å建LambdaQueryWrapper |
| | | LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // å¾
仿¬¾æ»éé¢ |
| | | BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream() |
| | | .map(SalesLedgerProduct::getPendingTicketsTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // ç»è®¡åºå |
| | | BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal(); |
| | |
| | | queryWrapper.ge(QualityInspect::getCheckTime, monthStart.toString()) |
| | | .le(QualityInspect::getCheckTime, monthEnd.toString()); |
| | | List<QualityInspect> monthInspects = qualityStatisticsMapper.selectList(queryWrapper); |
| | | |
| | | // ç»è®¡æ»æ°éï¼åæ ¼æ°é + ä¸åæ ¼æ°éï¼ |
| | | BigDecimal reduce = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(0)) |
| | | .map(QualityInspect::getQuantity) |
| | | .map(inspect -> { |
| | | BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | return qualified.add(unqualified); |
| | | }) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | supplierNum = supplierNum.add(reduce); |
| | | |
| | | BigDecimal reduce1 = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(1)) |
| | | .map(QualityInspect::getQuantity) |
| | | .map(inspect -> { |
| | | BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | return qualified.add(unqualified); |
| | | }) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | processNum = processNum.add(reduce1); |
| | | |
| | | BigDecimal reduce2 = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(2)) |
| | | .map(QualityInspect::getQuantity) |
| | | .map(inspect -> { |
| | | BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | return qualified.add(unqualified); |
| | | }) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | factoryNum = factoryNum.add(reduce2); |
| | | |
| | |
| | | |
| | | // 1. ä¾åºåæ£éªï¼ç±»å0ï¼- åæ ¼æ°é |
| | | BigDecimal supplierQualified = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(0) |
| | | && "åæ ¼".equals(inspect.getCheckResult())) |
| | | .map(QualityInspect::getQuantity) |
| | | .filter(inspect -> inspect.getInspectType().equals(0)) |
| | | .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | item.setSupplierNum(supplierQualified); |
| | | |
| | | // 2. å·¥åºæ£éªï¼ç±»å1ï¼- åæ ¼æ°é |
| | | BigDecimal processQualified = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(1) |
| | | && "åæ ¼".equals(inspect.getCheckResult())) |
| | | .map(QualityInspect::getQuantity) |
| | | .filter(inspect -> inspect.getInspectType().equals(1)) |
| | | .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | item.setProcessNum(processQualified); |
| | | |
| | | // 3. 工忣éªï¼ç±»å2ï¼- åæ ¼æ°é |
| | | BigDecimal factoryQualified = monthInspects.stream() |
| | | .filter(inspect -> inspect.getInspectType().equals(2) |
| | | && "åæ ¼".equals(inspect.getCheckResult())) |
| | | .map(QualityInspect::getQuantity) |
| | | .filter(inspect -> inspect.getInspectType().equals(2)) |
| | | .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | item.setFactoryNum(factoryQualified); |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public StatisticsReceivablePayableDto statisticsReceivablePayable(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate = null; |
| | | LocalDate endDate = null; |
| | | switch (type) { |
| | | case 1: |
| | | // è·åæ¬å¨å¨ä¸ |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | // è·åæ¬å¨å¨æ¥ |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | StatisticsReceivablePayableDto dto = new StatisticsReceivablePayableDto(); |
| | | LocalDate[] range = resolveFinanceRange(type); |
| | | LocalDate startDate = range[0]; |
| | | LocalDate endDate = range[1]; |
| | | |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()) |
| | | .with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()) |
| | | .with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | } |
| | | // åºæ¶ |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new LambdaQueryWrapper<SalesLedger>() |
| | | // .ge(SalesLedger::getEntryDate, startDate) |
| | | // .lt(SalesLedger::getEntryDate, endDate) |
| | | ); |
| | | // BigDecimal receivableMoney = |
| | | // salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, |
| | | // BigDecimal::add); |
| | | BigDecimal receivableMoney = sumAmount(salesLedgers, SalesLedger::getContractAmount); |
| | | // åºä» |
| | | List<PurchaseLedger> procurementRecords = purchaseLedgerMapper |
| | | .selectList(new LambdaQueryWrapper<PurchaseLedger>() |
| | | // .ge(PurchaseLedger::getEntryDate, startDate) |
| | | // .lt(PurchaseLedger::getEntryDate, endDate) |
| | | ); |
| | | // BigDecimal payableMoney = |
| | | // procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, |
| | | // BigDecimal::add); |
| | | BigDecimal payableMoney = sumAmount(procurementRecords, PurchaseLedger::getContractAmount); |
| | | // 颿¶ |
| | | List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>() |
| | | // .ge(ReceiptPayment::getReceiptPaymentDate, startDate) |
| | | // .lt(ReceiptPayment::getReceiptPaymentDate, endDate) |
| | | ); |
| | | // BigDecimal advanceMoney = |
| | | // receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, |
| | | // BigDecimal::add); |
| | | BigDecimal advanceMoney = sumAmount(receiptPayments, ReceiptPayment::getReceiptPaymentAmount); |
| | | // é¢ä» |
| | | List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper |
| | | .selectList(new LambdaQueryWrapper<PaymentRegistration>() |
| | | // .ge(PaymentRegistration::getPaymentDate, startDate) |
| | | // .lt(PaymentRegistration::getPaymentDate, endDate) |
| | | ); |
| | | // BigDecimal prepayMoney = |
| | | // paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, |
| | | // BigDecimal::add); |
| | | BigDecimal prepayMoney = sumAmount(paymentRegistrations, PaymentRegistration::getCurrentPaymentAmount); |
| | | StatisticsReceivablePayableDto statisticsReceivablePayableDto = new StatisticsReceivablePayableDto(); |
| | | statisticsReceivablePayableDto.setPayableMoney(payableMoney.subtract(prepayMoney)); |
| | | statisticsReceivablePayableDto.setReceivableMoney(receivableMoney.subtract(advanceMoney)); |
| | | statisticsReceivablePayableDto.setAdvanceMoney(advanceMoney); |
| | | statisticsReceivablePayableDto.setPrepayMoney(prepayMoney); |
| | | //éå®åºåº |
| | | BigDecimal receivableBase = sumSalesContractAmount(startDate, endDate); |
| | | //éå®éè´§ |
| | | BigDecimal salesReturnAmount = sumSalesReturnAmount(startDate, endDate); |
| | | //éè´å
¥åº |
| | | BigDecimal payableBase = sumPurchaseContractAmount(startDate, endDate); |
| | | //éè´éè´§ |
| | | BigDecimal purchaseReturnAmount = sumPurchaseReturnAmount(startDate, endDate); |
| | | //æ¶æ¬¾ |
| | | BigDecimal advanceMoney = sumCollectionAmount(startDate, endDate); |
| | | //仿¬¾ |
| | | BigDecimal prepayMoney = sumPaymentAmount(startDate, endDate); |
| | | |
| | | return statisticsReceivablePayableDto; |
| | | //åºæ¶éé¢=éå®åºåº-éå®éè´§ |
| | | dto.setReceivableMoney(scaleMoney(maxZero(receivableBase.subtract(salesReturnAmount)))); |
| | | //åºä»éé¢=éè´å
¥åº-éè´éè´§ |
| | | dto.setPayableMoney(scaleMoney(maxZero(payableBase.subtract(purchaseReturnAmount)))); |
| | | //æ¶æ¬¾éé¢=æ¶æ¬¾å |
| | | dto.setAdvanceMoney(scaleMoney(advanceMoney)); |
| | | //仿¬¾éé¢=仿¬¾å |
| | | dto.setPrepayMoney(scaleMoney(prepayMoney)); |
| | | return dto; |
| | | } |
| | | |
| | | public static <T> BigDecimal sumAmount(List<T> list, java.util.function.Function<T, BigDecimal> amountExtractor) { |
| | |
| | | String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | |
| | | // 2. æ¥è¯¢æ°æ® |
| | | List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat); |
| | | |
| | | // List<IncomeExpenseAnalysisDto> purchaseList = |
| | | // purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat); |
| | | |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, |
| | | dateFormat); |
| | | |
| | | // 3. 转 Mapï¼èªå¨åå¹¶ï¼ |
| | | Map<String, BigDecimal> incomeMap = incomeList.stream() |
| | |
| | | IncomeExpenseAnalysisDto::getAmount, |
| | | BigDecimal::add)); |
| | | |
| | | // Map<String, BigDecimal> purchaseMap = purchaseList.stream() |
| | | // .collect(Collectors.toMap( |
| | | // IncomeExpenseAnalysisDto::getDateStr, |
| | | // IncomeExpenseAnalysisDto::getAmount, |
| | | // BigDecimal::add)); |
| | | |
| | | |
| | | Map<String, BigDecimal> expenseMap = expenseList.stream() |
| | | .collect(Collectors.toMap( |
| | |
| | | for (String dateStr : xAxis) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("date", dateStr); |
| | | |
| | | // æ¶å
¥ |
| | | BigDecimal income = incomeMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | item.put("income", income.setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | // æ¯åº = éè´ + è´¢å¡æ¯åº |
| | | // BigDecimal purchase = purchaseMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | // æ¯åº |
| | | BigDecimal expense = expenseMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | // BigDecimal totalExpense = purchase.add(expense); |
| | | BigDecimal totalExpense = expense; |
| | | |
| | | item.put("expense", totalExpense.setScale(2, RoundingMode.HALF_UP)); |
| | | item.put("expense", expense.setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | result.add(item); |
| | | } |
| | |
| | | String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | |
| | | List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat); |
| | | |
| | | Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors |
| | | .toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); |
| | |
| | | rawMaterialDto.setName("åææ"); |
| | | rawMaterialDto.setValue(rawMaterialAmount != null ? rawMaterialAmount.toString() : "0"); |
| | | result.add(rawMaterialDto); |
| | | |
| | | List<MapDto> expenseList = accountExpenseMapper.selectExpenseComposition(null, null); |
| | | if (expenseList != null) { |
| | | result.addAll(expenseList); |
| | | } |
| | | } |
| | | |
| | | BigDecimal total = BigDecimal.ZERO; |
| | |
| | | @Override |
| | | public MonthlyIncomeDto monthlyIncome() { |
| | | MonthlyIncomeDto dto = new MonthlyIncomeDto(); |
| | | LocalDate now = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(now); |
| | | LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay(); |
| | | LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59); |
| | | |
| | | LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SalesLedgerProduct::getType, 1); |
| | | wrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | wrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(wrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(products)) { |
| | | return dto; |
| | | } |
| | | |
| | | BigDecimal collected = products.stream() |
| | | .map(SalesLedgerProduct::getInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setMonthlyIncome(collected); |
| | | |
| | | BigDecimal overdue = products.stream() |
| | | .map(SalesLedgerProduct::getPendingInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setOverdueNum(overdue); |
| | | |
| | | BigDecimal total = collected.add(overdue); |
| | | |
| | | if (total.compareTo(BigDecimal.ZERO) > 0) { |
| | | String collectionRate = collected.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setCollectionRate(collectionRate); |
| | | |
| | | String overdueRate = overdue.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setOverdueRate(overdueRate); |
| | | } |
| | | |
| | | LocalDate today = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(today); |
| | | LocalDate startDate = currentMonth.atDay(1); |
| | | LocalDate endDate = currentMonth.atEndOfMonth(); |
| | | //æ¶æ¬¾ |
| | | BigDecimal monthlyIncome = sumCollectionAmount(startDate, endDate); |
| | | //éå®åºåº |
| | | BigDecimal receivableBase = sumSalesContractAmount(startDate, endDate); |
| | | //éå®éè´§ |
| | | BigDecimal salesReturnAmount = sumSalesReturnAmount(startDate, endDate); |
| | | //忬¾ç=æ¶æ¬¾/(éå®åºåº-éå®éè´§)åºæ¶ |
| | | String collectionRate = toRateString(monthlyIncome, receivableBase.subtract(salesReturnAmount)); |
| | | //龿æ°=(éå®åºåºéé¢-éå®éè´§éé¢)åºæ¶éé¢-æ¶æ¬¾éé¢ |
| | | BigDecimal overdueAmount = receivableBase.subtract(salesReturnAmount).subtract(monthlyIncome); |
| | | //龿ç=龿æ°/åºæ¶éé¢ |
| | | String overdueRate = toRateString(overdueAmount, receivableBase); |
| | | dto.setMonthlyIncome(scaleMoney(monthlyIncome)); |
| | | dto.setCollectionRate(collectionRate); |
| | | dto.setOverdueNum(overdueAmount); |
| | | dto.setOverdueRate(overdueRate); |
| | | return dto; |
| | | } |
| | | |
| | | @Override |
| | | public MonthlyExpenditureDto monthlyExpenditure() { |
| | | |
| | | MonthlyExpenditureDto dto = new MonthlyExpenditureDto(); |
| | | LocalDate today = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(today); |
| | | LocalDate startDate = currentMonth.atDay(1); |
| | | LocalDate endDate = currentMonth.atEndOfMonth(); |
| | | //æ¯åº |
| | | BigDecimal monthlyExpenditure = sumPaymentAmount(startDate, endDate); |
| | | //éè´å
¥åº |
| | | BigDecimal payableBase = sumPurchaseContractAmount(startDate, endDate); |
| | | //éè´éè´§ |
| | | BigDecimal purchaseReturnAmount = sumPurchaseReturnAmount(startDate, endDate); |
| | | //仿¬¾ç=仿¬¾/(éè´å
¥åº-éè´éè´§)åºä» |
| | | String paymentRate = toRateString(monthlyExpenditure, payableBase.subtract(purchaseReturnAmount)); |
| | | //æ¶æ¬¾ |
| | | BigDecimal monthlyIncome = sumCollectionAmount(startDate, endDate); |
| | | //æ¯å©æ¶¦= æ¶æ¬¾-æ¯åº |
| | | BigDecimal grossProfit = monthlyIncome.subtract(monthlyExpenditure); |
| | | //婿¶¦ç=æ¯å©æ¶¦/æ¶æ¬¾ |
| | | String profitMarginRate = toRateString(grossProfit, monthlyIncome); |
| | | |
| | | // 彿æ¶é´èå´ |
| | | LocalDate now = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(now); |
| | | LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay(); |
| | | LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59); |
| | | |
| | | // éè´å°è´¦ï¼type = 2ï¼ |
| | | LambdaQueryWrapper<SalesLedgerProduct> purchaseWrapper = new LambdaQueryWrapper<>(); |
| | | purchaseWrapper.eq(SalesLedgerProduct::getType, 2); |
| | | purchaseWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | purchaseWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> purchaseProducts = salesLedgerProductMapper.selectList(purchaseWrapper); |
| | | |
| | | BigDecimal rawMaterialCost = BigDecimal.ZERO; // åææææ¬ |
| | | BigDecimal paidAmount = BigDecimal.ZERO; // 已仿¬¾éé¢ |
| | | BigDecimal pendingAmount = BigDecimal.ZERO; // å¾
仿¬¾éé¢ |
| | | |
| | | if (!CollectionUtils.isEmpty(purchaseProducts)) { |
| | | for (SalesLedgerProduct p : purchaseProducts) { |
| | | |
| | | if (p.getTaxInclusiveTotalPrice() != null) { |
| | | rawMaterialCost = rawMaterialCost.add(p.getTaxInclusiveTotalPrice()); |
| | | } |
| | | |
| | | if (p.getTicketsTotal() != null) { |
| | | paidAmount = paidAmount.add(p.getTicketsTotal()); |
| | | } |
| | | |
| | | if (p.getPendingTicketsTotal() != null) { |
| | | pendingAmount = pendingAmount.add(p.getPendingTicketsTotal()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å
¶ä»è´¹ç¨ |
| | | LambdaQueryWrapper<AccountExpense> expenseWrapper = new LambdaQueryWrapper<>(); |
| | | expenseWrapper.ge(AccountExpense::getExpenseDate, |
| | | java.sql.Date.valueOf(currentMonth.atDay(1))); |
| | | expenseWrapper.le(AccountExpense::getExpenseDate, |
| | | java.sql.Date.valueOf(currentMonth.atEndOfMonth())); |
| | | |
| | | List<AccountExpense> expenses = accountExpenseMapper.selectList(expenseWrapper); |
| | | |
| | | BigDecimal otherExpense = BigDecimal.ZERO; |
| | | if (!CollectionUtils.isEmpty(expenses)) { |
| | | for (AccountExpense e : expenses) { |
| | | if (e.getExpenseMoney() != null) { |
| | | otherExpense = otherExpense.add(e.getExpenseMoney()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æåº¦æ»æ¯åº |
| | | // BigDecimal monthlyExpenditure = rawMaterialCost.add(otherExpense); |
| | | BigDecimal monthlyExpenditure = otherExpense; |
| | | dto.setMonthlyExpenditure(monthlyExpenditure); |
| | | |
| | | // 已仿¬¾ ÷ï¼å·²ä»æ¬¾ + å¾
仿¬¾ï¼ |
| | | BigDecimal totalPayable = paidAmount.add(pendingAmount); |
| | | if (totalPayable.compareTo(BigDecimal.ZERO) > 0) { |
| | | String paymentRate = paidAmount |
| | | .divide(totalPayable, 4, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setPaymentRate(paymentRate); |
| | | } |
| | | |
| | | // å®å°è´¦ï¼type = 1ï¼ |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesWrapper = new LambdaQueryWrapper<>(); |
| | | salesWrapper.eq(SalesLedgerProduct::getType, 1); |
| | | salesWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | salesWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> salesProducts = salesLedgerProductMapper.selectList(salesWrapper); |
| | | |
| | | BigDecimal revenue = BigDecimal.ZERO; |
| | | if (!CollectionUtils.isEmpty(salesProducts)) { |
| | | for (SalesLedgerProduct s : salesProducts) { |
| | | if (s.getInvoiceAmount() != null) { |
| | | revenue = revenue.add(s.getInvoiceAmount()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ¯å©æ¶¦ & 婿¶¦ç |
| | | if (revenue.compareTo(BigDecimal.ZERO) > 0) { |
| | | |
| | | // æ¯å©æ¶¦ = é宿¶å
¥ - åææææ¬ |
| | | BigDecimal grossProfit = revenue.subtract(rawMaterialCost); |
| | | dto.setGrossProfit(grossProfit); |
| | | |
| | | // 婿¶¦ç = (é宿¶å
¥ - æåº¦æ»æ¯åº) / é宿¶å
¥ |
| | | BigDecimal profit = revenue.subtract(monthlyExpenditure); |
| | | String profitMarginRate = profit |
| | | .divide(revenue, 4, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | |
| | | dto.setProfitMarginRate(profitMarginRate); |
| | | } |
| | | |
| | | dto.setMonthlyExpenditure(scaleMoney(monthlyExpenditure)); |
| | | dto.setPaymentRate(paymentRate); |
| | | dto.setGrossProfit(scaleMoney(grossProfit)); |
| | | dto.setProfitMarginRate(profitMarginRate); |
| | | return dto; |
| | | } |
| | | |
| | |
| | | BigDecimal unqualifiedCount = BigDecimal.ZERO; |
| | | |
| | | for (QualityInspect item : list) { |
| | | if ("åæ ¼".equals(item.getCheckResult())) { |
| | | qualifiedCount = qualifiedCount.add(item.getQuantity()); |
| | | } else { |
| | | unqualifiedCount = unqualifiedCount.add(item.getQuantity()); |
| | | } |
| | | qualifiedCount = qualifiedCount.add(item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO); |
| | | unqualifiedCount = unqualifiedCount.add(item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO); |
| | | } |
| | | |
| | | BigDecimal totalCount = qualifiedCount.add(unqualifiedCount); |
| | |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal quantity = item.getQuantity(); |
| | | BigDecimal qualifiedQty = item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualifiedQty = item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | |
| | | if ("åæ ¼".equals(item.getCheckResult())) { |
| | | dto.setQualifiedCount(dto.getQualifiedCount().add(quantity)); |
| | | } else { |
| | | dto.setUnqualifiedCount(dto.getUnqualifiedCount().add(quantity)); |
| | | } |
| | | dto.setQualifiedCount(dto.getQualifiedCount().add(qualifiedQty)); |
| | | dto.setUnqualifiedCount(dto.getUnqualifiedCount().add(unqualifiedQty)); |
| | | } |
| | | |
| | | // 计ç®åæ ¼ç |
| | |
| | | BigDecimal unqualifiedCount = BigDecimal.ZERO; |
| | | |
| | | for (QualityInspect item : items) { |
| | | BigDecimal qty = item.getQuantity(); |
| | | totalCount = totalCount.add(qty); |
| | | BigDecimal qualifiedQty = item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualifiedQty = item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | |
| | | if ("åæ ¼".equals(item.getCheckResult())) { |
| | | qualifiedCount = qualifiedCount.add(qty); |
| | | } else { |
| | | unqualifiedCount = unqualifiedCount.add(qty); |
| | | } |
| | | totalCount = totalCount.add(qualifiedQty.add(unqualifiedQty)); |
| | | qualifiedCount = qualifiedCount.add(qualifiedQty); |
| | | unqualifiedCount = unqualifiedCount.add(unqualifiedQty); |
| | | } |
| | | |
| | | if (totalCount.compareTo(BigDecimal.ZERO) == 0) { |
| | |
| | | dto.setProcessNum(sumQuantity(qualityInspectList, 1)); // è¿ç¨ |
| | | dto.setFactoryNum(sumQuantity(qualityInspectList, 2)); // åºå |
| | | |
| | | // å设 qualityInspectList æ¯ä¸ä¸ª List<QualityInspect> ç±»åçéå |
| | | Map<String, List<QualityInspect>> groupedByCheckResult = qualityInspectList.stream() |
| | | .collect(Collectors.groupingBy(QualityInspect::getCheckResult)); |
| | | List<QualityInspect> qualityInspects = groupedByCheckResult.get("ä¸åæ ¼"); |
| | | if (ObjectUtils.isNull(qualityInspects) || qualityInspects.size() == 0) { |
| | | return null; |
| | | // æ ¹æ® unqualifiedQuantity > 0 çéä¸åæ ¼è®°å½ |
| | | List<QualityInspect> qualityInspects = qualityInspectList.stream() |
| | | .filter(i -> i.getUnqualifiedQuantity() != null && i.getUnqualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (ObjectUtils.isEmpty(qualityInspects)) { |
| | | // å³ä½¿æ²¡æä¸åæ ¼è®°å½ï¼ä¹åºè¯¥è¿åç»è®¡æ°æ®ï¼åªæ¯å¾è¡¨é¡¹ä¸ºç©º |
| | | dto.setItem(new ArrayList<>()); |
| | | return dto; |
| | | } |
| | | |
| | | // 4. å¤çå¾è¡¨é¡¹ (Item) |
| | | List<QualityStatisticsItem> itemList = new ArrayList<>(); |
| | | |
| | |
| | | private BigDecimal sumQuantity(List<QualityInspect> list, Integer type) { |
| | | return list.stream() |
| | | .filter(i -> i.getInspectType().equals(type)) |
| | | .map(QualityInspect::getQuantity) |
| | | .filter(Objects::nonNull) |
| | | .map(i -> { |
| | | BigDecimal qualified = i.getQualifiedQuantity() != null ? i.getQualifiedQuantity() : BigDecimal.ZERO; |
| | | BigDecimal unqualified = i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO; |
| | | return qualified.add(unqualified); |
| | | }) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | |
| | | QualityStatisticsItem item = new QualityStatisticsItem(); |
| | | item.setDate(dateLabel); |
| | | |
| | | item.setSupplierNum(list.stream().filter(i -> i.getInspectType() == 0).map(QualityInspect::getQuantity) |
| | | // ç»è®¡æ¯ç§æ£éªç±»åçä¸åæ ¼æ°é |
| | | item.setSupplierNum(list.stream() |
| | | .filter(i -> i.getInspectType() == 0) |
| | | .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | item.setProcessNum(list.stream().filter(i -> i.getInspectType() == 1).map(QualityInspect::getQuantity) |
| | | item.setProcessNum(list.stream() |
| | | .filter(i -> i.getInspectType() == 1) |
| | | .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | item.setFactoryNum(list.stream().filter(i -> i.getInspectType() == 2).map(QualityInspect::getQuantity) |
| | | item.setFactoryNum(list.stream() |
| | | .filter(i -> i.getInspectType() == 2) |
| | | .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | |
| | | return item; |
| | |
| | | return productionOperationTaskMapper.calculateProductionStatistics(startDateTime, endDateTime, userId, processIds); |
| | | } |
| | | |
| | | private LocalDate[] resolveFinanceRange(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | int safeType = type == null ? 1 : type; |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | switch (safeType) { |
| | | case 1: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month firstMonthOfQuarter = today.getMonth().firstMonthOfQuarter(); |
| | | startDate = LocalDate.of(today.getYear(), firstMonthOfQuarter, 1); |
| | | endDate = startDate.plusMonths(2).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | } |
| | | return new LocalDate[]{startDate, endDate}; |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çéå®åºåºéé¢ |
| | | private BigDecimal sumSalesContractAmount(LocalDate startDate, LocalDate endDate) { |
| | | SalesOutboundDto salesOutboundDto = new SalesOutboundDto(); |
| | | salesOutboundDto.setStartDate(startDate); |
| | | salesOutboundDto.setEndDate(endDate); |
| | | List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords(); |
| | | return sumAmount(salesOutboundVos, SalesOutboundVo::getOutboundAmount); |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çéå®éè´§éé¢ |
| | | private BigDecimal sumSalesReturnAmount(LocalDate startDate, LocalDate endDate) { |
| | | SalesReturnDto salesReturnDto = new SalesReturnDto(); |
| | | salesReturnDto.setStartDate(startDate); |
| | | salesReturnDto.setEndDate(endDate); |
| | | List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords(); |
| | | return sumAmount(salesReturnVos, SalesReturnVo::getRefundAmount); |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çéè´å
¥åºéé¢ |
| | | private BigDecimal sumPurchaseContractAmount(LocalDate startDate, LocalDate endDate) { |
| | | PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto(); |
| | | purchaseInboundDto.setStartDate(startDate); |
| | | purchaseInboundDto.setEndDate(endDate); |
| | | List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords(); |
| | | return sumAmount(purchaseInboundVos, PurchaseInboundVo::getInboundAmount); |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çéè´éè´§éé¢ |
| | | private BigDecimal sumPurchaseReturnAmount(LocalDate startDate, LocalDate endDate) { |
| | | PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto(); |
| | | purchaseReturnDto.setStartDate(startDate); |
| | | purchaseReturnDto.setEndDate(endDate); |
| | | List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords(); |
| | | return sumAmount(purchaseReturnVos, PurchaseReturnVo::getTotalAmount); |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çæ»æ¶æ¬¾éé¢ |
| | | private BigDecimal sumCollectionAmount(LocalDate startDate, LocalDate endDate) { |
| | | List<AccountSalesCollection> collections = defaultList(accountSalesCollectionMapper.selectList( |
| | | new LambdaQueryWrapper<AccountSalesCollection>() |
| | | .ge(AccountSalesCollection::getCollectionDate, startDate) |
| | | .le(AccountSalesCollection::getCollectionDate, endDate))); |
| | | return sumAmount(collections, AccountSalesCollection::getCollectionAmount); |
| | | } |
| | | |
| | | //è®¡ç®æ¥æå
çæ»ä»æ¬¾éé¢ |
| | | private BigDecimal sumPaymentAmount(LocalDate startDate, LocalDate endDate) { |
| | | List<AccountPurchasePayment> payments = defaultList(accountPurchasePaymentMapper.selectList( |
| | | new LambdaQueryWrapper<AccountPurchasePayment>() |
| | | .ge(AccountPurchasePayment::getPaymentDate, startDate) |
| | | .le(AccountPurchasePayment::getPaymentDate, endDate))); |
| | | return sumAmount(payments, AccountPurchasePayment::getPaymentAmount); |
| | | } |
| | | |
| | | private Date toDate(LocalDate localDate) { |
| | | return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private Date toExclusiveEndDate(LocalDate localDate) { |
| | | return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | private String toRateString(BigDecimal numerator, BigDecimal denominator) { |
| | | if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return "0.00"; |
| | | } |
| | | return defaultDecimal(numerator) |
| | | .divide(denominator, 4, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | } |
| | | |
| | | private BigDecimal maxZero(BigDecimal value) { |
| | | if (value == null) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private BigDecimal scaleMoney(BigDecimal value) { |
| | | return defaultDecimal(value).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private <T> List<T> defaultList(List<T> list) { |
| | | return list == null ? List.of() : list; |
| | | } |
| | | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | |
| | | if (StringUtils.isNotBlank(inspectionTaskDto.getInspectionProject())) { |
| | | queryWrapper.like(InspectionTask::getInspectionProject, inspectionTaskDto.getInspectionProject()); |
| | | } |
| | | queryWrapper.orderByDesc(InspectionTask::getCreateTime); |
| | | IPage<InspectionTask> entityPage = inspectionTaskMapper.selectPage(page, queryWrapper); |
| | | |
| | | // æ æ°æ®æåè¿å |
| | |
| | | if (timingTask.getIsEnabled() != null) { |
| | | queryWrapper.eq(TimingTask::getIsEnabled, timingTask.getIsEnabled()); |
| | | } |
| | | queryWrapper.orderByDesc(TimingTask::getCreateTime); |
| | | IPage<TimingTask> taskPage = timingTaskMapper.selectPage(page, queryWrapper); |
| | | |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.lavorissue.dto.StatisticsLaborIssue; |
| | | import com.ruoyi.lavorissue.mapper.LavorIssueMapper; |
| | | import com.ruoyi.lavorissue.pojo.LaborIssue; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "å³ä¿åæ¾-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å³ä¿åæ¾-å页æ¥è¯¢") |
| | | public R<?> listPage(Page page, LaborIssue laborIssue){ |
| | | public AjaxResult listPage(Page page, LaborIssue laborIssue){ |
| | | IPage<LaborIssue> listPage = laborIssueService.listPage(page, laborIssue); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @GetMapping("/statisticsList") |
| | | @Log(title = "å³ä¿åæ¾-ç»è®¡æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å³ä¿åæ¾-ç»è®¡æ¥è¯¢") |
| | | public R<?> statisticsList(LaborIssue laborIssue){ |
| | | public AjaxResult statisticsList(LaborIssue laborIssue){ |
| | | List<Map<String, Object>> listPage = laborIssueService.statisticsList(laborIssue); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "å³ä¿åæ¾-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "å³ä¿åæ¾-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> add(@RequestBody LaborIssue laborIssue){ |
| | | public AjaxResult add(@RequestBody LaborIssue laborIssue){ |
| | | String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | StartAndEndDateDto dateTime = DailyRedisCounter.getDateTime(); |
| | | Long approveId = lavorIssueMapper.selectCount(new LambdaQueryWrapper<LaborIssue>() |
| | |
| | | laborIssue.setOrderNo(String.format("%03d", l + 1)); |
| | | } |
| | | boolean save = laborIssueService.save(laborIssue); |
| | | return save ? R.ok() : R.fail(); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "å³ä¿åæ¾-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "å³ä¿åæ¾-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> update(@RequestBody LaborIssue laborIssue){ |
| | | public AjaxResult update(@RequestBody LaborIssue laborIssue){ |
| | | boolean update = laborIssueService.updateById(laborIssue); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "å³ä¿åæ¾-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å³ä¿åæ¾-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | boolean delete = laborIssueService.removeBatchByIds(ids); |
| | | return delete ? R.ok() : R.fail(); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @GetMapping("/statistics") |
| | | @Operation(summary = "å³ä¿åæ¾-ç»è®¡") |
| | | public R<?> statistics(StatisticsLaborIssue req) throws Exception { |
| | | public AjaxResult statistics(StatisticsLaborIssue req) throws Exception { |
| | | StatisticsLaborIssue statisticsLaborIssue = laborIssueService.statistics(req); |
| | | return R.ok(statisticsLaborIssue); |
| | | return AjaxResult.success(statisticsLaborIssue); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-å页æ¥è¯¢") |
| | | @Log(title = "计éå¨å
·å°è´¦-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | IPage<MeasuringInstrumentLedger> listPage = measuringInstrumentLedgerService.listPage(page, measuringInstrumentLedger); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | |
| | |
| | | @Operation(summary = "计éå¨å
·å°è´¦-æ°å¢") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ°å¢", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | public AjaxResult add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | boolean save = measuringInstrumentLedgerService.add(measuringInstrumentLedger); |
| | | if (save) { |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-ä¿®æ¹") |
| | | @Log(title = "计éå¨å
·å°è´¦-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | if (sysUser == null) { |
| | | return R.fail("ç¨æ·ä¸åå¨"); |
| | | return AjaxResult.error("ç¨æ·ä¸åå¨"); |
| | | } |
| | | measuringInstrumentLedger.setUserName(sysUser.getUserName()); |
| | | boolean update = measuringInstrumentLedgerService.updateById(measuringInstrumentLedger); |
| | | if (update) { |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-å é¤") |
| | | @Log(title = "计éå¨å
·å°è´¦-å é¤", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | for (Long id : ids) { |
| | | LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId,id); |
| | | List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(queryWrapper); |
| | | if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){ |
| | | return R.fail("请å
å é¤éä¸è®¡éå¨å
·å°è´¦ä¸çæææ£å®è®°å½"); |
| | | return AjaxResult.error("请å
å é¤éä¸è®¡éå¨å
·å°è´¦ä¸çæææ£å®è®°å½"); |
| | | } |
| | | } |
| | | boolean delete = measuringInstrumentLedgerService.removeBatchByIds(ids); |
| | | if (delete) { |
| | | return R.ok(); |
| | | return AjaxResult.success(); |
| | | } |
| | | return R.fail(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/verifying") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-æ£å®") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ£å®", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<?> verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | public AjaxResult verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | boolean update = measuringInstrumentLedgerService.verifying(measuringInstrumentLedger); |
| | | return update ? R.ok(null, "æ£å®æå") : R.fail("æ£å®å¤±è´¥"); |
| | | return update ? AjaxResult.success("æ£å®æå") : AjaxResult.error("æ£å®å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| src/main/java/com/ruoyi/measuringinstrumentledger/controller/MeasuringInstrumentLedgerRecordController.java
src/main/java/com/ruoyi/measuringinstrumentledger/controller/SparePartsController.java
src/main/java/com/ruoyi/measuringinstrumentledger/controller/SparePartsRequisitionRecordController.java
src/main/java/com/ruoyi/officesupplies/controller/OfficeSuppliesController.java
src/main/java/com/ruoyi/officesupplies/service/OfficeSuppliesService.java
src/main/java/com/ruoyi/officesupplies/service/impl/OfficeSuppliesServiceImpl.java
src/main/java/com/ruoyi/procurementrecord/controller/GasTankWarningController.java
src/main/java/com/ruoyi/procurementrecord/controller/InboundManagementController.java
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementPlanController.java
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementPriceManagementController.java
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java
src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java
src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java
src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java
src/main/java/com/ruoyi/production/pojo/ProductionOrder.java
src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java
src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
src/main/java/com/ruoyi/project/common/CaptchaController.java
src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
src/main/java/com/ruoyi/project/monitor/controller/ServerController.java
src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java
src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java
src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java
src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java
src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java
src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java
src/main/java/com/ruoyi/project/system/controller/SysLoginController.java
src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
src/main/java/com/ruoyi/project/system/controller/SysPostController.java
src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java
src/main/java/com/ruoyi/project/system/controller/SysRoleController.java
src/main/java/com/ruoyi/project/system/controller/SysUserClientController.java
src/main/java/com/ruoyi/project/system/controller/SysUserController.java
src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java
src/main/java/com/ruoyi/project/system/service/ISysUserService.java
src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java
src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
src/main/java/com/ruoyi/projectManagement/controller/InfoController.java
src/main/java/com/ruoyi/projectManagement/controller/PlanController.java
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java
src/main/java/com/ruoyi/purchase/controller/InvoicePurchaseController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/PaymentRegistrationController.java (已删除)
src/main/java/com/ruoyi/purchase/controller/ProcurementBusinessSummaryController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerTemplateController.java
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java (已删除)
src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseReportDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PaymentRegistrationDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/ProductRecordDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
src/main/java/com/ruoyi/purchase/dto/TicketRegistrationDto.java (已删除)
src/main/java/com/ruoyi/purchase/dto/VatDto.java
src/main/java/com/ruoyi/purchase/mapper/InvoicePurchaseMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/PaymentRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/ProductRecordMapper.java (已删除)
src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java
src/main/java/com/ruoyi/purchase/mapper/TicketRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/InvoicePurchase.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java (已删除)
src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java (已删除)
src/main/java/com/ruoyi/purchase/service/IInvoicePurchaseService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IPaymentRegistrationService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IProductRecordService.java (已删除)
src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
src/main/java/com/ruoyi/purchase/service/ITicketRegistrationService.java (已删除)
src/main/java/com/ruoyi/purchase/service/PurchaseReportService.java
src/main/java/com/ruoyi/purchase/service/impl/InvoicePurchaseServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReportServiceImpl.java
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/purchase/vo/PurchaseReportVo.java
src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsDetailsVo.java
src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsVo.java
src/main/java/com/ruoyi/quality/controller/QualityInspectFileController.java
src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
src/main/java/com/ruoyi/quality/utils/QualityInspectHelper.java
src/main/java/com/ruoyi/sales/controller/CommonFileController.java
src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java (已删除)
src/main/java/com/ruoyi/sales/controller/InvoiceRegistrationController.java (已删除)
src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java
src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java
src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java (已删除)
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
src/main/java/com/ruoyi/sales/controller/SalespersonManagementController.java
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationProductDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentExeclDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/ReceiptPaymentRecordDto.java (已删除)
src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java
src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java
src/main/java/com/ruoyi/sales/excel/InvoiceRegisAndProductExcelDto.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerFileMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationProductMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java (已删除)
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
src/main/java/com/ruoyi/sales/pojo/InvoiceLedger.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceLedgerFile.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceRegistration.java (已删除)
src/main/java/com/ruoyi/sales/pojo/InvoiceRegistrationProduct.java (已删除)
src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java
src/main/java/com/ruoyi/sales/pojo/ReceiptPayment.java (已删除)
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
src/main/java/com/ruoyi/sales/pojo/ShippingInfo.java
src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java
src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java (已删除)
src/main/java/com/ruoyi/sales/service/InvoiceRegistrationService.java (已删除)
src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java (已删除)
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/InvoiceRegistrationServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/MetricStatisticsServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java (已删除)
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
src/main/java/com/ruoyi/sales/vo/CustomerTransactionsDetailsVo.java
src/main/java/com/ruoyi/sales/vo/CustomerTransactionsVo.java
src/main/java/com/ruoyi/staff/controller/AnalyticsController.java
src/main/java/com/ruoyi/staff/controller/BankController.java
src/main/java/com/ruoyi/staff/controller/HolidayApplicationController.java
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceRecordsController.java
src/main/java/com/ruoyi/staff/controller/SchemeApplicableStaffController.java
src/main/java/com/ruoyi/staff/controller/StaffContractController.java
src/main/java/com/ruoyi/staff/controller/StaffLeaveController.java
src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java
src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java
src/main/java/com/ruoyi/staff/controller/StaffSchedulingController.java
src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java
src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java
src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java
src/main/java/com/ruoyi/staff/service/SchemeApplicableStaffService.java
src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java
src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
src/main/java/com/ruoyi/stock/service/StockInRecordService.java
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java
src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java
src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java
src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java
src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java
src/main/java/com/ruoyi/warehouse/controller/DocumentClassificationController.java
src/main/java/com/ruoyi/warehouse/controller/DocumentationBorrowManagementController.java
src/main/java/com/ruoyi/warehouse/controller/DocumentationController.java
src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesRowcolController.java
src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java
src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java
src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java
src/main/java/com/ruoyi/waterrecord/service/WaterRecordService.java
src/main/java/com/ruoyi/waterrecord/service/impl/WaterRecordServiceImpl.java
src/main/resources/application-ckgm.yml
src/main/resources/application-dev.yml
src/main/resources/application-hqjc.yml
src/main/resources/financial-agent-prompt.txt
src/main/resources/mapper/account/AccountExpenseMapper.xml (已删除)
src/main/resources/mapper/account/AccountFileMapper.xml (已删除)
src/main/resources/mapper/account/AccountIncomeMapper.xml (已删除)
src/main/resources/mapper/account/AccountStatementMapper.xml
src/main/resources/mapper/account/BorrowInfoMapper.xml (已删除)
src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml
src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
src/main/resources/mapper/approve/ApprovalInstanceMapper.xml
src/main/resources/mapper/approve/ApprovalInstanceNodeMapper.xml
src/main/resources/mapper/approve/ApprovalRecordMapper.xml
src/main/resources/mapper/approve/ApprovalTaskMapper.xml
src/main/resources/mapper/approve/ApprovalTemplateMapper.xml
src/main/resources/mapper/approve/ApprovalTemplateNodeApproverMapper.xml
src/main/resources/mapper/approve/ApprovalTemplateNodeMapper.xml
src/main/resources/mapper/approve/ApproveProcessMapper.xml
src/main/resources/mapper/approve/FinReimbursementDetailMapper.xml
src/main/resources/mapper/approve/FinReimbursementMapper.xml
src/main/resources/mapper/approve/FinReimbursementTravelMapper.xml
src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
src/main/resources/mapper/basic/CustomerMapper.xml
src/main/resources/mapper/basic/ProductModelMapper.xml
src/main/resources/mapper/basic/SupplierManageMapper.xml
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsMapper.xml
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeDeptMapper.xml
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeUserMapper.xml
src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
src/main/resources/mapper/device/DeviceRepairMapper.xml
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml
src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml (已删除)
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml (已删除)
src/main/resources/mapper/purchase/ProductRecordMapper.xml (已删除)
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
src/main/resources/mapper/quality/QualityInspectMapper.xml
src/main/resources/mapper/quality/QualityTestStandardMapper.xml
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml (已删除)
src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml (已删除)
src/main/resources/mapper/sales/InvoiceRegistrationProductMapper.xml (已删除)
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml (已删除)
src/main/resources/mapper/sales/SalesLedgerMapper.xml
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
src/main/resources/mapper/sales/SalesQuotationMapper.xml
src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
src/main/resources/mapper/staff/PersonalShiftMapper.xml
src/main/resources/mapper/staff/StaffLeaveMapper.xml
src/main/resources/mapper/staff/StaffOnJobMapper.xml
src/main/resources/mapper/stock/StockInRecordMapper.xml
src/main/resources/mapper/stock/StockInventoryMapper.xml
src/main/resources/mapper/stock/StockOutRecordMapper.xml
src/main/resources/mapper/system/SysDeptMapper.xml
src/main/resources/mapper/system/SysDictTypeMapper.xml
src/main/resources/mapper/system/SysNoticeMapper.xml
src/main/resources/mapper/system/SysPostMapper.xml
src/main/resources/mapper/system/SysUserMapper.xml
src/main/resources/mapper/technology/TechnologyOperationMapper.xml
src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml
src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
src/main/resources/mapper/warehouse/DocumentationMapper.xml
src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml |