| | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.pro.maintenanceplan.MesProMaintenancePlanService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | |
| | | plan -> buildPlanRespVOItems(plan, planItemMap.get(plan.getId())))); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得电力作业计划导入模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | List<MesProMaintenancePlanImportExcelVO> list = Collections.singletonList( |
| | | MesProMaintenancePlanImportExcelVO.builder() |
| | | .name("8月变电运维计划").planType(3).station("220kV城东变电站").line("城东-工业线路") |
| | | .teamName("运维一班").planDate(java.time.LocalDateTime.of(2026, 8, 1, 9, 0, 0)) |
| | | .remark("").itemCode("").itemQuantity(new java.math.BigDecimal("10")).itemRemark("").build() |
| | | ); |
| | | ExcelUtils.write(response, "电力作业计划导入模板.xls", "电力作业计划列表", MesProMaintenancePlanImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入电力作业计划") |
| | | @Parameters({ |
| | | @Parameter(name = "file", description = "Excel 文件", required = true), |
| | | @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:import')") |
| | | public CommonResult<MesProMaintenancePlanImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", required = false, |
| | | defaultValue = "false") Boolean updateSupport) throws Exception { |
| | | List<MesProMaintenancePlanImportExcelVO> list = ExcelUtils.read(file, MesProMaintenancePlanImportExcelVO.class); |
| | | return success(planService.importPlanList(list, updateSupport)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导出电力作业计划 Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:export')") |