Merge branch 'dev_New_pro' into dev_宁夏_英泽防锈
已添加12个文件
已重命名23个文件
已修改208个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # éå®å©æå端èè°ææ¡£ï¼`/sales-ai`ï¼ |
| | | > æ´æ°æ¶é´ï¼2026-05-18 |
| | | > éç¨æ¨¡åï¼å®¢æ·æ¡£æ¡ï¼ç§æµ·/å
¬æµ·ï¼ãé宿¥ä»·ãéå®å°è´¦ãéå®éè´§ã客æ·å¾æ¥ãåè´§å°è´¦ãææ ç»è®¡ |
| | | > éç¹è½åï¼å®¢æ·æµå¤±é£é©åæã忬¾ä¸æ¥ä»·çç¥å»ºè®® |
| | | |
| | | ## 1. æ¥å£æ»è§ |
| | | |
| | | 1. æµå¼å¯¹è¯ï¼`POST /sales-ai/chat` |
| | | 2. ä¼è¯å表ï¼`GET /sales-ai/history/sessions` |
| | | 3. ä¼è¯æ¶æ¯ï¼`GET /sales-ai/history/messages/{memoryId}` |
| | | 4. å é¤ä¼è¯ï¼`DELETE /sales-ai/history/{memoryId}` |
| | | |
| | | 说æï¼ |
| | | - `/chat` è¿å `text/stream;charset=utf-8`ï¼SSE ææ¬æµï¼ã |
| | | - å½ä¸å·¥å
·æ¶ï¼æç»å
容为 **JSON å符串**ï¼é `AjaxResult`ï¼ã |
| | | - æªå½ä¸å·¥å
·æ¶ï¼è¿åæ®éä¸æææ¬ã |
| | | |
| | | ## 2. å¯¹è¯æ¥å£ |
| | | |
| | | ### 2.1 è¯·æ± |
| | | |
| | | ```http |
| | | POST /sales-ai/chat |
| | | Content-Type: application/json |
| | | ``` |
| | | |
| | | ```json |
| | | { |
| | | "memoryId": "sales-ai-001", |
| | | "message": "帮æåå®¢æ·æµå¤±é£é©åæï¼è¿90天ï¼å10æ¡" |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | | åæ®µ | ç±»å | å¿
å¡« | 说æ | |
| | | | --- | --- | --- | --- | |
| | | | `memoryId` | string | æ¯ | ä¼è¯ IDï¼å端çæå¹¶å¤ç¨ | |
| | | | `message` | string | æ¯ | ç¨æ·è¾å
¥ | |
| | | |
| | | ### 2.2 è¿åå¤ç |
| | | |
| | | å端建议æµç¨ï¼ |
| | | 1. å
ææµæ¼æ¥å®æ´ææ¬ `fullText`ã |
| | | 2. å°è¯ `JSON.parse(fullText)`ï¼ |
| | | - æåï¼æ `type` è·¯ç±å°ç»æåç»ä»¶ã |
| | | - å¤±è´¥ï¼ææ®éèå¤©ææ¬å±ç¤ºã |
| | | |
| | | ## 3. ç»æåååºåè®® |
| | | |
| | | ### 3.1 éç¨ç»æ |
| | | |
| | | ```json |
| | | { |
| | | "success": true, |
| | | "type": "sales_dashboard", |
| | | "description": "å·²è¿åé宿æ ç»è®¡", |
| | | "summary": {}, |
| | | "data": {}, |
| | | "charts": {} |
| | | } |
| | | ``` |
| | | |
| | | ### 3.2 `type` æä¸¾ |
| | | |
| | | | type | åºæ¯ | |
| | | | --- | --- | |
| | | | `sales_customer_profile_list` | å®¢æ·æ¡£æ¡ï¼ç§æµ·/å
¬æµ·ï¼ | |
| | | | `sales_quotation_list` | é宿¥ä»· | |
| | | | `sales_ledger_list` | éå®å°è´¦ | |
| | | | `sales_return_list` | éå®éè´§ | |
| | | | `sales_customer_interaction_list` | 客æ·å¾æ¥ï¼åæ¬¾ï¼ | |
| | | | `sales_shipping_list` | åè´§å°è´¦ | |
| | | | `sales_dashboard` | ææ ç»è®¡ | |
| | | | `sales_customer_churn_risk` | å®¢æ·æµå¤±é£é©åæ | |
| | | | `sales_collection_quote_strategy` | 忬¾ä¸æ¥ä»·çç¥å»ºè®® | |
| | | |
| | | ## 4. èåè½åæ å°ï¼å¯¹åºè¥é管çï¼ |
| | | |
| | | 1. å®¢æ·æ¡£æ¡ï¼ç§æµ·ï¼ï¼ç¤ºä¾æé® `æ¥è¯¢ç§æµ·å®¢æ·æ¡£æ¡å10æ¡` |
| | | 2. å®¢æ·æ¡£æ¡ï¼å
¬æµ·ï¼ï¼ç¤ºä¾æé® `æ¥è¯¢å
¬æµ·å®¢æ·æ¡£æ¡` |
| | | 3. é宿¥ä»·ï¼ç¤ºä¾æé® `æ¥è¯¢æ¬æé宿¥ä»·` |
| | | 4. éå®å°è´¦ï¼ç¤ºä¾æé® `æ¥è¯¢æ¬æéå®å°è´¦` |
| | | 5. éå®éè´§ï¼ç¤ºä¾æé® `æ¥è¯¢è¿30天éå®éè´§` |
| | | 6. 客æ·å¾æ¥ï¼ç¤ºä¾æé® `æ¥è¯¢è¿30天客æ·åæ¬¾å¾æ¥` |
| | | 7. åè´§å°è´¦ï¼ç¤ºä¾æé® `æ¥è¯¢æ¬æåè´§å°è´¦` |
| | | 8. ææ ç»è®¡ï¼ç¤ºä¾æé® `æ¥çé宿æ ç»è®¡` |
| | | |
| | | ## 5. éç¹è½åèè° |
| | | |
| | | ### 5.1 å®¢æ·æµå¤±é£é©åæï¼`sales_customer_churn_risk`ï¼ |
| | | |
| | | æ°æ®ä½ç½®ï¼ |
| | | - å表ï¼`data.items` |
| | | - æ±æ»ï¼`summary.highRiskCount / mediumRiskCount / lowRiskCount` |
| | | - å¾è¡¨ï¼`charts.riskLevelPieOption`ã`charts.riskScoreBarOption` |
| | | |
| | | å项常ç¨åæ®µï¼ |
| | | - `customerName` |
| | | - `riskLevel`ï¼`high`/`medium`/`low`ï¼ |
| | | - `riskScore`ï¼0-100ï¼ |
| | | - `pendingAmount` |
| | | - `pendingRate` |
| | | - `daysSinceLastOrder` |
| | | - `riskReasons`ï¼å符串æ°ç»ï¼ |
| | | |
| | | ### 5.2 忬¾ä¸æ¥ä»·çç¥å»ºè®®ï¼`sales_collection_quote_strategy`ï¼ |
| | | |
| | | æ°æ®ä½ç½®ï¼ |
| | | - çç¥å¡ï¼`data.items` |
| | | - æ±æ»ï¼`summary.highPriorityCount / mediumPriorityCount / lowPriorityCount` |
| | | - å¾è¡¨ï¼`charts.pendingAmountBarOption`ã`charts.priorityPieOption` |
| | | |
| | | å项常ç¨åæ®µï¼ |
| | | - `customerName` |
| | | - `priority`ï¼`high`/`medium`/`low`ï¼ |
| | | - `pendingAmount` |
| | | - `quoteConversionRate` |
| | | - `collectionStrategy` |
| | | - `quotationStrategy` |
| | | - `nextAction` |
| | | |
| | | ## 6. ææ ç»è®¡èè°ï¼`sales_dashboard`ï¼ |
| | | |
| | | å
³é®åæ®µï¼ |
| | | - `summary.contractAmountTotal` |
| | | - `summary.receivedAmountTotal` |
| | | - `summary.pendingAmountTotal` |
| | | - `summary.shipRate` |
| | | |
| | | å¾è¡¨å段ï¼å¯ç´æ¥ç» EChartsï¼ï¼ |
| | | - `charts.amountBarOption` |
| | | - `charts.shippingPieOption` |
| | | - `charts.customerTopBarOption` |
| | | - `charts.contractTrendLineOption` |
| | | |
| | | éå æ°æ®ï¼ |
| | | - `data.topCustomers` |
| | | - `data.contractTrend` |
| | | |
| | | ## 7. ä¼è¯å岿¥å£ |
| | | |
| | | ### 7.1 ä¼è¯å表 |
| | | |
| | | ```http |
| | | GET /sales-ai/history/sessions |
| | | ``` |
| | | |
| | | è¿å `AjaxResult.data` åæ®µï¼ |
| | | - `memoryId` |
| | | - `title` |
| | | - `lastMessage` |
| | | - `messageCount` |
| | | - `lastChatTime` |
| | | |
| | | ### 7.2 ä¼è¯æ¶æ¯ |
| | | |
| | | ```http |
| | | GET /sales-ai/history/messages/{memoryId} |
| | | ``` |
| | | |
| | | è¿å `AjaxResult.data` åæ®µï¼ |
| | | - `role`ï¼`user` / `assistant` / `system` / `tool` |
| | | - `content` |
| | | - `filePaths`ï¼å½åéå®å©ææªä½¿ç¨æä»¶åæï¼å¯å¿½ç¥ï¼ |
| | | |
| | | ### 7.3 å é¤ä¼è¯ |
| | | |
| | | ```http |
| | | DELETE /sales-ai/history/{memoryId} |
| | | ``` |
| | | |
| | | è¿åæ å `AjaxResult`ã |
| | | |
| | | ## 8. å端æ¥å
¥çº¦æ |
| | | |
| | | 1. æ°å¢å©æé
ç½®æ¶ï¼`assistantRegistry` å¿
须注å `sales`ï¼æä½ æ¹çº¦å® keyï¼ï¼å¹¶æå `apiBase = /sales-ai`ã |
| | | 2. ç»æåæ¸²æå¿
é¡»åºäº `type` ååï¼ä¸è¦ä»
é å
³é®è¯ã |
| | | 3. è天渲æéä¿çâææ¬å
åºâï¼é¿å
JSON è§£æå¤±è´¥æ¶é¡µé¢ç©ºç½ã |
| | | 4. ä¸å¡å±ç¤ºåæ®µå»ºè®®ä¸æåï¼ä¸ç´æ¥å±ç¤ºè±æå段 keyã |
| | | |
| | | ## 9. èè°éªæ¶æ¸
å |
| | | |
| | | 1. è½æ£å¸¸æµå¼æ¥æ¶ `/sales-ai/chat` ååºå¹¶æ¼æ¥ææ¬ã |
| | | 2. è½æ `type` æ£ç¡®æ¸²æ 9 ç±»ç»æåç»æã |
| | | 3. è½æ£ç¡®å±ç¤ºâå®¢æ·æµå¤±é£é©åæâåâ忬¾ä¸æ¥ä»·çç¥å»ºè®®â两个éç¹åºæ¯ã |
| | | 4. ä¼è¯å表ãä¼è¯æ¶æ¯ãå é¤ä¼è¯å
¨é¾è·¯å¯ç¨ã |
| | | 5. `memoryId` å¤ç¨åå¯åçåå²ï¼ä¸ä¼ä¸²ä¼è¯ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # é¦é¡µçäº§çæ¿å端èè°ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-20 |
| | | 模åï¼`/home`ï¼é¦é¡µï¼ |
| | | |
| | | ## 1. æ¥å£æ¸
å |
| | | |
| | | 1. `GET /home/productionOverview`ï¼ç产æ»è§ |
| | | 2. `GET /home/productionRealtimeBoard`ï¼çäº§å®æ¶çæ¿ |
| | | 3. `GET /home/productionOrderProgress`ï¼ç产订åè¿åº¦ |
| | | 4. `GET /home/todayProductionPlan`ï¼ä»æ¥ç产计å |
| | | |
| | | æææ¥å£ç»ä¸è¿å `AjaxResult`ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": {} |
| | | } |
| | | ``` |
| | | |
| | | ## 2. ç产æ»è§ |
| | | |
| | | ### 2.1 è¯·æ± |
| | | |
| | | ```http |
| | | GET /home/productionOverview |
| | | ``` |
| | | |
| | | ### 2.2 è¿å `data` |
| | | |
| | | ```json |
| | | { |
| | | "totalOutput": 1280.00, |
| | | "totalScrap": 25.00, |
| | | "yieldRate": 98.08 |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | - `totalOutput`ï¼ç´¯è®¡äº§åºï¼ä»¶ï¼åæ ¼æ°ï¼ |
| | | - `totalScrap`ï¼ç´¯è®¡æ¥åºï¼ä»¶ï¼ |
| | | - `yieldRate`ï¼è¯çï¼0-100ï¼å端å±ç¤ºæ¶å¯æ¼æ¥ `%`ï¼ |
| | | |
| | | ## 3. çäº§å®æ¶çæ¿ |
| | | |
| | | ### 3.1 è¯·æ± |
| | | |
| | | ```http |
| | | GET /home/productionRealtimeBoard |
| | | ``` |
| | | |
| | | ### 3.2 è¿å `data` |
| | | |
| | | ```json |
| | | { |
| | | "deviceOee": { |
| | | "value": 74.00, |
| | | "compareYesterday": 2.50 |
| | | }, |
| | | "orderAchievementRate": { |
| | | "value": 81.30, |
| | | "compareYesterday": -1.20 |
| | | }, |
| | | "defectRate": { |
| | | "value": 1.40, |
| | | "compareYesterday": 0.30 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | - `value`ï¼å½æ¥ææ å¼ï¼0-100ï¼ |
| | | - `compareYesterday`ï¼è¾æ¨æ¥ååå¼ï¼å¯æ£å¯è´ï¼åç«¯ææ£è´å³å®ç®å¤´æ¹ååé¢è²ï¼ |
| | | |
| | | ## 4. ç产订åè¿åº¦ |
| | | |
| | | ### 4.1 è¯·æ± |
| | | |
| | | ```http |
| | | GET /home/productionOrderProgress?tab=all&pageNum=1&pageSize=10 |
| | | ``` |
| | | |
| | | åæ°ï¼ |
| | | |
| | | - `tab`ï¼`all` / `inProgress` / `completed` / `paused` |
| | | - `pageNum`ï¼é¡µç ï¼é»è®¤ `1`ï¼ |
| | | - `pageSize`ï¼æ¯é¡µæ¡æ°ï¼é»è®¤ `10`ï¼æå¤§ `50`ï¼ |
| | | |
| | | ### 4.2 è¿å `data` |
| | | |
| | | ```json |
| | | { |
| | | "tab": "all", |
| | | "total": 24, |
| | | "pageNum": 1, |
| | | "pageSize": 10, |
| | | "inProgressCount": 6, |
| | | "completedCount": 12, |
| | | "pausedCount": 2, |
| | | "records": [ |
| | | { |
| | | "orderNo": "MO-20260518-001", |
| | | "productName": "æºè½æ§å¶å¨", |
| | | "plannedQuantity": 1000.00, |
| | | "completedQuantity": 860.00, |
| | | "completionRate": 86.00, |
| | | "dueDate": "2026-05-20", |
| | | "status": 2, |
| | | "statusLabel": "è¿è¡ä¸" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | åæ®µè¯´æï¼ |
| | | |
| | | - `completionRate`ï¼å®æçï¼0-100ï¼ |
| | | - `status`ï¼åç«¯ç¶æç ï¼`1`å¾
å¼å§ï¼`2`è¿è¡ä¸ï¼`3`已宿ï¼`4`å·²æåï¼ |
| | | - `statusLabel`ï¼ç¶æä¸æå±ç¤ºå¼ |
| | | |
| | | ## 5. 仿¥ç产计å |
| | | |
| | | ### 5.1 è¯·æ± |
| | | |
| | | ```http |
| | | GET /home/todayProductionPlan?limit=4 |
| | | ``` |
| | | |
| | | åæ°ï¼ |
| | | |
| | | - `limit`ï¼è¿åæ¡æ°ï¼é»è®¤ `4`ï¼æå¤§ `20`ï¼ |
| | | |
| | | ### 5.2 è¿å `data` |
| | | |
| | | ```json |
| | | { |
| | | "total": 9, |
| | | "records": [ |
| | | { |
| | | "orderNo": "MO-20260518-004", |
| | | "productName": "ç»æä»¶A", |
| | | "plannedQuantity": 1200.00, |
| | | "dueDate": "2026-05-15", |
| | | "status": 2, |
| | | "statusLabel": "è¿è¡ä¸" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## 6. å端å±ç¤ºçº¦å® |
| | | |
| | | - ç¾åæ¯å段ç»ä¸æ¯æ°å¼ï¼å¦ `74.00`ï¼ï¼å端èªè¡æ¼æ¥ `%`ã |
| | | - æææ°å¼ä¿ç两ä½å°æ°ã |
| | | - `dueDate` å¯è½ä¸º `null`ï¼å端éå
åºå±ç¤ºï¼å¦ `--`ï¼ã |
| | | - `compareYesterday` æ£è´é½å¯è½åºç°ï¼å»ºè®®æ `>0` ä¸åã`<0` ä¸éã`=0` æå¹³å¤çã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # é¦é¡µçäº§çæ¿æ§è½ä¼ååç«¯åæ´ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-20 |
| | | éç¨é¡µé¢ï¼é¦é¡µ |
| | | æ¶ååºåï¼ |
| | | |
| | | 1. ç产订åè¿åº¦ |
| | | 2. 仿¥ç产计å |
| | | |
| | | ## 1. æ¬æ¬¡ä¼åç®æ |
| | | |
| | | éå¯¹å¤§æ°æ®éåºæ¯ï¼è®¢åæ°éå¤ãç产åå²é¿ï¼ä¼åæ¥è¯¢æ§è½ï¼éä½é¦é¡µæ¥å£ååºæ¶é´åå
åå ç¨ã |
| | | |
| | | ## 2. æ¶åæ¥å£ |
| | | |
| | | 1. `GET /home/productionOrderProgress` |
| | | 2. `GET /home/todayProductionPlan` |
| | | |
| | | ## 3. å端æ¯å¦éè¦æ¹ä»£ç |
| | | |
| | | ç»è®ºï¼**æ å¼ºå¶æ¹å¨ï¼æ¥å£å
¥åä¸è¿åç»æä¿æå
¼å®¹**ã |
| | | ä½ ç°æé¡µé¢å¯ä»¥ç´æ¥èè°ï¼ä¸éè¦æ¹å段æ å°ã |
| | | |
| | | ## 4. æ¥å£è¯´æï¼ä¿æä¸åï¼ |
| | | |
| | | ### 4.1 ç产订åè¿åº¦ |
| | | |
| | | 请æ±ï¼ |
| | | |
| | | ```http |
| | | GET /home/productionOrderProgress?tab=all&pageNum=1&pageSize=10 |
| | | ``` |
| | | |
| | | åæ°ï¼ |
| | | |
| | | - `tab`ï¼`all` / `inProgress` / `completed` / `paused` |
| | | - `pageNum`ï¼é¡µç ï¼é»è®¤ `1` |
| | | - `pageSize`ï¼æ¯é¡µæ¡æ°ï¼é»è®¤ `10`ï¼æå¤§ `50` |
| | | |
| | | è¿å `data`ï¼ç»æä¸åï¼ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "tab": "all", |
| | | "total": 1200, |
| | | "pageNum": 1, |
| | | "pageSize": 10, |
| | | "inProgressCount": 180, |
| | | "completedCount": 900, |
| | | "pausedCount": 20, |
| | | "records": [ |
| | | { |
| | | "orderNo": "MO-20260518-001", |
| | | "productName": "æºè½æ§å¶å¨", |
| | | "plannedQuantity": 1000.00, |
| | | "completedQuantity": 860.00, |
| | | "completionRate": 86.00, |
| | | "dueDate": "2026-05-20", |
| | | "status": 2, |
| | | "statusLabel": "è¿è¡ä¸" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ### 4.2 仿¥ç产计å |
| | | |
| | | 请æ±ï¼ |
| | | |
| | | ```http |
| | | GET /home/todayProductionPlan?limit=4 |
| | | ``` |
| | | |
| | | åæ°ï¼ |
| | | |
| | | - `limit`ï¼è¿åæ¡æ°ï¼é»è®¤ `4`ï¼æå¤§ `20` |
| | | |
| | | è¿å `data`ï¼ç»æä¸åï¼ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "total": 230, |
| | | "records": [ |
| | | { |
| | | "orderNo": "MO-20260518-004", |
| | | "productName": "ç»æä»¶A", |
| | | "plannedQuantity": 1200.00, |
| | | "dueDate": "2026-05-15", |
| | | "status": 2, |
| | | "statusLabel": "è¿è¡ä¸" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## 5. å端ä¼åç¹ï¼ä¾åç«¯ç¥æï¼ |
| | | |
| | | 1. 订åè¿åº¦ä¸ä»æ¥è®¡åæ¹ä¸ºè½»é SQLï¼ä»
æ¥è¯¢é¦é¡µå¿
éåæ®µã |
| | | 2. 廿äºé¦é¡µæ¥è¯¢è·¯å¾ä¸ä¸å¿
è¦ç大å
³èãå¾çå¡«å
å对象è£
é
ã |
| | | 3. ç¶æç»è®¡æ¹ä¸ºæ°æ®åºèå计æ°ï¼ä¸åéæ¡æå计ç®ã |
| | | 4. å页䏿¡æ°ä¸éä¿çï¼`pageSize <= 50`, `limit <= 20`ï¼ã |
| | | |
| | | ## 6. å端建议 |
| | | |
| | | 1. 忢 `tab` æ¶ä¿çç°æè°ç¨æ¹å¼å³å¯ã |
| | | 2. `dueDate` å¯è½ä¸ºç©ºï¼ç»§ç»æ `--` å
åºå±ç¤ºã |
| | | 3. ç¾åæ¯å段ä»ä¸ºæ°å¼ï¼å端继ç»è¿½å `%` å±ç¤ºã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # éè´æºè½ä½ä¼ååç«¯åæ´ææ¡£ |
| | | |
| | | ## 1. åæ´èæ¯ |
| | | |
| | | æ¬æ¬¡é对éè´æºè½ä½åäºå¯¹é½ä¼åï¼åèéå®/审æ¹/å¶é æºè½ä½ï¼ï¼ |
| | | |
| | | 1. æå `quickPrompts` å½ä¸ç¨³å®æ§ã |
| | | 2. å¢å¼ºç¸å¯¹æ¶é´è¯å«ï¼ä»å¤©/æ¨å¤©/æ¬å¨/ä¸å¨/æ¬æ/䏿/ä»å¹´/å»å¹´/è¿N天çï¼ã |
| | | 3. å¢å ä¸å¡æå¾æªè¯å«æ¶çç»æåå
åºååºï¼é¿å
ç¼é æ°æ®ã |
| | | 4. è¡¥å
å¾
仿¬¾æ¥è¯¢çæ±æ»å段ï¼ä¾¿äºåç«¯ç´æ¥æ¸²æç»è®¡å¡çã |
| | | |
| | | ## 2. æ¥å£å½±åæ¦è§ |
| | | |
| | | | æ¥å£ | æ¹æ³ | æ¯å¦æ¹è·¯å¾ | æ¯å¦æ¹å
¥å | æ¯å¦æ¹è¿åç»æ | |
| | | | --- | --- | --- | --- | --- | |
| | | | `/purchase-ai/chat` | POST(SSE) | å¦ | å¦ | æ¯ï¼æ°å¢å
åº JSON ç±»åï¼ | |
| | | | `/purchase-ai/analyze-files` | POST(SSE) | å¦ | å¦ | å¦ï¼ä»
å
é¨æç¤ºè¯å¢å¼ºï¼ | |
| | | |
| | | ## 3. æ°å¢å
åºååºï¼éç¹ï¼ |
| | | |
| | | å½ç¨æ·ææ¾å¨é®éè´ä¸å¡ï¼ä½æ¡ä»¶ä¸å
å䏿ªå½ä¸å¯æ§è¡æå¾æ¶ï¼`/purchase-ai/chat` ä¼ç´æ¥è¿åç»æå JSONï¼è䏿¯èªç±ææ¬ï¼ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "success": false, |
| | | "type": "purchase_intent_not_recognized", |
| | | "description": "æªè¯å«å°å¯æ§è¡çéè´æ¥è¯¢æ¡ä»¶ã为ä¿è¯ç»æåç¡®ï¼å½åä¸ä¼æ¨æµæç¼é æ°æ®ï¼è¯·è¡¥å
æç¡®æ¶é´èå´ãä¾åºåãéè´ååå·æç©æååæ¥è¯¢ã", |
| | | "summary": {}, |
| | | "data": { |
| | | "quickPrompts": [ |
| | | "æ¬æéè´é颿åååçç©ææåªäºï¼", |
| | | "åªäºéè´è®¢åè¿æªå
¥åºï¼", |
| | | "æè¿7天ä¾åºåå°è´§å¼å¸¸æåªäºï¼", |
| | | "帮æç»è®¡å¾
仿¬¾éè´åï¼", |
| | | "ååºæ¬æéè´éè´§æ
åµ" |
| | | ] |
| | | }, |
| | | "charts": {} |
| | | } |
| | | ``` |
| | | |
| | | å端å¤çå»ºè®®ï¼ |
| | | |
| | | 1. å½ `type === "purchase_intent_not_recognized"` æ¶ï¼å±ç¤º `description`ã |
| | | 2. 读å `data.quickPrompts` ä½ä¸ºå¿«æ·æé®æé®ï¼å¯ç´æ¥åå¡«è¾å
¥æ¡ï¼ã |
| | | |
| | | ## 4. å¾
仿¬¾è¿åæ°å¢æ±æ»å段 |
| | | |
| | | æ¥å£ç±»åï¼`type = "purchase_pending_payment_list"` |
| | | ä½ç½®ï¼`summary` |
| | | |
| | | æ°å¢åæ®µï¼ |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | | --- | --- | --- | |
| | | | pendingOrderCount | number | å¾
仿¬¾è®¢åæ° | |
| | | | totalContractAmount | number | å¾
仿¬¾è®¢åååæ»é¢ | |
| | | | totalPaidAmount | number | 已仿¬¾æ»é¢ | |
| | | | totalPendingAmount | number | å¾
仿¬¾æ»é¢ | |
| | | |
| | | 说æï¼åæå段ä»ä¿çï¼å
¼å®¹ï¼ï¼æ¬æ¬¡ä¸ºå¢éåæ®µï¼ä¸ç ´åç°ææ¸²æã |
| | | |
| | | ## 5. æ¶é´å£å¾ä¼å |
| | | |
| | | éè´æºè½ä½ç°å¨ç»ä¸æä¸å½æ¶åºå¨ææ¥ææ¢ç®ç¸å¯¹æ¶é´ï¼æ¯æï¼ |
| | | |
| | | - ä»å¤©ãæ¨å¤© |
| | | - æ¬å¨ãä¸å¨ |
| | | - æ¬æã䏿 |
| | | - ä»å¹´ãå»å¹´ |
| | | - è¿N天/å¨/æ/å¹´ãè¿åå¹´ãè¿å个æ |
| | | |
| | | å端æ éæ¹ä¼ åï¼ä½å±ç¤ºæ¶é´èå´æ¶è¯·ä»¥å端è¿å `summary.startDate/endDate/timeRange` 为åã |
| | | |
| | | ## 6. å端èè°æ£æ¥æ¸
å |
| | | |
| | | 1. `chat` æµå¼ç»ææ¼æ¥åï¼ä¼å
æ JSON è§£æã |
| | | 2. è¦çæ°ç±»å `purchase_intent_not_recognized` ç UI å¤çã |
| | | 3. å¾
仿¬¾é¡µé¢è¯»åå¹¶å±ç¤º `summary.totalPendingAmount` çæ°å¢å段ã |
| | | 4. éªè¯ä»¥ä¸å¿«æ·é®é¢å¯ç¨³å®è¿åç»æåç»æï¼ |
| | | - æ¬æéè´é颿åååçç©ææåªäºï¼ |
| | | - åªäºéè´è®¢åè¿æªå
¥åºï¼ |
| | | - æè¿7天ä¾åºåå°è´§å¼å¸¸æåªäºï¼ |
| | | - 帮æç»è®¡å¾
仿¬¾éè´åï¼ |
| | | - ååºæ¬æéè´éè´§æ
åµ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # é¦é¡µ HomeController æ¥å£å级åç«¯åæ´ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-21 |
| | | éç¨æ¨¡åï¼é¦é¡µï¼`/home`ï¼ |
| | | |
| | | ## 1. åæ´æ¦è§ |
| | | |
| | | æ¬æ¬¡ä¸º **å
¼å®¹å¼å级**ï¼æ§è°ç¨æ¹å¼ä»å¯ç¨ã |
| | | éç¹æ¯ç»çäº§çæ¿æ¥å£å¢å æ´æç¡®ççéåæ°ï¼ä¾¿äºåç«¯ææ¥æåç¶ææ¥è¯¢ã |
| | | |
| | | æ¶åæ¥å£ï¼ |
| | | |
| | | 1. `GET /home/productionOrderProgress` |
| | | 2. `GET /home/todayProductionPlan` |
| | | |
| | | ## 2. åæ°åæ´ |
| | | |
| | | ### 2.1 ç产订åè¿åº¦ `GET /home/productionOrderProgress` |
| | | |
| | | æ§åæ°ï¼ä»å
¼å®¹ï¼ï¼ |
| | | |
| | | - `tab`ï¼`all` / `inProgress` / `completed` / `paused` |
| | | - `pageNum`ï¼é»è®¤ `1` |
| | | - `pageSize`ï¼é»è®¤ `10`ï¼æå¤§ `50` |
| | | |
| | | æ°å¢åæ°ï¼ |
| | | |
| | | - `status`ï¼å¯éï¼ï¼ç¶æçéï¼ä¼å
级é«äº `tab` |
| | | å¯éå¼ï¼`all` / `waiting` / `inProgress` / `completed` / `paused` / `1` / `2` / `3` / `4` |
| | | - `bizDate`ï¼å¯éï¼ï¼ä¸å¡æ¥æçéï¼æ ¼å¼ `yyyy-MM-dd`ï¼æè®¢åå建æ¶é´è¿æ»¤ï¼ |
| | | |
| | | åæ°ä¼å
çº§ï¼ |
| | | |
| | | 1. å¦æä¼ äº `status`ï¼å端ä¼å
æ `status` è§£æï¼ |
| | | 2. æªä¼ `status` æ¶ï¼æ²¿ç¨åæ `tab` è¡ä¸ºï¼ |
| | | 3. `status` æ `bizDate` æ ¼å¼é误æ¶è¿å失败信æ¯ã |
| | | |
| | | 请æ±ç¤ºä¾ï¼ |
| | | |
| | | ```http |
| | | GET /home/productionOrderProgress?status=completed&bizDate=2026-05-20&pageNum=1&pageSize=10 |
| | | ``` |
| | | |
| | | ### 2.2 仿¥ç产计å `GET /home/todayProductionPlan` |
| | | |
| | | æ§åæ°ï¼ä»å
¼å®¹ï¼ï¼ |
| | | |
| | | - `limit`ï¼é»è®¤ `4`ï¼æå¤§ `20` |
| | | |
| | | æ°å¢åæ°ï¼ |
| | | |
| | | - `planDate`ï¼å¯éï¼ï¼è®¡åæ¥æçéï¼æ ¼å¼ `yyyy-MM-dd`ï¼æ `plan_complete_time` è¿æ»¤ï¼ |
| | | |
| | | 请æ±ç¤ºä¾ï¼ |
| | | |
| | | ```http |
| | | GET /home/todayProductionPlan?limit=6&planDate=2026-05-21 |
| | | ``` |
| | | |
| | | ## 3. è¿åç»æåæ´ |
| | | |
| | | ### 3.1 `productionOrderProgress` è¿åæ°å¢å段 |
| | | |
| | | æ°å¢ï¼ |
| | | |
| | | - `status`ï¼æ ååç¶æåæ¾ï¼`all` / `waiting` / `inProgress` / `completed` / `paused`ï¼ |
| | | - `bizDate`ï¼æ¥æçéåæ¾ï¼æªä¼ æ¶ä¸º `null`ï¼ |
| | | - `waitingCount`ï¼å¾
å¼å§è®¢åæ°é |
| | | |
| | | å
¼å®¹ä¿çï¼ |
| | | |
| | | - `tab` åæ®µç»§ç»è¿åï¼è页颿 éæ¹å¨å¯ç»§ç»ä½¿ç¨ï¼ |
| | | |
| | | è¿å示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "tab": "completed", |
| | | "status": "completed", |
| | | "bizDate": "2026-05-20", |
| | | "total": 24, |
| | | "pageNum": 1, |
| | | "pageSize": 10, |
| | | "waitingCount": 3, |
| | | "inProgressCount": 6, |
| | | "completedCount": 12, |
| | | "pausedCount": 2, |
| | | "records": [] |
| | | } |
| | | ``` |
| | | |
| | | ### 3.2 `todayProductionPlan` è¿åæ°å¢å段 |
| | | |
| | | æ°å¢ï¼ |
| | | |
| | | - `planDate`ï¼æ¥æçéåæ¾ï¼æªä¼ æ¶ä¸º `null`ï¼ |
| | | |
| | | è¿å示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "planDate": "2026-05-21", |
| | | "total": 9, |
| | | "records": [] |
| | | } |
| | | ``` |
| | | |
| | | ## 4. å端æ¹é 建议 |
| | | |
| | | 1. æ°é¡µé¢å»ºè®®ä¼å
ä¼ `status`ï¼éæ¥æ¿ä»£ `tab`ã |
| | | 2. éè¦ææ¥æå¤ççæ¿æ¶ï¼ä½¿ç¨ `bizDate` / `planDate`ã |
| | | 3. è页é¢å¯ä¸æ¹ï¼ç»§ç»æ²¿ç¨ååæ°ä¹è½æ£å¸¸èè°ã |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/AccountSubjectDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/AccountSubjectImportDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/PurchaseInboundDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.purchase; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/PurchaseReturnDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.purchase; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/SalesOutboundDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.sales; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/SalesReturnDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | package com.ruoyi.account.bean.dto.sales; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/vo/AccountSubjectVo.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | package com.ruoyi.account.bean.vo.financial; |
| | | |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/vo/PurchaseInboundVo.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | package com.ruoyi.account.bean.vo.purchase; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/vo/PurchaseReturnVo.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | package com.ruoyi.account.bean.vo.purchase; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/vo/SalesOutboundVo.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | package com.ruoyi.account.bean.vo.sales; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/vo/SalesReturnVo.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | package com.ruoyi.account.bean.vo.sales; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountExpense") |
| | | @Tag(name = "è´¢å¡ç®¡ç--æ¯åºç®¡ç") |
| | | public class AccountExpenseController { |
| | | public class AccountExpenseController extends BaseController { |
| | | |
| | | @Resource |
| | | private AccountExpenseService accountExpenseService; |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountExpense accountExpense) { |
| | | public R<?> add(@RequestBody AccountExpense accountExpense) { |
| | | accountExpense.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | accountExpense.setInputUser(loginUser.getNickName()); |
| | | return AjaxResult.success(accountExpenseService.save(accountExpense)); |
| | | return R.ok(accountExpenseService.save(accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªå |
| | | return AjaxResult.success(accountExpenseService.removeBatchByIds(ids)); |
| | | return R.ok(accountExpenseService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.updateById(accountExpense)); |
| | | public R<?> update(@RequestBody AccountExpense accountExpense) { |
| | | return R.ok(accountExpenseService.updateById(accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountExpenseListPage(Page page, AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.accountExpenseListPage(page, accountExpense)); |
| | | public R<?> accountExpenseListPage(Page page, AccountExpense accountExpense) { |
| | | return R.ok(accountExpenseService.accountExpenseListPage(page, accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "详æ
") |
| | | public AjaxResult accountExpenseDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountExpenseService.getById(id)); |
| | | public R<?> accountExpenseDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(accountExpenseService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/forms") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¥è¯¢") |
| | | public AjaxResult report(DateQueryDto dateQueryDto) { |
| | | return AjaxResult.success(accountExpenseService.report(dateQueryDto)); |
| | | public R<?> report(DateQueryDto dateQueryDto) { |
| | | return R.ok(accountExpenseService.report(dateQueryDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/analysis") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨-è´¢å¡åæ") |
| | | public AjaxResult analysis() { |
| | | return AjaxResult.success(accountExpenseService.analysis()); |
| | | public R<?> analysis() { |
| | | return R.ok(accountExpenseService.analysis()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/income") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¶å
¥å¹´åº¦æ¥è¯¢") |
| | | public AjaxResult reportIncome(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountIncomeService.reportIncome(reportDateDto)); |
| | | public R<?> reportIncome(ReportDateDto reportDateDto) { |
| | | return R.ok(accountIncomeService.reportIncome(reportDateDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/expense") |
| | | @Operation(summary = "è´¢å¡æ¥è¡¨å¾è¡¨æ¯åºå¹´åº¦æ¥è¯¢") |
| | | public AjaxResult reportExpense(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountExpenseService.reportExpense(reportDateDto)); |
| | | public R<?> reportExpense(ReportDateDto reportDateDto) { |
| | | return R.ok(accountExpenseService.reportExpense(reportDateDto)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountFile; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountFile") |
| | | @Tag(name = "è´¢å¡éä»¶") |
| | | public class AccountFileController { |
| | | public class AccountFileController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.save(accountFile)); |
| | | public R<?> add(@RequestBody AccountFile accountFile) { |
| | | return R.ok(accountFileService.save(accountFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delAccountFile(@RequestBody List<Integer> ids) { |
| | | public R<?> delAccountFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(accountFileService.removeBatchByIds(ids)); |
| | | return R.ok(accountFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountFileListPage(Page page, AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.accountFileListPage(page, accountFile)); |
| | | public R<?> accountFileListPage(Page page, AccountFile accountFile) { |
| | | return R.ok(accountFileService.accountFileListPage(page, accountFile)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountIncome") |
| | | @Tag(name = "è´¢å¡ç®¡ç--æ¶å
¥ç®¡ç") |
| | | public class AccountIncomeController { |
| | | public class AccountIncomeController extends BaseController { |
| | | |
| | | @Resource |
| | | private AccountIncomeService accountIncomeService; |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody AccountIncome accountIncome) { |
| | | public R<?> add(@RequestBody AccountIncome accountIncome) { |
| | | accountIncome.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | accountIncome.setInputUser(loginUser.getNickName()); |
| | | return AjaxResult.success(accountIncomeService.save(accountIncome)); |
| | | return R.ok(accountIncomeService.save(accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªå |
| | | return AjaxResult.success(accountIncomeService.removeBatchByIds(ids)); |
| | | return R.ok(accountIncomeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.updateById(accountIncome)); |
| | | public R<?> update(@RequestBody AccountIncome accountIncome) { |
| | | return R.ok(accountIncomeService.updateById(accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.accountIncomeListPage(page, accountIncome)); |
| | | public R<?> accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | return R.ok(accountIncomeService.accountIncomeListPage(page, accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "详æ
") |
| | | public AjaxResult accountIncomeDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountIncomeService.getById(id)); |
| | | public R<?> accountIncomeDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(accountIncomeService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.service.impl.AccountingServiceImpl; |
| | | 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; |
| | |
| | | |
| | | @Operation(summary = "æ»è®¡") |
| | | @GetMapping("/total") |
| | | public AjaxResult total(@RequestParam Integer year) { |
| | | public R<?> total(@RequestParam Integer year) { |
| | | return accountingService.total(year); |
| | | } |
| | | |
| | | @Operation(summary = "设å¤ç±»ååå¸") |
| | | @GetMapping("/deviceTypeDistribution") |
| | | public AjaxResult deviceTypeDistribution(@RequestParam Integer year) { |
| | | public R<?> deviceTypeDistribution(@RequestParam Integer year) { |
| | | return accountingService.deviceTypeDistribution(year); |
| | | } |
| | | |
| | | @Operation(summary = "设å¤å页æ¥è¯¢è®¡ç®ææ§") |
| | | @GetMapping("/calculateDepreciation") |
| | | public AjaxResult calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | public R<?> calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | return accountingService.calculateDepreciation(page,year); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/borrowInfo") |
| | | @AllArgsConstructor |
| | | public class BorrowInfoController { |
| | | public class BorrowInfoController extends BaseController { |
| | | |
| | | private BorrowInfoService borrowInfoService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | | public R<?> listPage(Page page, BorrowInfo borrowInfo) { |
| | | return borrowInfoService.listPage(page,borrowInfo); |
| | | } |
| | | |
| | |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "æ°å¢å款信æ¯", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody BorrowInfo borrowInfo) { |
| | | public R<?> add(@RequestBody BorrowInfo borrowInfo) { |
| | | return borrowInfoService.add(borrowInfo); |
| | | } |
| | | |
| | |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "ä¿®æ¹å款信æ¯", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updateBorrowInfo(@RequestBody BorrowInfo borrowInfo) { |
| | | public R<?> updateBorrowInfo(@RequestBody BorrowInfo borrowInfo) { |
| | | return borrowInfoService.updateBorrowInfo(borrowInfo); |
| | | } |
| | | |
| | |
| | | @DeleteMapping("/delete") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "å é¤å款信æ¯", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return borrowInfoService.delete(ids); |
| | | } |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/controller/AccountSubjectController.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.controller; |
| | | package com.ruoyi.account.controller.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.vo.AccountSubjectVo; |
| | | import com.ruoyi.account.service.AccountSubjectService; |
| | | import com.ruoyi.account.bean.dto.financial.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.vo.financial.AccountSubjectVo; |
| | | import com.ruoyi.account.service.purchase.AccountSubjectService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/controller/AccounPurchaseController.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.controller; |
| | | 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.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.PurchaseReturnVo; |
| | | import com.ruoyi.account.service.AccountPurchaseService; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.account.service.financial.AccountPurchaseService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/controller/AccountSalesController.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.controller; |
| | | 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.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.service.AccountSalesService; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.account.service.sales.AccountSalesService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/mapper/AccountSubjectMapper.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.mapper; |
| | | package com.ruoyi.account.mapper.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/pojo/AccountSubject.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.pojo; |
| | | package com.ruoyi.account.pojo.financial; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface BorrowInfoService extends IService<BorrowInfo> { |
| | | |
| | | AjaxResult listPage(Page page, BorrowInfo borrowInfo); |
| | | R<?> listPage(Page page, BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult add(BorrowInfo borrowInfo); |
| | | R<?> add(BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult updateBorrowInfo(BorrowInfo borrowInfo); |
| | | R<?> updateBorrowInfo(BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/AccountPurchaseService.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service; |
| | | package com.ruoyi.account.service.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.PurchaseReturnVo; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | |
| | | public AjaxResult total(Integer year) { |
| | | public R<?> total(Integer year) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("deprAmount",0); // ææ§éé¢ |
| | | map.put("deviceTotal",0); // è®¾å¤æ»æ° |
| | |
| | | }); |
| | | } |
| | | map.put("inventoryValue",procurementRecordTotal.add(customStorageTotal)); |
| | | return AjaxResult.success( map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | |
| | | return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | |
| | | public AjaxResult deviceTypeDistribution(Integer year) { |
| | | public R<?> deviceTypeDistribution(Integer year) { |
| | | // 2. ç»è£
è¿åVO |
| | | DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO(); |
| | | List<DeviceTypeDetail> details = deviceLedgerMapper.getDeviceTypeDistributionByYear( year); |
| | |
| | | .collect(Collectors.toList())); |
| | | vo.setTotalCount(vo.getCategories().size()); |
| | | } |
| | | return AjaxResult.success(vo); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | public AjaxResult calculateDepreciation(Page page, Integer year) { |
| | | public R<?> 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 AjaxResult.success(deviceLedgerIPage); |
| | | return R.ok(deviceLedgerIPage); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.service.BorrowInfoService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final AccountExpenseService accountExpenseService; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | | public R<?> listPage(Page page, BorrowInfo borrowInfo) { |
| | | LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(borrowInfo != null){ |
| | | if(StringUtils.isNotEmpty(borrowInfo.getEntryDateStart()) && StringUtils.isNotEmpty(borrowInfo.getEntryDateEnd())){ |
| | |
| | | borrowInfoLambdaQueryWrapper.like(BorrowInfo::getBorrowerName, borrowInfo.getBorrowerName()); |
| | | } |
| | | } |
| | | return AjaxResult.success(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper)); |
| | | return R.ok(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(BorrowInfo borrowInfo) { |
| | | public R<?> add(BorrowInfo borrowInfo) { |
| | | int insert = borrowInfoMapper.insert(borrowInfo); |
| | | if(insert > 0){ |
| | | // æ·»å æåï¼è¿å
¥æ¶å
¥ç®¡ç |
| | |
| | | accountIncome.setInputTime(DateUtils.getNowDate()); |
| | | accountIncome.setInputUser(borrowInfo.getBorrowerName()); |
| | | accountIncomeService.save(accountIncome); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | return R.ok(null, "æ·»å æå"); |
| | | } |
| | | return AjaxResult.success("æ·»å 失败"); |
| | | return R.ok(null, "æ·»å 失败"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateBorrowInfo(BorrowInfo borrowInfo) { |
| | | public R<?> updateBorrowInfo(BorrowInfo borrowInfo) { |
| | | int update = borrowInfoMapper.updateById(borrowInfo); |
| | | if(update > 0){ |
| | | // ä¿®æ¹æåï¼ä¿®æ¹æ¶å
¥ç®¡ç |
| | |
| | | accountExpense.setInputUser(borrowInfo.getBorrowerName()); |
| | | accountExpenseService.save(accountExpense); |
| | | } |
| | | return AjaxResult.success("ä¿®æ¹æå"); |
| | | return R.ok(null, "ä¿®æ¹æå"); |
| | | } |
| | | return AjaxResult.success("ä¿®æ¹å¤±è´¥"); |
| | | return R.ok(null, "ä¿®æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | int delete = borrowInfoMapper.deleteBatchIds(ids); |
| | | if(delete > 0){ |
| | | // å 餿åï¼å 餿¶å
¥ç®¡ç |
| | |
| | | accountExpenseService.remove(new LambdaQueryWrapper<AccountExpense>() |
| | | .in(AccountExpense::getBusinessId, ids) |
| | | .eq(AccountExpense::getBusinessType, 2)); |
| | | return AjaxResult.success("å 餿å"); |
| | | return R.ok(null, "å 餿å"); |
| | | } |
| | | return AjaxResult.success("å é¤å¤±è´¥"); |
| | | return R.ok(null, "å é¤å¤±è´¥"); |
| | | } |
| | | } |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/impl/AccountSubjectServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | package com.ruoyi.account.service.impl.financial; |
| | | |
| | | 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.account.bean.dto.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.dto.AccountSubjectImportDto; |
| | | import com.ruoyi.account.bean.vo.AccountSubjectVo; |
| | | import com.ruoyi.account.mapper.AccountSubjectMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.service.AccountSubjectService; |
| | | import com.ruoyi.account.bean.dto.financial.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.dto.financial.AccountSubjectImportDto; |
| | | import com.ruoyi.account.bean.vo.financial.AccountSubjectVo; |
| | | import com.ruoyi.account.mapper.financial.AccountSubjectMapper; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import com.ruoyi.account.service.purchase.AccountSubjectService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherEntryDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo; |
| | | import com.ruoyi.account.mapper.AccountSubjectMapper; |
| | | import com.ruoyi.account.mapper.financial.AccountSubjectMapper; |
| | | import com.ruoyi.account.mapper.financial.FinVoucherEntryMapper; |
| | | import com.ruoyi.account.mapper.financial.FinVoucherMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import com.ruoyi.account.pojo.financial.FinVoucherEntry; |
| | | import com.ruoyi.account.service.financial.FinVoucherService; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/impl/AccountPurchaseServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | package com.ruoyi.account.service.impl.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.PurchaseReturnVo; |
| | | import com.ruoyi.account.service.AccountPurchaseService; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.account.service.financial.AccountPurchaseService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/impl/AccountSalesServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | package com.ruoyi.account.service.impl.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.service.AccountSalesService; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.account.service.sales.AccountSalesService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/AccountSubjectService.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service; |
| | | 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.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.vo.AccountSubjectVo; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.bean.dto.financial.AccountSubjectDto; |
| | | import com.ruoyi.account.bean.vo.financial.AccountSubjectVo; |
| | | import com.ruoyi.account.pojo.financial.AccountSubject; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/account/service/AccountSalesService.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.account.service; |
| | | 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.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.bean.dto.sales.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢ä¸´æå®å") |
| | | @Log(title = "æ°å¢ä¸´æå®å", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesNearExpiry entity) { |
| | | public R<?> add(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.add(entity); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | return R.ok(null, "æ·»å æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "æ´æ°ä¸´æå®å") |
| | | @Log(title = "æ´æ°ä¸´æå®å", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesNearExpiry entity) { |
| | | public R<?> update(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.update(entity); |
| | | return AjaxResult.success("æ´æ°æå"); |
| | | return R.ok(null, "æ´æ°æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤ä¸´æå®å") |
| | | @Log(title = "å é¤ä¸´æå®å", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(Long[] ids) { |
| | | public R<?> delete(Long[] ids) { |
| | | afterSalesNearExpiryService.delete(ids); |
| | | return AjaxResult.success("å 餿å"); |
| | | return R.ok(null, "å 餿å"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢ä¸´æå®å") |
| | | @Log(title = "å页æ¥è¯¢ä¸´æå®å", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | public R<?> listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | IPage<AfterSalesNearExpiry> listPage = afterSalesNearExpiryService.listPage(page, entity); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | public R<?> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @Log(title = "å®åæå¡-åé¦ç»è®°", businessType = BusinessType.EXPORT) |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "å®åæå¡-æ°å¢") |
| | | @Log(title = "å®åæå¡-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | public R<?> add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "å®åæå¡-ä¿®æ¹") |
| | | @Log(title = "å®åæå¡-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | public R<?> 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 ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å®åæå¡-å é¤") |
| | | @Log(title = "å®åæå¡-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | boolean delete = afterSalesServiceService.removeByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/dispose") |
| | | @Operation(summary = "å®åæå¡-å¤ç") |
| | | @Log(title = "å®åæå¡-å¤ç", businessType = BusinessType.UPDATE) |
| | | public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | public R<?> 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 ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @Operation(summary = "å®åæå¡-è·åéå®å°è´¦") |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | public R<?> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @Operation(summary = "å®åæå¡-æ ¹æ®idè·å详æ
") |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | public R<?> getById(Long id) { |
| | | return R.ok(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @Operation(summary = "å®åæå¡-ç»è®¡å·¥åæ
åµ") |
| | | @GetMapping("count") |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | | public R<?> count() { |
| | | return R.ok(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.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; |
| | |
| | | @PostMapping("/upload") |
| | | @Operation(summary = "å®åæå¡-æä»¶ä¸ä¼ ") |
| | | @Log(title = "å®åæå¡-æä»¶ä¸ä¼ ", businessType = BusinessType.INSERT) |
| | | public AjaxResult fileUpload(@RequestParam("file") MultipartFile file, |
| | | public R<?> fileUpload(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("id") Long afterSalesServiceId) { |
| | | afterSalesServiceFileService.fileUpload(file, afterSalesServiceId); |
| | | return AjaxResult.success("ä¸ä¼ æå"); |
| | | return R.ok(null, "ä¸ä¼ æå"); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å®åå¤ç-å®åéä»¶å表") |
| | | @Log(title = "å®åå¤ç-å®åéä»¶å表", businessType = BusinessType.OTHER) |
| | | public AjaxResult fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return AjaxResult.success(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | public R<?> fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return R.ok(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{fileId}") |
| | | @Operation(summary = "å®åå¤ç-å é¤éä»¶") |
| | | @Log(title = "å®åå¤ç-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public AjaxResult delFile(@PathVariable Long fileId) { |
| | | public R<?> delFile(@PathVariable Long fileId) { |
| | | afterSalesServiceFileService.delFile(fileId); |
| | | return AjaxResult.success("å 餿å!"); |
| | | return R.ok(null, "å 餿å!"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | public interface ApproveTodoAgent { |
| | | |
| | | @SystemMessage(fromResource = "approve-todo-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate); |
| | | } |
| | |
| | | @Component |
| | | public class ApproveTodoIntentExecutor { |
| | | |
| | | private static final Pattern APPROVE_ID_PATTERN = Pattern.compile("\\b[A-Za-z]*\\d{8,}\\b"); |
| | | private static final Pattern LIMIT_PATTERN = Pattern.compile("(å|æè¿)?(\\d{1,2})æ¡"); |
| | | private static final Pattern APPROVE_ID_BY_LABEL_PATTERN = Pattern.compile("(æµç¨ç¼å·|æµç¨å·|æµç¨ID|审æ¹ç¼å·|ç¼å·)\\s*[:ï¼]?\\s*([A-Za-z0-9_-]{2,64})"); |
| | | private static final Pattern APPROVE_ID_PATTERN = Pattern.compile("\\b[A-Za-z]*\\d{6,}[A-Za-z0-9_-]*\\b"); |
| | | 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 NUMBER_PATTERN = Pattern.compile("(\\d+(?:\\.\\d+)?)"); |
| | | private static final Pattern RECENT_RANGE_PATTERN = Pattern.compile("è¿\\d+(天|å¨|个æ|æ|å¹´)"); |
| | |
| | | } |
| | | |
| | | String text = message.trim(); |
| | | String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text); |
| | | if (StringUtils.hasText(quickPromptResponse)) { |
| | | return quickPromptResponse; |
| | | } |
| | | |
| | | String approveId = extractApproveId(text); |
| | | boolean hasApproveId = StringUtils.hasText(approveId) && !isPlaceholderApproveId(approveId); |
| | | String startDate = extractStartDate(text); |
| | | String endDate = extractEndDate(text); |
| | | String timeRange = extractTimeRange(text); |
| | | |
| | | if (isStatsIntent(text)) { |
| | | return approveTodoTools.getTodoStats( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractTimeRange(text) |
| | | startDate, |
| | | endDate, |
| | | timeRange |
| | | ); |
| | | } |
| | | if (containsAny(text, "æµè½¬", "è¿åº¦", "èç¹", "æ¥å¿", "å¡å¨", "å¡å°", "å½å审æ¹äºº", "å¤çè®°å½")) { |
| | | return StringUtils.hasText(approveId) |
| | | return hasApproveId |
| | | ? approveTodoTools.getTodoProgress(memoryId, approveId) |
| | | : missingApproveId("todo_progress", "æ¥è¯¢å®¡æ¹è¿åº¦éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "详æ
", "æç»") && !containsAny(text, "å表")) { |
| | | return StringUtils.hasText(approveId) |
| | | return hasApproveId |
| | | ? approveTodoTools.getTodoDetail(memoryId, approveId) |
| | | : missingApproveId("todo_detail", "æ¥è¯¢å®¡æ¹è¯¦æ
éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "åæ¶å®¡æ ¸", "æ¤éå®¡æ ¸", "åéå®¡æ ¸", "æ¤é审æ¹", "æ¤å审æ¹") |
| | | || (containsAny(text, "æ¤é", "æ¤å") && containsAny(text, "å®¡æ¹æä½", "å®¡æ ¸æä½"))) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.cancelReviewTodo(memoryId, approveId, firstNonBlank(extractTail(text, "åå "), extractTail(text, "夿³¨"))) |
| | | return hasApproveId |
| | | ? approveTodoTools.cancelReviewTodo(memoryId, approveId, extractRemark(text)) |
| | | : missingApproveId("cancel_review_action", "åæ¶å®¡æ ¸éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "å é¤", "ç§»é¤")) { |
| | | return StringUtils.hasText(approveId) |
| | | return hasApproveId |
| | | ? approveTodoTools.deleteTodo(memoryId, approveId) |
| | | : missingApproveId("delete_action", "å é¤å®¡æ¹åéè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "驳å", "æç»")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", firstNonBlank(extractTail(text, "åå "), extractTail(text, "夿³¨"))) |
| | | return hasApproveId |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", extractRemark(text)) |
| | | : missingApproveId("review_action", "驳å审æ¹éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (containsAny(text, "å®¡æ ¸éè¿", "审æ¹éè¿", "éè¿å®¡æ¹", "åæå®¡æ¹", "审æ¹åæ")) { |
| | | return StringUtils.hasText(approveId) |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "夿³¨")) |
| | | return hasApproveId |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text)) |
| | | : missingApproveId("review_action", "审æ¹éè¿éè¦æä¾æµç¨ç¼å·ã"); |
| | | } |
| | | if (StringUtils.hasText(approveId) |
| | | if (hasApproveId |
| | | && containsAny(text, "éè¿", "åæ") |
| | | && !containsAny(text, "æªéè¿", "éè¿ç", "审æ¹éè¿ç", "å®¡æ ¸éè¿ç")) { |
| | | return approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "夿³¨")); |
| | | return approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text)); |
| | | } |
| | | if (containsAny(text, "ä¿®æ¹", "æ´æ°", "åæ´")) { |
| | | return StringUtils.hasText(approveId) |
| | | return hasApproveId |
| | | ? approveTodoTools.updateTodo( |
| | | memoryId, |
| | | approveId, |
| | |
| | | extractApproveType(text), |
| | | extractKeyword(text), |
| | | extractLimit(text), |
| | | extractScope(text)); |
| | | extractScope(text), |
| | | startDate, |
| | | endDate, |
| | | timeRange); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String tryExecuteQuickPrompt(String memoryId, String text) { |
| | | String normalized = normalizeForMatch(text); |
| | | String approveId = extractApproveId(text); |
| | | boolean hasApproveId = StringUtils.hasText(approveId) && !isPlaceholderApproveId(approveId); |
| | | |
| | | if ("æå½åæåªäºå®¡æ¹å¾
åéè¦å¤ç".equals(normalized)) { |
| | | return approveTodoTools.listTodos(memoryId, "pending", null, null, 10, "approver", null, null, null); |
| | | } |
| | | if ("帮æååºä»å¤©æ°å¢ç审æ¹å¾
å".equals(normalized)) { |
| | | return approveTodoTools.listTodos(memoryId, "all", null, null, 10, "related", null, null, "ä»å¤©"); |
| | | } |
| | | if ("å½åå¾
æå®¡æ¹çåæ®ææ¶é´ååºååºæ¥".equals(normalized)) { |
| | | return approveTodoTools.listTodos(memoryId, "pending", null, null, 10, "approver", null, null, null); |
| | | } |
| | | if ("æåèµ·ç审æ¹éåªäºè¿å¨å¤çä¸".equals(normalized)) { |
| | | return approveTodoTools.listTodos(memoryId, "processing", null, null, 10, "applicant", null, null, null); |
| | | } |
| | | if ("è¿7天æç审æ¹å¾
åç»è®¡æ
嵿乿 ·".equals(normalized)) { |
| | | return approveTodoTools.getTodoStats(memoryId, null, null, "è¿7天"); |
| | | } |
| | | if ("æ¬ææç审æ¹ä¸éè¿é©³åå¤çä¸åæå¤å°".equals(normalized)) { |
| | | return approveTodoTools.getTodoStats(memoryId, null, null, "æ¬æ"); |
| | | } |
| | | if ("è¿30天åç±»åå®¡æ¹æ°éå叿¯ä»ä¹".equals(normalized)) { |
| | | return approveTodoTools.getTodoStats(memoryId, null, null, "è¿30天"); |
| | | } |
| | | |
| | | if (normalized.startsWith("æ¥è¯¢æµç¨ç¼å·") && normalized.contains("审æ¹è¯¦æ
")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.getTodoDetail(memoryId, approveId) |
| | | : missingApproveId("todo_detail", "æ¥è¯¢å®¡æ¹è¯¦æ
éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("æµç¨ç¼å·") |
| | | && normalized.contains("å¡å¨åªä¸ªå®¡æ¹èç¹") |
| | | && normalized.contains("å½å审æ¹äººæ¯è°")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.getTodoProgress(memoryId, approveId) |
| | | : missingApproveId("todo_progress", "æ¥è¯¢å®¡æ¹è¿åº¦éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("å¸®ææ¥çæµç¨ç¼å·") && normalized.contains("å®¡æ¹æµè½¬è®°å½")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.getTodoProgress(memoryId, approveId) |
| | | : missingApproveId("todo_progress", "æ¥è¯¢å®¡æ¹æµè½¬è®°å½éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("帮æå®¡æ¹éè¿æµç¨ç¼å·")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text)) |
| | | : missingApproveId("review_action", "审æ¹éè¿éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("帮æé©³åæµç¨ç¼å·")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", extractRemark(text)) |
| | | : missingApproveId("review_action", "驳å审æ¹éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("æ¤éæåå对æµç¨ç¼å·") && normalized.contains("å®¡æ¹æä½")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.cancelReviewTodo(memoryId, approveId, extractRemark(text)) |
| | | : missingApproveId("cancel_review_action", "æ¤éå®¡æ¹æä½éè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("帮æä¿®æ¹æµç¨ç¼å·") && normalized.contains("夿³¨ä¸º")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.updateTodo(memoryId, approveId, null, null, null, null, null, null, extractRemark(text)) |
| | | : missingApproveId("update_action", "ä¿®æ¹å®¡æ¹åéè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | if (normalized.startsWith("å 餿åèµ·çæµç¨ç¼å·")) { |
| | | return hasApproveId |
| | | ? approveTodoTools.deleteTodo(memoryId, approveId) |
| | | : missingApproveId("delete_action", "å é¤å®¡æ¹åéè¦æä¾ç宿µç¨ç¼å·ã"); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | private String extractApproveId(String text) { |
| | | Matcher keywordMatcher = APPROVE_ID_BY_LABEL_PATTERN.matcher(text); |
| | | if (keywordMatcher.find()) { |
| | | return keywordMatcher.group(2); |
| | | } |
| | | Matcher matcher = APPROVE_ID_PATTERN.matcher(text); |
| | | return matcher.find() ? matcher.group() : null; |
| | | } |
| | |
| | | .replace("åæ®", "") |
| | | .replace("å¾
å", "") |
| | | .replace("å表", "") |
| | | .replace("æµç¨ç¼å·", "") |
| | | .replace("æµç¨å·", "") |
| | | .replace("å10æ¡", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .trim(); |
| | |
| | | } |
| | | |
| | | private String extractValue(String text, String fieldName) { |
| | | Pattern pattern = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|æ¯)[:ï¼]?[\\s]*([^,ï¼ãï¼;\\s]+)"); |
| | | Pattern pattern = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|为|æ¯)[:ï¼]?[\\s]*([^,ï¼ãï¼;\\s]+)"); |
| | | Matcher matcher = pattern.matcher(text); |
| | | return matcher.find() ? matcher.group(2) : null; |
| | | } |
| | |
| | | if (!text.contains(fieldName)) { |
| | | return null; |
| | | } |
| | | Matcher matcher = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|æ¯)[:ï¼]?[\\s]*(\\d{1,2})").matcher(text); |
| | | Matcher matcher = Pattern.compile(fieldName + "(æ¹ä¸º|ä¿®æ¹ä¸º|为|æ¯)[:ï¼]?[\\s]*(\\d{1,2})").matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : null; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | private String extractTail(String text, String key) { |
| | | Pattern quotedPattern = Pattern.compile(key + "(æ¯|为)?[:ï¼]?[\\s]*[â\"]([^â\"]+)[â\"]"); |
| | | Matcher quotedMatcher = quotedPattern.matcher(text); |
| | | if (quotedMatcher.find()) { |
| | | return cleanContent(quotedMatcher.group(2)); |
| | | } |
| | | Pattern pattern = Pattern.compile(key + "(æ¯|为)?[:ï¼]?[\\s]*(.+)"); |
| | | Matcher matcher = pattern.matcher(text); |
| | | return matcher.find() ? matcher.group(2).trim() : null; |
| | | return matcher.find() ? cleanContent(matcher.group(2)) : null; |
| | | } |
| | | |
| | | private String extractScope(String text) { |
| | | if (containsAny(text, "æåèµ·", "ææäº¤", "æç³è¯·", "ç³è¯·äººæ¯æ")) { |
| | | return "applicant"; |
| | | } |
| | | if (containsAny(text, "å¾
æå®¡æ¹", "å¾
æå®¡æ ¸", "æå¤ç", "æå®¡æ¹", "å½åå¾
æ", "éè¦æå¤ç")) { |
| | | if (containsAny(text, "å¾
æå®¡æ¹", "å¾
æå®¡æ ¸", "æå¤ç", "æå®¡æ¹", "å½åå¾
æ", "éè¦æå¤ç", "éè¦å¤ç")) { |
| | | return "approver"; |
| | | } |
| | | return "related"; |
| | | } |
| | | |
| | | private String extractRemark(String text) { |
| | | return firstNonBlank(firstNonBlank(extractTail(text, "夿³¨"), extractTail(text, "åå ")), extractQuotedContent(text)); |
| | | } |
| | | |
| | | private String extractQuotedContent(String text) { |
| | | Matcher matcher = Pattern.compile("[â\"]([^â\"]+)[â\"]").matcher(text); |
| | | return matcher.find() ? cleanContent(matcher.group(1)) : null; |
| | | } |
| | | |
| | | 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(" ", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private boolean isPlaceholderApproveId(String approveId) { |
| | | if (!StringUtils.hasText(approveId)) { |
| | | return true; |
| | | } |
| | | String value = approveId.trim(); |
| | | return "xxx".equalsIgnoreCase(value) |
| | | || value.matches("[xX]{2,}") |
| | | || "æµç¨ç¼å·".equals(value) |
| | | || "ç¼å·".equals(value) |
| | | || value.contains("示ä¾") |
| | | || value.contains("请è¾å
¥"); |
| | | } |
| | | |
| | | private String cleanContent(String text) { |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | return text.trim() |
| | | .replace("â", "") |
| | | .replace("â", "") |
| | | .replace("\"", "") |
| | | .replace("ã", "") |
| | | .replace("ï¼", "") |
| | | .replace(";", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private String firstNonBlank(String first, String second) { |
| | | return StringUtils.hasText(first) ? first : second; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | public interface ManufacturingAgent { |
| | | |
| | | @SystemMessage(fromResource = "manufacturing-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | public interface PurchaseAgent { |
| | | |
| | | @SystemMessage(fromResource = "purchase-agent-prompt.txt") |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage); |
| | | Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate); |
| | | } |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | public class PurchaseIntentExecutor { |
| | | |
| | | private static final Pattern ID_PATTERN = Pattern.compile("\\b\\d{1,12}\\b"); |
| | | private static final Pattern LIMIT_PATTERN = Pattern.compile("(å|æè¿)?(\\d{1,2})æ¡"); |
| | | private static final Pattern DATE_PATTERN = Pattern.compile("\\d{4}-\\d{2}-\\d{2}"); |
| | | private 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_RANGE_PATTERN = Pattern.compile("(è¿|æè¿)\\s*(\\d{1,3})\\s*(天|å¨|个æ|æ|å¹´)"); |
| | | private static final Pattern HALF_RANGE_PATTERN = Pattern.compile("(æè¿|è¿)?å(个)?(æ|å¹´)"); |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai"); |
| | | |
| | | private final PurchaseAgentTools purchaseAgentTools; |
| | | |
| | |
| | | return null; |
| | | } |
| | | String text = message.trim(); |
| | | String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text); |
| | | if (StringUtils.hasText(quickPromptResponse)) { |
| | | return quickPromptResponse; |
| | | } |
| | | |
| | | if (containsAny(text, "æè¡", "æå", "åå ", "åäº", "åå") && containsAny(text, "ç©æ", "产å", "åææ", "éè´éé¢", "éé¢")) { |
| | | return purchaseAgentTools.rankPurchaseMaterials( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text, |
| | | extractLimit(text) |
| | | ); |
| | | String keyword = extractKeyword(text); |
| | | Integer limit = extractLimit(text); |
| | | DateRange dateRange = extractDateRange(text); |
| | | String startDate = dateRange.startDate(); |
| | | String endDate = dateRange.endDate(); |
| | | |
| | | if (containsAny(text, "æè¡", "æå", "åå ", "åäº", "åå") |
| | | && containsAny(text, "ç©æ", "产å", "åææ", "éè´éé¢", "éé¢")) { |
| | | return purchaseAgentTools.rankPurchaseMaterials(memoryId, startDate, endDate, text, limit); |
| | | } |
| | | if (containsAny(text, "æªå
¥åº", "å¾
å
¥åº", "没æå
¥åº", "è¿æªå
¥åº")) { |
| | | return purchaseAgentTools.listUnstockedPurchaseOrders( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | return purchaseAgentTools.listUnstockedPurchaseOrders(memoryId, startDate, endDate, keyword, limit); |
| | | } |
| | | if (containsAny(text, "å°è´§å¼å¸¸", "å°è´§æå¼å¸¸", "å¼å¸¸å°è´§", "å°è´§é®é¢", "ä¾åºåå°è´§å¼å¸¸")) { |
| | | return purchaseAgentTools.listArrivalExceptions( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text, |
| | | extractLimit(text) |
| | | ); |
| | | return purchaseAgentTools.listArrivalExceptions(memoryId, startDate, endDate, text, limit); |
| | | } |
| | | if (containsAny(text, "å¾
仿¬¾", "æªä»æ¬¾", "æªä»æ¸
", "å¾
æ¯ä»", "åºä»")) { |
| | | return purchaseAgentTools.listPendingPaymentOrders( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | return purchaseAgentTools.listPendingPaymentOrders(memoryId, startDate, endDate, keyword, limit); |
| | | } |
| | | if (containsAny(text, "éè´§", "éæ", "ææ¶")) { |
| | | return purchaseAgentTools.listPurchaseReturns( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractKeyword(text), |
| | | extractLimit(text) |
| | | ); |
| | | return purchaseAgentTools.listPurchaseReturns(memoryId, startDate, endDate, keyword, limit); |
| | | } |
| | | if (isStatsIntent(text)) { |
| | | return purchaseAgentTools.getPurchaseStats( |
| | | memoryId, |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | text |
| | | ); |
| | | return purchaseAgentTools.getPurchaseStats(memoryId, startDate, endDate, text); |
| | | } |
| | | if (containsAny(text, "详æ
", "æç»") && extractId(text) != null) { |
| | | return purchaseAgentTools.getPurchaseLedgerDetail(memoryId, extractId(text)); |
| | | |
| | | Long ledgerId = extractId(text); |
| | | if (containsAny(text, "详æ
", "æç»") && ledgerId != null) { |
| | | return purchaseAgentTools.getPurchaseLedgerDetail(memoryId, ledgerId); |
| | | } |
| | | if (containsAny(text, "å°è´¦", "éè´å", "éè´è®¢å", "订å", "åå", "å表", "æ¥è¯¢")) { |
| | | return purchaseAgentTools.listPurchaseLedgers( |
| | | memoryId, |
| | | extractKeyword(text), |
| | | extractStartDate(text), |
| | | extractEndDate(text), |
| | | extractLimit(text) |
| | | ); |
| | | return purchaseAgentTools.listPurchaseLedgers(memoryId, keyword, startDate, endDate, limit); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String tryExecuteQuickPrompt(String memoryId, String text) { |
| | | String normalized = normalizeForMatch(text); |
| | | if ("æ¬æéè´é颿åååçç©ææåªäº".equals(normalized)) { |
| | | return purchaseAgentTools.rankPurchaseMaterials(memoryId, null, null, "æ¬æ", 10); |
| | | } |
| | | if ("åªäºéè´è®¢åè¿æªå
¥åº".equals(normalized)) { |
| | | return purchaseAgentTools.listUnstockedPurchaseOrders(memoryId, null, null, null, 10); |
| | | } |
| | | if ("æè¿7天ä¾åºåå°è´§å¼å¸¸æåªäº".equals(normalized)) { |
| | | return purchaseAgentTools.listArrivalExceptions(memoryId, null, null, "æè¿7天", 10); |
| | | } |
| | | if ("帮æç»è®¡å¾
仿¬¾éè´å".equals(normalized)) { |
| | | return purchaseAgentTools.listPendingPaymentOrders(memoryId, null, null, null, 10); |
| | | } |
| | | if ("ååºæ¬æéè´éè´§æ
åµ".equals(normalized)) { |
| | | return purchaseAgentTools.listPurchaseReturns(memoryId, null, null, null, 10); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | boolean queryWord = containsAny(text, "æ¥è¯¢", "æ¥ç", "çä¸", "çç", "è·å"); |
| | | boolean dataWord = containsAny(text, "æ°æ®", "éé¢", "æ°é", "ååé¢", "仿¬¾é¢", "å票é¢"); |
| | | boolean timeWord = containsAny(text, "ä»å¤©", "æ¬å¨", "æ¬æ", "䏿", "ä»å¹´", "å»å¹´", "è¿åå¹´", "æè¿å个æ", "å个æ") |
| | | || DATE_PATTERN.matcher(text).find(); |
| | | boolean timeWord = containsAny(text, "ä»å¤©", "æ¨å¤©", "æ¬å¨", "ä¸å¨", "æ¬æ", "䏿", "ä»å¹´", "å»å¹´", "è¿åå¹´", "æè¿å个æ", "å个æ") |
| | | || DATE_PATTERN.matcher(text).find() |
| | | || RELATIVE_RANGE_PATTERN.matcher(text).find() |
| | | || HALF_RANGE_PATTERN.matcher(text).find(); |
| | | return queryWord && dataWord && timeWord; |
| | | } |
| | | |
| | |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10; |
| | | } |
| | | |
| | | private String extractStartDate(String text) { |
| | | private DateRange extractDateRange(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | return matcher.find() ? matcher.group() : null; |
| | | if (matcher.find()) { |
| | | String first = matcher.group(1); |
| | | String second = matcher.find() ? matcher.group(1) : first; |
| | | return buildDateRange(first, second); |
| | | } |
| | | |
| | | LocalDate today = LocalDate.now(CHINA_ZONE_ID); |
| | | if (text.contains("ä»å¤©")) { |
| | | return new DateRange(formatDate(today), formatDate(today)); |
| | | } |
| | | if (text.contains("æ¨å¤©")) { |
| | | LocalDate yesterday = today.minusDays(1); |
| | | return new DateRange(formatDate(yesterday), formatDate(yesterday)); |
| | | } |
| | | if (text.contains("æ¬å¨")) { |
| | | LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | return new DateRange(formatDate(start), formatDate(today)); |
| | | } |
| | | if (text.contains("ä¸å¨")) { |
| | | LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | LocalDate start = thisWeekStart.minusWeeks(1); |
| | | LocalDate end = start.plusDays(6); |
| | | return new DateRange(formatDate(start), formatDate(end)); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | return new DateRange(formatDate(today.withDayOfMonth(1)), formatDate(today)); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | LocalDate start = today.minusMonths(1).withDayOfMonth(1); |
| | | return new DateRange(formatDate(start), formatDate(start.withDayOfMonth(start.lengthOfMonth()))); |
| | | } |
| | | if (text.contains("ä»å¹´") || text.contains("æ¬å¹´")) { |
| | | return new DateRange(formatDate(today.withDayOfYear(1)), formatDate(today)); |
| | | } |
| | | if (text.contains("å»å¹´")) { |
| | | LocalDate start = today.minusYears(1).withDayOfYear(1); |
| | | LocalDate end = start.withDayOfYear(start.lengthOfYear()); |
| | | return new DateRange(formatDate(start), formatDate(end)); |
| | | } |
| | | if (containsAny(text, "è¿åå¹´", "æè¿åå¹´")) { |
| | | return new DateRange(formatDate(today.minusMonths(6).plusDays(1)), formatDate(today)); |
| | | } |
| | | if (containsAny(text, "è¿å个æ", "æè¿å个æ", "å个æ")) { |
| | | return new DateRange(formatDate(today.minusDays(14)), formatDate(today)); |
| | | } |
| | | |
| | | Matcher relativeMatcher = RELATIVE_RANGE_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(formatDate(start), formatDate(today)); |
| | | } |
| | | |
| | | return new DateRange(null, null); |
| | | } |
| | | |
| | | private String extractEndDate(String text) { |
| | | Matcher matcher = DATE_PATTERN.matcher(text); |
| | | if (!matcher.find()) { |
| | | private DateRange buildDateRange(String start, String end) { |
| | | LocalDate startDate = parseDate(start); |
| | | LocalDate endDate = parseDate(end); |
| | | if (startDate == null || endDate == null) { |
| | | return new DateRange(null, null); |
| | | } |
| | | if (startDate.isAfter(endDate)) { |
| | | LocalDate temp = startDate; |
| | | startDate = endDate; |
| | | endDate = temp; |
| | | } |
| | | return new DateRange(formatDate(startDate), formatDate(endDate)); |
| | | } |
| | | |
| | | private LocalDate parseDate(String text) { |
| | | try { |
| | | return LocalDate.parse(text, DATE_FMT); |
| | | } catch (Exception ignored) { |
| | | return null; |
| | | } |
| | | return matcher.find() ? matcher.group() : 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(" ", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private String extractKeyword(String text) { |
| | | String cleaned = text |
| | | .replace("æ¥è¯¢", "") |
| | | .replace("æ¥ç", "") |
| | | .replace("çä¸", "") |
| | | .replace("çç", "") |
| | | .replace("请", "") |
| | | .replace("ä¸ä¸", "") |
| | | .replace("éè´", "") |
| | | .replace("éè´å", "") |
| | | .replace("éè´è®¢å", "") |
| | |
| | | .replace("åªäº", "") |
| | | .replace("ååº", "") |
| | | .replace("帮æ", "") |
| | | .replace("ç»è®¡", "") |
| | | .replace("åæ", "") |
| | | .replace("æ¬æ", "") |
| | | .replace("䏿", "") |
| | | .replace("æ¬å¹´", "") |
| | | .replace("ä»å¹´", "") |
| | | .replace("å»å¹´", "") |
| | | .replace("æ¬å¨", "") |
| | | .replace("ä¸å¨", "") |
| | | .replace("ä»å¤©", "") |
| | | .replace("æ¨å¤©", "") |
| | | .replace("è¿30天", "") |
| | | .replace("è¿7天", "") |
| | | .replace("è¿15天", "") |
| | | .replace("è¿60天", "") |
| | | .replace("æè¿30天", "") |
| | | .replace("æè¿7天", "") |
| | | .replace("æè¿15天", "") |
| | | .replace("æè¿60天", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .replace("å10æ¡", "") |
| | | .replace("å20æ¡", "") |
| | | .replace("æè¿20æ¡", "") |
| | | .trim(); |
| | | return cleaned.length() >= 2 ? cleaned : null; |
| | | } |
| | | |
| | | private record DateRange(String startDate, String endDate) { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 = "chatMemoryProviderSales", |
| | | tools = "salesAgentTools" |
| | | ) |
| | | public interface SalesAgent { |
| | | |
| | | @SystemMessage(fromResource = "sales-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.SalesAgentTools; |
| | | 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 SalesIntentExecutor { |
| | | |
| | | 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 final SalesAgentTools salesAgentTools; |
| | | |
| | | public SalesIntentExecutor(SalesAgentTools salesAgentTools) { |
| | | this.salesAgentTools = salesAgentTools; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | String keyword = extractKeyword(text); |
| | | Integer limit = extractLimit(text); |
| | | DateRange dateRange = extractDateRange(text); |
| | | String startDate = dateRange.startDate(); |
| | | String endDate = dateRange.endDate(); |
| | | |
| | | if (containsAny(text, "æµå¤±", "æµå¤±é£é©", "å®¢æ·æµå¤±", "é£é©åæ")) { |
| | | return salesAgentTools.analyzeCustomerChurnRisk(memoryId, startDate, endDate, text, keyword, limit); |
| | | } |
| | | if (containsAny(text, "忬¾", "æ¶æ¬¾", "æ¥ä»·") |
| | | && containsAny(text, "建议", "çç¥", "ä¼å", "æ¹æ¡")) { |
| | | return salesAgentTools.suggestCollectionAndQuotationStrategy( |
| | | memoryId, startDate, endDate, text, keyword, limit, shouldPrioritizeHighRisk(text)); |
| | | } |
| | | if (containsAny(text, "ææ ", "ç»è®¡", "çæ¿", "æ»è§", "ç»è¥åæ")) { |
| | | return salesAgentTools.getSalesDashboard(memoryId, startDate, endDate, text); |
| | | } |
| | | if (containsAny(text, "å®¢æ·æ¡£æ¡", "ç§æµ·", "å
¬æµ·", "å®¢æ·æ± ")) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, extractSeaType(text), keyword, limit); |
| | | } |
| | | if (containsAny(text, "é宿¥ä»·", "æ¥ä»·å", "æ¥ä»·", "询价")) { |
| | | return salesAgentTools.listSalesQuotations(memoryId, keyword, startDate, endDate, limit); |
| | | } |
| | | if (containsAny(text, "éå®éè´§", "éè´§", "鿬¾")) { |
| | | return salesAgentTools.listSalesReturns(memoryId, startDate, endDate, keyword, limit); |
| | | } |
| | | if (containsAny(text, "客æ·å¾æ¥", "徿¥", "忬¾", "åºæ¶", "æ¥æ¬¾", "æ¶æ¬¾æç»")) { |
| | | return salesAgentTools.listCustomerInteractions(memoryId, keyword, startDate, endDate, limit); |
| | | } |
| | | if (containsAny(text, "åè´§å°è´¦", "åè´§", "ç©æµ", "å¿«é", "è¿è¾")) { |
| | | return salesAgentTools.listShippingLedgers(memoryId, keyword, startDate, endDate, limit); |
| | | } |
| | | if (containsAny(text, "éå®å°è´¦", "éå®åå", "éå®è®¢å", "ååå°è´¦", "订åå°è´¦")) { |
| | | return salesAgentTools.listSalesLedgers(memoryId, keyword, startDate, endDate, limit); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String tryExecuteQuickPrompt(String memoryId, String text) { |
| | | String normalized = normalizeForMatch(text); |
| | | if ("æ¥è¯¢ç§æµ·å®¢æ·æ¡£æ¡å10æ¡".equals(normalized)) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, "private", null, 10); |
| | | } |
| | | if ("æ¥è¯¢å
¬æµ·å®¢æ·æ¡£æ¡".equals(normalized)) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, "public", null, 10); |
| | | } |
| | | if ("æ¥è¯¢æ¬æé宿¥ä»·".equals(normalized)) { |
| | | DateRange range = monthRange(); |
| | | return salesAgentTools.listSalesQuotations(memoryId, null, range.startDate(), range.endDate(), 10); |
| | | } |
| | | if ("æ¥è¯¢æ¬æéå®å°è´¦".equals(normalized)) { |
| | | DateRange range = monthRange(); |
| | | return salesAgentTools.listSalesLedgers(memoryId, null, range.startDate(), range.endDate(), 10); |
| | | } |
| | | if ("æ¥è¯¢è¿30天éå®éè´§".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return salesAgentTools.listSalesReturns(memoryId, range.startDate(), range.endDate(), null, 10); |
| | | } |
| | | if ("æ¥è¯¢è¿30天客æ·åæ¬¾å¾æ¥".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return salesAgentTools.listCustomerInteractions(memoryId, null, range.startDate(), range.endDate(), 10); |
| | | } |
| | | if ("æ¥è¯¢æ¬æåè´§å°è´¦".equals(normalized)) { |
| | | DateRange range = monthRange(); |
| | | return salesAgentTools.listShippingLedgers(memoryId, null, range.startDate(), range.endDate(), 10); |
| | | } |
| | | if ("æ¥çé宿æ ç»è®¡".equals(normalized)) { |
| | | return salesAgentTools.getSalesDashboard(memoryId, null, null, "æ¬æ"); |
| | | } |
| | | if ("帮æåå®¢æ·æµå¤±é£é©åæè¿30天å20æ¡".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return salesAgentTools.analyzeCustomerChurnRisk(memoryId, range.startDate(), range.endDate(), "è¿30天", null, 20); |
| | | } |
| | | if ("çæåæ¬¾ä¸æ¥ä»·çç¥å»ºè®®ä¼å
é«é£é©å®¢æ·".equals(normalized)) { |
| | | DateRange range = recentDaysRange(30); |
| | | return salesAgentTools.suggestCollectionAndQuotationStrategy(memoryId, range.startDate(), range.endDate(), "è¿30天", null, 10, true); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String extractSeaType(String text) { |
| | | if (text.contains("å
¬æµ·")) { |
| | | return "public"; |
| | | } |
| | | if (text.contains("ç§æµ·")) { |
| | | return "private"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Integer extractLimit(String text) { |
| | | Matcher matcher = LIMIT_PATTERN.matcher(text); |
| | | return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10; |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | if (text.contains("æ¬æ")) { |
| | | return monthRange(); |
| | | } |
| | | if (text.contains("䏿")) { |
| | | return lastMonthRange(); |
| | | } |
| | | if (text.contains("æ¬å¹´") || text.contains("ä»å¹´")) { |
| | | return yearRange(); |
| | | } |
| | | Matcher relativeDayMatcher = RELATIVE_DAY_PATTERN.matcher(text); |
| | | if (relativeDayMatcher.find()) { |
| | | int days = Integer.parseInt(relativeDayMatcher.group(2)); |
| | | return recentDaysRange(days); |
| | | } |
| | | return new DateRange(null, null); |
| | | } |
| | | |
| | | private DateRange buildDateRange(String start, String end) { |
| | | LocalDate startDate = parseDate(start); |
| | | LocalDate endDate = parseDate(end); |
| | | if (startDate == null || endDate == null) { |
| | | return new DateRange(null, null); |
| | | } |
| | | if (startDate.isAfter(endDate)) { |
| | | LocalDate temp = startDate; |
| | | startDate = endDate; |
| | | endDate = temp; |
| | | } |
| | | return new DateRange(formatDate(startDate), formatDate(endDate)); |
| | | } |
| | | |
| | | 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)); |
| | | } |
| | | |
| | | private DateRange monthRange() { |
| | | LocalDate today = LocalDate.now(); |
| | | return new DateRange(formatDate(today.withDayOfMonth(1)), 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(" ", "") |
| | | .trim(); |
| | | } |
| | | |
| | | private Boolean shouldPrioritizeHighRisk(String text) { |
| | | return containsAny(text, "ä¼å
é«é£é©", "é«é£é©å®¢æ·", "é«é£é©"); |
| | | } |
| | | |
| | | private String extractKeyword(String text) { |
| | | String cleaned = text |
| | | .replace("æ¥è¯¢", "") |
| | | .replace("æ¥ç", "") |
| | | .replace("çä¸", "") |
| | | .replace("çç", "") |
| | | .replace("帮æ", "") |
| | | .replace("请", "") |
| | | .replace("ä¸ä¸", "") |
| | | .replace("éå®", "") |
| | | .replace("å®¢æ·æ¡£æ¡", "") |
| | | .replace("æ¥ä»·å", "") |
| | | .replace("é宿¥ä»·", "") |
| | | .replace("éå®å°è´¦", "") |
| | | .replace("åè´§å°è´¦", "") |
| | | .replace("客æ·å¾æ¥", "") |
| | | .replace("éå®éè´§", "") |
| | | .replace("å10æ¡", "") |
| | | .replace("æè¿10æ¡", "") |
| | | .replace("å20æ¡", "") |
| | | .replace("æè¿20æ¡", "") |
| | | .replace("è¿30天", "") |
| | | .replace("æ¬æ", "") |
| | | .replace("æ¬å¹´", "") |
| | | .replace("ä»å¹´", "") |
| | | .replace("æ¡", "") |
| | | .trim(); |
| | | return cleaned.length() >= 2 ? cleaned : null; |
| | | } |
| | | |
| | | private record DateRange(String startDate, String endDate) { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 SalesAgentConfig { |
| | | |
| | | @Bean |
| | | ChatMemoryProvider chatMemoryProviderSales(MongoChatMemoryStore mongoChatMemoryStore) { |
| | | return memoryId -> MessageWindowChatMemory.builder() |
| | | .id(memoryId) |
| | | .maxMessages(30) |
| | | .chatMemoryStore(mongoChatMemoryStore) |
| | | .build(); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | 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("/manufacturing-ai") |
| | | public class ManufacturingAiController 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 ManufacturingAgent manufacturingAgent; |
| | | private final ManufacturingIntentExecutor manufacturingIntentExecutor; |
| | |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | return manufacturingAgent.chat(memoryId, userMessage) |
| | | return manufacturingAgent.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())); |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å¶é ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤å¶é ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | | return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT); |
| | | } |
| | | } |
| | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | |
| | | |
| | | @Operation(summary = "éè´å¤æä»¶åæç¡®è®¤å¤ç") |
| | | @PostMapping("/analyze-files/confirm") |
| | | public AjaxResult confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | public R confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | return purchaseAiService.confirmAnalyzeResult(request); |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | public R listSessions() { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return success(purchaseAiService.listSessions(loginUser)); |
| | | return R.ok(purchaseAiService.listSessions(loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "éè´ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return success(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | return R.ok(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤éè´ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return toAjax(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | return R.ok(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.ai.controller; |
| | | |
| | | import com.ruoyi.ai.assistant.SalesAgent; |
| | | import com.ruoyi.ai.assistant.SalesIntentExecutor; |
| | | 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.R; |
| | | 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("/sales-ai") |
| | | public class SalesAiController 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 SalesAgent salesAgent; |
| | | private final SalesIntentExecutor salesIntentExecutor; |
| | | private final AiSessionUserContext aiSessionUserContext; |
| | | private final MongoChatMemoryStore mongoChatMemoryStore; |
| | | private final AiChatSessionService aiChatSessionService; |
| | | |
| | | public SalesAiController(SalesAgent salesAgent, |
| | | SalesIntentExecutor salesIntentExecutor, |
| | | AiSessionUserContext aiSessionUserContext, |
| | | MongoChatMemoryStore mongoChatMemoryStore, |
| | | AiChatSessionService aiChatSessionService) { |
| | | this.salesAgent = salesAgent; |
| | | this.salesIntentExecutor = salesIntentExecutor; |
| | | 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 = salesIntentExecutor.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 salesAgent.chat(memoryId, userMessage, currentDateForPrompt()) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "éå®å©æä¼è¯å表") |
| | | @GetMapping("/history/sessions") |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "éå®å©æä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤éå®å©æä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | | return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | |
| | | public class XiaozhiController extends BaseController { |
| | | |
| | | private static final String FILE_ANALYZE_MEMORY_PREFIX = "file-analyze::"; |
| | | 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 ApproveTodoAgent approveTodoAgent; |
| | | private final ApproveTodoIntentExecutor approveTodoIntentExecutor; |
| | |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | return approveTodoAgent.chat(memoryId, userMessage) |
| | | if (isApproveTodoBusinessIntent(userMessage)) { |
| | | String noGuessResponse = "æªè¯å«å°å¯æ§è¡ç审æ¹å¾
åæä½æ¡ä»¶ã为ä¿è¯ç»æåç¡®ï¼å½åä¸ä¼æ¨æµæç¼é å®¡æ¹æ°æ®ï¼è¯·è¡¥å
æµç¨ç¼å·ãæ¶é´èå´ææç¡®æä½æä»¤ååè¯ã"; |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(noGuessResponse); |
| | | } |
| | | |
| | | return approveTodoAgent.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())); |
| | | public R listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "ä¼è¯æ¶æ¯") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ä¼è¯") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | return R.ok(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private boolean isApproveTodoBusinessIntent(String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return false; |
| | | } |
| | | String text = message.trim(); |
| | | boolean hasDomainWord = containsAny(text, |
| | | "审æ¹", "å¾
å", "æµç¨ç¼å·", "æµç¨å·", "å®¡æ¹æµè½¬", "审æ¹èç¹", "å½å审æ¹äºº", "驳å", "éè¿", "æ¤é", "å é¤"); |
| | | boolean hasIntentWord = containsAny(text, |
| | | "æ¥è¯¢", "æ¥ç", "ååº", "ç»è®¡", "åæ", "åå¸", "éè¿", "驳å", "æ¤é", "å é¤", "ä¿®æ¹", "æåªäº", "å¡å¨"); |
| | | return hasDomainWord && hasIntentWord; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | | return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.ai.service; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | import com.ruoyi.basic.service.StorageBlobService; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import dev.langchain4j.data.image.Image; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.Content; |
| | | import dev.langchain4j.data.message.ImageContent; |
| | | import dev.langchain4j.data.message.SystemMessage; |
| | | import dev.langchain4j.data.message.TextContent; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import dev.langchain4j.data.message.*; |
| | | 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.util.Base64; |
| | | import java.util.Arrays; |
| | | import java.nio.file.Files; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | | import java.nio.file.Files; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class PurchaseAiService { |
| | |
| | | private static final int MAX_FILE_COUNT = 10; |
| | | private static final int MAX_SINGLE_FILE_TEXT_LENGTH = 8000; |
| | | private static final int MAX_TOTAL_FILE_TEXT_LENGTH = 30000; |
| | | private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai"); |
| | | |
| | | private final PurchaseAgent purchaseAgent; |
| | | private final PurchaseIntentExecutor purchaseIntentExecutor; |
| | |
| | | return Flux.just(directResponse); |
| | | } |
| | | |
| | | return purchaseAgent.chat(memoryId, userMessage) |
| | | if (isPurchaseBusinessIntent(userMessage)) { |
| | | String noGuessResponse = buildNoGuessResponse(); |
| | | mongoChatMemoryStore.appendMessages( |
| | | memoryId, |
| | | List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse)) |
| | | ); |
| | | aiChatSessionService.refreshSessionStats(memoryId, loginUser); |
| | | return Flux.just(noGuessResponse); |
| | | } |
| | | |
| | | return purchaseAgent.chat(memoryId, userMessage, currentDateForPrompt()) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser)); |
| | | } |
| | |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | return Flux.defer(() -> purchaseAgent.chat(finalMemoryId, userPrompt)) |
| | | return Flux.defer(() -> purchaseAgent.chat(finalMemoryId, userPrompt, currentDateForPrompt())) |
| | | .onErrorResume(NoSuchElementException.class, ex -> { |
| | | mongoChatMemoryStore.deleteMessages(finalMemoryId); |
| | | return purchaseAgent.chat(finalMemoryId, userPrompt); |
| | | return purchaseAgent.chat(finalMemoryId, userPrompt, currentDateForPrompt()); |
| | | }) |
| | | .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)) |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | public AjaxResult confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | public R confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | if (request == null || !StringUtils.hasText(request.getBusinessType())) { |
| | | return AjaxResult.error("businessTypeä¸è½ä¸ºç©º"); |
| | | return R.fail("businessTypeä¸è½ä¸ºç©º"); |
| | | } |
| | | if (request.getPayload() == null || request.getPayload().isEmpty()) { |
| | | return AjaxResult.error("payloadä¸è½ä¸ºç©º"); |
| | | return R.fail("payloadä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | try { |
| | |
| | | case "purchase_ledger" -> processPurchaseLedger(request.getPayload()); |
| | | case "payment_registration" -> processPaymentRegistration(request.getPayload()); |
| | | case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload()); |
| | | default -> AjaxResult.error("æä¸æ¯æè¯¥ä¸å¡ç±»å: " + businessType); |
| | | default -> R.fail("æä¸æ¯æè¯¥ä¸å¡ç±»å: " + businessType); |
| | | }; |
| | | } catch (Exception ex) { |
| | | return AjaxResult.error(toCustomerMessage(ex)); |
| | | return R.fail(toCustomerMessage(ex)); |
| | | } |
| | | } |
| | | |
| | |
| | | }; |
| | | } |
| | | |
| | | private String currentDateForPrompt() { |
| | | return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT); |
| | | } |
| | | |
| | | private boolean isPurchaseBusinessIntent(String message) { |
| | | if (!StringUtils.hasText(message)) { |
| | | return false; |
| | | } |
| | | String text = message.trim(); |
| | | boolean hasDomainWord = containsAny(text, |
| | | "éè´", "éè´å°è´¦", "éè´å", "éè´è®¢å", "ä¾åºå", "ç©æ", "å
¥åº", "å°è´§", "å¾
仿¬¾", |
| | | "仿¬¾", "éè´§", "éæ", "å票", "åå"); |
| | | boolean hasIntentWord = containsAny(text, |
| | | "æ¥è¯¢", "æ¥ç", "ç»è®¡", "åæ", "æè¡", "æå", "ååº", "æåªäº", "æ
åµ", "æç»", "详æ
", "æ¥è¡¨"); |
| | | return hasDomainWord && hasIntentWord; |
| | | } |
| | | |
| | | private boolean containsAny(String text, String... keywords) { |
| | | for (String keyword : keywords) { |
| | | if (text.contains(keyword)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String buildNoGuessResponse() { |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("success", false); |
| | | result.put("type", "purchase_intent_not_recognized"); |
| | | result.put("description", "æªè¯å«å°å¯æ§è¡çéè´æ¥è¯¢æ¡ä»¶ã为ä¿è¯ç»æåç¡®ï¼å½åä¸ä¼æ¨æµæç¼é æ°æ®ï¼è¯·è¡¥å
æç¡®æ¶é´èå´ãä¾åºåãéè´ååå·æç©æååæ¥è¯¢ã"); |
| | | result.put("summary", Map.of()); |
| | | result.put("data", Map.of( |
| | | "quickPrompts", List.of( |
| | | "æ¬æéè´é颿åååçç©ææåªäºï¼", |
| | | "åªäºéè´è®¢åè¿æªå
¥åºï¼", |
| | | "æè¿7天ä¾åºåå°è´§å¼å¸¸æåªäºï¼", |
| | | "帮æç»è®¡å¾
仿¬¾éè´åï¼", |
| | | "ååºæ¬æéè´éè´§æ
åµ" |
| | | ) |
| | | )); |
| | | result.put("charts", Map.of()); |
| | | return JSON.toJSONString(result); |
| | | } |
| | | |
| | | private String buildPurchaseFileAnalyzePrompt(String message, String fileContent) { |
| | | return """ |
| | | ä½ æ¯éè´ä¸å¡æä»¶åæå©æãè¯·ä¸¥æ ¼æ ¹æ®ç¨æ·ä¸ä¼ çå¤ä¸ªæä»¶åç¨æ·è¦æ±æåéè´ä¸å¡æ°æ®ã |
| | |
| | | è¾åºè¦æ±: |
| | | 1. åªè¾åºåæ³ JSONï¼ä¸è¦ Markdownï¼ä¸è¦é¢å¤è§£éã |
| | | 2. JSON é¡¶å±å段åºå®ä¸º: |
| | | - success: boolean |
| | | - ok: boolean |
| | | - businessType: purchase_ledger | payment_registration | purchase_return_order | unknown |
| | | - action: confirm_required |
| | | - description: ä¸æè¯´æ |
| | |
| | | """.formatted(message, fileContent); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | private R processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | if (payload.containsKey("purchaseLedgers")) { |
| | | return processPurchaseLedgerBatch(payload); |
| | | } |
| | | |
| | | Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, 0); |
| | | R ledgerResult = validatePurchaseLedger(dto, 0); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | R productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | | int result = purchaseLedgerService.addOrEditPurchase(dto); |
| | | return AjaxResult.success("éè´å°è´¦å·²å¤ç", result); |
| | | return R.ok( result,"éè´å°è´¦å·²å¤ç"); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | private R processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers")); |
| | | if (purchaseLedgers.isEmpty()) { |
| | | return AjaxResult.error("purchaseLedgersä¸è½ä¸ºç©º"); |
| | | return R.fail("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); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, i); |
| | | R ledgerResult = validatePurchaseLedger(dto, i); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | |
| | | products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1); |
| | | dto.setProductData(products); |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(products, i); |
| | | R productResult = validatePurchaseProducts(products, i); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | |
| | | item.put("result", result); |
| | | results.add(item); |
| | | } |
| | | return AjaxResult.success("éè´å°è´¦å·²æ¹éå¤ç", results); |
| | | return R.ok( results,"éè´å°è´¦å·²æ¹éå¤ç"); |
| | | } |
| | | |
| | | private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap, |
| | |
| | | } |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | private R 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 AjaxResult.error(prefix + "缺å°äº§ååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°äº§ååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getSpecificationModel())) { |
| | | return AjaxResult.error(prefix + "缺å°è§æ ¼åå·ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°è§æ ¼åå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getUnit())) { |
| | | return AjaxResult.error(prefix + "缺å°åä½ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°åä½ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getQuantity() == null) { |
| | | return AjaxResult.error(prefix + "ç¼ºå°æ°é"); |
| | | return R.fail(prefix + "ç¼ºå°æ°é"); |
| | | } |
| | | if (product.getTaxInclusiveUnitPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°å«ç¨åä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (product.getTaxInclusiveTotalPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺å°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°å«ç¨æ»ä»·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | private R validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | String prefix = "第" + (ledgerIndex + 1) + "个éè´å°è´¦"; |
| | | if (!StringUtils.hasText(dto.getPurchaseContractNumber())) { |
| | | return AjaxResult.error(prefix + "缺å°éè´ååå·ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°éè´ååå·ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error(prefix + "缺å°ä¾åºååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | return R.fail(prefix + "缺å°ä¾åºååç§°ï¼è¯·è¡¥å
åå确认"); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | return "å¤ç失败ï¼" + message; |
| | | } |
| | | |
| | | private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | private R fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | if (dto.getSupplierId() != null) { |
| | | return null; |
| | | } |
| | | if (!StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error("ä¾åºåIDä¸è½ä¸ºç©ºï¼æªè¯å«å°ä¾åºååç§°ï¼æ æ³èªå¨å¹é
ä¾åºåID"); |
| | | return R.fail("ä¾åºåIDä¸è½ä¸ºç©ºï¼æªè¯å«å°ä¾åºååç§°ï¼æ æ³èªå¨å¹é
ä¾åºåID"); |
| | | } |
| | | |
| | | SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>() |
| | | .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim()) |
| | | .last("limit 1")); |
| | | if (supplier == null) { |
| | | return AjaxResult.error("æªæ¾å°ä¾åºåï¼" + dto.getSupplierName() + "ï¼è¯·å
ç»´æ¤ä¾åºåææå¨éæ©ä¾åºåID"); |
| | | return R.fail("æªæ¾å°ä¾åºåï¼" + dto.getSupplierName() + "ï¼è¯·å
ç»´æ¤ä¾åºåææå¨éæ©ä¾åºåID"); |
| | | } |
| | | dto.setSupplierId(supplier.getId()); |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult processPaymentRegistration(Map<String, Object> payload) { |
| | | private R processPaymentRegistration(Map<String, Object> payload) { |
| | | Object recordsValue = payload.get("records"); |
| | | List<PaymentRegistration> records; |
| | | if (recordsValue == null) { |
| | |
| | | }); |
| | | } |
| | | int result = paymentRegistrationService.insertPaymentRegistration(records); |
| | | return AjaxResult.success("仿¬¾ç»è®°å·²å¤ç", result); |
| | | return R.ok( result,"仿¬¾ç»è®°å·²å¤ç"); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | private R processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class); |
| | | Boolean result = purchaseReturnOrdersService.add(dto); |
| | | return AjaxResult.success("éè´éè´§åå·²å¤ç", result); |
| | | return R.ok( result,"éè´éè´§åå·²å¤ç"); |
| | | } |
| | | } |
| | |
| | | @P(value = "审æ¹ç±»åç¼å·ï¼å¯ä¸ä¼ ", required = false) Integer approveType, |
| | | @P(value = "å
³é®åï¼å¯å¹é
æµç¨ç¼å·ãæ é¢ãç³è¯·äººãå½å审æ¹äºº", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§20", required = false) Integer limit, |
| | | @P(value = "æ¥è¯¢èå´ï¼å¯éå¼ï¼relatedãapplicantãapproverï¼related 表示å½åç¨æ·ç¸å
³ï¼applicant 表示æåèµ·çï¼approver 表示å¾
æå¤çç", required = false) String scope) { |
| | | @P(value = "æ¥è¯¢èå´ï¼å¯éå¼ï¼relatedãapplicantãapproverï¼related 表示å½åç¨æ·ç¸å
³ï¼applicant 表示æåèµ·çï¼approver 表示å¾
æå¤çç", required = false) String scope, |
| | | @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); |
| | | Long userId = loginUser.getUserId(); |
| | | Integer statusCode = parseStatus(status); |
| | | String normalizedScope = normalizeScope(scope); |
| | | boolean hasDateFilter = StringUtils.hasText(startDate) || StringUtils.hasText(endDate) || StringUtils.hasText(timeRange); |
| | | DateRange dateRange = hasDateFilter ? resolveDateRange(startDate, endDate, timeRange) : null; |
| | | |
| | | LambdaQueryWrapper<ApproveProcess> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ApproveProcess::getApproveDelete, 0); |
| | |
| | | } |
| | | } |
| | | |
| | | if (dateRange != null) { |
| | | wrapper.ge(ApproveProcess::getCreateTime, dateRange.start().atStartOfDay()) |
| | | .lt(ApproveProcess::getCreateTime, dateRange.end().plusDays(1).atStartOfDay()); |
| | | } |
| | | |
| | | wrapper.orderByDesc(ApproveProcess::getCreateTime) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | |
| | |
| | | "statusFilter", StringUtils.hasText(status) ? status : "all", |
| | | "approveType", approveType == null ? "" : approveType, |
| | | "keyword", keyword == null ? "" : keyword, |
| | | "scope", normalizedScope |
| | | "scope", normalizedScope, |
| | | "timeRange", dateRange == null ? "all" : dateRange.label(), |
| | | "startDate", dateRange == null ? "" : dateRange.start().toString(), |
| | | "endDate", dateRange == null ? "" : dateRange.end().toString() |
| | | ), |
| | | Map.of("columns", todoColumns(), "items", items), |
| | | Map.of()); |
| | |
| | | public class PurchaseAgentTools { |
| | | |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai"); |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 30; |
| | | |
| | |
| | | .sorted(Comparator.comparing(item -> (BigDecimal) item.get("pendingAmount"), Comparator.reverseOrder())) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | BigDecimal totalContractAmount = items.stream() |
| | | .map(item -> asBigDecimal(item.get("contractAmount"))) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalPaidAmount = items.stream() |
| | | .map(item -> asBigDecimal(item.get("paidAmount"))) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalPendingAmount = items.stream() |
| | | .map(item -> asBigDecimal(item.get("pendingAmount"))) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | Map<String, Object> summary = rangeSummary(range, items.size()); |
| | | summary.put("pendingOrderCount", items.size()); |
| | | summary.put("totalContractAmount", totalContractAmount); |
| | | summary.put("totalPaidAmount", totalPaidAmount); |
| | | summary.put("totalPendingAmount", totalPendingAmount); |
| | | |
| | | return jsonResponse(true, "purchase_pending_payment_list", "å·²è¿åå¾
仿¬¾éè´åã", |
| | | rangeSummary(range, items.size()), Map.of("items", items), Map.of()); |
| | | summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éè´éè´§æ
åµ", value = "ææ¶é´èå´æ¥è¯¢éè´éè´§åå表åéè´§éé¢ã") |
| | |
| | | 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)); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | private List<PaymentRegistration> queryPayments(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId); |
| | |
| | | } |
| | | |
| | | private DateRange resolveDateRange(String startDate, String endDate, String timeRange) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate today = LocalDate.now(CHINA_ZONE_ID); |
| | | LocalDate start = parseLocalDate(startDate); |
| | | LocalDate end = parseLocalDate(endDate); |
| | | if (start != null || end != null) { |
| | |
| | | return new DateRange(today.minusDays(29), today, "è¿30天"); |
| | | } |
| | | String text = timeRange.trim(); |
| | | if (text.contains("ä»å¤©")) { |
| | | return new DateRange(today, today, "ä»å¤©"); |
| | | } |
| | | if (text.contains("æ¨å¤©")) { |
| | | LocalDate yesterday = today.minusDays(1); |
| | | return new DateRange(yesterday, yesterday, "æ¨å¤©"); |
| | | } |
| | | if (text.contains("æ¬å¨")) { |
| | | LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | return new DateRange(startOfWeek, today, "æ¬å¨"); |
| | | } |
| | | if (text.contains("ä¸å¨")) { |
| | | LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L); |
| | | LocalDate startOfLastWeek = thisWeekStart.minusWeeks(1); |
| | | return new DateRange(startOfLastWeek, startOfLastWeek.plusDays(6), "ä¸å¨"); |
| | | } |
| | | if (text.contains("ä»å¹´") || text.contains("æ¬å¹´")) { |
| | | return new DateRange(today.withDayOfYear(1), today, "ä»å¹´"); |
| | | } |
| | |
| | | if (!StringUtils.hasText(text)) { |
| | | return null; |
| | | } |
| | | return LocalDate.parse(text.trim(), DATE_FMT); |
| | | try { |
| | | return LocalDate.parse(text.trim(), DATE_FMT); |
| | | } catch (Exception ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private Date toDate(LocalDate localDate) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.SalesReceiptReturnMapper; |
| | | import com.ruoyi.account.pojo.SalesReceiptReturn; |
| | | 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 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.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.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class SalesAgentTools { |
| | | |
| | | private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final int DEFAULT_LIMIT = 10; |
| | | private static final int MAX_LIMIT = 30; |
| | | private static final BigDecimal ONE_HUNDRED = new BigDecimal("100"); |
| | | 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 final CustomerMapper customerMapper; |
| | | 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 AiSessionUserContext aiSessionUserContext; |
| | | |
| | | public SalesAgentTools(CustomerMapper customerMapper, |
| | | SalesLedgerMapper salesLedgerMapper, |
| | | SalesQuotationMapper salesQuotationMapper, |
| | | ShippingInfoMapper shippingInfoMapper, |
| | | ReceiptPaymentMapper receiptPaymentMapper, |
| | | InvoiceLedgerMapper invoiceLedgerMapper, |
| | | SalesReceiptReturnMapper salesReceiptReturnMapper, |
| | | AiSessionUserContext aiSessionUserContext) { |
| | | this.customerMapper = customerMapper; |
| | | this.salesLedgerMapper = salesLedgerMapper; |
| | | this.salesQuotationMapper = salesQuotationMapper; |
| | | this.shippingInfoMapper = shippingInfoMapper; |
| | | this.receiptPaymentMapper = receiptPaymentMapper; |
| | | this.invoiceLedgerMapper = invoiceLedgerMapper; |
| | | this.salesReceiptReturnMapper = salesReceiptReturnMapper; |
| | | this.aiSessionUserContext = aiSessionUserContext; |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å®¢æ·æ¡£æ¡", value = "æç§æµ·/å
¬æµ·ç±»ååå
³é®è¯æ¥è¯¢å®¢æ·æ¡£æ¡å表") |
| | | public String listCustomerProfiles(@ToolMemoryId String memoryId, |
| | | @P(value = "å®¢æ·æ± ç±»åï¼å¯é private/public", required = false) String seaType, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
客æ·åç§°/è系人/çµè¯", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | CustomerDto customerDto = new CustomerDto(); |
| | | customerDto.setType(normalizeSeaType(seaType)); |
| | | customerDto.setUsageStatus(1L); |
| | | |
| | | List<CustomerVo> rows = defaultList(customerMapper.list(customerDto, loginUser.getUserId())); |
| | | List<CustomerVo> filtered = rows.stream() |
| | | .filter(item -> matchCustomerKeyword(item, keyword)) |
| | | .sorted(Comparator.comparing(CustomerVo::getId, Comparator.nullsLast(Comparator.reverseOrder()))) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<Map<String, Object>> items = filtered.stream().map(item -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("id", item.getId()); |
| | | map.put("customerName", safe(item.getCustomerName())); |
| | | map.put("customerType", safe(item.getCustomerType())); |
| | | map.put("contactPerson", safe(item.getContactPerson())); |
| | | map.put("contactPhone", safe(item.getContactPhone())); |
| | | map.put("companyPhone", safe(item.getCompanyPhone())); |
| | | map.put("maintainer", safe(item.getMaintainer())); |
| | | map.put("maintenanceTime", formatDate(item.getMaintenanceTime())); |
| | | map.put("usageUserName", safe(item.getUsageUserName())); |
| | | map.put("seaType", customerSeaTypeName(item.getType())); |
| | | map.put("isAssigned", item.getIsAssigned()); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("count", items.size()); |
| | | summary.put("seaType", seaType == null ? "all" : seaType); |
| | | summary.put("keyword", safe(keyword)); |
| | | summary.put("userId", loginUser.getUserId()); |
| | | |
| | | return jsonResponse(true, "sales_customer_profile_list", "å·²è¿åå®¢æ·æ¡£æ¡å表", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢é宿¥ä»·", value = "æå
³é®è¯åæ¶é´èå´æ¥è¯¢é宿¥ä»·å") |
| | | public String listSalesQuotations(@ToolMemoryId String memoryId, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
æ¥ä»·åå·/客æ·/ä¸å¡å/ç¶æ", required = false) String keyword, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<SalesQuotation> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), SalesQuotation::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesQuotation::getDeptId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(SalesQuotation::getQuotationNo, keyword) |
| | | .or().like(SalesQuotation::getCustomer, keyword) |
| | | .or().like(SalesQuotation::getSalesperson, keyword) |
| | | .or().like(SalesQuotation::getStatus, keyword)); |
| | | } |
| | | wrapper.ge(SalesQuotation::getQuotationDate, range.start()) |
| | | .le(SalesQuotation::getQuotationDate, range.end()) |
| | | .orderByDesc(SalesQuotation::getQuotationDate, SalesQuotation::getId) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | |
| | | List<SalesQuotation> rows = defaultList(salesQuotationMapper.selectList(wrapper)); |
| | | BigDecimal quotationAmountTotal = rows.stream() |
| | | .map(SalesQuotation::getTotalAmount) |
| | | .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("quotationNo", safe(item.getQuotationNo())); |
| | | map.put("customer", safe(item.getCustomer())); |
| | | map.put("salesperson", safe(item.getSalesperson())); |
| | | map.put("quotationDate", formatDate(item.getQuotationDate())); |
| | | map.put("validDate", formatDate(item.getValidDate())); |
| | | map.put("status", safe(item.getStatus())); |
| | | map.put("paymentMethod", safe(item.getPaymentMethod())); |
| | | map.put("deliveryPeriod", safe(item.getDeliveryPeriod())); |
| | | map.put("totalAmount", item.getTotalAmount()); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("quotationAmountTotal", quotationAmountTotal); |
| | | return jsonResponse(true, "sales_quotation_list", "å·²è¿åé宿¥ä»·å表", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éå®å°è´¦", value = "æå
³é®è¯åæ¶é´èå´æ¥è¯¢éå®å°è´¦ï¼å¹¶è¿åå¼ç¥¨å款ä¸åè´§ç¶æ") |
| | | public String listSalesLedgers(@ToolMemoryId String memoryId, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
éå®ååå·/客æ·ååå·/客æ·/项ç®", required = false) String keyword, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | 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)); |
| | | } |
| | | wrapper.ge(SalesLedger::getEntryDate, toDate(range.start())) |
| | | .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end())) |
| | | .orderByDesc(SalesLedger::getEntryDate, SalesLedger::getId) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | List<SalesLedger> rows = defaultList(salesLedgerMapper.selectList(wrapper)); |
| | | if (rows.isEmpty()) { |
| | | return jsonResponse(true, "sales_ledger_list", "æªæ¥è¯¢å°ç¬¦åæ¡ä»¶çéå®å°è´¦", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<Long> ledgerIds = rows.stream().map(SalesLedger::getId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | Map<Long, BigDecimal> invoiceAmountByLedgerId = sumInvoiceAmounts(ledgerIds); |
| | | Map<Long, BigDecimal> receiptAmountByLedgerId = sumReceiptAmounts(loginUser, ledgerIds); |
| | | Map<Long, List<ShippingInfo>> shippingByLedgerId = queryShippingsByLedgerIds(loginUser, ledgerIds).stream() |
| | | .collect(Collectors.groupingBy(ShippingInfo::getSalesLedgerId)); |
| | | |
| | | BigDecimal contractAmountTotal = BigDecimal.ZERO; |
| | | BigDecimal invoicedAmountTotal = BigDecimal.ZERO; |
| | | BigDecimal receivedAmountTotal = BigDecimal.ZERO; |
| | | BigDecimal pendingAmountTotal = BigDecimal.ZERO; |
| | | |
| | | List<Map<String, Object>> items = new ArrayList<>(); |
| | | for (SalesLedger ledger : rows) { |
| | | BigDecimal contractAmount = defaultDecimal(ledger.getContractAmount()); |
| | | BigDecimal invoicedAmount = invoiceAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO); |
| | | BigDecimal receivedAmount = receiptAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO); |
| | | BigDecimal unbilledAmount = maxZero(contractAmount.subtract(invoicedAmount)); |
| | | BigDecimal pendingAmount = maxZero(invoicedAmount.subtract(receivedAmount)); |
| | | |
| | | contractAmountTotal = contractAmountTotal.add(contractAmount); |
| | | invoicedAmountTotal = invoicedAmountTotal.add(invoicedAmount); |
| | | receivedAmountTotal = receivedAmountTotal.add(receivedAmount); |
| | | pendingAmountTotal = pendingAmountTotal.add(pendingAmount); |
| | | |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("id", ledger.getId()); |
| | | item.put("salesContractNo", safe(ledger.getSalesContractNo())); |
| | | item.put("customerContractNo", safe(ledger.getCustomerContractNo())); |
| | | item.put("customerName", safe(ledger.getCustomerName())); |
| | | item.put("projectName", safe(ledger.getProjectName())); |
| | | item.put("salesman", safe(ledger.getSalesman())); |
| | | item.put("entryDate", formatDate(ledger.getEntryDate())); |
| | | item.put("executionDate", formatDate(ledger.getExecutionDate())); |
| | | item.put("deliveryDate", formatDate(ledger.getDeliveryDate())); |
| | | item.put("contractAmount", contractAmount); |
| | | item.put("invoicedAmount", invoicedAmount); |
| | | item.put("receivedAmount", receivedAmount); |
| | | item.put("unbilledAmount", unbilledAmount); |
| | | item.put("pendingAmount", pendingAmount); |
| | | item.put("shippingStatus", calcLedgerShippingStatus(shippingByLedgerId.get(ledger.getId()))); |
| | | items.add(item); |
| | | } |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("contractAmountTotal", contractAmountTotal); |
| | | summary.put("invoicedAmountTotal", invoicedAmountTotal); |
| | | summary.put("receivedAmountTotal", receivedAmountTotal); |
| | | summary.put("pendingAmountTotal", pendingAmountTotal); |
| | | return jsonResponse(true, "sales_ledger_list", "å·²è¿åéå®å°è´¦å表", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢éå®éè´§", value = "ææ¶é´èå´åå
³é®è¯æ¥è¯¢éå®éè´§è®°å½") |
| | | public String listSalesReturns(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
鿬¾åå·/交æå·/仿¬¾è´¦æ·", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<SalesReceiptReturn> wrapper = new LambdaQueryWrapper<>(); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesReceiptReturn::getDeptId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(SalesReceiptReturn::getRefundId, keyword) |
| | | .or().like(SalesReceiptReturn::getTransactionNo, keyword) |
| | | .or().like(SalesReceiptReturn::getPaymentAccountName, keyword)); |
| | | } |
| | | wrapper.ge(SalesReceiptReturn::getCreateTime, range.start().atStartOfDay()) |
| | | .le(SalesReceiptReturn::getCreateTime, range.end().atTime(23, 59, 59)) |
| | | .orderByDesc(SalesReceiptReturn::getCreateTime, SalesReceiptReturn::getId) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | List<SalesReceiptReturn> rows = defaultList(salesReceiptReturnMapper.selectList(wrapper)); |
| | | |
| | | BigDecimal returnAmount = rows.stream() |
| | | .map(SalesReceiptReturn::getActualAmount) |
| | | .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())); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("returnAmount", returnAmount); |
| | | return jsonResponse(true, "sales_return_list", "å·²è¿åéå®éè´§è®°å½", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢å®¢æ·å¾æ¥", value = "ææ¶é´èå´åå
³é®è¯æ¥è¯¢å®¢æ·åæ¬¾å¾æ¥æç»") |
| | | public String listCustomerInteractions(@ToolMemoryId String memoryId, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
客æ·åç§°/éå®ååå·/项ç®å", required = false) String keyword, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | 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<Long> ledgerIds = payments.stream() |
| | | .map(ReceiptPayment::getSalesLedgerId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | 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()); |
| | | |
| | | BigDecimal totalReceiptAmount = filtered.stream() |
| | | .map(ReceiptPayment::getReceiptPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .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()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢åè´§å°è´¦", value = "æå
³é®è¯åæ¶é´èå´æ¥è¯¢åè´§å°è´¦") |
| | | public String listShippingLedgers(@ToolMemoryId String memoryId, |
| | | @P(value = "å
³é®è¯ï¼å¯å¹é
åè´§åå·/å¿«éåå·/ç©æµå
¬å¸/车çå·", required = false) String keyword, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, null); |
| | | LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId); |
| | | if (StringUtils.hasText(keyword)) { |
| | | wrapper.and(w -> w.like(ShippingInfo::getShippingNo, keyword) |
| | | .or().like(ShippingInfo::getExpressNumber, keyword) |
| | | .or().like(ShippingInfo::getExpressCompany, keyword) |
| | | .or().like(ShippingInfo::getShippingCarNumber, keyword) |
| | | .or().like(ShippingInfo::getStatus, keyword)); |
| | | } |
| | | wrapper.ge(ShippingInfo::getShippingDate, toDate(range.start())) |
| | | .lt(ShippingInfo::getShippingDate, toExclusiveEndDate(range.end())) |
| | | .orderByDesc(ShippingInfo::getShippingDate, ShippingInfo::getId) |
| | | .last("limit " + normalizeLimit(limit)); |
| | | List<ShippingInfo> rows = defaultList(shippingInfoMapper.selectList(wrapper)); |
| | | if (rows.isEmpty()) { |
| | | return jsonResponse(true, "sales_shipping_list", "æªæ¥è¯¢å°åè´§å°è´¦è®°å½", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<Long> ledgerIds = rows.stream().map(ShippingInfo::getSalesLedgerId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); |
| | | 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)); |
| | | |
| | | long shippedCount = rows.stream().filter(item -> isShippedStatus(item.getStatus())).count(); |
| | | List<Map<String, Object>> items = rows.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("shippingNo", safe(item.getShippingNo())); |
| | | map.put("status", safe(item.getStatus())); |
| | | map.put("shippingDate", formatDate(item.getShippingDate())); |
| | | map.put("type", safe(item.getType())); |
| | | map.put("shippingCarNumber", safe(item.getShippingCarNumber())); |
| | | map.put("expressCompany", safe(item.getExpressCompany())); |
| | | map.put("expressNumber", safe(item.getExpressNumber())); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("shippingCount", rows.size()); |
| | | summary.put("shippedCount", shippedCount); |
| | | summary.put("pendingCount", Math.max(rows.size() - shippedCount, 0)); |
| | | return jsonResponse(true, "sales_shipping_list", "å·²è¿ååè´§å°è´¦è®°å½", summary, Map.of("items", items), Map.of()); |
| | | } |
| | | |
| | | @Tool(name = "æ¥è¯¢é宿æ ç»è®¡", value = "ææ¶é´èå´ç»è®¡éå®ååãæ¥ä»·ãåè´§ã忬¾çå
³é®ææ ") |
| | | public String getSalesDashboard(@ToolMemoryId String memoryId, |
| | | @P(value = "å¼å§æ¥æ yyyy-MM-dd", required = false) String startDate, |
| | | @P(value = "ç»ææ¥æ yyyy-MM-dd", required = false) String endDate, |
| | | @P(value = "æ¶é´èå´æè¿°ï¼å¦æ¬æãæ¬å¹´ãè¿30天", required = false) String timeRange) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, timeRange); |
| | | |
| | | List<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) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal quotationAmountTotal = quotations.stream() |
| | | .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(); |
| | | String shipRate = toRate(shippedCount, shippingCount); |
| | | |
| | | List<Map<String, Object>> topCustomers = buildTopCustomers(ledgers); |
| | | TrendData trendData = buildContractTrendData(ledgers, range); |
| | | |
| | | Map<String, Object> summary = new LinkedHashMap<>(); |
| | | summary.put("timeRange", range.label()); |
| | | summary.put("startDate", range.start().toString()); |
| | | summary.put("endDate", range.end().toString()); |
| | | summary.put("orderCount", ledgers.size()); |
| | | summary.put("quotationCount", quotations.size()); |
| | | summary.put("shippingCount", shippingCount); |
| | | summary.put("shippedCount", shippedCount); |
| | | summary.put("shipRate", shipRate); |
| | | summary.put("contractAmountTotal", contractAmountTotal); |
| | | summary.put("quotationAmountTotal", quotationAmountTotal); |
| | | summary.put("receivedAmountTotal", receivedAmountTotal); |
| | | summary.put("pendingAmountTotal", pendingAmountTotal); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, receivedAmountTotal, pendingAmountTotal)); |
| | | charts.put("shippingPieOption", buildShippingPieOption(shippedCount, Math.max(shippingCount - shippedCount, 0))); |
| | | charts.put("customerTopBarOption", buildCustomerTopBarOption(topCustomers)); |
| | | charts.put("contractTrendLineOption", buildContractTrendLineOption(trendData.labels(), trendData.values())); |
| | | |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | data.put("topCustomers", topCustomers); |
| | | data.put("contractTrend", trendData.toItemList()); |
| | | |
| | | return jsonResponse(true, "sales_dashboard", "å·²è¿åé宿æ ç»è®¡", summary, data, charts); |
| | | } |
| | | |
| | | @Tool(name = "å®¢æ·æµå¤±é£é©åæ", value = "æå®¢æ·ç»´åº¦è¯ä¼°æµå¤±é£é©ï¼è¾åºé£é©å级ãåå å建议ä¼å
级") |
| | | public String analyzeCustomerChurnRisk(@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 = "å
³é®è¯ï¼å¯å¹é
客æ·åç§°", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, StringUtils.hasText(timeRange) ? timeRange : "è¿180天"); |
| | | List<CustomerRiskMetric> metrics = buildCustomerRiskMetrics(loginUser, range, keyword); |
| | | if (metrics.isEmpty()) { |
| | | return jsonResponse(true, "sales_customer_churn_risk", "å½åèå´å
æªæ¥è¯¢å°å¯åæçå®¢æ·æ°æ®", |
| | | rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | List<CustomerRiskMetric> sorted = metrics.stream() |
| | | .sorted(Comparator.comparing(CustomerRiskMetric::getRiskScore).reversed() |
| | | .thenComparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder())) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | long highCount = sorted.stream().filter(item -> "high".equals(item.getRiskLevel())).count(); |
| | | long mediumCount = sorted.stream().filter(item -> "medium".equals(item.getRiskLevel())).count(); |
| | | long lowCount = sorted.stream().filter(item -> "low".equals(item.getRiskLevel())).count(); |
| | | |
| | | List<Map<String, Object>> items = sorted.stream().map(this::toRiskItem).collect(Collectors.toList()); |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("highRiskCount", highCount); |
| | | summary.put("mediumRiskCount", mediumCount); |
| | | summary.put("lowRiskCount", lowCount); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("riskLevelPieOption", buildRiskLevelPieOption(highCount, mediumCount, lowCount)); |
| | | charts.put("riskScoreBarOption", buildRiskScoreBarOption(sorted)); |
| | | |
| | | return jsonResponse(true, "sales_customer_churn_risk", "å·²å®æå®¢æ·æµå¤±é£é©åæ", summary, Map.of("items", items), charts); |
| | | } |
| | | |
| | | @Tool(name = "忬¾ä¸æ¥ä»·çç¥å»ºè®®", value = "åºäºå®¢æ·é£é©ã忬¾åæ¥ä»·æ
åµçæå¯æ§è¡çè·è¿çç¥") |
| | | public String suggestCollectionAndQuotationStrategy(@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 = "å
³é®è¯ï¼å¯å¹é
客æ·åç§°", required = false) String keyword, |
| | | @P(value = "è¿åæ¡æ°ï¼é»è®¤10ï¼æå¤§30", required = false) Integer limit, |
| | | @P(value = "æ¯å¦ä¼å
é«é£é©å®¢æ·ï¼true 表示é«é£é©ä¼å
", required = false) Boolean prioritizeHighRisk) { |
| | | LoginUser loginUser = currentLoginUser(memoryId); |
| | | DateRange range = resolveDateRange(startDate, endDate, StringUtils.hasText(timeRange) ? timeRange : "è¿90天"); |
| | | List<CustomerRiskMetric> metrics = buildCustomerRiskMetrics(loginUser, range, keyword); |
| | | if (metrics.isEmpty()) { |
| | | return jsonResponse(true, "sales_collection_quote_strategy", "å½åèå´å
æªæ¥è¯¢å°å¯çæçç¥çå®¢æ·æ°æ®", |
| | | rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of()); |
| | | } |
| | | |
| | | boolean highRiskFirst = Boolean.TRUE.equals(prioritizeHighRisk); |
| | | Comparator<CustomerRiskMetric> sortComparator; |
| | | if (highRiskFirst) { |
| | | sortComparator = Comparator |
| | | .comparingInt((CustomerRiskMetric metric) -> riskLevelRank(metric.getRiskLevel())).reversed() |
| | | .thenComparing(CustomerRiskMetric::getRiskScore, Comparator.reverseOrder()) |
| | | .thenComparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder()); |
| | | } else { |
| | | sortComparator = Comparator |
| | | .comparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder()) |
| | | .thenComparing(CustomerRiskMetric::getRiskScore, Comparator.reverseOrder()); |
| | | } |
| | | |
| | | List<CustomerRiskMetric> sorted = metrics.stream() |
| | | .sorted(sortComparator) |
| | | .limit(normalizeLimit(limit)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<Map<String, Object>> items = sorted.stream().map(this::toStrategyItem).collect(Collectors.toList()); |
| | | long highPriorityCount = items.stream().filter(item -> "high".equals(item.get("priority"))).count(); |
| | | long mediumPriorityCount = items.stream().filter(item -> "medium".equals(item.get("priority"))).count(); |
| | | long lowPriorityCount = items.stream().filter(item -> "low".equals(item.get("priority"))).count(); |
| | | |
| | | Map<String, Object> summary = rangeSummary(range, items.size(), keyword); |
| | | summary.put("highPriorityCount", highPriorityCount); |
| | | summary.put("mediumPriorityCount", mediumPriorityCount); |
| | | summary.put("lowPriorityCount", lowPriorityCount); |
| | | summary.put("prioritizeHighRisk", highRiskFirst); |
| | | summary.put("priorityMode", highRiskFirst ? "high_risk_first" : "pending_amount_first"); |
| | | |
| | | Map<String, Object> charts = new LinkedHashMap<>(); |
| | | charts.put("pendingAmountBarOption", buildPendingAmountBarOption(sorted)); |
| | | charts.put("priorityPieOption", buildPriorityPieOption(highPriorityCount, mediumPriorityCount, lowPriorityCount)); |
| | | |
| | | return jsonResponse(true, "sales_collection_quote_strategy", "å·²çæåæ¬¾ä¸æ¥ä»·çç¥å»ºè®®", summary, Map.of("items", items), charts); |
| | | } |
| | | |
| | | private List<CustomerRiskMetric> buildCustomerRiskMetrics(LoginUser loginUser, DateRange range, String keyword) { |
| | | List<SalesLedger> ledgers = querySalesLedgers(loginUser, range).stream() |
| | | .filter(item -> matchLedgerCustomerKeyword(item, keyword)) |
| | | .collect(Collectors.toList()); |
| | | if (ledgers.isEmpty()) { |
| | | return List.of(); |
| | | } |
| | | |
| | | Map<String, CustomerRiskMetric> metricMap = new LinkedHashMap<>(); |
| | | for (SalesLedger ledger : ledgers) { |
| | | String customerName = StringUtils.hasText(ledger.getCustomerName()) ? ledger.getCustomerName().trim() : "æªç¥å®¢æ·"; |
| | | CustomerRiskMetric metric = metricMap.computeIfAbsent(customerName, CustomerRiskMetric::new); |
| | | metric.setOrderCount(metric.getOrderCount() + 1); |
| | | metric.setContractAmount(metric.getContractAmount().add(defaultDecimal(ledger.getContractAmount()))); |
| | | metric.setTopSingleOrderAmount(metric.getTopSingleOrderAmount().max(defaultDecimal(ledger.getContractAmount()))); |
| | | LocalDate entryDate = toLocalDate(ledger.getEntryDate()); |
| | | if (entryDate != null && (metric.getLastOrderDate() == null || entryDate.isAfter(metric.getLastOrderDate()))) { |
| | | metric.setLastOrderDate(entryDate); |
| | | } |
| | | if (ledger.getId() != null) { |
| | | metric.getLedgerIds().add(ledger.getId()); |
| | | if (ledger.getDeliveryDate() != null) { |
| | | metric.getDeliveryDateByLedgerId().put(ledger.getId(), ledger.getDeliveryDate()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Long> allLedgerIds = metricMap.values().stream() |
| | | .flatMap(metric -> metric.getLedgerIds().stream()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | Map<Long, BigDecimal> receiptAmountByLedgerId = sumReceiptAmounts(loginUser, allLedgerIds); |
| | | Map<Long, List<ShippingInfo>> shippingByLedgerId = queryShippingsByLedgerIds(loginUser, allLedgerIds).stream() |
| | | .collect(Collectors.groupingBy(ShippingInfo::getSalesLedgerId)); |
| | | |
| | | List<SalesQuotation> quotations = querySalesQuotations(loginUser, range); |
| | | for (SalesQuotation quotation : quotations) { |
| | | String customerName = safe(quotation.getCustomer()); |
| | | CustomerRiskMetric metric = metricMap.get(customerName); |
| | | if (metric == null) { |
| | | continue; |
| | | } |
| | | metric.setQuoteCount(metric.getQuoteCount() + 1); |
| | | metric.setQuoteAmount(metric.getQuoteAmount().add(defaultDecimal(quotation.getTotalAmount()))); |
| | | } |
| | | |
| | | LocalDate today = LocalDate.now(); |
| | | for (CustomerRiskMetric metric : metricMap.values()) { |
| | | BigDecimal receivedAmount = BigDecimal.ZERO; |
| | | long overdueDeliveryCount = 0; |
| | | for (Long ledgerId : metric.getLedgerIds()) { |
| | | receivedAmount = receivedAmount.add(receiptAmountByLedgerId.getOrDefault(ledgerId, BigDecimal.ZERO)); |
| | | LocalDate deliveryDate = metric.getDeliveryDateByLedgerId().get(ledgerId); |
| | | if (deliveryDate != null && deliveryDate.isBefore(today) && !isLedgerFullyShipped(ledgerId, shippingByLedgerId)) { |
| | | overdueDeliveryCount++; |
| | | } |
| | | } |
| | | metric.setReceivedAmount(receivedAmount); |
| | | metric.setPendingAmount(maxZero(metric.getContractAmount().subtract(receivedAmount))); |
| | | if (metric.getContractAmount().compareTo(BigDecimal.ZERO) > 0) { |
| | | metric.setPendingRate(metric.getPendingAmount() |
| | | .divide(metric.getContractAmount(), 4, RoundingMode.HALF_UP)); |
| | | } else { |
| | | metric.setPendingRate(BigDecimal.ZERO); |
| | | } |
| | | metric.setOverdueDeliveryCount(overdueDeliveryCount); |
| | | if (metric.getLastOrderDate() == null) { |
| | | metric.setDaysSinceLastOrder(999); |
| | | } else { |
| | | metric.setDaysSinceLastOrder(Math.max(today.toEpochDay() - metric.getLastOrderDate().toEpochDay(), 0)); |
| | | } |
| | | evaluateRiskMetric(metric); |
| | | } |
| | | return new ArrayList<>(metricMap.values()); |
| | | } |
| | | |
| | | private void evaluateRiskMetric(CustomerRiskMetric metric) { |
| | | int score = 0; |
| | | List<String> reasons = new ArrayList<>(); |
| | | if (metric.getDaysSinceLastOrder() >= 90) { |
| | | score += 35; |
| | | reasons.add("è¿90å¤©æ æ°å¢è®¢å"); |
| | | } else if (metric.getDaysSinceLastOrder() >= 60) { |
| | | score += 25; |
| | | reasons.add("è¿60å¤©è®¢åæ´»è·åº¦ä¸é"); |
| | | } else if (metric.getDaysSinceLastOrder() >= 30) { |
| | | score += 12; |
| | | reasons.add("è¿30å¤©è®¢åæ³¢å¨åå¼±"); |
| | | } |
| | | |
| | | if (metric.getPendingRate().compareTo(new BigDecimal("0.60")) >= 0) { |
| | | score += 30; |
| | | reasons.add("å¾
忬¾å æ¯é«äº60%"); |
| | | } else if (metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) { |
| | | score += 20; |
| | | reasons.add("å¾
忬¾å æ¯é«äº30%"); |
| | | } else if (metric.getPendingRate().compareTo(new BigDecimal("0.10")) >= 0) { |
| | | score += 10; |
| | | reasons.add("åå¨å¾
忬¾é£é©"); |
| | | } |
| | | |
| | | if (metric.getOverdueDeliveryCount() > 0) { |
| | | score += Math.min((int) metric.getOverdueDeliveryCount() * 6, 20); |
| | | reasons.add("åå¨äº¤æé¾æè®¢å"); |
| | | } |
| | | |
| | | if (metric.getOrderCount() <= 1) { |
| | | score += 8; |
| | | reasons.add("订ååºæ°åä½"); |
| | | } |
| | | |
| | | if (metric.getQuoteCount() > 0 && metric.getOrderCount() == 0) { |
| | | score += 10; |
| | | reasons.add("æ¥ä»·æªå½¢æè®¢å转å"); |
| | | } |
| | | |
| | | score = Math.min(score, 100); |
| | | metric.setRiskScore(score); |
| | | if (score >= 70) { |
| | | metric.setRiskLevel("high"); |
| | | } else if (score >= 40) { |
| | | metric.setRiskLevel("medium"); |
| | | } else { |
| | | metric.setRiskLevel("low"); |
| | | } |
| | | metric.setRiskReasons(reasons); |
| | | } |
| | | |
| | | private Map<String, Object> toRiskItem(CustomerRiskMetric metric) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("customerName", metric.getCustomerName()); |
| | | map.put("riskLevel", metric.getRiskLevel()); |
| | | map.put("riskScore", metric.getRiskScore()); |
| | | map.put("contractAmount", metric.getContractAmount()); |
| | | map.put("receivedAmount", metric.getReceivedAmount()); |
| | | map.put("pendingAmount", metric.getPendingAmount()); |
| | | map.put("pendingRate", toPercent(metric.getPendingRate())); |
| | | map.put("orderCount", metric.getOrderCount()); |
| | | map.put("quoteCount", metric.getQuoteCount()); |
| | | map.put("overdueDeliveryCount", metric.getOverdueDeliveryCount()); |
| | | map.put("daysSinceLastOrder", metric.getDaysSinceLastOrder()); |
| | | map.put("lastOrderDate", formatDate(metric.getLastOrderDate())); |
| | | map.put("riskReasons", metric.getRiskReasons()); |
| | | return map; |
| | | } |
| | | |
| | | private Map<String, Object> toStrategyItem(CustomerRiskMetric metric) { |
| | | String priority = strategyPriority(metric); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("customerName", metric.getCustomerName()); |
| | | map.put("riskLevel", metric.getRiskLevel()); |
| | | map.put("riskScore", metric.getRiskScore()); |
| | | map.put("priority", priority); |
| | | map.put("pendingAmount", metric.getPendingAmount()); |
| | | map.put("pendingRate", toPercent(metric.getPendingRate())); |
| | | map.put("quoteCount", metric.getQuoteCount()); |
| | | map.put("orderCount", metric.getOrderCount()); |
| | | map.put("quoteConversionRate", toRate(metric.getOrderCount(), Math.max(metric.getQuoteCount(), 1))); |
| | | map.put("collectionStrategy", buildCollectionStrategy(metric)); |
| | | map.put("quotationStrategy", buildQuotationStrategy(metric)); |
| | | map.put("nextAction", buildNextAction(priority)); |
| | | map.put("topSingleOrderAmount", metric.getTopSingleOrderAmount()); |
| | | return map; |
| | | } |
| | | |
| | | private String buildCollectionStrategy(CustomerRiskMetric metric) { |
| | | if (metric.getPendingAmount().compareTo(BigDecimal.ZERO) <= 0) { |
| | | return "ä¿ææ£å¸¸æåº¦å¯¹è´¦ä¸å款确认ï¼ç»´æå®¢æ·å款èå¥ã"; |
| | | } |
| | | if (metric.getPendingRate().compareTo(new BigDecimal("0.60")) >= 0) { |
| | | return "ä¼å
éå®å款计åï¼æå¨æå忬¾èç¹å¹¶ç»å®åè´§æ¡ä»¶ï¼é¿å
æ°å¢ä¿¡ç¨æå£ã"; |
| | | } |
| | | if (metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) { |
| | | return "建议æ§è¡åå¨å¬æ¶æºå¶ï¼åæ¥è´¢å¡ä¸ä¸å¡èåè·è¿éç¹ååã"; |
| | | } |
| | | return "ä¿ææ£å¸¸å¬æ¶èå¥ï¼æååèç¹æå3天æé客æ·ä»æ¬¾ã"; |
| | | } |
| | | |
| | | private String buildQuotationStrategy(CustomerRiskMetric metric) { |
| | | if ("high".equals(metric.getRiskLevel())) { |
| | | return "æ¥ä»·ä¼å
ä¿æ¯å©ä¸åæ¬¾æ¡æ¬¾ï¼åå°è¶
é¿è´¦æï¼å¿
è¦æ¶éç¨åé¶æ®µæ¥ä»·ã"; |
| | | } |
| | | if (metric.getQuoteCount() > 0 && metric.getOrderCount() < metric.getQuoteCount()) { |
| | | return "ä¼åæ¥ä»·ç»æï¼å»ºè®®æä¾åºç¡ç+å级çç»åæ¥ä»·ï¼æé«è½¬åçã"; |
| | | } |
| | | if (metric.getOrderCount() <= 1) { |
| | | return "å å¼ºéæ±ææï¼å´ç»å®¢æ·åºæ¯è¡¥å
å¢å¼é¡¹ä¸äº¤ä»ä¿éæ¡æ¬¾ã"; |
| | | } |
| | | return "ä¿æå½åæ¥ä»·çç¥ï¼éç¹å´ç»äº¤æåæå¡è½ååå·®å¼ååç°ã"; |
| | | } |
| | | |
| | | private String buildNextAction(String priority) { |
| | | return switch (priority) { |
| | | case "high" -> "48å°æ¶å
宿客æ·å访ï¼ç¡®è®¤å款计å并夿 ¸æ¥ä»·æææã"; |
| | | case "medium" -> "æ¬å¨å
宿客æ·éæ±å¤çï¼æ´æ°æ¥ä»·çæ¬å¹¶åæ¥å款èç¹ã"; |
| | | default -> "ä¿ææåº¦ä¾è¡è·è¿ï¼æç»è¿½è¸ªå®¢æ·éè´è®¡åååã"; |
| | | }; |
| | | } |
| | | |
| | | private String strategyPriority(CustomerRiskMetric metric) { |
| | | if ("high".equals(metric.getRiskLevel()) || metric.getPendingRate().compareTo(new BigDecimal("0.50")) >= 0) { |
| | | return "high"; |
| | | } |
| | | if ("medium".equals(metric.getRiskLevel()) || metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) { |
| | | return "medium"; |
| | | } |
| | | return "low"; |
| | | } |
| | | |
| | | private int riskLevelRank(String riskLevel) { |
| | | if ("high".equals(riskLevel)) { |
| | | return 3; |
| | | } |
| | | if ("medium".equals(riskLevel)) { |
| | | return 2; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | private List<Map<String, Object>> buildTopCustomers(List<SalesLedger> ledgers) { |
| | | Map<String, BigDecimal> grouped = new LinkedHashMap<>(); |
| | | for (SalesLedger ledger : ledgers) { |
| | | String customerName = StringUtils.hasText(ledger.getCustomerName()) ? ledger.getCustomerName().trim() : "æªç¥å®¢æ·"; |
| | | grouped.merge(customerName, defaultDecimal(ledger.getContractAmount()), BigDecimal::add); |
| | | } |
| | | return grouped.entrySet().stream() |
| | | .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed()) |
| | | .limit(5) |
| | | .map(entry -> { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("customerName", entry.getKey()); |
| | | map.put("contractAmount", entry.getValue()); |
| | | return map; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private TrendData buildContractTrendData(List<SalesLedger> ledgers, DateRange range) { |
| | | Map<String, BigDecimal> amountByMonth = new LinkedHashMap<>(); |
| | | YearMonth startMonth = YearMonth.from(range.start()); |
| | | YearMonth endMonth = YearMonth.from(range.end()); |
| | | for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) { |
| | | amountByMonth.put(month.toString(), BigDecimal.ZERO); |
| | | } |
| | | for (SalesLedger ledger : ledgers) { |
| | | LocalDate entryDate = toLocalDate(ledger.getEntryDate()); |
| | | if (entryDate == null) { |
| | | continue; |
| | | } |
| | | String monthKey = YearMonth.from(entryDate).toString(); |
| | | if (!amountByMonth.containsKey(monthKey)) { |
| | | continue; |
| | | } |
| | | amountByMonth.put(monthKey, amountByMonth.get(monthKey).add(defaultDecimal(ledger.getContractAmount()))); |
| | | } |
| | | return new TrendData(new ArrayList<>(amountByMonth.keySet()), new ArrayList<>(amountByMonth.values())); |
| | | } |
| | | |
| | | private List<SalesLedger> querySalesLedgers(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<SalesLedger> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), SalesLedger::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedger::getDeptId); |
| | | if (range != null) { |
| | | wrapper.ge(SalesLedger::getEntryDate, toDate(range.start())) |
| | | .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end())); |
| | | } |
| | | return defaultList(salesLedgerMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<SalesQuotation> querySalesQuotations(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<SalesQuotation> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), SalesQuotation::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesQuotation::getDeptId); |
| | | if (range != null) { |
| | | wrapper.ge(SalesQuotation::getQuotationDate, range.start()) |
| | | .le(SalesQuotation::getQuotationDate, range.end()); |
| | | } |
| | | return defaultList(salesQuotationMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private List<ShippingInfo> queryShippings(LoginUser loginUser, DateRange range) { |
| | | LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId); |
| | | if (range != null) { |
| | | wrapper.ge(ShippingInfo::getShippingDate, toDate(range.start())) |
| | | .lt(ShippingInfo::getShippingDate, toExclusiveEndDate(range.end())); |
| | | } |
| | | 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(); |
| | | } |
| | | LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId); |
| | | applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId); |
| | | wrapper.in(ShippingInfo::getSalesLedgerId, ledgerIds); |
| | | return defaultList(shippingInfoMapper.selectList(wrapper)); |
| | | } |
| | | |
| | | private Map<Long, BigDecimal> sumInvoiceAmounts(List<Long> ledgerIds) { |
| | | if (ledgerIds == null || ledgerIds.isEmpty()) { |
| | | 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) { |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | for (ReceiptPayment item : queryReceiptsByLedgerIds(loginUser, ledgerIds)) { |
| | | if (item.getSalesLedgerId() == null) { |
| | | continue; |
| | | } |
| | | result.merge(item.getSalesLedgerId(), defaultDecimal(item.getReceiptPaymentAmount()), BigDecimal::add); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean isLedgerFullyShipped(Long ledgerId, Map<Long, List<ShippingInfo>> shippingByLedgerId) { |
| | | List<ShippingInfo> shippingInfos = shippingByLedgerId.get(ledgerId); |
| | | if (shippingInfos == null || shippingInfos.isEmpty()) { |
| | | return false; |
| | | } |
| | | return shippingInfos.stream().allMatch(item -> isShippedStatus(item.getStatus())); |
| | | } |
| | | |
| | | private String calcLedgerShippingStatus(List<ShippingInfo> shippingInfos) { |
| | | if (shippingInfos == null || shippingInfos.isEmpty()) { |
| | | return "æªåè´§"; |
| | | } |
| | | long shippedCount = shippingInfos.stream().filter(item -> isShippedStatus(item.getStatus())).count(); |
| | | if (shippedCount == 0) { |
| | | return "å¾
åè´§"; |
| | | } |
| | | if (shippedCount == shippingInfos.size()) { |
| | | return "å·²åè´§"; |
| | | } |
| | | return "é¨ååè´§"; |
| | | } |
| | | |
| | | private boolean isShippedStatus(String status) { |
| | | return StringUtils.hasText(status) && status.contains("å·²åè´§"); |
| | | } |
| | | |
| | | private boolean matchCustomerKeyword(CustomerVo customer, String keyword) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | return safe(customer.getCustomerName()).contains(text) |
| | | || safe(customer.getContactPerson()).contains(text) |
| | | || 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) { |
| | | if (!StringUtils.hasText(keyword)) { |
| | | return true; |
| | | } |
| | | String text = keyword.trim(); |
| | | return safe(ledger.getCustomerName()).contains(text) |
| | | || safe(ledger.getSalesContractNo()).contains(text) |
| | | || safe(ledger.getProjectName()).contains(text); |
| | | } |
| | | |
| | | private Integer normalizeSeaType(String seaType) { |
| | | if (!StringUtils.hasText(seaType)) { |
| | | return null; |
| | | } |
| | | String value = seaType.trim().toLowerCase(Locale.ROOT); |
| | | return switch (value) { |
| | | case "private", "ç§æµ·", "0" -> 0; |
| | | case "public", "å
¬æµ·", "1" -> 1; |
| | | default -> null; |
| | | }; |
| | | } |
| | | |
| | | private String customerSeaTypeName(Integer type) { |
| | | if (type == null) { |
| | | return "æªç¥"; |
| | | } |
| | | return type == 1 ? "å
¬æµ·" : "ç§æµ·"; |
| | | } |
| | | |
| | | private int normalizeLimit(Integer limit) { |
| | | if (limit == null || limit <= 0) { |
| | | return DEFAULT_LIMIT; |
| | | } |
| | | return Math.min(limit, MAX_LIMIT); |
| | | } |
| | | |
| | | private boolean tenantMatched(Long dataTenantId, Long userTenantId) { |
| | | if (userTenantId == null) { |
| | | return true; |
| | | } |
| | | return Objects.equals(dataTenantId, userTenantId); |
| | | } |
| | | |
| | | private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, 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 LoginUser currentLoginUser(String memoryId) { |
| | | LoginUser loginUser = aiSessionUserContext.get(memoryId); |
| | | if (loginUser != null) { |
| | | return loginUser; |
| | | } |
| | | return SecurityUtils.getLoginUser(); |
| | | } |
| | | |
| | | private DateRange resolveDateRange(String startDate, String endDate, String timeRange) { |
| | | 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(today.minusDays(29), today, "è¿30天"); |
| | | } |
| | | 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, "ä»å¹´"); |
| | | } |
| | | if (text.contains("å»å¹´")) { |
| | | LocalDate start = today.minusYears(1).withDayOfYear(1); |
| | | LocalDate end = today.minusYears(1).withMonth(12).withDayOfMonth(31); |
| | | return new DateRange(start, end, "å»å¹´"); |
| | | } |
| | | Matcher relativeMatcher = 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(today.minusDays(29), today, "è¿30天"); |
| | | } |
| | | |
| | | 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(Date date) { |
| | | LocalDate localDate = toLocalDate(date); |
| | | return formatDate(localDate); |
| | | } |
| | | |
| | | private String formatDate(LocalDate date) { |
| | | return date == null ? "" : date.format(DATE_FMT); |
| | | } |
| | | |
| | | private String formatDateTime(LocalDateTime time) { |
| | | return time == null ? "" : time.toString().replace('T', ' '); |
| | | } |
| | | |
| | | 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 String toRate(long numerator, long denominator) { |
| | | if (denominator <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | BigDecimal rate = new BigDecimal(numerator) |
| | | .multiply(ONE_HUNDRED) |
| | | .divide(new BigDecimal(denominator), 2, RoundingMode.HALF_UP); |
| | | return rate.toPlainString() + "%"; |
| | | } |
| | | |
| | | 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 String safe(Object value) { |
| | | return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' ').trim(); |
| | | } |
| | | |
| | | private <T> List<T> defaultList(List<T> list) { |
| | | return list == null ? List.of() : list; |
| | | } |
| | | |
| | | 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", range.start().toString()); |
| | | summary.put("endDate", range.end().toString()); |
| | | summary.put("count", count); |
| | | summary.put("keyword", safe(keyword)); |
| | | return summary; |
| | | } |
| | | |
| | | private Map<String, Object> buildAmountBarOption(BigDecimal contractAmount, |
| | | BigDecimal quotationAmount, |
| | | BigDecimal receivedAmount, |
| | | BigDecimal pendingAmount) { |
| | | List<String> xData = List.of("ååé¢", "æ¥ä»·é¢", "忬¾é¢", "å¾
忬¾"); |
| | | List<BigDecimal> yData = List.of(contractAmount, quotationAmount, receivedAmount, pendingAmount); |
| | | 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> buildShippingPieOption(long shippedCount, long pendingCount) { |
| | | List<Map<String, Object>> data = List.of( |
| | | Map.of("name", "å·²åè´§", "value", shippedCount), |
| | | Map.of("name", "æªåè´§", "value", pendingCount) |
| | | ); |
| | | 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> buildCustomerTopBarOption(List<Map<String, Object>> topCustomers) { |
| | | List<String> xData = new ArrayList<>(); |
| | | List<BigDecimal> yData = new ArrayList<>(); |
| | | for (Map<String, Object> item : topCustomers) { |
| | | xData.add(String.valueOf(item.get("customerName"))); |
| | | yData.add((BigDecimal) item.get("contractAmount")); |
| | | } |
| | | Map<String, Object> option = new LinkedHashMap<>(); |
| | | option.put("title", Map.of("text", "客æ·ååé¢TOP5", "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> buildContractTrendLineOption(List<String> labels, List<BigDecimal> 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", labels)); |
| | | option.put("yAxis", Map.of("type", "value")); |
| | | option.put("series", List.of(Map.of("name", "ååé¢", "type", "line", "smooth", true, "data", values))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildRiskLevelPieOption(long highCount, long mediumCount, long lowCount) { |
| | | List<Map<String, Object>> data = List.of( |
| | | Map.of("name", "é«é£é©", "value", highCount), |
| | | Map.of("name", "ä¸é£é©", "value", mediumCount), |
| | | Map.of("name", "ä½é£é©", "value", lowCount) |
| | | ); |
| | | 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> buildRiskScoreBarOption(List<CustomerRiskMetric> metrics) { |
| | | List<String> xData = metrics.stream().map(CustomerRiskMetric::getCustomerName).collect(Collectors.toList()); |
| | | List<Integer> yData = metrics.stream().map(CustomerRiskMetric::getRiskScore).collect(Collectors.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", "max", 100)); |
| | | option.put("series", List.of(Map.of("name", "é£é©åå¼", "type", "bar", "data", yData))); |
| | | return option; |
| | | } |
| | | |
| | | private Map<String, Object> buildPendingAmountBarOption(List<CustomerRiskMetric> metrics) { |
| | | List<String> xData = metrics.stream().map(CustomerRiskMetric::getCustomerName).collect(Collectors.toList()); |
| | | List<BigDecimal> yData = metrics.stream().map(CustomerRiskMetric::getPendingAmount).collect(Collectors.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> buildPriorityPieOption(long high, long medium, long low) { |
| | | List<Map<String, Object>> data = List.of( |
| | | Map.of("name", "é«ä¼å
级", "value", high), |
| | | Map.of("name", "ä¸ä¼å
级", "value", medium), |
| | | Map.of("name", "ä½ä¼å
级", "value", low) |
| | | ); |
| | | 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 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 record TrendData(List<String> labels, List<BigDecimal> values) { |
| | | private List<Map<String, Object>> toItemList() { |
| | | List<Map<String, Object>> items = new LinkedList<>(); |
| | | for (int i = 0; i < labels.size(); i++) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("month", labels.get(i)); |
| | | item.put("amount", values.get(i)); |
| | | items.add(item); |
| | | } |
| | | return items; |
| | | } |
| | | } |
| | | |
| | | private static class CustomerRiskMetric { |
| | | private final String customerName; |
| | | private final List<Long> ledgerIds = new ArrayList<>(); |
| | | private final Map<Long, LocalDate> deliveryDateByLedgerId = new HashMap<>(); |
| | | private BigDecimal contractAmount = BigDecimal.ZERO; |
| | | private BigDecimal receivedAmount = BigDecimal.ZERO; |
| | | private BigDecimal pendingAmount = BigDecimal.ZERO; |
| | | private BigDecimal pendingRate = BigDecimal.ZERO; |
| | | private BigDecimal quoteAmount = BigDecimal.ZERO; |
| | | private BigDecimal topSingleOrderAmount = BigDecimal.ZERO; |
| | | private int orderCount; |
| | | private int quoteCount; |
| | | private LocalDate lastOrderDate; |
| | | private long daysSinceLastOrder; |
| | | private long overdueDeliveryCount; |
| | | private int riskScore; |
| | | private String riskLevel = "low"; |
| | | private List<String> riskReasons = new ArrayList<>(); |
| | | |
| | | private CustomerRiskMetric(String customerName) { |
| | | this.customerName = customerName; |
| | | } |
| | | |
| | | private String getCustomerName() { |
| | | return customerName; |
| | | } |
| | | |
| | | private List<Long> getLedgerIds() { |
| | | return ledgerIds; |
| | | } |
| | | |
| | | private Map<Long, LocalDate> getDeliveryDateByLedgerId() { |
| | | return deliveryDateByLedgerId; |
| | | } |
| | | |
| | | private BigDecimal getContractAmount() { |
| | | return contractAmount; |
| | | } |
| | | |
| | | private void setContractAmount(BigDecimal contractAmount) { |
| | | this.contractAmount = contractAmount; |
| | | } |
| | | |
| | | private BigDecimal getReceivedAmount() { |
| | | return receivedAmount; |
| | | } |
| | | |
| | | private void setReceivedAmount(BigDecimal receivedAmount) { |
| | | this.receivedAmount = receivedAmount; |
| | | } |
| | | |
| | | private BigDecimal getPendingAmount() { |
| | | return pendingAmount; |
| | | } |
| | | |
| | | private void setPendingAmount(BigDecimal pendingAmount) { |
| | | this.pendingAmount = pendingAmount; |
| | | } |
| | | |
| | | private BigDecimal getPendingRate() { |
| | | return pendingRate; |
| | | } |
| | | |
| | | private void setPendingRate(BigDecimal pendingRate) { |
| | | this.pendingRate = pendingRate; |
| | | } |
| | | |
| | | private BigDecimal getQuoteAmount() { |
| | | return quoteAmount; |
| | | } |
| | | |
| | | private void setQuoteAmount(BigDecimal quoteAmount) { |
| | | this.quoteAmount = quoteAmount; |
| | | } |
| | | |
| | | private BigDecimal getTopSingleOrderAmount() { |
| | | return topSingleOrderAmount; |
| | | } |
| | | |
| | | private void setTopSingleOrderAmount(BigDecimal topSingleOrderAmount) { |
| | | this.topSingleOrderAmount = topSingleOrderAmount; |
| | | } |
| | | |
| | | private int getOrderCount() { |
| | | return orderCount; |
| | | } |
| | | |
| | | private void setOrderCount(int orderCount) { |
| | | this.orderCount = orderCount; |
| | | } |
| | | |
| | | private int getQuoteCount() { |
| | | return quoteCount; |
| | | } |
| | | |
| | | private void setQuoteCount(int quoteCount) { |
| | | this.quoteCount = quoteCount; |
| | | } |
| | | |
| | | private LocalDate getLastOrderDate() { |
| | | return lastOrderDate; |
| | | } |
| | | |
| | | private void setLastOrderDate(LocalDate lastOrderDate) { |
| | | this.lastOrderDate = lastOrderDate; |
| | | } |
| | | |
| | | private long getDaysSinceLastOrder() { |
| | | return daysSinceLastOrder; |
| | | } |
| | | |
| | | private void setDaysSinceLastOrder(long daysSinceLastOrder) { |
| | | this.daysSinceLastOrder = daysSinceLastOrder; |
| | | } |
| | | |
| | | private long getOverdueDeliveryCount() { |
| | | return overdueDeliveryCount; |
| | | } |
| | | |
| | | private void setOverdueDeliveryCount(long overdueDeliveryCount) { |
| | | this.overdueDeliveryCount = overdueDeliveryCount; |
| | | } |
| | | |
| | | private int getRiskScore() { |
| | | return riskScore; |
| | | } |
| | | |
| | | private void setRiskScore(int riskScore) { |
| | | this.riskScore = riskScore; |
| | | } |
| | | |
| | | private String getRiskLevel() { |
| | | return riskLevel; |
| | | } |
| | | |
| | | private void setRiskLevel(String riskLevel) { |
| | | this.riskLevel = riskLevel; |
| | | } |
| | | |
| | | private List<String> getRiskReasons() { |
| | | return riskReasons; |
| | | } |
| | | |
| | | private void setRiskReasons(List<String> riskReasons) { |
| | | this.riskReasons = riskReasons; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | 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; |
| | |
| | | @RestController |
| | | @RequestMapping("/approveNode") |
| | | @AllArgsConstructor |
| | | public class ApproveNodeController { |
| | | public class ApproveNodeController extends BaseController { |
| | | |
| | | private IApproveNodeService approveNodeService; |
| | | |
| | |
| | | */ |
| | | @GetMapping("/details/{id}") |
| | | @Operation(summary = "æµç¨ç¶æè¯¦æ
") |
| | | public AjaxResult details(@PathVariable String id) { |
| | | return AjaxResult.success(approveNodeService.details(id)); |
| | | public R<?> details(@PathVariable String id) { |
| | | return R.ok(approveNodeService.details(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/updateApproveNode") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "审æ¹èç¹") |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | public R<?> updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | approveNodeService.updateApproveNode(approveNode); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/init") |
| | | public AjaxResult init(String id) { |
| | | public R<?> init(String id) { |
| | | approveNodeService.initApproveNodes("",id,1L); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class ApproveProcessController extends BaseController { |
| | | |
| | | private IApproveProcessService approveProcessService; |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDept") |
| | | public AjaxResult getDept() { |
| | | public R<?> getDept() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LoginUser user = SecurityUtils.getLoginUser(); |
| | | Long[] deptIds = SecurityUtils.getDeptId(); |
| | | |
| | | List<SysDept> sysDeptList = approveProcessService.selectDeptListByDeptIds(deptIds); |
| | | return AjaxResult.success(sysDeptList); |
| | | return R.ok(sysDeptList); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "æ·»å 审æ¹") |
| | | public AjaxResult add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | public R<?> add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | if (approveProcessVO == null) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | return AjaxResult.success("æ·»å æå"); |
| | | return R.ok(null, "æ·»å æå"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/get") |
| | | @Operation(summary = "审æ¹è¯¦æ
") |
| | | public AjaxResult get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | public R<?> get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | if (approveGetAndUpdateVo.getId() == null || approveGetAndUpdateVo.getId().isEmpty()) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | return AjaxResult.success(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | return R.ok(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "æ´æ°å®¡æ¹") |
| | | public AjaxResult update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | public R<?> update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | if (approveGetAndUpdateVo == null) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | approveProcessService.updateByApproveId(approveGetAndUpdateVo); |
| | | return AjaxResult.success("æä½æå"); |
| | | return R.ok(null, "æä½æå"); |
| | | } |
| | | /** |
| | | * è·å审æ¹å表 |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "è·å审æ¹å表") |
| | | public AjaxResult list(Page page, ApproveProcess approveProcess) { |
| | | return AjaxResult.success(approveProcessService.listAll(page, approveProcess)); |
| | | public R<?> list(Page page, ApproveProcess approveProcess) { |
| | | return R.ok(approveProcessService.listAll(page, approveProcess)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/deleteIds") |
| | | @Operation(summary = "å é¤å®¡æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult deleteIds(@RequestBody List<Long> ids) { |
| | | public R<?> deleteIds(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.size() == 0) { |
| | | return AjaxResult.warn("åæ°ä¸è½ä¸ºç©º"); |
| | | return R.fail(HttpStatus.WARN,"åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | approveProcessService.delApprove(ids); |
| | | return AjaxResult.success("æä½æå"); |
| | | return R.ok(null, "æä½æå"); |
| | | } |
| | | |
| | | @Operation(summary = "å
¬åºç®¡ç导åº") |
| | |
| | | import com.ruoyi.approve.mapper.WorkingHoursSettingMapper; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.approve.service.HolidaySettingsService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/holidaySettings") |
| | | @AllArgsConstructor |
| | | public class HolidaySettingsController { |
| | | public class HolidaySettingsController extends BaseController { |
| | | private HolidaySettingsService holidaySettingsService; |
| | | private AnnualLeaveSettingMapper annualLeaveSettingMapper; |
| | | private OvertimeSettingMapper overtimeSettingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, HolidaySettings holidaySettings) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(holidaySettingsService.listpage(page,holidaySettings)); |
| | | return R.ok(holidaySettingsService.listpage(page,holidaySettings)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.save(holidaySettings)); |
| | | public R<?> add(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.save(holidaySettings)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.updateById(holidaySettings)); |
| | | public R<?> update(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.updateById(holidaySettings)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(holidaySettingsService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(holidaySettingsService.removeByIds(ids)); |
| | | } |
| | | /**ã |
| | | * è·åå¹´åè§åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAnnualLeaveSettingList") |
| | | public AjaxResult getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, AnnualLeaveSetting annualLeaveSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | return R.ok(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»å¹´åè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addAnnualLeaveSetting") |
| | | public AjaxResult addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | public R<?> addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°å¹´åè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateAnnualLeaveSetting") |
| | | public AjaxResult updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | public R<?> updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤å¹´åè§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteAnnualLeaveSetting") |
| | | public AjaxResult deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOvertimeSettingList") |
| | | public AjaxResult getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, OvertimeSetting overtimeSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | return R.ok(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»å çè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOvertimeSetting") |
| | | public AjaxResult addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.insert(overtimeSetting)); |
| | | public R<?> addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.insert(overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°å çè§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateOvertimeSetting") |
| | | public AjaxResult updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | public R<?> updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤å çè§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteOvertimeSetting") |
| | | public AjaxResult deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | /**ã |
| | | * è·åä¸çæ¶é´è®¾ç½®-çå¶è§åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getWorkingHoursSettingList") |
| | | public AjaxResult getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, WorkingHoursSetting workingHoursSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | return R.ok(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * 墿·»çå¶è§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/addWorkingHoursSetting") |
| | | public AjaxResult addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | public R<?> addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * æ´æ°çå¶è§å |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateWorkingHoursSetting") |
| | | public AjaxResult updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | public R<?> updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | } |
| | | /**ã |
| | | * å é¤çå¶è§å |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteWorkingHoursSetting") |
| | | public AjaxResult deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(workingHoursSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class KnowledgeBaseController extends BaseController { |
| | | private KnowledgeBaseService knowledgeBaseService; |
| | | |
| | | /**ã |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | return R.ok(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.save(knowledgeBase)); |
| | | public R<?> add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.save(knowledgeBase)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase)); |
| | | public R<?> update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.updateById(knowledgeBase)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(knowledgeBaseService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/notificationManagement") |
| | | @AllArgsConstructor |
| | | public class NotificationManagementController { |
| | | public class NotificationManagementController extends BaseController { |
| | | private NotificationManagementService notificationManagementService ; |
| | | private OnlineMeetingMapper onlineMeetingMapper; |
| | | private FileSharingMapper fileSharingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, NotificationManagement notificationManagement) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(notificationManagementService.listpage(page,notificationManagement)); |
| | | return R.ok(notificationManagementService.listpage(page,notificationManagement)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.save(notificationManagement)); |
| | | public R<?> add(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.save(notificationManagement)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.updateById(notificationManagement)); |
| | | public R<?> update(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.updateById(notificationManagement)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(notificationManagementService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(notificationManagementService.removeByIds(ids)); |
| | | } |
| | | /** |
| | | *æ°å¢ä¼è®® |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOnlineMeeting") |
| | | public AjaxResult addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return AjaxResult.success(onlineMeetingMapper.insert(onlineMeeting)); |
| | | public R<?> addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return R.ok(onlineMeetingMapper.insert(onlineMeeting)); |
| | | } |
| | | /** |
| | | *æ°å¢æä»¶å
񄧮 |
| | | * |
| | | */ |
| | | @PostMapping("/addFileSharing") |
| | | public AjaxResult addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return AjaxResult.success(fileSharingMapper.insert(fileSharing)); |
| | | public R<?> addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class RpaProcessAutomationController extends BaseController { |
| | | private RpaProcessAutomationService rpaProcessAutomationService; |
| | | /**ã |
| | | * è·åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "100") long size, RpaProcessAutomation rpaProcessAutomation) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | return R.ok(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | } |
| | | /**ã |
| | | * 墿·» |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | public R<?> add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * æ´æ° |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | public R<?> update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(rpaProcessAutomationService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(rpaProcessAutomationService.removeByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "RPAæµç¨èªå¨å导åº") |
| | |
| | | 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.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @Operation(summary = "è·å客æ·è·è¿è¯¦ç»ä¿¡æ¯") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | public R getInfo(@PathVariable("id") Integer id) { |
| | | return R.ok(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp)); |
| | | public R<?> add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PutMapping("/edit") |
| | | @Operation(summary = "ä¿®æ¹å®¢æ·è·è¿") |
| | | @Log(title = "客æ·è·è¿-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp)); |
| | | public R<?> edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "ä¸ä¼ è·è¿éä»¶") |
| | | @PostMapping("/upload/{followUpId}") |
| | | @Log(title = "客æ·è·è¿-ä¸ä¼ éä»¶", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return AjaxResult.success(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return R.ok(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "ä¸ä¼ éä»¶(å¤ç¨)") |
| | | @PostMapping("/upload") |
| | | @Log(title = "ä¸ä¼ éä»¶(å¤ç¨)", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | List<CustomerFollowUpFileDto> uploadedFiles = customerFollowUpService.addFollowUpFiles(files, null); |
| | | return AjaxResult.success(uploadedFiles); |
| | | return R.ok(uploadedFiles); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "æ¹éæ¥è¯¢éä»¶å表") |
| | | @PostMapping("/file/list") |
| | | public AjaxResult getFileList(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | public R getFileList(@RequestBody List<Long> ids) { |
| | | return R.ok(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "å é¤è·è¿éä»¶") |
| | | @DeleteMapping("/file/{fileId}") |
| | | @Log(title = "客æ·è·è¿-å é¤éä»¶", businessType = BusinessType.DELETE) |
| | | public AjaxResult deleteFile(@PathVariable Integer fileId) { |
| | | public R deleteFile(@PathVariable Integer fileId) { |
| | | customerFollowUpService.deleteFollowUpFile(fileId); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "å é¤å®¢æ·è·è¿") |
| | | @DeleteMapping("/{id}") |
| | | @Log(title = "客æ·è·è¿-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult remove(@PathVariable Integer id) { |
| | | return toAjax(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | public R remove(@PathVariable Integer id) { |
| | | return R.ok(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "æ°å¢/æ´æ°å访æé") |
| | | @PostMapping("/return-visit") |
| | | @Log(title = "å访æé-æ°å¢/æ´æ°", businessType = BusinessType.UPDATE) |
| | | public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return toAjax(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | public R saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return R.ok(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·åå访æé详æ
") |
| | | @GetMapping("/return-visit/{customerId}") |
| | | public AjaxResult getReturnVisit(@PathVariable Integer customerId) { |
| | | return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId)); |
| | | public R getReturnVisit(@PathVariable Integer customerId) { |
| | | return R.ok(customerReturnVisitService.getByCustomerId(customerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "æ è®°å访æé已读") |
| | | @PutMapping("/return-visit/read/{id}") |
| | | @Log(title = "å访æé-æ 记已读", businessType = BusinessType.UPDATE) |
| | | public AjaxResult markAsRead(@PathVariable Long id) { |
| | | public R markAsRead(@PathVariable Long id) { |
| | | customerReturnVisitService.markAsRead(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 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 AjaxResult addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | return toAjax(productService.addOrEditProduct(productDto)); |
| | | public R<?> addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | productService.addOrEditProduct(productDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProductModel") |
| | | public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | return toAjax(productModelService.addOrEditProductModel(productModelDto)); |
| | | public R<?> addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | productModelService.addOrEditProductModel(productModelDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProduct") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | // æ£æ¥æ¯å¦æéå®ååè®°å½å
³è该产å |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return AjaxResult.error("该产ååå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | return R.fail("该产ååå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | } |
| | | return toAjax(productService.delProductByIds(ids)); |
| | | productService.delProductByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProductModel") |
| | | public AjaxResult delProductModel(@RequestBody Long[] ids) { |
| | | public R<?> delProductModel(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | // æ£æ¥æ¯å¦æéå®ååè®°å½å
³è该产åè§æ ¼åå· |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductModelId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return AjaxResult.error("该产åè§æ ¼åå·åå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | return R.fail("该产åè§æ ¼åå·åå¨éå®/éè´è®°å½ï¼ä¸è½å é¤"); |
| | | } |
| | | return toAjax(productModelService.delProductModel(ids)); |
| | | productModelService.delProductModel(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "导å
¥äº§å", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importProductModel(@RequestParam("file") MultipartFile file, Integer productId) { |
| | | public R<?> 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SupplierManage supplierManage) { |
| | | public R add(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.saveSupplier(supplierManage); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delSupplier(@RequestBody List<Integer> ids) { |
| | | public R delSupplier(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | supplierService.delSupplier(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult supplierDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(supplierService.supplierDetail(id)); |
| | | public R supplierDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(supplierService.supplierDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody SupplierManage supplierManage) { |
| | | public R update(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.supplierUpdate(supplierManage); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return AjaxResult.success(supplierService.supplierListPage(page, supplierManageDto)); |
| | | public R supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return R.ok(supplierService.supplierListPage(page, supplierManageDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "ä¾åºå导å
¥", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | Boolean b = supplierService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导å
¥æå"); |
| | | } |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | public R importData(MultipartFile file) throws Exception { |
| | | return supplierService.importData(file); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOptions") |
| | | public AjaxResult getOptions() { |
| | | return AjaxResult.success(supplierService.list()); |
| | | public R getOptions() { |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/basic/supplierManageFile") |
| | | public class SupplierManageFileController { |
| | | public class SupplierManageFileController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.save(supplierManageFile)); |
| | | public R<?> add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.save(supplierManageFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | public R<?> delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(supplierManageFileService.removeBatchByIds(ids)); |
| | | return R.ok(supplierManageFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | public R<?> supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | } |
| | | |
| | | |
| | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Excel(name = "ä¾åºåç±»å") |
| | | private String supplierType; |
| | | |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | | |
| | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "ä¾åºåç±»å") |
| | | @TableField(value = "supplier_type") |
| | | @Excel(name = "ä¾åºåç±»å") |
| | | private String supplierType; |
| | | |
| | | @Schema(description = "纳ç¨äººè¯å«å·") |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | |
| | | @Schema(description = "ç§æ·ID") |
| | | @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.dto.ProductDto; |
| | | import com.ruoyi.basic.dto.ProductModelDto; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | IPage<ProductModel> modelListPage(Page page , ProductDto productDto); |
| | | |
| | | AjaxResult importProductModel(MultipartFile file, Integer productId); |
| | | R<?> 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | */ |
| | | void supplierExport(HttpServletResponse response, SupplierManageDto supplierManageDto); |
| | | |
| | | Boolean importData(MultipartFile file); |
| | | R importData(MultipartFile file); |
| | | } |
| | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importProductModel(MultipartFile file, Integer productId) { |
| | | public R<?> importProductModel(MultipartFile file, Integer productId) { |
| | | if (productId == null) { |
| | | return AjaxResult.error("请å
éæ©äº§åå导å
¥è§æ ¼åå·"); |
| | | return R.fail("请å
éæ©äº§åå导å
¥è§æ ¼åå·"); |
| | | } |
| | | |
| | | Product product = productMapper.selectById(productId); |
| | | if (product == null) { |
| | | return AjaxResult.error("éæ©ç产åä¸åå¨"); |
| | | return R.fail("éæ©ç产åä¸åå¨"); |
| | | } |
| | | |
| | | try { |
| | |
| | | List<ProductModel> productModelList = productModelExcelUtil.importExcel(file.getInputStream()); |
| | | |
| | | if (CollectionUtils.isEmpty(productModelList)) { |
| | | return AjaxResult.error("导å
¥æ°æ®ä¸è½ä¸ºç©º"); |
| | | return R.fail("导å
¥æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // è·åå½å产å䏿æçè§æ ¼åå·å |
| | |
| | | int rowNum = i + 2; |
| | | |
| | | if (StringUtils.isEmpty(item.getProductCode())) { |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [产åç¼ç ] ä¸è½ä¸ºç©º"); |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [产åç¼ç ] ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getModel())) { |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [è§æ ¼åå·] ä¸è½ä¸ºç©º"); |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [è§æ ¼åå·] ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getUnit())) { |
| | | return AjaxResult.error("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [åä½] ä¸è½ä¸ºç©º"); |
| | | return R.fail("第 " + rowNum + " è¡å¯¼å
¥å¤±è´¥: [åä½] ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // å»é,妿已å
å«è¯¥åå·,åè·³è¿ |
| | |
| | | } |
| | | |
| | | if (skipCount == 0) { |
| | | return AjaxResult.success(String.format("æå导å
¥ %d æ¡æ°æ®", waitToSaveList.size())); |
| | | return R.ok(null, String.format("æå导å
¥ %d æ¡æ°æ®", waitToSaveList.size())); |
| | | } else { |
| | | return AjaxResult.success(String.format("æå导å
¥ %d æ¡ï¼è·³è¿å·²å卿°æ® %d æ¡", waitToSaveList.size(), skipCount)); |
| | | return R.ok(null, 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 jakarta.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | private final SupplierManageMapper supplierMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SysDictDataMapper sysDictDataMapper; |
| | | |
| | | /** |
| | | * ä¾åºåæ°å¢ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean importData(MultipartFile file) { |
| | | |
| | | public R 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 true; |
| | | return R.ok("导å
¥æå"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagement; |
| | | import com.ruoyi.collaborativeApproval.service.DutyPlanService; |
| | | import com.ruoyi.common.utils.excel.ExcelUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @RestController |
| | | @RequestMapping("/dutyPlan") |
| | | @AllArgsConstructor |
| | | public class DutyPlanController { |
| | | public class DutyPlanController extends BaseController { |
| | | private DutyPlanService dutyPlanService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return AjaxResult.success(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | public R<?> listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return R.ok(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | } |
| | | @GetMapping("/getNum") |
| | | @Operation(summary = "è·åççº§æ°æ®") |
| | | public AjaxResult getNum(){ |
| | | return AjaxResult.success(dutyPlanService.getNum()); |
| | | public R<?> getNum(){ |
| | | return R.ok(dutyPlanService.getNum()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.save(dutyPlan)); |
| | | public R<?> add(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.save(dutyPlan)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.updateById(dutyPlan)); |
| | | public R<?> update(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.updateById(dutyPlan)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return AjaxResult.success(dutyPlanService.removeBatchByIds(ids)); |
| | | return R.ok(dutyPlanService.removeBatchByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @Operation(summary = "导åº") |
| | |
| | | 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 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 AjaxResult listPage(Page page, NoticeDTO noticeDTO){ |
| | | return AjaxResult.success(noticeService.listPage(page, noticeDTO)); |
| | | public R<?> listPage(Page page, NoticeDTO noticeDTO){ |
| | | return R.ok(noticeService.listPage(page, noticeDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody NoticeDTO noticeDTO){ |
| | | public R<?> add(@RequestBody NoticeDTO noticeDTO){ |
| | | if (noticeDTO.getStatus()==1){ |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | | sysNoticeService.simpleNoticeAll("éç¥å
Œ", |
| | | noticeDTO.getTitle(), |
| | | "/collaborativeApproval/noticeManagement?type="+noticeDTO.getType()); |
| | | } |
| | | return AjaxResult.success(noticeService.save(noticeDTO)); |
| | | return R.ok(noticeService.save(noticeDTO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody NoticeDTO noticeDTO){ |
| | | public R<?> 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 AjaxResult.success(noticeService.updateById(noticeDTO)); |
| | | return R.ok(noticeService.updateById(noticeDTO)); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return AjaxResult.success(noticeService.removeBatchByIds(ids)); |
| | | return R.ok(noticeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/count") |
| | | @Log(title = "è·åå
¬åæ°é", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è·åå
¬åæ°é") |
| | | public AjaxResult count(){ |
| | | return AjaxResult.success(noticeService.selectCount()); |
| | | public R<?> count(){ |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/noticeType") |
| | | @AllArgsConstructor |
| | | public class NoticeTypeController { |
| | | public class NoticeTypeController extends BaseController { |
| | | |
| | | private NoticeTypeService noticeTypeService; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody NoticeType noticeType) { |
| | | return AjaxResult.success(noticeTypeService.saveOrUpdate(noticeType)); |
| | | public R<?> add(@RequestBody NoticeType noticeType) { |
| | | return R.ok(noticeTypeService.saveOrUpdate(noticeType)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delNoticeType(@RequestBody List<Integer> ids) { |
| | | public R<?> delNoticeType(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(noticeTypeService.removeBatchByIds(ids)); |
| | | return R.ok(noticeTypeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult noticeTypeList() { |
| | | return AjaxResult.success(noticeTypeService.list()); |
| | | public R<?> noticeTypeList() { |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | 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; |
| | |
| | | @RequestMapping("/rulesRegulationsManagement") |
| | | @AllArgsConstructor |
| | | @Tag(name = "å¶åº¦ç®¡ç") |
| | | public class RulesRegulationsManagementController { |
| | | public class RulesRegulationsManagementController extends BaseController { |
| | | private RulesRegulationsManagementService rulesRegulationsManagementService; |
| | | private ReadingStatusMapper readingStatusMapper; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | public R<?> listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | public R<?> add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | rulesRegulationsManagementService.save(rulesRegulationsManagement); |
| | | return AjaxResult.success(rulesRegulationsManagement.getId()); |
| | | return R.ok(rulesRegulationsManagement.getId()); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | public R<?> update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return AjaxResult.success(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | return R.ok(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | } |
| | | //è§åæ¥çæ¶æ°å¢é
è¯»ç¶æ |
| | | @PostMapping("/addReadingStatus") |
| | | @Operation(summary = "æ°å¢é
è¯»ç¶æ") |
| | | public AjaxResult addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.insert(readingStatus)); |
| | | public R<?> addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.insert(readingStatus)); |
| | | } |
| | | @PostMapping("/updateReadingStatus") |
| | | @Operation(summary = "ä¿®æ¹é
è¯»ç¶æ") |
| | | public AjaxResult updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.updateById(readingStatus)); |
| | | public R<?> updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.updateById(readingStatus)); |
| | | } |
| | | @GetMapping("/getReadingStatusList") |
| | | @Operation(summary = "å页æ¥è¯¢é
è¯»ç¶æ") |
| | | public AjaxResult listPage(Page page, ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | public R<?> listPage(Page page, ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | } |
| | | @GetMapping("/getReadingStatusByRuleId/{ruleId}") |
| | | @Operation(summary = "æ ¹æ®å¶åº¦idæ¥è¯¢é
è¯»ç¶æ") |
| | | public AjaxResult getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return AjaxResult.success(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | public R<?> getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/rulesRegulationsManagementFile") |
| | | public class RulesRegulationsManagementFileController { |
| | | public class RulesRegulationsManagementFileController extends BaseController { |
| | | |
| | | @Resource |
| | | private RulesRegulationsManagementFileService rulesRegulationsManagementFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | public R<?> add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | return R.ok(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.listPage(page, rulesRegulationsManagementFile)); |
| | | public R<?> listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class SealApplicationManagementController extends BaseController { |
| | | private SealApplicationManagementService sealApplicationManagementService; |
| | | private ISysNoticeService sysNoticeService; |
| | | private FileUtil fileUtil; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return AjaxResult.success(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | public R<?> listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return R.ok(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public R<?> add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | sealApplicationManagementService.save(sealApplicationManagement); |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | |
| | | +"ç³è¯·æ é¢ï¼"+sealApplicationManagement.getTitle(), |
| | | Arrays.asList(sealApplicationManagement.getApproveUserId()), |
| | | "/collaborativeApproval/sealManagement?applicationNum="+sealApplicationManagement.getApplicationNum()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public R<?> update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | sealApplicationManagement.getId(), |
| | | sealApplicationManagement.getStorageBlobDTOs()); |
| | | return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | return R.ok(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | ids); |
| | | return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/staffContactsPersonal") |
| | | @AllArgsConstructor |
| | | public class StaffContactsPersonalController { |
| | | public class StaffContactsPersonalController extends BaseController { |
| | | private StaffContactsPersonalService staffContactsPersonalService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return AjaxResult.success(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | public R<?> listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return R.ok(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return AjaxResult.success(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | public R<?> add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return R.ok(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable("id") Long id) { |
| | | public R<?> delete(@PathVariable("id") Long id) { |
| | | // if (CollectionUtils.isEmpty(id)) { |
| | | // throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | // } |
| | | return AjaxResult.success(staffContactsPersonalService.removeById(id)); |
| | | return R.ok(staffContactsPersonalService.removeById(id)); |
| | | } |
| | | } |
| | |
| | | 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 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 AjaxResult listPage(Page page, String staffName, String payDateStr) { |
| | | public R<?> listPage(Page page, String staffName, String payDateStr) { |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, staffName, payDateStr); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "èªé
¬ç»©æ-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "èªé
¬ç»©æ-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public R<?> add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | | return save ? AjaxResult.success("æ·»å æå") : AjaxResult.error("æ·»å 失败"); |
| | | return save ? R.ok(null, "æ·»å æå") : R.fail("æ·»å 失败"); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "èªé
¬ç»©æ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "èªé
¬ç»©æ-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public R<?> update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | | return update ? AjaxResult.success("ä¿®æ¹æå") : AjaxResult.error("ä¿®æ¹å¤±è´¥"); |
| | | return update ? R.ok(null, "ä¿®æ¹æå") : R.fail("ä¿®æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "èªé
¬ç»©æ-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "èªé
¬ç»©æ-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | boolean delete = compensationPerformanceService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success("å 餿å") : AjaxResult.error("å é¤å¤±è´¥"); |
| | | return delete ? R.ok(null, "å 餿å") : R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | @Log(title = "导åºèªèµç®¡çå表", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | @Log(title = "导å
¥èªèµç®¡çå表", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> 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 AjaxResult.success(b); |
| | | return R.ok(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.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; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "å®¢æ·æè®¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å®¢æ·æè®¿-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, CustomerVisits customerVisits) { |
| | | public R<?> listPage(Page page, CustomerVisits customerVisits) { |
| | | IPage<CustomerVisits> listPage = customerVisitsService.listPage(page, customerVisits); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "å®¢æ·æè®¿-æ·»å ") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CustomerVisits customerVisits) { |
| | | public R<?> add(@RequestBody CustomerVisits customerVisits) { |
| | | boolean save = customerVisitsService.save(customerVisits); |
| | | if (save) { |
| | | return AjaxResult.success("æ·»å æå"); |
| | | return R.ok(null, "æ·»å æå"); |
| | | } |
| | | return AjaxResult.error("æ·»å 失败"); |
| | | return R.fail("æ·»å 失败"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-ç¼è¾", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "å®¢æ·æè®¿-ç¼è¾") |
| | | @PostMapping("update") |
| | | public AjaxResult updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | public R<?> updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | boolean updateResult = customerVisitsService.updateCustomerVisit(customerVisits); |
| | | if (updateResult) { |
| | | return AjaxResult.success("ç¼è¾æå"); |
| | | return R.ok(null, "ç¼è¾æå"); |
| | | } |
| | | return AjaxResult.error("ç¼è¾å¤±è´¥"); |
| | | return R.fail("ç¼è¾å¤±è´¥"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å®¢æ·æè®¿-å é¤") |
| | | @DeleteMapping("{customerId}") |
| | | public AjaxResult deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | public R<?> deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | if (customerId == null) { |
| | | return AjaxResult.error("客æ·IDä¸è½ä¸ºç©º"); |
| | | return R.fail("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | boolean deleteResult = customerVisitsService.removeById(customerId); |
| | | if (deleteResult) { |
| | | return AjaxResult.success("å 餿å"); |
| | | return R.ok(null, "å 餿å"); |
| | | } |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | 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; |
| | |
| | | @RequestMapping("/defect") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | public class DeviceDefectRecordController { |
| | | public class DeviceDefectRecordController extends BaseController { |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @Operation(summary = "设å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | public R<?> page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return R.ok(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | } |
| | | @Operation(summary = "设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/find/{deviceLedgerId}") |
| | | public AjaxResult find(@PathVariable Long deviceLedgerId) { |
| | | public R<?> find(@PathVariable Long deviceLedgerId) { |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | | deviceDefectRecordDto.setDeviceLedgerId(deviceLedgerId); |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | return R.ok(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å 设å¤ç¼ºé·è®°å½") |
| | | public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | public R<?> add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | public R<?> update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceDefectRecordService.removeById(id)); |
| | | public R<?> delete(@PathVariable Long id) { |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class DeviceLedgerController extends BaseController { |
| | | |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | |
| | | |
| | | @Operation(summary = "设å¤å°è´¦å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | public R<?> page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return R.ok(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å 设å¤å°è´¦") |
| | | public AjaxResult add(@RequestBody DeviceLedger deviceLedger) { |
| | | public R<?> add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceLedgerService.getById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceLedgerService.getById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤å°è´¦") |
| | | public AjaxResult update(@RequestBody DeviceLedger deviceLedger) { |
| | | public R<?> update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤å°è´¦") |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | public R<?> delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥è®¾å¤å°è´¦") |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | public R<?> importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导å
¥æå"); |
| | | return R.ok(null, "导å
¥æå"); |
| | | } |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | public AjaxResult getDeviceLedger( ) { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | public R<?> getDeviceLedger( ) { |
| | | return R.ok(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | } |
| | | |
| | | @GetMapping("scanDevice") |
| | | @Operation(summary = "è·å设å¤å°è´¦") |
| | | @Anonymous |
| | | public AjaxResult scanDevice(Long id) { |
| | | public R<?> scanDevice(Long id) { |
| | | List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id); |
| | | DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id); |
| | | if (list.size()>0){ |
| | | deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//æåç»´æ¤æ¶é´ |
| | | } |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//䏿¬¡ç»´æ¤æ¶é´ |
| | | return AjaxResult.success(deviceLedger); |
| | | return R.ok(deviceLedger); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class DeviceMaintenanceController extends BaseController { |
| | | |
| | | |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | |
| | | |
| | | @Operation(summary = "设å¤ä¿å
»å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | public R<?> page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return R.ok(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @PostMapping ("maintenance") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class DeviceMaintenanceFileController extends BaseController { |
| | | |
| | | @Resource |
| | | private DeviceMaintenanceFileService deviceMaintenanceFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | public R<?> add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | return R.ok(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | public R<?> qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(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.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 { |
| | | public class DeviceRepairController extends BaseController { |
| | | |
| | | private IDeviceRepairService deviceRepairService; |
| | | |
| | | @Operation(summary = "è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return AjaxResult.success(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | public R<?> page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return R.ok(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceRepairService.detailById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceRepairService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | public AjaxResult update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/repair") |
| | | @Operation(summary = "设å¤ç»´ä¿®") |
| | | public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.confirmRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/acceptance") |
| | | @Operation(summary = "è®¾å¤æ¥ä¿®éªæ¶å®¡æ¹") |
| | | public AjaxResult acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.approveRepairAcceptance(deviceRepairDto); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "å é¤è®¾å¤æ¥ä¿®") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | return R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @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.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; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public R<?> add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.add(maintenanceTask); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public R<?> update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return maintenanceTaskService.delete(ids); |
| | | } |
| | | |
| | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | | IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger); |
| | | |
| | | AjaxResult saveDeviceLedger(DeviceLedger deviceLedger); |
| | | R<?> saveDeviceLedger(DeviceLedger deviceLedger); |
| | | |
| | | AjaxResult updateDeviceLedger(DeviceLedger deviceLedger); |
| | | R<?> updateDeviceLedger(DeviceLedger deviceLedger); |
| | | |
| | | 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | R<?> 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | R<?> 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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskService extends IService<MaintenanceTask> { |
| | | AjaxResult listPage(Page page, MaintenanceTask maintenanceTask); |
| | | R<?> listPage(Page page, MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult add(MaintenanceTask maintenanceTask); |
| | | R<?> add(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | public R<?> saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | return AjaxResult.error("设å¤åç§°å·²åå¨"); |
| | | return R.fail("设å¤åç§°å·²åå¨"); |
| | | } |
| | | boolean save = this.save(deviceLedger); |
| | | if (save){ |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | public R<?> updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | if (this.updateById(deviceLedger)) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> 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 AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | return R.fail("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> 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 AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error("ä¿å失败"); |
| | | return R.fail("ä¿å失败"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (deviceRepairDto.getStatus() != null |
| | | && deviceRepairDto.getStatus() == STATUS_COMPLETED |
| | | && (oldDeviceRepair.getStatus() == null |
| | | || oldDeviceRepair.getStatus() != STATUS_COMPLETED)) { |
| | | return AjaxResult.error("请å
æäº¤éªæ¶å®¡æ¹ï¼éªæ¶éè¿åæå¯å®ç»"); |
| | | return R.fail("请å
æäº¤éªæ¶å®¡æ¹ï¼éªæ¶éè¿åæå¯å®ç»"); |
| | | } |
| | | // å¤çå¤ä»¶ä½¿ç¨æ
åµ |
| | | if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) { |
| | |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return AjaxResult.error("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | return R.fail("å¤ä»¶ " + spareParts.getName() + " æ°éä¸è¶³"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (deviceRepairDto.getStorageBlobDTOs() != null) { |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs()); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_COMPLETED) { |
| | | return AjaxResult.error("该æ¥ä¿®å·²å®ç»ï¼ä¸è½éå¤ç¡®è®¤ç»´ä¿®"); |
| | | return R.fail("该æ¥ä¿®å·²å®ç»ï¼ä¸è½éå¤ç¡®è®¤ç»´ä¿®"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_PENDING_ACCEPTANCE) { |
| | | return AjaxResult.error("该æ¥ä¿®å·²æäº¤éªæ¶å®¡æ¹"); |
| | | return R.fail("该æ¥ä¿®å·²æäº¤éªæ¶å®¡æ¹"); |
| | | } |
| | | deviceRepairDto.setStatus(STATUS_PENDING_ACCEPTANCE); |
| | | return updateDeviceRepair(deviceRepairDto); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | if (deviceRepairDto.getId() == null) { |
| | | return AjaxResult.error("æ¥ä¿®è®°å½idä¸è½ä¸ºç©º"); |
| | | return R.fail("æ¥ä¿®è®°å½idä¸è½ä¸ºç©º"); |
| | | } |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | return R.fail("æ¥ä¿®è®°å½ä¸åå¨"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() == null || oldDeviceRepair.getStatus() != STATUS_PENDING_ACCEPTANCE) { |
| | | return AjaxResult.error("该æ¥ä¿®æªè¿å
¥å¾
éªæ¶ç¶æï¼ä¸è½å®¡æ¹"); |
| | | return R.fail("该æ¥ä¿®æªè¿å
¥å¾
éªæ¶ç¶æï¼ä¸è½å®¡æ¹"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceName())) { |
| | | return AjaxResult.error("éªæ¶äººä¸è½ä¸ºç©º"); |
| | | return R.fail("éªæ¶äººä¸è½ä¸ºç©º"); |
| | | } |
| | | if (deviceRepairDto.getAcceptanceTime() == null) { |
| | | return AjaxResult.error("éªæ¶æ¶é´ä¸è½ä¸ºç©º"); |
| | | return R.fail("éªæ¶æ¶é´ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceRemark())) { |
| | | return AjaxResult.error("éªæ¶å¤æ³¨ä¸è½ä¸ºç©º"); |
| | | return R.fail("éªæ¶å¤æ³¨ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | DeviceRepair update = new DeviceRepair(); |
| | |
| | | update.setAcceptanceRemark(deviceRepairDto.getAcceptanceRemark()); |
| | | update.setStatus(STATUS_COMPLETED); |
| | | if (this.updateById(update)) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error("éªæ¶å®¡æ¹å¤±è´¥"); |
| | | return R.fail("éªæ¶å®¡æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.mapper.MaintenanceTaskMapper; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null); |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | | if (taskPage.getRecords().isEmpty()) { |
| | | return AjaxResult.success(taskPage); |
| | | return R.ok(taskPage); |
| | | } |
| | | |
| | | // 3. æ¶éææéè¦æ¥è¯¢çç¨æ·ID |
| | |
| | | task.setRegistrant(userNickNameMap.getOrDefault(task.getRegistrantId(), "æªç¥ç¨æ·")); |
| | | } |
| | | }); |
| | | return AjaxResult.success(taskPage); |
| | | return R.ok(taskPage); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(MaintenanceTask maintenanceTask) { |
| | | public R<?> add(MaintenanceTask maintenanceTask) { |
| | | maintenanceTask.setActive(true); |
| | | // 计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | TimingTask task = new TimingTask(); |
| | |
| | | if (insert > 0) { |
| | | maintenanceTaskScheduler.scheduleMaintenanceTask(maintenanceTask); |
| | | } |
| | | return AjaxResult.success("æ·»å æå"); |
| | | return R.ok(null, "æ·»å æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | public R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | MaintenanceTask maintenanceTask1 = maintenanceTaskMapper.selectById(maintenanceTask.getId()); |
| | | if (maintenanceTask1 == null) { |
| | | return AjaxResult.warn("æ²¡ææ¤æ°æ®"); |
| | | return R.fail(HttpStatus.WARN, "æ²¡ææ¤æ°æ®"); |
| | | } |
| | | BeanUtils.copyProperties(maintenanceTask, maintenanceTask1); |
| | | int update = maintenanceTaskMapper.updateById(maintenanceTask1); |
| | | if (update > 0) { |
| | | maintenanceTaskScheduler.rescheduleMaintenanceTask(maintenanceTask1); |
| | | } |
| | | return AjaxResult.success("æ´æ°æå"); |
| | | return R.ok(null, "æ´æ°æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | int delete = maintenanceTaskMapper.deleteBatchIds(ids); |
| | | if (delete > 0) { |
| | | ids.forEach(id -> { |
| | | maintenanceTaskScheduler.unscheduleMaintenanceTask(id); |
| | | }); |
| | | } |
| | | return AjaxResult.success("å 餿å"); |
| | | return R.ok(null, "å 餿å"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "ç¨çµåºå-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµåºå-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public R<?> listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | IPage<ElectricityConsumptionArea> listPage = electricityConsumptionAreaService.listPage(page, electricityConsumptionArea); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "ç¨çµåºå-æ°å¢") |
| | | @Log(title = "ç¨çµåºå-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public R<?> add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | boolean save = electricityConsumptionAreaService.saveOrUpdate(electricityConsumptionArea); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "ç¨çµåºå-å é¤") |
| | | @Log(title = "ç¨çµåºå-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = electricityConsumptionAreaService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | return remove ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å页æ¥è¯¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EnergyPeriod energyPeriod) { |
| | | public R<?> listPage(Page page, EnergyPeriod energyPeriod) { |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EnergyPeriod energyPeriod) { |
| | | public R<?> add(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean save = energyPeriodService.save(energyPeriod); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-æ¹éæ°å¢") |
| | | @Log(title = "ç¨çµæ¶æ®µ-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | public R<?> addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | boolean save = energyPeriodService.saveBatch(energyPeriods); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-ä¿®æ¹") |
| | | @Log(title = "ç¨çµæ¶æ®µ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EnergyPeriod energyPeriod) { |
| | | public R<?> update(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean update = energyPeriodService.updateById(energyPeriod); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "ç¨çµæ¶æ®µ-å é¤") |
| | | @Log(title = "ç¨çµæ¶æ®µ-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = energyPeriodService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error("å é¤å¤±è´¥"); |
| | | return remove ? R.ok() : R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设å¤è½è-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPage(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/deviceList") |
| | | @Operation(summary = "设å¤å°è´¦-æ¥è¯¢") |
| | | @Log(title = "设å¤å°è´¦-æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult deviceList(DeviceLedger deviceLedger) { |
| | | public R<?> deviceList(DeviceLedger deviceLedger) { |
| | | List<DeviceLedger> listPage = equipmentEnergyConsumptionService.deviceList(deviceLedger); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "设å¤è½è-æ°å¢") |
| | | @Log(title = "设å¤è½è-æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean save = equipmentEnergyConsumptionService.save(equipmentEnergyConsumption); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "设å¤è½è-æ¹éæ°å¢") |
| | | @Log(title = "设å¤è½è-æ¹éæ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | public R<?> addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | boolean save = equipmentEnergyConsumptionService.saveBatch(list); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "设å¤è½è-ä¿®æ¹") |
| | | @Log(title = "设å¤è½è-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean update = equipmentEnergyConsumptionService.updateById(equipmentEnergyConsumption); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "设å¤è½è-å é¤") |
| | | @Log(title = "设å¤è½è-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean remove = equipmentEnergyConsumptionService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | return remove ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导å
¥è®¾å¤è½è", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导å
¥è®¾å¤è½è") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | return equipmentEnergyConsumptionService.importData(file); |
| | | } |
| | | |
| | |
| | | @GetMapping("/listPageByTrend") |
| | | @Operation(summary = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢") |
| | | @Log(title = "设å¤è½è-è½æºè¶å¿-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPageByTrend(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | IPage<EquipmentEnergyConsumption> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> 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.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<EquipmentEnergyConsumption> util = new ExcelUtil<EquipmentEnergyConsumption>(EquipmentEnergyConsumption.class); |
| | | List<EquipmentEnergyConsumption> userList = util.importExcel(file.getInputStream()); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return AjaxResult.warn("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | return R.fail(HttpStatus.WARN, "模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return AjaxResult.success(true); |
| | | return R.ok(true); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | |
| | | 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.AjaxResult;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import com.ruoyi.framework.web.page.PageDomain;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.framework.web.page.TableSupport;
|
| | |
| | | /**
|
| | | * è¿åæå
|
| | | */
|
| | | public AjaxResult success()
|
| | | public R<?> success()
|
| | | {
|
| | | return AjaxResult.success();
|
| | | return R.ok();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åæåæ¶æ¯
|
| | | */
|
| | | public AjaxResult success(String message)
|
| | | public R<?> success(String message)
|
| | | {
|
| | | return AjaxResult.success(message);
|
| | | return R.ok(null, message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åæåæ¶æ¯
|
| | | */
|
| | | public AjaxResult success(Object data)
|
| | | public R<?> success(Object data)
|
| | | {
|
| | | return AjaxResult.success(data);
|
| | | return R.ok(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åå¤±è´¥æ¶æ¯
|
| | | */
|
| | | public AjaxResult error()
|
| | | public R<?> error()
|
| | | {
|
| | | return AjaxResult.error();
|
| | | return R.fail();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åå¤±è´¥æ¶æ¯
|
| | | */
|
| | | public AjaxResult error(String message)
|
| | | public R<?> error(String message)
|
| | | {
|
| | | return AjaxResult.error(message);
|
| | | return R.fail(message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è¿åè¦åæ¶æ¯
|
| | | */
|
| | | public AjaxResult warn(String message)
|
| | | public R<?> warn(String message)
|
| | | {
|
| | | return AjaxResult.warn(message);
|
| | | return R.fail(HttpStatus.WARN, message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * ååºè¿åç»æ
|
| | | * |
| | | *
|
| | | * @param rows å½±åè¡æ°
|
| | | * @return æä½ç»æ
|
| | | */
|
| | | protected AjaxResult toAjax(int rows)
|
| | | protected R<?> toAjax(int rows)
|
| | | {
|
| | | return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
| | | return rows > 0 ? R.ok() : R.fail();
|
| | | }
|
| | |
|
| | | /**
|
| | | * ååºè¿åç»æ
|
| | | * |
| | | *
|
| | | * @param result ç»æ
|
| | | * @return æä½ç»æ
|
| | | */
|
| | | protected AjaxResult toAjax(boolean result)
|
| | | protected R<?> toAjax(boolean result)
|
| | | {
|
| | | return result ? success() : error();
|
| | | }
|
| | |
| | | package com.ruoyi.home.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.dto.MapDto; |
| | | 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 com.ruoyi.home.annotation.DefaultType; |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import com.ruoyi.production.mapper.ProductionOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | public class HomeController extends BaseController { |
| | | |
| | | private final HomeService homeService; |
| | | private final ProductionOrderMapper productionOrderMapper; |
| | | private final ProductionProductOutputMapper productionProductOutputMapper; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | private static final Integer ORDER_STATUS_WAIT = 1; |
| | | private static final Integer ORDER_STATUS_RUNNING = 2; |
| | | private static final Integer ORDER_STATUS_COMPLETED = 3; |
| | | private static final Integer ORDER_STATUS_PAUSED = 4; |
| | | |
| | | /********************************************************åºç¡ç±»*****************************************************/ |
| | | @GetMapping("/todos") |
| | | @Log(title = "å¾
åäºé¡¹", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å¾
åäºé¡¹") |
| | | public AjaxResult todos(ApproveProcess req) throws ParseException { |
| | | public R todos() throws ParseException { |
| | | List<ApproveProcess> approveProcessList = homeService.todos(); |
| | | return AjaxResult.success(approveProcessList); |
| | | return R.ok(approveProcessList); |
| | | } |
| | | |
| | | @GetMapping("/approveAndDeviceTodos") |
| | | @Operation(summary = "审æ¹ååï¼è®¾å¤æ¥ä¿®å¾
åäºé¡¹") |
| | | public AjaxResult approveAndDeviceTodos(){ |
| | | public R approveAndDeviceTodos(){ |
| | | Map<String, Object> map = homeService.approveAndDeviceTodos(); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @GetMapping("/noticesCount") |
| | | @Operation(summary = "æªè¿æçå
¬åæ°é") |
| | | public AjaxResult noticesCount(){ |
| | | public R noticesCount(){ |
| | | Long count = homeService.noticesCount(); |
| | | return AjaxResult.success(count); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | @GetMapping("/deptStaffDistribution") |
| | | @Operation(summary = "åé¨é¨äººååå¸") |
| | | public AjaxResult deptStaffDistribution() { |
| | | public R deptStaffDistribution() { |
| | | DeptStaffDistributionDto dto = homeService.deptStaffDistribution(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/summaryStatistics") |
| | | @Operation(summary = "åå·¥-客æ·-ä¾åºåæ»æ°") |
| | | public AjaxResult summaryStatistics() { |
| | | public R summaryStatistics() { |
| | | HomeSummaryDto homeSummaryDto = homeService.summaryStatistics(); |
| | | return AjaxResult.success(homeSummaryDto); |
| | | return R.ok(homeSummaryDto); |
| | | } |
| | | |
| | | /********************************************************è¥ééè´ç±»**************************************************/ |
| | | @GetMapping("/supplierPurchaseRanking") |
| | | @Operation(summary = "ä¾åºåéè´æå") |
| | | public AjaxResult supplierPurchaseRanking(@DefaultType Integer type) { |
| | | public R supplierPurchaseRanking(@DefaultType Integer type) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/customerRevenueAnalysis") |
| | | @Operation(summary = "客æ·è¥æ¶è´¡ç®æ°å¼åæ") |
| | | public AjaxResult customerRevenueAnalysis(Long customerId, @DefaultType Integer type) { |
| | | public R customerRevenueAnalysis(Long customerId, @DefaultType Integer type) { |
| | | CustomerRevenueAnalysisDto dto = homeService.customerRevenueAnalysis(customerId, type); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/customerContributionRanking") |
| | | @Operation(summary = "客æ·éé¢è´¡ç®æå") |
| | | public AjaxResult customerContributionRanking(@DefaultType Integer type) { |
| | | public R customerContributionRanking(@DefaultType Integer type) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productSalesAnalysis") |
| | | @Operation(summary = "å产åéå®éé¢åæ") |
| | | public AjaxResult productSalesAnalysis() { |
| | | public R productSalesAnalysis() { |
| | | List<MapDto> list = homeService.productSalesAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/rawMaterialPurchaseAmountRatio") |
| | | @Operation(summary = "åææéè´éé¢å æ¯") |
| | | public AjaxResult rawMaterialPurchaseAmountRatio(){ |
| | | public R rawMaterialPurchaseAmountRatio(){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/business") |
| | | @Log(title = "éå®-éè´-åºåæ°æ®", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "éå®-éè´-åºåæ°æ®") |
| | | public AjaxResult business(HomeBusinessDto req) { |
| | | public R business() { |
| | | HomeBusinessDto homeBusinessDto = homeService.business(); |
| | | return AjaxResult.success(homeBusinessDto); |
| | | return R.ok(homeBusinessDto); |
| | | } |
| | | |
| | | @GetMapping("/analysisCustomerContractAmounts") |
| | | @Log(title = "客æ·ååéé¢åæ", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "客æ·ååéé¢åæ") |
| | | public AjaxResult analysisCustomerContractAmounts(AnalysisCustomerContractAmountsDto req) { |
| | | public R analysisCustomerContractAmounts() { |
| | | AnalysisCustomerContractAmountsDto analysisCustomerContractAmounts = homeService.analysisCustomerContractAmounts(); |
| | | return AjaxResult.success(analysisCustomerContractAmounts); |
| | | return R.ok(analysisCustomerContractAmounts); |
| | | } |
| | | |
| | | /********************************************************ç产类*****************************************************/ |
| | | @GetMapping("/inputOutputAnalysis") |
| | | @Operation(summary = "æå
¥äº§åºåæ") |
| | | public AjaxResult inputOutputAnalysis(@DefaultType Integer type){ |
| | | public R inputOutputAnalysis(@DefaultType Integer type){ |
| | | List<InputOutputAnalysisDto> list = homeService.inputOutputAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/processOutputAnalysis") |
| | | @Operation(summary = "å·¥åºäº§åºåæ") |
| | | public AjaxResult processOutputAnalysis(@DefaultType Integer type){ |
| | | public R processOutputAnalysis(@DefaultType Integer type){ |
| | | List<MapDto> list = homeService.processOutputAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/workOrderEfficiencyAnalysis") |
| | | @Operation(summary = "å·¥åæ§è¡æçåæ") |
| | | public AjaxResult workOrderEfficiencyAnalysis(@DefaultType Integer type){ |
| | | public R workOrderEfficiencyAnalysis(@DefaultType Integer type){ |
| | | List<WorkOrderEfficiencyDto> list = homeService.workOrderEfficiencyAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productionAccountingAnalysis") |
| | | @Operation(summary = "çäº§æ ¸ç®åæ") |
| | | public AjaxResult productionAccountingAnalysis(@DefaultType Integer type){ |
| | | public R productionAccountingAnalysis(@DefaultType Integer type){ |
| | | List<ProductionAccountingDto> list = homeService.productionAccountingAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/orderCount") |
| | | @Operation(summary = "è®¢åæ°") |
| | | public AjaxResult orderCount(){ |
| | | return AjaxResult.success(homeService.orderCount()); |
| | | public R orderCount(){ |
| | | return R.ok(homeService.orderCount()); |
| | | } |
| | | |
| | | @GetMapping("/progressStatistics") |
| | | @Operation(summary = "åç产订åç宿è¿åº¦ç»è®¡") |
| | | public AjaxResult progressStatistics(){ |
| | | public R progressStatistics(){ |
| | | ProductionProgressDto productionProgressDto = homeService.productionProgress(); |
| | | return AjaxResult.success(productionProgressDto); |
| | | return R.ok(productionProgressDto); |
| | | } |
| | | |
| | | @GetMapping("/workInProcessTurnover") |
| | | @Operation(summary = "å¨å¶åå¨è½¬æ
åµ") |
| | | public AjaxResult workInProcessTurnover(){ |
| | | public R workInProcessTurnover(){ |
| | | ProductionTurnoverDto productionTurnoverDto = homeService.workInProcessTurnover(); |
| | | return AjaxResult.success(productionTurnoverDto); |
| | | return R.ok(productionTurnoverDto); |
| | | } |
| | | |
| | | @GetMapping("/processDataProductionStatistics") |
| | | @Operation(summary = "å·¥åºæ°æ®ç产ç»è®¡æ°æ®") |
| | | public AjaxResult processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) { |
| | | public R processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) { |
| | | List<processDataProductionStatisticsDto> list = homeService.processDataProductionStatistics(type, processIds); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /********************************************************è´¨éç±»*****************************************************/ |
| | | @GetMapping("/productionOverview") |
| | | @Operation(summary = "Production Overview") |
| | | public R productionOverview() { |
| | | LocalDate today = LocalDate.now(); |
| | | Map<String, BigDecimal> totalStats = loadOutputStats(LocalDate.of(2000, 1, 1), today.plusDays(1)); |
| | | BigDecimal totalOutput = totalStats.get("quantity"); |
| | | BigDecimal totalScrap = totalStats.get("scrapQty"); |
| | | BigDecimal yieldRate = calcRate(totalOutput, totalOutput.add(totalScrap)); |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("totalOutput", scale(totalOutput)); |
| | | result.put("totalScrap", scale(totalScrap)); |
| | | result.put("yieldRate", scale(yieldRate)); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productionRealtimeBoard") |
| | | @Operation(summary = "Production Realtime Board") |
| | | public R productionRealtimeBoard() { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate yesterday = today.minusDays(1); |
| | | |
| | | BigDecimal todayDeviceOee = calcDeviceOee(today); |
| | | BigDecimal yesterdayDeviceOee = calcDeviceOee(yesterday); |
| | | |
| | | BigDecimal todayOrderAchievementRate = calcOrderAchievementRate(today); |
| | | BigDecimal yesterdayOrderAchievementRate = calcOrderAchievementRate(yesterday); |
| | | |
| | | BigDecimal todayDefectRate = calcDefectRate(today); |
| | | BigDecimal yesterdayDefectRate = calcDefectRate(yesterday); |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("deviceOee", buildRealtimeMetric(todayDeviceOee, todayDeviceOee.subtract(yesterdayDeviceOee))); |
| | | result.put("orderAchievementRate", buildRealtimeMetric(todayOrderAchievementRate, todayOrderAchievementRate.subtract(yesterdayOrderAchievementRate))); |
| | | result.put("defectRate", buildRealtimeMetric(todayDefectRate, todayDefectRate.subtract(yesterdayDefectRate))); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productionOrderProgress") |
| | | @Operation(summary = "Production Order Progress") |
| | | public R productionOrderProgress(@RequestParam(defaultValue = "all") String tab, |
| | | @RequestParam(required = false) String status, |
| | | @RequestParam(required = false) String bizDate, |
| | | @RequestParam(defaultValue = "1") Long pageNum, |
| | | @RequestParam(defaultValue = "10") Long pageSize) { |
| | | LocalDate queryDate = parseDateOrNull(bizDate); |
| | | if (!isBlank(bizDate) && queryDate == null) { |
| | | return R.fail("bizDateæ ¼å¼é误ï¼è¯·ä½¿ç¨yyyy-MM-dd"); |
| | | } |
| | | Integer statusFromParam = parseOrderStatus(status); |
| | | if (!isBlank(status) && statusFromParam == null && !"all".equalsIgnoreCase(status.trim())) { |
| | | return R.fail("statusåæ°ä¸åæ³ï¼å¯éå¼ï¼all/waiting/inProgress/completed/paused æ 1/2/3/4"); |
| | | } |
| | | Integer queryStatus = resolveOrderStatus(status, tab); |
| | | |
| | | long safePageNum = pageNum == null || pageNum < 1 ? 1 : pageNum; |
| | | long safePageSize = pageSize == null || pageSize < 1 ? 10 : Math.min(pageSize, 50); |
| | | long offset = (safePageNum - 1) * safePageSize; |
| | | LocalDateTime startTime = queryDate == null ? null : queryDate.atStartOfDay(); |
| | | LocalDateTime endTime = queryDate == null ? null : queryDate.plusDays(1).atStartOfDay(); |
| | | |
| | | List<Map<String, Object>> rawRows = productionOrderMapper.selectHomeOrderProgressPage(queryStatus, offset, safePageSize, startTime, endTime); |
| | | List<Map<String, Object>> records = new ArrayList<>(); |
| | | if (rawRows != null) { |
| | | for (Map<String, Object> rawRow : rawRows) { |
| | | records.add(buildOrderProgressRow(rawRow)); |
| | | } |
| | | } |
| | | |
| | | long waitingCount = 0L; |
| | | long inProgressCount = 0L; |
| | | long completedCount = 0L; |
| | | long pausedCount = 0L; |
| | | List<Map<String, Object>> statusCountRows = productionOrderMapper.countHomeOrderProgressByStatus(startTime, endTime); |
| | | if (statusCountRows != null) { |
| | | for (Map<String, Object> countRow : statusCountRows) { |
| | | Integer statusKey = toInteger(countRow.get("status")); |
| | | long cnt = toLong(countRow.get("cnt")); |
| | | if (Objects.equals(statusKey, ORDER_STATUS_WAIT)) { |
| | | waitingCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_RUNNING)) { |
| | | inProgressCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_COMPLETED)) { |
| | | completedCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_PAUSED)) { |
| | | pausedCount = cnt; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("tab", mapOrderTab(queryStatus)); |
| | | result.put("status", mapOrderStatus(queryStatus)); |
| | | result.put("bizDate", queryDate == null ? null : queryDate.format(DATE_FORMATTER)); |
| | | result.put("total", toLong(productionOrderMapper.countHomeOrderProgress(queryStatus, startTime, endTime))); |
| | | result.put("pageNum", safePageNum); |
| | | result.put("pageSize", safePageSize); |
| | | result.put("waitingCount", waitingCount); |
| | | result.put("inProgressCount", inProgressCount); |
| | | result.put("completedCount", completedCount); |
| | | result.put("pausedCount", pausedCount); |
| | | result.put("records", records); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/todayProductionPlan") |
| | | @Operation(summary = "Today Production Plan") |
| | | public R todayProductionPlan(@RequestParam(defaultValue = "4") Long limit, |
| | | @RequestParam(required = false) String planDate) { |
| | | LocalDate queryDate = parseDateOrNull(planDate); |
| | | if (!isBlank(planDate) && queryDate == null) { |
| | | return R.fail("planDateæ ¼å¼é误ï¼è¯·ä½¿ç¨yyyy-MM-dd"); |
| | | } |
| | | |
| | | long safeLimit = limit == null || limit < 1 ? 4 : Math.min(limit, 20); |
| | | LocalDateTime planStart = queryDate == null ? null : queryDate.atStartOfDay(); |
| | | LocalDateTime planEnd = queryDate == null ? null : queryDate.plusDays(1).atStartOfDay(); |
| | | List<Map<String, Object>> records = new ArrayList<>(); |
| | | List<Map<String, Object>> rawRows = productionOrderMapper.selectHomeTodayProductionPlan(safeLimit, planStart, planEnd); |
| | | if (rawRows != null) { |
| | | for (Map<String, Object> rawRow : rawRows) { |
| | | Map<String, Object> row = new LinkedHashMap<>(); |
| | | Integer rowStatus = toInteger(rawRow.get("status")); |
| | | row.put("orderNo", rawRow.get("orderNo")); |
| | | row.put("productName", rawRow.get("productName")); |
| | | row.put("plannedQuantity", scale(toBigDecimal(rawRow.get("plannedQuantity")))); |
| | | row.put("dueDate", rawRow.get("dueDate")); |
| | | row.put("status", rowStatus); |
| | | row.put("statusLabel", mapOrderStatusLabel(rowStatus)); |
| | | records.add(row); |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("planDate", queryDate == null ? null : queryDate.format(DATE_FORMATTER)); |
| | | result.put("total", toLong(productionOrderMapper.countHomeTodayProductionPlan(planStart, planEnd))); |
| | | result.put("records", records); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/rawMaterialDetection") |
| | | @Operation(summary = "åæææ£æµ") |
| | | public AjaxResult rawMaterialDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.rawMaterialDetection(type)); |
| | | public R rawMaterialDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.rawMaterialDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/processDetection") |
| | | @Operation(summary = "è¿ç¨æ£æµ") |
| | | public AjaxResult processDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.processDetection(type)); |
| | | public R processDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.processDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/factoryDetection") |
| | | @Operation(summary = "æååºåæ£æµ") |
| | | public AjaxResult factoryDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.factoryDetection(type)); |
| | | public R factoryDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.factoryDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/qualityInspectionCount") |
| | | @Operation(summary = "è´¨éæ£éªæ°é") |
| | | public AjaxResult qualityInspectionCount(){ |
| | | public R qualityInspectionCount(){ |
| | | QualityInspectionCountDto qualityInspectionCountDto = homeService.qualityInspectionCount(); |
| | | return AjaxResult.success(qualityInspectionCountDto); |
| | | return R.ok(qualityInspectionCountDto); |
| | | } |
| | | |
| | | @GetMapping("/nonComplianceWarning") |
| | | @Operation(summary = "ä¸åæ ¼é¢è¦") |
| | | public AjaxResult nonComplianceWarning(){ |
| | | public R nonComplianceWarning(){ |
| | | NonComplianceWarningDto nonComplianceWarningDto = homeService.nonComplianceWarning(); |
| | | return AjaxResult.success(nonComplianceWarningDto); |
| | | return R.ok(nonComplianceWarningDto); |
| | | } |
| | | |
| | | @GetMapping("/completedInspectionCount") |
| | | @Operation(summary = "宿æ£éªæ°") |
| | | public AjaxResult completedInspectionCount(){ |
| | | public R completedInspectionCount(){ |
| | | List<CompletedInspectionCountDto> list = homeService.completedInspectionCount(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/unqualifiedProductRanking") |
| | | @Operation(summary = "ä¸åæ ¼äº§åæå") |
| | | public AjaxResult unqualifiedProductRanking(){ |
| | | public R unqualifiedProductRanking(){ |
| | | List<UnqualifiedProductRankDto> list = homeService.unqualifiedProductRanking(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/unqualifiedProductProcessingAnalysis") |
| | | @Operation(summary = "ä¸åæ ¼æ£åå¤çåæ") |
| | | public AjaxResult unqualifiedProductProcessingAnalysis(){ |
| | | public R unqualifiedProductProcessingAnalysis(){ |
| | | List<MapDto> list = homeService.unqualifiedProductProcessingAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/qualityStatistics") |
| | | @Log(title = "è´¨éåæ", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¨éåæ") |
| | | public AjaxResult qualityStatistics(QualityStatisticsDto req) { |
| | | public R qualityStatistics() { |
| | | QualityStatisticsDto qualityStatisticsDto = homeService.qualityStatistics(); |
| | | return AjaxResult.success(qualityStatisticsDto); |
| | | return R.ok(qualityStatisticsDto); |
| | | } |
| | | |
| | | @GetMapping("/qualityInspectionStatistics") |
| | | @Operation(summary = "è´¨éç»è®¡") |
| | | public AjaxResult qualityInspectionStatistics(@DefaultType Integer type) { |
| | | public R qualityInspectionStatistics(@DefaultType Integer type) { |
| | | QualityStatisticsDto dto = homeService.qualityInspectionStatistics(type); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | /********************************************************è´¢å¡ç±»*****************************************************/ |
| | | @GetMapping("/incomeExpenseAnalysis") |
| | | @Operation(summary = "æ¯æ¶å¯¹æ¯åæ") |
| | | public AjaxResult incomeExpenseAnalysis(@DefaultType Integer type) { |
| | | public R incomeExpenseAnalysis(@DefaultType Integer type) { |
| | | List<Map<String, Object>> result = homeService.incomeExpenseAnalysis(type); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/profitTrendAnalysis") |
| | | @Operation(summary = "婿¶¦è¶å¿åæ") |
| | | public AjaxResult profitTrendAnalysis(){ |
| | | public R profitTrendAnalysis(){ |
| | | List<MapDto> list = homeService.profitTrendAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/expenseCompositionAnalysis") |
| | | @Operation(summary = "ææåæ") |
| | | public AjaxResult expenseCompositionAnalysis(@DefaultType Integer type) { |
| | | public R expenseCompositionAnalysis(@DefaultType Integer type) { |
| | | List<MapDto> list = homeService.expenseCompositionAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/monthlyIncome") |
| | | @Operation(summary = "æåº¦æ¶å
¥") |
| | | public AjaxResult monthlyIncome(){ |
| | | public R monthlyIncome(){ |
| | | MonthlyIncomeDto dto = homeService.monthlyIncome(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/monthlyExpenditure") |
| | | @Operation(summary = "æåº¦æ¯åº") |
| | | public AjaxResult monthlyExpenditure(){ |
| | | public R monthlyExpenditure(){ |
| | | MonthlyExpenditureDto dto = homeService.monthlyExpenditure(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/statisticsReceivablePayable") |
| | | @Log(title = "åºæ¶åºä»ç»è®¡", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "åºæ¶åºä»ç»è®¡") |
| | | public AjaxResult statisticsReceivablePayable(StatisticsReceivablePayableDto req, @DefaultType Integer type ) { |
| | | public R statisticsReceivablePayable(@DefaultType Integer type ) { |
| | | StatisticsReceivablePayableDto statisticsReceivablePayable = homeService.statisticsReceivablePayable(type); |
| | | return AjaxResult.success(statisticsReceivablePayable); |
| | | return R.ok(statisticsReceivablePayable); |
| | | } |
| | | |
| | | /********************************************************ä»å¨ç±»*****************************************************/ |
| | | |
| | | @GetMapping("/productCategoryDistribution") |
| | | @Operation(summary = "产å大类åå¸") |
| | | public AjaxResult productCategoryDistribution() { |
| | | public R productCategoryDistribution() { |
| | | ProductCategoryDistributionDto dto = homeService.productCategoryDistribution(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/salesPurchaseStorageProductCount") |
| | | @Operation(summary = "éå®-éè´-å¨åäº§åæ°") |
| | | public AjaxResult salesPurchaseStorageProductCount(){ |
| | | public R salesPurchaseStorageProductCount(){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productInOutAnalysis") |
| | | @Operation(summary = "产ååºå
¥åºåæ") |
| | | public AjaxResult productInOutAnalysis(@DefaultType Integer type){ |
| | | public R productInOutAnalysis(@DefaultType Integer type){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productTurnoverDays") |
| | | @Operation(summary = "产åå¨è½¬å¤©æ°") |
| | | public AjaxResult productTurnoverDays(){ |
| | | public R productTurnoverDays(){ |
| | | List<MapDto> list = homeService.productTurnoverDays(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | private Map<String, Object> buildOrderProgressRow(Map<String, Object> rawRow) { |
| | | Map<String, Object> row = new LinkedHashMap<>(); |
| | | Integer rowStatus = toInteger(rawRow.get("status")); |
| | | row.put("orderNo", rawRow.get("orderNo")); |
| | | row.put("productName", rawRow.get("productName")); |
| | | row.put("plannedQuantity", scale(toBigDecimal(rawRow.get("plannedQuantity")))); |
| | | row.put("completedQuantity", scale(toBigDecimal(rawRow.get("completedQuantity")))); |
| | | row.put("completionRate", scale(toBigDecimal(rawRow.get("completionRate")))); |
| | | row.put("dueDate", rawRow.get("dueDate")); |
| | | row.put("status", rowStatus); |
| | | row.put("statusLabel", mapOrderStatusLabel(rowStatus)); |
| | | return row; |
| | | } |
| | | |
| | | private Integer resolveOrderStatus(String status, String tab) { |
| | | if (!isBlank(status)) { |
| | | return parseOrderStatus(status); |
| | | } |
| | | return parseOrderStatus(tab); |
| | | } |
| | | |
| | | private Integer parseOrderStatus(String rawStatus) { |
| | | if (isBlank(rawStatus)) { |
| | | return null; |
| | | } |
| | | String normalized = rawStatus.trim().toLowerCase(); |
| | | if ("all".equals(normalized)) { |
| | | return null; |
| | | } |
| | | if ("1".equals(normalized) || "waiting".equals(normalized) || "wait".equals(normalized)) { |
| | | return ORDER_STATUS_WAIT; |
| | | } |
| | | if ("2".equals(normalized) || "inprogress".equals(normalized) || "running".equals(normalized)) { |
| | | return ORDER_STATUS_RUNNING; |
| | | } |
| | | if ("3".equals(normalized) || "completed".equals(normalized)) { |
| | | return ORDER_STATUS_COMPLETED; |
| | | } |
| | | if ("4".equals(normalized) || "paused".equals(normalized)) { |
| | | return ORDER_STATUS_PAUSED; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String mapOrderTab(Integer status) { |
| | | if (Objects.equals(status, ORDER_STATUS_RUNNING)) { |
| | | return "inProgress"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "completed"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "paused"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_WAIT)) { |
| | | return "waiting"; |
| | | } |
| | | return "all"; |
| | | } |
| | | |
| | | private String mapOrderStatus(Integer status) { |
| | | if (Objects.equals(status, ORDER_STATUS_WAIT)) { |
| | | return "waiting"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_RUNNING)) { |
| | | return "inProgress"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "completed"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "paused"; |
| | | } |
| | | return "all"; |
| | | } |
| | | |
| | | private String mapOrderStatusLabel(Integer status) { |
| | | if (Objects.equals(status, ORDER_STATUS_WAIT)) { |
| | | return "å¾
å¼å§"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_RUNNING)) { |
| | | return "è¿è¡ä¸"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "已宿"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "å·²æå"; |
| | | } |
| | | return "æªç¥"; |
| | | } |
| | | |
| | | private Map<String, BigDecimal> loadOutputStats(LocalDate startDate, LocalDate endDateExclusive) { |
| | | String start = startDate.atStartOfDay().format(DATE_TIME_FORMATTER); |
| | | String end = endDateExclusive.atStartOfDay().format(DATE_TIME_FORMATTER); |
| | | |
| | | BigDecimal quantity = BigDecimal.ZERO; |
| | | BigDecimal scrapQty = BigDecimal.ZERO; |
| | | List<Map<String, Object>> rows = productionProductOutputMapper.selectDailyOutputStats(start, end); |
| | | if (rows != null) { |
| | | for (Map<String, Object> row : rows) { |
| | | quantity = quantity.add(toBigDecimal(row.get("quantity"))); |
| | | scrapQty = scrapQty.add(toBigDecimal(row.get("scrapQty"))); |
| | | } |
| | | } |
| | | |
| | | Map<String, BigDecimal> stats = new LinkedHashMap<>(); |
| | | stats.put("quantity", quantity); |
| | | stats.put("scrapQty", scrapQty); |
| | | return stats; |
| | | } |
| | | |
| | | private BigDecimal calcDeviceOee(LocalDate day) { |
| | | long totalDeviceCount = deviceLedgerMapper.selectCount(new LambdaQueryWrapper<>()); |
| | | if (totalDeviceCount <= 0) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | Date start = Date.from(day.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | Date end = Date.from(day.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | List<DeviceRepair> repairList = deviceRepairMapper.selectList(new LambdaQueryWrapper<DeviceRepair>() |
| | | .select(DeviceRepair::getDeviceLedgerId) |
| | | .ge(DeviceRepair::getRepairTime, start) |
| | | .lt(DeviceRepair::getRepairTime, end) |
| | | .in(DeviceRepair::getStatus, 0, 3)); |
| | | |
| | | long repairingDeviceCount = repairList == null ? 0 : repairList.stream() |
| | | .map(DeviceRepair::getDeviceLedgerId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .count(); |
| | | |
| | | long availableDeviceCount = Math.max(totalDeviceCount - repairingDeviceCount, 0); |
| | | return new BigDecimal(availableDeviceCount) |
| | | .multiply(new BigDecimal("100")) |
| | | .divide(new BigDecimal(totalDeviceCount), 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private BigDecimal calcOrderAchievementRate(LocalDate day) { |
| | | List<ProductionOrder> orderList = productionOrderMapper.selectList(new LambdaQueryWrapper<ProductionOrder>() |
| | | .select(ProductionOrder::getQuantity, ProductionOrder::getCompleteQuantity) |
| | | .ge(ProductionOrder::getCreateTime, day.atStartOfDay()) |
| | | .lt(ProductionOrder::getCreateTime, day.plusDays(1).atStartOfDay()) |
| | | .ne(ProductionOrder::getStatus, ORDER_STATUS_PAUSED)); |
| | | |
| | | BigDecimal totalQuantity = BigDecimal.ZERO; |
| | | BigDecimal totalCompleteQuantity = BigDecimal.ZERO; |
| | | if (orderList != null) { |
| | | for (ProductionOrder order : orderList) { |
| | | totalQuantity = totalQuantity.add(zeroIfNull(order.getQuantity())); |
| | | totalCompleteQuantity = totalCompleteQuantity.add(zeroIfNull(order.getCompleteQuantity())); |
| | | } |
| | | } |
| | | return calcRate(totalCompleteQuantity, totalQuantity); |
| | | } |
| | | |
| | | private BigDecimal calcDefectRate(LocalDate day) { |
| | | Map<String, BigDecimal> stats = loadOutputStats(day, day.plusDays(1)); |
| | | BigDecimal quantity = stats.get("quantity"); |
| | | BigDecimal scrapQty = stats.get("scrapQty"); |
| | | return calcRate(scrapQty, quantity.add(scrapQty)); |
| | | } |
| | | |
| | | private Map<String, Object> buildRealtimeMetric(BigDecimal value, BigDecimal change) { |
| | | Map<String, Object> metric = new LinkedHashMap<>(); |
| | | metric.put("value", scale(value)); |
| | | metric.put("compareYesterday", scale(change)); |
| | | return metric; |
| | | } |
| | | |
| | | private BigDecimal calcRate(BigDecimal numerator, BigDecimal denominator) { |
| | | if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return zeroIfNull(numerator) |
| | | .multiply(new BigDecimal("100")) |
| | | .divide(denominator, 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private BigDecimal toBigDecimal(Object value) { |
| | | if (value == null) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | if (value instanceof BigDecimal) { |
| | | return (BigDecimal) value; |
| | | } |
| | | if (value instanceof Number) { |
| | | return BigDecimal.valueOf(((Number) value).doubleValue()); |
| | | } |
| | | try { |
| | | return new BigDecimal(String.valueOf(value)); |
| | | } catch (Exception ex) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | private Integer toInteger(Object value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | if (value instanceof Integer) { |
| | | return (Integer) value; |
| | | } |
| | | if (value instanceof Number) { |
| | | return ((Number) value).intValue(); |
| | | } |
| | | try { |
| | | return Integer.valueOf(String.valueOf(value)); |
| | | } catch (Exception ex) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private long toLong(Object value) { |
| | | if (value == null) { |
| | | return 0L; |
| | | } |
| | | if (value instanceof Long) { |
| | | return (Long) value; |
| | | } |
| | | if (value instanceof Number) { |
| | | return ((Number) value).longValue(); |
| | | } |
| | | try { |
| | | return Long.parseLong(String.valueOf(value)); |
| | | } catch (Exception ex) { |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | private LocalDate parseDateOrNull(String rawDate) { |
| | | if (isBlank(rawDate)) { |
| | | return null; |
| | | } |
| | | try { |
| | | return LocalDate.parse(rawDate.trim(), DATE_FORMATTER); |
| | | } catch (DateTimeParseException ex) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private boolean isBlank(String value) { |
| | | return value == null || value.trim().isEmpty(); |
| | | } |
| | | |
| | | private BigDecimal zeroIfNull(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private BigDecimal scale(BigDecimal value) { |
| | | return zeroIfNull(value).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 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 AjaxResult listPage(Page page, LaborIssue laborIssue){ |
| | | public R<?> listPage(Page page, LaborIssue laborIssue){ |
| | | IPage<LaborIssue> listPage = laborIssueService.listPage(page, laborIssue); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/statisticsList") |
| | | @Log(title = "å³ä¿åæ¾-ç»è®¡æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å³ä¿åæ¾-ç»è®¡æ¥è¯¢") |
| | | public AjaxResult statisticsList(LaborIssue laborIssue){ |
| | | public R<?> statisticsList(LaborIssue laborIssue){ |
| | | List<Map<String, Object>> listPage = laborIssueService.statisticsList(laborIssue); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "å³ä¿åæ¾-æ·»å ", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "å³ä¿åæ¾-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody LaborIssue laborIssue){ |
| | | public R<?> 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 ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "å³ä¿åæ¾-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "å³ä¿åæ¾-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody LaborIssue laborIssue){ |
| | | public R<?> update(@RequestBody LaborIssue laborIssue){ |
| | | boolean update = laborIssueService.updateById(laborIssue); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "å³ä¿åæ¾-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å³ä¿åæ¾-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | boolean delete = laborIssueService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @GetMapping("/statistics") |
| | | @Operation(summary = "å³ä¿åæ¾-ç»è®¡") |
| | | public AjaxResult statistics(StatisticsLaborIssue req) throws Exception { |
| | | public R<?> statistics(StatisticsLaborIssue req) throws Exception { |
| | | StatisticsLaborIssue statisticsLaborIssue = laborIssueService.statistics(req); |
| | | return AjaxResult.success(statisticsLaborIssue); |
| | | return R.ok(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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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 AjaxResult listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public R<?> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | IPage<MeasuringInstrumentLedger> listPage = measuringInstrumentLedgerService.listPage(page, measuringInstrumentLedger); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | |
| | |
| | | @Operation(summary = "计éå¨å
·å°è´¦-æ°å¢") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ°å¢", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | public R<?> add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | boolean save = measuringInstrumentLedgerService.add(measuringInstrumentLedger); |
| | | if (save) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-ä¿®æ¹") |
| | | @Log(title = "计éå¨å
·å°è´¦-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public R<?> update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | if (sysUser == null) { |
| | | return AjaxResult.error("ç¨æ·ä¸åå¨"); |
| | | return R.fail("ç¨æ·ä¸åå¨"); |
| | | } |
| | | measuringInstrumentLedger.setUserName(sysUser.getUserName()); |
| | | boolean update = measuringInstrumentLedgerService.updateById(measuringInstrumentLedger); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-å é¤") |
| | | @Log(title = "计éå¨å
·å°è´¦-å é¤", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | 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 AjaxResult.error("请å
å é¤éä¸è®¡éå¨å
·å°è´¦ä¸çæææ£å®è®°å½"); |
| | | return R.fail("请å
å é¤éä¸è®¡éå¨å
·å°è´¦ä¸çæææ£å®è®°å½"); |
| | | } |
| | | } |
| | | boolean delete = measuringInstrumentLedgerService.removeBatchByIds(ids); |
| | | if (delete) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/verifying") |
| | | @Operation(summary = "计éå¨å
·å°è´¦-æ£å®") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ£å®", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | public R<?> verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | boolean update = measuringInstrumentLedgerService.verifying(measuringInstrumentLedger); |
| | | return update ? AjaxResult.success("æ£å®æå") : AjaxResult.error("æ£å®å¤±è´¥"); |
| | | return update ? R.ok(null, "æ£å®æå") : R.fail("æ£å®å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerRecordService; |
| | | import io.jsonwebtoken.lang.Collections; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "计éå¨å
·å°è´¦è®°å½-å页æ¥è¯¢") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord){ |
| | | public R<?> listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord){ |
| | | IPage<MeasuringInstrumentLedgerRecord> listPage = measuringInstrumentLedgerRecordService.listPage(page, measuringInstrumentLedgerRecord); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "计éå¨å
·å°è´¦è®°å½-ä¿®æ¹") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | public R<?> update(@RequestBody MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | boolean update = measuringInstrumentLedgerRecordService.updateMeasuringInstrumentLedgerRecord(measuringInstrumentLedgerRecord); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "计éå¨å
·å°è´¦è®°å½-å é¤") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(Collections.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return AjaxResult.success(measuringInstrumentLedgerRecordService.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(Collections.isEmpty(ids)) return R.fail("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return R.ok(measuringInstrumentLedgerRecordService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsService; |
| | |
| | | @RequestMapping("/spareParts") |
| | | @Tag(name = "å¤ä»¶åç±»æ¥å£") |
| | | @AllArgsConstructor |
| | | public class SparePartsController { |
| | | public class SparePartsController extends BaseController { |
| | | private SparePartsService sparePartsService; |
| | | @GetMapping("/getTree") |
| | | @Operation(summary = "å¤ä»¶åç±»-æ ç»æ") |
| | | public AjaxResult getTree(){ |
| | | public R<?> getTree(){ |
| | | List<SparePartsDto> tree = sparePartsService.getTree(); |
| | | return AjaxResult.success(tree); |
| | | return R.ok(tree); |
| | | } |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å¤ä»¶åç±»-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SpareParts spareParts){ |
| | | public R<?> listPage(Page page, SpareParts spareParts){ |
| | | IPage<SparePartsDto> listPage = sparePartsService.listPage(page, spareParts); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | // @GetMapping("/list") |
| | | // @Operation(summary = "å¤ä»¶åç±»-æ¥è¯¢ææ") |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "å¤ä»¶åç±»-æ·»å ") |
| | | @Log(title = "å¤ä»¶åç±»-æ·»å ", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.save(spareParts)); |
| | | public R<?> add(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.save(spareParts)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "å¤ä»¶åç±»-æ´æ°") |
| | | @Log(title = "å¤ä»¶åç±»-æ´æ°", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.updateById(spareParts)); |
| | | public R<?> update(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.updateById(spareParts)); |
| | | } |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "å¤ä»¶åç±»-å é¤") |
| | | @Log(title = "å¤ä»¶åç±»-å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@PathVariable Long id){ |
| | | return AjaxResult.success(sparePartsService.removeById(id)); |
| | | public R<?> delete(@PathVariable Long id){ |
| | | return R.ok(sparePartsService.removeById(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RequestMapping("/sparePartsRequisitionRecord") |
| | | @Tag(name = "å¤ä»¶é¢ç¨è®°å½æ¥å£") |
| | | @AllArgsConstructor |
| | | public class SparePartsRequisitionRecordController { |
| | | public class SparePartsRequisitionRecordController extends BaseController { |
| | | private SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å¤ä»¶åç±»-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | public R<?> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | IPage<SparePartsRequisitionRecordDto> listPage = sparePartsRequisitionRecordService.listPage(page, sparePartsRequisitionRecordDto); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "åå
¬ç©èµ-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | public R<?> listPage(Page page, OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.listPage(page, officeSupplies); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "åå
¬ç©èµ-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody OfficeSupplies officeSupplies) { |
| | | public R<?> add(@RequestBody OfficeSupplies officeSupplies) { |
| | | // æç
§å½åæ¶é´yyyyMMdd + å½å¤©æ°å¢æ°é + 1çæç¼å· |
| | | // è·åå½å¤©æ°å¢æ°é |
| | | long count = officeSuppliesService.count(new LambdaQueryWrapper<OfficeSupplies>() |
| | |
| | | officeSupplies.setCode(code); |
| | | officeSupplies.setStatus(1); |
| | | officeSupplies.setApplyTime(new Date()); |
| | | return officeSuppliesService.save(officeSupplies) ? success() : error(); |
| | | return officeSuppliesService.save(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "åå
¬ç©èµ-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? success() : error(); |
| | | public R<?> update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "åå
¬ç©èµ-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? success() : error(); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | |
| | | /** |
| | |
| | | * @param officeSupplies |
| | | * @return |
| | | */ |
| | | AjaxResult listPage(Page page, OfficeSupplies officeSupplies); |
| | | R<?> listPage(Page page, OfficeSupplies officeSupplies); |
| | | } |
| | |
| | | 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.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.mapper.OfficeSuppliesMapper; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | |
| | | private final OfficeSuppliesMapper officeSuppliesMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | public R<?> listPage(Page page, OfficeSupplies officeSupplies) { |
| | | IPage<OfficeSupplies> list = officeSuppliesMapper.listPage(page, officeSupplies); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.GasTankWarning; |
| | | import com.ruoyi.procurementrecord.service.GasTankWarningService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/gasTankWarning") |
| | | @AllArgsConstructor |
| | | public class GasTankWarningController { |
| | | public class GasTankWarningController extends BaseController { |
| | | private GasTankWarningService gasTankWarningService; |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.listPage(page, gasTankWarning)); |
| | | public R<?> listPage(Page page, GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.listPage(page, gasTankWarning)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.save(gasTankWarning)); |
| | | public R<?> add(@RequestBody GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.save(gasTankWarning)); |
| | | } |
| | | |
| | | @PostMapping("update") |
| | | public AjaxResult update(@RequestBody GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.updateById(gasTankWarning)); |
| | | public R<?> update(@RequestBody GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.updateById(gasTankWarning)); |
| | | } |
| | | |
| | | @DeleteMapping("delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(gasTankWarningService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(gasTankWarningService.removeByIds(ids)); |
| | | } |
| | | |
| | | //å¯¼åº |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.InboundManagement; |
| | | import com.ruoyi.procurementrecord.service.InboundManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å°è´§ç®¡ç-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, InboundManagement inboundManagement) { |
| | | public R<?> listPage(Page page, InboundManagement inboundManagement) { |
| | | IPage<InboundManagement> result = inboundManagementService.listPage(page, inboundManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "å°è´§ç®¡ç-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody InboundManagement inboundManagement) { |
| | | public R<?> add(@RequestBody InboundManagement inboundManagement) { |
| | | inboundManagement.setArrivalTime(new Date()); |
| | | boolean result = inboundManagementService.save(inboundManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "å°è´§ç®¡ç-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody InboundManagement inboundManagement) { |
| | | public R<?> update(@RequestBody InboundManagement inboundManagement) { |
| | | boolean result = inboundManagementService.updateById(inboundManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "å°è´§ç®¡ç-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult del(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> del(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | boolean result = inboundManagementService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @PostMapping("/add") |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.insert(procurementExceptionRecord)); |
| | | public R<?> add(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return R.ok(procurementExceptionRecordMapper.insert(procurementExceptionRecord)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Transactional |
| | | public AjaxResult updatePro(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.updateById(procurementExceptionRecord)); |
| | | public R<?> updatePro(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return R.ok(procurementExceptionRecordMapper.updateById(procurementExceptionRecord)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementPlan; |
| | | import com.ruoyi.procurementrecord.service.ProcurementPlanService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @RequestMapping("/listPage") |
| | | @Operation(summary = "éè´è®¡å-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProcurementPlan procurementPlan){ |
| | | public R<?> listPage(Page page, ProcurementPlan procurementPlan){ |
| | | IPage<ProcurementPlan> result = procurementPlanService.listPage(page, procurementPlan); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "éè´è®¡å-æ·»å ") |
| | | public AjaxResult add(@RequestBody ProcurementPlan procurementPlan){ |
| | | public R<?> add(@RequestBody ProcurementPlan procurementPlan){ |
| | | boolean result = procurementPlanService.save(procurementPlan); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "éè´è®¡å-ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody ProcurementPlan procurementPlan){ |
| | | public R<?> update(@RequestBody ProcurementPlan procurementPlan){ |
| | | boolean result = procurementPlanService.updateById(procurementPlan); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "éè´è®¡å-å é¤") |
| | | public AjaxResult del(@RequestBody List<Long> ids){ |
| | | public R<?> del(@RequestBody List<Long> ids){ |
| | | boolean result = procurementPlanService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementPriceManagement; |
| | | import com.ruoyi.procurementrecord.service.ProcurementPriceManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "éè´ä»·æ ¼ç®¡ç-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> listPage(Page page, ProcurementPriceManagement procurementPriceManagement){ |
| | | IPage<ProcurementPriceManagement> result = procurementPriceManagementService.listPage(page, procurementPriceManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "éè´ä»·æ ¼ç®¡ç-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> add(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | boolean result = procurementPriceManagementService.save(procurementPriceManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "éè´ä»·æ ¼ç®¡ç-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> update(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | boolean result = procurementPriceManagementService.updateById(procurementPriceManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "éè´ä»·æ ¼ç®¡ç-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (ids == null || ids.isEmpty()) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | boolean result = procurementPriceManagementService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | |
| | | */ |
| | | @GetMapping("/getProcurementAmount") |
| | | @Operation(summary = "éè¿éå®äº§åidè·åå
¥åºæ°é") |
| | | public AjaxResult getProcurementAmount(@RequestParam("salesProductId") Long salesProductId) { |
| | | return AjaxResult.success(procurementRecordService.getProcurementAmount(salesProductId)); |
| | | public R<?> getProcurementAmount(@RequestParam("salesProductId") Long salesProductId) { |
| | | return R.ok(procurementRecordService.getProcurementAmount(salesProductId)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/productlist") |
| | | @Log(title = "éè´å
¥åº-å
¥åºç®¡ç-æ°å¢å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(ProcurementDto procurementDto) { |
| | | public R<?> list(ProcurementDto procurementDto) { |
| | | List<ProcurementDto> result = procurementRecordService.listProcurementBySalesLedgerId(procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "éè´å
¥åº-å
¥åºç®¡ç-æ°å¢å
¥åº", businessType = BusinessType.INSERT) |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody ProcurementAddDto procurementDto) { |
| | | public R<?> add(@RequestBody ProcurementAddDto procurementDto) { |
| | | procurementDto.setType(1); |
| | | procurementDto.setTypeName("éè´å
¥åº"); |
| | | return AjaxResult.success(procurementRecordService.add(procurementDto)); |
| | | return R.ok(procurementRecordService.add(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/addCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-å
¥åºç®¡ç-æ°å¢å
¥åº", businessType = BusinessType.INSERT) |
| | | @Transactional |
| | | public AjaxResult addCustom(@RequestBody List<CustomStorage> customStorage) { |
| | | public R<?> addCustom(@RequestBody List<CustomStorage> customStorage) { |
| | | return procurementRecordService.addCustom(customStorage); |
| | | } |
| | | |
| | | @PostMapping("/updateCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-å
¥åºç®¡ç-ä¿®æ¹å
¥åº", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateCustom(@RequestBody CustomStorage customStorage) { |
| | | public R<?> updateCustom(@RequestBody CustomStorage customStorage) { |
| | | return procurementRecordService.updateCustom(customStorage); |
| | | } |
| | | |
| | | @Delete("/delteCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-å
¥åºç®¡ç-å é¤å
¥åº", businessType = BusinessType.DELETE) |
| | | @Transactional |
| | | public AjaxResult deleteCustom(@RequestBody List<Long> ids) { |
| | | public R<?> deleteCustom(@RequestBody List<Long> ids) { |
| | | return procurementRecordService.deleteCustom(ids); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "éè´å
¥åº-å
¥åºç®¡ç-ä¿®æ¹å
¥åº", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updatePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updatePro(procurementDto)); |
| | | public R<?> updatePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updatePro(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/updateManagement") |
| | | @Log(title = "æåå
¥åº-åºåå°è´¦-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateManagement(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updateManagement(procurementDto)); |
| | | public R<?> updateManagement(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updateManagement(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/updateManagementByCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-åºåå°è´¦-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateManagementByCustom(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updateManagementByCustom(procurementDto)); |
| | | public R<?> updateManagementByCustom(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updateManagementByCustom(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/del") |
| | | @Log(title = "éè´å
¥åº-å
¥åºç®¡ç-å é¤å
¥åº", businessType = BusinessType.DELETE) |
| | | @Transactional |
| | | public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.deletePro(procurementDto)); |
| | | public R<?> deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.deletePro(procurementDto)); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "éè´å
¥åº-å
¥åºç®¡ç-å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å
¥åºæ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPage(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listReport") |
| | | @Operation(summary = "æ¥è¯¢åºåå¾è¡¨æ°æ®") |
| | | public AjaxResult listReport() { |
| | | return AjaxResult.success(procurementRecordService.getReportList()); |
| | | public R<?> listReport() { |
| | | return R.ok(procurementRecordService.getReportList()); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProduction") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å
¥åºæ¥è¯¢") |
| | | public AjaxResult listPageByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPageByProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProductProduction") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-ç产å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å
¥åºæ¥è¯¢") |
| | | public AjaxResult listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPageByProductProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-å
¥åºç®¡ç-å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å
¥åºæ¥è¯¢") |
| | | public AjaxResult listPageByCustom(Page page, CustomStorage customStorage) { |
| | | public R<?> listPageByCustom(Page page, CustomStorage customStorage) { |
| | | IPage<CustomStorage> result = procurementRecordService.listPageByCustom(page, customStorage); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopy") |
| | | @Log(title = "éè´å
¥åº-åºå管ç-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopy(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageCopy(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopy(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopyByProduction") |
| | | @Log(title = "ç产å
¥åº-åºå管ç-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopyByCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-åºå管ç-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | public R<?> listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | IPage<CustomStorage> result = procurementRecordService.listPageCopyByCustom(page, customStorage); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/getReportList") |
| | | @Log(title = "åºåæ¥è¡¨æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult getReportList(Page page, ProcurementPageDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.getReportList(page, procurementDto)); |
| | | public R<?> getReportList(Page page, ProcurementPageDto procurementDto) { |
| | | return R.ok(procurementRecordService.getReportList(page, procurementDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/listPageProductionStock") |
| | | @Log(title = "åºå管ç-æååºå", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageProductionStock(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageProductionStock(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProductModel> result = procurementRecordService.listPageProductionStock(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | } |
| | |
| | | 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 com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto; |
| | |
| | | |
| | | @PostMapping("/stockout") |
| | | @Log(title = "éè´åºåº-åºåºç®¡ç-åºåº", businessType = BusinessType.INSERT) |
| | | public AjaxResult stockout(@RequestBody ProcurementRecordOutAdd procurementRecordOutAdd) { |
| | | return AjaxResult.success(procurementRecordOutService.stockout(procurementRecordOutAdd)); |
| | | public R<?> stockout(@RequestBody ProcurementRecordOutAdd procurementRecordOutAdd) { |
| | | return R.ok(procurementRecordOutService.stockout(procurementRecordOutAdd)); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "éè´åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPage(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProduct") |
| | | @Log(title = "ç产åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageBySemiProduct") |
| | | @Log(title = "ç产åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageBySemiProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "èªå®ä¹åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByCustom(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/del") |
| | | @Log(title = "éè´åºåº-åºåºå°è´¦-å é¤åºåº", businessType = BusinessType.DELETE) |
| | | public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordOutService.deletePro(procurementDto)); |
| | | public R<?> deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordOutService.deletePro(procurementDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "éå®éè´§-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ReturnManagementDto returnManagement) { |
| | | public R<?> listPage(Page page, ReturnManagementDto returnManagement) { |
| | | IPage<ReturnManagementDto> result = returnManagementService.listPage(page, returnManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "éå®éè´§-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.addReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | public R<?> add(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.addReturnManagementDto(returnManagementDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "éå®éè´§-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.updateReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | public R<?> update(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.updateReturnManagementDto(returnManagementDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @Operation(summary = "éå®éè´§-å¤çéè´§å") |
| | | @GetMapping("/handle") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult handle(Long returnManagementId) { |
| | | return returnManagementService.handle(returnManagementId) ? success() : error(); |
| | | public R<?> handle(Long returnManagementId) { |
| | | return returnManagementService.handle(returnManagementId) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "éå®éè´§-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult del(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | public R<?> del(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | returnSaleProductService.remove(new QueryWrapper<ReturnSaleProduct>() |
| | | .lambda() |
| | | .in(ReturnSaleProduct::getReturnManagementId, ids)); |
| | | boolean result = returnManagementService.removeByIds(ids); |
| | | return result ? success() : error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @GetMapping("/getById") |
| | | @Operation(summary = "éå®éè´§-æ ¹æ®idæ¥è¯¢") |
| | | public AjaxResult getById(Long returnManagementId) { |
| | | public R<?> getById(Long returnManagementId) { |
| | | ReturnManagementDto returnManagementDto = returnManagementService.getReturnManagementDtoById(returnManagementId); |
| | | return success(returnManagementDto); |
| | | return R.ok(returnManagementDto); |
| | | } |
| | | |
| | | @GetMapping("/getByShippingId") |
| | | @Operation(summary = "éå®éè´§-æ ¹æ®åè´§åæ¥è¯¢éå®è®¢å以ååºåºç产åä¿¡æ¯") |
| | | public AjaxResult getByShippingId(Long shippingId) { |
| | | public R<?> getByShippingId(Long shippingId) { |
| | | ShippingInfoVo shippingInfoVo = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(shippingInfoVo); |
| | | return R.ok(shippingInfoVo); |
| | | } |
| | | |
| | | } |
| | |
| | | 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.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.SalesReturnVo; |
| | | import com.ruoyi.account.bean.dto.sales.SalesReturnDto; |
| | | import com.ruoyi.account.bean.vo.sales.SalesReturnVo; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | |
| | | |
| | | IPage<ProcurementPageDto> listPageByProduction(Page page, ProcurementPageDto procurementDto); |
| | | |
| | | AjaxResult addCustom(List<CustomStorage> customStorage); |
| | | R<?> addCustom(List<CustomStorage> customStorage); |
| | | |
| | | IPage<CustomStorage> listPageByCustom(Page page, CustomStorage customStorage); |
| | | |
| | |
| | | |
| | | IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage); |
| | | |
| | | AjaxResult updateCustom(CustomStorage customStorage); |
| | | R<?> updateCustom(CustomStorage customStorage); |
| | | |
| | | AjaxResult deleteCustom(List<Long> ids); |
| | | R<?> deleteCustom(List<Long> ids); |
| | | |
| | | int updateManagementByCustom(ProcurementManagementUpdateDto procurementDto); |
| | | |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | |
| | | private final CustomStorageMapper customStorageMapper; |
| | | |
| | | @Override |
| | | public AjaxResult addCustom(List<CustomStorage> customStorage) { |
| | | public R<?> addCustom(List<CustomStorage> customStorage) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if(CollectionUtils.isEmpty(customStorage)){ |
| | | return AjaxResult.error("æ°æ®ä¸è½ä¸ºç©º"); |
| | | return R.fail("æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | customStorage.forEach(item -> { |
| | | // æ¥è¯¢éè´å
¥åºæ°é |
| | |
| | | item.setCode(OrderUtils.countTodayByCreateTime(customStorageMapper, "", "code")); |
| | | customStorageMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success("èªå®ä¹å
¥åºæå"); |
| | | return R.ok(null, "èªå®ä¹å
¥åºæå"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateCustom(CustomStorage customStorage) { |
| | | return AjaxResult.success(customStorageMapper.updateById(customStorage)); |
| | | public R<?> updateCustom(CustomStorage customStorage) { |
| | | return R.ok(customStorageMapper.updateById(customStorage)); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteCustom(List<Long> ids) { |
| | | return AjaxResult.success(customStorageMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteCustom(List<Long> ids) { |
| | | return R.ok(customStorageMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | @Schema(description = "æ¯å¦ç产") |
| | | private Integer isProduction; |
| | | } |
| | |
| | | @PostMapping("/updateRouteItem") |
| | | @Operation(summary = "ä¿®æ¹ç产订åçå·¥èºè·¯çº¿è¯¦æ
") |
| | | public R updateRouteItem(@RequestBody ProductionOrderRoutingOperation productionOrderRoutingOperation) { |
| | | return R.ok(productionOrderRoutingOperationService.updateById(productionOrderRoutingOperation)); |
| | | return R.ok(productionOrderRoutingOperationService.updateRouteItem(productionOrderRoutingOperation)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteRouteItem/{id}") |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | Integer countPending(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<Map<String, Object>> selectHomeOrderProgressPage(@Param("status") Integer status, |
| | | @Param("offset") Long offset, |
| | | @Param("size") Long size, |
| | | @Param("startTime") LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime); |
| | | |
| | | Long countHomeOrderProgress(@Param("status") Integer status, |
| | | @Param("startTime") LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime); |
| | | |
| | | List<Map<String, Object>> countHomeOrderProgressByStatus(@Param("startTime") LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime); |
| | | |
| | | List<Map<String, Object>> selectHomeTodayProductionPlan(@Param("size") Long size, |
| | | @Param("planStart") LocalDateTime planStart, |
| | | @Param("planEnd") LocalDateTime planEnd); |
| | | |
| | | Long countHomeTodayProductionPlan(@Param("planStart") LocalDateTime planStart, |
| | | @Param("planEnd") LocalDateTime planEnd); |
| | | |
| | | } |
| | |
| | | |
| | | R addRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation); |
| | | |
| | | R updateRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation); |
| | | |
| | | R deleteRouteItem(Long id); |
| | | |
| | | int sortRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation); |
| | |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.service.ProductionBomStructureService; |
| | | import com.ruoyi.production.util.TaskPlanQuantityUtil; |
| | | import com.ruoyi.technology.mapper.TechnologyOperationMapper; |
| | | import com.ruoyi.technology.mapper.TechnologyOperationParamMapper; |
| | | import com.ruoyi.technology.mapper.TechnologyParamMapper; |
| | |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(ProductionOrderRoutingOperation::getId, item -> item, (left, right) -> left)); |
| | | // Keep task plan quantities aligned with the same order BOM snapshot demand used during snapshot creation. |
| | | Map<String, BigDecimal> demandedQuantityMap = buildOperationDemandedQuantityMap(structureList, rootProductModelId); |
| | | Map<String, BigDecimal> demandedQuantityMap = TaskPlanQuantityUtil.buildOperationDemandedQuantityMap(structureList, rootProductModelId); |
| | | for (ProductionOperationTask task : taskList) { |
| | | if (task == null || task.getId() == null || task.getProductionOrderRoutingOperationId() == null) { |
| | | continue; |
| | |
| | | ProductionOrderBom orderBom, |
| | | List<ProductionBomStructure> structureList, |
| | | Long rootProductModelId) { |
| | | // éæ°æ¥è¯¢BOMç»æï¼æåèç¹ä¼å
æåº |
| | | List<ProductionBomStructure> routingStructureList = this.list( |
| | | Wrappers.<ProductionBomStructure>lambdaQuery() |
| | | .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId()) |
| | | .orderByDesc(ProductionBomStructure::getParentId) |
| | | .orderByAsc(ProductionBomStructure::getId)); |
| | | |
| | | ProductionOrderRouting orderRouting = getOrCreateOrderRoutingSnapshot(productionOrderId, productionOrder, orderBom, rootProductModelId); |
| | | List<ProductionOrderRoutingOperation> desiredOperationList = buildDesiredRoutingOperationList(structureList, rootProductModelId); |
| | | List<ProductionOrderRoutingOperation> desiredOperationList = buildDesiredRoutingOperationList(routingStructureList, rootProductModelId); |
| | | List<ProductionOrderRoutingOperation> existingOperationList = productionOrderRoutingOperationMapper.selectList( |
| | | Wrappers.<ProductionOrderRoutingOperation>lambdaQuery() |
| | | .eq(ProductionOrderRoutingOperation::getOrderRoutingId, orderRouting.getId()) |
| | |
| | | if (matchedOperation == null) { |
| | | matchedOperation = insertRoutingOperationSnapshot(orderRouting.getId(), productionOrderId, desiredOperation); |
| | | } else { |
| | | updateRoutingOperationSnapshotIfNecessary(desiredOperation, orderRouting.getId(), productionOrderId, matchedOperation); |
| | | updateRoutingOperationSnapshotIfNecessary(matchedOperation, orderRouting.getId(), productionOrderId, desiredOperation); |
| | | } |
| | | finalOperationList.add(matchedOperation); |
| | | } |
| | |
| | | Map<Long, ProductionBomStructure> structureById = structureList.stream() |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left)); |
| | | |
| | | // æå»ºç¶-åæ å°å
³ç³» |
| | | Map<Long, List<ProductionBomStructure>> treeMap = buildParentChildMap(structureList); |
| | | |
| | | // 使ç¨ååºéåæå»ºæä½å表ï¼å
ååç¶ï¼ç¡®ä¿å·¥èºè·¯çº¿é¡ºåºæ£ç¡®ï¼ |
| | | Map<String, ProductionBomStructure> uniqueOperationMap = new LinkedHashMap<>(); |
| | | for (ProductionBomStructure bomStructure : structureList) { |
| | | if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) { |
| | | continue; |
| | | } |
| | | Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(bomStructure, structureById), rootProductModelId); |
| | | uniqueOperationMap.putIfAbsent(buildBomOperationDedupKey(bomStructure, outputProductModelId), bomStructure); |
| | | } |
| | | buildOperationListPostOrder(null, treeMap, uniqueOperationMap, structureById, rootProductModelId); |
| | | |
| | | List<ProductionOrderRoutingOperation> desiredOperationList = new ArrayList<>(); |
| | | int dragSort = 1; |
| | | for (ProductionBomStructure bomStructure : uniqueOperationMap.values()) { |
| | |
| | | desiredOperationList.add(routingOperation); |
| | | } |
| | | return desiredOperationList; |
| | | } |
| | | |
| | | private Map<Long, List<ProductionBomStructure>> buildParentChildMap(List<ProductionBomStructure> structureList) { |
| | | Map<Long, List<ProductionBomStructure>> treeMap = new LinkedHashMap<>(); |
| | | Map<Long, Integer> childCountMap = new HashMap<>(); |
| | | |
| | | // 第ä¸éï¼ç»è®¡æ¯ä¸ªèç¹çåèç¹æ°éï¼åæ¶æå»ºåå§æ å° |
| | | for (ProductionBomStructure structure : structureList) { |
| | | if (structure == null) continue; |
| | | Long parentId = structure.getParentId(); |
| | | childCountMap.merge(parentId, 1, Integer::sum); // ç»è®¡æ¯ä¸ªç¶èç¹æå¤å°ä¸ªåèç¹ |
| | | treeMap.computeIfAbsent(parentId, k -> new ArrayList<>()).add(structure); |
| | | } |
| | | |
| | | // 第äºéï¼å¯¹æ¯ä¸ªç¶èç¹ä¸çåèç¹æåèç¹æ°éååºæåºï¼æåèç¹çä¼å
ï¼ |
| | | for (Map.Entry<Long, List<ProductionBomStructure>> entry : treeMap.entrySet()) { |
| | | List<ProductionBomStructure> children = entry.getValue(); |
| | | children.sort((a, b) -> { |
| | | int countA = childCountMap.getOrDefault(a.getId(), 0); |
| | | int countB = childCountMap.getOrDefault(b.getId(), 0); |
| | | return Integer.compare(countB, countA); // åèç¹å¤çæåé¢ |
| | | }); |
| | | } |
| | | |
| | | return treeMap; |
| | | } |
| | | |
| | | private void buildOperationListPostOrder(Long parentId, |
| | | Map<Long, List<ProductionBomStructure>> treeMap, |
| | | Map<String, ProductionBomStructure> uniqueOperationMap, |
| | | Map<Long, ProductionBomStructure> structureById, |
| | | Long rootProductModelId) { |
| | | List<ProductionBomStructure> children = treeMap.get(parentId); |
| | | if (children == null || children.isEmpty()) { |
| | | return; |
| | | } |
| | | for (ProductionBomStructure child : children) { |
| | | // å
éå½å¤çåèç¹ |
| | | buildOperationListPostOrder(child.getId(), treeMap, uniqueOperationMap, structureById, rootProductModelId); |
| | | |
| | | // åå¤çå½åèç¹ |
| | | if (child.getTechnologyOperationId() != null) { |
| | | Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(child, structureById), rootProductModelId); |
| | | uniqueOperationMap.putIfAbsent(buildBomOperationDedupKey(child, outputProductModelId), child); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Map<String, Deque<ProductionOrderRoutingOperation>> buildExistingRoutingOperationBucketMap(List<ProductionOrderRoutingOperation> existingOperationList) { |
| | |
| | | if (!Objects.equals(currentOperation.getIsProduction(), desiredOperation.getIsProduction())) { |
| | | update.setIsProduction(desiredOperation.getIsProduction()); |
| | | currentOperation.setIsProduction(desiredOperation.getIsProduction()); |
| | | changed = true; |
| | | } |
| | | // æ´æ° dragSort åæ®µï¼ç¡®ä¿å·¥èºè·¯çº¿é¡ºåºæ£ç¡® |
| | | if (!Objects.equals(currentOperation.getDragSort(), desiredOperation.getDragSort())) { |
| | | update.setDragSort(desiredOperation.getDragSort()); |
| | | currentOperation.setDragSort(desiredOperation.getDragSort()); |
| | | changed = true; |
| | | } |
| | | if (!Objects.equals(currentOperation.getType(), desiredOperation.getType())) { |
| | |
| | | return; |
| | | } |
| | | for (ProductionBomStructureDto node : source) { |
| | | flattenTree(node.getChildren(), result); // å
é彿·»å åèç¹ |
| | | result.add(node); |
| | | flattenTree(node.getChildren(), result); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.mapper.ProductionOperationTaskMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderRoutingOperationMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderRoutingOperationParamMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.ProductionOperationTask; |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperation; |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.util.TaskPlanQuantityUtil; |
| | | import com.ruoyi.technology.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductionOrderRoutingOperationService; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.technology.mapper.TechnologyOperationParamMapper; |
| | | import com.ruoyi.technology.mapper.TechnologyParamMapper; |
| | | import com.ruoyi.technology.pojo.TechnologyOperationParam; |
| | | import com.ruoyi.technology.pojo.TechnologyParam; |
| | | import com.ruoyi.technology.pojo.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | private final TechnologyOperationParamMapper technologyOperationParamMapper; |
| | | private final TechnologyParamMapper technologyParamMapper; |
| | | private final ProductionOrderRoutingOperationParamMapper productionOrderRoutingOperationParamMapper; |
| | | private final ProductionOrderMapper productionOrderMapper; |
| | | private final ProductionOrderRoutingMapper productionOrderRoutingMapper; |
| | | private final ProductionOrderBomMapper productionOrderBomMapper; |
| | | private final ProductionBomStructureMapper productionBomStructureMapper; |
| | | private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper; |
| | | |
| | | @Override |
| | | public R addRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation) { |
| | |
| | | productionOperationTaskMapper.insert(productionOperationTask); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R updateRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation) { |
| | | Long operationId = productionOrderRoutingOperation.getId(); |
| | | |
| | | // æ´æ°å·¥èºè·¯çº¿å·¥åº |
| | | productionOrderRoutingOperationMapper.updateById(productionOrderRoutingOperation); |
| | | |
| | | // éæ°æ¥è¯¢å®æ´è®°å½ï¼å端å¯è½æ²¡æä¼ éææåæ®µï¼å¦ productionOrderIdï¼ |
| | | ProductionOrderRoutingOperation updatedOperation = productionOrderRoutingOperationMapper.selectById(operationId); |
| | | if (updatedOperation == null) { |
| | | throw new ServiceException("å·¥èºè·¯çº¿å·¥åºä¸åå¨"); |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦åå¨å·¥å |
| | | ProductionOperationTask productionOperationTask = productionOperationTaskMapper.selectOne( |
| | | new LambdaQueryWrapper<ProductionOperationTask>() |
| | | .eq(ProductionOperationTask::getProductionOrderRoutingOperationId, operationId) |
| | | .last("limit 1")); |
| | | |
| | | // æ ¹æ®æ¯å¦éè¦ç产è¿è¡å¤ç |
| | | Boolean isProduction = updatedOperation.getIsProduction(); |
| | | |
| | | if (Boolean.TRUE.equals(isProduction)) { |
| | | // éè¦çäº§ï¼æ£æ¥å·¥åæ¯å¦åå¨ï¼ä¸åå¨åçæ |
| | | if (productionOperationTask == null) { |
| | | ProductionOperationTask task = new ProductionOperationTask(); |
| | | task.setProductionOrderRoutingOperationId(updatedOperation.getId()); |
| | | task.setProductionOrderId(updatedOperation.getProductionOrderId()); |
| | | // è·åç产订å |
| | | ProductionOrder productionOrder = productionOrderMapper.selectById(updatedOperation.getProductionOrderId()); |
| | | if (productionOrder == null) { |
| | | throw new ServiceException("ç产订åä¸åå¨"); |
| | | } |
| | | |
| | | // è·å订åBOM |
| | | ProductionOrderBom orderBom = productionOrderBomMapper.selectOne( |
| | | Wrappers.<ProductionOrderBom>lambdaQuery() |
| | | .eq(ProductionOrderBom::getProductionOrderId, productionOrder.getId())); |
| | | |
| | | // ç¡®å®æ ¹äº§åè§æ ¼ID |
| | | Long rootProductModelId = orderBom != null && orderBom.getProductModelId() != null |
| | | ? orderBom.getProductModelId() |
| | | : productionOrder.getProductModelId(); |
| | | |
| | | // è·åBOMç»æå表 |
| | | List<ProductionBomStructure> orderBomStructureList = orderBom == null || orderBom.getId() == null |
| | | ? Collections.emptyList() |
| | | : productionBomStructureMapper.selectList( |
| | | Wrappers.<ProductionBomStructure>lambdaQuery() |
| | | .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId()) |
| | | .orderByAsc(ProductionBomStructure::getId)); |
| | | |
| | | // æå»ºå·¥åºéæ±éæ å° |
| | | Map<String, BigDecimal> operationDemandedQuantityMap = |
| | | TaskPlanQuantityUtil.buildOperationDemandedQuantityMap(orderBomStructureList, rootProductModelId); |
| | | |
| | | // è·åå·¥èºè·¯çº¿å·¥åºï¼ç¨äºè®¡ç®è®¡åæ°éï¼ |
| | | TechnologyRoutingOperation sourceOperation = technologyRoutingOperationMapper.selectById( |
| | | updatedOperation.getTechnologyRoutingOperationId()); |
| | | // å°åæ¥çç§ææ¹æ³æ¿æ¢ä¸ºè°ç¨å·¥å
·ç±» |
| | | BigDecimal planQuantity = TaskPlanQuantityUtil.resolveTaskPlanQuantity( |
| | | sourceOperation, |
| | | operationDemandedQuantityMap, |
| | | productionOrder, |
| | | rootProductModelId); |
| | | task.setPlanQuantity(planQuantity); |
| | | task.setCompleteQuantity(BigDecimal.ZERO); |
| | | task.setWorkOrderNo(generateNextTaskNo()); |
| | | task.setStatus(2); |
| | | productionOperationTaskMapper.insert(task); |
| | | } |
| | | } else { |
| | | // ä¸éè¦çäº§ï¼æ£æ¥å·¥åæ¯å¦åå¨ |
| | | if (productionOperationTask != null) { |
| | | validateTaskCanRemove(productionOperationTask); |
| | | // æ²¡ææ¥å·¥ï¼åå é¤å·¥å |
| | | productionOperationTaskMapper.deleteById(productionOperationTask.getId()); |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | private void validateTaskCanRemove(ProductionOperationTask task) { |
| | | if (task == null || task.getId() == null) { |
| | | return; |
| | | } |
| | | if (defaultDecimal(task.getCompleteQuantity()).compareTo(BigDecimal.ZERO) > 0) { |
| | | throw new ServiceException("å·¥åºå·²äº§çæ¥å·¥è®°å½ï¼æ æ³æ ¹æ® BOM åæ´å é¤å¯¹åºå·¥åºå¿«ç
§"); |
| | | } |
| | | long reportCount = productionProductMainMapper.selectCount( |
| | | Wrappers.<ProductionProductMain>lambdaQuery() |
| | | .eq(ProductionProductMain::getProductionOperationTaskId, task.getId())); |
| | | if (reportCount > 0) { |
| | | throw new ServiceException("å·¥åºå·²äº§çæ¥å·¥è®°å½ï¼æ æ³æ ¹æ® BOM åæ´å é¤å¯¹åºå·¥å"); |
| | | } |
| | | } |
| | | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | private String generateNextTaskNo() { |
| | | // çæä¸ä¸ä¸ªç产工åå· |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String prefix = "GD" + datePrefix; |
| | | ProductionOperationTask lastTask = productionOperationTaskMapper.selectOne( |
| | | Wrappers.<ProductionOperationTask>lambdaQuery() |
| | | .likeRight(ProductionOperationTask::getWorkOrderNo, prefix) |
| | | .orderByDesc(ProductionOperationTask::getWorkOrderNo) |
| | | .last("limit 1")); |
| | | int sequence = 1; |
| | | if (lastTask != null && lastTask.getWorkOrderNo() != null && lastTask.getWorkOrderNo().startsWith(prefix)) { |
| | | try { |
| | | sequence = Integer.parseInt(lastTask.getWorkOrderNo().substring(prefix.length())) + 1; |
| | | } catch (NumberFormatException ignored) { |
| | | sequence = 1; |
| | | } |
| | | } |
| | | return prefix + String.format("%03d", sequence); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.util; |
| | | |
| | | import com.ruoyi.production.pojo.ProductionBomStructure; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperation; |
| | | import com.ruoyi.technology.pojo.TechnologyRoutingOperation; |
| | | import lombok.experimental.UtilityClass; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å·¥åè®¡åæ°é计ç®å·¥å
·ç±» |
| | | */ |
| | | @UtilityClass |
| | | public class TaskPlanQuantityUtil { |
| | | |
| | | /** |
| | | * 计ç®å·¥åè®¡åæ°éï¼ä½¿ç¨ TechnologyRoutingOperationï¼ |
| | | */ |
| | | public BigDecimal resolveTaskPlanQuantity(TechnologyRoutingOperation sourceOperation, |
| | | Map<String, BigDecimal> operationDemandedQuantityMap, |
| | | ProductionOrder productionOrder, |
| | | Long rootProductModelId) { |
| | | if (sourceOperation == null || operationDemandedQuantityMap == null || operationDemandedQuantityMap.isEmpty()) { |
| | | return defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity()); |
| | | } |
| | | Long outputProductModelId = sourceOperation.getProductModelId() != null |
| | | ? sourceOperation.getProductModelId() |
| | | : rootProductModelId; |
| | | String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), outputProductModelId); |
| | | BigDecimal planQuantity = operationDemandedQuantityMap.get(key); |
| | | return planQuantity != null ? planQuantity : defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity()); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å·¥åè®¡åæ°éï¼ä½¿ç¨ ProductionOrderRoutingOperationï¼ |
| | | */ |
| | | public BigDecimal resolveTaskPlanQuantity(ProductionOrderRoutingOperation routingOperation, |
| | | Map<String, BigDecimal> demandedQuantityMap, |
| | | BigDecimal orderQuantity, |
| | | Long rootProductModelId) { |
| | | if (routingOperation == null || demandedQuantityMap == null || demandedQuantityMap.isEmpty()) { |
| | | return orderQuantity; |
| | | } |
| | | Long outputProductModelId = routingOperation.getProductModelId() != null |
| | | ? routingOperation.getProductModelId() |
| | | : rootProductModelId; |
| | | String key = buildOperationDemandedQuantityKey(routingOperation.getTechnologyOperationId(), outputProductModelId); |
| | | BigDecimal planQuantity = demandedQuantityMap.get(key); |
| | | return planQuantity != null ? planQuantity : orderQuantity; |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå·¥åºéæ±éæ å°è¡¨ |
| | | */ |
| | | public Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> bomStructures, Long rootProductModelId) { |
| | | if (bomStructures == null || bomStructures.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | Map<Long, ProductionBomStructure> structureById = new HashMap<>(); |
| | | for (ProductionBomStructure item : bomStructures) { |
| | | if (item != null && item.getId() != null) { |
| | | structureById.put(item.getId(), item); |
| | | } |
| | | } |
| | | Map<String, BigDecimal> demandedQuantityMap = new HashMap<>(); |
| | | Set<String> mergedOutputNodeKeySet = new HashSet<>(); |
| | | for (ProductionBomStructure bomStructure : bomStructures) { |
| | | if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) { |
| | | continue; |
| | | } |
| | | ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById); |
| | | Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId); |
| | | if (outputProductModelId == null) { |
| | | continue; |
| | | } |
| | | String mergedOutputNodeKey = buildOperationOutputNodeKey(bomStructure.getTechnologyOperationId(), |
| | | outputNode == null ? null : outputNode.getId(), outputProductModelId); |
| | | if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) { |
| | | continue; |
| | | } |
| | | BigDecimal demandedQuantity = defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity()); |
| | | String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId); |
| | | demandedQuantityMap.merge(key, demandedQuantity, BigDecimal::add); |
| | | } |
| | | return demandedQuantityMap; |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå·¥åºéæ±ékey |
| | | */ |
| | | public String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) { |
| | | return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºè¾åºèç¹key |
| | | */ |
| | | public String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) { |
| | | return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId); |
| | | } |
| | | |
| | | /** |
| | | * è§£æå·¥åºè¾åºèç¹ |
| | | */ |
| | | public ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure, |
| | | Map<Long, ProductionBomStructure> structureById) { |
| | | if (bomStructure == null) { |
| | | return null; |
| | | } |
| | | if (bomStructure.getParentId() == null) { |
| | | return bomStructure; |
| | | } |
| | | ProductionBomStructure parent = structureById.get(bomStructure.getParentId()); |
| | | return parent != null ? parent : bomStructure; |
| | | } |
| | | |
| | | /** |
| | | * è§£æè¾åºäº§åè§æ ¼ID |
| | | */ |
| | | public Long resolveOutputProductModelId(ProductionBomStructure outputNode, Long rootProductModelId) { |
| | | if (outputNode == null) { |
| | | return rootProductModelId; |
| | | } |
| | | return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId; |
| | | } |
| | | |
| | | /** |
| | | * é»è®¤BigDecimalå¼ |
| | | */ |
| | | public BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.project.common;
|
| | |
|
| | | import com.google.code.kaptcha.Producer;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.sign.Base64;
|
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import jakarta.annotation.Resource;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.util.FastByteArrayOutputStream;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import javax.imageio.ImageIO;
|
| | | import java.awt.image.BufferedImage;
|
| | | import java.io.IOException;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * éªè¯ç æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequiredArgsConstructor
|
| | | public class CaptchaController
|
| | | {
|
| | | @Resource(name = "captchaProducer")
|
| | | private Producer captchaProducer;
|
| | |
|
| | | @Resource(name = "captchaProducerMath")
|
| | | private Producer captchaProducerMath;
|
| | |
|
| | | private final RedisCache redisCache;
|
| | | |
| | | // éªè¯ç ç±»å
|
| | | @Value("${ruoyi.captchaType}")
|
| | | private String captchaType;
|
| | | |
| | | private final ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * çæéªè¯ç
|
| | | */
|
| | | @GetMapping("/captchaImage")
|
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | boolean captchaEnabled = configService.selectCaptchaEnabled();
|
| | | ajax.put("captchaEnabled", captchaEnabled);
|
| | | if (!captchaEnabled)
|
| | | {
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | // ä¿åéªè¯ç ä¿¡æ¯
|
| | | String uuid = IdUtils.simpleUUID();
|
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
| | |
|
| | | String capStr = null, code = null;
|
| | | BufferedImage image = null;
|
| | |
|
| | | // çæéªè¯ç
|
| | | if ("math".equals(captchaType))
|
| | | {
|
| | | String capText = captchaProducerMath.createText();
|
| | | capStr = capText.substring(0, capText.lastIndexOf("@"));
|
| | | code = capText.substring(capText.lastIndexOf("@") + 1);
|
| | | image = captchaProducerMath.createImage(capStr);
|
| | | }
|
| | | else if ("char".equals(captchaType))
|
| | | {
|
| | | capStr = code = captchaProducer.createText();
|
| | | image = captchaProducer.createImage(capStr);
|
| | | }
|
| | |
|
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
| | | // è½¬æ¢æµä¿¡æ¯ååº
|
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
| | | try
|
| | | {
|
| | | ImageIO.write(image, "jpg", os);
|
| | | }
|
| | | catch (IOException e)
|
| | | {
|
| | | return AjaxResult.error(e.getMessage());
|
| | | }
|
| | |
|
| | | ajax.put("uuid", uuid);
|
| | | ajax.put("img", Base64.encode(os.toByteArray()));
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.common; |
| | | |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * éªè¯ç æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | private final RedisCache redisCache; |
| | | |
| | | // éªè¯ç ç±»å |
| | | @Value("${ruoyi.captchaType}") |
| | | private String captchaType; |
| | | |
| | | private final ISysConfigService configService; |
| | | |
| | | /** |
| | | * çæéªè¯ç |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public R<?> getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | map.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return R.ok(map); |
| | | } |
| | | |
| | | // ä¿åéªè¯ç ä¿¡æ¯ |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | | |
| | | String capStr = null, code = null; |
| | | BufferedImage image = null; |
| | | |
| | | // çæéªè¯ç |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(captchaType)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | |
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | // è½¬æ¢æµä¿¡æ¯ååº |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | | try |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | |
| | | map.put("uuid", uuid); |
| | | map.put("img", Base64.encode(os.toByteArray())); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.monitor.domain.SysCache;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.data.redis.core.RedisCallback;
|
| | | import org.springframework.data.redis.core.RedisTemplate;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.*;
|
| | |
|
| | | /**
|
| | | * ç¼åçæ§
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/cache")
|
| | | @AllArgsConstructor
|
| | | public class CacheController
|
| | | {
|
| | | private RedisTemplate<String, String> redisTemplate;
|
| | |
|
| | | private final static List<SysCache> caches = new ArrayList<SysCache>();
|
| | | {
|
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "ç¨æ·ä¿¡æ¯"));
|
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "é
置信æ¯"));
|
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "æ°æ®åå
¸"));
|
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "éªè¯ç "));
|
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "é²éæäº¤"));
|
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "éæµå¤ç"));
|
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "å¯ç é误次æ°"));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping()
|
| | | public AjaxResult getInfo() throws Exception
|
| | | {
|
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
| | |
|
| | | Map<String, Object> result = new HashMap<>(3);
|
| | | result.put("info", info);
|
| | | result.put("dbSize", dbSize);
|
| | |
|
| | | List<Map<String, String>> pieList = new ArrayList<>();
|
| | | commandStats.stringPropertyNames().forEach(key -> {
|
| | | Map<String, String> data = new HashMap<>(2);
|
| | | String property = commandStats.getProperty(key);
|
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
| | | pieList.add(data);
|
| | | });
|
| | | result.put("commandStats", pieList);
|
| | | return AjaxResult.success(result);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getNames")
|
| | | public AjaxResult cache()
|
| | | {
|
| | | return AjaxResult.success(caches);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getKeys/{cacheName}")
|
| | | public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
| | | {
|
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
| | | return AjaxResult.success(new TreeSet<>(cacheKeys));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}")
|
| | | public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
| | | {
|
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
| | | return AjaxResult.success(sysCache);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheName/{cacheName}")
|
| | | public AjaxResult clearCacheName(@PathVariable String cacheName)
|
| | | {
|
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
| | | redisTemplate.delete(cacheKeys);
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheKey/{cacheKey}")
|
| | | public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
| | | {
|
| | | redisTemplate.delete(cacheKey);
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheAll")
|
| | | public AjaxResult clearCacheAll()
|
| | | {
|
| | | Collection<String> cacheKeys = redisTemplate.keys("*");
|
| | | redisTemplate.delete(cacheKeys);
|
| | | return AjaxResult.success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.monitor.domain.SysCache; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * ç¼åçæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | @AllArgsConstructor |
| | | public class CacheController extends BaseController |
| | | { |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "ç¨æ·ä¿¡æ¯")); |
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "é
置信æ¯")); |
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "æ°æ®åå
¸")); |
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "éªè¯ç ")); |
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "é²éæäº¤")); |
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "éæµå¤ç")); |
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "å¯ç é误次æ°")); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping() |
| | | public R<?> getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | result.put("commandStats", pieList); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getNames") |
| | | public R<?> cache() |
| | | { |
| | | return R.ok(caches); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public R<?> getCacheKeys(@PathVariable String cacheName) |
| | | { |
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | return R.ok(new TreeSet<>(cacheKeys)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public R<?> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) |
| | | { |
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey); |
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); |
| | | return R.ok(sysCache); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public R<?> clearCacheName(@PathVariable String cacheName) |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public R<?> clearCacheKey(@PathVariable String cacheKey) |
| | | { |
| | | redisTemplate.delete(cacheKey); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheAll") |
| | | public R<?> clearCacheAll() |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys("*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.domain.Server;
|
| | |
|
| | | /**
|
| | | * æå¡å¨çæ§
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/server")
|
| | | public class ServerController
|
| | | {
|
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
| | | @GetMapping()
|
| | | public AjaxResult getInfo() throws Exception
|
| | | {
|
| | | Server server = new Server();
|
| | | server.copyTo();
|
| | | return AjaxResult.success(server);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * æå¡å¨çæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController extends BaseController |
| | | { |
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')") |
| | | @GetMapping() |
| | | public R<?> getInfo() throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | return R.ok(server); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.exception.job.TaskException;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.job.CronUtils;
|
| | | import com.ruoyi.common.utils.job.ScheduleUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysJob;
|
| | | import com.ruoyi.project.monitor.service.ISysJobService;
|
| | |
|
| | | /**
|
| | | * è°åº¦ä»»å¡ä¿¡æ¯æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/job")
|
| | | @AllArgsConstructor
|
| | | public class SysJobController extends BaseController
|
| | | {
|
| | | private ISysJobService jobService;
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢å®æ¶ä»»å¡å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysJob sysJob)
|
| | | {
|
| | | startPage();
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导åºå®æ¶ä»»å¡å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.EXPORT)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJob sysJob)
|
| | | {
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
| | | util.exportExcel(response, list, "宿¶ä»»å¡");
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å宿¶ä»»å¡è¯¦ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
| | | @GetMapping(value = "/{jobId}")
|
| | | public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
| | | {
|
| | | return success(jobService.selectJobById(jobId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢å®æ¶ä»»å¡
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException
|
| | | {
|
| | | if (!CronUtils.isValid(job.getCronExpression()))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼Cron表达å¼ä¸æ£ç¡®");
|
| | | }
|
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'rmi'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'ldap(s)'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'http(s)'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串åå¨è¿è§");
|
| | | }
|
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
|
| | | {
|
| | | return error("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å¨ç½ååå
");
|
| | | }
|
| | | job.setCreateBy(getUsername());
|
| | | return toAjax(jobService.insertJob(job));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹å®æ¶ä»»å¡
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
|
| | | {
|
| | | if (!CronUtils.isValid(job.getCronExpression()))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼Cron表达å¼ä¸æ£ç¡®");
|
| | | }
|
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'rmi'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'ldap(s)'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'http(s)'è°ç¨");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串åå¨è¿è§");
|
| | | }
|
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
|
| | | {
|
| | | return error("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å¨ç½ååå
");
|
| | | }
|
| | | job.setUpdateBy(getUsername());
|
| | | return toAjax(jobService.updateJob(job));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 宿¶ä»»å¡ç¶æä¿®æ¹
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
|
| | | {
|
| | | SysJob newJob = jobService.selectJobById(job.getJobId());
|
| | | newJob.setStatus(job.getStatus());
|
| | | return toAjax(jobService.changeStatus(newJob));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 宿¶ä»»å¡ç«å³æ§è¡ä¸æ¬¡
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/run")
|
| | | public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
|
| | | {
|
| | | boolean result = jobService.run(job);
|
| | | return result ? success() : error("ä»»å¡ä¸åå¨æå·²è¿æï¼");
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤å®æ¶ä»»å¡
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{jobIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
|
| | | {
|
| | | jobService.deleteJobByIds(jobIds);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.job.CronUtils; |
| | | import com.ruoyi.common.utils.job.ScheduleUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | import com.ruoyi.project.monitor.service.ISysJobService; |
| | | |
| | | /** |
| | | * è°åº¦ä»»å¡ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/job") |
| | | @AllArgsConstructor |
| | | public class SysJobController extends BaseController |
| | | { |
| | | private ISysJobService jobService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJob sysJob) |
| | | { |
| | | startPage(); |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå®æ¶ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysJob sysJob) |
| | | { |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class); |
| | | util.exportExcel(response, list, "宿¶ä»»å¡"); |
| | | } |
| | | |
| | | /** |
| | | * è·å宿¶ä»»å¡è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobId}") |
| | | public R<?> getInfo(@PathVariable("jobId") Long jobId) |
| | | { |
| | | return R.ok(jobService.selectJobById(jobId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@RequestBody SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | if (!CronUtils.isValid(job.getCronExpression())) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼Cron表达å¼ä¸æ£ç¡®"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'rmi'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'ldap(s)'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'http(s)'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串åå¨è¿è§"); |
| | | } |
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) |
| | | { |
| | | return R.fail("æ°å¢ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å¨ç½ååå
"); |
| | | } |
| | | job.setCreateBy(getUsername()); |
| | | jobService.insertJob(job); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@RequestBody SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | if (!CronUtils.isValid(job.getCronExpression())) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼Cron表达å¼ä¸æ£ç¡®"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'rmi'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'ldap(s)'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å
许'http(s)'è°ç¨"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串åå¨è¿è§"); |
| | | } |
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) |
| | | { |
| | | return R.fail("ä¿®æ¹ä»»å¡'" + job.getJobName() + "'失败ï¼ç®æ å符串ä¸å¨ç½ååå
"); |
| | | } |
| | | job.setUpdateBy(getUsername()); |
| | | jobService.updateJob(job); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | SysJob newJob = jobService.selectJobById(job.getJobId()); |
| | | newJob.setStatus(job.getStatus()); |
| | | jobService.changeStatus(newJob); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ç«å³æ§è¡ä¸æ¬¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/run") |
| | | public R<?> run(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | boolean result = jobService.run(job); |
| | | return result ? R.ok() : R.fail("ä»»å¡ä¸åå¨æå·²è¿æï¼"); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobIds}") |
| | | public R<?> remove(@PathVariable Long[] jobIds) throws SchedulerException |
| | | { |
| | | jobService.deleteJobByIds(jobIds); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysJobLog;
|
| | | import com.ruoyi.project.monitor.service.ISysJobLogService;
|
| | |
|
| | | /**
|
| | | * è°åº¦æ¥å¿æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/jobLog")
|
| | | @AllArgsConstructor
|
| | | public class SysJobLogController extends BaseController
|
| | | {
|
| | | private ISysJobLogService jobLogService;
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢å®æ¶ä»»å¡è°åº¦æ¥å¿å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysJobLog sysJobLog)
|
| | | {
|
| | | startPage();
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导åºå®æ¶ä»»å¡è°åº¦æ¥å¿å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.EXPORT)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog)
|
| | | {
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
| | | util.exportExcel(response, list, "è°åº¦æ¥å¿");
|
| | | }
|
| | | |
| | | /**
|
| | | * æ ¹æ®è°åº¦ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
| | | @GetMapping(value = "/{jobLogId}")
|
| | | public AjaxResult getInfo(@PathVariable Long jobLogId)
|
| | | {
|
| | | return success(jobLogService.selectJobLogById(jobLogId));
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * å é¤å®æ¶ä»»å¡è°åº¦æ¥å¿
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "宿¶ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{jobLogIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] jobLogIds)
|
| | | {
|
| | | return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¸
ç©ºå®æ¶ä»»å¡è°åº¦æ¥å¿
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "è°åº¦æ¥å¿", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean()
|
| | | {
|
| | | jobLogService.cleanJobLog();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | import com.ruoyi.project.monitor.service.ISysJobLogService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | |
| | | /** |
| | | * è°åº¦æ¥å¿æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/jobLog") |
| | | @AllArgsConstructor |
| | | public class SysJobLogController extends BaseController |
| | | { |
| | | private ISysJobLogService jobLogService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡è°åº¦æ¥å¿å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJobLog sysJobLog) |
| | | { |
| | | startPage(); |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå®æ¶ä»»å¡è°åº¦æ¥å¿å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog) |
| | | { |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class); |
| | | util.exportExcel(response, list, "è°åº¦æ¥å¿"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è°åº¦ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobLogId}") |
| | | public R<?> getInfo(@PathVariable Long jobLogId) |
| | | { |
| | | return R.ok(jobLogService.selectJobLogById(jobLogId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å é¤å®æ¶ä»»å¡è°åº¦æ¥å¿ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "宿¶ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobLogIds}") |
| | | public R<?> remove(@PathVariable Long[] jobLogIds) |
| | | { |
| | | jobLogService.deleteJobLogByIds(jobLogIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
ç©ºå®æ¶ä»»å¡è°åº¦æ¥å¿ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "è°åº¦æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() |
| | | { |
| | | jobLogService.cleanJobLog(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | 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.security.service.SysPasswordService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysLogininfor;
|
| | | import com.ruoyi.project.monitor.service.ISysLogininforService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * ç³»ç»è®¿é®è®°å½
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/logininfor")
|
| | | @AllArgsConstructor
|
| | | public class SysLogininforController extends BaseController {
|
| | | private ISysLogininforService logininforService;
|
| | | private SysPasswordService passwordService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysLogininfor logininfor) {
|
| | | startPage();
|
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysLogininfor logininfor) {
|
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
| | | util.exportExcel(response, list, "ç»å½æ¥å¿");
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{infoIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] infoIds) {
|
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean() {
|
| | | logininforService.cleanLogininfor();
|
| | | return success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
| | | @Log(title = "è´¦æ·è§£é", businessType = BusinessType.OTHER)
|
| | | @GetMapping("/unlock/{userName}")
|
| | | public AjaxResult unlock(@PathVariable("userName") String userName) {
|
| | | passwordService.clearLoginRecordCache(userName);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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.security.service.SysPasswordService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysLogininfor; |
| | | import com.ruoyi.project.monitor.service.ISysLogininforService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®è®°å½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | @AllArgsConstructor |
| | | public class SysLogininforController extends BaseController { |
| | | private ISysLogininforService logininforService; |
| | | private SysPasswordService passwordService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) { |
| | | startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysLogininfor logininfor) { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | util.exportExcel(response, list, "ç»å½æ¥å¿"); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public R<?> remove(@PathVariable Long[] infoIds) { |
| | | logininforService.deleteLogininforByIds(infoIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "ç»å½æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() { |
| | | logininforService.cleanLogininfor(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") |
| | | @Log(title = "è´¦æ·è§£é", businessType = BusinessType.OTHER) |
| | | @GetMapping("/unlock/{userName}") |
| | | public R<?> unlock(@PathVariable("userName") String userName) { |
| | | passwordService.clearLoginRecordCache(userName); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysOperLog;
|
| | | import com.ruoyi.project.monitor.service.ISysOperLogService;
|
| | |
|
| | | /**
|
| | | * æä½æ¥å¿è®°å½
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/operlog")
|
| | | @AllArgsConstructor
|
| | | public class SysOperlogController extends BaseController
|
| | | {
|
| | | private ISysOperLogService operLogService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysOperLog operLog)
|
| | | {
|
| | | startPage();
|
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysOperLog operLog)
|
| | | {
|
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
| | | util.exportExcel(response, list, "æä½æ¥å¿");
|
| | | }
|
| | |
|
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.DELETE)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
| | | @DeleteMapping("/{operIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] operIds)
|
| | | {
|
| | | return toAjax(operLogService.deleteOperLogByIds(operIds));
|
| | | }
|
| | |
|
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.CLEAN)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean()
|
| | | {
|
| | | operLogService.cleanOperLog();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysOperLog; |
| | | import com.ruoyi.project.monitor.service.ISysOperLogService; |
| | | |
| | | /** |
| | | * æä½æ¥å¿è®°å½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | @AllArgsConstructor |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | private ISysOperLogService operLogService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysOperLog operLog) |
| | | { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | util.exportExcel(response, list, "æä½æ¥å¿"); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.DELETE) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/{operIds}") |
| | | public R<?> remove(@PathVariable Long[] operIds) |
| | | { |
| | | operLogService.deleteOperLogByIds(operIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Log(title = "æä½æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysUserOnline;
|
| | | import com.ruoyi.project.system.service.ISysUserOnlineService;
|
| | |
|
| | | /**
|
| | | * å¨çº¿ç¨æ·çæ§
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/online")
|
| | | @AllArgsConstructor
|
| | | public class SysUserOnlineController extends BaseController
|
| | | {
|
| | | private ISysUserOnlineService userOnlineService;
|
| | | private RedisCache redisCache;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(String ipaddr, String userName)
|
| | | {
|
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
| | | for (String key : keys)
|
| | | {
|
| | | LoginUser user = redisCache.getCacheObject(key);
|
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(ipaddr))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
| | | }
|
| | | else
|
| | | {
|
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
| | | }
|
| | | }
|
| | | Collections.reverse(userOnlineList);
|
| | | userOnlineList.removeAll(Collections.singleton(null));
|
| | | return getDataTable(userOnlineList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 强éç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
| | | @Log(title = "å¨çº¿ç¨æ·", businessType = BusinessType.FORCE)
|
| | | @DeleteMapping("/{tokenId}")
|
| | | public AjaxResult forceLogout(@PathVariable String tokenId)
|
| | | {
|
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysUserOnline; |
| | | import com.ruoyi.project.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * å¨çº¿ç¨æ·çæ§ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | @AllArgsConstructor |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | private ISysUserOnlineService userOnlineService; |
| | | private RedisCache redisCache; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | LoginUser user = redisCache.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | else |
| | | { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return getDataTable(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | | * 强éç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") |
| | | @Log(title = "å¨çº¿ç¨æ·", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public R<?> forceLogout(@PathVariable String tokenId) |
| | | { |
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysConfig;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * åæ°é
ç½® ä¿¡æ¯æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/config")
|
| | | @AllArgsConstructor
|
| | | public class SysConfigController extends BaseController
|
| | | {
|
| | | private ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * è·ååæ°é
ç½®å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysConfig config)
|
| | | {
|
| | | startPage();
|
| | | List<SysConfig> list = configService.selectConfigList(config);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:config:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysConfig config)
|
| | | {
|
| | | List<SysConfig> list = configService.selectConfigList(config);
|
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
| | | util.exportExcel(response, list, "åæ°æ°æ®");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®åæ°ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:query')")
|
| | | @GetMapping(value = "/{configId}")
|
| | | public AjaxResult getInfo(@PathVariable Long configId)
|
| | | {
|
| | | return success(configService.selectConfigById(configId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®åæ°é®åæ¥è¯¢åæ°å¼
|
| | | */
|
| | | @GetMapping(value = "/configKey/{configKey}")
|
| | | public AjaxResult getConfigKey(@PathVariable String configKey)
|
| | | {
|
| | | return success(configService.selectConfigByKey(configKey));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢åæ°é
ç½®
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:add')")
|
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysConfig config)
|
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("æ°å¢åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨");
|
| | | }
|
| | | config.setCreateBy(getUsername());
|
| | | return toAjax(configService.insertConfig(config));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹åæ°é
ç½®
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')")
|
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("ä¿®æ¹åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨");
|
| | | }
|
| | | config.setUpdateBy(getUsername());
|
| | | return toAjax(configService.updateConfig(config));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤åæ°é
ç½®
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{configIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] configIds)
|
| | | {
|
| | | configService.deleteConfigByIds(configIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * å·æ°åæ°ç¼å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | configService.resetConfigCache();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysConfig; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * åæ°é
ç½® ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | @AllArgsConstructor |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * è·ååæ°é
ç½®å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "åæ°æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public R<?> getInfo(@PathVariable Long configId) |
| | | { |
| | | return R.ok(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°é®åæ¥è¯¢åæ°å¼ |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public R<?> getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return R.ok(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return R.fail("æ°å¢åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | | configService.insertConfig(config); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return R.fail("ä¿®æ¹åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | | configService.updateConfig(config); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åæ°é
ç½® |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public R<?> remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°åæ°ç¼å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public R<?> refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | 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.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | |
|
| | | /**
|
| | | * é¨é¨ä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dept")
|
| | | @AllArgsConstructor
|
| | | public class SysDeptController extends BaseController
|
| | | {
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | /**
|
| | | * è·åé¨é¨å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
| | | @GetMapping("/list")
|
| | | public AjaxResult list(SysDept dept)
|
| | | {
|
| | | List<SysDept> depts = deptService.selectDeptList(dept);
|
| | | return success(depts);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢é¨é¨åè¡¨ï¼æé¤èç¹ï¼
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
| | | @GetMapping("/list/exclude/{deptId}")
|
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
| | | {
|
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
| | | return success(depts);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®é¨é¨ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')")
|
| | | @GetMapping(value = "/{deptId}")
|
| | | public AjaxResult getInfo(@PathVariable Long deptId)
|
| | | {
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | return success(deptService.selectDeptById(deptId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢é¨é¨
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')")
|
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("æ°å¢é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨");
|
| | | }
|
| | | dept.setCreateBy(getUsername());
|
| | | return toAjax(deptService.insertDept(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹é¨é¨
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | Long deptId = dept.getDeptId();
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨");
|
| | | }
|
| | | else if (dept.getParentId().equals(deptId))
|
| | | {
|
| | | return error("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼ä¸çº§é¨é¨ä¸è½æ¯èªå·±");
|
| | | }
|
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
| | | {
|
| | | return error("该é¨é¨å
嫿ªåç¨çåé¨é¨ï¼");
|
| | | }
|
| | | dept.setUpdateBy(getUsername());
|
| | | return toAjax(deptService.updateDept(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤é¨é¨
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{deptId}")
|
| | | public AjaxResult remove(@PathVariable Long deptId)
|
| | | {
|
| | | if (deptService.hasChildByDeptId(deptId))
|
| | | {
|
| | | return warn("åå¨ä¸çº§é¨é¨,ä¸å
许å é¤");
|
| | | }
|
| | | if (deptService.checkDeptExistUser(deptId))
|
| | | {
|
| | | return warn("é¨é¨åå¨ç¨æ·,ä¸å
许å é¤");
|
| | | }
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | return toAjax(deptService.deleteDeptById(deptId));
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | 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.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * é¨é¨ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | @AllArgsConstructor |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | private ISysDeptService deptService; |
| | | |
| | | /** |
| | | * è·åé¨é¨å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | public R<?> list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return R.ok(depts); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨åè¡¨ï¼æé¤èç¹ï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public R<?> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return R.ok(depts); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public R<?> getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return R.ok(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return R.fail("æ°å¢é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | deptService.insertDept(dept); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return R.fail("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return R.fail("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼ä¸çº§é¨é¨ä¸è½æ¯èªå·±"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return R.fail("该é¨é¨å
嫿ªåç¨çåé¨é¨ï¼"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | deptService.updateDept(dept); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤é¨é¨ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "é¨é¨ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public R<?> remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "åå¨ä¸çº§é¨é¨,ä¸å
许å é¤"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "é¨é¨åå¨ç¨æ·,ä¸å
许å é¤"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | deptService.deleteDeptById(deptId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDictData;
|
| | | import com.ruoyi.project.system.service.ISysDictDataService;
|
| | | import com.ruoyi.project.system.service.ISysDictTypeService;
|
| | |
|
| | | /**
|
| | | * æ°æ®åå
¸ä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dict/data")
|
| | | @AllArgsConstructor
|
| | | public class SysDictDataController extends BaseController
|
| | | {
|
| | | private ISysDictDataService dictDataService;
|
| | | private ISysDictTypeService dictTypeService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysDictData dictData)
|
| | | {
|
| | | startPage();
|
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictData dictData)
|
| | | {
|
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
| | | util.exportExcel(response, list, "åå
¸æ°æ®");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢åå
¸æ°æ®è¯¦ç»
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
| | | @GetMapping(value = "/{dictCode}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictCode)
|
| | | {
|
| | | return success(dictDataService.selectDictDataById(dictCode));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®åå
¸ç±»åæ¥è¯¢åå
¸æ°æ®ä¿¡æ¯
|
| | | */
|
| | | @GetMapping(value = "/type/{dictType}")
|
| | | public AjaxResult dictType(@PathVariable String dictType)
|
| | | {
|
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
| | | if (StringUtils.isNull(data))
|
| | | {
|
| | | data = new ArrayList<SysDictData>();
|
| | | }
|
| | | return success(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢åå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
| | | {
|
| | | dict.setCreateBy(getUsername());
|
| | | return toAjax(dictDataService.insertDictData(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ä¿ååå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
| | | {
|
| | | dict.setUpdateBy(getUsername());
|
| | | return toAjax(dictDataService.updateDictData(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤åå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{dictCodes}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictCodes)
|
| | | {
|
| | | dictDataService.deleteDictDataByIds(dictCodes);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.service.ISysDictDataService; |
| | | import com.ruoyi.project.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | @AllArgsConstructor |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | private ISysDictDataService dictDataService; |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictData dictData) |
| | | { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | util.exportExcel(response, list, "åå
¸æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åå
¸æ°æ®è¯¦ç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public R<?> getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return R.ok(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åæ¥è¯¢åå
¸æ°æ®ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public R<?> dictType(@PathVariable String dictType) |
| | | { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getUsername()); |
| | | dictDataService.insertDictData(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "åå
¸æ°æ®", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getUsername()); |
| | | dictDataService.updateDictData(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public R<?> remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDictType;
|
| | | import com.ruoyi.project.system.service.ISysDictTypeService;
|
| | |
|
| | | /**
|
| | | * æ°æ®åå
¸ä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dict/type")
|
| | | @AllArgsConstructor
|
| | | public class SysDictTypeController extends BaseController
|
| | | {
|
| | | private ISysDictTypeService dictTypeService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysDictType dictType)
|
| | | {
|
| | | startPage();
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictType dictType)
|
| | | {
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
| | | util.exportExcel(response, list, "åå
¸ç±»å");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢åå
¸ç±»å详ç»
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
| | | @GetMapping(value = "/{dictId}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictId)
|
| | | {
|
| | | return success(dictTypeService.selectDictTypeById(dictId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢åå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return error("æ°å¢åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨");
|
| | | }
|
| | | dict.setCreateBy(getUsername());
|
| | | return toAjax(dictTypeService.insertDictType(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹åå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return error("ä¿®æ¹åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨");
|
| | | }
|
| | | dict.setUpdateBy(getUsername());
|
| | | return toAjax(dictTypeService.updateDictType(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤åå
¸ç±»å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{dictIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictIds)
|
| | | {
|
| | | dictTypeService.deleteDictTypeByIds(dictIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * å·æ°åå
¸ç¼å
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | dictTypeService.resetDictCache();
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·ååå
¸éæ©æ¡å表
|
| | | */
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
| | | return success(dictTypes);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDictType; |
| | | import com.ruoyi.project.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | @AllArgsConstructor |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictType dictType) |
| | | { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | util.exportExcel(response, list, "åå
¸ç±»å"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åå
¸ç±»åè¯¦ç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public R<?> getInfo(@PathVariable Long dictId) |
| | | { |
| | | return R.ok(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return R.fail("æ°å¢åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | dictTypeService.insertDictType(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return R.fail("ä¿®æ¹åå
¸'" + dict.getDictName() + "'失败ï¼åå
¸ç±»åå·²åå¨"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | dictTypeService.updateDictType(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åå
¸ç±»å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public R<?> remove(@PathVariable Long[] dictIds) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°åå
¸ç¼å |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "åå
¸ç±»å", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public R<?> refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸éæ©æ¡å表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return R.ok(dictTypes); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.framework.security.LoginBody;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.SysLoginService;
|
| | | import com.ruoyi.framework.security.service.SysPermissionService;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import com.ruoyi.project.system.service.ISysUserDeptService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.util.ObjectUtils;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * ç»å½éªè¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @AllArgsConstructor
|
| | | public class SysLoginController
|
| | | {
|
| | | private SysLoginService loginService;
|
| | | private ISysMenuService menuService;
|
| | | private SysPermissionService permissionService;
|
| | | private TokenService tokenService;
|
| | | private ISysUserDeptService userDeptService;
|
| | | private ISysUserService userService;
|
| | | private SysDeptMapper sysDeptMapper;
|
| | |
|
| | | /**
|
| | | * ç»å½æ¹æ³
|
| | | * |
| | | * @param loginBody ç»å½ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @PostMapping("/login")
|
| | | public AjaxResult login(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | // çæä»¤ç
|
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
| | | loginBody.getUuid());
|
| | | ajax.put(Constants.TOKEN, token);
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åç¨æ·ä¿¡æ¯
|
| | | * |
| | | * @return ç¨æ·ä¿¡æ¯
|
| | | */
|
| | | @GetMapping("/getInfo")
|
| | | public AjaxResult getInfo()
|
| | | {
|
| | | LoginUser loginUser = SecurityUtils.getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | // è·åå½åç»å½å
¬å¸
|
| | | Long tenantId = loginUser.getTenantId();
|
| | | if(null != tenantId){
|
| | | user.setTenantId(tenantId);
|
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
|
| | | if(!ObjectUtils.isEmpty(sysDept)){
|
| | | user.setCurrentFactoryName(sysDept.getDeptName());
|
| | | }
|
| | | }
|
| | | // è§è²éå
|
| | | Set<String> roles = permissionService.getRolePermission(user);
|
| | | // æééå
|
| | | Set<String> permissions = permissionService.getMenuPermission(user);
|
| | | if (!loginUser.getPermissions().equals(permissions))
|
| | | {
|
| | | loginUser.setPermissions(permissions);
|
| | | tokenService.refreshToken(loginUser);
|
| | | }
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("user", user);
|
| | | ajax.put("aiEnabled", loginUser.getAiEnabled());
|
| | | ajax.put("roles", roles);
|
| | | ajax.put("permissions", permissions);
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åè·¯ç±ä¿¡æ¯
|
| | | * |
| | | * @return è·¯ç±ä¿¡æ¯
|
| | | */
|
| | | @GetMapping("getRouters")
|
| | | public AjaxResult getRouters()
|
| | | {
|
| | | Long userId = SecurityUtils.getUserId();
|
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
| | | return AjaxResult.success(menuService.buildMenus(menus));
|
| | | }
|
| | |
|
| | | @PostMapping("/loginCheck")
|
| | | public AjaxResult loginCheck(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | try {
|
| | | Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword());
|
| | | return AjaxResult.success(userId);
|
| | | }catch (Exception e) {
|
| | | return AjaxResult.error(e.getMessage());
|
| | | }
|
| | | }
|
| | |
|
| | | @GetMapping("/userLoginFacotryList")
|
| | | public AjaxResult userLoginFacotryList(SysUserDeptVo sysUserDeptVo){
|
| | | List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo);
|
| | | Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream()
|
| | | .collect(Collectors.toMap(
|
| | | SysUserDeptVo::getDeptId,
|
| | | item -> item,
|
| | | (existing, replacement) -> existing // 妿éå¤ï¼ä¿ç第ä¸ä¸ª
|
| | | ));
|
| | | List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values());
|
| | | return AjaxResult.success(uniqueList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * éæ©å
¬å¸ç»å½
|
| | | *
|
| | | * @param loginBody ç»å½ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @PostMapping("/loginCheckFactory")
|
| | | public AjaxResult loginCheckFactory(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | // çæä»¤ç
|
| | | String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId());
|
| | | ajax.put(Constants.TOKEN, token);
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginBody; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.SysLoginService; |
| | | import com.ruoyi.framework.security.service.SysPermissionService; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysMenu; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import com.ruoyi.project.system.service.ISysUserDeptService; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç»å½éªè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class SysLoginController extends BaseController |
| | | { |
| | | private SysLoginService loginService; |
| | | private ISysMenuService menuService; |
| | | private SysPermissionService permissionService; |
| | | private TokenService tokenService; |
| | | private ISysUserDeptService userDeptService; |
| | | private ISysUserService userService; |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | /** |
| | | * ç»å½æ¹æ³ |
| | | * |
| | | * @param loginBody ç»å½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @PostMapping("/login") |
| | | public R<?> login(@RequestBody LoginBody loginBody) |
| | | { |
| | | // çæä»¤ç |
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put(Constants.TOKEN, token); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @return ç¨æ·ä¿¡æ¯ |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public R<?> getInfo() |
| | | { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | // è·åå½åç»å½å
¬å¸ |
| | | Long tenantId = loginUser.getTenantId(); |
| | | if(null != tenantId){ |
| | | user.setTenantId(tenantId); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue()); |
| | | if(!ObjectUtils.isEmpty(sysDept)){ |
| | | user.setCurrentFactoryName(sysDept.getDeptName()); |
| | | } |
| | | } |
| | | // è§è²éå |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // æééå |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | if (!loginUser.getPermissions().equals(permissions)) |
| | | { |
| | | loginUser.setPermissions(permissions); |
| | | tokenService.refreshToken(loginUser); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | map.put("aiEnabled", loginUser.getAiEnabled()); |
| | | map.put("roles", roles); |
| | | map.put("permissions", permissions); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * è·åè·¯ç±ä¿¡æ¯ |
| | | * |
| | | * @return è·¯ç±ä¿¡æ¯ |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public R<?> getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return R.ok(menuService.buildMenus(menus)); |
| | | } |
| | | |
| | | @PostMapping("/loginCheck") |
| | | public R<?> loginCheck(@RequestBody LoginBody loginBody) |
| | | { |
| | | try { |
| | | Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword()); |
| | | return R.ok(userId); |
| | | }catch (Exception e) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/userLoginFacotryList") |
| | | public R<?> userLoginFacotryList(SysUserDeptVo sysUserDeptVo){ |
| | | List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo); |
| | | Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream() |
| | | .collect(Collectors.toMap( |
| | | SysUserDeptVo::getDeptId, |
| | | item -> item, |
| | | (existing, replacement) -> existing // 妿éå¤ï¼ä¿ç第ä¸ä¸ª |
| | | )); |
| | | List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values()); |
| | | return R.ok(uniqueList); |
| | | } |
| | | |
| | | /** |
| | | * éæ©å
¬å¸ç»å½ |
| | | * |
| | | * @param loginBody ç»å½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @PostMapping("/loginCheckFactory") |
| | | public R<?> loginCheckFactory(@RequestBody LoginBody loginBody) |
| | | { |
| | | // çæä»¤ç |
| | | String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put(Constants.TOKEN, token); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | 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.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * èåä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/menu")
|
| | | @AllArgsConstructor
|
| | | public class SysMenuController extends BaseController
|
| | | {
|
| | | private ISysMenuService menuService;
|
| | |
|
| | | /**
|
| | | * è·åèåå表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')")
|
| | | @GetMapping("/list")
|
| | | public AjaxResult list(SysMenu menu)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return success(menus);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®èåç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')")
|
| | | @GetMapping(value = "/{menuId}")
|
| | | public AjaxResult getInfo(@PathVariable Long menuId)
|
| | | {
|
| | | return success(menuService.selectMenuById(menuId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åèå䏿æ å表
|
| | | */
|
| | | @GetMapping("/treeselect")
|
| | | public AjaxResult treeselect(SysMenu menu)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return success(menuService.buildMenuTreeSelect(menus));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å 载对åºè§è²èåå表æ
|
| | | */
|
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢èå
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')")
|
| | | @Log(title = "èå管ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨");
|
| | | }
|
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
| | | {
|
| | | return error("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´");
|
| | | }
|
| | | menu.setCreateBy(getUsername());
|
| | | return toAjax(menuService.insertMenu(menu));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹èå
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
| | | @Log(title = "èå管ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨");
|
| | | }
|
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
| | | {
|
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´");
|
| | | }
|
| | | else if (menu.getMenuId().equals(menu.getParentId()))
|
| | | {
|
| | | return error("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼ä¸çº§èåä¸è½éæ©èªå·±");
|
| | | }
|
| | | menu.setUpdateBy(getUsername());
|
| | | return toAjax(menuService.updateMenu(menu));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤èå
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
| | | @Log(title = "èå管ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{menuId}")
|
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
| | | {
|
| | | if (menuService.hasChildByMenuId(menuId))
|
| | | {
|
| | | return warn("åå¨åèå,ä¸å
许å é¤");
|
| | | }
|
| | | if (menuService.checkMenuExistRole(menuId))
|
| | | {
|
| | | return warn("èåå·²åé
,ä¸å
许å é¤");
|
| | | }
|
| | | return toAjax(menuService.deleteMenuById(menuId));
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | 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.project.system.domain.SysMenu; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * èåä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | @AllArgsConstructor |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | private ISysMenuService menuService; |
| | | |
| | | /** |
| | | * è·åèåå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')") |
| | | @GetMapping("/list") |
| | | public R<?> list(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return R.ok(menus); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®èåç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public R<?> getInfo(@PathVariable Long menuId) |
| | | { |
| | | return R.ok(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åèå䏿æ å表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public R<?> treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return R.ok(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | |
| | | /** |
| | | * å 载对åºè§è²èåå表æ |
| | | */ |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public R<?> roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | map.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return R.fail("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return R.fail("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | | menuService.insertMenu(menu); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼ä¸çº§èåä¸è½éæ©èªå·±"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | | menuService.updateMenu(menu); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èå |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "èå管ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public R<?> remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "åå¨åèå,ä¸å
许å é¤"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "èåå·²åé
,ä¸å
许å é¤"); |
| | | } |
| | | menuService.deleteMenuById(menuId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.metadata.IPage;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import io.swagger.v3.oas.annotations.Operation;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | | 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.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysNotice;
|
| | | import com.ruoyi.project.system.service.ISysNoticeService;
|
| | |
|
| | | /**
|
| | | * å
¬å ä¿¡æ¯æä½å¤ç
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/notice")
|
| | | @AllArgsConstructor
|
| | | public class SysNoticeController extends BaseController {
|
| | | private ISysNoticeService noticeService;
|
| | |
|
| | | /**
|
| | | * è·åéç¥å
¬åå表
|
| | | */
|
| | | @GetMapping("/list")
|
| | | public R<IPage<SysNotice>> list(SysNotice notice, Page page) {
|
| | | IPage<SysNotice> list = noticeService.selectNoticeList(notice, page);
|
| | | return R.ok(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åæªè¯»æ°é
|
| | | */
|
| | | @GetMapping("/getCount")
|
| | | public R getCount(Long consigneeId) {
|
| | | return R.ok(noticeService.getCount(consigneeId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®éç¥å
¬åç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @GetMapping(value = "/{noticeId}")
|
| | | public AjaxResult getInfo(@PathVariable Long noticeId) {
|
| | | return success(noticeService.selectNoticeById(noticeId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢éç¥å
Œ
|
| | | */
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) {
|
| | | return toAjax(noticeService.insertNotice(notice));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹éç¥å
Œ
|
| | | */
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
|
| | | return toAjax(noticeService.updateNotice(notice));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤éç¥å
Œ
|
| | | */
|
| | | @DeleteMapping("/{noticeIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¸é®å·²è¯»
|
| | | */
|
| | | @PostMapping("/readAll")
|
| | | public AjaxResult readAll() {
|
| | | return toAjax(noticeService.readAll());
|
| | | }
|
| | |
|
| | | @PostMapping("appReadNotice")
|
| | | @Operation(summary = "ç§»å¨ç«¯æ ¹æ®æ¶æ¯IDè¿è¡å·²è¯»")
|
| | | public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
|
| | | boolean result = noticeService.appReadNotice(noticeId);
|
| | | return toAjax(result);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | 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.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * å
¬å ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | @AllArgsConstructor |
| | | public class SysNoticeController extends BaseController { |
| | | private ISysNoticeService noticeService; |
| | | |
| | | /** |
| | | * è·åéç¥å
¬åå表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public R<IPage<SysNotice>> list(SysNotice notice, Page page) { |
| | | IPage<SysNotice> list = noticeService.selectNoticeList(notice, page); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * è·åæªè¯»æ°é |
| | | */ |
| | | @GetMapping("/getCount") |
| | | public R getCount(Long consigneeId) { |
| | | return R.ok(noticeService.getCount(consigneeId)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®éç¥å
¬åç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{noticeId}") |
| | | public R<?> getInfo(@PathVariable Long noticeId) { |
| | | return R.ok(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢éç¥å
Œ |
| | | */ |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysNotice notice) { |
| | | noticeService.insertNotice(notice); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹éç¥å
Œ |
| | | */ |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysNotice notice) { |
| | | noticeService.updateNotice(notice); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éç¥å
Œ |
| | | */ |
| | | @DeleteMapping("/{noticeIds}") |
| | | public R<?> remove(@PathVariable Long[] noticeIds) { |
| | | noticeService.deleteNoticeByIds(noticeIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¸é®å·²è¯» |
| | | */ |
| | | @PostMapping("/readAll") |
| | | public R<?> readAll() { |
| | | noticeService.readAll(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("appReadNotice") |
| | | @Operation(summary = "ç§»å¨ç«¯æ ¹æ®æ¶æ¯IDè¿è¡å·²è¯»") |
| | | public R<?> appReadNotice(@RequestParam("noticeId") Long noticeId) { |
| | | noticeService.appReadNotice(noticeId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysPost;
|
| | | import com.ruoyi.project.system.service.ISysPostService;
|
| | |
|
| | | /**
|
| | | * å²ä½ä¿¡æ¯æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/post")
|
| | | @AllArgsConstructor
|
| | | public class SysPostController extends BaseController
|
| | | {
|
| | | private ISysPostService postService;
|
| | |
|
| | | /**
|
| | | * è·åå²ä½å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysPost post)
|
| | | {
|
| | | startPage();
|
| | | List<SysPost> list = postService.selectPostList(post);
|
| | | return getDataTable(list);
|
| | | }
|
| | | /**
|
| | | * 导åºå²ä½å表
|
| | | */
|
| | | |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:post:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysPost post)
|
| | | {
|
| | | List<SysPost> list = postService.selectPostList(post);
|
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
| | | util.exportExcel(response, list, "å²ä½æ°æ®");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®å²ä½ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:query')")
|
| | | @GetMapping(value = "/{postId}")
|
| | | public AjaxResult getInfo(@PathVariable Long postId)
|
| | | {
|
| | | return success(postService.selectPostById(postId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢å²ä½
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:add')")
|
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | }
|
| | | post.setCreateBy(getUsername());
|
| | | return toAjax(postService.insertPost(post));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹å²ä½
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')")
|
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | }
|
| | | post.setUpdateBy(getUsername());
|
| | | return toAjax(postService.updatePost(post));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤å²ä½
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')")
|
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{postIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] postIds)
|
| | | {
|
| | | return toAjax(postService.deletePostByIds(postIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åå²ä½éæ©æ¡å表
|
| | | */
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | List<SysPost> posts = postService.selectPostAll();
|
| | | return success(posts);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysPost; |
| | | import com.ruoyi.project.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | @AllArgsConstructor |
| | | public class SysPostController extends BaseController |
| | | { |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * è·åå²ä½å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | /** |
| | | * 导åºå²ä½å表 |
| | | */ |
| | | |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysPost post) |
| | | { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | util.exportExcel(response, list, "å²ä½æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å²ä½ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public R<?> getInfo(@PathVariable Long postId) |
| | | { |
| | | return R.ok(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return R.fail("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return R.fail("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | postService.insertPost(post); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return R.fail("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return R.fail("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | postService.updatePost(post); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å²ä½ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public R<?> remove(@PathVariable Long[] postIds) |
| | | { |
| | | postService.deletePostByIds(postIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå²ä½éæ©æ¡å表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return R.ok(posts); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.file.FileUploadUtils;
|
| | | import com.ruoyi.common.utils.file.MimeTypeUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.config.RuoYiConfig;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * ä¸ªäººä¿¡æ¯ ä¸å¡å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/user/profile")
|
| | | @AllArgsConstructor
|
| | | public class SysProfileController extends BaseController
|
| | | {
|
| | | private ISysUserService userService;
|
| | | private TokenService tokenService;
|
| | |
|
| | | /**
|
| | | * 个人信æ¯
|
| | | */
|
| | | @GetMapping
|
| | | public AjaxResult profile()
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | AjaxResult ajax = AjaxResult.success(user);
|
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ç¨æ·
|
| | | */
|
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult updateProfile(@RequestBody SysUser user)
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | SysUser currentUser = loginUser.getUser();
|
| | | currentUser.setNickName(user.getNickName());
|
| | | currentUser.setEmail(user.getEmail());
|
| | | currentUser.setPhonenumber(user.getPhonenumber());
|
| | | currentUser.setSex(user.getSex());
|
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | }
|
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | }
|
| | | if (userService.updateUserProfile(currentUser) > 0)
|
| | | {
|
| | | // æ´æ°ç¼åç¨æ·ä¿¡æ¯
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return success();
|
| | | }
|
| | | return error("ä¿®æ¹ä¸ªäººä¿¡æ¯å¼å¸¸ï¼è¯·è系管çå");
|
| | | }
|
| | |
|
| | | /**
|
| | | * éç½®å¯ç
|
| | | */
|
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/updatePwd")
|
| | | public AjaxResult updatePwd(@RequestBody Map<String, String> params)
|
| | | {
|
| | | String oldPassword = params.get("oldPassword");
|
| | | String newPassword = params.get("newPassword");
|
| | | LoginUser loginUser = getLoginUser();
|
| | | String userName = loginUser.getUsername();
|
| | | String password = loginUser.getPassword();
|
| | | if (!SecurityUtils.matchesPassword(oldPassword, password))
|
| | | {
|
| | | return error("ä¿®æ¹å¯ç å¤±è´¥ï¼æ§å¯ç é误");
|
| | | }
|
| | | if (SecurityUtils.matchesPassword(newPassword, password))
|
| | | {
|
| | | return error("æ°å¯ç ä¸è½ä¸æ§å¯ç ç¸å");
|
| | | }
|
| | | newPassword = SecurityUtils.encryptPassword(newPassword);
|
| | | if (userService.resetUserPwd(userName, newPassword) > 0)
|
| | | {
|
| | | // æ´æ°ç¼åç¨æ·å¯ç
|
| | | loginUser.getUser().setPassword(newPassword);
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return success();
|
| | | }
|
| | | return error("ä¿®æ¹å¯ç å¼å¸¸ï¼è¯·è系管çå");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 头åä¸ä¼
|
| | | */
|
| | | @Log(title = "ç¨æ·å¤´å", businessType = BusinessType.UPDATE)
|
| | | @PostMapping("/avatar")
|
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
| | | {
|
| | | if (!file.isEmpty())
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("imgUrl", avatar);
|
| | | // æ´æ°ç¼åç¨æ·å¤´å
|
| | | loginUser.getUser().setAvatar(avatar);
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | return error("ä¸ä¼ å¾çå¼å¸¸ï¼è¯·è系管çå");
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.config.RuoYiConfig; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * ä¸ªäººä¿¡æ¯ ä¸å¡å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | @AllArgsConstructor |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | private ISysUserService userService; |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * ä¸ªäººä¿¡æ¯ |
| | | */ |
| | | @GetMapping |
| | | public R<?> profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", user); |
| | | map.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | map.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ· |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> updateProfile(@RequestBody SysUser user) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser currentUser = loginUser.getUser(); |
| | | currentUser.setNickName(user.getNickName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return R.fail("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return R.fail("ä¿®æ¹ç¨æ·'" + loginUser.getUsername() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | if (userService.updateUserProfile(currentUser) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·ä¿¡æ¯ |
| | | tokenService.setLoginUser(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("ä¿®æ¹ä¸ªäººä¿¡æ¯å¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * éç½®å¯ç |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public R<?> updatePwd(@RequestBody Map<String, String> params) |
| | | { |
| | | String oldPassword = params.get("oldPassword"); |
| | | String newPassword = params.get("newPassword"); |
| | | LoginUser loginUser = getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | String password = loginUser.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | return R.fail("ä¿®æ¹å¯ç å¤±è´¥ï¼æ§å¯ç é误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | return R.fail("æ°å¯ç ä¸è½ä¸æ§å¯ç ç¸å"); |
| | | } |
| | | newPassword = SecurityUtils.encryptPassword(newPassword); |
| | | if (userService.resetUserPwd(userName, newPassword) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·å¯ç |
| | | loginUser.getUser().setPassword(newPassword); |
| | | tokenService.setLoginUser(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("ä¿®æ¹å¯ç å¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * 头åä¸ä¼ |
| | | */ |
| | | @Log(title = "ç¨æ·å¤´å", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public R<?> avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·å¤´å |
| | | loginUser.getUser().setAvatar(avatar); |
| | | tokenService.setLoginUser(loginUser); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("imgUrl", avatar); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | | return R.fail("ä¸ä¼ å¾çå¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.security.RegisterBody;
|
| | | import com.ruoyi.framework.security.service.SysRegisterService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | /**
|
| | | * 注åéªè¯
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @AllArgsConstructor
|
| | | public class SysRegisterController extends BaseController {
|
| | | private SysRegisterService registerService;
|
| | | private ISysConfigService configService;
|
| | |
|
| | | @PostMapping("/register")
|
| | | public AjaxResult register(@RequestBody RegisterBody user) {
|
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
| | | return error("å½åç³»ç»æ²¡æå¼å¯æ³¨ååè½ï¼");
|
| | | }
|
| | | String msg = registerService.register(user);
|
| | | return StringUtils.isEmpty(msg) ? success() : error(msg);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.RegisterBody; |
| | | import com.ruoyi.framework.security.service.SysRegisterService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 注åéªè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class SysRegisterController extends BaseController { |
| | | private SysRegisterService registerService; |
| | | private ISysConfigService configService; |
| | | |
| | | @PostMapping("/register") |
| | | public R<?> register(@RequestBody RegisterBody user) { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { |
| | | return R.fail("å½åç³»ç»æ²¡æå¼å¯æ³¨ååè½ï¼"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? R.ok() : R.fail(msg); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | 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.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.SysPermissionService;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.SysUserRole;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | | import com.ruoyi.project.system.service.ISysRoleService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | |
|
| | | /**
|
| | | * è§è²ä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/role")
|
| | | @AllArgsConstructor
|
| | | public class SysRoleController extends BaseController
|
| | | {
|
| | | private ISysRoleService roleService;
|
| | | private TokenService tokenService;
|
| | | private SysPermissionService permissionService;
|
| | | private ISysUserService userService;
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysRole role)
|
| | | {
|
| | | startPage();
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:role:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysRole role)
|
| | | {
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
| | | util.exportExcel(response, list, "è§è²æ°æ®");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®è§è²ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping(value = "/{roleId}")
|
| | | public AjaxResult getInfo(@PathVariable Long roleId)
|
| | | {
|
| | | roleService.checkRoleDataScope(roleId);
|
| | | return success(roleService.selectRoleById(roleId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢è§è²
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:add')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | }
|
| | | role.setCreateBy(getUsername());
|
| | | return toAjax(roleService.insertRole(role));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ä¿åè§è²
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | }
|
| | | role.setUpdateBy(getUsername());
|
| | | |
| | | if (roleService.updateRole(role) > 0)
|
| | | {
|
| | | // æ´æ°ç¼åç¨æ·æé
|
| | | LoginUser loginUser = getLoginUser();
|
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
| | | {
|
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
| | | tokenService.setLoginUser(loginUser);
|
| | | }
|
| | | return success();
|
| | | }
|
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è¯·è系管çå");
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ä¿åæ°æ®æé
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/dataScope")
|
| | | public AjaxResult dataScope(@RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | return toAjax(roleService.authDataScope(role));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ç¶æä¿®æ¹
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | role.setUpdateBy(getUsername());
|
| | | return toAjax(roleService.updateRoleStatus(role));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤è§è²
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{roleIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] roleIds)
|
| | | {
|
| | | return toAjax(roleService.deleteRoleByIds(roleIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åè§è²éæ©æ¡å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | return success(roleService.selectRoleAll());
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢å·²åé
ç¨æ·è§è²å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/allocatedList")
|
| | | public TableDataInfo allocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectAllocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢æªåé
ç¨æ·è§è²å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/unallocatedList")
|
| | | public TableDataInfo unallocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectUnallocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * åæ¶ææç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancel")
|
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUser(userRole));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹éåæ¶ææç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancelAll")
|
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹ééæ©ç¨æ·ææ
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/selectAll")
|
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | roleService.checkRoleDataScope(roleId);
|
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å对åºè§è²é¨é¨æ å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping(value = "/deptTree/{roleId}")
|
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | 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.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.SysPermissionService; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysRole; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.SysUserRole; |
| | | |
| | | /** |
| | | * è§è²ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | @AllArgsConstructor |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | private ISysRoleService roleService; |
| | | private TokenService tokenService; |
| | | private SysPermissionService permissionService; |
| | | private ISysUserService userService; |
| | | private ISysDeptService deptService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysRole role) |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | util.exportExcel(response, list, "è§è²æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public R<?> getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return R.ok(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return R.fail("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return R.fail("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨"); |
| | | } |
| | | role.setCreateBy(getUsername()); |
| | | roleService.insertRole(role); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return R.fail("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return R.fail("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·æé |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.fail("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è¯·è系管çå"); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åæ°æ®æé |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public R<?> dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | roleService.authDataScope(role); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | role.setUpdateBy(getUsername()); |
| | | roleService.updateRoleStatus(role); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public R<?> remove(@PathVariable Long[] roleIds) |
| | | { |
| | | roleService.deleteRoleByIds(roleIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·åè§è²éæ©æ¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | return R.ok(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åé
ç¨æ·è§è²å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æªåé
ç¨æ·è§è²å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶ææç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public R<?> cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | roleService.deleteAuthUser(userRole); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éåæ¶ææç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public R<?> cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.deleteAuthUsers(roleId, userIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * æ¹ééæ©ç¨æ·ææ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public R<?> selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | roleService.insertAuthUsers(roleId, userIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·å对åºè§è²é¨é¨æ å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public R<?> deptTree(@PathVariable("roleId") Long roleId) |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | map.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.GetuiConfig; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUserClient; |
| | | import com.ruoyi.project.system.service.SysUserClientService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | */ |
| | | @PostMapping("/addOrUpdateClientId") |
| | | @Operation(summary = "æ·»å /æ´æ°ç¨æ·cid") |
| | | public AjaxResult addOrUpdateClientId(@RequestBody SysUserClient sysUserClient) { |
| | | public R<?> addOrUpdateClientId(@RequestBody SysUserClient sysUserClient) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | sysUserClient.setUserId(userId); |
| | | boolean result = sysUserClientService.addOrUpdateClientId(sysUserClient); |
| | | return result ? success() : error("设å¤ç»å®å¤±è´¥"); |
| | | return result ? R.ok() : R.fail("设å¤ç»å®å¤±è´¥"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | |
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import com.ruoyi.project.system.service.*;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | |
|
| | | /**
|
| | | * ç¨æ·ä¿¡æ¯
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/user")
|
| | | @AllArgsConstructor
|
| | | public class SysUserController extends BaseController
|
| | | {
|
| | | private ISysUserService userService;
|
| | | private ISysRoleService roleService;
|
| | | private ISysDeptService deptService;
|
| | | private ISysPostService postService;
|
| | | private ISysUserDeptService userDeptService;
|
| | |
|
| | | /**
|
| | | * è·åç¨æ·å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åç¨æ·å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/listAll")
|
| | | public AjaxResult listAll(SysUser user)
|
| | | {
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | return AjaxResult.success(list);
|
| | | }
|
| | |
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:user:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysUser user)
|
| | | {
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | util.exportExcel(response, list, "ç¨æ·æ°æ®");
|
| | | }
|
| | |
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.IMPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:user:import')")
|
| | | @PostMapping("/importData")
|
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
| | | {
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | List<SysUser> userList = util.importExcel(file.getInputStream());
|
| | | String operName = getUsername();
|
| | | String message = userService.importUser(userList, updateSupport, operName);
|
| | | return success(message);
|
| | | }
|
| | |
|
| | | @PostMapping("/importTemplate")
|
| | | public void importTemplate(HttpServletResponse response)
|
| | | {
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | util.importTemplateExcel(response, "ç¨æ·æ°æ®");
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®ç¨æ·ç¼å·è·å详ç»ä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:query')")
|
| | | @GetMapping(value = { "/", "/{userId}" })
|
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | if (StringUtils.isNotNull(userId))
|
| | | {
|
| | | userService.checkUserDataScope(userId);
|
| | | SysUser sysUser = userService.selectUserById(userId);
|
| | | ajax.put(AjaxResult.DATA_TAG, sysUser);
|
| | | ajax.put("postIds", postService.selectPostListByUserId(userId));
|
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
| | | }
|
| | | List<SysRole> roles = roleService.selectRoleAll();
|
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
| | | ajax.put("posts", postService.selectPostAll());
|
| | | SysUserDeptVo sysUserDeptVo = new SysUserDeptVo();
|
| | | sysUserDeptVo.setUserId(userId);
|
| | | List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo);
|
| | | ajax.put("deptIds",sysUserDeptVos.stream().map(SysUserDeptVo::getDeptId).collect(Collectors.toList()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ°å¢ç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:add')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | }
|
| | | user.setCreateBy(getUsername());
|
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
| | | user.setTenantId(user.getDeptId());
|
| | | return toAjax(userService.insertUser(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | }
|
| | | user.setUpdateBy(getUsername());
|
| | | userService.bindUserDept(user);
|
| | | return toAjax(userService.updateUser(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤ç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{userIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] userIds)
|
| | | {
|
| | | if (ArrayUtils.contains(userIds, getUserId()))
|
| | | {
|
| | | return error("å½åç¨æ·ä¸è½å é¤");
|
| | | }
|
| | | return toAjax(userService.deleteUserByIds(userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * éç½®å¯ç
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/resetPwd")
|
| | | public AjaxResult resetPwd(@RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
| | | user.setUpdateBy(getUsername());
|
| | | return toAjax(userService.resetPwd(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ç¶æä¿®æ¹
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | user.setUpdateBy(getUsername());
|
| | | return toAjax(userService.updateUserStatus(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®ç¨æ·ç¼å·è·åææè§è²
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:query')")
|
| | | @GetMapping("/authRole/{userId}")
|
| | | public AjaxResult authRole(@PathVariable("userId") Long userId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | SysUser user = userService.selectUserById(userId);
|
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
| | | ajax.put("user", user);
|
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * ç¨æ·ææè§è²
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authRole")
|
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
| | | {
|
| | | userService.checkUserDataScope(userId);
|
| | | roleService.checkRoleDataScope(roleIds);
|
| | | userService.insertUserAuth(userId, roleIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åé¨é¨æ å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/deptTree")
|
| | | public AjaxResult deptTree(SysDept dept)
|
| | | {
|
| | | return success(deptService.selectDeptTreeList(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¸åé¡µç¨æ·æ¥è¯¢
|
| | | * @param user
|
| | | * @return
|
| | | */
|
| | | @GetMapping("/userListNoPage")
|
| | | public AjaxResult userListNoPage(SysUser user){
|
| | | List<SysUser> sysUserList = userService.userListNoPage(user);
|
| | | return AjaxResult.success(sysUserList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢å½åç¨æ·å
¬å¸ä¸ææç¨æ·
|
| | | * @param user
|
| | | * @return
|
| | | */
|
| | | @GetMapping("/userListNoPageByTenantId")
|
| | | public AjaxResult userListNoPageByTenantId(SysUser user){
|
| | | //è·åç»å½ç¨æ·ä¿¡æ¯
|
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
| | | user.setTenantId(loginUser.getTenantId());
|
| | | List<SysUser> sysUserList = userService.userListNoPage(user);
|
| | | return AjaxResult.success(sysUserList);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysRole; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.service.*; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | @AllArgsConstructor |
| | | public class SysUserController extends BaseController |
| | | { |
| | | private ISysUserService userService; |
| | | private ISysRoleService roleService; |
| | | private ISysDeptService deptService; |
| | | private ISysPostService postService; |
| | | private ISysUserDeptService userDeptService; |
| | | |
| | | /** |
| | | * è·åç¨æ·å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/listAll") |
| | | public R<?> listAll(SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.exportExcel(response, list, "ç¨æ·æ°æ®"); |
| | | } |
| | | |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | | public R<?> importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | String operName = getUsername(); |
| | | String message = userService.importUser(userList, updateSupport, operName); |
| | | return R.ok(null, message); |
| | | } |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.importTemplateExcel(response, "ç¨æ·æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping(value = { "/", "/{userId}" }) |
| | | public R<?> getInfo(@PathVariable(value = "userId", required = false) Long userId) |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (StringUtils.isNotNull(userId)) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | map.put("data", sysUser); |
| | | map.put("postIds", postService.selectPostListByUserId(userId)); |
| | | map.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | | } |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | | map.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | map.put("posts", postService.selectPostAll()); |
| | | SysUserDeptVo sysUserDeptVo = new SysUserDeptVo(); |
| | | sysUserDeptVo.setUserId(userId); |
| | | List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo); |
| | | map.put("deptIds",sysUserDeptVos.stream().map(SysUserDeptVo::getDeptId).collect(Collectors.toList())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysUser user) |
| | | { |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return R.fail("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return R.fail("æ°å¢ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return R.fail("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setTenantId(user.getDeptId()); |
| | | return R.ok(userService.insertUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return R.fail("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return R.fail("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return R.fail("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨"); |
| | | } |
| | | user.setUpdateBy(getUsername()); |
| | | userService.bindUserDept(user); |
| | | return R.ok(userService.updateUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¨æ· |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | public R<?> remove(@PathVariable Long[] userIds) |
| | | { |
| | | if (ArrayUtils.contains(userIds, getUserId())) |
| | | { |
| | | return R.fail("å½åç¨æ·ä¸è½å é¤"); |
| | | } |
| | | return R.ok(userService.deleteUserByIds(userIds)) ; |
| | | } |
| | | |
| | | /** |
| | | * éç½®å¯ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public R<?> resetPwd(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return R.ok(userService.resetPwd(user)); |
| | | } |
| | | |
| | | /** |
| | | * ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setUpdateBy(getUsername()); |
| | | return R.ok(userService.updateUserStatus(user)) ; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·ç¼å·è·åææè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public R<?> authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | map.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·ææè§è² |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public R<?> insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | roleService.checkRoleDataScope(roleIds); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·åé¨é¨æ å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public R<?> deptTree(SysDept dept) |
| | | { |
| | | return R.ok(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åé¡µç¨æ·æ¥è¯¢ |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/userListNoPage") |
| | | public R<?> userListNoPage(SysUser user){ |
| | | List<SysUser> sysUserList = userService.userListNoPage(user); |
| | | return R.ok(sysUserList); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·å
¬å¸ä¸ææç¨æ· |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/userListNoPageByTenantId") |
| | | public R<?> userListNoPageByTenantId(SysUser user){ |
| | | //è·åç»å½ç¨æ·ä¿¡æ¯ |
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser(); |
| | | user.setTenantId(loginUser.getTenantId()); |
| | | List<SysUser> sysUserList = userService.userListNoPage(user); |
| | | return R.ok(sysUserList); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.tool.gen.controller;
|
| | |
|
| | | import com.alibaba.druid.DbType;
|
| | | import com.alibaba.druid.sql.SQLUtils;
|
| | | import com.alibaba.druid.sql.ast.SQLStatement;
|
| | | import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
|
| | | import com.ruoyi.common.core.text.Convert;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.sql.SqlUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.config.GenConfig;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.tool.gen.domain.GenTable;
|
| | | import com.ruoyi.project.tool.gen.domain.GenTableColumn;
|
| | | import com.ruoyi.project.tool.gen.service.IGenTableColumnService;
|
| | | import com.ruoyi.project.tool.gen.service.IGenTableService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.io.IOUtils;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * 代ç çæ æä½å¤ç
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/tool/gen")
|
| | | @AllArgsConstructor
|
| | | public class GenController extends BaseController
|
| | | {
|
| | | private IGenTableService genTableService;
|
| | | private IGenTableColumnService genTableColumnService;
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢ä»£ç çæå表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo genList(GenTable genTable)
|
| | | {
|
| | | startPage();
|
| | | List<GenTable> list = genTableService.selectGenTableList(genTable);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å代ç çæä¿¡æ¯
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:query')")
|
| | | @GetMapping(value = "/{talbleId}")
|
| | | public AjaxResult getInfo(@PathVariable Long talbleId)
|
| | | {
|
| | | GenTable table = genTableService.selectGenTableById(talbleId);
|
| | | List<GenTable> tables = genTableService.selectGenTableAll();
|
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | map.put("info", table);
|
| | | map.put("rows", list);
|
| | | map.put("tables", tables);
|
| | | return success(map);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢æ°æ®åºå表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping("/db/list")
|
| | | public TableDataInfo dataList(GenTable genTable)
|
| | | {
|
| | | startPage();
|
| | | List<GenTable> list = genTableService.selectDbTableList(genTable);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢æ°æ®è¡¨å段å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping(value = "/column/{tableId}")
|
| | | public TableDataInfo columnList(Long tableId)
|
| | | {
|
| | | TableDataInfo dataInfo = new TableDataInfo();
|
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
| | | dataInfo.setRows(list);
|
| | | dataInfo.setTotal(list.size());
|
| | | return dataInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导å
¥è¡¨ç»æï¼ä¿åï¼
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.IMPORT)
|
| | | @PostMapping("/importTable")
|
| | | public AjaxResult importTableSave(String tables)
|
| | | {
|
| | | String[] tableNames = Convert.toStrArray(tables);
|
| | | // æ¥è¯¢è¡¨ä¿¡æ¯
|
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
| | | genTableService.importGenTable(tableList, SecurityUtils.getUsername());
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * åå»ºè¡¨ç»æï¼ä¿åï¼
|
| | | */
|
| | | @PreAuthorize("@ss.hasRole('admin')")
|
| | | @Log(title = "å建表", businessType = BusinessType.OTHER)
|
| | | @PostMapping("/createTable")
|
| | | public AjaxResult createTableSave(String sql)
|
| | | {
|
| | | try
|
| | | {
|
| | | SqlUtil.filterKeyword(sql);
|
| | | List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
|
| | | List<String> tableNames = new ArrayList<>();
|
| | | for (SQLStatement sqlStatement : sqlStatements)
|
| | | {
|
| | | if (sqlStatement instanceof MySqlCreateTableStatement)
|
| | | {
|
| | | MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
|
| | | if (genTableService.createTable(createTableStatement.toString()))
|
| | | {
|
| | | String tableName = createTableStatement.getTableName().replaceAll("`", "");
|
| | | tableNames.add(tableName);
|
| | | }
|
| | | }
|
| | | }
|
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
|
| | | String operName = SecurityUtils.getUsername();
|
| | | genTableService.importGenTable(tableList, operName);
|
| | | return AjaxResult.success();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | logger.error(e.getMessage(), e);
|
| | | return AjaxResult.error("åå»ºè¡¨ç»æå¼å¸¸");
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹ä¿å代ç çæä¸å¡
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
|
| | | {
|
| | | genTableService.validateEdit(genTable);
|
| | | genTableService.updateGenTable(genTable);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * å é¤ä»£ç çæ
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{tableIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] tableIds)
|
| | | {
|
| | | genTableService.deleteGenTableByIds(tableIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * é¢è§ä»£ç
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
|
| | | @GetMapping("/preview/{tableId}")
|
| | | public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
|
| | | {
|
| | | Map<String, String> dataMap = genTableService.previewCode(tableId);
|
| | | return success(dataMap);
|
| | | }
|
| | |
|
| | | /**
|
| | | * çæä»£ç ï¼ä¸è½½æ¹å¼ï¼
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/download/{tableName}")
|
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
|
| | | {
|
| | | byte[] data = genTableService.downloadCode(tableName);
|
| | | genCode(response, data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/genCode/{tableName}")
|
| | | public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
| | | {
|
| | | if (!GenConfig.isAllowOverwrite())
|
| | | {
|
| | | return AjaxResult.error("ãç³»ç»é¢è®¾ãä¸å
è®¸çææä»¶è¦çå°æ¬å°");
|
| | | }
|
| | | genTableService.generatorCode(tableName);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * åæ¥æ°æ®åº
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.UPDATE)
|
| | | @GetMapping("/synchDb/{tableName}")
|
| | | public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
| | | {
|
| | | genTableService.synchDb(tableName);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹éçæä»£ç
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/batchGenCode")
|
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException
|
| | | {
|
| | | String[] tableNames = Convert.toStrArray(tables);
|
| | | byte[] data = genTableService.downloadCode(tableNames);
|
| | | genCode(response, data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * çæzipæä»¶
|
| | | */
|
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException
|
| | | {
|
| | | response.reset();
|
| | | response.addHeader("Access-Control-Allow-Origin", "*");
|
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
| | | response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
| | | response.addHeader("Content-Length", "" + data.length);
|
| | | response.setContentType("application/octet-stream; charset=UTF-8");
|
| | | IOUtils.write(data, response.getOutputStream());
|
| | | }
|
| | | package com.ruoyi.project.tool.gen.controller; |
| | | |
| | | import com.alibaba.druid.DbType; |
| | | import com.alibaba.druid.sql.SQLUtils; |
| | | import com.alibaba.druid.sql.ast.SQLStatement; |
| | | import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.sql.SqlUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.config.GenConfig; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.tool.gen.domain.GenTable; |
| | | import com.ruoyi.project.tool.gen.domain.GenTableColumn; |
| | | import com.ruoyi.project.tool.gen.service.IGenTableColumnService; |
| | | import com.ruoyi.project.tool.gen.service.IGenTableService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 代ç çæ æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tool/gen") |
| | | @AllArgsConstructor |
| | | public class GenController extends BaseController |
| | | { |
| | | private IGenTableService genTableService; |
| | | private IGenTableColumnService genTableColumnService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä»£ç çæå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo genList(GenTable genTable) |
| | | { |
| | | startPage(); |
| | | List<GenTable> list = genTableService.selectGenTableList(genTable); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * è·å代ç çæä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:query')") |
| | | @GetMapping(value = "/{talbleId}") |
| | | public R<?> getInfo(@PathVariable Long talbleId) |
| | | { |
| | | GenTable table = genTableService.selectGenTableById(talbleId); |
| | | List<GenTable> tables = genTableService.selectGenTableAll(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("info", table); |
| | | map.put("rows", list); |
| | | map.put("tables", tables); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°æ®åºå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/db/list") |
| | | public TableDataInfo dataList(GenTable genTable) |
| | | { |
| | | startPage(); |
| | | List<GenTable> list = genTableService.selectDbTableList(genTable); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°æ®è¡¨å段å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping(value = "/column/{tableId}") |
| | | public TableDataInfo columnList(Long tableId) |
| | | { |
| | | TableDataInfo dataInfo = new TableDataInfo(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); |
| | | dataInfo.setRows(list); |
| | | dataInfo.setTotal(list.size()); |
| | | return dataInfo; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥è¡¨ç»æï¼ä¿åï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importTable") |
| | | public R<?> importTableSave(String tables) |
| | | { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames); |
| | | genTableService.importGenTable(tableList, SecurityUtils.getUsername()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * åå»ºè¡¨ç»æï¼ä¿åï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasRole('admin')") |
| | | @Log(title = "å建表", businessType = BusinessType.OTHER) |
| | | @PostMapping("/createTable") |
| | | public R<?> createTableSave(String sql) |
| | | { |
| | | try |
| | | { |
| | | SqlUtil.filterKeyword(sql); |
| | | List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql); |
| | | List<String> tableNames = new ArrayList<>(); |
| | | for (SQLStatement sqlStatement : sqlStatements) |
| | | { |
| | | if (sqlStatement instanceof MySqlCreateTableStatement) |
| | | { |
| | | MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement; |
| | | if (genTableService.createTable(createTableStatement.toString())) |
| | | { |
| | | String tableName = createTableStatement.getTableName().replaceAll("`", ""); |
| | | tableNames.add(tableName); |
| | | } |
| | | } |
| | | } |
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()])); |
| | | String operName = SecurityUtils.getUsername(); |
| | | genTableService.importGenTable(tableList, operName); |
| | | return R.ok(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(e.getMessage(), e); |
| | | return R.fail("åå»ºè¡¨ç»æå¼å¸¸"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿å代ç çæä¸å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> editSave(@Validated @RequestBody GenTable genTable) |
| | | { |
| | | genTableService.validateEdit(genTable); |
| | | genTableService.updateGenTable(genTable); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä»£ç çæ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:remove')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{tableIds}") |
| | | public R<?> remove(@PathVariable Long[] tableIds) |
| | | { |
| | | genTableService.deleteGenTableByIds(tableIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * é¢è§ä»£ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:preview')") |
| | | @GetMapping("/preview/{tableId}") |
| | | public R<?> preview(@PathVariable("tableId") Long tableId) throws IOException |
| | | { |
| | | Map<String, String> dataMap = genTableService.previewCode(tableId); |
| | | return R.ok(dataMap); |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼ä¸è½½æ¹å¼ï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/download/{tableName}") |
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException |
| | | { |
| | | byte[] data = genTableService.downloadCode(tableName); |
| | | genCode(response, data); |
| | | } |
| | | |
| | | /** |
| | | * çæä»£ç ï¼èªå®ä¹è·¯å¾ï¼ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/genCode/{tableName}") |
| | | public R<?> genCode(@PathVariable("tableName") String tableName) |
| | | { |
| | | if (!GenConfig.isAllowOverwrite()) |
| | | { |
| | | return R.fail("ãç³»ç»é¢è®¾ãä¸å
è®¸çææä»¶è¦çå°æ¬å°"); |
| | | } |
| | | genTableService.generatorCode(tableName); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * åæ¥æ°æ®åº |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.UPDATE) |
| | | @GetMapping("/synchDb/{tableName}") |
| | | public R<?> synchDb(@PathVariable("tableName") String tableName) |
| | | { |
| | | genTableService.synchDb(tableName); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éçæä»£ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代ç çæ", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/batchGenCode") |
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException |
| | | { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | byte[] data = genTableService.downloadCode(tableNames); |
| | | genCode(response, data); |
| | | } |
| | | |
| | | /** |
| | | * çæzipæä»¶ |
| | | */ |
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException |
| | | { |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); |
| | | response.addHeader("Content-Length", "" + data.length); |
| | | response.setContentType("application/octet-stream; charset=UTF-8"); |
| | | IOUtils.write(data, response.getOutputStream()); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.projectManagement.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.dto.InfoStageDto; |
| | | import com.ruoyi.projectManagement.dto.UpdateStateInfo; |
| | | import com.ruoyi.projectManagement.service.InfoService; |
| | |
| | | @RequestMapping("/projectManagement/info") |
| | | @Tag(name = "项ç®ç®¡çä¿¡æ¯è¡¨(项ç®ç®¡çç±»å)") |
| | | @RequiredArgsConstructor |
| | | public class InfoController { |
| | | public class InfoController extends BaseController { |
| | | |
| | | private final InfoService infoService; |
| | | private final InfoStageHandleService infoStageHandleService; |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "ä¿å") |
| | | public AjaxResult save(@RequestBody @Valid SaveInfoVo saveInfoVo) { |
| | | public R<?> save(@RequestBody @Valid SaveInfoVo saveInfoVo) { |
| | | infoService.save(saveInfoVo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/updateStatus") |
| | | @Operation(summary = "ä¿®æ¹ç¶æ") |
| | | public AjaxResult updateStatus(@RequestBody @Valid UpdateStateInfo updateStateInfo){ |
| | | public R<?> updateStatus(@RequestBody @Valid UpdateStateInfo updateStateInfo){ |
| | | infoService.updateStatus(updateStateInfo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | public R<?> delete(@PathVariable Long id) { |
| | | infoService.deleteInfo(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listPage") |
| | | @Operation(summary = "å页å表") |
| | | public AjaxResult listPage(@RequestBody @Valid SearchInfoVo vo) { |
| | | return AjaxResult.success(infoService.searchListInfo(vo)); |
| | | public R<?> listPage(@RequestBody @Valid SearchInfoVo vo) { |
| | | return R.ok(infoService.searchListInfo(vo)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/{id}") |
| | | @Operation(summary = "详æ
") |
| | | public AjaxResult getInfoById(@PathVariable Long id) { |
| | | return AjaxResult.success(infoService.getInfoById(id)); |
| | | public R<?> getInfoById(@PathVariable Long id) { |
| | | return R.ok(infoService.getInfoById(id)); |
| | | } |
| | | |
| | | @PostMapping("/saveStage") |
| | | @Operation(summary = "ä¿åé¶æ®µ") |
| | | public AjaxResult saveStage(@RequestBody @Valid SaveInfoStageVo dto) { |
| | | public R<?> saveStage(@RequestBody @Valid SaveInfoStageVo dto) { |
| | | infoStageHandleService.save(dto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listStage/{id}") |
| | | @Operation(summary = "åè¡¨é¶æ®µ") |
| | | public AjaxResult listStage(@PathVariable Long id) { |
| | | return AjaxResult.success(infoStageHandleService.getListVoByInfoId(id)); |
| | | public R<?> listStage(@PathVariable Long id) { |
| | | return R.ok(infoStageHandleService.getListVoByInfoId(id)); |
| | | } |
| | | |
| | | @PostMapping("/deleteStage/{id}") |
| | | @Operation(summary = "å é¤é¶æ®µ") |
| | | public AjaxResult deleteStage(@PathVariable Long id) { |
| | | public R<?> deleteStage(@PathVariable Long id) { |
| | | infoStageHandleService.deleteById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.projectManagement.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.service.PlanService; |
| | | import com.ruoyi.projectManagement.vo.SavePlanNodeVo; |
| | | import com.ruoyi.projectManagement.vo.SavePlanVo; |
| | |
| | | @RequestMapping("/projectManagement/plan") |
| | | @Tag(name = "项ç®ç®¡ç计å表(项ç®ç®¡çç±»å)") |
| | | @RequiredArgsConstructor |
| | | public class PlanController { |
| | | public class PlanController extends BaseController { |
| | | |
| | | private final PlanService planService; |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "ä¿å") |
| | | public AjaxResult save(@RequestBody @Valid SavePlanVo savePlanVo) { |
| | | public R<?> save(@RequestBody @Valid SavePlanVo savePlanVo) { |
| | | planService.savePlan(savePlanVo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | public R<?> delete(@PathVariable Long id) { |
| | | planService.deletePlan(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listPage") |
| | | @Operation(summary = "å页å表") |
| | | public AjaxResult listPage(@RequestBody SearchPlanVo searchPlanVo) { |
| | | return AjaxResult.success(planService.searchPlan(searchPlanVo)); |
| | | public R<?> listPage(@RequestBody SearchPlanVo searchPlanVo) { |
| | | return R.ok(planService.searchPlan(searchPlanVo)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.dto.RoleDto; |
| | | import com.ruoyi.projectManagement.mapper.RolesMapper; |
| | | import com.ruoyi.projectManagement.pojo.Roles; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("/projectManagement/roles") |
| | | @Tag(name = "") |
| | | public class RolesController { |
| | | public class RolesController extends BaseController { |
| | | |
| | | private RolesService rolesservice; |
| | | private RolesMapper rolesMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢ææ") |
| | | public AjaxResult listPage(Page<Roles> page, Roles roles) { |
| | | return AjaxResult.success(rolesservice.listPage(page, roles)); |
| | | public R<?> listPage(Page<Roles> page, Roles roles) { |
| | | return R.ok(rolesservice.listPage(page, roles)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢") |
| | | public AjaxResult add(@RequestBody RoleDto roleDto) { |
| | | public R<?> add(@RequestBody RoleDto roleDto) { |
| | | if (roleDto.getIsDefaultNo()) { |
| | | roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no")); |
| | | } |
| | | return AjaxResult.success(rolesservice.save(roleDto)); |
| | | return R.ok(rolesservice.save(roleDto)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹") |
| | | public AjaxResult update(@RequestBody Roles roles) { |
| | | return AjaxResult.success(rolesservice.updateById(roles)); |
| | | public R<?> update(@RequestBody Roles roles) { |
| | | return R.ok(rolesservice.updateById(roles)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(rolesservice.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.ok(rolesservice.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @PostMapping("/listSimpleRole") |
| | | public AjaxResult listSimpleRole() { |
| | | return AjaxResult.success(rolesservice.listSimpleRole()); |
| | | public R<?> listSimpleRole() { |
| | | return R.ok(rolesservice.listSimpleRole()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseReportDto; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | |
| | | @Tag(name = "éè´æ¥è¡¨") |
| | | @RequestMapping("/purchase/report") |
| | | @AllArgsConstructor |
| | | public class AccountingReportController { |
| | | public class AccountingReportController extends BaseController { |
| | | |
| | | private IInvoicePurchaseService invoicePurchaseService; |
| | | |
| | | @GetMapping("/list") |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) { |
| | | public R<?> list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) { |
| | | IPage<InvoicePurchaseReportDto> result =invoicePurchaseService.listPurchaseReport(page, invoicePurchaseReportDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦å¯¼åº", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.OTHER) |
| | | @GetMapping("/listVat") |
| | | public AjaxResult listVat(Page page,String month) { |
| | | public R<?> listVat(Page page,String month) { |
| | | IPage<VatDto> result = invoicePurchaseService.listVat(page, month); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseDto; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | |
| | | */ |
| | | @Log(title = "å票信æ¯", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateInvoice") |
| | | public AjaxResult addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException { |
| | | return toAjax(invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto)); |
| | | public R<?> addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException { |
| | | invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "å票信æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delInvoice") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(invoicePurchaseService.delInvoice(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | invoicePurchaseService.delInvoice(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PaymentHistoryRecordVo; |
| | | import com.ruoyi.purchase.dto.PaymentLedgerDto; |
| | |
| | | * è·å仿¬¾ç»è®°è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(paymentRegistrationService.selectPaymentRegistrationById(id)); |
| | | public R<?> getInfo(@PathVariable("id") Long id) { |
| | | return R.ok(paymentRegistrationService.selectPaymentRegistrationById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "仿¬¾ç»è®°", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody List<PaymentRegistration> paymentRegistration) { |
| | | return toAjax(paymentRegistrationService.insertPaymentRegistration(paymentRegistration)); |
| | | public R<?> add(@RequestBody List<PaymentRegistration> paymentRegistration) { |
| | | paymentRegistrationService.insertPaymentRegistration(paymentRegistration); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "仿¬¾ç»è®°", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult edit(@RequestBody PaymentRegistration paymentRegistration) { |
| | | return toAjax(paymentRegistrationService.updatePaymentRegistration(paymentRegistration)); |
| | | public R<?> edit(@RequestBody PaymentRegistration paymentRegistration) { |
| | | paymentRegistrationService.updatePaymentRegistration(paymentRegistration); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "仿¬¾ç»è®°", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/del") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(paymentRegistrationService.deletePaymentRegistrationByIds(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | paymentRegistrationService.deletePaymentRegistrationByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "仿¬¾ç»è®°", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long[] ids) { |
| | | return toAjax(paymentRegistrationService.delete(ids)); |
| | | public R<?> delete(@RequestBody Long[] ids) { |
| | | paymentRegistrationService.delete(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·å仿¬¾ç»è®°è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/byPurchaseId/{id}") |
| | | public AjaxResult getPurchaseInfo(@PathVariable("id") Long id) { |
| | | return success(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id)); |
| | | public R<?> getPurchaseInfo(@PathVariable("id") Long id) { |
| | | return R.ok(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id)); |
| | | } |
| | | |
| | | /** |
| | | * è·å仿¬¾ç»è®°è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/paymentLedgerList") |
| | | public AjaxResult paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page, |
| | | public R<?> paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page, |
| | | Integer detailPageNum, |
| | | Integer detailPageSize) { |
| | | IPage<Map<String, Object>> mapIPage = paymentRegistrationService.selectPaymentLedgerList(paymentLedgerDto, page, detailPageNum, detailPageSize); |
| | | return success(mapIPage); |
| | | return R.ok(mapIPage); |
| | | } |
| | | |
| | | /** |
| | | * ä¾åºå徿¥å页æ¥å£ |
| | | */ |
| | | @GetMapping("/supplierNameListPage") |
| | | public AjaxResult supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){ |
| | | return success(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto)); |
| | | public R<?> supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){ |
| | | return R.ok(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * ä¾åºå徿¥å页æ¥å£ |
| | | */ |
| | | @GetMapping("/supplierNameListPageDetails") |
| | | public AjaxResult supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){ |
| | | return success(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto)); |
| | | public R<?> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){ |
| | | return R.ok(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¬æåºä»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/paymentMonthList") |
| | | public AjaxResult paymentMonthList() { |
| | | return success(paymentRegistrationService.paymentMonthList()); |
| | | public R<?> paymentMonthList() { |
| | | return R.ok(paymentRegistrationService.paymentMonthList()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getPaymentRecordList/{supplierId}") |
| | | public AjaxResult getPaymentRecordList(@PathVariable Long supplierId) { |
| | | public R<?> getPaymentRecordList(@PathVariable Long supplierId) { |
| | | List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationService.getPaymentRecordList(supplierId); |
| | | return success(paymentRecordList); |
| | | return R.ok(paymentRecordList); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto; |
| | | import com.ruoyi.purchase.service.impl.ProcurementBusinessSummaryServiceImpl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | private ProcurementBusinessSummaryServiceImpl procurementBusinessSummaryService; |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, ProcurementBusinessSummaryDto procurementBusinessSummaryDto) { |
| | | return AjaxResult.success(procurementBusinessSummaryService.listPage(page, procurementBusinessSummaryDto)); |
| | | public R<?> listPage(Page page, ProcurementBusinessSummaryDto procurementBusinessSummaryDto) { |
| | | return R.ok(procurementBusinessSummaryService.listPage(page, procurementBusinessSummaryDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | |
| | | @Log(title = "导å
¥éè´å°è´¦", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥éè´å°è´¦") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | public R<?> importData(@RequestParam("file") |
| | | @ApiParam(value = "Excelæä»¶", required = true) |
| | | MultipartFile file) { |
| | | return purchaseLedgerService.importData(file); |
| | |
| | | */ |
| | | @Log(title = "éè´å°è´¦", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditPurchase") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "/æ¥è¯¢éè´æ¨¡æ¿") |
| | | @GetMapping("/getPurchaseTemplateList") |
| | | public AjaxResult getPurchaseTemplateList() { |
| | | public R<?> getPurchaseTemplateList() { |
| | | List<PurchaseLedgerTemplate> purchaseLedgers = purchaseLedgerTemplateMapper.selectList(null); |
| | | purchaseLedgers.forEach(purchaseLedgerDto1 -> { |
| | | LambdaQueryWrapper<SalesLedgerProductTemplate> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | purchaseLedgerDto1.setProductList(list); |
| | | } |
| | | }); |
| | | return AjaxResult.success(purchaseLedgers); |
| | | return R.ok(purchaseLedgers); |
| | | } |
| | | /** |
| | | * ä¿®æ¹éè´å°è´¦å®¡æ¹ç¶æ |
| | | */ |
| | | @PostMapping("/updateApprovalStatus") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | return toAjax(purchaseLedgerService.updateById(purchaseLedger)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | purchaseLedgerService.updateById(purchaseLedger); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * æ¥è¯¢éè´å°è´¦å产åç¶åå表 |
| | |
| | | */ |
| | | @Log(title = "éè´å°è´¦", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delPurchase") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | purchaseLedgerService.deletePurchaseLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * æ ¹æ®éå®ååæ¥è¯¢äº§åä¿¡æ¯ |
| | | */ |
| | | @GetMapping("/getProductBySalesNo") |
| | | public AjaxResult getProductBySalesNo(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getProductBySalesNo(id)); |
| | | public R<?> getProductBySalesNo(Long id) { |
| | | return R.ok(purchaseLedgerService.getProductBySalesNo(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * æ ¹æ®idæ¥è¯¢éè´ååå· |
| | | */ |
| | | @GetMapping("/getPurchaseNoById") |
| | | public AjaxResult getPurchaseNoById(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getPurchaseNoById(id)); |
| | | public R<?> getPurchaseNoById(Long id) { |
| | | return R.ok(purchaseLedgerService.getPurchaseNoById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * æ ¹æ®éè´ååå·æ¥è¯¢äº§å |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return AjaxResult.success(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | public R<?> getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return R.ok(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢éè´å°è´¦å表 |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | public R<?> listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return R.ok(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | } |
| | | |
| | | @Operation(summary = "çæéè´åºåå·") |
| | | @GetMapping("/createPurchaseNo") |
| | | @Log(title = "çæéè´åºåå·", businessType = BusinessType.OTHER) |
| | | public AjaxResult createPurchaseNo() { |
| | | return AjaxResult.success("çææå",purchaseLedgerService.getPurchaseNo()); |
| | | public R<?> createPurchaseNo() { |
| | | return R.ok(purchaseLedgerService.getPurchaseNo(), "çææå"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | | import com.ruoyi.purchase.mapper.SalesLedgerProductTemplateMapper; |
| | |
| | | @RequestMapping("/purchaseLedgerTemplate") |
| | | @Tag(name = "éè´å°è´¦æ¨¡æ¿") |
| | | @AllArgsConstructor |
| | | public class PurchaseLedgerTemplateController { |
| | | public class PurchaseLedgerTemplateController extends BaseController { |
| | | |
| | | private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "æ·»å éè´å°è´¦æ¨¡æ¿", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ·»å éè´å°è´¦æ¨¡æ¿") |
| | | public AjaxResult add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // éè´æ¨¡æ¿ |
| | | if(StringUtils.isNotEmpty(purchaseLedgerDto.getTemplateName())){ |
| | | // 模æ¿åç§°ä¸è½éå¤ï¼æéå¤å°±ä¸éè¦æ°å¢äº |
| | |
| | | }); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "éè´å°è´¦æ¨¡æ¿", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤éè´å°è´¦æ¨¡æ¿") |
| | | public AjaxResult delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return AjaxResult.error("è¯·éæ©è¦å é¤çéè´å°è´¦æ¨¡æ¿"); |
| | | public R<?> delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return R.fail("è¯·éæ©è¦å é¤çéè´å°è´¦æ¨¡æ¿"); |
| | | int result = purchaseLedgerTemplateMapper.deleteBatchIds(id); |
| | | salesLedgerProductTemplateMapper.delete(new LambdaQueryWrapper<SalesLedgerProductTemplate>() |
| | | .in(SalesLedgerProductTemplate::getSalesLedgerId, id)); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "ä¿®æ¹éè´å°è´¦æ¨¡æ¿", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹éè´å°è´¦æ¨¡æ¿") |
| | | public AjaxResult update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 模æ¿åç§°ä¸è½éå¤ï¼æéå¤å°±ä¸éè¦æ°å¢äº |
| | | PurchaseLedgerTemplate purchaseLedgerTemplate = purchaseLedgerTemplateMapper |
| | | .selectOne(new LambdaQueryWrapper<PurchaseLedgerTemplate>() |
| | |
| | | salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate); |
| | | }); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | |
| | | @RequestMapping("/purchaseReturnOrders") |
| | | @Tag(name = "éè´éè´§å") |
| | | @AllArgsConstructor |
| | | public class PurchaseReturnOrdersController { |
| | | public class PurchaseReturnOrdersController extends BaseController { |
| | | private PurchaseReturnOrdersService purchaseReturnOrdersService; |
| | | private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return AjaxResult.success(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto)); |
| | | public R<?> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return R.ok(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto)); |
| | | } |
| | | |
| | | // æ°å¢ |
| | | @Log(title = "éè´éè´§å", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception { |
| | | public R<?> add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception { |
| | | if (purchaseReturnOrderDto.getIsDefaultNo()) { |
| | | purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL", "no")); |
| | | } |
| | | return AjaxResult.success(purchaseReturnOrdersService.add(purchaseReturnOrderDto)); |
| | | return R.ok(purchaseReturnOrdersService.add(purchaseReturnOrderDto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/selectById/{id}") |
| | | public AjaxResult selectById(@PathVariable Long id) { |
| | | return AjaxResult.success(purchaseReturnOrdersService.getPurchaseReturnOrderDtoById(id)); |
| | | public R<?> selectById(@PathVariable Long id) { |
| | | return R.ok(purchaseReturnOrdersService.getPurchaseReturnOrderDtoById(id)); |
| | | } |
| | | |
| | | @PostMapping("/deleteById/{id}") |
| | | public AjaxResult deleteById(@PathVariable Long id) { |
| | | public R<?> deleteById(@PathVariable Long id) { |
| | | purchaseReturnOrdersService.deleteById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getByPurchaseLedgerId") |
| | | @Operation(summary = "éè´éè´§-æ ¹æ®éè´è®¢åidæ¥è¯¢éè´è®¢å对åºçå
¥åºäº§åä¿¡æ¯") |
| | | public AjaxResult getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | public R<?> getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | List<PurchaseStockInProductVo> purchaseStockInProductVos = purchaseReturnOrdersService.getByPurchaseLedgerId(purchaseLedgerId); |
| | | return AjaxResult.success(purchaseStockInProductVos); |
| | | return R.ok(purchaseStockInProductVos); |
| | | } |
| | | |
| | | |
| | |
| | | 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 com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | |
| | | |
| | | @Operation(summary = "æ ¹æ®idæ¥è¯¢ä»æ¬¾æµæ°´") |
| | | @GetMapping("/getPaymentRegistrationById") |
| | | public AjaxResult getPaymentRegistrationById(Long id) { |
| | | public R<?> getPaymentRegistrationById(Long id) { |
| | | PaymentRegistration byId = paymentRegistrationService.getById(id); |
| | | return AjaxResult.success(byId); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @Operation(summary = "ä¿®æ¹ä»æ¬¾æµæ°´") |
| | | @PutMapping("/updatePaymentRegistration") |
| | | @Log(title = "ä¿®æ¹ä»æ¬¾æµæ°´", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) { |
| | | return AjaxResult.success(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio)); |
| | | public R<?> updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) { |
| | | return R.ok(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio)); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ä»æ¬¾æµæ°´") |
| | | @DeleteMapping("/delPaymentRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delPaymentRegistration(@RequestBody List<Long> id) { |
| | | return toAjax(paymentRegistrationService.delPaymentRegistration(id)); |
| | | public R<?> delPaymentRegistration(@RequestBody List<Long> id) { |
| | | paymentRegistrationService.delPaymentRegistration(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "æ¥ç¥¨ç»è®°", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult addOrUpdateRegistration(@RequestBody List<TicketRegistrationDto> ticketRegistrationDto) throws IOException { |
| | | if(CollectionUtils.isEmpty(ticketRegistrationDto)) return AjaxResult.error("è¯·éæ©è¦ä¿åçè®°å½"); |
| | | public R<?> addOrUpdateRegistration(@RequestBody List<TicketRegistrationDto> ticketRegistrationDto) throws IOException { |
| | | if(CollectionUtils.isEmpty(ticketRegistrationDto)) return R.fail("è¯·éæ©è¦ä¿åçè®°å½"); |
| | | for (TicketRegistrationDto ticketRegistrationDto1 : ticketRegistrationDto) { |
| | | ticketRegistrationService.addOrUpdateRegistration(ticketRegistrationDto1); |
| | | } |
| | | return toAjax(1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/getProductRecordById") |
| | | public AjaxResult getProductRecordById(@RequestBody ProductRecordDto productRecordDto) { |
| | | public R<?> getProductRecordById(@RequestBody ProductRecordDto productRecordDto) { |
| | | if (productRecordDto.getId() == null) { |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | return AjaxResult.success(productRecordService.getProductRecordById(productRecordDto)); |
| | | return R.ok(productRecordService.getProductRecordById(productRecordDto)); |
| | | } |
| | | |
| | | @Schema(description = "ä¿®æ¹æ¥ç¥¨ç»è®°") |
| | | @PostMapping("/updateRegistration") |
| | | public AjaxResult updateRegistration(@RequestBody ProductRecordDto productRecordDto) { |
| | | public R<?> updateRegistration(@RequestBody ProductRecordDto productRecordDto) { |
| | | |
| | | return productRecordService.updateRecord(productRecordDto); |
| | | } |
| | |
| | | @Log(title = "å 餿¥ç¥¨ç»è®°(æ¥ç¥¨å°è´¦)", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delRegistration(@RequestBody Long[] ids) { |
| | | return toAjax(ticketRegistrationService.delRegistration(ids)); |
| | | public R<?> delRegistration(@RequestBody Long[] ids) { |
| | | ticketRegistrationService.delRegistration(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * å页æ¥è¯¢äº§åä¿¡æ¯å¼ç¥¨è®°å½å表 |
| | | */ |
| | | @GetMapping("/productRecordPage") |
| | | public AjaxResult productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) { |
| | | public R<?> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) { |
| | | |
| | | IPage<ProductRecordDto> list = productRecordService.productRecordPage(page,ticketRegistrationDto); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åç¥¨å· |
| | | */ |
| | | @GetMapping("/getTicketNo") |
| | | public AjaxResult getTicketNo(TicketRegistrationDto ticketRegistrationDto) { |
| | | return AjaxResult.success(ticketRegistrationService.getTicketNo(ticketRegistrationDto)); |
| | | public R<?> getTicketNo(TicketRegistrationDto ticketRegistrationDto) { |
| | | return R.ok(ticketRegistrationService.getTicketNo(ticketRegistrationDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Schema(description = "æ ¹æ®idæ¥è¯¢æ¥æ¼ç»è®°") |
| | | @GetMapping("/getPuargeById") |
| | | public AjaxResult getPuargeById(Long id) { |
| | | return AjaxResult.success(ticketRegistrationService.getPuargeById( id)); |
| | | public R<?> getPuargeById(Long id) { |
| | | return R.ok(ticketRegistrationService.getPuargeById( id)); |
| | | } |
| | | |
| | | |
| | |
| | | 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.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseReturnVo; |
| | | import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | |
| | | 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.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | |
| | | |
| | | IPage<ProductRecordDto> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto); |
| | | |
| | | AjaxResult updateRecord(ProductRecordDto productRecordDto); |
| | | R<?> updateRecord(ProductRecordDto productRecordDto); |
| | | |
| | | ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | |
| | | |
| | | String getPurchaseNo(); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | |
| | | PurchaseLedgerDto getPurchaseByCode(PurchaseLedgerDto purchaseLedgerDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.mapper.ProductRecordMapper; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateRecord(ProductRecordDto productRecordDto) { |
| | | public R<?> updateRecord(ProductRecordDto productRecordDto) { |
| | | ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId()); |
| | | if (productRecord == null) return AjaxResult.error("è®°å½ä¸åå¨"); |
| | | if (productRecord == null) return R.fail("è®°å½ä¸åå¨"); |
| | | |
| | | // æ´æ°äº§åå°è´¦ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId()); |
| | |
| | | productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice())); |
| | | productRecordMapper.updateById(productRecord); |
| | | |
| | | return AjaxResult.success("ä¿®æ¹æå"); |
| | | return R.ok(null, "ä¿®æ¹æå"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelUtil<PurchaseLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(PurchaseLedgerImportDto.class); |
| | | Map<String, List<PurchaseLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("éè´å°è´¦æ°æ®", "éè´äº§åæ°æ®"), inputStream, 0); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("éè´è¡¨æ ¼ä¸ºç©ºï¼"); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return R.fail("éè´è¡¨æ ¼ä¸ºç©ºï¼"); |
| | | // ä¸å¡å±åå¹¶ |
| | | List<PurchaseLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("éè´å°è´¦æ°æ®"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("éè´å°è´¦æ°æ®ä¸ºç©ºï¼"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return R.fail("éè´å°è´¦æ°æ®ä¸ºç©ºï¼"); |
| | | List<PurchaseLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("éè´äº§åæ°æ®"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("éè´äº§åæ°æ®ä¸ºç©ºï¼"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return R.fail("éè´äº§åæ°æ®ä¸ºç©ºï¼"); |
| | | // ä¾åºåæ°æ® |
| | | List<SupplierManage> customers = supplierManageMapper.selectList(new LambdaQueryWrapper<SupplierManage>().in(SupplierManage::getSupplierName, |
| | | salesLedgerImportDtoList.stream().map(PurchaseLedgerImportDto::getSupplierName).collect(Collectors.toList()))); |
| | |
| | | addApproveByPurchase(loginUser,salesLedger); |
| | | } |
| | | |
| | | return AjaxResult.success("导å
¥æå"); |
| | | return R.ok(null, "导å
¥æå"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return AjaxResult.success("导å
¥å¤±è´¥"); |
| | | return R.ok(null, "导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | updateWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id); |
| | | purchaseReturnOrderProductsMapper.delete(updateWrapper); |
| | | //(éè´éè´§çæ°æ®éè¦å æ) |
| | | stockOutRecordMapper.delete(Wrappers.<StockOutRecord>lambdaQuery() |
| | | .eq(StockOutRecord::getRecordType,StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode()) |
| | | .in(StockOutRecord::getRecordId, purchaseReturnOrderProducts.stream().map(PurchaseReturnOrderProducts::getId).collect(Collectors.toList()))); |
| | | purchaseReturnOrderProducts.stream().forEach(purchaseReturnOrderProducts1 -> { |
| | | stockUtils.deleteStockOutRecord(purchaseReturnOrderProducts1.getId(),StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode()); |
| | | }); |
| | | // è´¢å¡ |
| | | LambdaUpdateWrapper<AccountIncome> updateWrapperAccountIncome = new LambdaUpdateWrapper<>(); |
| | | updateWrapperAccountIncome.eq(AccountIncome::getBusinessId, id); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.add(qualityInspectDto)); |
| | | @Operation(summary = "æ°å¢æ£éª") |
| | | @Log(title = "æ°å¢æ£éª", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return R.ok(qualityInspectService.add(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å 餿£éª") |
| | | @Log(title = "å 餿£éª", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å¦æå·²ç»æäº¤å°±ä¸å
许å é¤ |
| | | List<QualityInspect> qualityInspects = qualityInspectService.listByIds(ids); |
| | |
| | | qualityInspectFileService.remove(Wrappers.<QualityInspectFile>lambdaQuery() |
| | | .in(QualityInspectFile::getInspectId, ids)); |
| | | //å 餿£éªå |
| | | return AjaxResult.success(qualityInspectService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult QualityInspectDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(qualityInspectService.getDetailById(id)); |
| | | @Operation(summary = "æ£éªè¯¦æ
") |
| | | @Log(title = "æ£éªè¯¦æ
", businessType = BusinessType.OTHER) |
| | | public R<?> QualityInspectDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(qualityInspectService.getDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.updateQualityInspect(qualityInspectDto)); |
| | | @Operation(summary = "ä¿®æ¹æ£éª") |
| | | @Log(title = "ä¿®æ¹æ£éª", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return R.ok(qualityInspectService.updateQualityInspect(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectListPage(Page page, QualityInspectDto qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.qualityInspectListPage(page, qualityInspect)); |
| | | @Operation(summary = "å页æ¥è¯¢æ£éª") |
| | | @Log(title = "å页æ¥è¯¢æ£éª", businessType = BusinessType.OTHER) |
| | | public R<?> qualityInspectListPage(Page page, QualityInspectDto qualityInspect) { |
| | | return R.ok(qualityInspectService.qualityInspectListPage(page, qualityInspect)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param qualityInspect |
| | | */ |
| | | @PostMapping("/export") |
| | | @Operation(summary = "å¯¼åºæ£éª") |
| | | @Log(title = "å¯¼åºæ£éª", businessType = BusinessType.EXPORT) |
| | | public void qualityInspectExport(HttpServletResponse response, QualityInspect qualityInspect) { |
| | | qualityInspectService.qualityInspectExport(response, qualityInspect); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/submit") |
| | | public AjaxResult submit(@RequestBody QualityInspect qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.submit(qualityInspect)); |
| | | @Operation(summary = "æäº¤æ£éª") |
| | | @Log(title = "æäº¤æ£éª", businessType = BusinessType.OTHER) |
| | | public R<?> submit(@RequestBody QualityInspect qualityInspect) { |
| | | return R.ok(qualityInspectService.submit(qualityInspect)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param qualityInspect |
| | | */ |
| | | @PostMapping("/down") |
| | | @Operation(summary = "ä¸è½½æ£éª") |
| | | @Log(title = "ä¸è½½æ£éª", businessType = BusinessType.OTHER) |
| | | public void down(HttpServletResponse response, @RequestBody QualityInspect qualityInspect) { |
| | | qualityInspectService.down(response, qualityInspect); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityInspectFile qualityInspectFile) { |
| | | return AjaxResult.success(qualityInspectFileService.save(qualityInspectFile)); |
| | | public R<?> add(@RequestBody QualityInspectFile qualityInspectFile) { |
| | | return R.ok(qualityInspectFileService.save(qualityInspectFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(qualityInspectFileService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectFileListPage(Page page, QualityInspectFile qualityInspectFile) { |
| | | return AjaxResult.success(qualityInspectFileService.qualityInspectFileListPage(page, qualityInspectFile)); |
| | | public R<?> qualityInspectFileListPage(Page page, QualityInspectFile qualityInspectFile) { |
| | | return R.ok(qualityInspectFileService.qualityInspectFileListPage(page, qualityInspectFile)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{inspectId}") |
| | | public AjaxResult QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) { |
| | | return AjaxResult.success(qualityInspectParamService.qualityInspectParamDetail(inspectId)); |
| | | @Operation(summary = "æ£éªåæ°é¡¹è¯¦æ
") |
| | | @Log(title = "æ£éªåæ°é¡¹è¯¦æ
", businessType = BusinessType.OTHER) |
| | | public R<?> QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) { |
| | | return R.ok(qualityInspectParamService.qualityInspectParamDetail(inspectId)); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody List<QualityInspectParam> qualityInspectParams) { |
| | | return AjaxResult.success(qualityInspectParamService.updateBatchById(qualityInspectParams)); |
| | | @Operation(summary = "ä¿®æ¹æ£éªåæ°é¡¹") |
| | | @Log(title = "ä¿®æ¹æ£éªåæ°é¡¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody List<QualityInspectParam> qualityInspectParams) { |
| | | return R.ok(qualityInspectParamService.updateBatchById(qualityInspectParams)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å 餿£éªåæ°é¡¹") |
| | | @Log(title = "å 餿£éªåæ°é¡¹", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(qualityInspectParamService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectParamService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.service.QualityReportService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | */ |
| | | @Operation(summary = "è·åæ£éªç»è®¡æ°æ®") |
| | | @GetMapping("/getInspectStatistics") |
| | | public AjaxResult getInspectStatistics() { |
| | | return AjaxResult.success(qualityReportService.getInspectStatistics()); |
| | | @Log(title = "è·åæ£éªç»è®¡æ°æ®", businessType = BusinessType.OTHER) |
| | | public R<?> getInspectStatistics() { |
| | | return R.ok(qualityReportService.getInspectStatistics()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·ååæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getPassRateStatistics") |
| | | public AjaxResult getPassRateStatistics() { |
| | | return AjaxResult.success(qualityReportService.getPassRateStatistics()); |
| | | @Log(title = "è·ååæ ¼çç»è®¡æ°æ®", businessType = BusinessType.OTHER) |
| | | public R<?> getPassRateStatistics() { |
| | | return R.ok(qualityReportService.getPassRateStatistics()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·åæåº¦åæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getMonthlyPassRateStatistics") |
| | | public AjaxResult getMonthlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyPassRateStatistics(year)); |
| | | @Log(title = "è·åæåº¦åæ ¼çç»è®¡æ°æ®", businessType = BusinessType.OTHER) |
| | | public R<?> getMonthlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getMonthlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·å年度æ»åæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getYearlyPassRateStatistics") |
| | | public AjaxResult getYearlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getYearlyPassRateStatistics(year)); |
| | | @Log(title = "è·å年度æ»åæ ¼çç»è®¡æ°æ®", businessType = BusinessType.OTHER) |
| | | public R<?> getYearlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getYearlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·åæåº¦å®ææç»æ°æ®") |
| | | @GetMapping("/getMonthlyCompletionDetails") |
| | | public AjaxResult getMonthlyCompletionDetails(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyCompletionDetails(year)); |
| | | @Log(title = "è·åæåº¦å®ææç»æ°æ®", businessType = BusinessType.OTHER) |
| | | public R<?> getMonthlyCompletionDetails(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getMonthlyCompletionDetails(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "è·åçç¹æ£æµææ ç»è®¡") |
| | | @GetMapping("/getTopParameters") |
| | | public AjaxResult getTopParameters(@RequestParam("modelType") Integer modelType) { |
| | | return AjaxResult.success(qualityReportService.getTopParameters(modelType)); |
| | | @Log(title = "è·åçç¹æ£æµææ ç»è®¡", businessType = BusinessType.OTHER) |
| | | public R<?> getTopParameters(@RequestParam("modelType") Integer modelType) { |
| | | return R.ok(qualityReportService.getTopParameters(modelType)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.pojo.QualityTestStandardBinding; |
| | | import com.ruoyi.quality.service.QualityTestStandardBindingService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/qualityTestStandardBinding") |
| | | @AllArgsConstructor |
| | | @Tag(name = "æ£æµæ å主表ä¸äº§åå
³è表") |
| | | public class QualityTestStandardBindingController { |
| | | |
| | | private QualityTestStandardBindingService qualityTestStandardBindingService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | return AjaxResult.success(qualityTestStandardBindingService.add(qualityTestStandardBindings)); |
| | | @Operation(summary = "æ°å¢æ£æµæ å主表ä¸äº§åå
³è表") |
| | | @Log(title = "æ°å¢æ£æµæ å主表ä¸äº§åå
³è表", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | return R.ok(qualityTestStandardBindingService.add(qualityTestStandardBindings)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å 餿£æµæ å主表ä¸äº§åå
³è表") |
| | | @Log(title = "å 餿£æµæ å主表ä¸äº§åå
³è表", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardBindingService.removeBatchByIds(ids)); |
| | | return R.ok(qualityTestStandardBindingService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult listBinding(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardBindingService.listBinding(testStandardId)); |
| | | @Operation(summary = "æ£æµææ ç»´æ¤æ¥è¯¢") |
| | | @Log(title = "æ£æµææ ç»´æ¤æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> listBinding(Long testStandardId) { |
| | | return R.ok(qualityTestStandardBindingService.listBinding(testStandardId)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.service.IQualityTestStandardService; |
| | | import com.ruoyi.quality.service.QualityTestStandardParamService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/qualityTestStandard") |
| | | @Tag(name = "æ£æµæ å主表") |
| | | public class QualityTestStandardController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.save(qualityTestStandard)); |
| | | @Operation(summary = "æ°å¢æ£æµæ å主表") |
| | | @Log(title = "æ°å¢æ£æµæ å主表", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.save(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å 餿£æµæ å主表") |
| | | @Log(title = "å 餿£æµæ å主表", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardService.delQualityTestStandard(ids)); |
| | | return R.ok(qualityTestStandardService.delQualityTestStandard(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.updateById(qualityTestStandard)); |
| | | @Operation(summary = "æ£æµæ å主表修æ¹") |
| | | @Log(title = "æ£æµæ å主表修æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.updateById(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard)); |
| | | @Operation(summary = "æ£æµæ å主表å页æ¥è¯¢") |
| | | @Log(title = "æ£æµæ å主表å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/copyParam") |
| | | public AjaxResult copyParam(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.copyParam(qualityTestStandard)); |
| | | @Operation(summary = "æ£æµæ åå¤å¶åæ°") |
| | | @Log(title = "æ£æµæ åå¤å¶åæ°", businessType = BusinessType.OTHER) |
| | | public R<?> copyParam(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.copyParam(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/qualityTestStandardAudit") |
| | | public AjaxResult qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) { |
| | | return AjaxResult.success(qualityTestStandardService.updateBatchById(qualityTestStandards)); |
| | | @Operation(summary = "æ£æµæ åæ¹éå®¡æ ¸") |
| | | @Log(title = "æ£æµæ åæ¹éå®¡æ ¸", businessType = BusinessType.OTHER) |
| | | public R<?> qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) { |
| | | return R.ok(qualityTestStandardService.updateBatchById(qualityTestStandards)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getQualityTestStandardByProductId") |
| | | public AjaxResult getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) { |
| | | return AjaxResult.success(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process)); |
| | | @Operation(summary = "æ ¹æ®äº§åidæ¥è¯¢ç¸å
³çæ£éªæ å") |
| | | @Log(title = "æ ¹æ®äº§åidæ¥è¯¢ç¸å
³çæ£éªæ å", businessType = BusinessType.OTHER) |
| | | public R<?> getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) { |
| | | return R.ok(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getQualityTestStandardParamByTestStandardId") |
| | | public AjaxResult getQualityTestStandardParamByTestStandardId(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId))); |
| | | @Operation(summary = "æ ¹æ®æ£æµæ åidæ¥è¯¢ç¸å
³çæ£éªæ ååæ°") |
| | | @Log(title = "æ ¹æ®æ£æµæ åidæ¥è¯¢ç¸å
³çæ£éªæ ååæ°", businessType = BusinessType.OTHER) |
| | | public R<?> getQualityTestStandardParamByTestStandardId(Long testStandardId) { |
| | | return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId))); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.service.QualityTestStandardParamService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/qualityTestStandardParam") |
| | | @AllArgsConstructor |
| | | @Tag(name = "æ£æµæ ååæ°") |
| | | public class QualityTestStandardParamController { |
| | | |
| | | private QualityTestStandardParamService qualityTestStandardParamService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return AjaxResult.success(qualityTestStandardParamService.save(qualityTestStandardParam)); |
| | | @Operation(summary = "æ°å¢æ£æµæ ååæ°") |
| | | @Log(title = "æ°å¢æ£æµæ ååæ°", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return R.ok(qualityTestStandardParamService.save(qualityTestStandardParam)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å 餿£æµææ ç»´æ¤") |
| | | @Log(title = "å 餿£æµææ ç»´æ¤", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardParamService.removeBatchByIds(ids)); |
| | | return R.ok(qualityTestStandardParamService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return AjaxResult.success(qualityTestStandardParamService.updateById(qualityTestStandardParam)); |
| | | @Operation(summary = "æ£æµææ ç»´æ¤ä¿®æ¹") |
| | | @Log(title = "æ£æµææ ç»´æ¤ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return R.ok(qualityTestStandardParamService.updateById(qualityTestStandardParam)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId,testStandardId))); |
| | | @Operation(summary = "æ£æµææ ç»´æ¤æ¥è¯¢") |
| | | @Log(title = "æ£æµææ ç»´æ¤æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> list(Long testStandardId) { |
| | | return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId,testStandardId))); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | 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.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityUnqualifiedService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/quality/qualityUnqualified") |
| | | @Tag(name = "ä¸åæ ¼ç®¡ç") |
| | | public class QualityUnqualifiedController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | @Operation(summary = "æ°å¢ä¸åæ ¼ç®¡ç") |
| | | @Log(title = "æ°å¢ä¸åæ ¼ç®¡ç", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | qualityUnqualified.setInspectState(0); |
| | | return AjaxResult.success(qualityUnqualifiedService.save(qualityUnqualified)); |
| | | return R.ok(qualityUnqualifiedService.save(qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "å é¤ä¸åæ ¼ç®¡ç") |
| | | @Log(title = "å é¤ä¸åæ ¼ç®¡ç", businessType = BusinessType.DELETE) |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | qualityUnqualifiedService.listByIds(ids).stream().forEach(qualityUnqualified -> { |
| | | if (qualityUnqualified.getInspectState()==1){ |
| | | throw new RuntimeException("该ä¸åæ ¼æ°æ®å·²ç»å¤çæ æ³å é¤!"); |
| | | } |
| | | }); |
| | | return AjaxResult.success(qualityUnqualifiedService.removeBatchByIds(ids)); |
| | | return R.ok(qualityUnqualifiedService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult QualityUnqualifiedDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(qualityUnqualifiedService.getUnqualified(id)); |
| | | @Operation(summary = "ä¸åæ ¼ç®¡ç详æ
") |
| | | @Log(title = "ä¸åæ ¼ç®¡ç详æ
", businessType = BusinessType.OTHER) |
| | | public R<?> QualityUnqualifiedDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(qualityUnqualifiedService.getUnqualified(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.updateById(qualityUnqualified)); |
| | | @Operation(summary = "ä¸åæ ¼ç®¡çä¿®æ¹") |
| | | @Log(title = "ä¸åæ ¼ç®¡çä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.updateById(qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified)); |
| | | @Operation(summary = "ä¸åæ ¼ç®¡çå页æ¥è¯¢") |
| | | @Log(title = "ä¸åæ ¼ç®¡çå页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public R<?> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param qualityUnqualified |
| | | */ |
| | | @PostMapping("/export") |
| | | @Operation(summary = "ä¸åæ ¼ç®¡ç导åº") |
| | | @Log(title = "ä¸åæ ¼ç®¡ç导åº", businessType = BusinessType.EXPORT) |
| | | public void qualityUnqualifiedExport(HttpServletResponse response,QualityUnqualified qualityUnqualified) { |
| | | qualityUnqualifiedService.qualityUnqualifiedExport(response, qualityUnqualified); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/deal") |
| | | public AjaxResult deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | @Operation(summary = "ä¸åæ ¼ç®¡çå¤ç") |
| | | @Log(title = "ä¸åæ ¼ç®¡çå¤ç", businessType = BusinessType.OTHER) |
| | | public R<?> deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "å
³è产ååå·id") |
| | | private Long productModelId; |
| | | } |
| | |
| | | BeanUtils.copyProperties(qualityInspect, qualityUnqualified); |
| | | qualityUnqualified.setInspectState(0);//å¾
å¤ç |
| | | qualityUnqualified.setQuantity(qualityInspect.getUnqualifiedQuantity()); |
| | | qualityUnqualified.setProductModelId(qualityInspect.getProductModelId()); |
| | | List<QualityInspectParam> inspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId())); |
| | | String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(",")); |
| | | qualityUnqualified.setDefectivePhenomena(text + "è¿äºææ ä¸åå¨ä¸åæ ¼");//ä¸åæ ¼ç°è±¡ |
| | | qualityUnqualified.setInspectId(qualityInspect.getId()); |
| | | qualityUnqualified.setId(null); |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } |
| | | |
| | |
| | | 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 com.ruoyi.sales.service.ICommonFileService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | */ |
| | | @Log(title = "éä»¶å é¤", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delCommonFile") |
| | | public AjaxResult delCommonFile(@RequestBody Long[] ids) { |
| | | public R<?> delCommonFile(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return toAjax(commonFileService.delCommonFileByIds(ids)); |
| | | commonFileService.delCommonFileByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | public void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException{ |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper; |
| | |
| | | @RestController |
| | | @RequestMapping("/invoiceLedger") |
| | | @AllArgsConstructor |
| | | public class InvoiceLedgerController { |
| | | public class InvoiceLedgerController extends BaseController { |
| | | |
| | | private InvoiceLedgerService invoiceLedgerService; |
| | | private InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | public R<?> invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | invoiceLedgerService.invoiceLedgerSaveOrUpdate(productDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | public R<?> invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | invoiceLedgerService.invoiceLedgerDel(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/page") |
| | | public AjaxResult invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/fileList") |
| | | public AjaxResult invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | public R<?> invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/delFile") |
| | | @Log(title = "å¼ç¥¨å°è´¦", businessType = BusinessType.DELETE) |
| | | public AjaxResult invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è¦å é¤çæä»¶"); |
| | | public R<?> invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return R.fail("è¯·éæ©è¦å é¤çæä»¶"); |
| | | invoiceLedgerFileMapper.deleteBatchIds(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadFile") |
| | | public AjaxResult invoiceLedgerUploadFile(MultipartFile file) { |
| | | public R<?> invoiceLedgerUploadFile(MultipartFile file) { |
| | | try { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | return R.ok(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult invoiceLedgerInfo(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | public R<?> invoiceLedgerInfo(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/commitFile") |
| | | public AjaxResult invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | public R<?> invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | try { |
| | | invoiceLedgerService.invoiceLedgerCommitFile(invoiceLedgerDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/salesAccount") |
| | | public AjaxResult invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¬æå¼ç¥¨éé¢ |
| | | */ |
| | | @GetMapping("/getInvoiceAmount") |
| | | public AjaxResult getInvoiceAmount() { |
| | | public R<?> getInvoiceAmount() { |
| | | try { |
| | | BigDecimal amount = invoiceLedgerService.getInvoiceAmount(); |
| | | return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); |
| | | return R.ok(amount != null ? amount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("è·åå¼ç¥¨éé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | return R.fail("è·åå¼ç¥¨éé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/registrationProductPage") |
| | | public AjaxResult registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | public R<?> registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | |
| | | return AjaxResult.success(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | return R.ok(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceLedgerProductInfo") |
| | | public AjaxResult invoiceLedgerProductDetail(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | public R<?> invoiceLedgerProductDetail(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("delInvoiceLedger/{invoiceRegistrationProductId}") |
| | | public AjaxResult delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | public R<?> delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | try { |
| | | invoiceLedgerService.delInvoiceLedger(invoiceRegistrationProductId); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationDto; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | @RestController |
| | | @RequestMapping("/invoiceRegistration") |
| | | @AllArgsConstructor |
| | | public class InvoiceRegistrationController { |
| | | public class InvoiceRegistrationController extends BaseController { |
| | | |
| | | private InvoiceRegistrationService invoiceRegistrationService; |
| | | |
| | |
| | | @PostMapping("/save") |
| | | @Log(title = "å¼ç¥¨ç»è®°", businessType = com.ruoyi.framework.aspectj.lang.enums.BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult invoiceRegistrationSave(@RequestBody List<SalesLedgerDto> salesLedgerDto) { |
| | | if(Collections.isEmpty(salesLedgerDto)) return AjaxResult.error("è¯·éæ©è¦ä¿åçè®°å½"); |
| | | public R<?> invoiceRegistrationSave(@RequestBody List<SalesLedgerDto> salesLedgerDto) { |
| | | if(Collections.isEmpty(salesLedgerDto)) return R.fail("è¯·éæ©è¦ä¿åçè®°å½"); |
| | | salesLedgerDto.forEach(item ->{ |
| | | invoiceRegistrationService.invoiceRegistrationSave(item); |
| | | }); |
| | | |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceRegistrationDel(@RequestBody List<Integer> ids) { |
| | | public R<?> invoiceRegistrationDel(@RequestBody List<Integer> ids) { |
| | | invoiceRegistrationService.invoiceRegistrationDel(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult invoiceRegistrationUpdate(@RequestBody InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | public R<?> invoiceRegistrationUpdate(@RequestBody InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | invoiceRegistrationService.invoiceRegistrationUpdate(invoiceRegistrationDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationListPage(page, invoiceRegistrationDto)); |
| | | public R<?> invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationListPage(page, invoiceRegistrationDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/productList") |
| | | public AjaxResult invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationProductList(invoiceRegistrationProductDto)); |
| | | public R<?> invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationProductList(invoiceRegistrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/detail") |
| | | public AjaxResult invoiceRegistrationDetail(Integer id) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationDetail(id)); |
| | | public R<?> invoiceRegistrationDetail(Integer id) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | | import com.ruoyi.sales.service.impl.MetricStatisticsServiceImpl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @Operation(summary = "头鍿»è®¡") |
| | | @GetMapping("/total") |
| | | public AjaxResult total() { |
| | | public R<?> total() { |
| | | return metricStatisticsService.total(); |
| | | } |
| | | |
| | | @Operation(summary = "ç»è®¡è¡¨") |
| | | @GetMapping("/statisticsTable") |
| | | public AjaxResult statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | public R<?> statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | return metricStatisticsService.statisticsTable(statisticsTableDto); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.PaymentShippingMapper; |
| | | import com.ruoyi.sales.pojo.PaymentShipping; |
| | | import com.ruoyi.sales.service.PaymentShippingService; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢æ¯ä»ä¸åè´§ä¿¡æ¯") |
| | | public AjaxResult listPage(Page page, PaymentShipping paymentShipping) { |
| | | public R<?> listPage(Page page, PaymentShipping paymentShipping) { |
| | | IPage<PaymentShipping> listPage = paymentShippingService.listPage(page, paymentShipping); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å æ¯ä»ä¸åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody PaymentShipping paymentShipping) { |
| | | public R<?> add(@RequestBody PaymentShipping paymentShipping) { |
| | | String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD","order_no"); |
| | | paymentShipping.setOrderNo(ord); |
| | | boolean save = paymentShippingService.save(paymentShipping); |
| | | return save ? success() : error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹æ¯ä»ä¸åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody PaymentShipping paymentShipping) { |
| | | public R<?> update(@RequestBody PaymentShipping paymentShipping) { |
| | | boolean update = paymentShippingService.updateById(paymentShipping); |
| | | return update ? success() : error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å 餿¯ä»ä¸åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return AjaxResult.success(paymentShippingService.removeByIds(ids)); |
| | | return R.ok(paymentShippingService.removeByIds(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.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) { |
| | | public R<?> receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) { |
| | | receiptPaymentService.receiptPaymentSaveOrUpdate(receiptPayment); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentUpdate(receiptPayment)); |
| | | public R<?> receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) { |
| | | return R.ok(receiptPaymentService.receiptPaymentUpdate(receiptPayment)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult receiptPaymentDel (@RequestBody List<Integer> ids) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentDel(ids)); |
| | | public R<?> receiptPaymentDel (@RequestBody List<Integer> ids) { |
| | | return R.ok(receiptPaymentService.receiptPaymentDel(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/customerInteractions") |
| | | public AjaxResult customerInteractions (InvoiceLedgerDto receiptPaymentDto) { |
| | | return AjaxResult.success(receiptPaymentService.customerInteractions(receiptPaymentDto)); |
| | | public R<?> customerInteractions (InvoiceLedgerDto receiptPaymentDto) { |
| | | return R.ok(receiptPaymentService.customerInteractions(receiptPaymentDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult receiptPaymentInfo (Integer id) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentInfo(id)); |
| | | public R<?> receiptPaymentInfo (Integer id) { |
| | | return R.ok(receiptPaymentService.receiptPaymentInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ¬æåæ¬¾éé¢ |
| | | */ |
| | | @GetMapping("/getReceiptAmount") |
| | | public AjaxResult getReceiptAmount() { |
| | | public R<?> getReceiptAmount() { |
| | | try { |
| | | BigDecimal receiptAmount = receiptPaymentService.getReceiptAmount(); |
| | | return AjaxResult.success(receiptAmount != null ? receiptAmount : BigDecimal.ZERO); |
| | | return R.ok(receiptAmount != null ? receiptAmount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("è·å忬¾éé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | return R.fail("è·å忬¾éé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/bindInvoiceNoRegPage") |
| | | public AjaxResult bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) { |
| | | return AjaxResult.success(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto)); |
| | | public R<?> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) { |
| | | return R.ok(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto)); |
| | | } |
| | | |
| | | @Schema(description = "导åºå款ç»è®°") |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceInfo") |
| | | public AjaxResult invoiceInfo (Integer id) { |
| | | return AjaxResult.success(receiptPaymentService.invoiceInfo(id)); |
| | | public R<?> invoiceInfo (Integer id) { |
| | | return R.ok(receiptPaymentService.invoiceInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ¬æåºæ¶,忬¾éé¢ |
| | | */ |
| | | @GetMapping("/getAmountMouth") |
| | | public AjaxResult getAmountMouth() { |
| | | return AjaxResult.success(receiptPaymentService.getAmountMouth()); |
| | | public R<?> getAmountMouth() { |
| | | return R.ok(receiptPaymentService.getAmountMouth()); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | |
| | | @Log(title = "导å
¥éå®å°è´¦", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥éå®å°è´¦") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | public R<?> importData(@RequestParam("file") |
| | | @ApiParam(value = "Excelæä»¶", required = true) |
| | | MultipartFile file) { |
| | | return salesLedgerService.importData(file); |
| | |
| | | */ |
| | | @Log(title = "éå®å°è´¦", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateSalesLedger") |
| | | public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) { |
| | | return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto)); |
| | | public R<?> add(@RequestBody SalesLedgerDto salesLedgerDto) { |
| | | salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "éå®å°è´¦", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delLedger") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return toAjax(salesLedgerService.deleteSalesLedgerByIds(ids)); |
| | | salesLedgerService.deleteSalesLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listNoPage") |
| | | public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto) { |
| | | public R<?> listNoPage(SalesLedgerDto salesLedgerDto) { |
| | | List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "éå®å°è´¦éä»¶å é¤", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delLedgerFile") |
| | | public AjaxResult delLedgerFile(@RequestBody Long[] ids) { |
| | | public R<?> delLedgerFile(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return toAjax(commonFileService.deleteSalesLedgerByIds(ids)); |
| | | commonFileService.deleteSalesLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * æ¬æéå®ååéé¢ |
| | | */ |
| | | @GetMapping("/getContractAmount") |
| | | public AjaxResult getContractAmount() { |
| | | public R<?> getContractAmount() { |
| | | try { |
| | | BigDecimal contractAmount = salesLedgerService.getContractAmount(); |
| | | return AjaxResult.success(contractAmount != null ? contractAmount : BigDecimal.ZERO); |
| | | return R.ok(contractAmount != null ? contractAmount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("è·åååéé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | return R.fail("è·åååéé¢å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * 客æ·ååéé¢TOP5ç»è®¡ |
| | | */ |
| | | @GetMapping("/getTopFiveList") |
| | | public AjaxResult getTopFiveList() { |
| | | return AjaxResult.success(salesLedgerService.getTopFiveList()); |
| | | public R<?> getTopFiveList() { |
| | | return R.ok(salesLedgerService.getTopFiveList()); |
| | | } |
| | | |
| | | /** |
| | | * è¿åå¹´å¼ç¥¨,忬¾éé¢ |
| | | */ |
| | | @GetMapping("/getAmountHalfYear") |
| | | public AjaxResult getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) { |
| | | return AjaxResult.success(salesLedgerService.getAmountHalfYear(type)); |
| | | public R<?> getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) { |
| | | return R.ok(salesLedgerService.getAmountHalfYear(type)); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | * 忬¾ç»è®°å页æ¥è¯¢ |
| | | */ |
| | | @GetMapping("/listPageSalesLedger") |
| | | public AjaxResult listPage(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | public R<?> listPageSalesLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPage(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | * 仿¬¾ç»è®°å页æ¥è¯¢ |
| | | */ |
| | | @GetMapping("/listPagePurchaseLedger") |
| | | public AjaxResult listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | public R<?> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPagePurchaseLedger(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | * æ¥è¯¢äº§åä¿¡æ¯å表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SalesLedgerProduct salesLedgerProduct) { |
| | | public R<?> list(SalesLedgerProduct salesLedgerProduct) { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if (CollUtil.isEmpty(list)) { |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | * è·å产åä¿¡æ¯è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | public R<?> getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(salesLedgerProductService.selectSalesLedgerProductById(id)); |
| | | return R.ok(salesLedgerProductService.selectSalesLedgerProductById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åä¿¡æ¯", businessType = BusinessType.INSERT) |
| | | @PostMapping ("/addOrUpdateSalesLedgerProduct") |
| | | public AjaxResult add(@RequestBody SalesLedgerProduct salesLedgerProduct) |
| | | public R<?> add(@RequestBody SalesLedgerProduct salesLedgerProduct) |
| | | { |
| | | return toAjax(salesLedgerProductService.addOrUpdateSalesLedgerProduct(salesLedgerProduct)); |
| | | salesLedgerProductService.addOrUpdateSalesLedgerProduct(salesLedgerProduct); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产åä¿¡æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProduct") |
| | | public AjaxResult remove(@RequestBody Long[] ids) |
| | | public R<?> remove(@RequestBody Long[] ids) |
| | | { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | return toAjax(salesLedgerProductService.deleteSalesLedgerProductByIds(ids)); |
| | | salesLedgerProductService.deleteSalesLedgerProductByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //æ ¹æ®äº§åidè·åbom夿åºåæ¯å¦å
è¶³ |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.service.SalesQuotationService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/sales/quotation") |
| | | @AllArgsConstructor |
| | | public class SalesQuotationController { |
| | | public class SalesQuotationController extends BaseController { |
| | | private final SalesQuotationService salesQuotationService; |
| | | @GetMapping("/list") |
| | | public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto)); |
| | | public R<?> getList(Page page, SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.listPage(page, salesQuotationDto)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.add(salesQuotationDto)); |
| | | public R<?> add(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.add(salesQuotationDto)); |
| | | } |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.edit(salesQuotationDto)); |
| | | public R<?> update(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.edit(salesQuotationDto)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long id) { |
| | | return AjaxResult.success(salesQuotationService.delete(id)); |
| | | public R<?> delete(@RequestBody Long id) { |
| | | return R.ok(salesQuotationService.delete(id)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.pojo.SalespersonManagement; |
| | | import com.ruoyi.sales.service.SalespersonManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢ä¸å¡åä¿¡æ¯") |
| | | public AjaxResult listPage(Page page, SalespersonManagement salespersonManagement) { |
| | | public R<?> listPage(Page page, SalespersonManagement salespersonManagement) { |
| | | IPage<SalespersonManagement> listPage = salespersonManagementService.listPage(page, salespersonManagement); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å ä¸å¡åä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody SalespersonManagement salespersonManagement) { |
| | | public R<?> add(@RequestBody SalespersonManagement salespersonManagement) { |
| | | boolean save = salespersonManagementService.save(salespersonManagement); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹ä¸å¡åä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody SalespersonManagement salespersonManagement) { |
| | | public R<?> update(@RequestBody SalespersonManagement salespersonManagement) { |
| | | boolean update = salespersonManagementService.updateById(salespersonManagement); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤ä¸å¡åä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return R.fail("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | boolean delete = salespersonManagementService.removeByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "åè´§ä¿¡æ¯å表") |
| | | public AjaxResult listPage(Page page, ShippingInfo req) { |
| | | public R<?> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ·»å åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "åè´§ä¿¡æ¯ç®¡ç", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | public R<?> add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no"); |
| | | // åè´§å®¡æ¹ |
| | |
| | | req.setShippingNo(sh); |
| | | req.setStatus("å¾
å®¡æ ¸"); |
| | | boolean save = shippingInfoService.add(req); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @Operation(summary = "åè´§æ£åºå") |
| | | @PostMapping("/deductStock") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "åè´§ä¿¡æ¯ç®¡ç", businessType = BusinessType.UPDATE) |
| | | public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); |
| | | public R<?> deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "åè´§ä¿¡æ¯ç®¡ç", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody ShippingInfo req) { |
| | | public R<?> update(@RequestBody ShippingInfo req) { |
| | | ShippingInfo byId = shippingInfoService.getById(req.getId()); |
| | | if (byId == null) { |
| | | return AjaxResult.error("åè´§ä¿¡æ¯ä¸åå¨"); |
| | | return R.fail("åè´§ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | boolean update = shippingInfoService.updateById(req); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "åè´§ä¿¡æ¯ç®¡ç", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | |
| | | return shippingInfoService.delete(ids) ? AjaxResult.success("å 餿å") : AjaxResult.error("å é¤å¤±è´¥"); |
| | | return shippingInfoService.delete(ids) ? R.ok("å 餿å") : R.fail("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @Operation(summary = "éè¿å®¢æ·åç§°æ¥è¯¢å
³èçåè´§åå·") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | public R<?> getByCustomerName(String customerName) { |
| | | return R.ok(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | | |
| | | @GetMapping("/getDateil/{id}") |
| | |
| | | @Excel(name = "ç¾è®¢æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date executionDate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "äº¤ä»æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date deliveryDate; |
| | | |
| | | @Schema(description = "仿¬¾æ¹å¼") |
| | | @Excel(name = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | |
| | | @Excel(name = "æ¯å¦è´¨æ£", readConverterExp = "0=å¦,1=æ¯") |
| | | private Boolean isChecked; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¯å¦ç产 |
| | | */ |
| | | @Excel(name = "æ¯å¦ç产", readConverterExp = "0=å¦,1=æ¯") |
| | | private Integer isProduction; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | |
| | | IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | |
| | | List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SalesTrendDto; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | public AjaxResult total() { |
| | | public R<?> total() { |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(null); |
| | | if(CollectionUtils.isEmpty(salesLedgers)) return AjaxResult.success(salesLedgers); |
| | | if(CollectionUtils.isEmpty(salesLedgers)) return R.ok(salesLedgers); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // éå®é¢ |
| | | map.put("contractAmountTotal", salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getType, 1)); |
| | | map.put("shipRate", "0%"); |
| | | if(CollectionUtils.isEmpty(salesLedgerProducts)) return AjaxResult.success(map); |
| | | if(CollectionUtils.isEmpty(salesLedgerProducts)) return R.ok(map); |
| | | // åè´§æ°é |
| | | long count = shippingInfoMapper.selectCount(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getSalesLedgerProductId, salesLedgerProducts.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList())) |
| | | .eq(ShippingInfo::getStatus,"å·²åè´§")); |
| | | map.put("shipRate", String.format("%.2f", count * 100.0 / salesLedgerProducts.size()) + "%"); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | public AjaxResult statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | public R<?> statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | |
| | |
| | | map.put("orderCountList", orderCountList); |
| | | map.put("salesAmountList", salesAmountList); |
| | | map.put("shippingRateList", shippingRateList); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | * å é¤ç产计å |
| | | */ |
| | | public void deleteProductionData(List<Long> productIds) { |
| | | if (CollectionUtils.isEmpty(productIds)) { |
| | | return; |
| | | } |
| | | List<ProductionPlan> productionPlans = productionPlanMapper.selectList( |
| | | new LambdaQueryWrapper<ProductionPlan>() |
| | | .in(ProductionPlan::getSalesLedgerProductId, productIds.stream().map(Long::intValue).collect(Collectors.toList()))); |
| | |
| | | package com.ruoyi.sales.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.mapper.ProductionProductInputMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | import com.ruoyi.sales.vo.SalesLedgerVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.jetbrains.annotations.Nullable; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelUtil<SalesLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(SalesLedgerImportDto.class); |
| | | Map<String, List<SalesLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("éå®å°è´¦æ°æ®", "éå®äº§åæ°æ®"), inputStream, 0); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("éå®è¡¨æ ¼ä¸ºç©ºï¼"); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return R.fail("éå®è¡¨æ ¼ä¸ºç©ºï¼"); |
| | | // ä¸å¡å±åå¹¶ |
| | | List<SalesLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("éå®å°è´¦æ°æ®"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("éå®å°è´¦æ°æ®ä¸ºç©ºï¼"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return R.fail("éå®å°è´¦æ°æ®ä¸ºç©ºï¼"); |
| | | List<SalesLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("éå®äº§åæ°æ®"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("éå®äº§åæ°æ®ä¸ºç©ºï¼"); |
| | | // å®¢æ·æ°æ® |
| | | List<Customer> customers = customerMapper.selectList(new LambdaQueryWrapper<Customer>().in(Customer::getCustomerName, |
| | | salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList()))); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return R.fail("éå®äº§åæ°æ®ä¸ºç©ºï¼"); |
| | | // å®¢æ·æ°æ® - åè listPage æ¥è¯¢ç§æµ·å®¢æ·ï¼type = 0ï¼ |
| | | // type = 0ï¼ç§æµ·å®¢æ·ï¼æè
type = 1ï¼å
¬æµ·å®¢æ·ï¼ä¸å·²è¢«åé
ï¼å¹¶ä¸æ¯èªå·±é¢ç¨ãèªå·±å建æè
å
±äº«ç»èªå·±çå®¢æ· |
| | | Long loginUserId = loginUser.getUser().getUserId(); |
| | | List<Customer> customers = customerMapper.selectList(new QueryWrapper<Customer>() |
| | | .in("customer_name", salesLedgerImportDtoList.stream() |
| | | .map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList())) |
| | | .and(wrapper -> wrapper.eq("type", 0) |
| | | .or(wrapper2 -> wrapper2.eq("type", 1).eq("is_assigned", 1))) |
| | | .and(wrapper -> wrapper.eq("usage_user", loginUserId) |
| | | .or(wrapper2 -> wrapper2.eq("create_user", loginUserId) |
| | | .or(wrapper3 -> wrapper3.exists("select 1 from customer_user cu where cu.customer_id = customer.id and cu.user_id = " + loginUserId))))); |
| | | // // è§æ ¼åå·æ°æ® |
| | | // List<ProductModel> productModels = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getModel, |
| | | // salesLedgerProductImportDtoList.stream().map(SalesLedgerImportDto::getSpecificationModel).collect(Collectors.toList()))); |
| | |
| | | SalesLedger salesLedger = new SalesLedger(); |
| | | BeanUtils.copyProperties(salesLedgerImportDto, salesLedger); |
| | | salesLedger.setExecutionDate(DateUtils.toLocalDate(salesLedgerImportDto.getExecutionDate())); |
| | | salesLedger.setDeliveryDate(DateUtils.toLocalDate(salesLedgerImportDto.getDeliveryDate())); |
| | | // éè¿å®¢æ·åç§°æ¥è¯¢å®¢æ·IDï¼å®¢æ·ååå· |
| | | salesLedger.setCustomerId(customers.stream() |
| | | Optional<Customer> customerOptional = customers.stream() |
| | | .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName())) |
| | | .findFirst() |
| | | .map(Customer::getId) |
| | | .orElse(null)); |
| | | salesLedger.setCustomerContractNo(customers.stream() |
| | | .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName())) |
| | | .findFirst() |
| | | .map(Customer::getTaxpayerIdentificationNumber) |
| | | .orElse(null)); |
| | | .findFirst(); |
| | | if (customerOptional.isEmpty()) { |
| | | throw new RuntimeException("客æ·:" + salesLedger.getCustomerName() + "ä¸åå¨ï¼æè
éç§æµ·ç¨æ·"); |
| | | } |
| | | salesLedger.setCustomerId(customerOptional.get().getId()); |
| | | salesLedger.setCustomerContractNo(customerOptional.get().getTaxpayerIdentificationNumber()); |
| | | Long aLong = sysUsers.stream() |
| | | .filter(sysUser -> sysUser.getNickName().equals(salesLedger.getEntryPerson())) |
| | | .findFirst() |
| | |
| | | salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP)); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxExclusiveTotalPrice()); |
| | | list.stream() |
| | | .filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel())) |
| | | .findFirst() |
| | | .ifPresent(map -> { |
| | | salesLedgerProduct.setProductModelId(Long.parseLong(map.get("modelId").toString())); |
| | | salesLedgerProduct.setProductId(Long.parseLong(map.get("id").toString())); |
| | | }); |
| | | // æ ¡éªäº§åè§æ ¼æ¯å¦åå¨ |
| | | Optional<Map<String, Object>> productModelOptional = list.stream() |
| | | .filter(map -> Objects.equals(map.get("productName"), salesLedgerProduct.getProductCategory()) && Objects.equals(map.get("model"), salesLedgerProduct.getSpecificationModel())) |
| | | .findFirst(); |
| | | if (productModelOptional.isEmpty()) { |
| | | throw new RuntimeException("产å大类:" + salesLedgerProduct.getProductCategory() + ",è§æ ¼åå·:" + salesLedgerProduct.getSpecificationModel() + "ä¸åå¨ï¼"); |
| | | } |
| | | Map<String, Object> productModelMap = productModelOptional.get(); |
| | | salesLedgerProduct.setProductModelId(Long.parseLong(productModelMap.get("modelId").toString())); |
| | | salesLedgerProduct.setProductId(Long.parseLong(productModelMap.get("id").toString())); |
| | | // salesLedgerProduct.setProductId(productList.stream() |
| | | // .filter(product -> product.getProductName().equals(salesLedgerProduct.getProductCategory())) |
| | | // .findFirst() |
| | |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | salesLedgerProduct.setApproveStatus(0); |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setIsProduction(salesLedgerProductImportDto.getIsProduction() == 1); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | // æ·»å çäº§æ°æ® |
| | | salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success("导å
¥æå"); |
| | | return R.ok(null, "导å
¥æå"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("导å
¥å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | return AjaxResult.success("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | salesLedger.setTenantId(customer.getTenantId()); |
| | | // 3. æ°å¢ææ´æ°ä¸»è¡¨ |
| | | if (salesLedger.getId() == null) { |
| | | String contractNo = generateSalesContractNo(); |
| | | String contractNo = salesLedger.getSalesContractNo(); |
| | | if (StringUtils.isEmpty(contractNo)) { |
| | | contractNo = generateSalesContractNo(); |
| | | } |
| | | salesLedger.setSalesContractNo(contractNo); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | } else { |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.service.AnalyticsService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/staff/analytics") |
| | | public class AnalyticsController { |
| | | public class AnalyticsController extends BaseController { |
| | | |
| | | @Resource |
| | | private AnalyticsService analyticsService; |
| | | |
| | | @GetMapping("/reason") |
| | | public AjaxResult staffLeaveReasonAnalytics() { |
| | | return AjaxResult.success(analyticsService.staffLeaveReasonAnalytics()); |
| | | public R<?> staffLeaveReasonAnalytics() { |
| | | return R.ok(analyticsService.staffLeaveReasonAnalytics()); |
| | | } |
| | | |
| | | @GetMapping("/monthly_turnover_rate") |
| | | public AjaxResult getMonthlyTurnoverRateFor12Months() { |
| | | return AjaxResult.success(analyticsService.getMonthlyTurnoverRateFor12Months()); |
| | | public R<?> getMonthlyTurnoverRateFor12Months() { |
| | | return R.ok(analyticsService.getMonthlyTurnoverRateFor12Months()); |
| | | } |
| | | |
| | | @GetMapping("/total_statistic") |
| | | public AjaxResult getTotalStatistic() { |
| | | return AjaxResult.success(analyticsService.getTotalStatistic()); |
| | | public R<?> getTotalStatistic() { |
| | | return R.ok(analyticsService.getTotalStatistic()); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.Bank; |
| | | import com.ruoyi.staff.service.BankService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/bank") |
| | | @AllArgsConstructor |
| | | public class BankController { |
| | | public class BankController extends BaseController { |
| | | |
| | | private BankService bankService; |
| | | |
| | | @GetMapping("/list") |
| | | public AjaxResult list() { |
| | | return AjaxResult.success(bankService.list()); |
| | | public R<?> list() { |
| | | return R.ok(bankService.list()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "æ°å¢é¶è¡ç®¡ç表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "é¶è¡ç®¡ç表", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Bank bank) { |
| | | return AjaxResult.success(bankService.save(bank)); |
| | | public R<?> add(@RequestBody Bank bank) { |
| | | return R.ok(bankService.save(bank)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "æ´æ°é¶è¡ç®¡ç表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "é¶è¡ç®¡ç表", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Bank bank) { |
| | | return AjaxResult.success(bankService.updateById(bank)); |
| | | public R<?> update(@RequestBody Bank bank) { |
| | | return R.ok(bankService.updateById(bank)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤é¶è¡ç®¡ç表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "é¶è¡ç®¡ç表", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(bankService.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return R.ok(bankService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.HolidayApplication; |
| | | import com.ruoyi.staff.service.HolidayApplicationService; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/holidayApplication") |
| | | @AllArgsConstructor |
| | | public class HolidayApplicationController { |
| | | public class HolidayApplicationController extends BaseController { |
| | | |
| | | private HolidayApplicationService holidayApplicationService; |
| | | /** |
| | | * 请åç³è¯·å页æ¥è¯¢ |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.listPage(page, holidayApplication)); |
| | | public R<?> listPage(Page page, HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.listPage(page, holidayApplication)); |
| | | } |
| | | /** |
| | | * æ°å¢è¯·åç³è¯· |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.save(holidayApplication)); |
| | | public R<?> add(@RequestBody HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.save(holidayApplication)); |
| | | } |
| | | /** |
| | | * ä¿®æ¹è¯·åç³è¯· |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.updateById(holidayApplication)); |
| | | public R<?> update(@RequestBody HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.updateById(holidayApplication)); |
| | | } |
| | | /** |
| | | * å é¤è¯·åç³è¯· |
| | | */ |
| | | @DeleteMapping("/delete/{id}") |
| | | public AjaxResult delete(@PathVariable("id") Long id){ |
| | | return AjaxResult.success(holidayApplicationService.removeById(id)); |
| | | public R<?> delete(@PathVariable("id") Long id){ |
| | | return R.ok(holidayApplicationService.removeById(id)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceRecords; |
| | | import com.ruoyi.staff.service.PersonalAttendanceRecordsService; |
| | |
| | | @RestController |
| | | @RequestMapping("/personalAttendanceRecords") |
| | | @Tag(name = "人åæå¡ç¾å°") |
| | | public class PersonalAttendanceRecordsController { |
| | | public class PersonalAttendanceRecordsController extends BaseController { |
| | | @Resource |
| | | private PersonalAttendanceRecordsService personalAttendanceRecordsService; |
| | | |
| | | @Operation(summary = "æ°å¢æå¡ç¾å°") |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.add(personalAttendanceRecordsDto)); |
| | | public R<?> add(@RequestBody PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.add(personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "å页æ¥è¯¢æå¡ç¾å°") |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.listPage(page, personalAttendanceRecordsDto)); |
| | | public R<?> listPage(Page page, PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.listPage(page, personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "è·åå½å人çèå¤ç¸å
³æ°æ®") |
| | | @GetMapping("/today") |
| | | public AjaxResult todayInfo(PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.todayInfo(personalAttendanceRecordsDto)); |
| | | public R<?> todayInfo(PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.todayInfo(personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "å¯¼åºæå¡ç¾å°") |
| | |
| | | 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 com.ruoyi.staff.pojo.SchemeApplicableStaff; |
| | | import com.ruoyi.staff.service.SchemeApplicableStaffService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.listPage(page,schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "ç¤¾ä¿æ¹æ¡éç¨äººå表", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> add(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.add(schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "ç¤¾ä¿æ¹æ¡éç¨äººå表", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updateSchemeApplicableStaff(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> updateSchemeApplicableStaff(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.updateSchemeApplicableStaff(schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "ç¤¾ä¿æ¹æ¡éç¨äººå表", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return schemeApplicableStaffService.delete(ids); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.service.StaffContractService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffContract") |
| | | @Tag(name = "åå·¥å°è´¦/åå管ç") |
| | | public class StaffContractController { |
| | | public class StaffContractController extends BaseController { |
| | | |
| | | @Resource |
| | | private StaffContractService staffContractService; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffContractListPage(Page page, StaffContract staffContract) { |
| | | return AjaxResult.success(staffContractService.staffContractListPage(page, staffContract)); |
| | | public R<?> staffContractListPage(Page page, StaffContract staffContract) { |
| | | return R.ok(staffContractService.staffContractListPage(page, staffContract)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffLeave") |
| | | @Tag(name = "å工离è") |
| | | public class StaffLeaveController { |
| | | public class StaffLeaveController extends BaseController { |
| | | @Resource |
| | | private StaffLeaveService staffLeaveService; |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.staffLeaveListPage(page, staffLeaveDto)); |
| | | public R<?> staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.staffLeaveListPage(page, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.add(staffLeaveDto)); |
| | | public R<?> add(@RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.add(staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.update(id, staffLeaveDto)); |
| | | public R<?> update(@PathVariable("id") Long id, @RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.update(id, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult del(@RequestBody List<Integer> ids) { |
| | | public R<?> del(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(staffLeaveService.del(ids)); |
| | | return R.ok(staffLeaveService.del(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobExcelDto; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffOnJob") |
| | | @Tag(name = "åå·¥å°è´¦") |
| | | public class StaffOnJobController { |
| | | public class StaffOnJobController extends BaseController { |
| | | |
| | | @Resource |
| | | private IStaffOnJobService staffOnJobService; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | public R<?> staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult staffOnJobList(StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | public R<?> staffOnJobList(StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.add(staffOnJob)); |
| | | public R<?> add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return R.ok(staffOnJobService.add(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return AjaxResult.success(staffOnJobService.update(id, staffOnJobDto)); |
| | | public R<?> update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return R.ok(staffOnJobService.update(id, staffOnJobDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | public R<?> delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(staffOnJobService.delStaffOnJobs(ids)); |
| | | return R.ok(staffOnJobService.delStaffOnJobs(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(id)); |
| | | public R<?> staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return R.ok(staffOnJobService.staffOnJobDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/renewContract/{id}") |
| | | public AjaxResult renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return AjaxResult.success(staffOnJobService.renewContract(id, staffContract)); |
| | | public R<?> renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return R.ok(staffOnJobService.renewContract(id, staffContract)); |
| | | } |
| | | |
| | | @Operation(summary = "ä¸è½½æ¨¡æ¿") |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "å¨èå工导å
¥", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(@RequestPart("file") MultipartFile file) { |
| | | public R<?> importData(@RequestPart("file") MultipartFile file) { |
| | | Boolean b = staffOnJobService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导å
¥æå"); |
| | | return R.ok(null, "导å
¥æå"); |
| | | } |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/exportCopy") |
| | | @Operation(summary = "word模æ¿ååå¨èå工导åº") |
| | | public AjaxResult exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return AjaxResult.success(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | public R<?> exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return R.ok(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.pojo.StaffSalaryMain; |
| | | import com.ruoyi.staff.service.StaffSalaryMainService; |
| | |
| | | @RestController |
| | | @RequestMapping("/staffSalaryMain") |
| | | @AllArgsConstructor |
| | | public class StaffSalaryMainController { |
| | | public class StaffSalaryMainController extends BaseController { |
| | | |
| | | private StaffSalaryMainService staffSalaryMainService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å工工èµä¸»è¡¨å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | public R<?> listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.listPage(page, staffSalaryMain); |
| | | } |
| | | |
| | | @Operation(summary = "éè¿é¨é¨idsè·åç¨æ·ä¿¡æ¯è®¡ç®æ¯ä¸ªåå·¥çå·¥èµ") |
| | | @PostMapping("/calculateSalary") |
| | | public AjaxResult calculateSalary(@RequestBody CalculateSalaryDto calculateSalaryDto) { |
| | | public R<?> calculateSalary(@RequestBody CalculateSalaryDto calculateSalaryDto) { |
| | | return staffSalaryMainService.calculateSalary(calculateSalaryDto); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "æ°å»ºå·¥èµè¡¨") |
| | | @Log(title = "æ°å»ºå·¥èµè¡¨", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | public R<?> add(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.add(staffSalaryMain); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "ä¿®æ¹å·¥èµè¡¨") |
| | | @Log(title = "ä¿®æ¹å·¥èµè¡¨", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateStaffSalaryMain(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | public R<?> updateStaffSalaryMain(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.updateStaffSalaryMain(staffSalaryMain); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "å é¤å·¥èµè¡¨") |
| | | @Log(title = "å é¤å·¥èµè¡¨", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return staffSalaryMainService.delete(ids); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.SaveStaffSchedulingDto; |
| | | import com.ruoyi.staff.dto.StaffSchedulingDto; |
| | | import com.ruoyi.staff.service.StaffSchedulingService; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffScheduling") |
| | | @RequiredArgsConstructor |
| | | public class StaffSchedulingController { |
| | | public class StaffSchedulingController extends BaseController { |
| | | |
| | | private final StaffSchedulingService staffSchedulingService; |
| | | |
| | | @PostMapping("/listPage") |
| | | public AjaxResult listPage(@RequestBody SearchSchedulingVo vo){ |
| | | return AjaxResult.success(staffSchedulingService.listPage(vo)); |
| | | public R<?> listPage(@RequestBody SearchSchedulingVo vo){ |
| | | return R.ok(staffSchedulingService.listPage(vo)); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | public AjaxResult save(@RequestBody @Validated SaveStaffSchedulingDto saveStaffSchedulingDto){ |
| | | public R<?> save(@RequestBody @Validated SaveStaffSchedulingDto saveStaffSchedulingDto){ |
| | | staffSchedulingService.saveStaffScheduling(saveStaffSchedulingDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delByIds") |
| | | public AjaxResult delByIds(@RequestBody List<Integer> ids){ |
| | | public R<?> delByIds(@RequestBody List<Integer> ids){ |
| | | staffSchedulingService.removeByIds(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{id}") |
| | | public AjaxResult del(@PathVariable("id") Integer id){ |
| | | public R<?> del(@PathVariable("id") Integer id){ |
| | | staffSchedulingService.removeById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åç¨æ·ææ°æçè®°å½ |
| | | */ |
| | | @GetMapping("/getCurrentUserLatestScheduling") |
| | | public AjaxResult getCurrentUserLatestScheduling(){ |
| | | return AjaxResult.success(staffSchedulingService.getCurrentUserLatestScheduling()); |
| | | public R<?> getCurrentUserLatestScheduling(){ |
| | | return R.ok(staffSchedulingService.getCurrentUserLatestScheduling()); |
| | | } |
| | | |
| | | @Log(title = "导åºäººåæçå表", businessType = BusinessType.EXPORT) |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.SchemeApplicableStaff; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | |
| | | */ |
| | | public interface SchemeApplicableStaffService extends IService<SchemeApplicableStaff> { |
| | | |
| | | AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult add(SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> add(SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.pojo.StaffSalaryMain; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | |
| | | */ |
| | | public interface StaffSalaryMainService extends IService<StaffSalaryMain> { |
| | | |
| | | AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain); |
| | | R listPage(Page page, StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult add(StaffSalaryMain staffSalaryMain); |
| | | R<?> add(StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult updateStaffSalaryMain(StaffSalaryMain staffSalaryMain); |
| | | R<?> updateStaffSalaryMain(StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | |
| | | AjaxResult calculateSalary(CalculateSalaryDto calculateSalaryDto); |
| | | R<?> calculateSalary(CalculateSalaryDto calculateSalaryDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.UserAccountDto; |
| | | import com.ruoyi.production.bean.dto.UserProductionAccountingDto; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | LambdaQueryWrapper<SchemeApplicableStaff> schemeApplicableStaffLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(schemeApplicableStaff != null){ |
| | | if(StringUtils.isNotEmpty(schemeApplicableStaff.getTitle())){ |
| | |
| | | Page<SchemeApplicableStaff> page1 = schemeApplicableStaffMapper.selectPage(page, schemeApplicableStaffLambdaQueryWrapper); |
| | | List<Long> collect = page1.getRecords().stream().map(SchemeApplicableStaff::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(collect)){ |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | List<SchemeInsuranceDetail> schemeInsuranceDetails = schemeInsuranceDetailMapper |
| | | .selectList(new LambdaQueryWrapper<SchemeInsuranceDetail>() |
| | |
| | | item.setDeptNames(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(","))); |
| | | } |
| | | }); |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | public void setSchemeApplicableStaffUserInfo(SchemeApplicableStaff schemeApplicableStaff) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> add(SchemeApplicableStaff schemeApplicableStaff) { |
| | | if(schemeApplicableStaff == null){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | if(CollectionUtils.isEmpty(schemeApplicableStaff.getSchemeInsuranceDetailList())){ |
| | | return AjaxResult.error("è¯·éæ©æ¹æ¡æç»"); |
| | | return R.fail("è¯·éæ©æ¹æ¡æç»"); |
| | | } |
| | | setSchemeApplicableStaffUserInfo(schemeApplicableStaff); //æ ¹æ®é¨é¨è®¾ç½®ç¨æ·ä¿¡æ¯ |
| | | int insert = schemeApplicableStaffMapper.insert(schemeApplicableStaff); |
| | |
| | | item.setSchemeId(schemeApplicableStaff.getId()); |
| | | schemeInsuranceDetailMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success(insert); |
| | | return R.ok(insert); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff) { |
| | | if(schemeApplicableStaff == null){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | setSchemeApplicableStaffUserInfo(schemeApplicableStaff); //æ ¹æ®é¨é¨è®¾ç½®ç¨æ·ä¿¡æ¯ |
| | | int update = schemeApplicableStaffMapper.updateById(schemeApplicableStaff); |
| | |
| | | item.setSchemeId(schemeApplicableStaff.getId()); |
| | | schemeInsuranceDetailMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success(update); |
| | | return R.ok(update); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | int delete = schemeApplicableStaffMapper.deleteBatchIds(ids); |
| | | schemeInsuranceDetailMapper.delete(new LambdaQueryWrapper<SchemeInsuranceDetail>() |
| | | .in(SchemeInsuranceDetail::getSchemeId, ids)); |
| | | return AjaxResult.success(delete); |
| | | return R.ok(delete); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.dto.WordDateDto; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | |
| | | |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService { |
| | | public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService { |
| | | |
| | | private final StaffOnJobMapper staffOnJobMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | |
| | | private final StaffEmergencyContactMapper staffEmergencyContactMapper; |
| | | private final StaffEmergencyContactServiceImpl staffEmergencyContactServiceImpl; |
| | | |
| | | |
| | | //å¨èåå·¥å°è´¦å页æ¥è¯¢ |
| | | // å¨èåå·¥å°è´¦å页æ¥è¯¢ |
| | | @Override |
| | | public IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return staffOnJobMapper.staffOnJobListPage(page,staffOnJob); |
| | | return staffOnJobMapper.staffOnJobListPage(page, staffOnJob); |
| | | } |
| | | |
| | | //æ°å¢å
¥è |
| | | // æ°å¢å
¥è |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int add(StaffOnJobDto staffOnJobPrams) { |
| | | String[] ignoreProperties = {"id"};//æé¤id屿§ |
| | | String[] ignoreProperties = { "id" };// æé¤id屿§ |
| | | // 夿ç¼å·æ¯å¦åå¨ |
| | | List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffNo, staffOnJobPrams.getStaffNo())); |
| | | if (staffOnJobs != null && !staffOnJobs.isEmpty()){ |
| | | throw new BaseException("ç¼å·ä¸º"+staffOnJobPrams.getStaffNo()+"çå工已ç»åå¨,æ æ³æ°å¢!!!"); |
| | | List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList( |
| | | Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffNo, staffOnJobPrams.getStaffNo())); |
| | | if (staffOnJobs != null && !staffOnJobs.isEmpty()) { |
| | | throw new BaseException("ç¼å·ä¸º" + staffOnJobPrams.getStaffNo() + "çå工已ç»åå¨,æ æ³æ°å¢!!!"); |
| | | } |
| | | |
| | | // å建å
¥èæ°æ® |
| | |
| | | staffOnJobMapper.insert(staffOnJobPrams); |
| | | // æ¥è¯¢ç¨æ·æ¯å¦å·²ç»æ°å¢ |
| | | SysUser sysUser = sysUserService.selectUserById(staffOnJobPrams.getId()); |
| | | if(sysUser == null){ |
| | | if (sysUser == null) { |
| | | SysUser sysUser1 = new SysUser(); |
| | | sysUser1.setUserName(staffOnJobPrams.getStaffNo()); |
| | | sysUser1.setNickName(staffOnJobPrams.getStaffName()); |
| | | String s = SecurityUtils.encryptPassword("123456"); |
| | | sysUser1.setPassword(s); |
| | | if(staffOnJobPrams.getSysPostId() != null){ |
| | | Long[] posts = new Long[]{staffOnJobPrams.getSysPostId().longValue()}; |
| | | if (staffOnJobPrams.getSysPostId() != null) { |
| | | Long[] posts = new Long[] { staffOnJobPrams.getSysPostId().longValue() }; |
| | | sysUser1.setPostIds(posts); |
| | | } |
| | | sysUser1.setRoleIds(new Long[]{staffOnJobPrams.getRoleId()}); |
| | | sysUser1.setDeptIds(new Long[]{staffOnJobPrams.getSysDeptId()}); |
| | | sysUser1.setRoleIds(new Long[] { staffOnJobPrams.getRoleId() }); |
| | | sysUser1.setDeptIds(new Long[] { staffOnJobPrams.getSysDeptId() }); |
| | | sysUser1.setStatus("0"); |
| | | sysUserService.insertUser(sysUser1); |
| | | } |
| | | // ç»å®åè¡¨æ°æ® |
| | | bingingStaffOnJobExtra(staffOnJobPrams.getId(),staffOnJobPrams); |
| | | bingingStaffOnJobExtra(staffOnJobPrams.getId(), staffOnJobPrams); |
| | | // å建ååè®°å½ |
| | | StaffContract staffContract = new StaffContract(); |
| | | staffContract.setStaffOnJobId(staffOnJobPrams.getId()); |
| | |
| | | return staffContractMapper.insert(staffContract); |
| | | } |
| | | |
| | | //æ´æ°å
¥èä¿¡æ¯ |
| | | // æ´æ°å
¥èä¿¡æ¯ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int update(Long id, StaffOnJobDto staffOnJobParams) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StaffOnJob job = staffOnJobMapper.selectById(id); |
| | | if (job == null){ |
| | | throw new BaseException("ç¼å·ä¸º"+staffOnJobParams.getStaffNo()+"çåå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | if (job == null) { |
| | | throw new BaseException("ç¼å·ä¸º" + staffOnJobParams.getStaffNo() + "çåå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id"};//æé¤æ´æ°å±æ§ |
| | | String[] ignoreProperties = { "id" };// æé¤æ´æ°å±æ§ |
| | | |
| | | // è·åææ°ååæ°æ®ï¼å¹¶ä¸æ´æ° |
| | | StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery() |
| | | .eq(StaffContract::getStaffOnJobId, id) |
| | | .last("limit 1") |
| | | .orderByDesc(StaffContract::getId)); |
| | | if (contract != null){ |
| | | BeanUtils.copyProperties(staffOnJobParams,contract,ignoreProperties); |
| | | if (contract != null) { |
| | | BeanUtils.copyProperties(staffOnJobParams, contract, ignoreProperties); |
| | | staffContractMapper.updateById(contract); |
| | | } |
| | | |
| | | // å 餿æåè¡¨æ°æ® |
| | | delStaffOnJobExtra(Arrays.asList(id)); |
| | | // ç»å®åè¡¨æ°æ® |
| | | bingingStaffOnJobExtra(id,staffOnJobParams); |
| | | bingingStaffOnJobExtra(id, staffOnJobParams); |
| | | // æ´æ°åå·¥æ°æ® |
| | | staffOnJobParams.setContractExpireTime(staffOnJobParams.getContractEndTime()); |
| | | return staffOnJobMapper.updateById(staffOnJobParams); |
| | |
| | | |
| | | /** |
| | | * ç»å®åå·¥åè¡¨æ°æ® |
| | | * |
| | | * @param staffOnJobPrams |
| | | * @param id |
| | | */ |
| | | public void bingingStaffOnJobExtra(Long id,StaffOnJob staffOnJobPrams) { |
| | | public void bingingStaffOnJobExtra(Long id, StaffOnJob staffOnJobPrams) { |
| | | // æ°å¢æè²ç»å |
| | | if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEducationList())){ |
| | | if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEducationList())) { |
| | | staffOnJobPrams.getStaffEducationList().stream() |
| | | .filter(Objects::nonNull) // è¿æ»¤null对象ï¼é¿å
空æé |
| | | .forEach(staff -> staff.setStaffOnJobId(id)); // èµå¼ |
| | | staffEducationService.saveBatch(staffOnJobPrams.getStaffEducationList()); |
| | | } |
| | | // æ°å¢å·¥ä½ç»å |
| | | if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffWorkExperienceList())){ |
| | | if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffWorkExperienceList())) { |
| | | staffOnJobPrams.getStaffWorkExperienceList().stream() |
| | | .filter(Objects::nonNull) // è¿æ»¤null对象ï¼é¿å
空æé |
| | | .forEach(staff -> staff.setStaffOnJobId(id)); // èµå¼ |
| | | staffWorkExperienceServiceImpl.saveBatch(staffOnJobPrams.getStaffWorkExperienceList()); |
| | | } |
| | | // æ°å¢ç´§æ¥è系人 |
| | | if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEmergencyContactList())){ |
| | | if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEmergencyContactList())) { |
| | | staffOnJobPrams.getStaffEmergencyContactList().stream() |
| | | .filter(Objects::nonNull) // è¿æ»¤null对象ï¼é¿å
空æé |
| | | .forEach(staff -> staff.setStaffOnJobId(id)); // èµå¼ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * éè¿åå·¥idå 餿è²ç»åï¼å·¥ä½ç»åï¼ç´§æ¥è系人 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public void delStaffOnJobExtra(List<Long> ids) { |
| | | // å 餿è²ç»å |
| | | staffEducationService.remove(Wrappers.<StaffEducation>lambdaQuery().in(StaffEducation::getStaffOnJobId,ids)); |
| | | staffEducationService.remove(Wrappers.<StaffEducation>lambdaQuery().in(StaffEducation::getStaffOnJobId, ids)); |
| | | // å é¤å·¥ä½ç»å |
| | | staffWorkExperienceServiceImpl.remove(Wrappers.<StaffWorkExperience>lambdaQuery().in(StaffWorkExperience::getStaffOnJobId,ids)); |
| | | staffWorkExperienceServiceImpl |
| | | .remove(Wrappers.<StaffWorkExperience>lambdaQuery().in(StaffWorkExperience::getStaffOnJobId, ids)); |
| | | // å é¤ç´§æ¥è系人 |
| | | staffEmergencyContactServiceImpl.remove(Wrappers.<StaffEmergencyContact>lambdaQuery().in(StaffEmergencyContact::getStaffOnJobId,ids)); |
| | | staffEmergencyContactServiceImpl |
| | | .remove(Wrappers.<StaffEmergencyContact>lambdaQuery().in(StaffEmergencyContact::getStaffOnJobId, ids)); |
| | | } |
| | | |
| | | //å é¤å
¥è |
| | | // å é¤å
¥è |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delStaffOnJobs(List<Integer> ids) { |
| | | List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().in(StaffOnJob::getId, ids)); |
| | | if(CollectionUtils.isEmpty(staffOnJobs)){ |
| | | List<StaffOnJob> staffOnJobs = staffOnJobMapper |
| | | .selectList(Wrappers.<StaffOnJob>lambdaQuery().in(StaffOnJob::getId, ids)); |
| | | if (CollectionUtils.isEmpty(staffOnJobs)) { |
| | | throw new BaseException("该åå·¥ä¸åå¨,æ æ³å é¤!!!"); |
| | | } |
| | | // å é¤å
¥èæ°æ® |
| | |
| | | // å é¤ç¦»èæ°æ® |
| | | staffLeaveMapper.delete(Wrappers.<StaffLeave>lambdaQuery().in(StaffLeave::getStaffOnJobId, ids)); |
| | | // å 餿å¡è®°å½ |
| | | personalAttendanceRecordsMapper.delete(Wrappers.<PersonalAttendanceRecords>lambdaQuery().in(PersonalAttendanceRecords::getStaffOnJobId, ids)); |
| | | personalAttendanceRecordsMapper.delete( |
| | | Wrappers.<PersonalAttendanceRecords>lambdaQuery().in(PersonalAttendanceRecords::getStaffOnJobId, ids)); |
| | | // å é¤ç¨æ·æ°æ® |
| | | List<SysUser> sysUsers = sysUserMapper.selectList(Wrappers.<SysUser>lambdaQuery() |
| | | .in(SysUser::getUserName, staffOnJobs.stream().map(StaffOnJob::getStaffNo).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(sysUsers)){ |
| | | .in(SysUser::getUserName, |
| | | staffOnJobs.stream().map(StaffOnJob::getStaffNo).collect(Collectors.toList()))); |
| | | if (CollectionUtils.isNotEmpty(sysUsers)) { |
| | | Long[] longs = sysUsers.stream().map(SysUser::getUserId).toArray(Long[]::new); |
| | | sysUserService.deleteUserByIds(longs); |
| | | } |
| | |
| | | delStaffOnJobExtra(ids.stream().map(Integer::longValue).collect(Collectors.toList())); |
| | | |
| | | // å é¤ååæ°æ® |
| | | return staffContractMapper.delete(Wrappers.<StaffContract>lambdaQuery().in(StaffContract::getStaffOnJobId, ids)); |
| | | return staffContractMapper |
| | | .delete(Wrappers.<StaffContract>lambdaQuery().in(StaffContract::getStaffOnJobId, ids)); |
| | | } |
| | | |
| | | // ç»ç¾åå |
| | |
| | | public int renewContract(Long id, StaffContract staffContract) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StaffOnJob job = staffOnJobMapper.selectById(id); |
| | | if (job == null){ |
| | | if (job == null) { |
| | | throw new BaseException("该åå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | //å¨èå工详æ
|
| | | // å¨èå工详æ
|
| | | @Override |
| | | public StaffOnJobDto staffOnJobDetail(Long id) { |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectById(id); |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectById(id); |
| | | if (staffOnJob == null) { |
| | | throw new IllegalArgumentException("该åå·¥ä¸åå¨"); |
| | | } |
| | |
| | | .eq(StaffContract::getStaffOnJobId, staffOnJob.getId()) |
| | | .last("limit 1") |
| | | .orderByDesc(StaffContract::getId)); |
| | | if (contract != null){ |
| | | if (contract != null) { |
| | | staffOnJobDto.setContractTerm(contract.getContractTerm()); |
| | | staffOnJobDto.setContractStartTime(contract.getContractStartTime()); |
| | | staffOnJobDto.setContractEndTime(contract.getContractEndTime()); |
| | |
| | | // è·ååè¡¨æ°æ® |
| | | staffOnJobDto.setStaffEducationList(staffEducationMapper.selectList(Wrappers.<StaffEducation>lambdaQuery() |
| | | .eq(StaffEducation::getStaffOnJobId, staffOnJob.getId()))); |
| | | staffOnJobDto.setStaffWorkExperienceList(staffWorkExperienceMapper.selectList(Wrappers.<StaffWorkExperience>lambdaQuery() |
| | | .eq(StaffWorkExperience::getStaffOnJobId, staffOnJob.getId()))); |
| | | staffOnJobDto.setStaffEmergencyContactList(staffEmergencyContactMapper.selectList(Wrappers.<StaffEmergencyContact>lambdaQuery() |
| | | .eq(StaffEmergencyContact::getStaffOnJobId, staffOnJob.getId()))); |
| | | staffOnJobDto.setStaffWorkExperienceList( |
| | | staffWorkExperienceMapper.selectList(Wrappers.<StaffWorkExperience>lambdaQuery() |
| | | .eq(StaffWorkExperience::getStaffOnJobId, staffOnJob.getId()))); |
| | | staffOnJobDto.setStaffEmergencyContactList( |
| | | staffEmergencyContactMapper.selectList(Wrappers.<StaffEmergencyContact>lambdaQuery() |
| | | .eq(StaffEmergencyContact::getStaffOnJobId, staffOnJob.getId()))); |
| | | return staffOnJobDto; |
| | | } |
| | | |
| | | //å¨èåå·¥å¯¼åº |
| | | // å¨èåå·¥å¯¼åº |
| | | @Override |
| | | public void staffOnJobExport(HttpServletResponse response, StaffOnJob staffOnJob) { |
| | | List<StaffOnJobDto> staffOnJobs = staffOnJobMapper.staffOnJobList(staffOnJob); |
| | |
| | | try { |
| | | ExcelUtil<StaffOnJobExcelDto> util = new ExcelUtil<>(StaffOnJobExcelDto.class); |
| | | List<StaffOnJobExcelDto> staffOnJobs = util.importExcel(file.getInputStream()); |
| | | if (CollectionUtils.isEmpty(staffOnJobs)){ |
| | | if (CollectionUtils.isEmpty(staffOnJobs)) { |
| | | return false; |
| | | } |
| | | // è·åææé¨é¨æ°æ® |
| | | List<SysDept> sysDepts = sysDeptMapper.selectList(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, 0)); |
| | | List<SysDept> sysDepts = sysDeptMapper |
| | | .selectList(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, 0)); |
| | | // è·åææè§è²æ°æ® |
| | | List<SysRole> sysRoles = sysRoleMapper.selectRoleAll(); |
| | | staffOnJobs.forEach(staffOnJob -> { |
| | | // å¤çååæéæ°æ®æ ¼å¼ |
| | | if (staffOnJob.getContractTerm() != null && !staffOnJob.getContractTerm().trim().isEmpty()) { |
| | | String term = staffOnJob.getContractTerm().trim(); |
| | | try { |
| | | Integer.parseInt(term); |
| | | } catch (NumberFormatException e) { |
| | | throw new ServiceException("åå·¥[" + staffOnJob.getStaffName() + "]çååæé[" |
| | | + staffOnJob.getContractTerm() + "]æ ¼å¼ä¸æ£ç¡®ï¼å¿
须为纯æ°å(å¦: 1, 2, 3)"); |
| | | } |
| | | } |
| | | StaffOnJobDto staffOnJobDto = new StaffOnJobDto(); |
| | | BeanUtils.copyProperties(staffOnJob, staffOnJobDto); |
| | | // éè¿åç§°è·åé¨é¨id |
| | | staffOnJobDto.setSysDeptId(// ... existing code ... |
| | | sysDepts.stream() |
| | | .filter(dept -> dept.getDeptName() != null && dept.getDeptName().equals(staffOnJob.getSysDeptName())) |
| | | .findFirst() |
| | | .map(SysDept::getDeptId) |
| | | .orElse(null) |
| | | ); |
| | | Long deptId = sysDepts.stream() |
| | | .filter(dept -> dept.getDeptName() != null |
| | | && dept.getDeptName().equals(staffOnJob.getSysDeptName())) |
| | | .findFirst() |
| | | .map(SysDept::getDeptId) |
| | | .orElse(null); |
| | | if (deptId == null) { |
| | | throw new ServiceException( |
| | | "åå·¥[" + staffOnJob.getStaffName() + "]çé¨é¨[" + staffOnJob.getSysDeptName() + "]ä¸åå¨ï¼è¯·æ£æ¥æ°æ®"); |
| | | } |
| | | staffOnJobDto.setSysDeptId(deptId); |
| | | |
| | | // éè¿åç§°è·åè§è²id |
| | | staffOnJobDto.setRoleId(sysRoles.stream() |
| | | .filter(role -> role.getRoleName() != null && role.getRoleName().equals(staffOnJob.getRoleName())) |
| | | Long roleId = sysRoles.stream() |
| | | .filter(role -> role.getRoleName() != null |
| | | && role.getRoleName().equals(staffOnJob.getRoleName())) |
| | | .findFirst() |
| | | .map(SysRole::getRoleId) |
| | | .orElse( null)); |
| | | add(staffOnJobDto); |
| | | .orElse(null); |
| | | if (roleId == null) { |
| | | throw new ServiceException( |
| | | "åå·¥[" + staffOnJob.getStaffName() + "]çè§è²[" + staffOnJob.getRoleName() + "]ä¸åå¨ï¼è¯·æ£æ¥æ°æ®"); |
| | | } |
| | | staffOnJobDto.setRoleId(roleId); |
| | | SpringUtils.getAopProxy(this).add(staffOnJobDto); |
| | | }); |
| | | return true; |
| | | } catch (ServiceException | BaseException e) { |
| | | throw e; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | log.error("åå·¥å°è´¦å¯¼å
¥å¤±è´¥ : " + e.getMessage()); |
| | | throw new ServiceException("导å
¥å¤±è´¥: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String exportCopy(HttpServletResponse response, StaffOnJob staffOnJob) throws Exception { |
| | |
| | | // è®¾ç½®æ¨¡æ¿æä»¶æå¨ç®å½ï¼ç»å¯¹è·¯å¾ï¼ä¾å¦ï¼/templates/ï¼ |
| | | cfg.setClassForTemplateLoading(StaffOnJobServiceImpl.class, "/static"); |
| | | cfg.setDefaultEncoding("UTF-8"); |
| | | //2.å®ä¹éè¦å¡«å
çåé |
| | | // 2.å®ä¹éè¦å¡«å
çåé |
| | | // â æé å工信æ¯ï¼å®é
项ç®ä¸å¯ä»æ°æ®åº/Excel读åï¼ |
| | | WordDateDto staff = new WordDateDto(); |
| | | BeanUtils.copyProperties(staffOnJob, staff); |
| | |
| | | Instant instant = staff.getContractExpireTime().toInstant(); |
| | | |
| | | // ä¹å¯ä»¥æå®å
·ä½æ¶åºï¼ä¾å¦Asia/Shanghaiï¼ |
| | | LocalDate localDate = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDate(); // ååç»ææ¶é´ |
| | | LocalDate localDate = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDate(); // ååç»ææ¶é´ |
| | | LocalDate localDate1 = localDate.minusYears(Integer.parseInt(staff.getContractTerm()));// ååå¼å§æ¶é´ |
| | | |
| | | // ç¾è®¢æ¥æè½¬æ¢lcoaldate |
| | |
| | | staff.setQyear(localDate2.getYear() + ""); |
| | | staff.setQmoth(localDate2.getMonthValue() + ""); |
| | | staff.setQday(localDate2.getDayOfMonth() + ""); |
| | | if(staff.getDateSelect().equals("A")){ |
| | | if (staff.getDateSelect().equals("A")) { |
| | | staff.setSyear(localDate1.getYear() + ""); |
| | | staff.setSmoth(localDate1.getMonthValue() + ""); |
| | | staff.setSday(localDate1.getDayOfMonth() + ""); |
| | |
| | | staff.setSeyear(localDate4.getYear() + ""); |
| | | staff.setSemoth(localDate4.getMonthValue() + ""); |
| | | staff.setSeday(localDate4.getDayOfMonth() + ""); |
| | | }else if (staff.getDateSelect().equals("B")){ |
| | | } else if (staff.getDateSelect().equals("B")) { |
| | | |
| | | staff.setBsyear(localDate1.getYear() + ""); |
| | | staff.setBsmoth(localDate1.getMonthValue() + ""); |
| | |
| | | staff.setBseyear(localDate4.getYear() + ""); |
| | | staff.setBsemoth(localDate4.getMonthValue() + ""); |
| | | staff.setBseday(localDate4.getDayOfMonth() + ""); |
| | | }else if (staff.getDateSelect().equals("C")){ |
| | | } else if (staff.getDateSelect().equals("C")) { |
| | | staff.setCsyear(localDate1.getYear() + ""); |
| | | staff.setCsmoth(localDate1.getMonthValue() + ""); |
| | | staff.setCsday(localDate1.getDayOfMonth() + ""); |
| | | } |
| | | |
| | | Map<String,Object> data = new HashMap<>(); |
| | | data.put("item",staff); |
| | | //3.å è½½XML æ¨¡æ¿ |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("item", staff); |
| | | // 3.å è½½XML æ¨¡æ¿ |
| | | Template template = cfg.getTemplate("å³å¨åå书.xml"); |
| | | //4.çæå¡«å
åç XML å
容 |
| | | // 4.çæå¡«å
åç XML å
容 |
| | | StringWriter out = new StringWriter(); |
| | | template.process(data, out); |
| | | String filledXml = out.toString(); |
| | | //5.å°XMLå
容åå
¥äº¤ä»¶å¹¶æ¹ä¸º.docx æ ¼å¼ |
| | | // 5.å°XMLå
容åå
¥äº¤ä»¶å¹¶æ¹ä¸º.docx æ ¼å¼ |
| | | File outputFile = new File(url); |
| | | try(FileOutputStream fos = new FileOutputStream(outputFile); |
| | | OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) { |
| | | try (FileOutputStream fos = new FileOutputStream(outputFile); |
| | | OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) { |
| | | osw.write(filledXml); |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.mapper.StaffLeaveMapper; |
| | |
| | | private final AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | public R<?> listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | LambdaQueryWrapper<StaffSalaryMain> staffSalaryMainLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(staffSalaryMain != null){ |
| | | if(StringUtils.isNotEmpty(staffSalaryMain.getSalaryTitle())){ |
| | |
| | | List<StaffSalaryDetail> staffSalaryDetailList = staffSalaryDetailMapper.selectList(new LambdaQueryWrapper<StaffSalaryDetail>().eq(StaffSalaryDetail::getMainId, main.getId())); |
| | | main.setStaffSalaryDetailList(staffSalaryDetailList); |
| | | }); |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(StaffSalaryMain staffSalaryMain) { |
| | | public R<?> add(StaffSalaryMain staffSalaryMain) { |
| | | staffSalaryMainMapper.insert(staffSalaryMain); |
| | | staffSalaryMain.getStaffSalaryDetailList().forEach(detail -> { |
| | | detail.setMainId(staffSalaryMain.getId()); |
| | | }); |
| | | staffSalaryDetailService.saveBatch(staffSalaryMain.getStaffSalaryDetailList()); |
| | | return AjaxResult.success("æ°å¢æå"); |
| | | return R.ok(null, "æ°å¢æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateStaffSalaryMain(StaffSalaryMain staffSalaryMain) { |
| | | public R<?> updateStaffSalaryMain(StaffSalaryMain staffSalaryMain) { |
| | | if(staffSalaryMain == null){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | StaffSalaryMain staffSalaryMain1 = staffSalaryMainMapper.selectById(staffSalaryMain.getId()); |
| | | if(staffSalaryMain1 == null){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | // å¾
å®¡æ ¸ä¸å¯ç¼è¾ |
| | | // if(staffSalaryMain1.getStatus() > 3){ |
| | | // return AjaxResult.error("å¾
å®¡æ ¸ä¸å¯ç¼è¾"); |
| | | // return R.fail("å¾
å®¡æ ¸ä¸å¯ç¼è¾"); |
| | | // } |
| | | staffSalaryMainMapper.updateById(staffSalaryMain); |
| | | if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(staffSalaryMain.getStaffSalaryDetailList())){ |
| | |
| | | accountExpense.setInputTime(new Date()); |
| | | accountExpenseMapper.insert(accountExpense); |
| | | } |
| | | return AjaxResult.success("ä¿®æ¹æå"); |
| | | return R.ok(null, "ä¿®æ¹æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | staffSalaryMainMapper.deleteBatchIds(ids); |
| | | staffSalaryDetailMapper.delete(new LambdaQueryWrapper<StaffSalaryDetail>().in(StaffSalaryDetail::getMainId, ids)); |
| | | return AjaxResult.success("å 餿å"); |
| | | return R.ok(null, "å 餿å"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult calculateSalary(CalculateSalaryDto calculateSalaryDto) { |
| | | public R<?> calculateSalary(CalculateSalaryDto calculateSalaryDto) { |
| | | if(CollectionUtils.isEmpty(calculateSalaryDto.getIds())){ |
| | | return AjaxResult.error("åæ°é误"); |
| | | return R.fail("åæ°é误"); |
| | | } |
| | | List<Map<String, Object>> longs = setSchemeApplicableStaffUserInfo(calculateSalaryDto.getIds()); // éè¿é¨é¨idsè·åç¨æ·ä¿¡æ¯ |
| | | if(CollectionUtils.isEmpty(longs)){ |
| | | return AjaxResult.error("æ åå·¥"); |
| | | return R.fail("æ åå·¥"); |
| | | } |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (Map<String, Object> id : longs) { |
| | |
| | | schemeApplicableStaffService.calculateByEmployeeId((Integer) id.get("id"),id,calculateSalaryDto.getDate()); |
| | | mapList.add(id); |
| | | } |
| | | return AjaxResult.success(mapList); |
| | | return R.ok(mapList); |
| | | } |
| | | |
| | | public List<Map<String, Object>> setSchemeApplicableStaffUserInfo(List<Long> ids) { |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @Tag(name = "å
¥åº") |
| | | @RequestMapping("/stockInRecord") |
| | | @RequiredArgsConstructor |
| | | public class StockInRecordController { |
| | | public class StockInRecordController extends BaseController { |
| | | |
| | | private final StockInRecordService stockInRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-å表", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å
¥åºç®¡çå表") |
| | | public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | public R<?> listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | IPage<StockInRecordDto> result = stockInRecordService.listPage(page, stockInRecordDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "å
¥åºç®¡ç-å é¤å
¥åº", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(stockInRecordService.batchDelete(ids)); |
| | | return R.ok(stockInRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @DeleteMapping("/pending") |
| | | @Log(title = "å
¥åºç®¡ç-å é¤å¾
审æ¹å
¥åº", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤å¾
审æ¹çå
¥åºè®°å½") |
| | | public AjaxResult deletePending(@RequestBody List<Long> ids) { |
| | | public R<?> deletePending(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(stockInRecordService.batchDeletePending(ids)); |
| | | return R.ok(stockInRecordService.batchDeletePending(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockInRecord") |
| | |
| | | @PostMapping("/approve") |
| | | @Log(title = "å
¥åºç®¡ç-审æ¹å
¥åº", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "æ¹é审æ¹å
¥åºè®°å½") |
| | | public AjaxResult approve(@RequestBody StockInRecordDto approveDto) { |
| | | public R<?> approve(@RequestBody StockInRecordDto approveDto) { |
| | | if(CollectionUtils.isEmpty(approveDto.getIds())){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | stockInRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| 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/dto/StockOutRecordDto.java
src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java
src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java
src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.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/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-dev.yml
src/main/resources/approve-todo-agent-prompt.txt
src/main/resources/manufacturing-agent-prompt.txt
src/main/resources/mapper/account/financial/AccountSubjectMapper.xml
src/main/resources/mapper/basic/CustomerMapper.xml
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
src/main/resources/mapper/production/ProductionOrderMapper.xml
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
src/main/resources/mapper/quality/QualityUnqualifiedMapper.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/purchase-agent-prompt.txt
src/main/resources/sales-agent-prompt.txt
src/main/resources/static/销售台账导入模板.xlsx |