diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java index 9e25606..2939f1d 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java @@ -8,12 +8,20 @@ import com.bonus.common.utils.poi.ExcelUtil; import com.bonus.digital.dao.PlanManagementVo; import com.bonus.digital.dao.WorkloadCategoryVo; import com.bonus.digital.service.PlanManagementService; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.util.IOUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -126,4 +134,39 @@ public class PlanManagementController extends BaseController { } } + @ApiOperation("模板下载") + @GetMapping("/downloadTeamExcel") + public void downloadTeamExcel(HttpServletRequest request, HttpServletResponse response) { + InputStream inputStream = null; + ServletOutputStream servletOutputStream = null; + try { + String path = "download/" + "计划管理.xlsx"; + inputStream = this.getClass().getClassLoader().getResourceAsStream(path); + response.setContentType("application/vnd.ms-excel"); + response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate"); + response.addHeader("charset", "utf-8"); + response.addHeader("Pragma", "no-cache"); + String encodeName = URLEncoder.encode("计划管理导入摸板.xlsx", StandardCharsets.UTF_8.toString()); + response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName); + servletOutputStream = response.getOutputStream(); + IOUtils.copy(inputStream, servletOutputStream); + response.flushBuffer(); + //log.info("文件下载成功!!"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (servletOutputStream != null) { + servletOutputStream.close(); + } + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/WorkloadCategoryController.java b/bonus-business/src/main/java/com/bonus/digital/controller/WorkloadCategoryController.java index e95694d..b2f2b8f 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/WorkloadCategoryController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/WorkloadCategoryController.java @@ -40,6 +40,20 @@ public class WorkloadCategoryController extends BaseController { } } + /** + * 工作量类别列表 + */ + @PreAuthorize("@ss.hasPermi('workload:category:list')") + @GetMapping("/getWorkloadCategoryListSelect") + public AjaxResult getWorkloadCategoryListSelect(WorkloadCategoryVo workloadCategoryVo) { + try { + List list = workloadCategoryService.getWorkloadCategoryList(workloadCategoryVo); + return success(list); + } catch (Exception e) { + return error("系统异常"); + } + } + /** * 新增工作量类别 */