| | |
| | | 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.deepoove.poi.data.style.*; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.manage.pojo.ManageRiskAssessmentResults; |
| | | import com.ruoyi.manage.service.ManageRiskAssessmentResultsService; |
| | | import com.ruoyi.manage.utils.MyUtil; |
| | | import com.ruoyi.manage.vo.ManageRiskAssessmentResultsVo; |
| | | import com.ruoyi.manage.vo.Result; |
| | | import com.deepoove.poi.data.style.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class ManageRiskAssessmentResultsController { |
| | | |
| | | @Autowired |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private ManageRiskAssessmentResultsService manageRiskAssessmentResultsService; |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "分页查询") |
| | | @GetMapping("/getPageResults") |
| | | public Result<IPage<ManageRiskAssessmentResultsVo>> getPageResults(Page page) { |
| | |
| | | return Result.success(ipage); |
| | | } |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "批准") |
| | | @GetMapping("/hazardIdentificationAndRiskApproval") |
| | | public Result<?> hazardIdentificationAndRiskApproval(Integer approve, Integer status) { |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "审批") |
| | | @GetMapping("/dangerousRiskApproval") |
| | | public Result<?> dangerousRiskApproval(Integer approval, Integer status) { |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "导入") |
| | | @PostMapping("/riskAssessmentImport") |
| | | public void riskAssessmentImport(MultipartFile file) throws IOException { |
| | | boolean excelFile = MyUtil.isExcelFile(file); |
| | | boolean excelFile = isExcelFile(file); |
| | | if (!excelFile) { |
| | | throw new ErrorException("请导入excel文件!"); |
| | | } |
| | |
| | | })).extraRead(CellExtraTypeEnum.MERGE).sheet().doRead(); |
| | | } |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "新增") |
| | | @PostMapping("/addNewRiskFactors") |
| | | public void addNewRiskFactors(@RequestBody ManageRiskAssessmentResults manageRiskAssessmentResults) { |
| | |
| | | manageRiskAssessmentResultsService.saveOrUpdate(manageRiskAssessmentResults); |
| | | } |
| | | |
| | | @ValueClassify(value = "危险因素辨识与风险评价结果一览") |
| | | @ApiOperation(value = "删除") |
| | | @GetMapping("/removeRiskFactors") |
| | | public void removeRiskFactors(Integer id) { |
| | | manageRiskAssessmentResultsService.removeById(id); |
| | | } |
| | | |
| | | @ValueAuth |
| | | |
| | | @ApiOperation(value = "导出危险因素辨识与风险评价结果一览") |
| | | @GetMapping("/exportHazardFactorIdentification") |
| | | public void exportPersonTraining(HttpServletResponse response){ |
| | | manageRiskAssessmentResultsService.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"); |
| | | } |
| | | } |