Merge branch 'dev_New_pro' into dev_宁夏_英泽防锈
# Conflicts:
# src/main/resources/application-dev.yml
已添加50个文件
已重命名11个文件
已修改97个文件
已删除23个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 设å¤ä¿å
»å®æ¶ä»»å¡è®¾å¤é¡¹ç®å段å端èè°è¯´æ |
| | | |
| | | > æ´æ°æ¶é´ï¼2026-05-11 |
| | | > éç¨èå´ï¼è®¾å¤ä¿å
»å®æ¶ä»»å¡ï¼`maintenance_task`ï¼ä¸è®¾å¤ä¿å
»è®°å½ï¼`device_maintenance`ï¼ |
| | | |
| | | ## 1. åæ´æ¦è¿° |
| | | |
| | | æ¬æ¬¡åç«¯åæ´ï¼ |
| | | |
| | | 1. `MaintenanceTask` æ°å¢å段 `machineryCategory`ï¼è®¾å¤é¡¹ç®ï¼ã |
| | | 2. 宿¶ä»»å¡æ§è¡çæè®¾å¤ä¿å
»è®°å½æ¶ï¼ä¼æ `MaintenanceTask.machineryCategory` 忥åå
¥ `DeviceMaintenance.machineryCategory`ã |
| | | |
| | | 对åºä»£ç ä½ç½®ï¼ |
| | | |
| | | - `src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java` |
| | | - `src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java` |
| | | |
| | | ## 2. æ°æ®åºåæ´ |
| | | |
| | | éè¦å
æ§è¡æ°æ®åºåæ´ï¼å¦åæ°å¢/æ¥è¯¢è¯¥å段ä¼å¼å¸¸ï¼ï¼ |
| | | |
| | | ```sql |
| | | ALTER TABLE `maintenance_task` |
| | | ADD COLUMN `machinery_category` VARCHAR(100) NULL COMMENT '设å¤é¡¹ç®' AFTER `device_model`; |
| | | ``` |
| | | |
| | | ## 3. åæ®µçº¦å® |
| | | |
| | | | åæ®µ | å«ä¹ | ç±»å | 建议 | |
| | | | --- | --- | --- | --- | |
| | | | machineryCategory | 设å¤é¡¹ç® | string | å端æ°å¢/ç¼è¾å®æ¶ä»»å¡æ¶ä¼ å¼ | |
| | | |
| | | 说æï¼ |
| | | |
| | | - å端å½åæªå¯¹è¯¥å段å强å¶éç©ºæ ¡éªï¼ä½ä¸å¡ä¸å»ºè®®å端ä½ä¸ºå¿
å¡«å¤çã |
| | | - åå² `maintenance_task` æ§æ°æ®è¥è¯¥å段为空ï¼ååºäºæ§ä»»å¡çæçä¿å
»è®°å½ä¹ä¼ä¸ºç©ºã |
| | | |
| | | ## 4. æ¥å£èè° |
| | | |
| | | ### 4.1 æ°å¢å®æ¶ä»»å¡ |
| | | |
| | | ```http |
| | | POST /deviceMaintenanceTask/add |
| | | Content-Type: application/json |
| | | ``` |
| | | |
| | | 请æ±ç¤ºä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "taskName": "ç©ºåæºA-å¨ä¿å
»", |
| | | "taskId": 1001, |
| | | "deviceModel": "GA75", |
| | | "machineryCategory": "å¨å设å¤", |
| | | "frequencyType": "WEEKLY", |
| | | "frequencyDetail": "MON,09:00", |
| | | "registrantId": 1, |
| | | "registrationDate": "2026-05-11", |
| | | "remarks": "èè°æ ·ä¾" |
| | | } |
| | | ``` |
| | | |
| | | ### 4.2 ä¿®æ¹å®æ¶ä»»å¡ |
| | | |
| | | ```http |
| | | POST /deviceMaintenanceTask/update |
| | | Content-Type: application/json |
| | | ``` |
| | | |
| | | 请æ±ç¤ºä¾ï¼å« `id`ï¼ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "id": 12, |
| | | "machineryCategory": "å¨å设å¤" |
| | | } |
| | | ``` |
| | | |
| | | ### 4.3 宿¶ä»»å¡å表 |
| | | |
| | | ```http |
| | | GET /deviceMaintenanceTask/listPage?pageNum=1&pageSize=10 |
| | | ``` |
| | | |
| | | è¿åè®°å½ä¸ä¼å
å« `machineryCategory` åæ®µã |
| | | |
| | | ### 4.4 设å¤ä¿å
»è®°å½å表/详æ
|
| | | |
| | | ```http |
| | | GET /device/maintenance/page?pageNum=1&pageSize=10 |
| | | GET /device/maintenance/{id} |
| | | ``` |
| | | |
| | | è¿åä¸ `machineryCategory` æ¥æºäº `device_maintenance.machinery_category`ã |
| | | 对äºâç±å®æ¶ä»»å¡èªå¨çæâçè®°å½ï¼è¯¥å¼ä¼ç»§æ¿çææ¶å¯¹åºä»»å¡ç `machineryCategory`ã |
| | | |
| | | ## 5. å端æ¹é ç¹ |
| | | |
| | | 1. 宿¶ä»»å¡æ°å¢/ç¼è¾è¡¨åå¢å â设å¤é¡¹ç®ï¼machineryCategoryï¼âè¾å
¥é¡¹ã |
| | | 2. æäº¤ `/deviceMaintenanceTask/add`ã`/deviceMaintenanceTask/update` æ¶æºå¸¦ `machineryCategory`ã |
| | | 3. 宿¶ä»»å¡å表å¢å â设å¤é¡¹ç®âåï¼å¦é¡µé¢æè¯¥å表ï¼ã |
| | | 4. 设å¤ä¿å
»è®°å½å表/详æ
å¢å â设å¤é¡¹ç®âå±ç¤ºï¼ç©ºå¼æ¾ç¤º `--`ã |
| | | |
| | | ## 6. èè°éªæ¶æ¸
å |
| | | |
| | | 1. æ°å¢ä¸ä¸ªå¸¦ `machineryCategory` ç宿¶ä»»å¡ï¼ä¿åæåã |
| | | 2. æ¥è¯¢ `/deviceMaintenanceTask/listPage`ï¼ç¡®è®¤è¯¥ä»»å¡è¿å `machineryCategory`ã |
| | | 3. çå¾
䏿¬¡å®æ¶è§¦åï¼æå°é¢çè°å°ä¸´è¿æ¶é´ï¼ï¼çæä¿å
»è®°å½ã |
| | | 4. æ¥è¯¢ `/device/maintenance/page` æè¯¦æ
æ¥å£ï¼ç¡®è®¤æ°è®°å½ç `machineryCategory` ä¸ä»»å¡ä¸è´ã |
| | | 5. ä¿®æ¹ä»»å¡ `machineryCategory` å忬¡è§¦åï¼ç¡®è®¤âæ°çæè®°å½âä½¿ç¨æ°å¼ï¼åå²è®°å½ä¸ååï¼ã |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # AccountSubject æ å½¢æ¹é åç«¯ä¿®æ¹ææ¡£ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-12 |
| | | |
| | | ## 1. åæ´èæ¯ |
| | | |
| | | `AccountSubjectController` å·²æ¹ä¸ºç¶åå±çº§é彿¨¡å¼ï¼`/accountSubject/list` ç°å¨è¿åæ å½¢ç»æï¼`children` éå½ï¼ï¼ä¸åæ¯å纯çå¹³éºå表ã |
| | | |
| | | --- |
| | | |
| | | ## 2. å端æ¥å£åå |
| | | |
| | | ### 2.1 æ¥è¯¢æ¥å£ï¼å·²åæ´ä¸ºæ ï¼ |
| | | |
| | | - URLï¼`GET /accountSubject/list` |
| | | - å
¥åï¼ä¿æä¸åï¼`current,size,subjectCode,subjectName,subjectType,status`ï¼ |
| | | - åºåï¼ä»æ¯å页壳ï¼`records,total`ï¼ï¼ä½ `records` å为æ èç¹æ°ç»ï¼æ ¹èç¹å页ï¼åèç¹éå½å
åµï¼ |
| | | |
| | | 示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": { |
| | | "records": [ |
| | | { |
| | | "id": 1, |
| | | "parentId": null, |
| | | "subjectCode": "1002", |
| | | "subjectName": "é¶è¡å款", |
| | | "subjectType": "èµäº§ç±»", |
| | | "balanceDirection": "åæ¹", |
| | | "status": 0, |
| | | "leaf": false, |
| | | "children": [ |
| | | { |
| | | "id": 2, |
| | | "parentId": 1, |
| | | "subjectCode": "100201", |
| | | "subjectName": "å·¥è¡å款", |
| | | "subjectType": "èµäº§ç±»", |
| | | "balanceDirection": "åæ¹", |
| | | "status": 0, |
| | | "leaf": true, |
| | | "children": [] |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "total": 1 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ### 2.2 æ°å¢/ç¼è¾æ¥å£å段åå |
| | | |
| | | - `POST /accountSubject/add` |
| | | - `PUT /accountSubject/edit` |
| | | |
| | | æ°å¢æ¯æåæ®µï¼ |
| | | |
| | | - `parentId`ï¼ç¶èç¹IDï¼ä¸ºç©ºè¡¨ç¤ºæ ¹èç¹ï¼ |
| | | |
| | | 示ä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "id": 2, |
| | | "parentId": 1, |
| | | "subjectCode": "100201", |
| | | "subjectName": "å·¥è¡å款", |
| | | "subjectType": "èµäº§ç±»", |
| | | "balanceDirection": "åæ¹", |
| | | "status": 0, |
| | | "remark": "" |
| | | } |
| | | ``` |
| | | |
| | | ### 2.3 å 餿¥å£è¡ä¸ºåå |
| | | |
| | | - `DELETE /accountSubject/remove/{ids}` |
| | | |
| | | è¡ä¸ºï¼ |
| | | |
| | | 1. å é¤ç¶èç¹æ¶ä¼éå½å 餿æååèç¹ã |
| | | 2. è¥ä»»æå¾
å é¤èç¹ï¼å«ååï¼å·²è¢« `fin_voucher_entry.subject_code` å¼ç¨ï¼åæ´ä½å é¤å¤±è´¥ã |
| | | |
| | | --- |
| | | |
| | | ## 3. å端æ¹é æ¸
å |
| | | |
| | | ## 3.1 æ»è´¦ç§ç®ç®¡ç页 |
| | | |
| | | æä»¶ï¼`src/views/financialManagement/generalLedger/index.vue` |
| | | |
| | | ### å¿
æ¹é¡¹ |
| | | |
| | | 1. æ°å¢âç¶ç§ç®âéæ©æ§ä»¶ï¼`el-cascader` æ `el-tree-select`ï¼ï¼ä¿åæ¶å¸¦ `parentId`ã |
| | | 2. å表æ¹ä¸ºæ 表å±ç¤ºï¼æ¨è `el-table` + `row-key` + `tree-props`ï¼ã |
| | | 3. æç´¢é»è¾ä¿æä¸åï¼ä½è¦å
¼å®¹ `records` 为æ ç»æã |
| | | |
| | | --- |
| | | |
| | | ## 3.2 åè¯é¡µç§ç®ä¸æ |
| | | |
| | | æä»¶ï¼`src/views/financialManagement/voucher/index.vue` |
| | | |
| | | å½ååè¯åå½ä½¿ç¨ `el-select`ï¼å¹³éºï¼ã |
| | | å端已è¿åæ ï¼éè¦å端æå¹³åååç»å®ä¸æã |
| | | |
| | | 示ä¾ï¼å¯å¤ç¨ï¼ï¼ |
| | | |
| | | ```js |
| | | const flattenSubjectTree = (nodes, result = []) => { |
| | | (nodes || []).forEach(node => { |
| | | result.push({ |
| | | code: node.subjectCode, |
| | | name: node.subjectName, |
| | | id: node.id, |
| | | parentId: node.parentId |
| | | }); |
| | | if (node.children?.length) { |
| | | flattenSubjectTree(node.children, result); |
| | | } |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | // list æ¥å£è¿ååï¼ |
| | | const treeRecords = response.data?.records || []; |
| | | subjectList.value = flattenSubjectTree(treeRecords); |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## 3.3 ç§ç®æ»è´¦/æç»è´¦é¡µçº§è |
| | | |
| | | æä»¶ï¼ |
| | | |
| | | - `src/views/financialManagement/voucher/generalLedger.vue` |
| | | - `src/views/financialManagement/voucher/detailLedger.vue` |
| | | |
| | | å½åé»è¾æ¯æ `records` å¼ºå¶æ å°æ `children: []`ï¼éè¦å é¤è¿æ®µâå¹³éºæ¹é âï¼ç´æ¥ä½¿ç¨å端æ ã |
| | | |
| | | 示ä¾ï¼å¯å¤ç¨ï¼ï¼ |
| | | |
| | | ```js |
| | | const toCascaderTree = (nodes = []) => |
| | | nodes |
| | | .filter(item => item.subjectCode && item.subjectName) |
| | | .map(item => ({ |
| | | code: item.subjectCode, |
| | | name: item.subjectName, |
| | | children: toCascaderTree(item.children || []) |
| | | })); |
| | | |
| | | subjectOptions.value = toCascaderTree(response.data?.records || []); |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## 4. 建议çåç«¯åæ®µçº¦å® |
| | | |
| | | 建议å¨å端 `form` å¢å ï¼ |
| | | |
| | | - `parentId: null` |
| | | |
| | | å¹¶å¨ç¼è¾åå¡«æ¶ä¿æ `parentId`ã |
| | | |
| | | --- |
| | | |
| | | ## 5. èè°æ³¨æäºé¡¹ |
| | | |
| | | 1. `/accountSubject/list` ç `total` æ¯æ ¹èç¹æ°éï¼ä¸æ¯å
¨éèç¹æ°ã |
| | | 2. è¥é¡µé¢ä»æå¹³éº `records.map(...)` å¤çï¼ä¼ä¸¢å¤±åèç¹ã |
| | | 3. å é¤ç§ç®å¤±è´¥æ¶ï¼ä¼å
æ£æ¥æ¯å¦è¢«åè¯åå½å¼ç¨ã |
| | | 4. ä¿å失败åºç°âç¶ç§ç®ä¸è½æ¯å½åç§ç®æå
¶åç§ç®âæ¶ï¼éè¦å端éå¶ç¶èç¹å¯éèå´ã |
| | | |
| | | --- |
| | | |
| | | ## 6. æ°æ®åºåæ®µè¦æ± |
| | | |
| | | `account_subject` éè¦å
å« `parent_id` åæ®µï¼`bigint`ï¼å¯ç©ºï¼ã |
| | | è¥çº¿ä¸åºå°æªæ·»å ï¼è¯·å
æ§è¡ DDL åèè°ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- account_subject å¢å ç¶çº§ç§ç®åæ®µï¼æ å½¢ç»æï¼ |
| | | ALTER TABLE `account_subject` |
| | | ADD COLUMN `parent_id` bigint NULL COMMENT 'ç¶ç§ç®IDï¼ä¸ºç©ºè¡¨ç¤ºæ ¹èç¹ï¼' AFTER `id`; |
| | | |
| | | CREATE INDEX `idx_account_subject_parent_id` ON `account_subject` (`parent_id`); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- è´¢å¡ç®¡ç模åå»ºè¡¨èæ¬ï¼åºå®èµäº§/æ å½¢èµäº§/åè¯/ç§ç®è´¦ï¼ |
| | | -- 说æï¼ |
| | | -- 1) æ»è´¦ç§ç®ç»§ç»å¤ç¨å·²æè¡¨ account_subjectï¼ä¸éå¤å建 fin_account_subjectã |
| | | -- 2) éé¢å段ç»ä¸ decimal(18,2)ã |
| | | |
| | | CREATE TABLE IF NOT EXISTS `fin_fixed_asset` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `asset_code` varchar(64) NOT NULL COMMENT 'èµäº§ç¼å·', |
| | | `asset_name` varchar(128) NOT NULL COMMENT 'èµäº§åç§°', |
| | | `category` varchar(64) NOT NULL COMMENT 'èµäº§ç±»å«', |
| | | `specification` varchar(255) DEFAULT NULL COMMENT 'è§æ ¼åå·', |
| | | `purchase_date` date NOT NULL COMMENT 'è´ç½®æ¥æ', |
| | | `original_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'èµäº§åå¼', |
| | | `useful_life` int NOT NULL DEFAULT '1' COMMENT '使ç¨å¹´é(å¹´)', |
| | | `residual_rate` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'æ®å¼ç(%)', |
| | | `accumulated_depreciation` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'ç´¯è®¡ææ§', |
| | | `net_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'åå¼', |
| | | `location` varchar(255) DEFAULT NULL COMMENT 'åæ¾å°ç¹', |
| | | `department` varchar(128) DEFAULT NULL COMMENT '使ç¨é¨é¨', |
| | | `keeper` varchar(64) DEFAULT NULL COMMENT 'ä¿ç®¡äºº', |
| | | `status` varchar(32) NOT NULL DEFAULT 'in_use' COMMENT 'ç¶æ: in_use/idle/repair/scrapped', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `create_user` varchar(64) DEFAULT NULL COMMENT 'å建人', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_user` varchar(64) DEFAULT NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´', |
| | | `dept_id` bigint DEFAULT NULL COMMENT 'é¨é¨ID', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_fin_fixed_asset_code` (`asset_code`), |
| | | KEY `idx_fin_fixed_asset_status` (`status`), |
| | | KEY `idx_fin_fixed_asset_category` (`category`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='åºå®èµäº§'; |
| | | |
| | | CREATE TABLE IF NOT EXISTS `fin_intangible_asset` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `asset_code` varchar(64) NOT NULL COMMENT 'èµäº§ç¼å·', |
| | | `asset_name` varchar(128) NOT NULL COMMENT 'èµäº§åç§°', |
| | | `category` varchar(64) NOT NULL COMMENT 'èµäº§ç±»å«', |
| | | `certificate_no` varchar(128) DEFAULT NULL COMMENT 'è¯ä¹¦ç¼å·', |
| | | `acquisition_date` date NOT NULL COMMENT 'å徿¥æ', |
| | | `original_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'èµäº§åå¼', |
| | | `amortization_period` int NOT NULL DEFAULT '1' COMMENT 'æéå¹´é(å¹´)', |
| | | `residual_rate` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'æ®å¼ç(%)', |
| | | `accumulated_amortization` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '累计æé', |
| | | `net_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'åå¼', |
| | | `validity_date` date DEFAULT NULL COMMENT 'æææè³', |
| | | `status` varchar(32) NOT NULL DEFAULT 'in_use' COMMENT 'ç¶æ: in_use/expired/amortized', |
| | | `description` varchar(1000) DEFAULT NULL COMMENT 'èµäº§æè¿°', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `create_user` varchar(64) DEFAULT NULL COMMENT 'å建人', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_user` varchar(64) DEFAULT NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´', |
| | | `dept_id` bigint DEFAULT NULL COMMENT 'é¨é¨ID', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_fin_intangible_asset_code` (`asset_code`), |
| | | KEY `idx_fin_intangible_asset_status` (`status`), |
| | | KEY `idx_fin_intangible_asset_category` (`category`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='æ å½¢èµäº§'; |
| | | |
| | | CREATE TABLE IF NOT EXISTS `fin_voucher` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `voucher_no` varchar(64) NOT NULL COMMENT 'åè¯åå·', |
| | | `voucher_date` date NOT NULL COMMENT 'åè¯æ¥æ', |
| | | `summary` varchar(500) DEFAULT NULL COMMENT 'æè¦', |
| | | `debit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'åæ¹å计', |
| | | `credit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'è´·æ¹å计', |
| | | `creator` varchar(64) DEFAULT NULL COMMENT 'å¶å人', |
| | | `status` varchar(32) NOT NULL DEFAULT 'unposted' COMMENT 'ç¶æ: unposted/posted/cancelled', |
| | | `attachment_count` int NOT NULL DEFAULT '0' COMMENT 'éä»¶å¼ æ°', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `create_user` varchar(64) DEFAULT NULL COMMENT 'å建人', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_user` varchar(64) DEFAULT NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´', |
| | | `dept_id` bigint DEFAULT NULL COMMENT 'é¨é¨ID', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_fin_voucher_no` (`voucher_no`), |
| | | KEY `idx_fin_voucher_date` (`voucher_date`), |
| | | KEY `idx_fin_voucher_status` (`status`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='åè¯ä¸»è¡¨'; |
| | | |
| | | CREATE TABLE IF NOT EXISTS `fin_voucher_entry` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `voucher_id` bigint NOT NULL COMMENT 'åè¯ID', |
| | | `row_no` int NOT NULL DEFAULT '1' COMMENT 'è¡å·', |
| | | `subject_code` varchar(64) NOT NULL COMMENT 'ç§ç®ç¼ç ', |
| | | `subject_name` varchar(128) DEFAULT NULL COMMENT 'ç§ç®åç§°', |
| | | `summary` varchar(500) DEFAULT NULL COMMENT 'æè¦', |
| | | `debit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'åæ¹éé¢', |
| | | `credit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT 'è´·æ¹éé¢', |
| | | `auxiliary_type` varchar(32) DEFAULT NULL COMMENT 'è¾
婿 ¸ç®ç±»å', |
| | | `auxiliary_id` varchar(64) DEFAULT NULL COMMENT 'è¾
婿 ¸ç®å¯¹è±¡ID', |
| | | `auxiliary_name` varchar(128) DEFAULT NULL COMMENT 'è¾
婿 ¸ç®å¯¹è±¡åç§°', |
| | | `create_user` varchar(64) DEFAULT NULL COMMENT 'å建人', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_user` varchar(64) DEFAULT NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´', |
| | | `dept_id` bigint DEFAULT NULL COMMENT 'é¨é¨ID', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_fin_voucher_entry_voucher` (`voucher_id`), |
| | | KEY `idx_fin_voucher_entry_subject` (`subject_code`), |
| | | KEY `idx_fin_voucher_entry_aux` (`auxiliary_type`, `auxiliary_id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='åè¯åå½'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # è´¢å¡ç®¡ç模åå端èè°ææ¡£ï¼account 模åï¼ |
| | | |
| | | æ´æ°æ¶é´ï¼2026-05-12 |
| | | |
| | | ## 1. éç¨è¯´æ |
| | | |
| | | ### 1.1 ååºç»æ |
| | | æåååºï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": {} |
| | | } |
| | | ``` |
| | | |
| | | ä¸å¡æ ¡éªå¤±è´¥ï¼ä¾å¦åè´·ä¸å¹³è¡¡ãå¿
填缺失ï¼ç±å
¨å±å¼å¸¸è¿åï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 500, |
| | | "msg": "é误信æ¯", |
| | | "data": null |
| | | } |
| | | ``` |
| | | |
| | | ### 1.2 åé¡µç»æ |
| | | å页æ¥å£ç»ä¸ä½¿ç¨ MyBatis-Plus `Page`ï¼ |
| | | - 请æ±åæ°ï¼`current`ã`size` |
| | | - è¿åï¼`data.records`ã`data.total` |
| | | |
| | | --- |
| | | |
| | | ## 2. æ»è´¦ç§ç®ï¼å·²å¨åæ¥å£ä¸å¢å¼ºæ ¡éªï¼ |
| | | |
| | | æ¥å£ä¿æä¸åï¼ |
| | | - `GET /accountSubject/list` |
| | | - `POST /accountSubject/add` |
| | | - `PUT /accountSubject/edit` |
| | | - `DELETE /accountSubject/remove/{ids}` |
| | | - `POST /accountSubject/export` |
| | | |
| | | æ°å¢è§åï¼ |
| | | 1. `subjectCode`ã`subjectName`ã`subjectType` å¿
å¡«ã |
| | | 2. `subjectCode` å¯ä¸æ ¡éªã |
| | | 3. å é¤ååå¼ç¨æ ¡éªï¼è¥è¢«åè¯åå½(`fin_voucher_entry.subject_code`)å¼ç¨ï¼ç¦æ¢å é¤ã |
| | | |
| | | --- |
| | | |
| | | ## 3. åºå®èµäº§ |
| | | |
| | | Base URLï¼`/financial/fixedAsset` |
| | | |
| | | ### 3.1 å页æ¥è¯¢ |
| | | - `GET /page` |
| | | - Queryï¼`current,size,assetCode,assetName,category,status` |
| | | |
| | | ### 3.2 æ°å¢ |
| | | - `POST /add` |
| | | - Bodyï¼JSONï¼ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "assetCode": "GD20260512001", |
| | | "assetName": "åå
¬çµè", |
| | | "category": "electronic", |
| | | "specification": "ThinkPad X1", |
| | | "purchaseDate": "2026-05-01", |
| | | "originalValue": 8000.00, |
| | | "usefulLife": 5, |
| | | "residualRate": 5.00, |
| | | "location": "è´¢å¡é¨", |
| | | "department": "è´¢å¡é¨", |
| | | "keeper": "å¼ ä¸", |
| | | "status": "in_use", |
| | | "remark": "示ä¾" |
| | | } |
| | | ``` |
| | | |
| | | ### 3.3 ä¿®æ¹ |
| | | - `PUT /update` |
| | | - Bodyï¼åæ°å¢ï¼éå
å« `id` |
| | | |
| | | ### 3.4 å é¤ |
| | | - `DELETE /delete?ids=1&ids=2` |
| | | |
| | | ### 3.5 ææ§è®¡æï¼ææï¼ |
| | | - `POST /depreciate` |
| | | - Body å¯éï¼ |
| | | - å
¨é¨å¨ç¨èµäº§ï¼`{}` |
| | | - æå®èµäº§ï¼`{"ids":[1,2,3]}` |
| | | |
| | | æ ¸å¿å
¬å¼ï¼ |
| | | - `monthlyDepreciation = originalValue * (1 - residualRate/100) / (usefulLife*12)` |
| | | - `accumulatedDepreciation += monthlyDepreciation` |
| | | - `netValue = originalValue - accumulatedDepreciation` |
| | | |
| | | ç¶æå»ºè®®å¼ï¼ |
| | | - `in_use`ã`idle`ã`repair`ã`scrapped` |
| | | |
| | | --- |
| | | |
| | | ## 4. æ å½¢èµäº§ |
| | | |
| | | Base URLï¼`/financial/intangibleAsset` |
| | | |
| | | ### 4.1 å页æ¥è¯¢ |
| | | - `GET /page` |
| | | - Queryï¼`current,size,assetCode,assetName,category,status` |
| | | |
| | | ### 4.2 æ°å¢ |
| | | - `POST /add` |
| | | |
| | | ```json |
| | | { |
| | | "assetCode": "WX20260512001", |
| | | "assetName": "ERP软件许å¯", |
| | | "category": "software", |
| | | "certificateNo": "SW-001", |
| | | "acquisitionDate": "2026-05-01", |
| | | "originalValue": 50000.00, |
| | | "amortizationPeriod": 10, |
| | | "residualRate": 0.00, |
| | | "validityDate": "2036-05-01", |
| | | "status": "in_use", |
| | | "description": "示ä¾", |
| | | "remark": "" |
| | | } |
| | | ``` |
| | | |
| | | ### 4.3 ä¿®æ¹ |
| | | - `PUT /update` |
| | | - Bodyï¼åæ°å¢ï¼éå
å« `id` |
| | | |
| | | ### 4.4 å é¤ |
| | | - `DELETE /delete?ids=1&ids=2` |
| | | |
| | | ### 4.5 æé计æï¼ææï¼ |
| | | - `POST /amortize` |
| | | - Body å¯éï¼ |
| | | - å
¨é¨å¨ç¨èµäº§ï¼`{}` |
| | | - æå®èµäº§ï¼`{"ids":[1,2,3]}` |
| | | |
| | | æ ¸å¿å
¬å¼ï¼ |
| | | - `monthlyAmortization = originalValue * (1 - residualRate/100) / (amortizationPeriod*12)` |
| | | - `accumulatedAmortization += monthlyAmortization` |
| | | - `netValue = originalValue - accumulatedAmortization` |
| | | - å½ `netValue <= 0` æ¶ï¼`netValue=0` ä¸ `status=amortized` |
| | | |
| | | ç¶æå»ºè®®å¼ï¼ |
| | | - `in_use`ã`expired`ã`amortized` |
| | | |
| | | --- |
| | | |
| | | ## 5. åè¯ |
| | | |
| | | Base URLï¼`/financial/voucher` |
| | | |
| | | ### 5.1 å页æ¥è¯¢ |
| | | - `GET /page` |
| | | - Queryï¼`current,size,voucherNo,creator,status,startDate,endDate` |
| | | |
| | | ### 5.2 æ°å¢ |
| | | - `POST /add` |
| | | |
| | | ```json |
| | | { |
| | | "voucherNo": "è®°-0001", |
| | | "voucherDate": "2026-05-12", |
| | | "summary": "é宿¶å
¥", |
| | | "creator": "å¼ ä¸", |
| | | "attachmentCount": 0, |
| | | "remark": "", |
| | | "entries": [ |
| | | { |
| | | "subjectCode": "1002", |
| | | "subjectName": "é¶è¡å款", |
| | | "summary": "æ¶å°è´§æ¬¾", |
| | | "debit": 1000.00, |
| | | "credit": 0 |
| | | }, |
| | | { |
| | | "subjectCode": "6001", |
| | | "subjectName": "主è¥ä¸å¡æ¶å
¥", |
| | | "summary": "确认æ¶å
¥", |
| | | "debit": 0, |
| | | "credit": 1000.00 |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ### 5.3 ä¿®æ¹ |
| | | - `PUT /update` |
| | | - Bodyï¼åæ°å¢ï¼éå
å« `id` |
| | | - ä»
`unposted` ç¶æå
è®¸ä¿®æ¹ |
| | | |
| | | ### 5.4 è¿è´¦ |
| | | - `POST /post` |
| | | |
| | | ```json |
| | | { |
| | | "id": 1 |
| | | } |
| | | ``` |
| | | |
| | | ### 5.5 ä½åº |
| | | - `POST /cancel` |
| | | |
| | | ```json |
| | | { |
| | | "id": 1 |
| | | } |
| | | ``` |
| | | |
| | | ### 5.6 详æ
|
| | | - `GET /detail/{id}` |
| | | |
| | | å
³é®æ ¡éªï¼ |
| | | 1. åå½è³å°ä¸æ¡ææè¡ï¼ç§ç®ä¸ç©ºï¼ä¸åæ¹æè´·æ¹ > 0ï¼ã |
| | | 2. æ¯æ¡ææåå½ä¸è½åè´·åæ¶å¤§äº 0ã |
| | | 3. å贷平衡ï¼`sum(debit) == sum(credit)` ä¸é½ > 0ã |
| | | 4. `subjectCode` å¿
é¡»åå¨äº `account_subject`ã |
| | | |
| | | ç¶ææµè½¬ï¼ |
| | | - `unposted -> posted` |
| | | - `unposted -> cancelled` |
| | | |
| | | --- |
| | | |
| | | ## 6. ç§ç®æ»è´¦ |
| | | |
| | | ### 6.1 æ¥è¯¢æ¥å£ |
| | | - `GET /financial/ledger/general` |
| | | |
| | | ### 6.2 Query åæ° |
| | | - `subjectCode`ï¼å¿
å¡«ï¼ |
| | | - `startMonth`ï¼YYYY-MMï¼ |
| | | - `endMonth`ï¼YYYY-MMï¼ |
| | | |
| | | ### 6.3 è¿ååæ®µ |
| | | - `rowType`ï¼`opening` / `entry` / `monthly_total` / `yearly_total` |
| | | - `date` |
| | | - `voucherNo` |
| | | - `summary` |
| | | - `debit` |
| | | - `credit` |
| | | - `direction`ï¼å/è´·ï¼ |
| | | - `balance`ï¼åæ£è´·è´ï¼ |
| | | |
| | | 说æï¼ |
| | | - ç§ç®æ¯æâæå®ç§ç®åå
¶ä¸çº§ï¼åç¼å¹é
ï¼âæ¥è¯¢ã |
| | | - èªå¨è¾åºâæåä½é¢ / æ¬æå计 / æ¬å¹´ç´¯è®¡âã |
| | | |
| | | --- |
| | | |
| | | ## 7. ç§ç®æç»è´¦ |
| | | |
| | | ### 7.1 æ¥è¯¢æ¥å£ |
| | | - `GET /financial/ledger/detail` |
| | | |
| | | ### 7.2 Query åæ° |
| | | - `subjectCode`ï¼å¿
å¡«ï¼ |
| | | - `auxiliaryType`ï¼å¯éï¼`customer/supplier/department/employee/project`ï¼ |
| | | - `auxiliaryId`ï¼å¯éï¼ |
| | | - `startMonth`ï¼YYYY-MMï¼ |
| | | - `endMonth`ï¼YYYY-MMï¼ |
| | | |
| | | ### 7.3 è¿ååæ®µ |
| | | åç§ç®æ»è´¦ï¼ |
| | | - `rowType,date,voucherNo,summary,debit,credit,direction,balance` |
| | | |
| | | --- |
| | | |
| | | ## 8. æ°æ®åºèæ¬ |
| | | |
| | | å·²æä¾èæ¬ï¼ |
| | | |
| | | - `doc/20260512_create_financial_management_tables.sql` |
| | | |
| | | å
å«ï¼ |
| | | - `fin_fixed_asset` |
| | | - `fin_intangible_asset` |
| | | - `fin_voucher` |
| | | - `fin_voucher_entry` |
| | | |
| | | æ»è´¦ç§ç®å¤ç¨ç°æ `account_subject`ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseInboundDto", description = "è´¢å¡ç®¡ç--éè´å
¥åºå°è´¦(ä¼ å)") |
| | | public class PurchaseInboundDto { |
| | | |
| | | @Schema(description = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseReturnDto", description = "è´¢å¡ç®¡ç--éè´éè´§å°è´¦(ä¼ å)") |
| | | public class PurchaseReturnDto { |
| | | |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * ç§ç®æç»è´¦æ¥è¯¢åæ°ï¼å«è¾
婿 ¸ç®æ¡ä»¶ï¼ã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinDetailLedgerQueryDto extends FinLedgerQueryDto { |
| | | |
| | | /** |
| | | * è¾
婿 ¸ç®ç±»åï¼customer/supplier/department/employee/projectã |
| | | */ |
| | | private String auxiliaryType; |
| | | |
| | | /** |
| | | * è¾
婿 ¸ç®å¯¹è±¡IDã |
| | | */ |
| | | private String auxiliaryId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.account.pojo.financial.FinFixedAsset; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * åºå®èµäº§æ¥è¯¢ä¸ä¿å DTOã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinFixedAssetDto extends FinFixedAsset { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ¹éID请æ±åæ°ã |
| | | */ |
| | | @Data |
| | | public class FinIdBatchDto { |
| | | |
| | | /** |
| | | * IDéåã |
| | | */ |
| | | private List<Long> ids; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.account.pojo.financial.FinIntangibleAsset; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§æ¥è¯¢ä¸ä¿å DTOã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinIntangibleAssetDto extends FinIntangibleAsset { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ç§ç®è´¦æ¥è¯¢åæ°ã |
| | | */ |
| | | @Data |
| | | public class FinLedgerQueryDto { |
| | | |
| | | /** |
| | | * ç§ç®ç¼ç ï¼æ¯ææ«çº§ææå®ç§ç®ï¼ã |
| | | */ |
| | | private String subjectCode; |
| | | |
| | | /** |
| | | * å¼å§æä»½ï¼æ ¼å¼ï¼YYYY-MMã |
| | | */ |
| | | private String startMonth; |
| | | |
| | | /** |
| | | * ç»ææä»½ï¼æ ¼å¼ï¼YYYY-MMã |
| | | */ |
| | | private String endMonth; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åè¯ä¿å DTOï¼ä¸»è¡¨ + åå½ï¼ã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinVoucherDto extends FinVoucher { |
| | | |
| | | /** |
| | | * åè¯æç»åå½ã |
| | | */ |
| | | private List<FinVoucherEntryDto> entries; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import com.ruoyi.account.pojo.financial.FinVoucherEntry; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * åè¯åå½ DTOã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinVoucherEntryDto extends FinVoucherEntry { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * åè¯å页æ¥è¯¢åæ°ã |
| | | */ |
| | | @Data |
| | | public class FinVoucherPageDto { |
| | | |
| | | /** |
| | | * åè¯åå·ï¼æ¨¡ç³å¹é
ï¼ã |
| | | */ |
| | | private String voucherNo; |
| | | |
| | | /** |
| | | * å¶å人ã |
| | | */ |
| | | private String creator; |
| | | |
| | | /** |
| | | * åè¯ç¶æã |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * å¼å§æ¥æï¼å«ï¼ã |
| | | */ |
| | | private LocalDate startDate; |
| | | |
| | | /** |
| | | * ç»ææ¥æï¼å«ï¼ã |
| | | */ |
| | | private LocalDate endDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.dto.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * åè¯ç¶æåæ´åæ°ã |
| | | */ |
| | | @Data |
| | | public class FinVoucherStatusDto { |
| | | |
| | | /** |
| | | * åè¯IDã |
| | | */ |
| | | private Long id; |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AccountSubjectVo extends AccountSubject { |
| | | |
| | | /** |
| | | * åç§ç®å表ï¼éå½ç»æï¼ã |
| | | */ |
| | | private List<AccountSubjectVo> children = new ArrayList<>(); |
| | | |
| | | /** |
| | | * æ¯å¦å¶åèç¹ã |
| | | */ |
| | | private Boolean leaf; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseInboundVo", description = "è´¢å¡ç®¡ç--éè´å
¥åºå°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class PurchaseInboundVo { |
| | | |
| | | @Schema(description = "å
¥åºåid") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å
¥åºåå·") |
| | | @Excel(name = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | @Excel(name = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å
¥åºæ¥æ") |
| | | @Excel(name = "å
¥åºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date InboundDate; |
| | | |
| | | @Schema(description = "产ååç§°") |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "产åè§æ ¼") |
| | | @Excel(name = "产åè§æ ¼") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "éé¢") |
| | | @Excel(name = "éé¢") |
| | | private BigDecimal InboundAmount; |
| | | |
| | | @Schema(description = "éè´è®¢åå·") |
| | | @Excel(name = "éè´è®¢åå·") |
| | | private String purchaseContractNumber; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseReturnVo", description = "è´¢å¡ç®¡ç--éè´éè´§å°è´¦(è¿å)") |
| | | @ExcelIgnoreUnannotated |
| | | public class PurchaseReturnVo { |
| | | |
| | | @Schema(description = "éè´§åid") |
| | | private Long id; |
| | | |
| | | @Excel(name = "éè´§åå·") |
| | | @Schema(description = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | @Schema(description = "ä¾åºå") |
| | | @Excel(name = "ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å
³èå
¥åºåå·") |
| | | @Excel(name = "å
³èå
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | @Schema(description = "éè´§æ¥æ") |
| | | @Excel(name = "éè´§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime preparedAt; |
| | | |
| | | @Schema(description = "鿬¾æ»é¢") |
| | | @Excel(name = "鿬¾æ»é¢") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Schema(description = "éè´§æ¹å¼") |
| | | @Excel(name = "éè´§æ¹å¼") |
| | | private String returnType; |
| | | |
| | | @Schema(description = "éè´è®¢åå·") |
| | | @Excel(name = "éè´è®¢åå·") |
| | | private String purchaseContractNumber; |
| | | } |
| | |
| | | @Excel(name = "产åè§æ ¼") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "åºåºæ°é") |
| | | @Excel(name = "åºåºæ°é") |
| | | private BigDecimal stockOutNum; |
| | | @Schema(description = "éé¢") |
| | | @Excel(name = "éé¢") |
| | | private BigDecimal outboundAmount; |
| | | |
| | | @Schema(description = "åè´§ç¼å·") |
| | | @Excel(name = "åè´§ç¼å·") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * ç§ç®è´¦åºç¡å彿¥è¯¢å¯¹è±¡ï¼SQLæ å°ä½¿ç¨ï¼ã |
| | | */ |
| | | @Data |
| | | public class FinLedgerEntryRecordVo { |
| | | |
| | | /** |
| | | * åè¯æ¥æã |
| | | */ |
| | | private LocalDate voucherDate; |
| | | |
| | | /** |
| | | * åè¯åå·ã |
| | | */ |
| | | private String voucherNo; |
| | | |
| | | /** |
| | | * æè¦ã |
| | | */ |
| | | private String summary; |
| | | |
| | | /** |
| | | * åæ¹éé¢ã |
| | | */ |
| | | private BigDecimal debit; |
| | | |
| | | /** |
| | | * è´·æ¹éé¢ã |
| | | */ |
| | | private BigDecimal credit; |
| | | |
| | | /** |
| | | * è¡å·ï¼æåºå段ï¼ã |
| | | */ |
| | | private Integer rowNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.financial; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * ç§ç®è´¦è¡æ°æ®è¿å对象ã |
| | | */ |
| | | @Data |
| | | public class FinLedgerRowVo { |
| | | |
| | | /** |
| | | * è¡ç±»åï¼opening/entry/monthly_total/yearly_totalã |
| | | */ |
| | | private String rowType; |
| | | |
| | | /** |
| | | * æ¥æã |
| | | */ |
| | | private LocalDate date; |
| | | |
| | | /** |
| | | * åè¯åå·ã |
| | | */ |
| | | private String voucherNo; |
| | | |
| | | /** |
| | | * æè¦ã |
| | | */ |
| | | private String summary; |
| | | |
| | | /** |
| | | * åæ¹éé¢ã |
| | | */ |
| | | private BigDecimal debit; |
| | | |
| | | /** |
| | | * è´·æ¹éé¢ã |
| | | */ |
| | | private BigDecimal credit; |
| | | |
| | | /** |
| | | * ä½é¢æ¹åï¼å/è´·ã |
| | | */ |
| | | private String direction; |
| | | |
| | | /** |
| | | * ä½é¢ï¼åæ£è´·è´ï¼ã |
| | | */ |
| | | private BigDecimal balance; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.bean.vo.financial; |
| | | |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import com.ruoyi.account.pojo.financial.FinVoucherEntry; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åè¯è¯¦æ
è¿å对象ã |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class FinVoucherDetailVo extends FinVoucher { |
| | | |
| | | /** |
| | | * åè¯åå½å表ã |
| | | */ |
| | | private List<FinVoucherEntry> entries; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.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.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéè´é¨å å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountPurchase") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ççéè´é¨å") |
| | | public class AccounPurchaseController { |
| | | |
| | | private final AccountPurchaseService accountPurchaseService; |
| | | |
| | | @GetMapping("/listPageAccountPurchase") |
| | | @Log(title = "éè´å
¥åºå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éè´å
¥åºå°è´¦") |
| | | public R<IPage<PurchaseInboundVo>> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto) { |
| | | IPage<PurchaseInboundVo> listPage = accountPurchaseService.listPageAccountPurchase(page,purchaseInboundDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountPurchaseInbound") |
| | | @Operation(summary = "导åºéè´å
¥åºæä»¶") |
| | | @Log(title = "导åºéè´å
¥åºæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto) { |
| | | accountPurchaseService.exportAccountPurchaseInbound(response,purchaseInboundDto); |
| | | } |
| | | |
| | | @GetMapping("/listPageAccountPurchaseReturn") |
| | | @Log(title = "éè´éè´§å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éè´éè´§å°è´¦") |
| | | public R<IPage<PurchaseReturnVo>> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto) { |
| | | IPage<PurchaseReturnVo> listPage = accountPurchaseService.listPageAccountPurchaseReturn(page,purchaseReturnDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/exportAccountPurchaseReturn") |
| | | @Operation(summary = "导åºéè´éè´§æä»¶") |
| | | @Log(title = "导åºéè´éè´§æä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportAccountPurchaseReturn(HttpServletResponse response,PurchaseReturnDto purchaseReturnDto) { |
| | | accountPurchaseService.exportAccountPurchaseReturn(response,purchaseReturnDto); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private final AccountSalesService accountSalesService; |
| | | |
| | | @GetMapping("/listPageByOutbound") |
| | | @GetMapping("/listPageAccountSales") |
| | | @Log(title = "éå®åºåºå°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éå®åºåºå°è´¦") |
| | | public R<IPage<SalesOutboundVo>> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto) { |
| | | IPage<SalesOutboundVo> listPage = accountSalesService.listPageByOutbound(page,salesOutboundDto); |
| | | public R<IPage<SalesOutboundVo>> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto) { |
| | | IPage<SalesOutboundVo> listPage = accountSalesService.listPageAccountSales(page,salesOutboundDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | |
| | | accountSalesService.exportAccountSalesOutbound(response,salesOutboundDto); |
| | | } |
| | | |
| | | @GetMapping("/listPageByReturn") |
| | | @GetMapping("/listPageAccountSalesReturn") |
| | | @Log(title = "éå®éè´§å°è´¦", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è´¢å¡ç®¡ç--éå®éè´§å°è´¦") |
| | | public R<IPage<SalesReturnVo>> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | IPage<SalesReturnVo> listPage = accountSalesService.listPageBySalesReturn(page,salesReturnDto); |
| | | public R<IPage<SalesReturnVo>> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | IPage<SalesReturnVo> listPage = accountSalesService.listPageAccountSalesReturn(page,salesReturnDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @Log(title = "æ»è´¦ç§ç®æ°æ®éå", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "æ»è´¦ç§ç®å页æ¥è¯¢") |
| | | @Operation(summary = "æ»è´¦ç§ç®æ å½¢æ¥è¯¢ï¼éå½ï¼") |
| | | public R<IPage<AccountSubjectVo>> AccountSubjectDtoList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto) { |
| | | IPage<AccountSubjectVo> paramList = accountSubjectService.baseList(page, accountSubjectDto); |
| | | return R.ok(paramList); |
| | |
| | | @Log(title = "æ°å¢æ»è´¦ç§ç®", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢æ»è´¦ç§ç®") |
| | | public R AccountSubjectDtoAdd(@RequestBody AccountSubjectDto accountSubjectDto) { |
| | | return R.ok(accountSubjectService.save(accountSubjectDto)); |
| | | return R.ok(accountSubjectService.saveAccountSubject(accountSubjectDto)); |
| | | } |
| | | |
| | | @PutMapping("/edit") |
| | | @Log(title = "ä¿®æ¹æ»è´¦ç§ç®", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹æ»è´¦ç§ç®") |
| | | public R AccountSubjectDtoEdit(@RequestBody AccountSubjectDto accountSubjectDto) { |
| | | return R.ok(accountSubjectService.updateById(accountSubjectDto)); |
| | | return R.ok(accountSubjectService.updateAccountSubject(accountSubjectDto)); |
| | | } |
| | | |
| | | @DeleteMapping("/remove/{ids}") |
| | | @Log(title = "å 餿»è´¦ç§ç®", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å 餿»è´¦ç§ç®") |
| | | public R AccountSubjectDtooRemove(@PathVariable Long[] ids) { |
| | | return R.ok(accountSubjectService.removeBatchByIds(Arrays.asList(ids))); |
| | | return R.ok(accountSubjectService.removeAccountSubjectByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinFixedAssetDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinIdBatchDto; |
| | | import com.ruoyi.account.pojo.financial.FinFixedAsset; |
| | | import com.ruoyi.account.service.financial.FinFixedAssetService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * åºå®èµäº§æ§å¶å¨ã |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/financial/fixedAsset") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ç-åºå®èµäº§") |
| | | public class FinFixedAssetController { |
| | | |
| | | private final FinFixedAssetService finFixedAssetService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "åºå®èµäº§å页æ¥è¯¢") |
| | | public R<IPage<FinFixedAsset>> page(Page<FinFixedAsset> page, FinFixedAssetDto queryDto) { |
| | | return R.ok(finFixedAssetService.pageList(page, queryDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "åºå®èµäº§", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢åºå®èµäº§") |
| | | public R<Boolean> add(@RequestBody FinFixedAssetDto dto) { |
| | | return R.ok(finFixedAssetService.add(dto)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "åºå®èµäº§", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹åºå®èµäº§") |
| | | public R<Boolean> update(@RequestBody FinFixedAssetDto dto) { |
| | | return R.ok(finFixedAssetService.update(dto)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "åºå®èµäº§", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤åºå®èµäº§") |
| | | public R<Boolean> delete(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(finFixedAssetService.deleteByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/depreciate") |
| | | @Log(title = "åºå®èµäº§ææ§è®¡æ", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "åºå®èµäº§ææè®¡æææ§") |
| | | public R depreciate(@RequestBody(required = false) FinIdBatchDto dto) { |
| | | return R.ok(finFixedAssetService.depreciate(dto == null ? null : dto.getIds())); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinIdBatchDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinIntangibleAssetDto; |
| | | import com.ruoyi.account.pojo.financial.FinIntangibleAsset; |
| | | import com.ruoyi.account.service.financial.FinIntangibleAssetService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§æ§å¶å¨ã |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/financial/intangibleAsset") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ç-æ å½¢èµäº§") |
| | | public class FinIntangibleAssetController { |
| | | |
| | | private final FinIntangibleAssetService finIntangibleAssetService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "æ å½¢èµäº§å页æ¥è¯¢") |
| | | public R<IPage<FinIntangibleAsset>> page(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto) { |
| | | return R.ok(finIntangibleAssetService.pageList(page, queryDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "æ å½¢èµäº§", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢æ å½¢èµäº§") |
| | | public R<Boolean> add(@RequestBody FinIntangibleAssetDto dto) { |
| | | return R.ok(finIntangibleAssetService.add(dto)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "æ å½¢èµäº§", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹æ å½¢èµäº§") |
| | | public R<Boolean> update(@RequestBody FinIntangibleAssetDto dto) { |
| | | return R.ok(finIntangibleAssetService.update(dto)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "æ å½¢èµäº§", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å 餿 å½¢èµäº§") |
| | | public R<Boolean> delete(@RequestParam("ids") Long[] ids) { |
| | | return R.ok(finIntangibleAssetService.deleteByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/amortize") |
| | | @Log(title = "æ å½¢èµäº§æé计æ", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "æ å½¢èµäº§ææè®¡ææé") |
| | | public R amortize(@RequestBody(required = false) FinIdBatchDto dto) { |
| | | return R.ok(finIntangibleAssetService.amortize(dto == null ? null : dto.getIds())); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.controller.financial; |
| | | |
| | | import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo; |
| | | import com.ruoyi.account.service.financial.FinLedgerService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç§ç®æ»è´¦/æç»è´¦æ§å¶å¨ã |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/financial/ledger") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ç-ç§ç®è´¦") |
| | | public class FinLedgerController { |
| | | |
| | | private final FinLedgerService finLedgerService; |
| | | |
| | | @GetMapping("/general") |
| | | @Operation(summary = "ç§ç®æ»è´¦æ¥è¯¢") |
| | | public R<List<FinLedgerRowVo>> general(FinLedgerQueryDto queryDto) { |
| | | return R.ok(finLedgerService.queryGeneralLedger(queryDto)); |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | | @Operation(summary = "ç§ç®æç»è´¦æ¥è¯¢") |
| | | public R<List<FinLedgerRowVo>> detail(FinDetailLedgerQueryDto queryDto) { |
| | | return R.ok(finLedgerService.queryDetailLedger(queryDto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinVoucherDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherStatusDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo; |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import com.ruoyi.account.service.financial.FinVoucherService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * åè¯æ§å¶å¨ã |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/financial/voucher") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "è´¢å¡ç®¡ç-åè¯") |
| | | public class FinVoucherController { |
| | | |
| | | private final FinVoucherService finVoucherService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "åè¯å页æ¥è¯¢") |
| | | public R<IPage<FinVoucher>> page(Page<FinVoucher> page, FinVoucherPageDto queryDto) { |
| | | return R.ok(finVoucherService.pageList(page, queryDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "åè¯", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢åè¯") |
| | | public R<Boolean> add(@RequestBody FinVoucherDto dto) { |
| | | return R.ok(finVoucherService.addVoucher(dto)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "åè¯", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹åè¯") |
| | | public R<Boolean> update(@RequestBody FinVoucherDto dto) { |
| | | return R.ok(finVoucherService.updateVoucher(dto)); |
| | | } |
| | | |
| | | @PostMapping("/post") |
| | | @Log(title = "åè¯è¿è´¦", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "åè¯è¿è´¦") |
| | | public R<Boolean> post(@RequestBody FinVoucherStatusDto dto) { |
| | | return R.ok(finVoucherService.postVoucher(dto.getId())); |
| | | } |
| | | |
| | | @PostMapping("/cancel") |
| | | @Log(title = "åè¯ä½åº", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "åè¯ä½åº") |
| | | public R<Boolean> cancel(@RequestBody FinVoucherStatusDto dto) { |
| | | return R.ok(finVoucherService.cancelVoucher(dto.getId())); |
| | | } |
| | | |
| | | @GetMapping("/detail/{id}") |
| | | @Operation(summary = "åè¯è¯¦æ
") |
| | | public R<FinVoucherDetailVo> detail(@PathVariable("id") Long id) { |
| | | return R.ok(finVoucherService.detail(id)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface AccountSubjectMapper extends BaseMapper<AccountSubject> { |
| | | |
| | | Long countReferencedBySubjectCodes(@Param("subjectCodes") List<String> subjectCodes); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.financial.FinFixedAsset; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * åºå®èµäº§ Mapperã |
| | | */ |
| | | @Mapper |
| | | public interface FinFixedAssetMapper extends BaseMapper<FinFixedAsset> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.financial.FinIntangibleAsset; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§ Mapperã |
| | | */ |
| | | @Mapper |
| | | public interface FinIntangibleAssetMapper extends BaseMapper<FinIntangibleAsset> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo; |
| | | import com.ruoyi.account.pojo.financial.FinVoucherEntry; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åè¯åå½ Mapperã |
| | | */ |
| | | @Mapper |
| | | public interface FinVoucherEntryMapper extends BaseMapper<FinVoucherEntry> { |
| | | |
| | | List<FinLedgerEntryRecordVo> listPostedEntries(@Param("subjectCode") String subjectCode, |
| | | @Param("startDate") LocalDate startDate, |
| | | @Param("endDate") LocalDate endDate, |
| | | @Param("auxiliaryType") String auxiliaryType, |
| | | @Param("auxiliaryId") String auxiliaryId); |
| | | |
| | | List<FinLedgerEntryRecordVo> listPostedEntriesBefore(@Param("subjectCode") String subjectCode, |
| | | @Param("beforeDate") LocalDate beforeDate, |
| | | @Param("auxiliaryType") String auxiliaryType, |
| | | @Param("auxiliaryId") String auxiliaryId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.mapper.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * åè¯ä¸»è¡¨ Mapperã |
| | | */ |
| | | @Mapper |
| | | public interface FinVoucherMapper extends BaseMapper<FinVoucher> { |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç¶ç§ç®IDï¼ä¸ºç©ºè¡¨ç¤ºæ ¹èç¹ï¼ |
| | | */ |
| | | @ApiModelProperty("ç¶ç§ç®IDï¼ä¸ºç©ºè¡¨ç¤ºæ ¹èç¹ï¼") |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * ç§ç®ç¼ç (å¯ä¸æ è¯) |
| | | */ |
| | | @ApiModelProperty("ç§ç®ç¼ç (å¯ä¸æ è¯)") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.financial; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * åºå®èµäº§å®ä½ã |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_fixed_asset") |
| | | @ApiModel(value = "FinFixedAsset对象", description = "åºå®èµäº§") |
| | | public class FinFixedAsset implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("èµäº§ç¼å·") |
| | | private String assetCode; |
| | | |
| | | @ApiModelProperty("èµäº§åç§°") |
| | | private String assetName; |
| | | |
| | | @ApiModelProperty("èµäº§ç±»å«") |
| | | private String category; |
| | | |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | private String specification; |
| | | |
| | | @ApiModelProperty("è´ç½®æ¥æ") |
| | | private LocalDate purchaseDate; |
| | | |
| | | @ApiModelProperty("èµäº§åå¼") |
| | | private BigDecimal originalValue; |
| | | |
| | | @ApiModelProperty("使ç¨å¹´é(å¹´)") |
| | | private Integer usefulLife; |
| | | |
| | | @ApiModelProperty("æ®å¼ç(%)") |
| | | private BigDecimal residualRate; |
| | | |
| | | @ApiModelProperty("ç´¯è®¡ææ§") |
| | | private BigDecimal accumulatedDepreciation; |
| | | |
| | | @ApiModelProperty("åå¼") |
| | | private BigDecimal netValue; |
| | | |
| | | @ApiModelProperty("åæ¾å°ç¹") |
| | | private String location; |
| | | |
| | | @ApiModelProperty("使ç¨é¨é¨") |
| | | private String department; |
| | | |
| | | @ApiModelProperty("ä¿ç®¡äºº") |
| | | private String keeper; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.financial; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§å®ä½ã |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_intangible_asset") |
| | | @ApiModel(value = "FinIntangibleAsset对象", description = "æ å½¢èµäº§") |
| | | public class FinIntangibleAsset implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("èµäº§ç¼å·") |
| | | private String assetCode; |
| | | |
| | | @ApiModelProperty("èµäº§åç§°") |
| | | private String assetName; |
| | | |
| | | @ApiModelProperty("èµäº§ç±»å«") |
| | | private String category; |
| | | |
| | | @ApiModelProperty("è¯ä¹¦ç¼å·") |
| | | private String certificateNo; |
| | | |
| | | @ApiModelProperty("å徿¥æ") |
| | | private LocalDate acquisitionDate; |
| | | |
| | | @ApiModelProperty("èµäº§åå¼") |
| | | private BigDecimal originalValue; |
| | | |
| | | @ApiModelProperty("æéå¹´é(å¹´)") |
| | | private Integer amortizationPeriod; |
| | | |
| | | @ApiModelProperty("æ®å¼ç(%)") |
| | | private BigDecimal residualRate; |
| | | |
| | | @ApiModelProperty("累计æé") |
| | | private BigDecimal accumulatedAmortization; |
| | | |
| | | @ApiModelProperty("åå¼") |
| | | private BigDecimal netValue; |
| | | |
| | | @ApiModelProperty("æææè³") |
| | | private LocalDate validityDate; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("èµäº§æè¿°") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.financial; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * åè¯ä¸»è¡¨å®ä½ã |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_voucher") |
| | | @ApiModel(value = "FinVoucher对象", description = "åè¯ä¸»è¡¨") |
| | | public class FinVoucher implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("åè¯åå·") |
| | | private String voucherNo; |
| | | |
| | | @ApiModelProperty("åè¯æ¥æ") |
| | | private LocalDate voucherDate; |
| | | |
| | | @ApiModelProperty("æè¦") |
| | | private String summary; |
| | | |
| | | @ApiModelProperty("åæ¹å计") |
| | | private BigDecimal debit; |
| | | |
| | | @ApiModelProperty("è´·æ¹å计") |
| | | private BigDecimal credit; |
| | | |
| | | @ApiModelProperty("å¶å人") |
| | | private String creator; |
| | | |
| | | @ApiModelProperty("ç¶æ: unposted/posted/cancelled") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("éä»¶æ°é") |
| | | private Integer attachmentCount; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.pojo.financial; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * åè¯åå½å®ä½ã |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("fin_voucher_entry") |
| | | @ApiModel(value = "FinVoucherEntry对象", description = "åè¯åå½") |
| | | public class FinVoucherEntry implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("åè¯ID") |
| | | private Long voucherId; |
| | | |
| | | @ApiModelProperty("è¡å·") |
| | | private Integer rowNo; |
| | | |
| | | @ApiModelProperty("ç§ç®ç¼ç ") |
| | | private String subjectCode; |
| | | |
| | | @ApiModelProperty("ç§ç®åç§°") |
| | | private String subjectName; |
| | | |
| | | @ApiModelProperty("æè¦") |
| | | private String summary; |
| | | |
| | | @ApiModelProperty("åæ¹éé¢") |
| | | private BigDecimal debit; |
| | | |
| | | @ApiModelProperty("è´·æ¹éé¢") |
| | | private BigDecimal credit; |
| | | |
| | | @ApiModelProperty("è¾
婿 ¸ç®ç±»å") |
| | | private String auxiliaryType; |
| | | |
| | | @ApiModelProperty("è¾
婿 ¸ç®å¯¹è±¡ID") |
| | | private String auxiliaryId; |
| | | |
| | | @ApiModelProperty("è¾
婿 ¸ç®å¯¹è±¡åç§°") |
| | | private String auxiliaryName; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | 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 jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéå®é¨å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | public interface AccountPurchaseService { |
| | | IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto); |
| | | |
| | | void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto); |
| | | |
| | | IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto); |
| | | |
| | | void exportAccountPurchaseReturn(HttpServletResponse response, PurchaseReturnDto purchaseReturnDto); |
| | | } |
| | |
| | | */ |
| | | public interface AccountSalesService { |
| | | |
| | | IPage<SalesOutboundVo> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto); |
| | | IPage<SalesOutboundVo> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto); |
| | | |
| | | void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto); |
| | | |
| | | IPage<SalesReturnVo> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto); |
| | | IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto); |
| | | |
| | | void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æ»è´¦ç§ç®è¡¨ æå¡ç±» |
| | |
| | | |
| | | IPage<AccountSubjectVo> baseList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto); |
| | | |
| | | Boolean saveAccountSubject(AccountSubjectDto accountSubjectDto); |
| | | |
| | | Boolean updateAccountSubject(AccountSubjectDto accountSubjectDto); |
| | | |
| | | Boolean removeAccountSubjectByIds(List<Long> ids); |
| | | |
| | | void exportAccountSubject(HttpServletResponse response); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.financial.FinFixedAssetDto; |
| | | import com.ruoyi.account.pojo.financial.FinFixedAsset; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åºå®èµäº§æå¡ã |
| | | */ |
| | | public interface FinFixedAssetService extends IService<FinFixedAsset> { |
| | | |
| | | IPage<FinFixedAsset> pageList(Page<FinFixedAsset> page, FinFixedAssetDto queryDto); |
| | | |
| | | Boolean add(FinFixedAssetDto dto); |
| | | |
| | | Boolean update(FinFixedAssetDto dto); |
| | | |
| | | Boolean deleteByIds(List<Long> ids); |
| | | |
| | | Map<String, Object> depreciate(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.financial.FinIntangibleAssetDto; |
| | | import com.ruoyi.account.pojo.financial.FinIntangibleAsset; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§æå¡ã |
| | | */ |
| | | public interface FinIntangibleAssetService extends IService<FinIntangibleAsset> { |
| | | |
| | | IPage<FinIntangibleAsset> pageList(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto); |
| | | |
| | | Boolean add(FinIntangibleAssetDto dto); |
| | | |
| | | Boolean update(FinIntangibleAssetDto dto); |
| | | |
| | | Boolean deleteByIds(List<Long> ids); |
| | | |
| | | Map<String, Object> amortize(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.financial; |
| | | |
| | | import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç§ç®è´¦æå¡ã |
| | | */ |
| | | public interface FinLedgerService { |
| | | |
| | | List<FinLedgerRowVo> queryGeneralLedger(FinLedgerQueryDto queryDto); |
| | | |
| | | List<FinLedgerRowVo> queryDetailLedger(FinDetailLedgerQueryDto queryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.financial; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo; |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | |
| | | /** |
| | | * åè¯æå¡ã |
| | | */ |
| | | public interface FinVoucherService extends IService<FinVoucher> { |
| | | |
| | | IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto); |
| | | |
| | | Boolean addVoucher(FinVoucherDto dto); |
| | | |
| | | Boolean updateVoucher(FinVoucherDto dto); |
| | | |
| | | Boolean postVoucher(Long id); |
| | | |
| | | Boolean cancelVoucher(Long id); |
| | | |
| | | FinVoucherDetailVo detail(Long id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | 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.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¢å¡ç®¡ççéå®é¨å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-07 04:45:30 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AccountPurchaseServiceImpl implements AccountPurchaseService { |
| | | |
| | | private final StockInRecordMapper stockInRecordMapper; |
| | | |
| | | private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto) { |
| | | return stockInRecordMapper.listPageAccountPurchase(page,purchaseInboundDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto) { |
| | | List<PurchaseInboundVo> list = stockInRecordMapper.listPageAccountPurchase(new Page(1,-1),purchaseInboundDto).getRecords(); |
| | | ExcelUtil<PurchaseInboundVo> util = new ExcelUtil<>(PurchaseInboundVo.class); |
| | | util.exportExcel(response, list , "éè´å
¥åº"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto) { |
| | | return purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(page,purchaseReturnDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountPurchaseReturn(HttpServletResponse response, PurchaseReturnDto purchaseReturnDto) { |
| | | List<PurchaseReturnVo> list = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1,-1),purchaseReturnDto).getRecords(); |
| | | ExcelUtil<PurchaseReturnVo> util = new ExcelUtil<>(PurchaseReturnVo.class); |
| | | util.exportExcel(response, list , "éè´éè´§"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.service.AccountSalesService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @RequiredArgsConstructor |
| | | public class AccountSalesServiceImpl implements AccountSalesService { |
| | | |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesOutboundVo> listPageByOutbound(Page page, SalesOutboundDto salesOutboundDto) { |
| | | return shippingInfoMapper.listPageByOutbound(page,salesOutboundDto); |
| | | public IPage<SalesOutboundVo> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto) { |
| | | return stockOutRecordMapper.listPageAccountSales(page,salesOutboundDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto) { |
| | | List<SalesOutboundVo> list = shippingInfoMapper.listPageByOutbound(new Page(1,-1),salesOutboundDto).getRecords(); |
| | | List<SalesOutboundVo> list = stockOutRecordMapper.listPageAccountSales(new Page(1,-1),salesOutboundDto).getRecords(); |
| | | ExcelUtil<SalesOutboundVo> util = new ExcelUtil<>(SalesOutboundVo.class); |
| | | util.exportExcel(response, list , "éå®åºåº"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesReturnVo> listPageBySalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | return returnManagementMapper.listPageBySalesReturn(page,salesReturnDto); |
| | | public IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto) { |
| | | return returnManagementMapper.listPageAccountSalesReturn(page,salesReturnDto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto) { |
| | | List<SalesReturnVo> list = returnManagementMapper.listPageBySalesReturn(new Page(1,-1),salesReturnDto).getRecords(); |
| | | List<SalesReturnVo> list = returnManagementMapper.listPageAccountSalesReturn(new Page(1,-1),salesReturnDto).getRecords(); |
| | | ExcelUtil<SalesReturnVo> util = new ExcelUtil<>(SalesReturnVo.class); |
| | | util.exportExcel(response, list , "éå®éè´§"); |
| | | } |
| | |
| | | import com.ruoyi.account.mapper.AccountSubjectMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.service.AccountSubjectService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public IPage<AccountSubjectVo> baseList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto) { |
| | | LambdaQueryWrapper<AccountSubject> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (accountSubjectDto != null && StringUtils.isNotEmpty(accountSubjectDto.getSubjectCode())) { |
| | | queryWrapper.like(AccountSubject::getSubjectCode, accountSubjectDto.getSubjectCode()); |
| | | } |
| | | if (accountSubjectDto != null && StringUtils.isNotEmpty(accountSubjectDto.getSubjectName())) { |
| | | queryWrapper.like(AccountSubject::getSubjectName, accountSubjectDto.getSubjectName()); |
| | | } |
| | | if (accountSubjectDto != null && StringUtils.isNotEmpty(accountSubjectDto.getSubjectType())) { |
| | | queryWrapper.eq(AccountSubject::getSubjectType, accountSubjectDto.getSubjectType()); |
| | | } |
| | | queryWrapper.orderByDesc(AccountSubject::getId); |
| | | Page<AccountSubjectDto> requestPage = page == null ? new Page<>(1, 10) : page; |
| | | List<AccountSubject> allSubjects = list(loadBaseQueryWrapper(accountSubjectDto)); |
| | | List<AccountSubject> filteredSubjects = applyTreeFilter(allSubjects, accountSubjectDto); |
| | | List<AccountSubjectVo> fullTree = buildTree(filteredSubjects); |
| | | |
| | | Page<AccountSubject> entityPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal()); |
| | | Page<AccountSubject> paramPage = page(entityPage, queryWrapper); |
| | | long current = requestPage.getCurrent() <= 0 ? 1 : requestPage.getCurrent(); |
| | | long size = requestPage.getSize() <= 0 ? 10 : requestPage.getSize(); |
| | | int fromIndex = (int) Math.min((current - 1) * size, fullTree.size()); |
| | | int toIndex = (int) Math.min(fromIndex + size, fullTree.size()); |
| | | List<AccountSubjectVo> pagedRoots = fromIndex >= toIndex |
| | | ? Collections.emptyList() |
| | | : fullTree.subList(fromIndex, toIndex); |
| | | |
| | | Page<AccountSubjectVo> resultPage = new Page<>(paramPage.getCurrent(), paramPage.getSize(), paramPage.getTotal()); |
| | | List<AccountSubjectVo> records = new ArrayList<>(paramPage.getRecords().size()); |
| | | for (AccountSubject item : paramPage.getRecords()) { |
| | | AccountSubjectVo vo = new AccountSubjectVo(); |
| | | BeanUtils.copyProperties(item, vo); |
| | | records.add(vo); |
| | | } |
| | | resultPage.setRecords(records); |
| | | Page<AccountSubjectVo> resultPage = new Page<>(current, size, fullTree.size()); |
| | | resultPage.setRecords(pagedRoots); |
| | | return resultPage; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean saveAccountSubject(AccountSubjectDto accountSubjectDto) { |
| | | validateSubjectRequiredFields(accountSubjectDto); |
| | | validateSubjectCodeUnique(accountSubjectDto, false); |
| | | validateParent(accountSubjectDto.getParentId(), null); |
| | | if (accountSubjectDto.getStatus() == null) { |
| | | accountSubjectDto.setStatus(0); |
| | | } |
| | | return save(accountSubjectDto); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateAccountSubject(AccountSubjectDto accountSubjectDto) { |
| | | if (accountSubjectDto == null || accountSubjectDto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼ç§ç®IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (getById(accountSubjectDto.getId()) == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼æªæ¾å°å¯¹åºç§ç®"); |
| | | } |
| | | validateParent(accountSubjectDto.getParentId(), accountSubjectDto.getId()); |
| | | validateSubjectRequiredFields(accountSubjectDto); |
| | | validateSubjectCodeUnique(accountSubjectDto, true); |
| | | return updateById(accountSubjectDto); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean removeAccountSubjectByIds(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return true; |
| | | } |
| | | List<AccountSubject> allSubjects = list(); |
| | | if (allSubjects == null || allSubjects.isEmpty()) { |
| | | return true; |
| | | } |
| | | Map<Long, List<Long>> childrenIdMap = buildChildrenIdMap(allSubjects); |
| | | Set<Long> removeIds = new LinkedHashSet<>(); |
| | | for (Long id : ids) { |
| | | collectDescendantIds(id, childrenIdMap, removeIds); |
| | | } |
| | | if (removeIds.isEmpty()) { |
| | | return true; |
| | | } |
| | | List<String> subjectCodes = allSubjects.stream() |
| | | .filter(subject -> removeIds.contains(subject.getId())) |
| | | .map(AccountSubject::getSubjectCode) |
| | | .filter(StringUtils::isNotEmpty) |
| | | .collect(Collectors.toList()); |
| | | if (!subjectCodes.isEmpty()) { |
| | | Long referencedCount = accountSubjectMapper.countReferencedBySubjectCodes(subjectCodes); |
| | | if (referencedCount != null && referencedCount > 0) { |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼ç§ç®å·²è¢«åè¯åå½å¼ç¨"); |
| | | } |
| | | } |
| | | return removeByIds(removeIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ExcelUtil<AccountSubjectImportDto> util = new ExcelUtil<>(AccountSubjectImportDto.class); |
| | | util.exportExcel(response, importDtos , "æ»è´¦ç§ç®"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªç§ç®å¿
å¡«åæ®µï¼é¿å
èæ°æ®åå
¥ã |
| | | */ |
| | | private void validateSubjectRequiredFields(AccountSubjectDto accountSubjectDto) { |
| | | if (accountSubjectDto == null) { |
| | | throw new ServiceException("æ»è´¦ç§ç®æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(accountSubjectDto.getSubjectCode())) { |
| | | throw new ServiceException("ç§ç®ç¼ç ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(accountSubjectDto.getSubjectName())) { |
| | | throw new ServiceException("ç§ç®åç§°ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(accountSubjectDto.getSubjectType())) { |
| | | throw new ServiceException("ç§ç®ç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªç§ç®ç¼ç å¯ä¸ï¼æ°å¢åä¿®æ¹é½è¦æ§è¡ã |
| | | */ |
| | | private void validateSubjectCodeUnique(AccountSubjectDto accountSubjectDto, boolean isUpdate) { |
| | | LambdaQueryWrapper<AccountSubject> codeQueryWrapper = new LambdaQueryWrapper<>(); |
| | | codeQueryWrapper.eq(AccountSubject::getSubjectCode, accountSubjectDto.getSubjectCode()); |
| | | if (isUpdate) { |
| | | codeQueryWrapper.ne(AccountSubject::getId, accountSubjectDto.getId()); |
| | | } |
| | | AccountSubject exists = getOne(codeQueryWrapper, false); |
| | | if (Objects.nonNull(exists)) { |
| | | throw new ServiceException("ç§ç®ç¼ç å·²åå¨ï¼è¯·å¿éå¤æäº¤"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä»
æéç¨è¿æ»¤æ¡ä»¶æ¥è¯¢åºç¡æ°æ®ï¼æ å½¢è¿æ»¤åç»ååï¼ã |
| | | */ |
| | | private LambdaQueryWrapper<AccountSubject> loadBaseQueryWrapper(AccountSubjectDto accountSubjectDto) { |
| | | LambdaQueryWrapper<AccountSubject> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (accountSubjectDto != null && accountSubjectDto.getStatus() != null) { |
| | | queryWrapper.eq(AccountSubject::getStatus, accountSubjectDto.getStatus()); |
| | | } |
| | | queryWrapper.orderByAsc(AccountSubject::getSubjectCode).orderByAsc(AccountSubject::getId); |
| | | return queryWrapper; |
| | | } |
| | | |
| | | /** |
| | | * æ å½¢è¿æ»¤ï¼å½ä¸èç¹åä¿çå
¶ç¶é¾ä¸åæ ï¼ä¿è¯éå½ç»æå®æ´ã |
| | | */ |
| | | private List<AccountSubject> applyTreeFilter(List<AccountSubject> allSubjects, AccountSubjectDto queryDto) { |
| | | if (allSubjects == null || allSubjects.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | boolean hasFilter = queryDto != null && ( |
| | | StringUtils.isNotEmpty(queryDto.getSubjectCode()) |
| | | || StringUtils.isNotEmpty(queryDto.getSubjectName()) |
| | | || StringUtils.isNotEmpty(queryDto.getSubjectType()) |
| | | ); |
| | | if (!hasFilter) { |
| | | return allSubjects; |
| | | } |
| | | |
| | | Map<Long, AccountSubject> subjectMap = allSubjects.stream() |
| | | .filter(item -> item.getId() != null) |
| | | .collect(Collectors.toMap(AccountSubject::getId, item -> item, (a, b) -> a, LinkedHashMap::new)); |
| | | Map<Long, List<AccountSubject>> childrenMap = buildChildrenMap(allSubjects); |
| | | |
| | | Set<Long> matchedIds = new LinkedHashSet<>(); |
| | | for (AccountSubject subject : allSubjects) { |
| | | if (subject.getId() == null) { |
| | | continue; |
| | | } |
| | | if (matchesFilter(subject, queryDto)) { |
| | | matchedIds.add(subject.getId()); |
| | | } |
| | | } |
| | | if (matchedIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | Set<Long> resultIds = new LinkedHashSet<>(matchedIds); |
| | | for (Long matchedId : matchedIds) { |
| | | addAncestors(matchedId, subjectMap, resultIds); |
| | | addDescendants(matchedId, childrenMap, resultIds); |
| | | } |
| | | |
| | | return allSubjects.stream() |
| | | .filter(item -> item.getId() != null && resultIds.contains(item.getId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private boolean matchesFilter(AccountSubject subject, AccountSubjectDto queryDto) { |
| | | if (queryDto == null) { |
| | | return true; |
| | | } |
| | | if (StringUtils.isNotEmpty(queryDto.getSubjectCode()) |
| | | && (subject.getSubjectCode() == null || !subject.getSubjectCode().contains(queryDto.getSubjectCode()))) { |
| | | return false; |
| | | } |
| | | if (StringUtils.isNotEmpty(queryDto.getSubjectName()) |
| | | && (subject.getSubjectName() == null || !subject.getSubjectName().contains(queryDto.getSubjectName()))) { |
| | | return false; |
| | | } |
| | | if (StringUtils.isNotEmpty(queryDto.getSubjectType()) |
| | | && !queryDto.getSubjectType().equals(subject.getSubjectType())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private void addAncestors(Long subjectId, Map<Long, AccountSubject> subjectMap, Set<Long> resultIds) { |
| | | AccountSubject current = subjectMap.get(subjectId); |
| | | if (current == null) { |
| | | return; |
| | | } |
| | | Long parentId = current.getParentId(); |
| | | while (parentId != null && parentId > 0) { |
| | | AccountSubject parent = subjectMap.get(parentId); |
| | | if (parent == null) { |
| | | break; |
| | | } |
| | | if (!resultIds.add(parent.getId())) { |
| | | break; |
| | | } |
| | | parentId = parent.getParentId(); |
| | | } |
| | | } |
| | | |
| | | private void addDescendants(Long subjectId, Map<Long, List<AccountSubject>> childrenMap, Set<Long> resultIds) { |
| | | List<AccountSubject> children = childrenMap.getOrDefault(subjectId, Collections.emptyList()); |
| | | for (AccountSubject child : children) { |
| | | if (child.getId() == null) { |
| | | continue; |
| | | } |
| | | if (resultIds.add(child.getId())) { |
| | | addDescendants(child.getId(), childrenMap, resultIds); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Map<Long, List<AccountSubject>> buildChildrenMap(List<AccountSubject> subjects) { |
| | | Map<Long, List<AccountSubject>> childrenMap = new HashMap<>(); |
| | | for (AccountSubject subject : subjects) { |
| | | if (subject.getId() == null) { |
| | | continue; |
| | | } |
| | | Long parentId = subject.getParentId(); |
| | | if (parentId == null || parentId <= 0) { |
| | | continue; |
| | | } |
| | | childrenMap.computeIfAbsent(parentId, key -> new ArrayList<>()).add(subject); |
| | | } |
| | | return childrenMap; |
| | | } |
| | | |
| | | /** |
| | | * åºäº parentId éå½æå»ºç§ç®æ ã |
| | | */ |
| | | private List<AccountSubjectVo> buildTree(List<AccountSubject> subjects) { |
| | | if (subjects == null || subjects.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<AccountSubject> sortedSubjects = new ArrayList<>(subjects); |
| | | sortedSubjects.sort(Comparator |
| | | .comparing(AccountSubject::getSubjectCode, Comparator.nullsLast(String::compareTo)) |
| | | .thenComparing(AccountSubject::getId, Comparator.nullsLast(Long::compareTo))); |
| | | |
| | | Map<Long, AccountSubjectVo> subjectVoMap = new LinkedHashMap<>(); |
| | | for (AccountSubject subject : sortedSubjects) { |
| | | if (subject.getId() == null) { |
| | | continue; |
| | | } |
| | | AccountSubjectVo vo = new AccountSubjectVo(); |
| | | BeanUtils.copyProperties(subject, vo); |
| | | subjectVoMap.put(subject.getId(), vo); |
| | | } |
| | | |
| | | List<AccountSubjectVo> roots = new ArrayList<>(); |
| | | for (AccountSubject subject : sortedSubjects) { |
| | | if (subject.getId() == null) { |
| | | continue; |
| | | } |
| | | AccountSubjectVo current = subjectVoMap.get(subject.getId()); |
| | | Long parentId = subject.getParentId(); |
| | | if (parentId != null && parentId > 0 && subjectVoMap.containsKey(parentId)) { |
| | | subjectVoMap.get(parentId).getChildren().add(current); |
| | | } else { |
| | | roots.add(current); |
| | | } |
| | | } |
| | | |
| | | markLeafRecursively(roots); |
| | | return roots; |
| | | } |
| | | |
| | | private void markLeafRecursively(List<AccountSubjectVo> nodes) { |
| | | for (AccountSubjectVo node : nodes) { |
| | | List<AccountSubjectVo> children = node.getChildren(); |
| | | node.setLeaf(children == null || children.isEmpty()); |
| | | if (children != null && !children.isEmpty()) { |
| | | markLeafRecursively(children); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªç¶åå
³ç³»ï¼ç¶èç¹å¿
é¡»åå¨ï¼ä¸ä¸è½å½¢æå¾ªç¯å¼ç¨ã |
| | | */ |
| | | private void validateParent(Long parentId, Long currentId) { |
| | | if (parentId == null || parentId <= 0) { |
| | | return; |
| | | } |
| | | if (currentId != null && parentId.equals(currentId)) { |
| | | throw new ServiceException("ç¶ç§ç®ä¸è½éæ©èªèº«"); |
| | | } |
| | | AccountSubject parent = getById(parentId); |
| | | if (parent == null) { |
| | | throw new ServiceException("ç¶ç§ç®ä¸åå¨ï¼è¯·éæ°éæ©"); |
| | | } |
| | | // 鲿¢å½¢æç¯ï¼æ´æ°æ¶ï¼ç¶èç¹ä¸è½æ¯å½åèç¹çä»»æååèç¹ã |
| | | if (currentId != null) { |
| | | Set<Long> visited = new HashSet<>(); |
| | | Long traceParentId = parentId; |
| | | while (traceParentId != null && traceParentId > 0) { |
| | | if (!visited.add(traceParentId)) { |
| | | throw new ServiceException("ç§ç®å±çº§åå¨å¾ªç¯å¼ç¨ï¼è¯·æ£æ¥ç¶ç§ç®è®¾ç½®"); |
| | | } |
| | | if (traceParentId.equals(currentId)) { |
| | | throw new ServiceException("ç¶ç§ç®ä¸è½æ¯å½åç§ç®æå
¶åç§ç®"); |
| | | } |
| | | AccountSubject traceNode = getById(traceParentId); |
| | | if (traceNode == null) { |
| | | break; |
| | | } |
| | | traceParentId = traceNode.getParentId(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Map<Long, List<Long>> buildChildrenIdMap(List<AccountSubject> subjects) { |
| | | Map<Long, List<Long>> map = new HashMap<>(); |
| | | for (AccountSubject subject : subjects) { |
| | | if (subject.getId() == null || subject.getParentId() == null || subject.getParentId() <= 0) { |
| | | continue; |
| | | } |
| | | map.computeIfAbsent(subject.getParentId(), key -> new ArrayList<>()).add(subject.getId()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * æ¶éå¾
å é¤èç¹åå
¶ææååèç¹ã |
| | | */ |
| | | private void collectDescendantIds(Long id, Map<Long, List<Long>> childrenIdMap, Set<Long> result) { |
| | | if (id == null || !result.add(id)) { |
| | | return; |
| | | } |
| | | List<Long> children = childrenIdMap.getOrDefault(id, Collections.emptyList()); |
| | | for (Long childId : children) { |
| | | collectDescendantIds(childId, childrenIdMap, result); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinFixedAssetDto; |
| | | import com.ruoyi.account.mapper.financial.FinFixedAssetMapper; |
| | | import com.ruoyi.account.pojo.financial.FinFixedAsset; |
| | | import com.ruoyi.account.service.financial.FinFixedAssetService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * åºå®èµäº§æå¡å®ç°ã |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FinFixedAssetServiceImpl extends ServiceImpl<FinFixedAssetMapper, FinFixedAsset> implements FinFixedAssetService { |
| | | |
| | | private static final BigDecimal ONE_HUNDRED = new BigDecimal("100"); |
| | | private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | |
| | | @Override |
| | | public IPage<FinFixedAsset> pageList(Page<FinFixedAsset> page, FinFixedAssetDto queryDto) { |
| | | LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetCode())) { |
| | | wrapper.like(FinFixedAsset::getAssetCode, queryDto.getAssetCode()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetName())) { |
| | | wrapper.like(FinFixedAsset::getAssetName, queryDto.getAssetName()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCategory())) { |
| | | wrapper.eq(FinFixedAsset::getCategory, queryDto.getCategory()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) { |
| | | wrapper.eq(FinFixedAsset::getStatus, queryDto.getStatus()); |
| | | } |
| | | wrapper.orderByDesc(FinFixedAsset::getId); |
| | | return page(page, wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(FinFixedAssetDto dto) { |
| | | validateForSave(dto, false); |
| | | if (StringUtils.isEmpty(dto.getAssetCode())) { |
| | | dto.setAssetCode(generateAssetCode()); |
| | | } |
| | | BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate()); |
| | | dto.setResidualRate(residualRate); |
| | | BigDecimal accumulatedDepreciation = defaultMoney(dto.getAccumulatedDepreciation()); |
| | | dto.setAccumulatedDepreciation(accumulatedDepreciation); |
| | | dto.setNetValue(calculateNetValue(dto.getOriginalValue(), accumulatedDepreciation)); |
| | | if (StringUtils.isEmpty(dto.getStatus())) { |
| | | dto.setStatus("in_use"); |
| | | } |
| | | return save(dto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean update(FinFixedAssetDto dto) { |
| | | if (dto == null || dto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼èµäº§IDä¸è½ä¸ºç©º"); |
| | | } |
| | | FinFixedAsset existed = getById(dto.getId()); |
| | | if (existed == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼åºå®èµäº§ä¸åå¨"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getAssetCode())) { |
| | | dto.setAssetCode(existed.getAssetCode()); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getStatus())) { |
| | | dto.setStatus(existed.getStatus()); |
| | | } |
| | | validateForSave(dto, true); |
| | | BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate()); |
| | | dto.setResidualRate(residualRate); |
| | | if (dto.getAccumulatedDepreciation() == null) { |
| | | dto.setAccumulatedDepreciation(defaultMoney(existed.getAccumulatedDepreciation())); |
| | | } |
| | | dto.setNetValue(calculateNetValue(dto.getOriginalValue(), dto.getAccumulatedDepreciation())); |
| | | return updateById(dto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteByIds(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼è¯·éæ©è¦å é¤çæ°æ®"); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, Object> depreciate(List<Long> ids) { |
| | | LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | if (ids != null && !ids.isEmpty()) { |
| | | wrapper.in(FinFixedAsset::getId, ids); |
| | | } else { |
| | | wrapper.eq(FinFixedAsset::getStatus, "in_use"); |
| | | } |
| | | List<FinFixedAsset> assets = list(wrapper); |
| | | BigDecimal totalMonthlyDepreciation = ZERO; |
| | | int processedCount = 0; |
| | | for (FinFixedAsset asset : assets) { |
| | | if (!"in_use".equals(asset.getStatus())) { |
| | | continue; |
| | | } |
| | | BigDecimal monthlyDepreciation = calculateMonthlyDepreciation( |
| | | asset.getOriginalValue(), |
| | | asset.getResidualRate(), |
| | | asset.getUsefulLife() |
| | | ); |
| | | BigDecimal accumulatedDepreciation = defaultMoney(asset.getAccumulatedDepreciation()).add(monthlyDepreciation); |
| | | if (accumulatedDepreciation.compareTo(defaultMoney(asset.getOriginalValue())) > 0) { |
| | | accumulatedDepreciation = defaultMoney(asset.getOriginalValue()); |
| | | } |
| | | asset.setAccumulatedDepreciation(roundMoney(accumulatedDepreciation)); |
| | | asset.setNetValue(calculateNetValue(asset.getOriginalValue(), asset.getAccumulatedDepreciation())); |
| | | updateById(asset); |
| | | processedCount++; |
| | | totalMonthlyDepreciation = totalMonthlyDepreciation.add(monthlyDepreciation); |
| | | } |
| | | Map<String, Object> result = new HashMap<>(4); |
| | | result.put("processedCount", processedCount); |
| | | result.put("totalMonthlyDepreciation", roundMoney(totalMonthlyDepreciation)); |
| | | result.put("executionTime", LocalDateTime.now()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æææ¡£è§åæ ¡éªåºå®èµäº§æ°æ®ã |
| | | */ |
| | | private void validateForSave(FinFixedAssetDto dto, boolean isUpdate) { |
| | | if (dto == null) { |
| | | throw new ServiceException("åºå®èµäº§æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (isUpdate && dto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼èµäº§IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getAssetName())) { |
| | | throw new ServiceException("èµäº§åç§°ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getCategory())) { |
| | | throw new ServiceException("èµäº§ç±»å«ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getPurchaseDate() == null) { |
| | | throw new ServiceException("è´ç½®æ¥æä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getOriginalValue() == null || dto.getOriginalValue().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("èµäº§åå¼ä¸è½ä¸ºç©ºä¸ä¸è½å°äº0"); |
| | | } |
| | | if (dto.getUsefulLife() == null || dto.getUsefulLife() <= 0) { |
| | | throw new ServiceException("使ç¨å¹´éå¿
须大äº0"); |
| | | } |
| | | if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("æ®å¼çä¸è½å°äº0"); |
| | | } |
| | | if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(ONE_HUNDRED) > 0) { |
| | | throw new ServiceException("æ®å¼çä¸è½å¤§äº100%"); |
| | | } |
| | | if (StringUtils.isNotEmpty(dto.getAssetCode())) { |
| | | LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(FinFixedAsset::getAssetCode, dto.getAssetCode()); |
| | | if (isUpdate) { |
| | | wrapper.ne(FinFixedAsset::getId, dto.getId()); |
| | | } |
| | | if (count(wrapper) > 0) { |
| | | throw new ServiceException("èµäº§ç¼å·å·²åå¨ï¼è¯·å¿éå¤æäº¤"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åºå®èµäº§ææ§å
¬å¼ï¼ |
| | | * monthlyDepreciation = originalValue * (1 - residualRate/100) / (usefulLife*12) |
| | | */ |
| | | private BigDecimal calculateMonthlyDepreciation(BigDecimal originalValue, BigDecimal residualRate, Integer usefulLife) { |
| | | BigDecimal normalizedOriginalValue = defaultMoney(originalValue); |
| | | BigDecimal normalizedResidualRate = normalizeResidualRate(residualRate); |
| | | BigDecimal depreciableRatio = BigDecimal.ONE.subtract(normalizedResidualRate.divide(ONE_HUNDRED, 8, RoundingMode.HALF_UP)); |
| | | BigDecimal months = BigDecimal.valueOf((long) usefulLife * 12L); |
| | | if (months.compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("使ç¨å¹´éæ æï¼æ æ³è®¡æææ§"); |
| | | } |
| | | return roundMoney(normalizedOriginalValue.multiply(depreciableRatio).divide(months, 8, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | /** |
| | | * åå¼ = åå¼ - ç´¯è®¡ææ§ã |
| | | */ |
| | | private BigDecimal calculateNetValue(BigDecimal originalValue, BigDecimal accumulatedDepreciation) { |
| | | BigDecimal value = defaultMoney(originalValue).subtract(defaultMoney(accumulatedDepreciation)); |
| | | if (value.compareTo(BigDecimal.ZERO) < 0) { |
| | | value = BigDecimal.ZERO; |
| | | } |
| | | return roundMoney(value); |
| | | } |
| | | |
| | | private BigDecimal normalizeResidualRate(BigDecimal residualRate) { |
| | | return residualRate == null ? BigDecimal.ZERO : residualRate; |
| | | } |
| | | |
| | | private BigDecimal defaultMoney(BigDecimal value) { |
| | | return value == null ? ZERO : roundMoney(value); |
| | | } |
| | | |
| | | private BigDecimal roundMoney(BigDecimal value) { |
| | | if (value == null) { |
| | | return ZERO; |
| | | } |
| | | return value.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private String generateAssetCode() { |
| | | return "GD" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinIntangibleAssetDto; |
| | | import com.ruoyi.account.mapper.financial.FinIntangibleAssetMapper; |
| | | import com.ruoyi.account.pojo.financial.FinIntangibleAsset; |
| | | import com.ruoyi.account.service.financial.FinIntangibleAssetService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * æ å½¢èµäº§æå¡å®ç°ã |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FinIntangibleAssetServiceImpl extends ServiceImpl<FinIntangibleAssetMapper, FinIntangibleAsset> implements FinIntangibleAssetService { |
| | | |
| | | private static final BigDecimal ONE_HUNDRED = new BigDecimal("100"); |
| | | private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | |
| | | @Override |
| | | public IPage<FinIntangibleAsset> pageList(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto) { |
| | | LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetCode())) { |
| | | wrapper.like(FinIntangibleAsset::getAssetCode, queryDto.getAssetCode()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetName())) { |
| | | wrapper.like(FinIntangibleAsset::getAssetName, queryDto.getAssetName()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCategory())) { |
| | | wrapper.eq(FinIntangibleAsset::getCategory, queryDto.getCategory()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) { |
| | | wrapper.eq(FinIntangibleAsset::getStatus, queryDto.getStatus()); |
| | | } |
| | | wrapper.orderByDesc(FinIntangibleAsset::getId); |
| | | return page(page, wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(FinIntangibleAssetDto dto) { |
| | | validateForSave(dto, false); |
| | | if (StringUtils.isEmpty(dto.getAssetCode())) { |
| | | dto.setAssetCode(generateAssetCode()); |
| | | } |
| | | BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate()); |
| | | dto.setResidualRate(residualRate); |
| | | BigDecimal accumulatedAmortization = defaultMoney(dto.getAccumulatedAmortization()); |
| | | dto.setAccumulatedAmortization(accumulatedAmortization); |
| | | dto.setNetValue(calculateNetValue(dto.getOriginalValue(), accumulatedAmortization)); |
| | | if (StringUtils.isEmpty(dto.getStatus())) { |
| | | dto.setStatus("in_use"); |
| | | } |
| | | return save(dto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean update(FinIntangibleAssetDto dto) { |
| | | if (dto == null || dto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼èµäº§IDä¸è½ä¸ºç©º"); |
| | | } |
| | | FinIntangibleAsset existed = getById(dto.getId()); |
| | | if (existed == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼æ å½¢èµäº§ä¸åå¨"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getAssetCode())) { |
| | | dto.setAssetCode(existed.getAssetCode()); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getStatus())) { |
| | | dto.setStatus(existed.getStatus()); |
| | | } |
| | | validateForSave(dto, true); |
| | | BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate()); |
| | | dto.setResidualRate(residualRate); |
| | | if (dto.getAccumulatedAmortization() == null) { |
| | | dto.setAccumulatedAmortization(defaultMoney(existed.getAccumulatedAmortization())); |
| | | } |
| | | dto.setNetValue(calculateNetValue(dto.getOriginalValue(), dto.getAccumulatedAmortization())); |
| | | if (dto.getNetValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | dto.setStatus("amortized"); |
| | | } else if ("amortized".equals(dto.getStatus())) { |
| | | dto.setStatus("in_use"); |
| | | } |
| | | if (dto.getValidityDate() != null |
| | | && dto.getValidityDate().isBefore(LocalDate.now()) |
| | | && !"amortized".equals(dto.getStatus())) { |
| | | dto.setStatus("expired"); |
| | | } |
| | | return updateById(dto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteByIds(List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | throw new ServiceException("å é¤å¤±è´¥ï¼è¯·éæ©è¦å é¤çæ°æ®"); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, Object> amortize(List<Long> ids) { |
| | | LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | if (ids != null && !ids.isEmpty()) { |
| | | wrapper.in(FinIntangibleAsset::getId, ids); |
| | | } else { |
| | | wrapper.eq(FinIntangibleAsset::getStatus, "in_use"); |
| | | } |
| | | List<FinIntangibleAsset> assets = list(wrapper); |
| | | BigDecimal totalMonthlyAmortization = ZERO; |
| | | int processedCount = 0; |
| | | for (FinIntangibleAsset asset : assets) { |
| | | if (!"in_use".equals(asset.getStatus())) { |
| | | continue; |
| | | } |
| | | BigDecimal monthlyAmortization = calculateMonthlyAmortization( |
| | | asset.getOriginalValue(), |
| | | asset.getResidualRate(), |
| | | asset.getAmortizationPeriod() |
| | | ); |
| | | BigDecimal accumulatedAmortization = defaultMoney(asset.getAccumulatedAmortization()).add(monthlyAmortization); |
| | | if (accumulatedAmortization.compareTo(defaultMoney(asset.getOriginalValue())) > 0) { |
| | | accumulatedAmortization = defaultMoney(asset.getOriginalValue()); |
| | | } |
| | | asset.setAccumulatedAmortization(roundMoney(accumulatedAmortization)); |
| | | asset.setNetValue(calculateNetValue(asset.getOriginalValue(), asset.getAccumulatedAmortization())); |
| | | |
| | | // è§åï¼å½åå¼ <= 0 æ¶ï¼åå¼å½é¶å¹¶æ 记为已æéå®ã |
| | | if (asset.getNetValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | asset.setNetValue(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); |
| | | asset.setStatus("amortized"); |
| | | } else if (asset.getValidityDate() != null && asset.getValidityDate().isBefore(LocalDate.now())) { |
| | | asset.setStatus("expired"); |
| | | } |
| | | updateById(asset); |
| | | processedCount++; |
| | | totalMonthlyAmortization = totalMonthlyAmortization.add(monthlyAmortization); |
| | | } |
| | | Map<String, Object> result = new HashMap<>(4); |
| | | result.put("processedCount", processedCount); |
| | | result.put("totalMonthlyAmortization", roundMoney(totalMonthlyAmortization)); |
| | | result.put("executionTime", LocalDateTime.now()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æææ¡£è§åæ ¡éªæ å½¢èµäº§æ°æ®ã |
| | | */ |
| | | private void validateForSave(FinIntangibleAssetDto dto, boolean isUpdate) { |
| | | if (dto == null) { |
| | | throw new ServiceException("æ å½¢èµäº§æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (isUpdate && dto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼èµäº§IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getAssetName())) { |
| | | throw new ServiceException("èµäº§åç§°ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getCategory())) { |
| | | throw new ServiceException("èµäº§ç±»å«ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getAcquisitionDate() == null) { |
| | | throw new ServiceException("å徿¥æä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getOriginalValue() == null || dto.getOriginalValue().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("èµäº§åå¼ä¸è½ä¸ºç©ºä¸ä¸è½å°äº0"); |
| | | } |
| | | if (dto.getAmortizationPeriod() == null || dto.getAmortizationPeriod() <= 0) { |
| | | throw new ServiceException("æéå¹´éå¿
须大äº0"); |
| | | } |
| | | if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("æ®å¼çä¸è½å°äº0"); |
| | | } |
| | | if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(ONE_HUNDRED) > 0) { |
| | | throw new ServiceException("æ®å¼çä¸è½å¤§äº100%"); |
| | | } |
| | | if (StringUtils.isNotEmpty(dto.getAssetCode())) { |
| | | LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(FinIntangibleAsset::getAssetCode, dto.getAssetCode()); |
| | | if (isUpdate) { |
| | | wrapper.ne(FinIntangibleAsset::getId, dto.getId()); |
| | | } |
| | | if (count(wrapper) > 0) { |
| | | throw new ServiceException("èµäº§ç¼å·å·²åå¨ï¼è¯·å¿éå¤æäº¤"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ å½¢èµäº§æéå
¬å¼ï¼ |
| | | * monthlyAmortization = originalValue * (1 - residualRate/100) / (amortizationPeriod*12) |
| | | */ |
| | | private BigDecimal calculateMonthlyAmortization(BigDecimal originalValue, BigDecimal residualRate, Integer amortizationPeriod) { |
| | | BigDecimal normalizedOriginalValue = defaultMoney(originalValue); |
| | | BigDecimal normalizedResidualRate = normalizeResidualRate(residualRate); |
| | | BigDecimal amortizableRatio = BigDecimal.ONE.subtract(normalizedResidualRate.divide(ONE_HUNDRED, 8, RoundingMode.HALF_UP)); |
| | | BigDecimal months = BigDecimal.valueOf((long) amortizationPeriod * 12L); |
| | | if (months.compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("æéå¹´éæ æï¼æ æ³è®¡ææé"); |
| | | } |
| | | return roundMoney(normalizedOriginalValue.multiply(amortizableRatio).divide(months, 8, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | /** |
| | | * åå¼ = åå¼ - 累计æéã |
| | | */ |
| | | private BigDecimal calculateNetValue(BigDecimal originalValue, BigDecimal accumulatedAmortization) { |
| | | BigDecimal value = defaultMoney(originalValue).subtract(defaultMoney(accumulatedAmortization)); |
| | | if (value.compareTo(BigDecimal.ZERO) < 0) { |
| | | value = BigDecimal.ZERO; |
| | | } |
| | | return roundMoney(value); |
| | | } |
| | | |
| | | private BigDecimal normalizeResidualRate(BigDecimal residualRate) { |
| | | return residualRate == null ? BigDecimal.ZERO : residualRate; |
| | | } |
| | | |
| | | private BigDecimal defaultMoney(BigDecimal value) { |
| | | return value == null ? ZERO : roundMoney(value); |
| | | } |
| | | |
| | | private BigDecimal roundMoney(BigDecimal value) { |
| | | if (value == null) { |
| | | return ZERO; |
| | | } |
| | | return value.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private String generateAssetCode() { |
| | | return "WX" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.service.impl.financial; |
| | | |
| | | import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto; |
| | | import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto; |
| | | import com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo; |
| | | import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo; |
| | | import com.ruoyi.account.mapper.financial.FinVoucherEntryMapper; |
| | | import com.ruoyi.account.service.financial.FinLedgerService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * ç§ç®æ»è´¦/æç»è´¦æå¡å®ç°ã |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FinLedgerServiceImpl implements FinLedgerService { |
| | | |
| | | private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | private final FinVoucherEntryMapper finVoucherEntryMapper; |
| | | |
| | | @Override |
| | | public List<FinLedgerRowVo> queryGeneralLedger(FinLedgerQueryDto queryDto) { |
| | | if (queryDto == null || StringUtils.isEmpty(queryDto.getSubjectCode())) { |
| | | return Collections.emptyList(); |
| | | } |
| | | YearMonth startMonth = parseMonth(queryDto.getStartMonth(), "å¼å§æä»½"); |
| | | YearMonth endMonth = parseMonth(queryDto.getEndMonth(), "ç»ææä»½"); |
| | | if (startMonth.isAfter(endMonth)) { |
| | | throw new ServiceException("å¼å§æä»½ä¸è½å¤§äºç»ææä»½"); |
| | | } |
| | | return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, null, null); |
| | | } |
| | | |
| | | @Override |
| | | public List<FinLedgerRowVo> queryDetailLedger(FinDetailLedgerQueryDto queryDto) { |
| | | if (queryDto == null || StringUtils.isEmpty(queryDto.getSubjectCode())) { |
| | | return Collections.emptyList(); |
| | | } |
| | | YearMonth startMonth = parseMonth(queryDto.getStartMonth(), "å¼å§æä»½"); |
| | | YearMonth endMonth = parseMonth(queryDto.getEndMonth(), "ç»ææä»½"); |
| | | if (startMonth.isAfter(endMonth)) { |
| | | throw new ServiceException("å¼å§æä»½ä¸è½å¤§äºç»ææä»½"); |
| | | } |
| | | return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, queryDto.getAuxiliaryType(), queryDto.getAuxiliaryId()); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºè´¦ç°¿è¡æ°æ®ï¼è¾åºæåãåå½ãæ¬æåè®¡ãæ¬å¹´ç´¯è®¡ã |
| | | */ |
| | | private List<FinLedgerRowVo> buildLedgerRows(String subjectCode, |
| | | YearMonth startMonth, |
| | | YearMonth endMonth, |
| | | String auxiliaryType, |
| | | String auxiliaryId) { |
| | | LocalDate startDate = startMonth.atDay(1); |
| | | LocalDate endDate = endMonth.atEndOfMonth(); |
| | | |
| | | List<FinLedgerEntryRecordVo> openingEntries = finVoucherEntryMapper.listPostedEntriesBefore( |
| | | subjectCode, startDate, auxiliaryType, auxiliaryId |
| | | ); |
| | | BigDecimal openingBalance = calculateBalance(openingEntries); |
| | | |
| | | List<FinLedgerEntryRecordVo> currentPeriodEntries = finVoucherEntryMapper.listPostedEntries( |
| | | subjectCode, startDate, endDate, auxiliaryType, auxiliaryId |
| | | ); |
| | | Map<YearMonth, List<FinLedgerEntryRecordVo>> monthEntriesMap = groupEntriesByMonth(currentPeriodEntries); |
| | | |
| | | List<FinLedgerRowVo> rows = new ArrayList<>(); |
| | | BigDecimal runningBalance = openingBalance; |
| | | BigDecimal yearDebit = ZERO; |
| | | BigDecimal yearCredit = ZERO; |
| | | |
| | | for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) { |
| | | rows.add(buildOpeningRow(month.atDay(1), runningBalance)); |
| | | |
| | | List<FinLedgerEntryRecordVo> monthEntries = monthEntriesMap.getOrDefault(month, Collections.emptyList()); |
| | | BigDecimal monthDebit = ZERO; |
| | | BigDecimal monthCredit = ZERO; |
| | | for (FinLedgerEntryRecordVo entry : monthEntries) { |
| | | BigDecimal debit = money(entry.getDebit()); |
| | | BigDecimal credit = money(entry.getCredit()); |
| | | runningBalance = runningBalance.add(debit).subtract(credit); |
| | | monthDebit = monthDebit.add(debit); |
| | | monthCredit = monthCredit.add(credit); |
| | | |
| | | FinLedgerRowVo row = new FinLedgerRowVo(); |
| | | row.setRowType("entry"); |
| | | row.setDate(entry.getVoucherDate()); |
| | | row.setVoucherNo(entry.getVoucherNo()); |
| | | row.setSummary(StringUtils.isNotEmpty(entry.getSummary()) ? entry.getSummary() : ""); |
| | | row.setDebit(debit); |
| | | row.setCredit(credit); |
| | | row.setBalance(money(runningBalance)); |
| | | row.setDirection(resolveDirection(runningBalance)); |
| | | rows.add(row); |
| | | } |
| | | |
| | | rows.add(buildMonthlyTotalRow(month.atEndOfMonth(), monthDebit, monthCredit, runningBalance)); |
| | | yearDebit = yearDebit.add(monthDebit); |
| | | yearCredit = yearCredit.add(monthCredit); |
| | | } |
| | | |
| | | rows.add(buildYearlyTotalRow(endMonth.atEndOfMonth(), yearDebit, yearCredit, runningBalance)); |
| | | return rows; |
| | | } |
| | | |
| | | private Map<YearMonth, List<FinLedgerEntryRecordVo>> groupEntriesByMonth(List<FinLedgerEntryRecordVo> entries) { |
| | | Map<YearMonth, List<FinLedgerEntryRecordVo>> map = new LinkedHashMap<>(); |
| | | for (FinLedgerEntryRecordVo entry : entries) { |
| | | if (entry.getVoucherDate() == null) { |
| | | continue; |
| | | } |
| | | YearMonth month = YearMonth.from(entry.getVoucherDate()); |
| | | map.computeIfAbsent(month, key -> new ArrayList<>()).add(entry); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | private FinLedgerRowVo buildOpeningRow(LocalDate date, BigDecimal openingBalance) { |
| | | FinLedgerRowVo row = new FinLedgerRowVo(); |
| | | row.setRowType("opening"); |
| | | row.setDate(date); |
| | | row.setVoucherNo("-"); |
| | | row.setSummary("æåä½é¢"); |
| | | row.setDebit(ZERO); |
| | | row.setCredit(ZERO); |
| | | row.setBalance(money(openingBalance)); |
| | | row.setDirection(resolveDirection(openingBalance)); |
| | | return row; |
| | | } |
| | | |
| | | private FinLedgerRowVo buildMonthlyTotalRow(LocalDate date, |
| | | BigDecimal monthDebit, |
| | | BigDecimal monthCredit, |
| | | BigDecimal monthBalance) { |
| | | FinLedgerRowVo row = new FinLedgerRowVo(); |
| | | row.setRowType("monthly_total"); |
| | | row.setDate(date); |
| | | row.setVoucherNo("-"); |
| | | row.setSummary("æ¬æå计"); |
| | | row.setDebit(money(monthDebit)); |
| | | row.setCredit(money(monthCredit)); |
| | | row.setBalance(money(monthBalance)); |
| | | row.setDirection(resolveDirection(monthBalance)); |
| | | return row; |
| | | } |
| | | |
| | | private FinLedgerRowVo buildYearlyTotalRow(LocalDate date, |
| | | BigDecimal yearDebit, |
| | | BigDecimal yearCredit, |
| | | BigDecimal yearBalance) { |
| | | FinLedgerRowVo row = new FinLedgerRowVo(); |
| | | row.setRowType("yearly_total"); |
| | | row.setDate(date); |
| | | row.setVoucherNo("-"); |
| | | row.setSummary("å计"); |
| | | row.setDebit(money(yearDebit)); |
| | | row.setCredit(money(yearCredit)); |
| | | row.setBalance(money(yearBalance)); |
| | | row.setDirection(resolveDirection(yearBalance)); |
| | | return row; |
| | | } |
| | | |
| | | private BigDecimal calculateBalance(List<FinLedgerEntryRecordVo> entries) { |
| | | BigDecimal balance = ZERO; |
| | | for (FinLedgerEntryRecordVo entry : entries) { |
| | | balance = balance.add(money(entry.getDebit())).subtract(money(entry.getCredit())); |
| | | } |
| | | return money(balance); |
| | | } |
| | | |
| | | private String resolveDirection(BigDecimal balance) { |
| | | return money(balance).compareTo(BigDecimal.ZERO) >= 0 ? "å" : "è´·"; |
| | | } |
| | | |
| | | private YearMonth parseMonth(String value, String fieldLabel) { |
| | | if (StringUtils.isEmpty(value)) { |
| | | throw new ServiceException(fieldLabel + "ä¸è½ä¸ºç©ºï¼æ ¼å¼åºä¸ºYYYY-MM"); |
| | | } |
| | | try { |
| | | return YearMonth.parse(value, MONTH_FORMATTER); |
| | | } catch (DateTimeParseException ex) { |
| | | throw new ServiceException(fieldLabel + "æ ¼å¼éè¯¯ï¼æ ¼å¼åºä¸ºYYYY-MM"); |
| | | } |
| | | } |
| | | |
| | | private BigDecimal money(BigDecimal value) { |
| | | if (value == null) { |
| | | return ZERO; |
| | | } |
| | | return value.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.financial.FinVoucherDto; |
| | | 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.FinVoucherEntryMapper; |
| | | import com.ruoyi.account.mapper.financial.FinVoucherMapper; |
| | | import com.ruoyi.account.pojo.AccountSubject; |
| | | import com.ruoyi.account.pojo.financial.FinVoucher; |
| | | import com.ruoyi.account.pojo.financial.FinVoucherEntry; |
| | | import com.ruoyi.account.service.financial.FinVoucherService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * åè¯æå¡å®ç°ã |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FinVoucherServiceImpl extends ServiceImpl<FinVoucherMapper, FinVoucher> implements FinVoucherService { |
| | | |
| | | private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | private final FinVoucherEntryMapper finVoucherEntryMapper; |
| | | private final AccountSubjectMapper accountSubjectMapper; |
| | | |
| | | @Override |
| | | public IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto) { |
| | | LambdaQueryWrapper<FinVoucher> wrapper = new LambdaQueryWrapper<>(); |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getVoucherNo())) { |
| | | wrapper.like(FinVoucher::getVoucherNo, queryDto.getVoucherNo()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCreator())) { |
| | | wrapper.eq(FinVoucher::getCreator, queryDto.getCreator()); |
| | | } |
| | | if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) { |
| | | wrapper.eq(FinVoucher::getStatus, queryDto.getStatus()); |
| | | } |
| | | if (queryDto != null && queryDto.getStartDate() != null) { |
| | | wrapper.ge(FinVoucher::getVoucherDate, queryDto.getStartDate()); |
| | | } |
| | | if (queryDto != null && queryDto.getEndDate() != null) { |
| | | wrapper.le(FinVoucher::getVoucherDate, queryDto.getEndDate()); |
| | | } |
| | | wrapper.orderByDesc(FinVoucher::getVoucherDate).orderByDesc(FinVoucher::getId); |
| | | return page(page, wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addVoucher(FinVoucherDto dto) { |
| | | validateVoucherBasicInfo(dto, false); |
| | | List<FinVoucherEntry> validEntries = buildAndValidateEntries(dto); |
| | | |
| | | FinVoucher voucher = new FinVoucher(); |
| | | BeanUtils.copyProperties(dto, voucher); |
| | | voucher.setStatus("unposted"); |
| | | voucher.setAttachmentCount(voucher.getAttachmentCount() == null ? 0 : voucher.getAttachmentCount()); |
| | | BigDecimal totalDebit = calculateTotalDebit(validEntries); |
| | | BigDecimal totalCredit = calculateTotalCredit(validEntries); |
| | | voucher.setDebit(totalDebit); |
| | | voucher.setCredit(totalCredit); |
| | | if (StringUtils.isEmpty(voucher.getSummary())) { |
| | | voucher.setSummary(findDefaultSummary(validEntries)); |
| | | } |
| | | save(voucher); |
| | | saveEntries(voucher.getId(), validEntries); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateVoucher(FinVoucherDto dto) { |
| | | validateVoucherBasicInfo(dto, true); |
| | | FinVoucher existed = getById(dto.getId()); |
| | | if (existed == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼åè¯ä¸åå¨"); |
| | | } |
| | | if (!"unposted".equals(existed.getStatus())) { |
| | | throw new ServiceException("ä»
æªè¿è´¦åè¯å
许修æ¹"); |
| | | } |
| | | List<FinVoucherEntry> validEntries = buildAndValidateEntries(dto); |
| | | |
| | | FinVoucher voucher = new FinVoucher(); |
| | | BeanUtils.copyProperties(dto, voucher); |
| | | voucher.setStatus(existed.getStatus()); |
| | | voucher.setAttachmentCount(voucher.getAttachmentCount() == null ? 0 : voucher.getAttachmentCount()); |
| | | BigDecimal totalDebit = calculateTotalDebit(validEntries); |
| | | BigDecimal totalCredit = calculateTotalCredit(validEntries); |
| | | voucher.setDebit(totalDebit); |
| | | voucher.setCredit(totalCredit); |
| | | if (StringUtils.isEmpty(voucher.getSummary())) { |
| | | voucher.setSummary(findDefaultSummary(validEntries)); |
| | | } |
| | | updateById(voucher); |
| | | |
| | | LambdaQueryWrapper<FinVoucherEntry> deleteWrapper = new LambdaQueryWrapper<>(); |
| | | deleteWrapper.eq(FinVoucherEntry::getVoucherId, voucher.getId()); |
| | | finVoucherEntryMapper.delete(deleteWrapper); |
| | | saveEntries(voucher.getId(), validEntries); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean postVoucher(Long id) { |
| | | FinVoucher voucher = getById(id); |
| | | if (voucher == null) { |
| | | throw new ServiceException("è¿è´¦å¤±è´¥ï¼åè¯ä¸åå¨"); |
| | | } |
| | | if (!"unposted".equals(voucher.getStatus())) { |
| | | throw new ServiceException("ä»
æªè¿è´¦åè¯å
许è¿è´¦"); |
| | | } |
| | | voucher.setStatus("posted"); |
| | | return updateById(voucher); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean cancelVoucher(Long id) { |
| | | FinVoucher voucher = getById(id); |
| | | if (voucher == null) { |
| | | throw new ServiceException("ä½åºå¤±è´¥ï¼åè¯ä¸åå¨"); |
| | | } |
| | | if (!"unposted".equals(voucher.getStatus())) { |
| | | throw new ServiceException("ä»
æªè¿è´¦åè¯å
许ä½åº"); |
| | | } |
| | | voucher.setStatus("cancelled"); |
| | | return updateById(voucher); |
| | | } |
| | | |
| | | @Override |
| | | public FinVoucherDetailVo detail(Long id) { |
| | | FinVoucher voucher = getById(id); |
| | | if (voucher == null) { |
| | | throw new ServiceException("æ¥è¯¢å¤±è´¥ï¼åè¯ä¸åå¨"); |
| | | } |
| | | LambdaQueryWrapper<FinVoucherEntry> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(FinVoucherEntry::getVoucherId, id) |
| | | .orderByAsc(FinVoucherEntry::getRowNo) |
| | | .orderByAsc(FinVoucherEntry::getId); |
| | | List<FinVoucherEntry> entries = finVoucherEntryMapper.selectList(wrapper); |
| | | |
| | | FinVoucherDetailVo vo = new FinVoucherDetailVo(); |
| | | BeanUtils.copyProperties(voucher, vo); |
| | | vo.setEntries(entries); |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªåè¯ä¸»è¡¨å段ãç¶æåæ®µä¸å¯ä¸æ§ã |
| | | */ |
| | | private void validateVoucherBasicInfo(FinVoucherDto dto, boolean isUpdate) { |
| | | if (dto == null) { |
| | | throw new ServiceException("åè¯æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (isUpdate && dto.getId() == null) { |
| | | throw new ServiceException("ä¿®æ¹å¤±è´¥ï¼åè¯IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getVoucherNo())) { |
| | | throw new ServiceException("åè¯åå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getVoucherDate() == null) { |
| | | throw new ServiceException("åè¯æ¥æä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<FinVoucher> uniqueWrapper = new LambdaQueryWrapper<>(); |
| | | uniqueWrapper.eq(FinVoucher::getVoucherNo, dto.getVoucherNo()); |
| | | if (isUpdate) { |
| | | uniqueWrapper.ne(FinVoucher::getId, dto.getId()); |
| | | } |
| | | if (count(uniqueWrapper) > 0) { |
| | | throw new ServiceException("åè¯åå·å·²åå¨ï¼è¯·å¿éå¤æäº¤"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿æ»¤ææåå½å¹¶æ§è¡åè´·å¹³è¡¡æ ¡éªã |
| | | */ |
| | | private List<FinVoucherEntry> buildAndValidateEntries(FinVoucherDto dto) { |
| | | List<FinVoucherEntryDto> rawEntries = dto.getEntries(); |
| | | if (rawEntries == null || rawEntries.isEmpty()) { |
| | | throw new ServiceException("åå½ä¸è½ä¸ºç©ºï¼è³å°éè¦ä¸æ¡ææåå½"); |
| | | } |
| | | List<FinVoucherEntry> validEntries = new ArrayList<>(); |
| | | int rowNo = 1; |
| | | for (FinVoucherEntryDto entryDto : rawEntries) { |
| | | if (entryDto == null || StringUtils.isEmpty(entryDto.getSubjectCode())) { |
| | | continue; |
| | | } |
| | | BigDecimal debit = defaultMoney(entryDto.getDebit()); |
| | | BigDecimal credit = defaultMoney(entryDto.getCredit()); |
| | | if (debit.compareTo(BigDecimal.ZERO) <= 0 && credit.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | if (debit.compareTo(BigDecimal.ZERO) > 0 && credit.compareTo(BigDecimal.ZERO) > 0) { |
| | | throw new ServiceException("åå½åæ¹åè´·æ¹ä¸è½åæ¶å¤§äº0"); |
| | | } |
| | | FinVoucherEntry entry = new FinVoucherEntry(); |
| | | BeanUtils.copyProperties(entryDto, entry); |
| | | entry.setDebit(debit); |
| | | entry.setCredit(credit); |
| | | entry.setRowNo(rowNo++); |
| | | validEntries.add(entry); |
| | | } |
| | | if (validEntries.isEmpty()) { |
| | | throw new ServiceException("åå½è³å°éè¦ä¸æ¡ææè¡ï¼ç§ç®ä¸ç©ºï¼ä¸åæ¹æè´·æ¹å¤§äº0ï¼"); |
| | | } |
| | | |
| | | // åå½ç§ç®å¿
é¡»åå¨ï¼é¿å
èç§ç®ç¼ç å
¥è´¦ã |
| | | Set<String> subjectCodes = validEntries.stream() |
| | | .map(FinVoucherEntry::getSubjectCode) |
| | | .filter(StringUtils::isNotEmpty) |
| | | .collect(Collectors.toSet()); |
| | | if (subjectCodes.isEmpty()) { |
| | | throw new ServiceException("åå½ç§ç®ä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<AccountSubject> subjectWrapper = new LambdaQueryWrapper<>(); |
| | | subjectWrapper.in(AccountSubject::getSubjectCode, subjectCodes); |
| | | List<AccountSubject> subjects = accountSubjectMapper.selectList(subjectWrapper); |
| | | Map<String, AccountSubject> subjectMap = subjects.stream() |
| | | .collect(Collectors.toMap(AccountSubject::getSubjectCode, it -> it, (a, b) -> a)); |
| | | for (FinVoucherEntry entry : validEntries) { |
| | | AccountSubject accountSubject = subjectMap.get(entry.getSubjectCode()); |
| | | if (accountSubject == null) { |
| | | throw new ServiceException("ç§ç®ç¼ç ä¸åå¨ï¼" + entry.getSubjectCode()); |
| | | } |
| | | if (StringUtils.isEmpty(entry.getSubjectName())) { |
| | | entry.setSubjectName(accountSubject.getSubjectName()); |
| | | } |
| | | } |
| | | |
| | | BigDecimal totalDebit = calculateTotalDebit(validEntries); |
| | | BigDecimal totalCredit = calculateTotalCredit(validEntries); |
| | | if (totalDebit.compareTo(BigDecimal.ZERO) <= 0 || totalCredit.compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("åè´·éé¢å¿
须大äº0"); |
| | | } |
| | | if (totalDebit.compareTo(totalCredit) != 0) { |
| | | throw new ServiceException("åè´·ä¸å¹³è¡¡ï¼ç¦æ¢ä¿å"); |
| | | } |
| | | return validEntries; |
| | | } |
| | | |
| | | private void saveEntries(Long voucherId, List<FinVoucherEntry> entries) { |
| | | if (voucherId == null) { |
| | | throw new ServiceException("åè¯IDä¸è½ä¸ºç©º"); |
| | | } |
| | | for (FinVoucherEntry entry : entries) { |
| | | entry.setVoucherId(voucherId); |
| | | finVoucherEntryMapper.insert(entry); |
| | | } |
| | | } |
| | | |
| | | private String findDefaultSummary(List<FinVoucherEntry> entries) { |
| | | for (FinVoucherEntry entry : entries) { |
| | | if (StringUtils.isNotEmpty(entry.getSummary())) { |
| | | return entry.getSummary(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private BigDecimal calculateTotalDebit(List<FinVoucherEntry> entries) { |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (FinVoucherEntry entry : entries) { |
| | | total = total.add(defaultMoney(entry.getDebit())); |
| | | } |
| | | return total.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private BigDecimal calculateTotalCredit(List<FinVoucherEntry> entries) { |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (FinVoucherEntry entry : entries) { |
| | | total = total.add(defaultMoney(entry.getCredit())); |
| | | } |
| | | return total.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private BigDecimal defaultMoney(BigDecimal value) { |
| | | if (value == null) { |
| | | return ZERO; |
| | | } |
| | | return value.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ShippingProductDetailMapper shippingProductDetailMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final StockUtils stockUtils; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | |
| | | addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(),purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | |
| | | if (shippingInfo != null) { |
| | | if (status.equals(2)) { |
| | | shippingInfo.setStatus("å®¡æ ¸éè¿"); |
| | | shippingInfo.setShippingDate(new Date()); |
| | | //æ´æ¹åºåºå®¡æ ¸ç¶æï¼å¾
ç¡®è®¤æ¹æå¾
å®¡æ ¸ï¼ |
| | | stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId()); |
| | | } else if (status.equals(3)) { |
| | | shippingInfo.setStatus("å®¡æ ¸æç»"); |
| | | } else if (status.equals(1)) { |
| | |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | //åºåæ£å |
| | | |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_NODE, approveNode.getId(), approveNode.getStorageBlobDTOS()); |
| | |
| | | * ç§æµ·å®¢æ·æµåå
¬æµ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/back") |
| | | public R back(Long id) { |
| | | @PostMapping("/back/{id}") |
| | | public R back(@PathVariable("id") Long id) { |
| | | return R.ok(customerService.back(id)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String previewURL; |
| | | |
| | | |
| | | private String url; |
| | | private String name; |
| | | |
| | | /** |
| | | * ä¸è½½å°å |
| | | */ |
| | |
| | | INBOUND_MANAGEMENT("inbound_management"), |
| | | // Office Supplies |
| | | OFFICE_SUPPLIES("office_supplies"), |
| | | // OA |
| | | OA_PROJECT_PHASE_TASK("oa_project_phase_task"), |
| | | OA_PROJECT("oa_project"), |
| | | OA_PROJECT_PHASE("oa_project_phase"), |
| | | // Measuring Instrument Ledger |
| | | SPARE_PARTS("spare_parts"), |
| | | MEASURING_INSTRUMENT_LEDGER_RECORD("measuring_instrument_ledger_record"), |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.vo.ProductModelVo; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | private String model; |
| | | |
| | | @Excel(name = "产åç¼ç ") |
| | | @TableField("product_code") |
| | | private String productCode; |
| | | |
| | | /** |
| | |
| | | //å°å®¢æ·çtypeæ¹ä¸º1 ä¸ç´æ¥åé
ç»å½åç¨æ· |
| | | Customer customer = customerMapper.selectById(id); |
| | | customer.setType(1); |
| | | customer.setIsAssigned(1); |
| | | customer.setIsAssigned(0); |
| | | return this.updateById(customer); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // å 餿§éä»¶ä¿¡æ¯ |
| | | if (application == null) { |
| | | if (application == null || application.trim().isEmpty()) { |
| | | for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) { |
| | | if (storageBlobDTO.getApplication() == null || storageBlobDTO.getApplication().trim().isEmpty()) { |
| | | throw new RuntimeException("æä»¶ç¨éä¸è½ä¸ºç©º"); |
| | | } |
| | | deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.getByType(storageBlobDTO.getApplication()), recordType, recordId); |
| | | } |
| | | } else { |
| | |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setName(storageBlob.getOriginalFilename()); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId())); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setName(storageBlob.getOriginalFilename()); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId())); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | |
| | | StorageBlobVO storageBlobVO = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(storageBlob, storageBlobVO); |
| | | storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO)); |
| | | storageBlobVO.setName(storageBlob.getOriginalFilename()); |
| | | storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO)); |
| | | storageBlobDTOS.add(storageBlobVO); |
| | | } |
| | |
| | | |
| | | import lombok.Getter; |
| | | |
| | | |
| | | //å
¥åºæä¸¾ |
| | | @Getter |
| | | public enum StockInQualifiedRecordTypeEnum implements BaseEnum<String> { |
| | | |
| | | |
| | | CUSTOMIZATION_STOCK_IN("0", "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT("1", "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN("2", "ç产æ¥å·¥-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_SCRAP("4", "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | PRODUCTION_SCRAP("5", "ç产æ¥å·¥-æ¥åº"), |
| | | QUALITYINSPECT_STOCK_IN("6", "è´¨æ£-åæ ¼å
¥åº"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | CUSTOMIZATION_UNSTOCK_IN("9", "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "éè´-è´¨æ£-åæ ¼å
¥åº"), |
| | | DEFECTIVE_PASS("11", "ä¸åæ ¼-è®©æ¥æ¾è¡"), |
| | | QUALITYINSPECT_UNSTOCK_IN("12", "è´¨æ£-ä¸åæ ¼å
¥åº"), |
| | | SALE_SHIP_STOCK_OUT("13", "éå®-åè´§åºåº"), |
| | | RETURN_HE_IN("14", "éå®éè´§-åæ ¼å
¥åº"), |
| | | RETURN_UNSTOCK_IN("15", "éå®éè´§-ä¸åæ ¼å
¥åº"), |
| | | PICK_RETURN_IN("20", "颿éæ-åæ ¼å
¥åº"), |
| | | PURCHASE_RETURN_STOCK_OUT("21", "éè´éè´§"), |
| | | FEED_RETURN_IN("22", "ç产éæ-åæ ¼å
¥åº"); |
| | | |
| | | |
| | |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | PURCHASE_RETURN_STOCK_OUT("9", "éè´éè´§"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | SALE_SHIP_STOCK_OUT("13", "éå®-åè´§åºåº"), |
| | | PICK_STOCK_OUT("14", "çäº§é¢æåºåº"), |
| | | FEED_STOCK_OUT("15", "ç产补æåºåº"); |
| | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | @Schema(description = "设å¤é¡¹ç®") |
| | | private String machineryCategory; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import java.util.Set; |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | | @RequiredArgsConstructor |
| | | @DisallowConcurrentExecution |
| | | public class MaintenanceTaskJob implements Job, Serializable { |
| | | private static final long serialVersionUID = 1L; // å¿
é¡»å®ä¹åºååID |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private final DeviceMaintenanceServiceImpl deviceMaintenanceService; |
| | | @Autowired |
| | | private DeviceMaintenanceServiceImpl deviceMaintenanceService; |
| | | |
| | | private final JdbcTemplate jdbcTemplate; |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTask.setStatus(0); |
| | | inspectionTask.setDeviceModel(timingTask.getDeviceModel()); |
| | | inspectionTask.setMachineryCategory(timingTask.getMachineryCategory()); |
| | | inspectionTask.setCreateUser(Integer.parseInt(timingTask.getRegistrantId().toString())); |
| | | inspectionTask.setUpdateTime(LocalDateTime.now()); |
| | | inspectionTask.setCreateTime(LocalDateTime.now()); |
| | |
| | | import com.ruoyi.inspectiontask.pojo.TimingTask; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | | @RequiredArgsConstructor |
| | | public class TimingTaskJob implements Job, Serializable { |
| | | private static final long serialVersionUID = 1L; // å¿
é¡»å®ä¹åºååID |
| | | |
| | | private final InspectionTaskMapper inspectionTaskMapper; |
| | | private final JdbcTemplate jdbcTemplate; |
| | | @Autowired |
| | | private InspectionTaskMapper inspectionTaskMapper; |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | |
| | | if (timingTask == null) { |
| | | throw new JobExecutionException("æ¾ä¸å°å®æ¶ä»»å¡: " + taskId); |
| | | } |
| | | |
| | | |
| | | // if (!timingTask.isActive()) { |
| | | // throw new JobExecutionException("宿¶ä»»å¡å·²ç¦ç¨: " + taskId); |
| | | // } |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/Details.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/InventoryInformationDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementAddDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementManagementUpdateDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutAdd.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutPageDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ProcurementUpdateDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| ÎļþÃû´Ó src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.bean.dto; |
| | | |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ReturnSaleProductDto extends ReturnSaleProduct { |
| | | |
| | | private String productName; |
| | | |
| | | private String model; |
| | | |
| | | private String unit; |
| | | |
| | | //æªéè´§æ°é |
| | | private BigDecimal unQuantity; |
| | | |
| | | //æ»éè´§æ°é |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | // éè´§æ»ä»· |
| | | private BigDecimal price; |
| | | |
| | | // éè´§æ»ä»· |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | @Schema(description = "æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @Schema(description = "åè´§åºåºæ°é") |
| | | private BigDecimal stockOutNum; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.bean.vo; |
| | | |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Schema(name = "ShippingInfoVo", description = "è¥é管ç--åè´§ä¿¡æ¯") |
| | | public class ShippingInfoVo { |
| | | |
| | | private ShippingInfo shippingInfo; |
| | | |
| | | @Schema(description = "å货产åå表") |
| | | private List<ShippingProductVo> shippingProductVoList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.bean.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @Schema(name = "ShippingProductVo", description = "è¥é管ç--åè´§åºåºäº§åå表") |
| | | public class ShippingProductVo { |
| | | @Schema(description = "åºåºåid") |
| | | private Long id; |
| | | |
| | | @Schema(description = "产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @Schema(description = "产å大类") |
| | | private String productCategory; |
| | | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "åºåºåå·") |
| | | private String outboundBatches; |
| | | |
| | | @Schema(description = "åè´§åºåºæ°é") |
| | | private BigDecimal stockOutNum; |
| | | |
| | | @Schema(description = "æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @Schema(description = "æªéè´§æ°") |
| | | private BigDecimal unQuantity; |
| | | |
| | | @Schema(description = "éè´§æ»æ°") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | @Schema(description = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | 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.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | 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.procurementrecord.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordOutService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.service.impl.ReturnSaleProductServiceImpl; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/getByShippingId") |
| | | @Operation(summary = "éå®éè´§-æ ¹æ®åºåºåæ¥è¯¢éå®è®¢å以å产åä¿¡æ¯") |
| | | @Operation(summary = "éå®éè´§-æ ¹æ®åè´§åæ¥è¯¢éå®è®¢å以ååºåºç产åä¿¡æ¯") |
| | | public AjaxResult getByShippingId(Long shippingId) { |
| | | SalesLedgerDto salesLedgerDto = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(salesLedgerDto); |
| | | ShippingInfoVo shippingInfoVo = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(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.procurementrecord.dto.ProcurementDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | 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.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | 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.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | ReturnManagementDto getReturnManagementDtoById(Long id); |
| | | |
| | | IPage<SalesReturnVo> listPageBySalesReturn(Page page, @Param("req") SalesReturnDto salesReturnDto); |
| | | IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, @Param("req") SalesReturnDto salesReturnDto); |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.mapper; |
| | | |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Schema(description = "å建æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @Schema(description = "åå»ºç¨æ·") |
| | |
| | | package com.ruoyi.procurementrecord.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Schema(description = "éè´§åid") |
| | | private Long returnManagementId; |
| | | |
| | | @Schema(description = "é货产åid") |
| | | private Long returnsalesLedgerProductId; |
| | | @Schema(description = "å
³èåºåºåid") |
| | | private Long stockOutRecordId; |
| | | |
| | | @Schema(description = "éè´§äº§åæ°é") |
| | | private BigDecimal num; |
| | |
| | | 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.procurementrecord.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | |
| | |
| | | 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.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | |
| | | boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto); |
| | | |
| | | SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId); |
| | | ShippingInfoVo getReturnManagementDtoByShippingIdId(Long shippingId); |
| | | |
| | | boolean handle(Long returnManagementId); |
| | | |
| | |
| | | package com.ruoyi.procurementrecord.service; |
| | | |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordOutService; |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.service.SalesRefundAmountOrderService; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto) { |
| | | List<ReturnSaleProduct> returnSaleProducts = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(returnManagementDto.getReturnSaleProducts())) { |
| | | returnManagementDto.getReturnSaleProducts().stream().forEach(returnSaleProductDto -> { |
| | | ReturnSaleProduct returnSaleProduct = new ReturnSaleProduct(); |
| | | BeanUtils.copyProperties(returnSaleProductDto, returnSaleProduct); |
| | | returnSaleProducts.add(returnSaleProduct); |
| | | if (returnSaleProductDto.getId() == null){ |
| | | returnSaleProduct.setReturnManagementId(returnManagementDto.getId()); |
| | | returnSaleProduct.setStatus(0); |
| | | returnSaleProductService.save(returnSaleProduct); |
| | | }else returnSaleProductService.updateById(returnSaleProduct); |
| | | }); |
| | | } |
| | | returnSaleProductService.updateBatchById(returnSaleProducts); |
| | | return updateById(returnManagementDto); |
| | | } |
| | | |
| | | @Override |
| | | public SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId) { |
| | | public ShippingInfoVo getReturnManagementDtoByShippingIdId(Long shippingId) { |
| | | ShippingInfo byId = shippingInfoService.getById(shippingId); |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(byId.getSalesLedgerId()); |
| | | SalesLedgerDto salesLedgerDto = new SalesLedgerDto(); |
| | | BeanUtils.copyProperties(salesLedger, salesLedgerDto); |
| | | |
| | | List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId()); |
| | | salesLedgerDto.setProductDtoData(salesLedgerProductDtos); |
| | | return salesLedgerDto; |
| | | ShippingInfoVo shippingInfoVo = new ShippingInfoVo(); |
| | | shippingInfoVo.setShippingInfo(byId); |
| | | List<ShippingProductVo> shippingProductVos = shippingInfoService.getReturnManagementDtoById(byId.getId()); |
| | | shippingInfoVo.setShippingProductVoList(shippingProductVos); |
| | | return shippingInfoVo; |
| | | } |
| | | |
| | | @Override |
| | |
| | | ReturnManagement byId = this.getById(returnManagementId); |
| | | List<ReturnSaleProductDto> list = returnSaleProductService.listReturnSaleProduct(returnManagementId); |
| | | byId.setStatus(1); |
| | | byId.setSettler(SecurityUtils.getLoginUser().getNickName()); |
| | | updateById(byId); |
| | | SalesRefundAmountOrderDto salesRefundAmountOrder = new SalesRefundAmountOrderDto(); |
| | | salesRefundAmountOrder.setReturnManagementId(returnManagementId); |
| | |
| | | salesRefundAmountOrder.setRefundedAmount(new BigDecimal(0)); |
| | | // æ¯å¦æè´¨éé®é¢ |
| | | if (returnSaleProduct.getIsQuality() == 1) { |
| | | // æè´¨éé®é¢ï¼å
¥ä¸åæ ¼åº |
| | | stockUtils.addUnStock(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInUnQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode(),returnSaleProduct.getId()); |
| | | // æè´¨éé®é¢ï¼å
¥ä¸åæ ¼åº(å¸¦æ¹æ¬¡) |
| | | stockUtils.addUnStockWithBatchNo(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode(),returnSaleProduct.getId(),returnSaleProduct.getBatchNo()); |
| | | }else{ |
| | | // æ è´¨éé®é¢ï¼å
¥åæ ¼åº |
| | | stockUtils.addStock(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(),returnSaleProduct.getId()); |
| | | // æ è´¨éé®é¢ï¼å
¥åæ ¼åº(å¸¦æ¹æ¬¡) |
| | | stockUtils.addStockWithBatchNo(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(),returnSaleProduct.getId(),returnSaleProduct.getBatchNo()); |
| | | } |
| | | } |
| | | salesRefundAmountOrder.setRefundAmount(bigDecimal); |
| | |
| | | package com.ruoyi.procurementrecord.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | |
| | | package com.ruoyi.procurementrecord.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.common.enums.ReviewStatusEnum; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | |
| | | private final StockInventoryService stockInventoryService; |
| | | private final StockInRecordService stockInRecordService; |
| | | private final StockOutRecordService stockOutRecordService; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | |
| | | /** |
| | | * ä¸åæ ¼å
¥åº |
| | |
| | | stockUninventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockUninventoryDto.setQualitity(quantity); |
| | | stockUninventoryDto.setProductModelId(productModelId); |
| | | stockUninventoryService.addStockInRecordOnly(stockUninventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæ ¼å
¥åºå¸¦æ¹æ¬¡å· |
| | | * |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addUnStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setRecordId(recordId); |
| | | stockUninventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockUninventoryDto.setQualitity(quantity); |
| | | stockUninventoryDto.setProductModelId(productModelId); |
| | | stockUninventoryDto.setBatchNo(batchNo); |
| | | stockUninventoryService.addStockInRecordOnly(stockUninventoryDto); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * åæ ¼å
¥åº |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | } |
| | | |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | stockInventoryService.addStockOutRecordOnly(stockInventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * å货审æ¹ç¶ææ´æ¹ |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void shipmentStatus(String recordType, Long recordId) { |
| | | LambdaQueryWrapper<StockOutRecord> queryWrapper = new LambdaQueryWrapper<StockOutRecord>().eq(StockOutRecord::getRecordType, recordType) |
| | | .eq(StockOutRecord::getRecordId, recordId); |
| | | stockOutRecordService.list(queryWrapper).stream().forEach(stockOutRecord -> { |
| | | stockOutRecord.setApprovalStatus(0); |
| | | stockOutRecordService.updateById(stockOutRecord); |
| | | }); |
| | | } |
| | | |
| | | //ä¸åæ ¼åºåå é¤ |
| | | public void deleteStockInRecord(Long recordId, String recordType) { |
| | | StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>() |
| | | .lambda().eq(StockInRecord::getRecordId, recordId) |
| | | .eq(StockInRecord::getRecordType, recordType)); |
| | | .eq(StockInRecord::getRecordType, recordType), false); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | stockInRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | //å°åºåå忥 |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(recordType); |
| | | stockInventoryDto.setQualitity(one.getStockInNum()); |
| | | stockInventoryMapper.updateSubtractStockInventory((stockInventoryDto)); |
| | | if (ReviewStatusEnum.APPROVED.getCode().equals(one.getApprovalStatus())) { |
| | | stockInRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | } else { |
| | | stockInRecordService.removeById(one.getId()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | public void deleteStockOutRecord(Long recordId, String recordType) { |
| | | StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>() |
| | | .lambda().eq(StockOutRecord::getRecordId, recordId) |
| | | .eq(StockOutRecord::getRecordType, recordType)); |
| | | .eq(StockOutRecord::getRecordType, recordType), false); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | stockOutRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | //å°åºåå 忥 |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(recordType); |
| | | stockInventoryDto.setQualitity(one.getStockOutNum()); |
| | | stockInventoryMapper.updateAddStockInventory((stockInventoryDto)); |
| | | if (ReviewStatusEnum.APPROVED.getCode().equals(one.getApprovalStatus())) { |
| | | stockOutRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | } else { |
| | | stockOutRecordService.removeById(one.getId()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @Schema(description = "éå®å°è´¦id") |
| | | private Long salesLedgerId; |
| | | |
| | | @Schema(description = "éå®äº§åè§æ ¼id") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @Schema(description = "æ¥å·¥è¡¨id") |
| | | private Long productionProductMainId; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | |
| | | @Schema(description = "ç产æ¥å·¥ä¸»è¡¨id") |
| | | private Long productionProductMainId; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | |
| | | @Schema(description = "ç产æ¥å·¥ä¸»è¡¨id") |
| | | private Long productionProductMainId; |
| | | |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.bean.dto.ProductionBomStructureDto; |
| | | import com.ruoyi.production.bean.vo.ProductionBomStructureVo; |
| | | import com.ruoyi.production.mapper.ProductionBomStructureMapper; |
| | | import com.ruoyi.production.mapper.ProductionOperationTaskMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderBomMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionOrderRoutingOperationMapper; |
| | | import com.ruoyi.production.pojo.ProductionBomStructure; |
| | | import com.ruoyi.production.pojo.ProductionOperationTask; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.pojo.ProductionOrderBom; |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperation; |
| | | import com.ruoyi.production.service.ProductionBomStructureService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequiredArgsConstructor() |
| | | public class ProductionBomStructureServiceImpl extends ServiceImpl<ProductionBomStructureMapper, ProductionBomStructure> implements ProductionBomStructureService { |
| | | |
| | | private final ProductionBomStructureMapper productionBomStructureMapper; |
| | | private final ProductionBomStructureMapper productionBomStructureMapper; |
| | | private final ProductionOrderBomMapper productionOrderBomMapper; |
| | | private final ProductionOrderMapper productionOrderMapper; |
| | | private final ProductionOrderRoutingOperationMapper productionOrderRoutingOperationMapper; |
| | | private final ProductionOperationTaskMapper productionOperationTaskMapper; |
| | | |
| | | /** |
| | | * æ ¹æ®BOMæ¥è¯¢å¹¶ç»è£
ç»ææ ã |
| | |
| | | if (!updateList.isEmpty()) { |
| | | this.updateBatchById(updateList); |
| | | } |
| | | syncDemandedQuantityAndTaskPlanQuantity(orderBomId, dto.getProductionOrderId()); |
| | | return true; |
| | | } |
| | | |
| | | private void syncDemandedQuantityAndTaskPlanQuantity(Long orderBomId, Long productionOrderId) { |
| | | if (orderBomId == null) { |
| | | return; |
| | | } |
| | | ProductionOrderBom orderBom = productionOrderBomMapper.selectById(orderBomId); |
| | | if (orderBom == null) { |
| | | return; |
| | | } |
| | | Long currentProductionOrderId = productionOrderId != null ? productionOrderId : orderBom.getProductionOrderId(); |
| | | if (currentProductionOrderId == null) { |
| | | return; |
| | | } |
| | | ProductionOrder productionOrder = productionOrderMapper.selectById(currentProductionOrderId); |
| | | if (productionOrder == null) { |
| | | return; |
| | | } |
| | | |
| | | BigDecimal orderQuantity = defaultDecimal(productionOrder.getQuantity()); |
| | | List<ProductionBomStructure> structureList = this.list( |
| | | Wrappers.<ProductionBomStructure>lambdaQuery() |
| | | .eq(ProductionBomStructure::getProductionOrderBomId, orderBomId) |
| | | .orderByAsc(ProductionBomStructure::getId)); |
| | | syncStructureDemandedQuantity(structureList, orderQuantity); |
| | | syncTaskPlanQuantity( |
| | | currentProductionOrderId, |
| | | structureList, |
| | | orderQuantity, |
| | | orderBom.getProductModelId() != null ? orderBom.getProductModelId() : productionOrder.getProductModelId()); |
| | | } |
| | | |
| | | private void syncStructureDemandedQuantity(List<ProductionBomStructure> structureList, BigDecimal orderQuantity) { |
| | | if (structureList == null || structureList.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ProductionBomStructure> updateList = new ArrayList<>(); |
| | | for (ProductionBomStructure structure : structureList) { |
| | | if (structure == null || structure.getId() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal demandedQuantity = defaultDecimal(structure.getUnitQuantity()).multiply(orderQuantity); |
| | | if (compareDecimal(structure.getDemandedQuantity(), demandedQuantity) == 0) { |
| | | continue; |
| | | } |
| | | ProductionBomStructure update = new ProductionBomStructure(); |
| | | update.setId(structure.getId()); |
| | | update.setDemandedQuantity(demandedQuantity); |
| | | updateList.add(update); |
| | | structure.setDemandedQuantity(demandedQuantity); |
| | | } |
| | | if (!updateList.isEmpty()) { |
| | | this.updateBatchById(updateList); |
| | | } |
| | | } |
| | | |
| | | private void syncTaskPlanQuantity(Long productionOrderId, |
| | | List<ProductionBomStructure> structureList, |
| | | BigDecimal orderQuantity, |
| | | Long rootProductModelId) { |
| | | List<ProductionOperationTask> taskList = productionOperationTaskMapper.selectList( |
| | | Wrappers.<ProductionOperationTask>lambdaQuery() |
| | | .eq(ProductionOperationTask::getProductionOrderId, productionOrderId) |
| | | .orderByAsc(ProductionOperationTask::getId)); |
| | | if (taskList == null || taskList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | Set<Long> routingOperationIds = taskList.stream() |
| | | .map(ProductionOperationTask::getProductionOrderRoutingOperationId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (routingOperationIds.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | Map<Long, ProductionOrderRoutingOperation> routingOperationMap = productionOrderRoutingOperationMapper |
| | | .selectBatchIds(routingOperationIds) |
| | | .stream() |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(ProductionOrderRoutingOperation::getId, item -> item, (left, right) -> left)); |
| | | Map<String, BigDecimal> demandedQuantityMap = buildOperationDemandedQuantityMap(structureList, rootProductModelId, orderQuantity); |
| | | |
| | | for (ProductionOperationTask task : taskList) { |
| | | if (task == null || task.getId() == null || task.getProductionOrderRoutingOperationId() == null) { |
| | | continue; |
| | | } |
| | | ProductionOrderRoutingOperation routingOperation = routingOperationMap.get(task.getProductionOrderRoutingOperationId()); |
| | | if (routingOperation == null || routingOperation.getTechnologyRoutingOperationId() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal planQuantity = resolveTaskPlanQuantity(routingOperation, demandedQuantityMap, orderQuantity); |
| | | if (compareDecimal(task.getPlanQuantity(), planQuantity) == 0) { |
| | | continue; |
| | | } |
| | | ProductionOperationTask update = new ProductionOperationTask(); |
| | | update.setId(task.getId()); |
| | | update.setPlanQuantity(planQuantity); |
| | | productionOperationTaskMapper.updateById(update); |
| | | } |
| | | } |
| | | |
| | | private Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> structureList, |
| | | Long rootProductModelId, |
| | | BigDecimal orderQuantity) { |
| | | if (structureList == null || structureList.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | Map<Long, ProductionBomStructure> structureById = structureList.stream() |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left)); |
| | | Map<String, BigDecimal> demandedQuantityMap = new HashMap<>(); |
| | | for (ProductionBomStructure bomStructure : structureList) { |
| | | if (bomStructure == null || bomStructure.getTechnologyOperationId() == null || bomStructure.getUnitQuantity() == null) { |
| | | continue; |
| | | } |
| | | Long outputProductModelId = resolveOutputProductModelId(bomStructure, structureById, rootProductModelId); |
| | | String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId); |
| | | demandedQuantityMap.merge(key, bomStructure.getUnitQuantity().multiply(orderQuantity), BigDecimal::add); |
| | | } |
| | | return demandedQuantityMap; |
| | | } |
| | | |
| | | private BigDecimal resolveTaskPlanQuantity(ProductionOrderRoutingOperation routingOperation, |
| | | Map<String, BigDecimal> demandedQuantityMap, |
| | | BigDecimal orderQuantity) { |
| | | if (routingOperation == null || demandedQuantityMap == null || demandedQuantityMap.isEmpty()) { |
| | | return orderQuantity; |
| | | } |
| | | String key = buildOperationDemandedQuantityKey( |
| | | routingOperation.getTechnologyOperationId(), |
| | | routingOperation.getProductModelId()); |
| | | BigDecimal planQuantity = demandedQuantityMap.get(key); |
| | | return planQuantity != null ? planQuantity : orderQuantity; |
| | | } |
| | | |
| | | private String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) { |
| | | return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId); |
| | | } |
| | | |
| | | private Long resolveOutputProductModelId(ProductionBomStructure bomStructure, |
| | | Map<Long, ProductionBomStructure> structureById, |
| | | Long rootProductModelId) { |
| | | if (bomStructure == null) { |
| | | return rootProductModelId; |
| | | } |
| | | Long parentId = bomStructure.getParentId(); |
| | | if (parentId == null) { |
| | | return rootProductModelId != null ? rootProductModelId : bomStructure.getProductModelId(); |
| | | } |
| | | ProductionBomStructure parent = structureById.get(parentId); |
| | | if (parent != null && parent.getProductModelId() != null) { |
| | | return parent.getProductModelId(); |
| | | } |
| | | return rootProductModelId != null ? rootProductModelId : bomStructure.getProductModelId(); |
| | | } |
| | | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private int compareDecimal(BigDecimal left, BigDecimal right) { |
| | | return defaultDecimal(left).compareTo(defaultDecimal(right)); |
| | | } |
| | | |
| | | /** |
| | | * å°æ å½¢ç»ææå¹³æå表ï¼ä¾¿äºç»ä¸ä¿åã |
| | | */ |
| | |
| | | .eq(TechnologyRoutingOperation::getTechnologyRoutingId, technologyRouting.getId()) |
| | | .orderByDesc(TechnologyRoutingOperation::getDragSort) |
| | | .orderByDesc(TechnologyRoutingOperation::getId)); |
| | | Map<String, BigDecimal> operationDemandedQuantityMap = buildOperationDemandedQuantityMap(technologyRouting, productionOrder); |
| | | Map<Long, String> operationNameMap = technologyOperationMapper.selectBatchIds( |
| | | // éåå¤çæ°æ®å¹¶ç»è£
ç»æ |
| | | routingOperations.stream() |
| | |
| | | ProductionOperationTask task = new ProductionOperationTask(); |
| | | task.setProductionOrderRoutingOperationId(targetOperation.getId()); |
| | | task.setProductionOrderId(productionOrder.getId()); |
| | | task.setPlanQuantity(defaultDecimal(productionOrder.getQuantity())); |
| | | task.setPlanQuantity(resolveTaskPlanQuantity(sourceOperation, operationDemandedQuantityMap, productionOrder)); |
| | | task.setCompleteQuantity(BigDecimal.ZERO); |
| | | task.setWorkOrderNo(generateNextTaskNo()); |
| | | task.setStatus(2); |
| | |
| | | } |
| | | } |
| | | return syncedParamCount; |
| | | } |
| | | |
| | | private Map<String, BigDecimal> buildOperationDemandedQuantityMap(TechnologyRouting technologyRouting, |
| | | ProductionOrder productionOrder) { |
| | | if (technologyRouting == null || technologyRouting.getBomId() == null) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | BigDecimal orderQuantity = defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity()); |
| | | List<TechnologyBomStructure> bomStructures = technologyBomStructureMapper.selectList( |
| | | Wrappers.<TechnologyBomStructure>lambdaQuery() |
| | | .eq(TechnologyBomStructure::getBomId, technologyRouting.getBomId()) |
| | | .isNotNull(TechnologyBomStructure::getOperationId) |
| | | .orderByAsc(TechnologyBomStructure::getId)); |
| | | if (bomStructures.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | Map<Long, TechnologyBomStructure> structureById = bomStructures.stream() |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(TechnologyBomStructure::getId, item -> item, (left, right) -> left)); |
| | | Map<String, BigDecimal> demandedQuantityMap = new HashMap<>(); |
| | | for (TechnologyBomStructure bomStructure : bomStructures) { |
| | | if (bomStructure == null || bomStructure.getOperationId() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal unitQuantity = bomStructure.getUnitQuantity(); |
| | | if (unitQuantity == null) { |
| | | continue; |
| | | } |
| | | Long outputProductModelId = resolveOutputProductModelId(bomStructure, structureById, technologyRouting.getProductModelId()); |
| | | String key = buildOperationDemandedQuantityKey(bomStructure.getOperationId(), outputProductModelId); |
| | | demandedQuantityMap.merge(key, unitQuantity.multiply(orderQuantity), BigDecimal::add); |
| | | } |
| | | return demandedQuantityMap; |
| | | } |
| | | |
| | | private BigDecimal resolveTaskPlanQuantity(TechnologyRoutingOperation sourceOperation, |
| | | Map<String, BigDecimal> operationDemandedQuantityMap, |
| | | ProductionOrder productionOrder) { |
| | | if (sourceOperation == null || operationDemandedQuantityMap == null || operationDemandedQuantityMap.isEmpty()) { |
| | | return defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity()); |
| | | } |
| | | String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), sourceOperation.getProductModelId()); |
| | | BigDecimal planQuantity = operationDemandedQuantityMap.get(key); |
| | | return planQuantity != null ? planQuantity : defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity()); |
| | | } |
| | | |
| | | private String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) { |
| | | return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId); |
| | | } |
| | | |
| | | private Long resolveOutputProductModelId(TechnologyBomStructure bomStructure, |
| | | Map<Long, TechnologyBomStructure> structureById, |
| | | Long routingProductModelId) { |
| | | if (bomStructure == null) { |
| | | return routingProductModelId; |
| | | } |
| | | Long parentId = bomStructure.getParentId(); |
| | | if (parentId == null) { |
| | | return routingProductModelId != null ? routingProductModelId : bomStructure.getProductModelId(); |
| | | } |
| | | TechnologyBomStructure parent = structureById.get(parentId); |
| | | if (parent != null && parent.getProductModelId() != null) { |
| | | return parent.getProductModelId(); |
| | | } |
| | | return routingProductModelId != null ? routingProductModelId : bomStructure.getProductModelId(); |
| | | } |
| | | |
| | | private ProductionOrderBom syncProductionOrderBomSnapshot(ProductionOrder productionOrder, TechnologyRouting technologyRouting) { |
| | |
| | | if (reportOutput == null) { |
| | | continue; |
| | | } |
| | | Long reportMainId = reportOutput.getProductionProductMainId() != null |
| | | ? reportOutput.getProductionProductMainId() |
| | | : reportOutput.getProductMainId(); |
| | | if (reportMainId == null) { |
| | | if (reportOutput.getProductionProductMainId() == null) { |
| | | continue; |
| | | } |
| | | Long reportMainId = reportOutput.getProductionProductMainId(); |
| | | reportOutputMap.computeIfAbsent(reportMainId, k -> new ArrayList<>()).add(reportOutput); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.quality.mapper.*; |
| | | import com.ruoyi.quality.pojo.*; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import com.ruoyi.technology.mapper.TechnologyOperationMapper; |
| | |
| | | private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper; |
| | | private final TechnologyOperationMapper technologyOperationMapper; |
| | | private final StockUtils stockUtils; |
| | | private final StockInRecordService stockInRecordService; |
| | | private final StockInventoryService stockInventoryService; |
| | | |
| | | @Override |
| | |
| | | // å½åå®ç°æå·¥åºæåç´æ¥ä½ä¸ºæå
¥ï¼åç»è¥æ¥å
¥é¢æè®°å½å¯å¨è¿éæ¿æ¢æ¥æºã |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductionProductMainId(productionProductMain.getId()); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInput.setProductModelId(item.getProductModelId()); |
| | | productionProductInput.setInputQuantity(item.getUnitQuantity().multiply(defaultDecimal(dto.getQuantity()))); |
| | | productionProductInput.setQuantity(productionProductInput.getInputQuantity()); |
| | |
| | | |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | | productionProductOutput.setProductionProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductModelId(productModel.getId()); |
| | | productionProductOutput.setQuantity(defaultDecimal(dto.getQuantity())); |
| | | productionProductOutput.setScrapQty(defaultDecimal(dto.getScrapQty())); |
| | | productionProductOutputMapper.insert(productionProductOutput); |
| | | BigDecimal reportQty = defaultDecimal(productionProductOutput.getQuantity()); |
| | | BigDecimal scrapQty = defaultDecimal(productionProductOutput.getScrapQty()); |
| | | BigDecimal productQty = reportQty; |
| | | String qualifiedBatchNo = null; |
| | | |
| | | List<ProductionOrderRoutingOperation> routingOperationList = productionOrderRoutingOperationMapper.selectList( |
| | | Wrappers.<ProductionOrderRoutingOperation>lambdaQuery() |
| | |
| | | stockInventoryDto.setQualitity(productQty); |
| | | stockInventoryDto.setProductModelId(productModel.getId()); |
| | | stockInventoryService.addStockInRecordOnly(stockInventoryDto); |
| | | qualifiedBatchNo = resolveLatestStockInBatchNo( |
| | | productionProductMain.getId(), |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), |
| | | productModel.getId(), |
| | | "0"); |
| | | } |
| | | |
| | | productionOperationTask.setCompleteQuantity(defaultDecimal(productionOperationTask.getCompleteQuantity()).add(productQty)); |
| | |
| | | } |
| | | ProductionAccount productionAccount = new ProductionAccount(); |
| | | productionAccount.setProductionProductMainId(productionProductMain.getId()); |
| | | // productionAccount.setSalesLedgerId(productionOrder.getSalesLedgerId()); |
| | | // productionAccount.setSalesLedgerProductId(productionOrder.getSalesLedgerProductId() == null ? null : productionOrder.getSalesLedgerProductId().longValue()); |
| | | productionAccount.setSchedulingUserId(user == null ? null : user.getUserId()); |
| | | productionAccount.setSchedulingUserName(user == null ? dto.getUserName() : user.getNickName()); |
| | | productionAccount.setFinishedNum(productQty); |
| | |
| | | productionAccount.setSchedulingDate(LocalDateTime.now()); |
| | | productionAccountMapper.insert(productionAccount); |
| | | } |
| | | // if (defaultDecimal(dto.getScrapQty()).compareTo(BigDecimal.ZERO) > 0) { |
| | | // stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), |
| | | // StockInUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | // } |
| | | if (scrapQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | stockUtils.addUnStockWithBatchNo( |
| | | productModel.getId(), |
| | | scrapQty, |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), |
| | | productionProductMain.getId(), |
| | | qualifiedBatchNo); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private String resolveLatestStockInBatchNo(Long recordId, |
| | | String recordType, |
| | | Long productModelId, |
| | | String stockType) { |
| | | if (recordId == null || productModelId == null) { |
| | | return null; |
| | | } |
| | | StockInRecord stockInRecord = stockInRecordService.getOne( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .eq(StockInRecord::getRecordId, recordId) |
| | | .eq(StockInRecord::getRecordType, recordType) |
| | | .eq(StockInRecord::getProductModelId, productModelId) |
| | | .eq(StockInRecord::getType, stockType) |
| | | .orderByDesc(StockInRecord::getId) |
| | | .last("limit 1"), |
| | | false); |
| | | if (stockInRecord == null) { |
| | | throw new ServiceException("æªæ¾å°å¯¹åºçå
¥åºç³è¯·è®°å½"); |
| | | } |
| | | return stockInRecord.getBatchNo(); |
| | | } |
| | | |
| | | private void syncOperationParamInputValue(ProductionProductMainDto dto, |
| | |
| | | productionOrderRoutingOperationParamMapper.delete( |
| | | Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery() |
| | | .eq(ProductionOrderRoutingOperationParam::getProductionProductMainId, productionProductMain.getId())); |
| | | stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode()); |
| | | stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode()); |
| | | stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode()); |
| | | stockUtils.deleteStockOutRecord(productionProductMain.getId(), StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode()); |
| | | productionProductMainMapper.deleteById(productionProductMain.getId()); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlan(SavePlanVo savePlanVo) { |
| | | Plan plan = BeanUtil.copyProperties(savePlanVo, Plan.class); |
| | | // éä»¶å¤ç |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("", RecordTypeEnum.PLAN, savePlanVo.getId(), savePlanVo.getStorageBlobDTOs()); |
| | | if (savePlanVo.getId() == null) { |
| | | planMapper.insert(plan); |
| | | } else { |
| | | planMapper.updateById(plan); |
| | | } |
| | | // éä»¶å¤ç |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.PLAN, plan.getId(), savePlanVo.getStorageBlobDTOs()); |
| | | planService.savePlanNode(plan.getId(), savePlanVo.getSavePlanNodeList()); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | |
| | | @Transactional |
| | | public void save(@NotNull SaveInfoStageVo saveInfoStageVo) { |
| | | InfoStage infoStage = BeanUtil.copyProperties(saveInfoStageVo, InfoStage.class); |
| | | // éä»¶å¤ç |
| | | String attachmentIds = StrUtil.join(",", Optional.ofNullable(saveInfoStageVo.getAttachmentIds()).orElse(Collections.emptyList())); |
| | | infoStage.setAttachment(attachmentIds); |
| | | |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("", RecordTypeEnum.INFO_STAGE, infoStage.getProjectManagementInfoId(), saveInfoStageVo.getStorageBlobDTOs()); |
| | | |
| | | if (infoStage.getId() == null) { |
| | | infoStageMapper.insert(infoStage); |
| | | } else { |
| | | infoStageMapper.updateById(infoStage); |
| | | } |
| | | |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.INFO_STAGE, infoStage.getId(), saveInfoStageVo.getStorageBlobDTOs()); |
| | | infoStageHandleService.syncInfoStage(infoStage.getProjectManagementInfoId()); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.purchase.vo.PurchaseStockInProductVo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @GetMapping("/getByPurchaseLedgerId") |
| | | @Operation(summary = "éè´éè´§-æ ¹æ®éè´è®¢åidæ¥è¯¢éè´è®¢å对åºçå
¥åºäº§åä¿¡æ¯") |
| | | public AjaxResult getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | List<PurchaseStockInProductVo> purchaseStockInProductVos = purchaseReturnOrdersService.getByPurchaseLedgerId(purchaseLedgerId); |
| | | return AjaxResult.success(purchaseStockInProductVos); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | | //æ¹æ¬¡å· |
| | | private String batchNo; |
| | | |
| | | } |
| | |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class SimpleReturnOrderGroupDto implements Serializable { |
| | | private Long salesLedgerProductId; |
| | | private Long productModelId; |
| | | private BigDecimal sumReturnQuantity; |
| | | } |
| | |
| | | package com.ruoyi.purchase.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.bean.dto.PurchaseReturnDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseReturnVo; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo; |
| | | import com.ruoyi.purchase.vo.PurchaseStockInProductVo; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | IPage<PurchaseReturnOrderHasAllInfoDto> listPage(Page page, @Param("params") PurchaseReturnOrderDto purchaseReturnOrder); |
| | | |
| | | PurchaseReturnOrderHasAllInfoDto getPurchaseReturnOrderHasAllInfoById(@Param("id") @NotNull Long id); |
| | | |
| | | IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, @Param("req") PurchaseReturnDto purchaseReturnDto); |
| | | |
| | | //æ ¹æ®éè´è®¢åidæ¥è¯¢éè´è®¢å对åºçå
¥åºäº§åä¿¡æ¯ |
| | | List<PurchaseStockInProductVo> getByPurchaseLedgerId(@Param("purchaseLedgerId") Long purchaseLedgerId); |
| | | |
| | | List<PurchaseReturnOrderProductsDetailVo> getPurchaseReturnOrderProductsDetailById(@Param("id") Long id); |
| | | } |
| | |
| | | package com.ruoyi.purchase.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | |
| | | @Schema(description = "éè´§åid") |
| | | private Long purchaseReturnOrderId; |
| | | |
| | | @Schema(description = "éè´äº§åid") |
| | | @Schema(description = "éå®å°è´¦äº§åid") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @Schema(description = "éè´§æ°é") |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "å
³èå
¥åºåid") |
| | | private Long stockInRecordId; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.purchase.vo.PurchaseReturnDetailsVo; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | |
| | | import com.ruoyi.purchase.vo.PurchaseStockInProductVo; |
| | | import jakarta.validation.constraints.NotNull; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | PurchaseReturnDetailsVo getPurchaseReturnOrderDtoById(@NotNull Long id); |
| | | |
| | | void deleteById(@NotNull Long id); |
| | | |
| | | List<PurchaseStockInProductVo> getByPurchaseLedgerId(Long purchaseLedgerId); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.purchase.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderProductsDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrderProducts; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnDetailsVo; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo; |
| | | import com.ruoyi.purchase.vo.PurchaseStockInProductVo; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | purchaseReturnOrderProductsDto.setSalesLedgerProductId(purchaseReturnOrderProductsDto.getSalesLedgerProductId()); |
| | | purchaseReturnOrderProductsDto.setPurchaseReturnOrderId(purchaseReturnOrderDto.getId()); |
| | | purchaseReturnOrderProductsDto.setReturnQuantity(purchaseReturnOrderProductsDto.getReturnQuantity()); |
| | | purchaseReturnOrderProductsDto.setStockInRecordId(purchaseReturnOrderProductsDto.getStockInRecordId()); |
| | | // è¿é为æ°å¢å æ¤id为null |
| | | purchaseReturnOrderProductsDto.setId(null); |
| | | purchaseReturnOrderProductsMapper.insert(purchaseReturnOrderProductsDto); |
| | | //åºåéè¦åºåº(éè´éè´§) |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(purchaseReturnOrderDto.getPurchaseLedgerId()); |
| | | //åºåéè¦åºåº(éè´éè´§,å¸¦æ¹æ¬¡å·) |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(purchaseReturnOrderProductsDto.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), purchaseReturnOrderProductsDto.getReturnQuantity(), StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode(), purchaseReturnOrderDto.getId(), purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), purchaseReturnOrderProductsDto.getReturnQuantity(), StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode(), purchaseReturnOrderProductsDto.getId(), purchaseReturnOrderProductsDto.getBatchNo()); |
| | | } |
| | | }else { |
| | | throw new RuntimeException("è¯·éæ©éè´§åå"); |
| | |
| | | |
| | | @Override |
| | | public PurchaseReturnDetailsVo getPurchaseReturnOrderDtoById(Long id) { |
| | | //æ¥ä¸»ä½ |
| | | PurchaseReturnOrderHasAllInfoDto purchaseReturnOrders = purchaseReturnOrdersMapper.getPurchaseReturnOrderHasAllInfoById(id); |
| | | PurchaseReturnDetailsVo purchaseReturnOrderDto = BeanUtil.copyProperties(purchaseReturnOrders, PurchaseReturnDetailsVo.class); |
| | | // æ¥è¯¢åºä»å
·ä½å¯¹åºçéè´§ |
| | | LambdaQueryWrapper<PurchaseReturnOrderProducts> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, purchaseReturnOrders.getId()); |
| | | |
| | | List<PurchaseReturnOrderProducts> purchaseReturnOrderProducts = purchaseReturnOrderProductsMapper.selectList(queryWrapper); |
| | | List<PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVos = BeanUtil.copyToList(purchaseReturnOrderProducts, PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo.class); |
| | | // æ¥è¯¢åºå¯¹åºçååä¿¡æ¯ |
| | | List<Long> productIds = purchaseReturnOrderProductsDetailVos.stream().map(PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo::getSalesLedgerProductId).distinct().filter(Objects::nonNull).collect(Collectors.toList()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerService.getSalesLedgerProductListByIds(productIds, SaleEnum.PURCHASE); |
| | | Map<Long, SalesLedgerProduct> productmap = salesLedgerProducts.stream().collect(Collectors.toMap(SalesLedgerProduct::getId, product -> product)); |
| | | purchaseReturnOrderProductsDetailVos.forEach(purchaseReturnOrderProductsDetailVo -> { |
| | | purchaseReturnOrderProductsDetailVo.setSalesLedgerProduct(productmap.get(purchaseReturnOrderProductsDetailVo.getSalesLedgerProductId())); |
| | | }); |
| | | |
| | | //æ¥æç» |
| | | List<PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVos = purchaseReturnOrdersMapper.getPurchaseReturnOrderProductsDetailById(id); |
| | | purchaseReturnOrderDto.setPurchaseReturnOrderProductsDetailVoList(purchaseReturnOrderProductsDetailVos); |
| | | |
| | | |
| | | return purchaseReturnOrderDto; |
| | | } |
| | | |
| | |
| | | @Transactional |
| | | public void deleteById(Long id) { |
| | | purchaseReturnOrdersMapper.deleteById(id); |
| | | List<PurchaseReturnOrderProducts> purchaseReturnOrderProducts = purchaseReturnOrderProductsMapper.selectList(Wrappers.<PurchaseReturnOrderProducts>lambdaQuery().eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id)); |
| | | LambdaUpdateWrapper<PurchaseReturnOrderProducts> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id); |
| | | purchaseReturnOrderProductsMapper.delete(updateWrapper); |
| | | //(éè´éè´§çæ°æ®éè¦å æ) |
| | | stockOutRecordMapper.delete(Wrappers.<StockOutRecord>lambdaQuery() |
| | | .eq(StockOutRecord::getRecordType,StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode()) |
| | | .eq(StockOutRecord::getRecordId, id)); |
| | | .in(StockOutRecord::getRecordId, purchaseReturnOrderProducts.stream().map(PurchaseReturnOrderProducts::getId).collect(Collectors.toList()))); |
| | | // è´¢å¡ |
| | | LambdaUpdateWrapper<AccountIncome> updateWrapperAccountIncome = new LambdaUpdateWrapper<>(); |
| | | updateWrapperAccountIncome.eq(AccountIncome::getBusinessId, id); |
| | |
| | | updateWrapperAccountIncome.eq(AccountIncome::getIncomeType, 4); |
| | | accountIncomeService.remove(updateWrapperAccountIncome); |
| | | } |
| | | |
| | | @Override |
| | | public List<PurchaseStockInProductVo> getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | return purchaseReturnOrdersMapper.getByPurchaseLedgerId(purchaseLedgerId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.purchase.vo; |
| | | |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private List<PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVoList; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public static class PurchaseReturnOrderProductsDetailVo implements Serializable { |
| | | private Long id; |
| | | private BigDecimal returnQuantity; |
| | | private Long salesLedgerProductId; |
| | | private Long purchaseReturnOrderId; |
| | | |
| | | private SalesLedgerProduct salesLedgerProduct; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class PurchaseReturnOrderProductsDetailVo { |
| | | |
| | | @Schema(description = "éè´§æç»id") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éå®å°è´¦ç产åid") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @Schema(description = "产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @Schema(description = "产å大类") |
| | | private String productCategory; |
| | | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | @Schema(description = "å
¥åºæ°é") |
| | | private BigDecimal stockInNum; |
| | | |
| | | @Schema(description = "æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @Schema(description = "æªéè´§æ°") |
| | | private BigDecimal unQuantity; |
| | | |
| | | @Schema(description = "å·²éè´§æ°é") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | @Schema(description = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | @Schema(description = "éè´§æ°é") |
| | | private BigDecimal returnQuantity; |
| | | |
| | | @Schema(description = "éè´§åid") |
| | | private Long purchaseReturnOrderId; |
| | | |
| | | @Schema(description = "æ¯å¦è´¨æ£") |
| | | private Boolean isChecked; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @Schema(name = "PurchaseStockInProductVo", description = "éè´ç®¡ç--éè´è®¢åä¸å
¥åºäº§åå表") |
| | | public class PurchaseStockInProductVo { |
| | | |
| | | @Schema(description = "å
¥åºåid") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éå®å°è´¦ç产åid") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @Schema(description = "产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @Schema(description = "产å大类") |
| | | private String productCategory; |
| | | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "å
¥åºåå·") |
| | | private String inboundBatches; |
| | | |
| | | @Schema(description = "å
¥åºæ°é") |
| | | private BigDecimal stockInNum; |
| | | |
| | | @Schema(description = "æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @Schema(description = "å¯éè´§æ°") |
| | | private BigDecimal unQuantity; |
| | | |
| | | @Schema(description = "éè´§æ»æ°") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | @Schema(description = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | @Schema(description = "æ¯å¦è´¨æ£") |
| | | private Boolean isChecked; |
| | | } |
| | |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | private final StockUtils stockUtils; |
| | | private final StockInventoryService stockInventoryService; |
| | | private final StockInRecordService stockInRecordService; |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private IQualityInspectParamService qualityInspectParamService; |
| | |
| | | // stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId()); |
| | | //ä»
æ·»å å
¥åºè®°å½ |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | //妿æ¯éè´è´¨æ£åæ ¼å
¥åºéç¨CUSTOMIZATION_UNSTOCK_OUT,å
¶ä½åæ ¼å
¥åºéç¨QUALITYINSPECT_STOCK_IN |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())); |
| | | if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())){ |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | } |
| | | stockInventoryDto.setRecordId(qualityInspect.getId()); |
| | | stockInventoryDto.setProductModelId(qualityInspect.getProductModelId()); |
| | | stockInventoryDto.setQualitity(qualityInspect.getQuantity()); |
| | | stockInventoryDto.setBatchNo(resolveProductionBatchNo( |
| | | qualityInspect.getProductMainId(), |
| | | qualityInspect.getId(), |
| | | qualityInspect.getProductModelId())); |
| | | stockInventoryService.addStockInRecordOnly(stockInventoryDto); |
| | | } |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |
| | | |
| | | private String resolveProductionBatchNo(Long productionProductMainId, |
| | | Long qualityInspectId, |
| | | Long productModelId) { |
| | | if (productModelId == null) { |
| | | return null; |
| | | } |
| | | if (productionProductMainId != null) { |
| | | StockInRecord productionRecord = stockInRecordService.getOne( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .eq(StockInRecord::getRecordId, productionProductMainId) |
| | | .eq(StockInRecord::getProductModelId, productModelId) |
| | | .in(StockInRecord::getRecordType, Arrays.asList( |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode())) |
| | | .isNotNull(StockInRecord::getBatchNo) |
| | | .orderByDesc(StockInRecord::getId) |
| | | .last("limit 1"), |
| | | false); |
| | | if (productionRecord != null) { |
| | | return productionRecord.getBatchNo(); |
| | | } |
| | | } |
| | | if (qualityInspectId == null) { |
| | | return null; |
| | | } |
| | | StockInRecord inspectRecord = stockInRecordService.getOne( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .eq(StockInRecord::getRecordId, qualityInspectId) |
| | | .eq(StockInRecord::getProductModelId, productModelId) |
| | | .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode()) |
| | | .isNotNull(StockInRecord::getBatchNo) |
| | | .orderByDesc(StockInRecord::getId) |
| | | .last("limit 1"), |
| | | false); |
| | | return inspectRecord == null ? null : inspectRecord.getBatchNo(); |
| | | } |
| | | |
| | | /*çææ£éªæ¥å*/ |
| | | @Override |
| | | public void down(HttpServletResponse response, QualityInspect qualityInspect) { |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.quality.service.IQualityUnqualifiedService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private final ProductionOrderRoutingOperationMapper productionOrderRoutingOperationMapper; |
| | | private final ProductionOperationTaskMapper productionOperationTaskMapper; |
| | | private final StockUninventoryService stockUninventoryService; |
| | | private final StockInRecordService stockInRecordService; |
| | | |
| | | @Override |
| | | public IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | |
| | | public int deal(QualityUnqualified qualityUnqualified) { |
| | | QualityUnqualified unqualified = qualityUnqualifiedMapper.selectById(qualityUnqualified.getId()); |
| | | QualityInspect qualityInspect = qualityInspectService.getById(unqualified.getInspectId()); |
| | | String batchNo = qualityInspect == null ? null |
| | | : resolveProductionBatchNo(qualityInspect.getProductMainId(), qualityInspect.getId(), qualityInspect.getProductModelId()); |
| | | if (ObjectUtils.isNotNull(qualityInspect) && qualityInspect.getInspectType() != 0) { |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "è¿ä¿®": |
| | |
| | | } |
| | | break; |
| | | case "æ¥åº": |
| | | stockUtils.addUnStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), |
| | | StockInUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId()); |
| | | stockUtils.addUnStockWithBatchNo(qualityInspect.getProductModelId(), unqualified.getQuantity(), |
| | | StockInQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId(), batchNo); |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), |
| | | StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId()); |
| | | stockUtils.addStockWithBatchNo(qualityInspect.getProductModelId(), unqualified.getQuantity(), |
| | | StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(), batchNo); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "æ¥åº": |
| | | stockUtils.addUnStock(modelId, unqualified.getQuantity(), |
| | | StockInUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId()); |
| | | StockInQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId()); |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | stockUtils.addStock(modelId, unqualified.getQuantity(), |
| | |
| | | private BigDecimal defaultDecimal(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | private String resolveProductionBatchNo(Long productionProductMainId, |
| | | Long qualityInspectId, |
| | | Long productModelId) { |
| | | if (productModelId == null) { |
| | | return null; |
| | | } |
| | | if (productionProductMainId != null) { |
| | | StockInRecord productionRecord = stockInRecordService.getOne( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .eq(StockInRecord::getRecordId, productionProductMainId) |
| | | .eq(StockInRecord::getProductModelId, productModelId) |
| | | .in(StockInRecord::getRecordType, Arrays.asList( |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode())) |
| | | .isNotNull(StockInRecord::getBatchNo) |
| | | .orderByDesc(StockInRecord::getId) |
| | | .last("limit 1"), |
| | | false); |
| | | if (productionRecord != null) { |
| | | return productionRecord.getBatchNo(); |
| | | } |
| | | } |
| | | if (qualityInspectId == null) { |
| | | return null; |
| | | } |
| | | StockInRecord inspectRecord = stockInRecordService.getOne( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .eq(StockInRecord::getRecordId, qualityInspectId) |
| | | .eq(StockInRecord::getProductModelId, productModelId) |
| | | .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode()) |
| | | .isNotNull(StockInRecord::getBatchNo) |
| | | .orderByDesc(StockInRecord::getId) |
| | | .last("limit 1"), |
| | | false); |
| | | return inspectRecord == null ? null : inspectRecord.getBatchNo(); |
| | | } |
| | | } |
| | |
| | | if (CollUtil.isEmpty(list)) { |
| | | return AjaxResult.success(list); |
| | | } |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList()); |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getSalesLedgerProductId, item -> item.getSumReturnQuantity())); |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, item -> item.getSumReturnQuantity())); |
| | | |
| | | list.forEach(item -> { |
| | | if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) { |
| | |
| | | } |
| | | } |
| | | // ç»è®¡éè´§æ°é |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO); |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getProductModelId(), BigDecimal.ZERO); |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | |
| | | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @Operation(summary = "éè¿å®¢æ·åç§°æ¥è¯¢") |
| | | @Operation(summary = "éè¿å®¢æ·åç§°æ¥è¯¢å
³èçåè´§åå·") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private List<Long> batchNo; |
| | | private List<ShippingProductDetail> batchNoDetailList; |
| | | |
| | | //å
³èçåºåºåå· |
| | | private String outboundBatches; |
| | | |
| | | //åè´§æ°é |
| | | private BigDecimal totalQuantity; |
| | | |
| | | |
| | | } |
| | |
| | | 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.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | List<ShippingInfo> listAll(); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById(@Param("shippingId")Long shippingId); |
| | | List<ShippingProductVo> getReturnManagementDtoById(@Param("shippingId")Long shippingId); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | IPage<SalesOutboundVo> listPageByOutbound(Page page, @Param("req") SalesOutboundDto salesOutboundDto); |
| | | } |
| | |
| | | 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.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo; |
| | | import com.ruoyi.sales.dto.ShippingApproveDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.dto.ShippingProductDetailDto; |
| | |
| | | |
| | | boolean delete(List<Long> ids); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById( Long shippingId); |
| | | List<ShippingProductVo> getReturnManagementDtoById(Long shippingId); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | |
| | | private final ProductionProductInputMapper productionProductInputMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final RedisTemplate<String, String> redisTemplate; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Value("${file.upload-dir}") |
| | |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(productWrapper); |
| | | if (type.equals(SaleEnum.PURCHASE)) { |
| | | // æ¥è¯¢éè´§ä¿¡æ¯ |
| | | List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList()); |
| | | List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(productIds)){ |
| | | groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | | } |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getSalesLedgerProductId, SimpleReturnOrderGroupDto::getSumReturnQuantity)); |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, SimpleReturnOrderGroupDto::getSumReturnQuantity)); |
| | | salesLedgerProducts.forEach(item -> { |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO); |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getProductModelId(), BigDecimal.ZERO); |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) { |
| | | try { |
| | | // 1. æ ¡éªå®¢æ·ä¿¡æ¯ |
| | | Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId()); |
| | | if (customer == null) { |
| | | throw new BaseException("客æ·ä¸åå¨"); |
| | | } |
| | | |
| | | // 2. DTO转Entity |
| | | SalesLedger salesLedger = convertToEntity(salesLedgerDto); |
| | | salesLedger.setCustomerName(customer.getCustomerName()); |
| | | salesLedger.setTenantId(customer.getTenantId()); |
| | | // 3. æ°å¢ææ´æ°ä¸»è¡¨ |
| | | if (salesLedger.getId() == null) { |
| | | String contractNo = generateSalesContractNo(); |
| | | salesLedger.setSalesContractNo(contractNo); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | } else { |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | } |
| | | |
| | | // 4. å¤çåè¡¨æ°æ® |
| | | List<SalesLedgerProduct> productList = salesLedgerDto.getProductData(); |
| | | if (productList != null && !productList.isEmpty()) { |
| | | handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType())); |
| | | updateMainContractAmount( |
| | | salesLedger.getId(), |
| | | productList, |
| | | SalesLedgerProduct::getTaxInclusiveTotalPrice, |
| | | salesLedgerMapper, |
| | | SalesLedger.class |
| | | ); |
| | | } |
| | | |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) { |
| | | migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds()); |
| | | } |
| | | return 1; |
| | | } catch (IOException e) { |
| | | throw new BaseException("æä»¶è¿ç§»å¤±è´¥: " + e.getMessage()); |
| | | // 1. æ ¡éªå®¢æ·ä¿¡æ¯ |
| | | Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId()); |
| | | if (customer == null) { |
| | | throw new BaseException("客æ·ä¸åå¨"); |
| | | } |
| | | |
| | | // 2. DTO转Entity |
| | | SalesLedger salesLedger = convertToEntity(salesLedgerDto); |
| | | salesLedger.setCustomerName(customer.getCustomerName()); |
| | | salesLedger.setTenantId(customer.getTenantId()); |
| | | // 3. æ°å¢ææ´æ°ä¸»è¡¨ |
| | | if (salesLedger.getId() == null) { |
| | | String contractNo = generateSalesContractNo(); |
| | | salesLedger.setSalesContractNo(contractNo); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | } else { |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | } |
| | | |
| | | |
| | | // 4. å¤çåè¡¨æ°æ® |
| | | List<SalesLedgerProduct> productList = salesLedgerDto.getProductData(); |
| | | if (productList != null && !productList.isEmpty()) { |
| | | handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType())); |
| | | updateMainContractAmount( |
| | | salesLedger.getId(), |
| | | productList, |
| | | SalesLedgerProduct::getTaxInclusiveTotalPrice, |
| | | salesLedgerMapper, |
| | | SalesLedger.class |
| | | ); |
| | | } |
| | | |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs()); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * å°ä¸´æ¶æä»¶è¿ç§»å°æ£å¼ç®å½ |
| | | * |
| | | * @param businessId ä¸å¡IDï¼éå®å°è´¦IDï¼ |
| | | * @param tempFileIds ä¸´æ¶æä»¶IDå表 |
| | | * @throws IOException æä»¶æä½å¼å¸¸ |
| | | */ |
| | | private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException { |
| | | if (CollectionUtils.isEmpty(tempFileIds)) { |
| | | return; |
| | | } |
| | | |
| | | // æå»ºæ£å¼ç®å½è·¯å¾ï¼æä¸å¡ç±»å忥æåç»ï¼ |
| | | String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | |
| | | Path formalDirPath = Paths.get(formalDir); |
| | | |
| | | // ç¡®ä¿æ£å¼ç®å½åå¨ï¼éå½åå»ºï¼ |
| | | if (!Files.exists(formalDirPath)) { |
| | | Files.createDirectories(formalDirPath); |
| | | } |
| | | |
| | | for (String tempFileId : tempFileIds) { |
| | | // æ¥è¯¢ä¸´æ¶æä»¶è®°å½ |
| | | TempFile tempFile = tempFileMapper.selectById(tempFileId); |
| | | if (tempFile == null) { |
| | | log.warn("ä¸´æ¶æä»¶ä¸åå¨ï¼è·³è¿å¤ç: {}", tempFileId); |
| | | continue; |
| | | } |
| | | |
| | | // æå»ºæ£å¼æä»¶åï¼å
å«ä¸å¡IDåæ¶é´æ³ï¼é¿å
å²çªï¼ |
| | | String originalFilename = tempFile.getOriginalName(); |
| | | String fileExtension = FilenameUtils.getExtension(originalFilename); |
| | | String formalFilename = businessId + "_" + |
| | | System.currentTimeMillis() + "_" + |
| | | UUID.randomUUID().toString().substring(0, 8) + |
| | | (StringUtils.hasText(fileExtension) ? "." + fileExtension : ""); |
| | | |
| | | Path formalFilePath = formalDirPath.resolve(formalFilename); |
| | | |
| | | try { |
| | | // æ§è¡æä»¶è¿ç§»ï¼ä½¿ç¨ååæä½ç¡®ä¿å®å
¨æ§ï¼ |
| | | // Files.move( |
| | | // Paths.get(tempFile.getTempPath()), |
| | | // formalFilePath, |
| | | // StandardCopyOption.REPLACE_EXISTING, |
| | | // StandardCopyOption.ATOMIC_MOVE |
| | | // ); |
| | | // ååç§»å¨å¤±è´¥ï¼ä½¿ç¨å¤å¶+å é¤ |
| | | Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING); |
| | | Files.deleteIfExists(Paths.get(tempFile.getTempPath())); |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | |
| | | // æ´æ°æä»¶è®°å½ï¼å
³èå°ä¸å¡IDï¼ |
| | | CommonFile fileRecord = new CommonFile(); |
| | | fileRecord.setCommonId(businessId); |
| | | fileRecord.setName(originalFilename); |
| | | fileRecord.setUrl(formalFilePath.toString()); |
| | | fileRecord.setCreateTime(LocalDateTime.now()); |
| | | //éå® |
| | | fileRecord.setType(FileNameType.SALE.getValue()); |
| | | commonFileMapper.insert(fileRecord); |
| | | |
| | | // å é¤ä¸´æ¶æä»¶è®°å½ |
| | | tempFileMapper.deleteById(tempFile); |
| | | |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | } catch (IOException e) { |
| | | log.error("æä»¶è¿ç§»å¤±è´¥: {}", tempFile.getTempPath(), e); |
| | | // å¯éæ©åæ»äºå¡æè®°å½å¤±è´¥æä»¶ |
| | | throw new IOException("æä»¶è¿ç§»å¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æä»¶è¿ç§»æ¹æ³ |
| | | |
| | | @Override |
| | | public void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, SaleEnum type) { |
| | |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingApproveDto; |
| | |
| | | @Override |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item ->{ |
| | | listPage.getRecords().forEach(item -> { |
| | | item.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, item.getId())); |
| | | }); |
| | | return listPage; |
| | |
| | | throw new RuntimeException("åè´§ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //æ£ååºå |
| | | if(!"å·²åè´§".equals(byId.getStatus())){ |
| | | if (!"å·²åè´§".equals(byId.getStatus())) { |
| | | List<ShippingProductDetail> shippingProductDetails = shippingProductDetailMapper.selectList(new LambdaQueryWrapper<ShippingProductDetail>().eq(ShippingProductDetail::getShippingInfoId, req.getId())); |
| | | if (CollectionUtils.isEmpty(shippingProductDetails)) { |
| | | throw new RuntimeException("åè´§ä¿¡æ¯ä¸åå¨"); |
| | |
| | | boolean update = this.updateById(byId); |
| | | // ä¿åæä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs()); |
| | | return update ; |
| | | return update; |
| | | } |
| | | |
| | | @Override |
| | | public boolean delete(List<Long> ids) { |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getId, ids)); |
| | | if(CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | if (CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | // å é¤éä»¶ |
| | | commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue()); |
| | | // æ£å·²åè´§åºå |
| | | for (ShippingInfo shippingInfo : shippingInfos) { |
| | | if("å·²åè´§".equals(shippingInfo.getStatus())) { |
| | | if ("å·²åè´§".equals(shippingInfo.getStatus())) { |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | } |
| | | } |
| | | // å é¤åè´§å®¡æ¹ |
| | | if(CollectionUtils.isNotEmpty(shippingInfos)){ |
| | | for (ShippingInfo shippingInfo : shippingInfos){ |
| | | if (CollectionUtils.isNotEmpty(shippingInfos)) { |
| | | for (ShippingInfo shippingInfo : shippingInfos) { |
| | | List<ApproveProcess> one = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | | .like(ApproveProcess::getApproveReason, shippingInfo.getShippingNo())); |
| | | if(one != null){ |
| | | if (one != null) { |
| | | List<Long> list = one.stream().map(ApproveProcess::getId).toList(); |
| | | approveProcessService.delByIds(list); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) { |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId ); |
| | | public List<ShippingProductVo> getReturnManagementDtoById(Long shippingId) { |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean add(ShippingInfoDto req) { |
| | | this.save( req); |
| | | this.save(req); |
| | | req.getBatchNoDetailList().forEach(item -> item.setShippingInfoId(req.getId())); |
| | | shippingProductDetailMapper.insert(req.getBatchNoDetailList()); |
| | | for (ShippingProductDetail shippingProductDetail : req.getBatchNoDetailList()) { |
| | | stockUtils.substractStock(shippingProductDetail.getProductModelId(), shippingProductDetail.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(), shippingProductDetail.getBatchNo()); |
| | | } |
| | | // ä¿åæä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | |
| | | ShippingApproveDto shippingApproveDto = new ShippingApproveDto(); |
| | | ShippingInfo shippingInfo = new ShippingInfo(); |
| | | shippingInfo.setShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1),shippingInfo).getRecords().get(0)); |
| | | shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1), shippingInfo).getRecords().get(0)); |
| | | List<ShippingProductDetailDto> dateilByShippingNo = shippingProductDetailMapper.getDateilByShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingProductDetailDtoList(dateilByShippingNo); |
| | | return shippingApproveDto; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | |
| | | @PostMapping("/addstockUninventory") |
| | | @Operation(summary = "æ°å¢åºå") |
| | | public R addstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.addStockUninventory(stockUninventoryDto)); |
| | | } |
| | |
| | | @PostMapping("/subtractstockUninventory") |
| | | @Operation(summary = "æ£ååºå") |
| | | public R subtractstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.subtractStockUninventory(stockUninventoryDto)); |
| | | } |
| | |
| | | @PostMapping("/addStockInRecordOnly") |
| | | @Operation(summary = "æ°å¢å
¥åºè®°å½ï¼ä»
å建记å½ï¼ä¸è°æ´åºåï¼") |
| | | public R addStockInRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.addStockInRecordOnly(stockUninventoryDto)); |
| | | } |
| | |
| | | @PostMapping("/addStockOutRecordOnly") |
| | | @Operation(summary = "æ°å¢åºåºè®°å½ï¼ä»
å建记å½ï¼ä¸è°æ´åºåï¼") |
| | | public R addStockOutRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.addStockOutRecordOnly(stockUninventoryDto)); |
| | | } |
| | |
| | | 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.PurchaseInboundDto; |
| | | import com.ruoyi.account.bean.vo.PurchaseInboundVo; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.execl.StockInRecordExportData; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | |
| | | IPage<StockInRecordDto> listPage(Page page, @Param("params") StockInRecordDto stockInRecordDto); |
| | | |
| | | List<StockInRecordExportData> listStockInRecordExportData(@Param("params") StockInRecordDto stockInRecordDto); |
| | | |
| | | IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, @Param("req") PurchaseInboundDto purchaseInboundDto); |
| | | } |
| | |
| | | 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.SalesOutboundDto; |
| | | import com.ruoyi.account.bean.vo.SalesOutboundVo; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.execl.StockOutRecordExportData; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | |
| | | |
| | | List<StockOutRecordExportData> listStockOutRecordExportData(@Param("params") StockOutRecordDto stockOutRecordDto); |
| | | |
| | | IPage<SalesOutboundVo> listPageAccountSales(Page page, @Param("req") SalesOutboundDto salesOutboundDto); |
| | | } |
| | |
| | | @Schema(description = "ç±»å 0åæ ¼å
¥åº 1ä¸åæ ¼å
¥åº") |
| | | private String type; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ 0-å¾
å®¡æ¹ 1-éè¿ 2-驳å", implementation = ReviewStatusEnum.class) |
| | | @Schema(description = "审æ¹ç¶æ 0-å¾
å®¡æ¹ 1-éè¿ 2-驳å 3-éå®åºåºå¾
确认", implementation = ReviewStatusEnum.class) |
| | | private Integer approvalStatus; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.ReviewStatusEnum; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<StockInRecordExportData> util = new ExcelUtil<>(StockInRecordExportData.class); |
| | |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | if (dto.getUnQualifiedQuantity() != null && dto.getUnQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | stockUninventoryDto.setRecordType(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()); |
| | | stockUninventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()); |
| | | stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity()); |
| | | stockUninventoryDto.setRemark(dto.getRemark()); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.ReviewStatusEnum; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public int add(StockOutRecordDto stockOutRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK","outbound_batches"); |
| | | stockOutRecordDto.setOutboundBatches(no); |
| | | StockInRecord stockInRecord = new StockInRecord(); |
| | | BeanUtils.copyProperties(stockOutRecordDto, stockInRecord); |
| | | if (StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode().equals(stockOutRecordDto.getRecordType())){ |
| | | stockOutRecordDto.setApprovalStatus(3); |
| | | } |
| | | return stockOutRecordMapper.insert(stockOutRecordDto); |
| | | } |
| | | |
| | |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<StockOutRecordExportData> util = new ExcelUtil<>(StockOutRecordExportData.class); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockUnInventoryExportData; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import lombok.AllArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private final StockUninventoryMapper stockUninventoryMapper; |
| | | private final StockOutRecordService stockOutRecordService; |
| | | private final StockInRecordService stockInRecordService; |
| | | private final ProductModelMapper productModelMapper; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<StockUninventoryDto> pageStockUninventory(Page page, StockUninventoryDto stockUninventoryDto) { |
| | |
| | | stockInRecordDto.setRecordId(stockUninventoryDto.getRecordId()); |
| | | stockInRecordDto.setRecordType(stockUninventoryDto.getRecordType()); |
| | | stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity()); |
| | | stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo()); |
| | | String batchNo = StringUtils.trim(stockUninventoryDto.getBatchNo()); |
| | | if (StringUtils.isEmpty(batchNo)) { |
| | | batchNo = generateAutoBatchNo(stockUninventoryDto.getProductModelId()); |
| | | } |
| | | stockInRecordDto.setBatchNo(batchNo); |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordDto.setRemark(stockUninventoryDto.getRemark()); |
| | |
| | | stockUninventory.setLockedQuantity(stockUninventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity())); |
| | | return this.updateById(stockUninventory); |
| | | } |
| | | |
| | | //è§åçæï¼20260424-产åç¼å·-001 |
| | | private String generateAutoBatchNo(Long productModelId) { |
| | | if (productModelId == null) { |
| | | throw new ServiceException("产åè§æ ¼IDä¸è½ä¸ºç©º"); |
| | | } |
| | | ProductModel productModel = productModelMapper.selectById(productModelId); |
| | | if (productModel == null) { |
| | | throw new ServiceException("产åè§æ ¼ä¸åå¨ï¼ID=" + productModelId); |
| | | } |
| | | String productCode = StringUtils.trim(productModel.getProductCode()); |
| | | if (StringUtils.isEmpty(productCode)) { |
| | | throw new ServiceException("产åè§æ ¼æªç»´æ¤äº§åç¼ç ï¼ID=" + productModelId); |
| | | } |
| | | |
| | | String dateText = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); |
| | | String prefix = dateText + "-" + productCode + "-"; |
| | | int maxSequence = resolveMaxSequence(prefix); |
| | | int sequence = maxSequence + 1; |
| | | while (sequence < 1_000_000) { |
| | | String batchNo = prefix + String.format("%03d", sequence); |
| | | if (!isBatchNoExists(batchNo)) { |
| | | return batchNo; |
| | | } |
| | | sequence++; |
| | | } |
| | | throw new ServiceException("æ¹å·åºå·è¶
åºèå´ï¼è¯·æ£æ¥æ¹å·æ°æ®"); |
| | | } |
| | | |
| | | private int resolveMaxSequence(String prefix) { |
| | | int maxSequence = 0; |
| | | List<StockInventory> stockInventoryList = stockInventoryMapper.selectList( |
| | | Wrappers.<StockInventory>lambdaQuery() |
| | | .select(StockInventory::getBatchNo) |
| | | .likeRight(StockInventory::getBatchNo, prefix)); |
| | | for (StockInventory stockInventory : stockInventoryList) { |
| | | maxSequence = Math.max(maxSequence, parseSequence(stockInventory.getBatchNo(), prefix)); |
| | | } |
| | | |
| | | List<StockInRecord> stockInRecordList = stockInRecordService.list( |
| | | Wrappers.<StockInRecord>lambdaQuery() |
| | | .select(StockInRecord::getBatchNo) |
| | | .likeRight(StockInRecord::getBatchNo, prefix)); |
| | | for (StockInRecord stockInRecord : stockInRecordList) { |
| | | maxSequence = Math.max(maxSequence, parseSequence(stockInRecord.getBatchNo(), prefix)); |
| | | } |
| | | return maxSequence; |
| | | } |
| | | |
| | | private int parseSequence(String batchNo, String prefix) { |
| | | if (StringUtils.isEmpty(batchNo) || StringUtils.isEmpty(prefix) || !batchNo.startsWith(prefix)) { |
| | | return 0; |
| | | } |
| | | String sequenceText = batchNo.substring(prefix.length()); |
| | | if (StringUtils.isEmpty(sequenceText) || !sequenceText.matches("\\d+")) { |
| | | return 0; |
| | | } |
| | | try { |
| | | return Integer.parseInt(sequenceText); |
| | | } catch (NumberFormatException ignored) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isBatchNoExists(String batchNo) { |
| | | if (StringUtils.isEmpty(batchNo)) { |
| | | return false; |
| | | } |
| | | Long inventoryCount = stockInventoryMapper.selectCount( |
| | | Wrappers.<StockInventory>lambdaQuery().eq(StockInventory::getBatchNo, batchNo)); |
| | | if (inventoryCount != null && inventoryCount > 0) { |
| | | return true; |
| | | } |
| | | return stockInRecordService.count( |
| | | Wrappers.<StockInRecord>lambdaQuery().eq(StockInRecord::getBatchNo, batchNo)) > 0; |
| | | } |
| | | } |
| | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String model; |
| | | |
| | | @Schema(description = "产åç¼ç ") |
| | | private String productCode; |
| | | |
| | | private List<TechnologyBomStructureVo> children; |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('product:bom:export')") |
| | | @Operation(summary = "导åºBOMæä»¶") |
| | | @Log(title = "导åºBOMæä»¶", businessType = BusinessType.EXPORT) |
| | | public void exportBom(HttpServletResponse response, @RequestParam Integer bomId) { |
| | | public void exportBom(HttpServletResponse response, @RequestParam Long bomId) { |
| | | technologyBomService.exportBom(response, bomId); |
| | | } |
| | | |
| | |
| | | |
| | | R uploadBom(MultipartFile file); |
| | | |
| | | void exportBom(HttpServletResponse response, Integer bomId); |
| | | void exportBom(HttpServletResponse response, Long bomId); |
| | | |
| | | R copy(TechnologyBom technologyBom); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.BomImportDto; |
| | | import com.ruoyi.production.bean.dto.ProductStructureDto; |
| | | import com.ruoyi.technology.bean.dto.BomImportDto; |
| | | import com.ruoyi.technology.bean.dto.TechnologyBomDto; |
| | | import com.ruoyi.technology.bean.dto.TechnologyBomStructureDto; |
| | | import com.ruoyi.technology.bean.vo.TechnologyBomStructureVo; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void exportBom(HttpServletResponse response, Integer bomId) { |
| | | public void exportBom(HttpServletResponse response, Long bomId) { |
| | | if (bomId == null) { |
| | | throw new ServiceException("BOM IDä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<TechnologyBomStructureVo> treeData = technologyBomStructureService.listByBomId(bomId); |
| | | if (treeData == null || treeData.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | // List<ProductStructureDto> treeData = productStructureService.listBybomId(bomId); |
| | | // if (treeData == null || treeData.isEmpty()) { |
| | | // return; |
| | | // } |
| | | // |
| | | // // å°æ å½¢ç»ææå¹³å ä½¿ç¨ BFSç®æ³ 导åº,æå±çº§é¡ºåº |
| | | // List<BomImportDto> exportList = new ArrayList<>(); |
| | | // |
| | | // // Map<ID, Node> idMap ç¨äºæ¥æ¾ç¶èç¹ |
| | | // Map<Long, ProductStructureDto> idMap = new HashMap<>(); |
| | | // populateMap(treeData, idMap); |
| | | // |
| | | // // treeData ç第ä¸ä¸ªæ¯æ ¹èç¹ |
| | | // for (ProductStructureDto root : treeData) { |
| | | // // æ·»å æ ¹èç¹ |
| | | // BomImportDto rootRow = new BomImportDto(); |
| | | // rootRow.setParentName(root.getProductName()); |
| | | // rootRow.setParentSpec(root.getModel()); |
| | | // rootRow.setUnitQty(root.getUnitQuantity()); |
| | | // rootRow.setRemark(""); |
| | | // exportList.add(rootRow); |
| | | // |
| | | // // BFS éå-éå |
| | | // Queue<ProductStructureDto> queue = new LinkedList<>(); |
| | | // if (root.getChildren() != null) { |
| | | // queue.addAll(root.getChildren()); |
| | | // } |
| | | // |
| | | // while (!queue.isEmpty()) { |
| | | // ProductStructureDto child = queue.poll(); |
| | | // |
| | | // // æ¥æ¾ç¶èç¹ |
| | | // ProductStructureDto parent = idMap.get(child.getParentId()); |
| | | // if (parent == null) { |
| | | // // é¤äºæå¤å±èç¹,å
¶ä»èç¹çç¶ç±»è¯å®æ¯ä¸ä¼ä¸ºç©ºç |
| | | // continue; |
| | | // } |
| | | // |
| | | // BomImportDto row = new BomImportDto(); |
| | | // // ç¶ç±»ä¿¡æ¯ |
| | | // row.setParentName(parent.getProductName()); |
| | | // row.setParentSpec(parent.getModel()); |
| | | // // åç±»ä¿¡æ¯ |
| | | // row.setChildName(child.getProductName()); |
| | | // row.setChildSpec(child.getModel()); |
| | | // row.setUnitQty(child.getUnitQuantity()); |
| | | // row.setProcess(child.getProcessName()); |
| | | // |
| | | // exportList.add(row); |
| | | // |
| | | // // å°åèç¹çåèç¹å å
¥éå-ä¸ä¸å± |
| | | // if (child.getChildren() != null && !child.getChildren().isEmpty()) { |
| | | // queue.addAll(child.getChildren()); |
| | | // } |
| | | // } |
| | | // } |
| | | // å°æ å½¢ç»ææå¹³å ä½¿ç¨ BFSç®æ³ 导åº,æå±çº§é¡ºåº |
| | | List<BomImportDto> exportList = new ArrayList<>(); |
| | | |
| | | // Map<ID, Node> idMap ç¨äºæ¥æ¾ç¶èç¹ |
| | | Map<Long, TechnologyBomStructureVo> idMap = new HashMap<>(); |
| | | populateMap(treeData, idMap); |
| | | |
| | | // treeData ç第ä¸ä¸ªæ¯æ ¹èç¹ |
| | | for (TechnologyBomStructureVo root : treeData) { |
| | | // æ·»å æ ¹èç¹ |
| | | BomImportDto rootRow = new BomImportDto(); |
| | | rootRow.setParentName(root.getProductName()); |
| | | rootRow.setParentSpec(root.getModel()); |
| | | rootRow.setUnitQty(root.getUnitQuantity()); |
| | | rootRow.setParentCode(root.getProductCode()); |
| | | rootRow.setRemark(""); |
| | | exportList.add(rootRow); |
| | | |
| | | // BFS éå-éå |
| | | Queue<TechnologyBomStructureVo> queue = new LinkedList<>(); |
| | | if (root.getChildren() != null) { |
| | | queue.addAll(root.getChildren()); |
| | | } |
| | | |
| | | while (!queue.isEmpty()) { |
| | | TechnologyBomStructureVo child = queue.poll(); |
| | | |
| | | // æ¥æ¾ç¶èç¹ |
| | | TechnologyBomStructureVo parent = idMap.get(child.getParentId()); |
| | | if (parent == null) { |
| | | // é¤äºæå¤å±èç¹,å
¶ä»èç¹çç¶ç±»è¯å®æ¯ä¸ä¼ä¸ºç©ºç |
| | | continue; |
| | | } |
| | | |
| | | BomImportDto row = new BomImportDto(); |
| | | // ç¶ç±»ä¿¡æ¯ |
| | | row.setParentName(parent.getProductName()); |
| | | row.setParentSpec(parent.getModel()); |
| | | // åç±»ä¿¡æ¯ |
| | | row.setChildName(child.getProductName()); |
| | | row.setChildSpec(child.getModel()); |
| | | row.setUnitQty(child.getUnitQuantity()); |
| | | row.setProcess(child.getOperationName()); |
| | | row.setChildCode(child.getProductCode()); |
| | | |
| | | exportList.add(row); |
| | | |
| | | // å°åèç¹çåèç¹å å
¥éå-ä¸ä¸å± |
| | | if (child.getChildren() != null && !child.getChildren().isEmpty()) { |
| | | queue.addAll(child.getChildren()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | ExcelUtil<BomImportDto> util = new ExcelUtil<>(BomImportDto.class); |
| | | // util.exportExcel(response, exportList, "BOMç»æå¯¼åº"); |
| | | util.exportExcel(response, exportList, "BOMç»æå¯¼åº"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return s.replaceAll("[\\u00A0\\u3000]", "").trim(); |
| | | } |
| | | |
| | | private void populateMap(List<ProductStructureDto> nodes, Map<Long, ProductStructureDto> map) { |
| | | private void populateMap(List<TechnologyBomStructureVo> nodes, Map<Long, TechnologyBomStructureVo> map) { |
| | | if (nodes == null || nodes.isEmpty()) { |
| | | return; |
| | | } |
| | | for (ProductStructureDto node : nodes) { |
| | | for (TechnologyBomStructureVo node : nodes) { |
| | | map.put(node.getId(), node); |
| | | populateMap(node.getChildren(), map); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.warehouse.dto.DocumentationDto; |
| | | import com.ruoyi.warehouse.pojo.Documentation; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://localhost:3300/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.AccountSubject"> |
| | | <id column="id" property="id" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="subject_code" property="subjectCode" /> |
| | | <result column="subject_name" property="subjectName" /> |
| | | <result column="subject_type" property="subjectType" /> |
| | |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |
| | | |
| | | <select id="countReferencedBySubjectCodes" resultType="java.lang.Long"> |
| | | SELECT COUNT(1) |
| | | FROM fin_voucher_entry |
| | | WHERE subject_code IN |
| | | <foreach collection="subjectCodes" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="pageSalesRefundAmountOrderDto" resultType="com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto"> |
| | | select sl.sales_contract_no, |
| | | sl.customer_contract_no, |
| | | slp.specification_model, |
| | | slp.product_category as product_name, |
| | | slp.unit, |
| | | pm.model as specification_model, |
| | | p.product_name , |
| | | pm.unit, |
| | | sl.customer_name, |
| | | rm.return_no as return_management_no, |
| | | srao.* |
| | |
| | | left join return_management rm on srao.return_management_id = rm.id |
| | | left join return_sale_product rs on rm.id = rs.return_management_id |
| | | left join sales_ledger_product slp on rs.return_sales_ledger_product_id = slp.id |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sales_ledger sl on slp.sales_ledger_id = sl.id |
| | | <where> |
| | | <if test="ew.salesContractNo != null and ew.salesContractNo !=''"> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.mapper.financial.FinVoucherEntryMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.financial.FinVoucherEntry"> |
| | | <id column="id" property="id"/> |
| | | <result column="voucher_id" property="voucherId"/> |
| | | <result column="row_no" property="rowNo"/> |
| | | <result column="subject_code" property="subjectCode"/> |
| | | <result column="subject_name" property="subjectName"/> |
| | | <result column="summary" property="summary"/> |
| | | <result column="debit" property="debit"/> |
| | | <result column="credit" property="credit"/> |
| | | <result column="auxiliary_type" property="auxiliaryType"/> |
| | | <result column="auxiliary_id" property="auxiliaryId"/> |
| | | <result column="auxiliary_name" property="auxiliaryName"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="dept_id" property="deptId"/> |
| | | </resultMap> |
| | | |
| | | <select id="listPostedEntries" resultType="com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo"> |
| | | SELECT |
| | | v.voucher_date AS voucherDate, |
| | | v.voucher_no AS voucherNo, |
| | | CASE |
| | | WHEN e.summary IS NOT NULL AND e.summary != '' THEN e.summary |
| | | ELSE v.summary |
| | | END AS summary, |
| | | e.debit AS debit, |
| | | e.credit AS credit, |
| | | e.row_no AS rowNo |
| | | FROM fin_voucher_entry e |
| | | INNER JOIN fin_voucher v ON e.voucher_id = v.id |
| | | WHERE v.status = 'posted' |
| | | AND (e.subject_code = #{subjectCode} OR e.subject_code LIKE CONCAT(#{subjectCode}, '%')) |
| | | AND v.voucher_date <![CDATA[>=]]> #{startDate} |
| | | AND v.voucher_date <![CDATA[<=]]> #{endDate} |
| | | <if test="auxiliaryType != null and auxiliaryType != ''"> |
| | | AND e.auxiliary_type = #{auxiliaryType} |
| | | </if> |
| | | <if test="auxiliaryId != null and auxiliaryId != ''"> |
| | | AND e.auxiliary_id = #{auxiliaryId} |
| | | </if> |
| | | ORDER BY v.voucher_date ASC, v.id ASC, e.row_no ASC, e.id ASC |
| | | </select> |
| | | |
| | | <select id="listPostedEntriesBefore" resultType="com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo"> |
| | | SELECT |
| | | v.voucher_date AS voucherDate, |
| | | v.voucher_no AS voucherNo, |
| | | CASE |
| | | WHEN e.summary IS NOT NULL AND e.summary != '' THEN e.summary |
| | | ELSE v.summary |
| | | END AS summary, |
| | | e.debit AS debit, |
| | | e.credit AS credit, |
| | | e.row_no AS rowNo |
| | | FROM fin_voucher_entry e |
| | | INNER JOIN fin_voucher v ON e.voucher_id = v.id |
| | | WHERE v.status = 'posted' |
| | | AND (e.subject_code = #{subjectCode} OR e.subject_code LIKE CONCAT(#{subjectCode}, '%')) |
| | | AND v.voucher_date <![CDATA[<]]> #{beforeDate} |
| | | <if test="auxiliaryType != null and auxiliaryType != ''"> |
| | | AND e.auxiliary_type = #{auxiliaryType} |
| | | </if> |
| | | <if test="auxiliaryId != null and auxiliaryId != ''"> |
| | | AND e.auxiliary_id = #{auxiliaryId} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper"> |
| | | |
| | | <select id="listProcurementBySalesLedgerId" resultType="com.ruoyi.procurementrecord.dto.ProcurementDto"> |
| | | <select id="listProcurementBySalesLedgerId" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementDto"> |
| | | select |
| | | t1.supplier_name, |
| | | t2.product_category, |
| | |
| | | </if> |
| | | group by t2.id |
| | | </select> |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto"> |
| | | select |
| | | t3.supplier_name, |
| | | t3.purchase_contract_number, |
| | |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto"> |
| | | select |
| | | t3.supplier_name, |
| | | t3.purchase_contract_number, |
| | |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | | where t1.type = 1 |
| | | </select> |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | | where t1.type = 2 |
| | | </select> |
| | | <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy"> |
| | | select |
| | | t3.supplier_name, |
| | | t3.purchase_contract_number, |
| | |
| | | group by t3.supplier_name,t2.product_category,t2.specification_model,t1.unit_price |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | <select id="listCopy" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy"> |
| | | select |
| | | t3.supplier_name, |
| | | t3.purchase_contract_number, |
| | |
| | | where t1.type = 1 |
| | | group by t3.supplier_name,t2.product_category,t2.specification_model |
| | | </select> |
| | | <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | |
| | | where t1.type = 2 |
| | | group by t3.customer_name,t2.product_category,t2.specification_model |
| | | </select> |
| | | <select id="listPageByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | <select id="listPageByProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | |
| | | group by t2.product_category,t2.specification_model,t1.unit_price |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listPagePRS" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | <select id="listPagePRS" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy"> |
| | | select * |
| | | from procurement_record_storage t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | |
| | | from procurement_record_storage |
| | | where product_model_id = #{productModelId} |
| | | </select> |
| | | <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto"> |
| | | select |
| | | t1.*, |
| | | t1.inbound_num as inboundNum0, |
| | |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | </mapper> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.supplier_name, |
| | | t2.product_category, |
| | |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select t3.supplier_name, |
| | | t2.product_category, |
| | | t1.id, |
| | |
| | | where t1.type = 1 |
| | | </select> |
| | | |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | |
| | | where t1.type = 2 |
| | | </select> |
| | | |
| | | <select id="listTwo" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listTwo" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select t1.supplier_name, |
| | | t1.product_category, |
| | | t1.id, |
| | |
| | | from procurement_record_out t1 |
| | | where t1.type = 3 |
| | | </select> |
| | | <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t2.supplier_name, |
| | | t2.product_category, |
| | |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | <select id="listPageBySemiProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | <select id="listPageBySemiProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t1.id, |
| | | t1.code, |
| | |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.procurementrecord.mapper.ReturnManagementMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto"> |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto"> |
| | | select rm.*, |
| | | c.customer_name, |
| | | si.shipping_no, |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto"> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto"> |
| | | select rm.*, |
| | | c.customer_name, |
| | | si.shipping_no, |
| | |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.id = #{id} |
| | | </select> |
| | | <select id="listPageBySalesReturn" resultType="com.ruoyi.account.bean.vo.SalesReturnVo"> |
| | | <select id="listPageAccountSalesReturn" resultType="com.ruoyi.account.bean.vo.SalesReturnVo"> |
| | | select rm.id, |
| | | rm.return_no, |
| | | c.customer_name, |
| | |
| | | and c.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} |
| | | AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by rm.id DESC |
| | | </select> |
| | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.procurementrecord.pojo.ReturnSaleProduct"> |
| | | <id column="id" property="id" /> |
| | | <result column="return_management_id" property="returnManagementId" /> |
| | | <result column="return_sales_ledger_product_id" property="returnsalesLedgerProductId" /> |
| | | <result column="stock_out_record_id" property="stockOutRecordId" /> |
| | | <result column="num" property="num" /> |
| | | <result column="status" property="status" /> |
| | | </resultMap> |
| | | <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto"> |
| | | SELECT slp.product_category as product_name, |
| | | slp.specification_model as model, |
| | | slp.unit as unit, |
| | | <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto"> |
| | | SELECT distinct |
| | | p.product_name as product_name, |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | rsp.*, |
| | | GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | sor.outbound_batches, |
| | | sor.stock_out_num, |
| | | sor.batch_no, |
| | | GREATEST(sor.stock_out_num - COALESCE(rsp.num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM return_sale_product rsp |
| | | LEFT JOIN return_management rm ON rm.id = rsp.return_management_id |
| | | LEFT JOIN shipping_info si ON si.id = rm.shipping_id |
| | | LEFT JOIN shipping_product_detail spd ON spd.shipping_info_id = si.id |
| | | LEFT JOIN stock_out_record sor ON rsp.stock_out_record_id = sor.id and sor.record_type = '13' |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN (SELECT return_sales_ledger_product_id, |
| | | |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | LEFT JOIN product p on pm.product_id = p.id |
| | | LEFT JOIN (SELECT stock_out_record_id, |
| | | SUM(num) AS total_return_num |
| | | FROM return_sale_product |
| | | WHERE 1 = 1 and return_management_id != #{returnManagementId} |
| | | GROUP BY return_sales_ledger_product_id) rs ON rs.return_sales_ledger_product_id = slp.id |
| | | WHERE 1 = 1 and return_management_id = #{returnManagementId} |
| | | GROUP BY stock_out_record_id) rs ON rs.stock_out_record_id = sor.id |
| | | where rm.id =#{returnManagementId} |
| | | </select> |
| | | <select id="listReturnSaleProduct" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto"> |
| | | select rsp.*,slp.tax_inclusive_unit_price ,slp.tax_inclusive_total_price*rsp.num as price |
| | | <select id="listReturnSaleProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto"> |
| | | select rsp.*, |
| | | sor.batch_no, |
| | | slp.tax_inclusive_unit_price , |
| | | slp.tax_inclusive_total_price*rsp.num as price |
| | | from return_sale_product rsp |
| | | left join sales_ledger_product slp on slp.id = rsp.return_sales_ledger_product_id |
| | | LEFT JOIN return_management rm ON rm.id = rsp.return_management_id |
| | | LEFT JOIN shipping_info si ON si.id = rm.shipping_id |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN stock_out_record sor ON rsp.stock_out_record_id = sor.id |
| | | where rsp.return_management_id = #{returnManagementId} |
| | | </select> |
| | | |
| | |
| | | </resultMap> |
| | | <select id="getReturnOrderGroupListByProductIds" resultType="com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto" |
| | | parameterType="java.util.List"> |
| | | select t1.sales_ledger_product_id,sum(t1.return_quantity) as sum_return_quantity from purchase_return_order_products as t1 |
| | | select t1.sales_ledger_product_id, |
| | | sum(t1.return_quantity) as sum_return_quantity |
| | | from purchase_return_order_products as t1 |
| | | inner join purchase_return_orders as t2 on t1.purchase_return_order_id = t2.id |
| | | WHERE t1.sales_ledger_product_id IN |
| | | <foreach item="id" collection="productIds" separator="," open="(" close=")"> |
| | |
| | | <include refid="getPurchaseReturnOrderHasAllInfoFormAndColumn"/> |
| | | where pro.id = #{id} |
| | | </select> |
| | | <select id="listPageAccountPurchaseReturn" |
| | | resultType="com.ruoyi.account.bean.vo.PurchaseReturnVo"> |
| | | select pro.id, |
| | | pro.no returnNo, |
| | | t.inboundBatches, |
| | | sm.supplier_name, |
| | | pro.prepared_at, |
| | | pro.total_amount, |
| | | CASE pro.return_type WHEN 0 THEN 'éè´§éæ¬¾' WHEN 1 THEN 'ææ¶' END AS returnType, |
| | | pl.purchase_contract_number |
| | | from purchase_return_orders pro |
| | | left join |
| | | (select prop.purchase_return_order_id, |
| | | GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches |
| | | from purchase_return_order_products prop |
| | | left join stock_in_record sir on prop.stock_in_record_id = sir.id |
| | | GROUP BY prop.purchase_return_order_id) t on t.purchase_return_order_id = pro.id |
| | | left join supplier_manage sm on pro.supplier_id = sm.id |
| | | left join purchase_ledger pl on pro.purchase_ledger_id = pl.id |
| | | where 1=1 |
| | | <if test="req.returnNo != null and req.returnNo != ''"> |
| | | and pro.no like concat('%',#{req.returnNo},'%') |
| | | </if> |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | and sm.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE_FORMAT(pro.prepared_at, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by pro.id DESC |
| | | </select> |
| | | <select id="getByPurchaseLedgerId" resultType="com.ruoyi.purchase.vo.PurchaseStockInProductVo"> |
| | | SELECT |
| | | sir.id, |
| | | sir.product_model_id, |
| | | slp.id salesLedgerProductId, |
| | | slp.product_category, |
| | | slp.specification_model, |
| | | slp.unit, |
| | | slp.is_checked, |
| | | sir.inbound_batches, |
| | | sir.stock_in_num, |
| | | sir.batch_no, |
| | | slp.tax_inclusive_unit_price, |
| | | GREATEST(sir.stock_in_num - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM stock_in_record sir |
| | | LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id |
| | | LEFT JOIN purchase_ledger pl |
| | | ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) |
| | | LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id |
| | | LEFT JOIN ( |
| | | SELECT |
| | | stock_in_record_id, |
| | | SUM(return_quantity) AS total_return_num |
| | | FROM purchase_return_order_products prop |
| | | left join purchase_return_orders pro on pro.id = prop.purchase_return_order_id |
| | | WHERE 1=1 |
| | | GROUP BY stock_in_record_id |
| | | ) rs ON rs.stock_in_record_id = sir.id |
| | | WHERE sir.approval_status = 1 AND slp.type = 2 |
| | | AND sir.record_type IN ('7','10') |
| | | and pl.id = #{purchaseLedgerId} |
| | | </select> |
| | | <select id="getPurchaseReturnOrderProductsDetailById" |
| | | resultType="com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo"> |
| | | select prop.id, |
| | | prop.sales_ledger_product_id, |
| | | slp.product_model_id, |
| | | slp.product_category, |
| | | slp.specification_model, |
| | | slp.is_checked, |
| | | slp.unit, |
| | | sir.inbound_batches, |
| | | sir.stock_in_num, |
| | | sir.batch_no, |
| | | slp.tax_inclusive_unit_price, |
| | | prop.return_quantity, |
| | | prop.purchase_return_order_id, |
| | | GREATEST(sir.stock_in_num - COALESCE(prop.return_quantity, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | from purchase_return_order_products prop |
| | | left join purchase_return_orders pro on prop.purchase_return_order_id = pro.id |
| | | LEFT JOIN stock_in_record sir ON prop.stock_in_record_id = sir.id and sir.record_type in ('7','10') |
| | | LEFT JOIN sales_ledger_product slp ON prop.sales_ledger_product_id = slp.id and slp.type = 2 |
| | | LEFT JOIN (SELECT stock_in_record_id, |
| | | SUM(return_quantity) AS total_return_num |
| | | FROM purchase_return_order_products |
| | | WHERE 1 = 1 and purchase_return_order_id = #{id} |
| | | GROUP BY stock_in_record_id) rs ON rs.stock_in_record_id = sir.id |
| | | where pro.id = #{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectSalesLedgerProductList" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | | SELECT |
| | | T1.*, |
| | | T1.id, |
| | | T1.sales_ledger_id, |
| | | T1.warn_num, |
| | | T1.speculative_trading_name, |
| | | T1.quantity, |
| | | T1.min_stock, |
| | | T1.tax_rate, |
| | | T1.tax_inclusive_unit_price, |
| | | T1.tax_inclusive_total_price, |
| | | T1.tax_exclusive_total_price, |
| | | T1.invoice_type, |
| | | T1.type, |
| | | T1.tickets_num, |
| | | T1.tickets_amount, |
| | | T1.future_tickets, |
| | | T1.future_tickets_amount, |
| | | T1.invoice_num, |
| | | T1.no_invoice_num, |
| | | T1.invoice_amount, |
| | | T1.no_invoice_amount, |
| | | T1.product_id, |
| | | T1.product_model_id, |
| | | T1.register, |
| | | T1.register_date, |
| | | T1.approve_status, |
| | | T1.pending_invoice_total, |
| | | T1.invoice_total, |
| | | T1.pending_tickets_total, |
| | | T1.tickets_total, |
| | | T1.is_checked, |
| | | T1.is_production, |
| | | T1.create_user, |
| | | T1.dept_id, |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.unit as unit, |
| | | CASE |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1 |
| | | ELSE 0 |
| | |
| | | LEFT JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id |
| | | GROUP BY sales_ledger_product_id |
| | | ) t3 ON t3.sales_ledger_product_id = T1.id |
| | | left join product_model pm ON T1.product_model_id = pm.id |
| | | left join product p ON pm.product_id = p.id |
| | | <where> |
| | | <if test="salesLedgerProduct.salesLedgerId != null"> |
| | | AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId} |
| | |
| | | s.update_user, |
| | | s.tenant_id, |
| | | sl.sales_contract_no, |
| | | slp.specification_model, |
| | | pm.model as specification_model, |
| | | pm.unit, |
| | | p.product_name, |
| | | sl.customer_name |
| | | sl.customer_name, |
| | | spd.totalQuantity, |
| | | sor.outboundBatches |
| | | FROM shipping_info s |
| | | LEFT JOIN (select shipping_info_id,sum(quantity) totalQuantity from shipping_product_detail GROUP BY shipping_info_id) spd ON spd.shipping_info_id = s.id |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join (select record_id,GROUP_CONCAT(outbound_batches SEPARATOR ',') AS outboundBatches |
| | | from stock_out_record |
| | | where record_type='13'and approval_status=1 |
| | | group by record_id)sor on sor.record_id= s.id |
| | | WHERE 1=1 |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | </select> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | SELECT |
| | | slp.*, |
| | | si.shipping_no, |
| | | GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.bean.vo.ShippingProductVo"> |
| | | SELECT distinct |
| | | sor.id, |
| | | slp.product_category, |
| | | slp.specification_model, |
| | | slp.unit, |
| | | slp.product_model_id, |
| | | sor.outbound_batches, |
| | | sor.stock_out_num, |
| | | sor.batch_no, |
| | | slp.tax_inclusive_unit_price, |
| | | GREATEST(sor.stock_out_num - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM shipping_info si |
| | | LEFT JOIN shipping_product_detail spd ON spd.shipping_info_id = si.id |
| | | LEFT JOIN stock_out_record sor ON sor.record_id = si.id and sor.record_type = '13' |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | return_sales_ledger_product_id, |
| | | stock_out_record_id, |
| | | SUM(num) AS total_return_num |
| | | FROM return_sale_product rsp |
| | | left join return_management rm on rm.id = rsp.return_management_id |
| | | left join shipping_info si on si.id = rm.shipping_id |
| | | WHERE 1=1 |
| | | GROUP BY return_sales_ledger_product_id |
| | | ) rs ON rs.return_sales_ledger_product_id = slp.id |
| | | GROUP BY stock_out_record_id |
| | | ) rs ON rs.stock_out_record_id = sor.id |
| | | <where> |
| | | <if test="shippingId != null"> |
| | | si.id = #{shippingId} |
| | | </if> |
| | | </where> |
| | | order by sor.id |
| | | </select> |
| | | <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | select * from shipping_info si |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where si.status = 'å·²åè´§' and sl.customer_name = #{customerName} |
| | | </select> |
| | | <select id="listPageByOutbound" resultType="com.ruoyi.account.bean.vo.SalesOutboundVo"> |
| | | SELECT |
| | | sor.id, |
| | | sor.outbound_batches, |
| | | sl.customer_name, |
| | | s.shipping_date, |
| | | p.product_name, |
| | | slp.specification_model, |
| | | slp.stock_out_num, |
| | | s.shipping_no, |
| | | sl.sales_contract_no |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join stock_out_record sor on sor.record_id = s.id and sor.record_type='13' |
| | | WHERE s.status='å·²åè´§' |
| | | <if test="req.outboundBatches != null and req.outboundBatches != ''"> |
| | | AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND s.shipping_date BETWEEN #{startDate} AND #{endDate} |
| | | </if> |
| | | order by sor.id DESC |
| | | where sl.customer_name = #{customerName} |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | order by sir.id desc |
| | | </select> |
| | | <select id="listPageAccountPurchase" resultType="com.ruoyi.account.bean.vo.PurchaseInboundVo"> |
| | | SELECT |
| | | sir.id, |
| | | sir.inbound_batches, |
| | | pl.supplier_name, |
| | | DATE(sir.create_time) AS inboundDate, |
| | | p.product_name, |
| | | pm.model as specification_model, |
| | | sir.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount, |
| | | pl.purchase_contract_number |
| | | FROM stock_in_record sir |
| | | -- 10 ç±»åæå
³èè´¨æ£è¡¨ |
| | | LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id |
| | | -- 卿å
³èéè´ï¼èªå¨éé
7 å 10ï¼ |
| | | LEFT JOIN purchase_ledger pl |
| | | ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) |
| | | -- 产åå
³èä¸å¨ |
| | | LEFT JOIN sales_ledger_product slp ON pl.id = slp.product_id |
| | | LEFT JOIN product_model pm ON sir.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | -- æ¡ä»¶ |
| | | WHERE sir.approval_status = 1 AND slp.type = 2 |
| | | AND sir.record_type IN ('7','10') |
| | | <if test="req.inboundBatches != null and req.inboundBatches != ''"> |
| | | AND sir.inbound_batches LIKE CONCAT('%',#{req.inboundBatches},'%') |
| | | </if> |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | AND pl.supplier_name LIKE CONCAT('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE(sir.create_time) BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by sir.id DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | WHERE sor.product_model_id = #{productModelId} |
| | | AND (sor.batch_no = #{batchNo} OR (#{batchNo} IS NULL AND sor.batch_no IS NULL)) |
| | | AND sor.type = #{type} |
| | | AND sor.approval_status = 0 |
| | | AND sor.approval_status IN (0, 3) |
| | | </select> |
| | | |
| | | <select id="listSelectableBatchNoByProductModelIds" resultType="com.ruoyi.stock.pojo.StockInventory"> |
| | |
| | | order by si.product_model_id, si.batch_no |
| | | </select> |
| | | <select id="getByModelId" resultType="com.ruoyi.stock.pojo.StockInventory"> |
| | | select spd.id, spd.batch_no, spd.locked_quantity, (spd.qualitity - IFNULL(sd.qualitity, 0)) as qualitity |
| | | from stock_inventory spd |
| | | left join (select stock_inventory_id, sum(quantity) as qualitity |
| | | from shipping_product_detail |
| | | group by stock_inventory_id) as sd on sd.stock_inventory_id = spd.id |
| | | where product_model_id = #{productModelId} |
| | | select si.id, si.batch_no, si.locked_quantity, (si.qualitity - IFNULL(sd.qualitity, 0)) as qualitity |
| | | from stock_inventory si |
| | | left join ( |
| | | select spd.stock_inventory_id, sum(spd.quantity) as qualitity |
| | | from shipping_product_detail spd |
| | | where exists ( |
| | | select 1 |
| | | from stock_out_record sor |
| | | where sor.record_id = spd.shipping_info_id |
| | | and sor.record_type = '13' |
| | | and sor.type = '0' |
| | | and sor.approval_status in (0, 3) |
| | | and sor.product_model_id = spd.product_model_id |
| | | and (sor.batch_no = spd.batch_no or (sor.batch_no is null and spd.batch_no is null)) |
| | | ) |
| | | group by spd.stock_inventory_id |
| | | ) as sd on sd.stock_inventory_id = si.id |
| | | where si.product_model_id = #{productModelId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | order by sor.id desc |
| | | </select> |
| | | |
| | | <select id="listPageAccountSales" resultType="com.ruoyi.account.bean.vo.SalesOutboundVo"> |
| | | SELECT |
| | | sor.id, |
| | | sor.outbound_batches, |
| | | sl.customer_name, |
| | | sor.create_time as shippingDate, |
| | | p.product_name, |
| | | pm.model as specification_model, |
| | | sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount, |
| | | s.shipping_no, |
| | | sl.sales_contract_no |
| | | FROM stock_out_record sor |
| | | left join shipping_info s on sor.record_id = s.id |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | WHERE sor.record_type='13' and sor.approval_status=1 |
| | | <if test="req.outboundBatches != null and req.outboundBatches != ''"> |
| | | AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%') |
| | | </if> |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND s.shipping_date BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by sor.id DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | p.product_name as productName, |
| | | pm.product_id as productId, |
| | | pm.model, |
| | | top1.name as operationName |
| | | top1.name as operationName, |
| | | pm.product_code as productCode |
| | | from technology_bom_structure tbs |
| | | left join product_model pm on tbs.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |