feat(report): 新增会计报表功能并完善设备维护和首页统计
- 新增增值税比对报表功能,支持进项销项税额统计
- 添加增值税图表数据接口,实现进销项对比可视化
- 完善设备维护模块,增加批量保养完成功能
- 优化首页统计功能,支持自定义时间范围查询
- 更新数据库配置,调整开发环境数据源连接
- 重构采购报表模块,增强数据统计准确性
- 添加增值税明细查询功能,支持按发票和订单分类显示
- 完善供应商往来账务管理功能
- 优化产品销售分析和原材料采购占比统计
- 新增产品周转天数统计功能,支持指定时间段查询
- 添加采购品大类分布分析功能
- 优化设备保养完成流程,支持手动和自动标记完成状态
- 扩展首页统计接口,支持按时间区间过滤数据
- 优化数据导出功能,提升Excel导出性能
- 添加安全权限控制,集成登录用户信息验证
- 重构报表查询逻辑,统一分页和排序处理方式
- 完善异常处理机制,增强系统稳定性
- 优化SQL查询语句,提升数据检索效率
- 添加数据校验功能,确保业务数据准确性
- 重构设备维护服务层,优化批量操作性能
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # æå®å³°ç³»ç»åè½ä¼å - å端èè°ææ¡£ |
| | | |
| | | --- |
| | | |
| | | ## ä¸ãå¤ä»¶ç®¡ç - å¤ä»¶ç¬ç«åºåº |
| | | |
| | | ### 1.1 æ°å¢æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | `/sparePartsRequisitionRecord/outbound` | å¤ä»¶ç¬ç«åºåºï¼ä¸ä¾èµç»´ä¿®/ä¿å
»ï¼ | |
| | | |
| | | ### 1.2 请æ±åæ° |
| | | |
| | | ```json |
| | | { |
| | | "sparePartsId": 10, // å¤ä»¶ID (Long, å¿
å¡«) |
| | | "quantity": 5, // åºåºæ°é (Integer, å¿
å¡«) |
| | | "deviceLedgerId": 1, // 设å¤å°è´¦ID (Long, å¯é) |
| | | "remark": "æå¨åºåºå¤æ³¨" // 夿³¨ (String, å¯é) |
| | | } |
| | | ``` |
| | | |
| | | ### 1.3 è¿åå¼ |
| | | |
| | | æåè¿å `AjaxResult.success()`ï¼å¤±è´¥æåº `IllegalArgumentException`ï¼"å¤ä»¶ä¸åå¨" / "å¤ä»¶ xxx åºåä¸è¶³"ï¼ï¼åç«¯ç¨ `msg` å±ç¤ºã |
| | | |
| | | ### 1.4 æä¸¾åæ´ |
| | | |
| | | `sourceType` æ°å¢ `2` = "ç´æ¥åºåº"ï¼`SparePartsRequisitionRecordSourceTypeEnum`ï¼ãå表æ¥å£ `/listPage` è¿åç `sourceText` ä¼èªå¨æ å°ã |
| | | |
| | | ### 1.5 å端æ¹é æå¼ |
| | | |
| | | **æä»¶**: `src/views/equipmentManagement/spareParts/index.vue` |
| | | |
| | | - Tabãå¤ä»¶é¢ç¨è®°å½ãåºåæ°å¢ **ãç´æ¥åºåºã** æé® |
| | | - ç¹å»å¼¹åºè¡¨åå¼¹çªï¼åæ®µï¼ |
| | | - å¤ä»¶éæ©ï¼`el-select`ï¼å¿
å¡«ï¼ |
| | | - åºåºæ°éï¼`el-input-number`ï¼min=1ï¼å¿
å¡«ï¼ |
| | | - 设å¤éæ©ï¼å¯éï¼å¯ä¸å
³è设å¤ï¼ |
| | | - 夿³¨ï¼å¯éï¼ |
| | | - æäº¤åæ ¡éªæ°é > 0 ä¸ä¸è¶
è¿åºå |
| | | - æååå·æ°å表 |
| | | |
| | | **API å°è£
** (`src/api/equipmentManagement/sparePartsUsage.js`): |
| | | |
| | | ```js |
| | | export function outboundSpareParts(data) { |
| | | return request({ |
| | | url: '/sparePartsRequisitionRecord/outbound', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## äºã设å¤ä¿å
» - ä¿å
»å®æ / æ¹é宿 |
| | | |
| | | ### 2.1 æ°å¢æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | PUT | `/device/maintenance/complete/{id}` | åæ¡ä¿å
»å®æ | |
| | | | PUT | `/device/maintenance/batchComplete` | ä¸é®ä¿å
»å®æï¼æåå»ºæ¥ææ¹éï¼ | |
| | | |
| | | ### 2.2 忡宿 `PUT /complete/{id}` |
| | | |
| | | - Path åæ°: `id` â ä¿å
»è®°å½ID |
| | | - æ RequestBody |
| | | - å端èªå¨è®¾ç½® `status=1`ã`maintenanceActuallyName`=å½åç»å½ç¨æ·ã`maintenanceActuallyTime`=å½åæ¶é´ |
| | | - è¿å: æå `AjaxResult.success()`ï¼å¤±è´¥ `AjaxResult.error("ä¿å
»è®°å½ä¸åå¨" / "该ä¿å
»è®°å½å·²å®æ")` |
| | | |
| | | ### 2.3 æ¹é宿 `PUT /batchComplete` |
| | | |
| | | - Query åæ°: `dateStr` â æ¥æåç¬¦ä¸²ï¼æ ¼å¼ `yyyy-MM-dd` |
| | | - å端æ `createTime` æ¥æèå´æ¥è¯¢è¯¥æ¥ææ `status=0` è®°å½ï¼æ¹é设置为å®ç» |
| | | - è¿å: æå `AjaxResult.success("已宿 N æ¡ä¿å
»è®°å½")`ï¼å¤±è´¥ `AjaxResult.error("æ¥æåæ°ä¸è½ä¸ºç©º" / "è¯¥æ¥æä¸æ²¡æå¾
宿çä¿å
»è®°å½")` |
| | | |
| | | ### 2.4 å®ä½åæ´ |
| | | |
| | | `DeviceMaintenanceDto` æ°å¢ `dateStr` åæ®µï¼æ ¼å¼ `yyyy-MM-dd`ï¼ï¼å表æ¥è¯¢æ¶å·²èªå¨å¡«å
ï¼å端å¯ç¨äºæ¥æåç»ã |
| | | |
| | | ### 2.5 å端æ¹é æå¼ |
| | | |
| | | **æä»¶**: `src/views/equipmentManagement/upkeep/index.vue` |
| | | |
| | | 1. **æ `dateStr` æ¥æåç»æå å±ç¤º**ï¼åç
§éå®å°è´¦ `type="expand"` 模å¼ï¼ |
| | | - ä¸»è¡æ¾ç¤ºï¼æ¥æãè®°å½æ°ã**ãä¸é®ä¿å
»å®æã** æé® |
| | | - å±å¼åå表æ¾ç¤ºæ¯æ¡æç»å **ãä¿å
»å®æã** æé® |
| | | |
| | | 2. **åæ¡ä¿å
»å®ææé®** |
| | | - æ¯æ¡æç»æä½åæ°å¢ãä¿å
»å®æã |
| | | - ä»
`status === 0`ï¼å¾
ä¿å
»ï¼æ¶æ¾ç¤º |
| | | - ç¹å»ç¡®è®¤åè°ç¨ `PUT /device/maintenance/complete/{id}` |
| | | |
| | | 3. **ä¸é®ä¿å
»å®ææé®** |
| | | - åç»è¡ä¸æ¾ç¤ºï¼ä¼ å
¥è¯¥åç»ç `dateStr` |
| | | - ç¹å»ç¡®è®¤åè°ç¨ `PUT /device/maintenance/batchComplete?dateStr=2026-08-07` |
| | | |
| | | **API å°è£
** (`src/api/equipmentManagement/upkeep.js`): |
| | | |
| | | ```js |
| | | export function completeMaintenance(id) { |
| | | return request({ |
| | | url: '/device/maintenance/complete/' + id, |
| | | method: 'put' |
| | | }) |
| | | } |
| | | |
| | | export function batchCompleteMaintenance(dateStr) { |
| | | return request({ |
| | | url: '/device/maintenance/batchComplete', |
| | | method: 'put', |
| | | params: { dateStr } |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## ä¸ã设å¤å·¡æ£ - å·¡æ£å®æ / æ¹é宿 |
| | | |
| | | ### 3.1 æ°å¢æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | PUT | `/inspectionTask/complete/{id}` | 忡巡æ£å®æ | |
| | | | PUT | `/inspectionTask/batchComplete` | ä¸é®å·¡æ£å®æï¼æåå»ºæ¥ææ¹éï¼ | |
| | | |
| | | ### 3.2 忡宿 `PUT /complete/{id}` |
| | | |
| | | - Path åæ°: `id` â å·¡æ£ä»»å¡ID |
| | | - æ RequestBody |
| | | - å端设置 `status=1`ï¼è¥ `inspectionResult` 为空åé»è®¤è®¾ä¸º `"1"`ï¼æ£å¸¸ï¼ |
| | | - è¿å: `R.ok(åå½±åè¡æ°)`ï¼å·²å®æçè®°å½ä¼æ¥é |
| | | |
| | | ### 3.3 æ¹é宿 `PUT /batchComplete` |
| | | |
| | | - Query åæ°: `dateStr` â æ¥æåç¬¦ä¸²ï¼æ ¼å¼ `yyyy-MM-dd` |
| | | - å端æ `createTime` æ¥æèå´æ¥è¯¢è¯¥æ¥ææ `status=0` è®°å½ï¼éæ¡è®¾ç½®ä¸º `status=1` |
| | | - è¿å: `R.ok(宿çè®°å½æ°)`ï¼æ è®°å½æ¶æ¥é |
| | | |
| | | ### 3.4 å®ä½åæ´ |
| | | |
| | | `InspectionTask` æ°å¢åæ®µï¼ |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | status | Integer | ç¶æï¼0=å¾
å·¡æ£ï¼1=已宿 | |
| | | |
| | | > `GET /inspectionTask/list` è¿åä¸å·²å
å« `status` åæ®µå `dateStr` åç»å段ã |
| | | |
| | | ### 3.5 æ°æ®åºåæ´ï¼é DBA æ§è¡ï¼ |
| | | |
| | | ```sql |
| | | ALTER TABLE `inspection_task` |
| | | ADD COLUMN `status` tinyint NULL DEFAULT 0 |
| | | COMMENT 'ç¶æ 0=å¾
å·¡æ£, 1=已宿'; |
| | | ``` |
| | | |
| | | ### 3.6 å端æ¹é æå¼ |
| | | |
| | | **æä»¶**: `src/views/equipmentManagement/inspectionManagement/index.vue` |
| | | |
| | | 1. **æ `dateStr` æ¥æåç»æå å±ç¤º** |
| | | 2. **忡巡æ£å®ææé®** â ä»
`status === 0` æ¶æ¾ç¤ºï¼è°ç¨ `PUT /inspectionTask/complete/{id}` |
| | | 3. **ä¸é®å·¡æ£å®ææé®** â åç»è¡ä¸æ¾ç¤ºï¼è°ç¨ `PUT /inspectionTask/batchComplete?dateStr=xxx` |
| | | 4. **ç¶æå** â ä½¿ç¨ `status` åæ®µï¼0=å¾
å·¡æ£(warning)ã1=已宿(success) |
| | | |
| | | **API å°è£
** (`src/api/inspectionManagement/index.js`): |
| | | |
| | | ```js |
| | | export function completeInspection(id) { |
| | | return request({ |
| | | url: '/inspectionTask/complete/' + id, |
| | | method: 'put' |
| | | }) |
| | | } |
| | | |
| | | export function batchCompleteInspection(dateStr) { |
| | | return request({ |
| | | url: '/inspectionTask/batchComplete', |
| | | method: 'put', |
| | | params: { dateStr } |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## åãå¢å¼ç¨å¯¹æ¯é¡µé¢ |
| | | |
| | | ### 4.1 æ°å¢æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | `/purchase/report/listVatDetail` | å¢å¼ç¨æç»ï¼æå票/订åå±ç¤ºï¼ | |
| | | |
| | | ### 4.2 `GET /listVatDetail` 请æ±åæ° |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | current | int | å¦ | 页ç | |
| | | | size | int | å¦ | æ¯é¡µæ¡æ° | |
| | | | month | String | å¦ | æä»½çéï¼æ ¼å¼ `yyyy-MM` | |
| | | |
| | | ### 4.3 `GET /listVatDetail` è¿åç»æ |
| | | |
| | | ```json |
| | | { |
| | | "records": [ |
| | | { |
| | | "invoiceNo": "CG202608001", // å票å·ï¼éè´ååå·/éå®ååå·ï¼ |
| | | "salesContractNo": "XS202608001", // éå®ååå· |
| | | "supplierName": "XXä¾åºå", // ä¾åºååç§°ï¼è¿é¡¹æ¶æå¼ï¼ |
| | | "customerName": "XX客æ·", // 客æ·åç§°ï¼éé¡¹æ¶æå¼ï¼ |
| | | "orderType": "è¿é¡¹", // è¿é¡¹ / é项 |
| | | "invoiceDate": "2026-08-03", // å¼ç¥¨æ¥æ |
| | | "taxRate": 13.00, // ç¨ç |
| | | "jTaxAmount": 13000.00, // è¿é¡¹ç¨é¢ |
| | | "xTaxAmount": 0.00, // é项ç¨é¢ |
| | | "taxAmount": 13000.00 // ç¨é¢ |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ### 4.4 å·²ææ¥å£ï¼ä¿æä¸åï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | `/purchase/report/listVat` | å¢å¼ç¨åç¥¨æ±æ» | |
| | | | GET | `/purchase/report/vatChart` | å¢å¼ç¨è¿é项å¾è¡¨æ°æ®ï¼ææèåï¼ | |
| | | |
| | | ### 4.5 å端æ¹é æå¼ |
| | | |
| | | **æä»¶**: `src/views/reportAnalysis/taxComparison/index.vue` |
| | | |
| | | 1. æ°å¢ **Tab 忢**:ãæ±æ»è§å¾ã/ãæç»è§å¾ã |
| | | - æ±æ»è§å¾ â è°ç¨åæ `listVat` æ¥å£ |
| | | - æç»è§å¾ â è°ç¨æ°å¢ `listVatDetail` æ¥å£ |
| | | 2. æç»è§å¾è¡¨æ ¼å: å票å·ãéå®ååå·ã客æ·/ä¾åºåãç±»å(tag)ãå¼ç¥¨æ¥æãç¨çãç¨é¢ |
| | | 3. ä¿çæä»½çéåå¾è¡¨åºå |
| | | |
| | | **API å°è£
** (`src/api/procurementManagement/taxComparison.js`): |
| | | |
| | | ```js |
| | | export function getVatDetail(query) { |
| | | return request({ |
| | | url: '/purchase/report/listVatDetail', |
| | | method: 'get', |
| | | params: query // { current, size, month } |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## äºã管ç驾驶è±ï¼é¦é¡µ PSI æ°æ®åæå¤§å±ï¼ |
| | | |
| | | ### 5.1 åç«¯åæ´ |
| | | |
| | | 以䏿¥å£æ°å¢å¯éæ¥æèå´åæ° `startDate` / `endDate`ï¼æ ¼å¼ `yyyy-MM-dd`ï¼ï¼ä¸ä¼ åæåæ type é»è¾è®¡ç®ï¼å¨/æ/å£åº¦ï¼ï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | åæ´è¯´æ | |
| | | |------|------|----------| |
| | | | GET | `/home/supplierPurchaseRanking` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | | GET | `/home/customerContributionRanking` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | | GET | `/home/productSalesAnalysis` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | | GET | `/home/rawMaterialPurchaseAmountRatio` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | | GET | `/home/salesPurchaseStorageProductCount` | æ°å¢ `startDate`/`endDate` å¯éåæ°ï¼label æ¹ä¸º"éå®è®¢åæ°" | |
| | | | GET | `/home/productInOutAnalysis` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | | GET | `/home/productTurnoverDays` | æ°å¢ `startDate`/`endDate` å¯éåæ° | |
| | | |
| | | ### 5.2 å
³é®åæ´è¯¦æ
|
| | | |
| | | **`/home/salesPurchaseStorageProductCount`**: |
| | | |
| | | - 第ä¸ä¸ªææ ä»ãéå®äº§åæ°ãæ¹ä¸º **ãéå®è®¢åæ°ã**ï¼ç»è®¡ `sales_ledger` è¡¨è®¢åæ°ï¼éäº§åæ°ï¼ |
| | | - Query åæ°ï¼å为å¯éï¼: |
| | | - `startDate`: å¼å§æ¥æ `yyyy-MM-dd` |
| | | - `endDate`: ç»ææ¥æ `yyyy-MM-dd` |
| | | - `type`: ä¸ä¼ æ¥æåæ°æ¶ä½¿ç¨ï¼1=å¨, 2=æ, 3=å£åº¦ï¼ |
| | | - è¿åç»æä¸å (`List<MapDto>`): `[{ name, value, rate }]` |
| | | |
| | | **`/home/productCategoryDistribution`**: |
| | | |
| | | - éè´å大类åå¸ç¯å½¢å¾æ°æ®å·²ä¿®å¤ï¼å°ç±»ç `value`/`rate` ç°å¨å
å«çå®éè´æ°æ® |
| | | - æ éå端æ¹å¨ |
| | | |
| | | ### 5.3 å端æ¹é æå¼ |
| | | |
| | | **æä»¶**: `src/views/reportAnalysis/PSIDataAnalysis/index.vue` |
| | | |
| | | 1. **æ¥æçéæ§ä»¶** |
| | | - 页é¢é¡¶é¨æ°å¢ `el-date-picker`ï¼ç±»å `daterange`ï¼æ ¼å¼ `yyyy-MM-dd`ï¼ |
| | | - å¿«æ·é项: æ¬æãè¿7天ãè¿30天ãè¿90天 |
| | | - éè¿ props / provide å°é䏿¥æä¼ ç»ååç»ä»¶ |
| | | |
| | | 2. **æ ç¾æåä¿®æ¹** (`components/center-top.vue`) |
| | | - 第ä¸å¼ å¡çæ é¢: ãéå®äº§åæ°ãâ **ãéå®è®¢åæ°ã** |
| | | |
| | | 3. **API è°ç¨æ´æ°** |
| | | - ååç»ä»¶è°ç¨æ¥å£æ¶ä¼ å
¥ `startDate` / `endDate` åæ° |
| | | |
| | | **API å°è£
示ä¾** (`src/api/viewIndex.js`): |
| | | |
| | | ```js |
| | | export function getSalesPurchaseStorageProductCount(params) { |
| | | return request({ |
| | | url: '/home/salesPurchaseStorageProductCount', |
| | | method: 'get', |
| | | params // { startDate, endDate } æ { type } äºéä¸ |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | > ææ `/home` æ¥å£åéµå¾ªç¸å模å¼ï¼ä¼ `startDate`/`endDate` æ¶ä¸ä¼ `type`ï¼åä¹äº¦ç¶ã |
| | | |
| | | --- |
| | | |
| | | ## å
ãæ¹å¨æä»¶æ¸
å |
| | | |
| | | | é¡µé¢ | æä»¶è·¯å¾ | æ¹å¨ç±»å | |
| | | |------|----------|----------| |
| | | | å¤ä»¶ç®¡ç | `src/views/equipmentManagement/spareParts/index.vue` | æ°å¢ãç´æ¥åºåºãæé®+å¼¹çª | |
| | | | å¤ä»¶API | `src/api/equipmentManagement/sparePartsUsage.js` | æ°å¢ `outboundSpareParts` | |
| | | | 设å¤ä¿å
» | `src/views/equipmentManagement/upkeep/index.vue` | æ¥æåç»+ä¿å
»å®æ+ä¸é®ä¿å
»å®æ | |
| | | | ä¿å
»API | `src/api/equipmentManagement/upkeep.js` | æ°å¢ `completeMaintenance` / `batchCompleteMaintenance` | |
| | | | 设å¤å·¡æ£ | `src/views/equipmentManagement/inspectionManagement/index.vue` | æ¥æåç»+å·¡æ£å®æ+ä¸é®å·¡æ£å®æ | |
| | | | å·¡æ£API | `src/api/inspectionManagement/index.js` | æ°å¢ `completeInspection` / `batchCompleteInspection` | |
| | | | å¢å¼ç¨å¯¹æ¯ | `src/views/reportAnalysis/taxComparison/index.vue` | æ°å¢æç»è§å¾ Tab | |
| | | | å¢å¼ç¨API | `src/api/procurementManagement/taxComparison.js` | æ°å¢ `getVatDetail` | |
| | | | PSIå¤§å± | `src/views/reportAnalysis/PSIDataAnalysis/index.vue` | æ°å¢æ¥æçéæ§ä»¶ | |
| | | | PSIç»è®¡å¡ | `src/views/reportAnalysis/PSIDataAnalysis/components/center-top.vue` | æ ç¾æ¹"éå®è®¢åæ°"+æ¥æåæ° | |
| | | | 大å±API | `src/api/viewIndex.js` | æææ¥å£å¢å `startDate`/`endDate` åæ° | |
| | | |
| | | --- |
| | | |
| | | ## ä¸ã注æäºé¡¹ |
| | | |
| | | 1. **å·¡æ£ DDL**: ééç¥ DBA æ§è¡ `ALTER TABLE inspection_task ADD COLUMN status tinyint ...` |
| | | 2. **HTTP æ¹æ³**: å®æç±»æ¥å£ä½¿ç¨ **PUT**ï¼æ°å¢åºåºä½¿ç¨ **POST**ï¼æ¥è¯¢ä½¿ç¨ **GET** |
| | | 3. **æ¥ææ ¼å¼**: æææ¥æåæ°ä½¿ç¨ `yyyy-MM-dd` åç¬¦ä¸²æ ¼å¼ |
| | | 4. **ç©ºåæ°å
¼å®¹**: æ¥æåæ°å为å¯éï¼ä¸ä¼ åä¿æåæ type é»è¾ |
| | | 5. **æ¹é宿**: ä¿å
»/å·¡æ£çæ¹éå®æåæ `createTime` æ¥æèå´å¹é
ï¼é `planTime` |
| | | 6. **é误å¤ç**: å¤ä»¶åºåºå¤±è´¥ä¼æå¼å¸¸ï¼é AjaxResultï¼ï¼å端éå¨ catch ä¸å±ç¤ºéè¯¯ä¿¡æ¯ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ä¸ã设å¤ç®¡ç模å |
| | | |
| | | ## 1\. å¤ä»¶ç®¡ç - å¤ä»¶é¢ç¨è®°å½ |
| | | |
| | | ç°æå¤ä»¶åºåºä»
è½ä¾æè®¾å¤æ£ä¿®åºæ¯ï¼åºåºæ¸ éåå¨å±éï¼éæ°å¢ç¬ç«å¤ä»¶åºåºåè½å
¥å£ï¼æ¯æç´æ¥å®æå¤ä»¶é¢ç¨åºåºæä½ã |
| | | |
| | | ## å¤ä»¶é¢ç¨è®°å½é¡µé¢2. 设å¤ä¿å
» - ä¿å
»ä»»å¡ |
| | | |
| | | ä¿å
»ä»»å¡ä¸ååï¼é¡µé¢åç
§éå® / éè´è®¢åæ ·å¼ï¼æ¯æææ¥æåç»æå å±ç¤ºï¼åç»æ¡ç®å¯å±å¼æ¥çæç»ï¼åæ¡æç»è¡æ«å°¾å¢å ãä¿å
»å®æãæä½æé®ï¼å¯åç¬åç»åæ¡ä¿å
»ä»»å¡ï¼æå æ±æ»ç¶æä¸ï¼æ°å¢ãä¸é®ä¿å
»å®æãæ¹éæä½æé®ï¼å¿«éåç»å½ååç»å
¨é¨ä¿å
»é¡¹ã |
| | | |
| | | ## ä¿å
»ä»»å¡é¡µé¢3. 设å¤å·¡æ£ - å·¡æ£ä»»å¡ |
| | | |
| | | å·¡æ£ä»»å¡ä¸å宿åï¼é¡µé¢åç
§éå® / éè´è®¢åå¸å±ï¼ææ¥æåç»æå å±ç¤ºï¼åç»æ¯æå±å¼æ¥çæç»ï¼æ¯æ¡å·¡æ£æç»åå¢è®¾ãå·¡æ£å®æãæé®ï¼æ¯æåç¬åç»åæ¡å·¡æ£è®°å½ï¼åç»æå æªå±å¼ç¶æä¸ï¼æä¾ãä¸é®å·¡æ£å®æãæ¹éæä½ï¼ç»ä¸åç»è¯¥åç»ä¸ææå·¡æ£ä»»å¡ã |
| | | |
| | | # äºãå³çåææ¨¡å |
| | | |
| | | ## 1\. å¢å¼ç¨å¯¹æ¯é¡µé¢ |
| | | |
| | | å½å页颿¥è¯¢æ æ°æ®ï¼æççè¦æ±ä¼åæ°æ®å±ç¤ºé»è¾ï¼å表å±ç¤ºå订åå¢å¼ç¨æç»ï¼é¡µé¢å³ä¾§æ°å¢æ±ç¶å¯è§åå¾è¡¨ï¼ç´è§å¯¹æ¯è¿é项å¢å¼ç¨æ°æ®ã |
| | | |
| | | ## å¢å¼ç¨å¯¹æ¯é¡µé¢2. 管ç驾驶è±ï¼PSI æ°æ®åæå¤§å±ï¼ |
| | | |
| | | ææ ä¿®æ¹ï¼å°é¡¶é¨ãéå®äº§åæ°ãè°æ´ä¸ºãéå®è®¢åæ°ãï¼æ¶é´çéï¼é¡µé¢å·¦ä¸è§æ°å¢æ¥æèå´ä¸æçéæ§ä»¶ï¼ææç»è®¡ææ æ æ³¨å½åçéæ¶æ®µï¼æ°æ®ä¿®å¤ï¼è§£å³ãéè´ååå¸ãç¯å½¢å¾æ æ°æ®å±ç¤ºé®é¢ã |
| | |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface AccountStatementMapper extends BaseMapper<AccountStatement> { |
| | | |
| | | |
| | | IPage<StatementAccountVo> listPageAccountStatement(Page page, @Param("req") StatementAccountDto statementAccountDto); |
| | | |
| | | IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month); |
| | | IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month, @Param("type") String type); |
| | | |
| | | List<VatSummaryDto> selectVatSummary(@Param("year") String year); |
| | | |
| | | IPage<VatDto> listVatDetail(Page page, @Param("month") String month); |
| | | } |
| | |
| | | @Getter |
| | | public enum SparePartsRequisitionRecordSourceTypeEnum implements BaseEnum<Integer> { |
| | | SparePartsRequisitionRecordSourceTypeRepair(0, "ç»´ä¿®"), |
| | | SparePartsRequisitionRecordSourceTypeMaintenance(1, "ä¿å
»"); |
| | | SparePartsRequisitionRecordSourceTypeMaintenance(1, "ä¿å
»"), |
| | | SparePartsRequisitionRecordSourceTypeDirectOutbound(2, "ç´æ¥åºåº"); |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | |
| | | deviceMaintenanceService.export(response, ids); |
| | | } |
| | | |
| | | @PostMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®ä¿å
»å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(@RequestBody DeviceMaintenanceBatchCompleteDto dto) { |
| | | return deviceMaintenanceService.batchComplete(dto); |
| | | } |
| | | |
| | | @PutMapping("/complete/{id}") |
| | | @Operation(summary = "ä¿å
»å®æ") |
| | | public AjaxResult complete(@PathVariable Long id) { |
| | | return deviceMaintenanceService.complete(id); |
| | | } |
| | | |
| | | @PutMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®ä¿å
»å®æ") |
| | | public AjaxResult batchComplete(String dateStr) { |
| | | return deviceMaintenanceService.batchComplete(dateStr); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @Schema(name = "设å¤ä¿å
»æ¹éå®æè¯·æ±") |
| | | public class DeviceMaintenanceBatchCompleteDto { |
| | | |
| | | @Schema(description = "计åä¿å
»æ¥æ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private LocalDate maintenancePlanDate; |
| | | |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @Schema(description = "å®é
ä¿å
»æ¶é´") |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @Schema(description = "ä¿å
ȍȾ") |
| | | private String maintenanceResult; |
| | | } |
| | |
| | | @Schema(description = "ä¿å
»å¾ç") |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @Schema(description = "æ¥æåç»å段(yyyy-MM-dd)") |
| | | private String dateStr; |
| | | |
| | | } |
| | | |
| | |
| | | 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.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceMaintenanceVo detailById(Long id); |
| | | |
| | | AjaxResult batchComplete(DeviceMaintenanceBatchCompleteDto dto); |
| | | |
| | | AjaxResult complete(Long id); |
| | | |
| | | AjaxResult batchComplete(String dateStr); |
| | | } |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.execl.DeviceMaintenanceExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // è¥è®¾ç½®äºå®é
ä¿å
»æ¥æï¼åèªå¨æ 记为å®ç» |
| | | if (deviceMaintenance.getMaintenanceActuallyTime() != null && deviceMaintenance.getStatus() == null) { |
| | | deviceMaintenance.setStatus(1); |
| | | } |
| | | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult complete(Long id) { |
| | | DeviceMaintenance record = this.getById(id); |
| | | if (record == null) { |
| | | return AjaxResult.error("ä¿å
»è®°å½ä¸åå¨"); |
| | | } |
| | | if (record.getStatus() != null && record.getStatus() == 1) { |
| | | return AjaxResult.error("该ä¿å
»è®°å½å·²å®æ"); |
| | | } |
| | | record.setStatus(1); |
| | | record.setMaintenanceActuallyName(SecurityUtils.getLoginUser().getNickName()); |
| | | record.setMaintenanceActuallyTime(LocalDateTime.now()); |
| | | this.updateById(record); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(String dateStr) { |
| | | if (StringUtils.isBlank(dateStr)) { |
| | | return AjaxResult.error("æ¥æåæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | LocalDate date = LocalDate.parse(dateStr); |
| | | LocalDateTime startOfDay = date.atStartOfDay(); |
| | | LocalDateTime endOfDay = date.atTime(LocalTime.MAX); |
| | | List<DeviceMaintenance> records = this.lambdaQuery() |
| | | .eq(DeviceMaintenance::getStatus, 0) |
| | | .ge(DeviceMaintenance::getCreateTime, startOfDay) |
| | | .le(DeviceMaintenance::getCreateTime, endOfDay) |
| | | .list(); |
| | | if (records.isEmpty()) { |
| | | return AjaxResult.error("è¯¥æ¥æä¸æ²¡æå¾
宿çä¿å
»è®°å½"); |
| | | } |
| | | String nickName = SecurityUtils.getLoginUser().getNickName(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (DeviceMaintenance record : records) { |
| | | record.setStatus(1); |
| | | record.setMaintenanceActuallyName(nickName); |
| | | record.setMaintenanceActuallyTime(now); |
| | | } |
| | | this.updateBatchById(records); |
| | | return AjaxResult.success("已宿 " + records.size() + " æ¡ä¿å
»è®°å½"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(DeviceMaintenanceBatchCompleteDto dto) { |
| | | if (dto.getMaintenancePlanDate() == null) { |
| | | return AjaxResult.error("计åä¿å
»æ¥æä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<DeviceMaintenance> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(DeviceMaintenance::getStatus, 0) |
| | | .apply("DATE(maintenance_plan_time) = {0}", dto.getMaintenancePlanDate().toString()); |
| | | List<DeviceMaintenance> list = this.list(wrapper); |
| | | if (list.isEmpty()) { |
| | | return AjaxResult.success("è¯¥æ¥æä¸æ²¡æå¾
ä¿å
»çè®°å½"); |
| | | } |
| | | list.forEach(task -> { |
| | | task.setStatus(1); |
| | | if (StringUtils.isNotBlank(dto.getMaintenanceActuallyName())) { |
| | | task.setMaintenanceActuallyName(dto.getMaintenanceActuallyName()); |
| | | } |
| | | if (dto.getMaintenanceActuallyTime() != null) { |
| | | task.setMaintenanceActuallyTime(dto.getMaintenanceActuallyTime()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getMaintenanceResult())) { |
| | | task.setMaintenanceResult(dto.getMaintenanceResult()); |
| | | } |
| | | }); |
| | | this.updateBatchById(list); |
| | | return AjaxResult.success("å
±å®æ " + list.size() + " æ¡ä¿å
»è®°å½"); |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | List<DeviceMaintenance> supplierManageList = deviceMaintenanceMapper.selectList(null); |
| | | ArrayList<DeviceMaintenanceExeclDto> deviceLedgerExeclDtos = new ArrayList<>(); |
| | |
| | | /********************************************************è¥ééè´ç±»**************************************************/ |
| | | @GetMapping("/supplierPurchaseRanking") |
| | | @Operation(summary = "ä¾åºåéè´æå") |
| | | public R supplierPurchaseRanking(@DefaultType Integer type) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type); |
| | | public R supplierPurchaseRanking(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type, startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/customerContributionRanking") |
| | | @Operation(summary = "客æ·éé¢è´¡ç®æå") |
| | | public R customerContributionRanking(@DefaultType Integer type) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type); |
| | | public R customerContributionRanking(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type, startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productSalesAnalysis") |
| | | @Operation(summary = "å产åéå®éé¢åæ") |
| | | public R productSalesAnalysis() { |
| | | List<MapDto> list = homeService.productSalesAnalysis(); |
| | | public R productSalesAnalysis( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<MapDto> list = homeService.productSalesAnalysis(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/rawMaterialPurchaseAmountRatio") |
| | | @Operation(summary = "åææéè´éé¢å æ¯") |
| | | public R rawMaterialPurchaseAmountRatio(){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(); |
| | | public R rawMaterialPurchaseAmountRatio( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/salesPurchaseStorageProductCount") |
| | | @Operation(summary = "éå®-éè´-å¨åäº§åæ°") |
| | | public R salesPurchaseStorageProductCount(){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(); |
| | | public R salesPurchaseStorageProductCount( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productInOutAnalysis") |
| | | @Operation(summary = "产ååºå
¥åºåæ") |
| | | public R productInOutAnalysis(@DefaultType Integer type){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type); |
| | | public R productInOutAnalysis(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type, startDate, endDate); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productTurnoverDays") |
| | | @Operation(summary = "产åå¨è½¬å¤©æ°") |
| | | public R productTurnoverDays(){ |
| | | List<MapDto> list = homeService.productTurnoverDays(); |
| | | public R productTurnoverDays( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.productTurnoverDays(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | |
| | | import com.ruoyi.dto.MapDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return 产åå¨è½¬å¤©æ°å表 |
| | | */ |
| | | List<MapDto> productTurnoverDays(); |
| | | |
| | | List<MapDto> productTurnoverDaysByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | /** |
| | | * æ¥è¯¢éè´å大类åå¸ï¼å产åå°ç±»çéè´æ°é/éé¢ï¼ |
| | | * |
| | | * @return éè´åå¸å表 |
| | | */ |
| | | List<MapDto> selectPurchaseCategoryDistribution(); |
| | | } |
| | |
| | | |
| | | HomeSummaryDto summaryStatistics(); |
| | | |
| | | List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type); |
| | | List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type, String startDate, String endDate); |
| | | |
| | | CustomerRevenueAnalysisDto customerRevenueAnalysis(Long customerId, Integer type); |
| | | |
| | | ProductCategoryDistributionDto productCategoryDistribution(); |
| | | |
| | | List<CustomerContributionRankingDto> customerContributionRanking(Integer type); |
| | | List<CustomerContributionRankingDto> customerContributionRanking(Integer type, String startDate, String endDate); |
| | | |
| | | List<MapDto> productSalesAnalysis(); |
| | | List<MapDto> productSalesAnalysis(String startDate, String endDate); |
| | | |
| | | List<MapDto> rawMaterialPurchaseAmountRatio(); |
| | | List<MapDto> rawMaterialPurchaseAmountRatio(String startDate, String endDate); |
| | | |
| | | List<MapDto> salesPurchaseStorageProductCount(); |
| | | List<MapDto> salesPurchaseStorageProductCount(String startDate, String endDate); |
| | | |
| | | List<Map<String, Object>> productInOutAnalysis(Integer type); |
| | | List<Map<String, Object>> productInOutAnalysis(Integer type, String startDate, String endDate); |
| | | |
| | | List<MapDto> productTurnoverDays(); |
| | | List<MapDto> productTurnoverDays(String startDate, String endDate); |
| | | |
| | | List<Map<String, Object>> incomeExpenseAnalysis(Integer type); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | public List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type, String startDateStr, String endDateStr) { |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | switch (type) { |
| | | case 1: // å¨ |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: // æ |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: // å£åº¦ |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | startDate = LocalDate.parse(startDateStr); |
| | | endDate = LocalDate.parse(endDateStr); |
| | | } else { |
| | | LocalDate today = LocalDate.now(); |
| | | switch (type) { |
| | | case 1: // å¨ |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: // æ |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: // å£åº¦ |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | QueryWrapper<PurchaseLedger> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("supplier_name", "SUM(contract_amount) as total_amount") |
| | | .ge("entry_date", startDate) |
| | | .le("entry_date", endDate) |
| | | // .ne("approval_status", 3) |
| | | .groupBy("supplier_name") |
| | | .orderByDesc("total_amount") |
| | | .last("LIMIT 5"); |
| | |
| | | majorDto.setRate("0.00"); |
| | | } |
| | | |
| | | // æ¥è¯¢å产åå°ç±»çéè´æ°é |
| | | Map<String, BigDecimal> purchaseDataMap = new java.util.HashMap<>(); |
| | | List<com.ruoyi.dto.MapDto> purchaseDistribution = homeMapper.selectPurchaseCategoryDistribution(); |
| | | if (purchaseDistribution != null) { |
| | | for (com.ruoyi.dto.MapDto item : purchaseDistribution) { |
| | | if (item.getName() != null && item.getValue() != null) { |
| | | purchaseDataMap.put(item.getName(), new BigDecimal(item.getValue())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | BigDecimal majorTotalChildrenValue = BigDecimal.ZERO; |
| | | List<ProductCategoryDistributionDto.MinorCategoryDto> minorDtos = new ArrayList<>(); |
| | | for (Product minor : children) { |
| | | ProductCategoryDistributionDto.MinorCategoryDto minorDto = new ProductCategoryDistributionDto.MinorCategoryDto(); |
| | | minorDto.setName(minor.getProductName()); |
| | | minorDto.setValue("0"); |
| | | BigDecimal minorValue = purchaseDataMap.getOrDefault(minor.getProductName(), BigDecimal.ZERO); |
| | | minorDto.setValue(minorValue.toString()); |
| | | minorDto.setRate("0.00"); |
| | | minorDto.setChildren(new ArrayList<>()); |
| | | minorDtos.add(minorDto); |
| | | majorTotalChildrenValue = majorTotalChildrenValue.add(minorValue); |
| | | } |
| | | majorDto.setChildren(minorDtos); |
| | | // 使ç¨å®é
éè´æ°æ®æ´æ°å¤§ç±»ç value |
| | | if (majorTotalChildrenValue.compareTo(BigDecimal.ZERO) > 0) { |
| | | majorDto.setValue(majorTotalChildrenValue.toString()); |
| | | } |
| | | majorItems.add(majorDto); |
| | | } |
| | | |
| | | // 计ç®å¤§ç±»å æ¯ |
| | | BigDecimal totalAllValue = BigDecimal.ZERO; |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | try { |
| | | totalAllValue = totalAllValue.add(new BigDecimal(m.getValue())); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | if (totalAllValue.compareTo(BigDecimal.ZERO) > 0) { |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | try { |
| | | BigDecimal val = new BigDecimal(m.getValue()); |
| | | m.setRate(val.divide(totalAllValue, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString()); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | // 计ç®å°ç±»å æ¯ï¼å¨å大类å
ï¼ |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | if (m.getChildren() == null || m.getChildren().isEmpty()) { |
| | | continue; |
| | | } |
| | | BigDecimal parentVal = BigDecimal.ZERO; |
| | | for (ProductCategoryDistributionDto.MinorCategoryDto child : m.getChildren()) { |
| | | try { |
| | | parentVal = parentVal.add(new BigDecimal(child.getValue())); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | if (parentVal.compareTo(BigDecimal.ZERO) > 0) { |
| | | for (ProductCategoryDistributionDto.MinorCategoryDto child : m.getChildren()) { |
| | | try { |
| | | BigDecimal childVal = new BigDecimal(child.getValue()); |
| | | child.setRate(childVal.divide(parentVal, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString()); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | dto.setItems(majorItems); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerContributionRankingDto> customerContributionRanking(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate = null; |
| | | LocalDate endDate = null; |
| | | switch (type) { |
| | | case 1: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | public List<CustomerContributionRankingDto> customerContributionRanking(Integer type, String startDateStr, String endDateStr) { |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | startDate = LocalDate.parse(startDateStr); |
| | | endDate = LocalDate.parse(endDateStr); |
| | | } else { |
| | | LocalDate today = LocalDate.now(); |
| | | switch (type) { |
| | | case 1: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | QueryWrapper<SalesLedger> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("customer_name", "SUM(contract_amount) as total_amount") |
| | | .isNotNull("customer_name") |
| | | .between("entry_date", startDate, endDate) |
| | | .groupBy("customer_name") |
| | | .orderByDesc("total_amount") |
| | | .last("LIMIT 5"); |
| | | |
| | | if (startDate != null && endDate != null) { |
| | | queryWrapper.between("entry_date", startDate, endDate); |
| | | } |
| | | |
| | | List<Map<String, Object>> maps = salesLedgerMapper.selectMaps(queryWrapper); |
| | | List<CustomerContributionRankingDto> result = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> productSalesAnalysis() { |
| | | // è·åææäº§å大类çéå®é¢ |
| | | List<Map<String, Object>> analysisResults = salesLedgerProductMapper.selectProductSalesAnalysis(); |
| | | public List<MapDto> productSalesAnalysis(String startDateStr, String endDateStr) { |
| | | List<Map<String, Object>> analysisResults; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | analysisResults = salesLedgerProductMapper.selectProductSalesAnalysisByDate(startDateStr, endDateStr); |
| | | } else { |
| | | analysisResults = salesLedgerProductMapper.selectProductSalesAnalysis(); |
| | | } |
| | | if (CollectionUtils.isEmpty(analysisResults)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> rawMaterialPurchaseAmountRatio() { |
| | | // è·åææåææçéè´é¢ |
| | | List<Map<String, Object>> analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysis(); |
| | | public List<MapDto> rawMaterialPurchaseAmountRatio(String startDateStr, String endDateStr) { |
| | | List<Map<String, Object>> analysisResults; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysisByDate(startDateStr, endDateStr); |
| | | } else { |
| | | analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysis(); |
| | | } |
| | | if (CollectionUtils.isEmpty(analysisResults)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> salesPurchaseStorageProductCount() { |
| | | public List<MapDto> salesPurchaseStorageProductCount(String startDate, String endDate) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | LocalDateTime lastMonth = now.minusMonths(1); |
| | | LocalDateTime lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | LocalDateTime lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); |
| | | LocalDateTime currentMonthStart; |
| | | LocalDateTime currentMonthEnd; |
| | | LocalDateTime lastMonthStart; |
| | | LocalDateTime lastMonthEnd; |
| | | |
| | | // éå® |
| | | int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, now); |
| | | int lastSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, lastMonthStart, lastMonthEnd); |
| | | // éè´ |
| | | int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, now); |
| | | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { |
| | | LocalDate start = LocalDate.parse(startDate); |
| | | LocalDate end = LocalDate.parse(endDate); |
| | | currentMonthStart = start.atStartOfDay(); |
| | | currentMonthEnd = end.atTime(LocalTime.MAX); |
| | | long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(start, end) + 1; |
| | | LocalDate lastStart = start.minusDays(daysBetween); |
| | | LocalDate lastEnd = start.minusDays(1); |
| | | lastMonthStart = lastStart.atStartOfDay(); |
| | | lastMonthEnd = lastEnd.atTime(LocalTime.MAX); |
| | | } else { |
| | | currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | currentMonthEnd = now; |
| | | LocalDateTime lastMonth = now.minusMonths(1); |
| | | lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); |
| | | } |
| | | |
| | | // éå®è®¢åæ°ï¼ç»è®¡sales_ledgerè¡¨ï¼ |
| | | int currentSales = Math.toIntExact(salesLedgerMapper.selectCount(new LambdaQueryWrapper<SalesLedger>() |
| | | .ge(SalesLedger::getEntryDate, currentMonthStart) |
| | | .le(SalesLedger::getEntryDate, currentMonthEnd))); |
| | | int lastSales = Math.toIntExact(salesLedgerMapper.selectCount(new LambdaQueryWrapper<SalesLedger>() |
| | | .ge(SalesLedger::getEntryDate, lastMonthStart) |
| | | .le(SalesLedger::getEntryDate, lastMonthEnd))); |
| | | // éè´äº§åæ° |
| | | int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, currentMonthEnd); |
| | | int lastPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, lastMonthStart, lastMonthEnd); |
| | | // å¨å |
| | | int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, now); |
| | | // å¨åäº§åæ° |
| | | int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, currentMonthEnd); |
| | | int lastStorage = stockInventoryMapper.selectStorageProductCountByDate(lastMonthStart, lastMonthEnd); |
| | | |
| | | List<MapDto> list = new ArrayList<>(); |
| | | list.add(createMapDto("éå®äº§åæ°", currentSales, lastSales)); |
| | | list.add(createMapDto("éå®è®¢åæ°", currentSales, lastSales)); |
| | | list.add(createMapDto("éè´äº§åæ°", currentPurchase, lastPurchase)); |
| | | list.add(createMapDto("å¨åäº§åæ°", currentStorage, lastStorage)); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> productInOutAnalysis(Integer type) { |
| | | public List<Map<String, Object>> productInOutAnalysis(Integer type, String startDateStr, String endDateStr) { |
| | | String targetName; |
| | | if (type == 1) { |
| | | targetName = "åææ"; |
| | |
| | | LocalDate now = LocalDate.now(); |
| | | DateTimeFormatter displayDtf = DateTimeFormatter.ofPattern("M/d"); |
| | | |
| | | String startDate = now.minusDays(6).toString(); |
| | | String endDate = now.toString(); |
| | | LocalDate start; |
| | | LocalDate end; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | start = LocalDate.parse(startDateStr); |
| | | end = LocalDate.parse(endDateStr); |
| | | } else { |
| | | end = now; |
| | | start = now.minusDays(6); |
| | | } |
| | | String startDate = start.toString(); |
| | | String endDate = end.toString(); |
| | | |
| | | List<Map<String, Object>> inCounts = stockInventoryMapper.selectDailyStockInCounts(rootCategoryId, startDate, |
| | | endDate + " 23:59:59"); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> productTurnoverDays() { |
| | | public List<MapDto> productTurnoverDays(String startDateStr, String endDateStr) { |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | return homeMapper.productTurnoverDaysByDate(startDateStr, endDateStr); |
| | | } |
| | | return homeMapper.productTurnoverDays(); |
| | | } |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:52 |
| | | */ |
| | | @RestController |
| | | @Tag(name = "å·¡æ£ä»»å¡è®°å½") |
| | | @RequestMapping("/inspectionTask") |
| | |
| | | |
| | | private InspectionTaskService inspectionTaskService; |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨è¡¨æ¥è¯¢ |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨è¡¨æ¥è¯¢") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨æ¥è¯¢") |
| | | public R<IPage<InspectionTaskDto>> list(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) { |
| | | IPage<InspectionTaskDto> list = inspectionTaskService.selectInspectionTaskList(page, inspectionTaskDto); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | */ |
| | | @PostMapping("/export") |
| | | @Operation(summary = "导åºå®æ¶ä»»å¡è®°å½") |
| | | public void export(HttpServletResponse response) { |
| | |
| | | util.exportExcel(response, list.getRecords(), "导åºå®æ¶ä»»å¡è®°å½"); |
| | | } |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨æ°å¢ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/addOrEditInspectionTask") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨æ°å¢ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return R.ok(inspectionTaskService.addOrEditInspectionTask(inspectionTaskDto)); |
| | | } |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨å é¤ |
| | | */ |
| | | @DeleteMapping("/delInspectionTask") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return R.ok(inspectionTaskService.delByIds(ids)); |
| | | } |
| | | |
| | | @PutMapping("/complete/{id}") |
| | | @Operation(summary = "å·¡æ£å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R complete(@PathVariable Long id) { |
| | | return R.ok(inspectionTaskService.complete(id)); |
| | | } |
| | | |
| | | @PutMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®å·¡æ£å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R batchComplete(String dateStr) { |
| | | return R.ok(inspectionTaskService.batchComplete(dateStr)); |
| | | } |
| | | |
| | | } |
| | |
| | | @Schema(description = "å·¡æ£å°ç¹è¯¦ç»æè¿°") |
| | | private String inspectionLocation; |
| | | |
| | | @Schema(description = "ç¶æ 0=å¾
å·¡æ£, 1=已宿") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | private Integer deleted; |
| | | |
| | |
| | | import com.ruoyi.inspectiontask.dto.InspectionTaskDto; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:49 |
| | | */ |
| | | public interface InspectionTaskService extends IService<InspectionTask> { |
| | | |
| | | IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto); |
| | |
| | | int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto); |
| | | |
| | | int delByIds(Long[] ids); |
| | | |
| | | int complete(Long id); |
| | | |
| | | int batchComplete(String dateStr); |
| | | } |
| | |
| | | // ä¿åæä»¶ï¼å段ä¸ä¼ åä¿çåå²ï¼ |
| | | saveInspectionAttachments(inspectionTask.getId(), inspectionTaskDto); |
| | | |
| | | // å·¡æ£ç»æè®¾ç½®åï¼èªå¨æ è®°ä¸ºå·²å®æ |
| | | if (StringUtils.isNotBlank(inspectionTaskDto.getInspectionResult())) { |
| | | InspectionTask statusUpdate = new InspectionTask(); |
| | | statusUpdate.setId(inspectionTask.getId()); |
| | | statusUpdate.setStatus(1); |
| | | inspectionTaskMapper.updateById(statusUpdate); |
| | | } |
| | | |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int complete(Long id) { |
| | | InspectionTask task = inspectionTaskMapper.selectById(id); |
| | | if (task == null) { |
| | | throw new IllegalArgumentException("å·¡æ£ä»»å¡ä¸åå¨"); |
| | | } |
| | | if (task.getStatus() != null && task.getStatus() == 1) { |
| | | throw new IllegalArgumentException("该巡æ£ä»»å¡å·²å®æ"); |
| | | } |
| | | task.setStatus(1); |
| | | if (task.getInspectionResult() == null) { |
| | | task.setInspectionResult("1"); |
| | | } |
| | | return inspectionTaskMapper.updateById(task); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int batchComplete(String dateStr) { |
| | | if (StringUtils.isBlank(dateStr)) { |
| | | throw new IllegalArgumentException("æ¥æåæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | java.time.LocalDate date = java.time.LocalDate.parse(dateStr); |
| | | java.time.LocalDateTime startOfDay = date.atStartOfDay(); |
| | | java.time.LocalDateTime endOfDay = date.atTime(java.time.LocalTime.MAX); |
| | | List<InspectionTask> tasks = inspectionTaskMapper.selectList( |
| | | new LambdaQueryWrapper<InspectionTask>() |
| | | .eq(InspectionTask::getStatus, 0) |
| | | .ge(InspectionTask::getCreateTime, startOfDay) |
| | | .le(InspectionTask::getCreateTime, endOfDay)); |
| | | if (tasks.isEmpty()) { |
| | | throw new IllegalArgumentException("è¯¥æ¥æä¸æ²¡æå¾
宿çå·¡æ£è®°å½"); |
| | | } |
| | | int count = 0; |
| | | for (InspectionTask task : tasks) { |
| | | task.setStatus(1); |
| | | if (task.getInspectionResult() == null) { |
| | | task.setInspectionResult("1"); |
| | | } |
| | | inspectionTaskMapper.updateById(task); |
| | | count++; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | private void validateInspectionInput(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) { |
| | | String inspectionResult = inspectionTaskDto.getInspectionResult(); |
| | | if (StringUtils.isBlank(inspectionResult) && oldInspectionTask != null) { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sparePartsRequisitionRecord") |
| | | @Tag(name = "å¤ä»¶é¢ç¨è®°å½æ¥å£") |
| | |
| | | private SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å¤ä»¶åç±»-å页æ¥è¯¢") |
| | | @Operation(summary = "å¤ä»¶é¢ç¨è®°å½-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | IPage<SparePartsRequisitionRecordDto> listPage = sparePartsRequisitionRecordService.listPage(page, sparePartsRequisitionRecordDto); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/outbound") |
| | | @Operation(summary = "å¤ä»¶ç¬ç«åºåº") |
| | | public AjaxResult outbound(@RequestBody SparePartsOutboundDto dto){ |
| | | sparePartsRequisitionRecordService.outbound(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "å¤ä»¶åºåºè¯·æ±") |
| | | public class SparePartsOutboundDto { |
| | | |
| | | @Schema(description = "å¤ä»¶ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Long sparePartsId; |
| | | |
| | | @Schema(description = "åºåºæ°é", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Integer quantity; |
| | | |
| | | @Schema(description = "设å¤IDï¼å¯éï¼") |
| | | private Long deviceLedgerId; |
| | | |
| | | @Schema(description = "夿³¨ï¼å¯éï¼") |
| | | private String remark; |
| | | } |
| | |
| | | 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.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | public interface SparePartsRequisitionRecordService extends IService<SparePartsRequisitionRecord> { |
| | | IPage<SparePartsRequisitionRecordDto> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto); |
| | | |
| | | void outbound(SparePartsOutboundDto dto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.SparePartsRequisitionRecordSourceTypeEnum; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsRequisitionRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | import java.math.BigDecimal; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SparePartsRequisitionRecordServiceImpl extends ServiceImpl<SparePartsRequisitionRecordMapper, SparePartsRequisitionRecord> implements SparePartsRequisitionRecordService { |
| | | private final SparePartsRequisitionRecordMapper sparePartsRequisitionRecordMapper; |
| | | private final SparePartsMapper sparePartsMapper; |
| | | |
| | | @Override |
| | | public IPage<SparePartsRequisitionRecordDto> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto) { |
| | | IPage<SparePartsRequisitionRecordDto> result = sparePartsRequisitionRecordMapper.listPage(page, sparePartsRequisitionRecordDto); |
| | | // å¤çæ¥æºç±»åææ¬ |
| | | result.getRecords().forEach(record -> { |
| | | if (record.getSourceType() != null) { |
| | | record.setSourceText(SparePartsRequisitionRecordSourceTypeEnum.getByCode(record.getSourceType()).getValue()); |
| | | SparePartsRequisitionRecordSourceTypeEnum typeEnum = SparePartsRequisitionRecordSourceTypeEnum.getByCode(record.getSourceType()); |
| | | if (typeEnum != null) { |
| | | record.setSourceText(typeEnum.getValue()); |
| | | } |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void outbound(SparePartsOutboundDto dto) { |
| | | SpareParts spareParts = sparePartsMapper.selectById(dto.getSparePartsId()); |
| | | if (spareParts == null) { |
| | | throw new IllegalArgumentException("å¤ä»¶ä¸åå¨"); |
| | | } |
| | | if (spareParts.getQuantity().compareTo(new BigDecimal(dto.getQuantity())) < 0) { |
| | | throw new IllegalArgumentException("å¤ä»¶ " + spareParts.getName() + " åºåä¸è¶³"); |
| | | } |
| | | // æ£ååºå |
| | | spareParts.setQuantity(spareParts.getQuantity().subtract(new BigDecimal(dto.getQuantity()))); |
| | | sparePartsMapper.updateById(spareParts); |
| | | // å建é¢ç¨è®°å½ |
| | | SparePartsRequisitionRecord record = new SparePartsRequisitionRecord(); |
| | | record.setSourceType(SparePartsRequisitionRecordSourceTypeEnum.SparePartsRequisitionRecordSourceTypeDirectOutbound.getCode()); |
| | | record.setSparePartsId(dto.getSparePartsId()); |
| | | record.setQuantity(dto.getQuantity()); |
| | | record.setDeviceLedgerId(dto.getDeviceLedgerId()); |
| | | this.save(record); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.purchase.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.service.ISupplierService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.service.PurchaseReportService; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | private final ISupplierService supplierService; |
| | | private final PurchaseReportService purchaseReportService; |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦", businessType = BusinessType.OTHER) |
| | | public R list(Page page, String customerName) { |
| | | return R.ok(purchaseReportService.list(page,customerName)); |
| | | return R.ok(purchaseReportService.list(page, customerName)); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦å¯¼åº", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @Operation(summary = "éè´æ¥è¡¨-项ç®å©æ¶¦å¯¼åº") |
| | | public void export(HttpServletResponse response, String customerName) { |
| | | List<PurchaseReportVo> list = purchaseReportService.list(new Page(1,-1),customerName).getRecords(); |
| | | List<PurchaseReportVo> list = purchaseReportService.list(new Page(1, -1), customerName).getRecords(); |
| | | ExcelUtil<PurchaseReportVo> util = new ExcelUtil<>(PurchaseReportVo.class); |
| | | util.exportExcel(response, list , "项ç®å©æ¶¦"); |
| | | |
| | | util.exportExcel(response, list, "项ç®å©æ¶¦"); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.OTHER) |
| | | @GetMapping("/listVat") |
| | | public R listVat(Page page,String month) { |
| | | return R.ok(purchaseReportService.listVat(page,month)); |
| | | public R listVat(Page page, String month, String type) { |
| | | return R.ok(purchaseReportService.listVat(page, month, type)); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportTwo") |
| | | @Operation(summary = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹") |
| | | public void exportTwo(HttpServletResponse response,String month) { |
| | | List<VatDto> list = purchaseReportService.listVat(new Page(1,-1),month).getRecords(); |
| | | @Operation(summary = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹å¯¼åº") |
| | | public void exportTwo(HttpServletResponse response, String month) { |
| | | List<VatDto> list = purchaseReportService.listVat(new Page(1, -1), month, null).getRecords(); |
| | | ExcelUtil<VatDto> util = new ExcelUtil<>(VatDto.class); |
| | | util.exportExcel(response, list , "å¢å¼ç¨æ¯å¯¹"); |
| | | util.exportExcel(response, list, "å¢å¼ç¨æ¯å¯¹"); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨å¾è¡¨æ°æ®", businessType = BusinessType.OTHER) |
| | | @GetMapping("/vatChart") |
| | | @Operation(summary = "å¢å¼ç¨è¿é项对æ¯å¾è¡¨æ°æ®") |
| | | public R vatChart(String year) { |
| | | List<VatSummaryDto> list = purchaseReportService.vatSummary(year); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/listVatDetail") |
| | | @Operation(summary = "å¢å¼ç¨æç»-æå票/订åå±ç¤º") |
| | | public AjaxResult listVatDetail(Page page, String month) { |
| | | IPage<VatDto> result = purchaseReportService.listVatDetail(page, month); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/supplierTransactions") |
| | | @Log(title = "ä¾åºå徿¥", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "ä¾åºå徿¥") |
| | | public R supplierTransactions(Page page, String supplierName) { |
| | | return R.ok(supplierService.supplierTransactions(page,supplierName)); |
| | | return R.ok(supplierService.supplierTransactions(page, supplierName)); |
| | | } |
| | | |
| | | @GetMapping("/supplierTransactionsDetails") |
| | | @Log(title = "ä¾åºå徿¥æç»", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "ä¾åºå徿¥æç»") |
| | | public R supplierTransactionsDetails(Page page, Long supplierId) { |
| | | return R.ok(supplierService.supplierTransactionsDetails(page,supplierId)); |
| | | return R.ok(supplierService.supplierTransactionsDetails(page, supplierId)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | 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.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "VatDto", description = "管ç驾驶è±--å¢å¼ç¨æ¯å¯¹åæ°") |
| | | @Schema(name = "VatDto", description = "å¢å¼ç¨æ¯å¯¹æç»") |
| | | @ExcelIgnoreUnannotated |
| | | public class VatDto { |
| | | |
| | | @Excel(name = "ID") |
| | | @Schema(description = "å票ID") |
| | | private Long id; |
| | | |
| | | @Excel(name = "å票å·ç ") |
| | | @Schema(description = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | @Schema(description = "å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate issueDate; |
| | | |
| | | @Excel(name = "ç±»å") |
| | | @Schema(description = "ç±»å sales-é项 purchase-è¿é¡¹") |
| | | private String type; |
| | | |
| | | @Excel(name = "å票类å") |
| | | @Schema(description = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | @Excel(name = "ç¨é¢") |
| | | @Schema(description = "ç¨é¢") |
| | | private BigDecimal taxAmount; |
| | | |
| | | @Excel(name = "ä»·ç¨å计") |
| | | @Schema(description = "ä»·ç¨å计") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Excel(name = "客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | @Schema(description = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Excel(name = "æä»½") |
| | | @Schema(description = "æä»½") |
| | | private String month ; |
| | | private String month; |
| | | |
| | | @Excel(name = "é项ç¨é¢") |
| | | @Schema(description = "é项ç¨é¢") |
| | |
| | | @Schema(description = "è¿é¡¹ç¨é¢") |
| | | private BigDecimal xTaxAmount; |
| | | |
| | | @Excel(name = "é-è¿") |
| | | @Schema(description = "é-è¿") |
| | | private BigDecimal taxAmount; |
| | | // ========== æç»è§å¾å段 ========== |
| | | |
| | | @Excel(name = "å票å·") |
| | | @Schema(description = "å票å·") |
| | | private String invoiceNo; |
| | | |
| | | @Excel(name = "éå®ååå·") |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @Excel(name = "订åç±»å") |
| | | @Schema(description = "ç±»å è¿é¡¹/é项") |
| | | private String orderType; |
| | | |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | @Schema(description = "å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate invoiceDate; |
| | | |
| | | @Excel(name = "ç¨ç") |
| | | @Schema(description = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @Schema(description = "å¢å¼ç¨è¿éé¡¹æææ±æ»ï¼å¾è¡¨ç¨ï¼") |
| | | public class VatSummaryDto { |
| | | |
| | | @Schema(description = "æä»½") |
| | | private String month; |
| | | |
| | | @Schema(description = "é项ç¨é¢å计") |
| | | private BigDecimal jTaxAmount; |
| | | |
| | | @Schema(description = "è¿é¡¹ç¨é¢å计") |
| | | private BigDecimal xTaxAmount; |
| | | |
| | | @Schema(description = "å·®é¢ï¼é-è¿ï¼") |
| | | private BigDecimal taxAmount; |
| | | } |
| | |
| | | package com.ruoyi.purchase.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PurchaseReportService { |
| | | |
| | | IPage<PurchaseReportVo> list(Page page, String customerName); |
| | | |
| | | IPage<VatDto> listVat(Page page, String month); |
| | | IPage<VatDto> listVat(Page page, String month, String type); |
| | | |
| | | List<VatSummaryDto> vatSummary(String year); |
| | | |
| | | IPage<VatDto> listVatDetail(Page page, String month); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.mapper.AccountStatementMapper; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.service.PurchaseReportService; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Slf4j |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<VatDto> listVat(Page page, String month) { |
| | | return accountStatementMapper.selectVatDtoPage(page, month); |
| | | public IPage<VatDto> listVat(Page page, String month, String type) { |
| | | return accountStatementMapper.selectVatDtoPage(page, month, type); |
| | | } |
| | | |
| | | @Override |
| | | public List<VatSummaryDto> vatSummary(String year) { |
| | | return accountStatementMapper.selectVatSummary(year); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<VatDto> listVatDetail(Page page, String month) { |
| | | return accountStatementMapper.listVatDetail(page, month); |
| | | } |
| | | } |
| | |
| | | IPage<SalesLedgerDto> listSalesLedgerAndShipped(Page page, @Param("ew") SalesLedgerDto salesLedgerDto); |
| | | |
| | | IPage<PurchaseReportVo> selectPurchaseReportVoPage(Page page, @Param("customerName") String customerName); |
| | | |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> selectProductSalesAnalysis(); |
| | | |
| | | List<Map<String, Object>> selectProductSalesAnalysisByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<Map<String, Object>> selectRawMaterialPurchaseAnalysis(); |
| | | |
| | | List<Map<String, Object>> selectRawMaterialPurchaseAnalysisByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | BigDecimal selectRawMaterialExpense(); |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-bdpro?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: 123456 |
| | | # ä»åºæ°æ®æº |
| | |
| | | ORDER BY lj.statement_month DESC |
| | | </select> |
| | | <select id="selectVatDtoPage" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | SELECT |
| | | month, |
| | | jTaxAmount, |
| | | xTaxAmount, |
| | | (jTaxAmount - xTaxAmount) AS taxAmount |
| | | FROM ( |
| | | SELECT * FROM ( |
| | | SELECT |
| | | asi.id, |
| | | asi.invoice_number AS invoiceNumber, |
| | | asi.issue_date AS issueDate, |
| | | 'sales' AS type, |
| | | asi.invoice_type AS invoiceType, |
| | | asi.tax_price AS taxAmount, |
| | | asi.tax_inclusive_price AS totalAmount, |
| | | c.customer_name AS customerName, |
| | | NULL AS supplierName, |
| | | DATE_FORMAT(asi.issue_date, '%Y-%m') AS month |
| | | FROM account_sales_invoice asi |
| | | LEFT JOIN customer c ON c.id = asi.customer_id |
| | | WHERE (asi.status IS NULL OR asi.status = 0) |
| | | UNION ALL |
| | | SELECT |
| | | api.id, |
| | | api.invoice_number AS invoiceNumber, |
| | | api.issue_date AS issueDate, |
| | | 'purchase' AS type, |
| | | api.invoice_type AS invoiceType, |
| | | api.tax_price AS taxAmount, |
| | | api.tax_inclusive_price AS totalAmount, |
| | | NULL AS customerName, |
| | | s.supplier_name AS supplierName, |
| | | DATE_FORMAT(api.issue_date, '%Y-%m') AS month |
| | | FROM account_purchase_invoice api |
| | | LEFT JOIN supplier_manage s ON s.id = api.supplier_id |
| | | WHERE (api.status IS NULL OR api.status = 0) |
| | | ) AS invoice_detail |
| | | <where> |
| | | <if test="month != null and month != ''"> |
| | | AND month = #{month} |
| | | </if> |
| | | <if test="type != null and type != ''"> |
| | | AND type = #{type} |
| | | </if> |
| | | </where> |
| | | ORDER BY issueDate DESC, type |
| | | </select> |
| | | |
| | | <select id="selectVatSummary" resultType="com.ruoyi.purchase.dto.VatSummaryDto"> |
| | | SELECT |
| | | month, |
| | | SUM(IF(type = 'purchase', tax_price, 0)) AS xTaxAmount, |
| | | SUM(IF(type = 'sales', tax_price, 0)) AS jTaxAmount |
| | | SUM(jTaxAmount) AS jTaxAmount, |
| | | SUM(xTaxAmount) AS xTaxAmount, |
| | | SUM(jTaxAmount) - SUM(xTaxAmount) AS taxAmount |
| | | FROM ( |
| | | SELECT |
| | | DATE_FORMAT(issue_date, '%Y-%m') AS month, |
| | | tax_price, |
| | | 'sales' AS type |
| | | SUM(tax_price) AS jTaxAmount, |
| | | 0 AS xTaxAmount |
| | | FROM account_sales_invoice |
| | | WHERE status != 1 |
| | | WHERE (status IS NULL OR status = 0) |
| | | <if test="year != null and year != ''"> |
| | | AND YEAR(issue_date) = #{year} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(issue_date, '%Y-%m') |
| | | UNION ALL |
| | | SELECT |
| | | DATE_FORMAT(issue_date, '%Y-%m') AS month, |
| | | tax_price, |
| | | 'purchase' AS type |
| | | 0 AS jTaxAmount, |
| | | SUM(tax_price) AS xTaxAmount |
| | | FROM account_purchase_invoice |
| | | WHERE status != 1 |
| | | ) AS all_data |
| | | GROUP BY month |
| | | ) AS TT |
| | | <where> |
| | | <if test="month != null"> |
| | | and TT.month = #{month} |
| | | WHERE (status IS NULL OR status = 0) |
| | | <if test="year != null and year != ''"> |
| | | AND YEAR(issue_date) = #{year} |
| | | </if> |
| | | </where> |
| | | ORDER BY TT.month |
| | | GROUP BY DATE_FORMAT(issue_date, '%Y-%m') |
| | | ) t |
| | | GROUP BY month |
| | | ORDER BY month |
| | | </select> |
| | | |
| | | <select id="listVatDetail" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | SELECT * |
| | | FROM ( |
| | | -- è¿é¡¹ç¨æç»ï¼éè´è®¢åï¼ |
| | | SELECT |
| | | pl.purchase_contract_number AS invoiceNo, |
| | | pl.sales_contract_no AS salesContractNo, |
| | | pl.supplier_name AS supplierName, |
| | | NULL AS customerName, |
| | | 'è¿é¡¹' AS orderType, |
| | | pl.entry_date AS invoiceDate, |
| | | slp.tax_rate AS taxRate, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS jTaxAmount, |
| | | 0 AS xTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS taxAmount |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN purchase_ledger pl ON pl.id = slp.sales_ledger_id |
| | | WHERE slp.type = 2 |
| | | AND slp.tax_rate IS NOT NULL |
| | | AND slp.tax_rate > 0 |
| | | GROUP BY pl.id |
| | | |
| | | UNION ALL |
| | | |
| | | -- éé¡¹ç¨æç»ï¼éå®è®¢åï¼ |
| | | SELECT |
| | | sl.sales_contract_no AS invoiceNo, |
| | | sl.sales_contract_no AS salesContractNo, |
| | | NULL AS supplierName, |
| | | sl.customer_name AS customerName, |
| | | 'é项' AS orderType, |
| | | sl.entry_date AS invoiceDate, |
| | | slp.tax_rate AS taxRate, |
| | | 0 AS jTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS xTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS taxAmount |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN sales_ledger sl ON sl.id = slp.sales_ledger_id |
| | | WHERE slp.type = 1 |
| | | AND slp.tax_rate IS NOT NULL |
| | | AND slp.tax_rate > 0 |
| | | GROUP BY sl.id |
| | | ) a |
| | | <where> |
| | | <if test="month != null and month != ''"> |
| | | AND DATE_FORMAT(a.invoiceDate, '%Y-%m') = #{month} |
| | | </if> |
| | | </where> |
| | | ORDER BY a.invoiceDate DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | GROUP BY p.id, p.product_name |
| | | </select> |
| | | |
| | | <select id="productTurnoverDaysByDate" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT p.product_name AS name, |
| | | DATEDIFF(IFNULL(MAX(sor.create_time), NOW()), MAX(sir.create_time)) AS value |
| | | FROM product p |
| | | JOIN product_model pm ON p.id = pm.product_id |
| | | JOIN stock_in_record sir ON pm.id = sir.product_model_id |
| | | AND sir.create_time >= #{startDate} |
| | | AND sir.create_time <= #{endDate} |
| | | LEFT JOIN stock_out_record sor ON pm.id = sor.product_model_id |
| | | GROUP BY p.id, p.product_name |
| | | </select> |
| | | |
| | | <select id="selectPurchaseCategoryDistribution" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT p2.product_name AS name, |
| | | COUNT(DISTINCT slp.id) AS value |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN product p ON p.id = slp.product_category |
| | | LEFT JOIN product p2 ON p2.id = p.parent_id |
| | | WHERE slp.type = 2 |
| | | AND p.parent_id IS NOT NULL |
| | | GROUP BY p2.product_name |
| | | ORDER BY value DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectProductSalesAnalysisByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | product_category as name, |
| | | SUM( tax_inclusive_total_price ) AS value |
| | | FROM |
| | | sales_ledger_product |
| | | WHERE |
| | | type = 1 |
| | | AND register_date >= #{startDate} |
| | | AND register_date <= #{endDate} |
| | | GROUP BY |
| | | product_category |
| | | ORDER BY |
| | | value DESC |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.Map"> |
| | | WITH RECURSIVE raw_material_tree AS ( |
| | | SELECT id FROM product WHERE product_name = 'åææ' AND parent_id IS NULL |
| | | UNION ALL |
| | | SELECT p.id FROM product p INNER JOIN raw_material_tree rmt ON p.parent_id = rmt.id |
| | | ) |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | |
| | | JOIN product pr ON slp.product_id = pr.id |
| | | WHERE |
| | | slp.type = 2 |
| | | AND pr.id IN (SELECT id FROM raw_material_tree) |
| | | GROUP BY |
| | | pr.id, |
| | | pr.product_name |
| | | ORDER BY |
| | | value DESC |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysisByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | | FROM |
| | | sales_ledger_product slp |
| | | JOIN product pr ON slp.product_id = pr.id |
| | | WHERE |
| | | slp.type = 2 |
| | | AND slp.register_date >= #{startDate} |
| | | AND slp.register_date <= #{endDate} |
| | | AND pr.parent_id = ( SELECT id FROM product WHERE product_name = 'åææ' ) |
| | | GROUP BY |
| | | pr.id, |
| | |
| | | <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> |
| | | WITH RECURSIVE product_tree AS (SELECT id |
| | | FROM product |
| | | WHERE product_name = 'åææ' |
| | | WHERE product_name = 'åææ' AND parent_id IS NULL |
| | | |
| | | UNION ALL |
| | | |