| | |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanAuditReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanImportExcelVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanImportReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanImportRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanSaveReqVO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得采购计划") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<ErpPurchasePlanRespVO> getPurchasePlan(@RequestParam("id") Long id) { |
| | | ErpPurchasePlanDO plan = purchasePlanService.getPurchasePlan(id); |
| | | if (plan == null) { |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得采购计划分页") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<PageResult<ErpPurchasePlanRespVO>> getPurchasePlanPage(@Valid ErpPurchasePlanPageReqVO pageReqVO) { |
| | | PageResult<ErpPurchasePlanDO> pageResult = purchasePlanService.getPurchasePlanPage(pageReqVO); |
| | | return success(buildPurchasePlanVOPageResult(pageResult)); |
| | |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<ErpPurchasePlanRespVO> list = buildPurchasePlanVOPageResult(purchasePlanService.getPurchasePlanPage(pageReqVO)).getList(); |
| | | ExcelUtils.write(response, "采购计划.xls", "数据", ErpPurchasePlanRespVO.class, list); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得导入采购计划模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // 手动创建导出 demo |
| | | List<ErpPurchasePlanImportExcelVO> list = Arrays.asList( |
| | | ErpPurchasePlanImportExcelVO.builder().no("CGJH-示例-001").name("示例采购计划") |
| | | .demandSource(null).planDate(null).supplierName("") |
| | | .remark("").productCode("").productUnitCode("").count(null) |
| | | .demandTime(null).itemRemark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.writeTemplate(response, "采购计划导入模板.xls", "采购计划列表", ErpPurchasePlanImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入采购计划") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:import')") |
| | | public CommonResult<ErpPurchasePlanImportRespVO> importExcel(@Valid ErpPurchasePlanImportReqVO importReqVO) |
| | | throws Exception { |
| | | List<ErpPurchasePlanImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), ErpPurchasePlanImportExcelVO.class); |
| | | return success(purchasePlanService.importPurchasePlanList(list, importReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | |
| | | |
| | | @GetMapping("/approver-ids") |
| | | @Operation(summary = "获得采购计划的审批人编号集合,供前端判断是否展示审核按钮") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<Set<Long>> getApproverUserIds() { |
| | | return success(purchasePlanService.getPurchasePlanApproverUserIds()); |
| | | } |