From 3e451c90f8734835743e9cebcf02ce30e577c28d Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 24 十一月 2025 11:27:18 +0800
Subject: [PATCH] yys 1.新增入职导入,下载模板
---
src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java | 75 ++++++++++++++++++++++++++++++-------
1 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java b/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
index 1b6cfb5..47521e7 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
@@ -3,20 +3,27 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.device.dto.DeviceMaintenanceDto;
+import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO;
import com.ruoyi.device.dto.DeviceRepairDto;
+import com.ruoyi.device.dto.RepairAmountGroupDTO;
+import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.device.pojo.DeviceMaintenance;
import com.ruoyi.device.pojo.DeviceRepair;
+import com.ruoyi.device.service.IDeviceLedgerService;
import com.ruoyi.device.service.IDeviceMaintenanceService;
import com.ruoyi.device.service.IDeviceRepairService;
import com.ruoyi.framework.web.domain.AjaxResult;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
-
+@Api(tags = "璁惧淇濆吇")
@RestController
@RequestMapping("/device/maintenance")
public class DeviceMaintenanceController {
@@ -25,34 +32,51 @@
@Autowired
private IDeviceMaintenanceService deviceMaintenanceService;
- @ApiModelProperty("璁惧鎶ヤ慨鍒楄〃")
+ @Autowired
+ private IDeviceLedgerService deviceLedgerService;
+
+ @ApiModelProperty("璁惧淇濆吇鍒楄〃")
@GetMapping("/page")
public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) {
return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto));
}
@PostMapping()
- @ApiModelProperty("娣诲姞璁惧鎶ヤ慨")
- public AjaxResult add(@RequestBody DeviceMaintenance deviceRepair) {
- return deviceMaintenanceService.saveDeviceRepair(deviceRepair);
+ @ApiModelProperty("娣诲姞璁惧淇濆吇")
+ public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) {
+ DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId());
+ deviceMaintenance.setDeviceName(byId.getDeviceName());
+ deviceMaintenance.setDeviceModel(byId.getDeviceModel());
+ return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance);
}
- @ApiModelProperty("鏍规嵁id鏌ヨ璁惧鎶ヤ慨")
+ @ApiModelProperty("鏍规嵁id鏌ヨ璁惧淇濆吇")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {
- return AjaxResult.success(deviceMaintenanceService.getById(id));
+ return AjaxResult.success(deviceMaintenanceService.detailById(id));
}
@PutMapping ()
- @ApiModelProperty("淇敼璁惧鎶ヤ慨")
+ @ApiModelProperty("淇敼璁惧淇濆吇")
public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) {
- return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance);
+ DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId());
+ deviceMaintenance.setDeviceName(byId.getDeviceName());
+ deviceMaintenance.setDeviceModel(byId.getDeviceModel());
+ return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance);
}
- @DeleteMapping("/{id}")
- @ApiModelProperty("鍒犻櫎璁惧鎶ヤ慨")
- public AjaxResult delete(@PathVariable ArrayList<Long> ids) {
- boolean b = deviceMaintenanceService.removeBatchByIds(ids);
+ @PostMapping ("maintenance")
+ @ApiModelProperty("淇敼璁惧淇濆吇")
+ public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) {
+ deviceMaintenance.setStatus(1);
+ return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance);
+ }
+
+
+ @DeleteMapping("/{ids}")
+ @ApiModelProperty("鍒犻櫎璁惧淇濆吇")
+ public AjaxResult delete(@PathVariable("ids") Long[] ids) {
+ boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids));
if (!b) {
return AjaxResult.error("鍒犻櫎澶辫触");
}
@@ -60,10 +84,33 @@
}
@PostMapping("export")
- @ApiModelProperty("瀵煎嚭璁惧鎶ヤ慨")
+ @ApiModelProperty("瀵煎嚭璁惧淇濆吇")
public void export(HttpServletResponse response, Long[] ids) {
deviceMaintenanceService.export(response, ids);
}
+ /**
+ * 鎸夊勾浠芥煡璇㈡瘡鏈堟姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級
+ * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�2025锛�
+ */
+ @GetMapping("/monthlyAmount")
+ @ApiModelProperty("鎸夊勾浠芥煡璇㈡瘡鏈堟姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級")
+ public AjaxResult getMonthlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) {
+ List<DeviceMonthlyRepairTableDTO> result = deviceMaintenanceService.getMonthlyRepairAmountByYear(year);
+ return AjaxResult.success(result);
+ }
+
+ /**
+ * 鎸夊勾浠芥煡璇㈡姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級
+ * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�2025锛�
+ */
+ @GetMapping("/yearlyAmount")
+ @ApiModelProperty("鎸夊勾浠芥煡璇㈡姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級")
+ public AjaxResult yearlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) {
+ List<RepairAmountGroupDTO> result = deviceMaintenanceService.getRepairAmountByYear(year);
+ return AjaxResult.success(result);
+ }
+
+
}
--
Gitblit v1.9.3