| | |
| | | package com.ruoyi.manage.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.alibaba.excel.read.listener.PageReadListener; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.manage.annotation.ValueAuth; |
| | | import com.ruoyi.manage.annotation.ValueClassify; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.manage.pojo.ManageControlPlanList; |
| | | import com.ruoyi.manage.service.ManageControlPlanListService; |
| | | import com.ruoyi.manage.utils.MyUtil; |
| | | import com.ruoyi.manage.vo.ManageControlPlanListVo; |
| | | import com.ruoyi.manage.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | @Resource |
| | | private ManageControlPlanListService manageControlPlanListService; |
| | | |
| | | @Autowired |
| | | |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | |
| | | @ApiOperation(value = "分页查询") |
| | | @GetMapping("/getPageList") |
| | | public Result<IPage<ManageControlPlanListVo>> getPageList(Page page){ |
| | | IPage<ManageControlPlanListVo> ipage = manageControlPlanListService.getPageList(page); |
| | | return Result.success(ipage); |
| | | public Result<IPage<ManageControlPlanListVo>> getPageList(Page page) { |
| | | return Result.success(manageControlPlanListService.getPageList(page)); |
| | | } |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | @ApiOperation(value = "批准") |
| | | @GetMapping("/approvalOfControlPlanChecklist") |
| | | public Result<?> approvalOfControlPlanChecklist(Integer approve, Integer status){ |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | @ApiOperation(value = "审批") |
| | | @GetMapping("/riskAnalysisApprovalOfControlPlanChecklist") |
| | | public Result<?> riskAnalysisApprovalOfControlPlanChecklist(Integer approval, Integer status){ |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | @ApiOperation(value = "导入") |
| | | @PostMapping("/importControlPlanList") |
| | | public void importControlPlanList(MultipartFile file) throws IOException { |
| | | boolean excelFile = MyUtil.isExcelFile(file); |
| | | boolean excelFile = isExcelFile(file); |
| | | if (!excelFile) { |
| | | throw new ErrorException("请导入excel文件!"); |
| | | } |
| | |
| | | })).sheet().doRead(); |
| | | } |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | @ApiOperation(value = "新增") |
| | | @PostMapping("/analysisOfMajorRiskFactorsAdded") |
| | | public void analysisOfMajorRiskFactorsAdded(@RequestBody ManageControlPlanList manageControlPlanList) throws IOException { |
| | |
| | | manageControlPlanListService.saveOrUpdate(manageControlPlanList); |
| | | } |
| | | |
| | | @ValueClassify(value = "重大风险因素分析及控制计划清单") |
| | | @ApiOperation(value = "删除") |
| | | @GetMapping("/deleteSignificantRiskFactorAnalysis") |
| | | public void deleteSignificantRiskFactorAnalysis(Integer id) throws IOException { |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @ValueAuth |
| | | |
| | | @ApiOperation(value = "重大风险因素分析及控制计划清单") |
| | | @GetMapping("/exportSignificantRiskFactors") |
| | | public void exportSignificantRiskFactors(HttpServletResponse response){ |
| | | manageControlPlanListService.exportPersonTraining(response); |
| | | } |
| | | |
| | | public static boolean isExcelFile(MultipartFile file) { |
| | | if (file.isEmpty()) { |
| | | return false; |
| | | } |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (originalFilename == null) { |
| | | return false; |
| | | } |
| | | String[] parts = originalFilename.split("\\."); |
| | | if (parts.length == 0) { |
| | | return false; |
| | | } |
| | | String fileExtension = parts[parts.length - 1].toLowerCase(); |
| | | return fileExtension.equals("xls") || fileExtension.equals("xlsx"); |
| | | } |
| | | } |