From 792ff6e14b5074d30f8a7bd804d3b8e6454c3969 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期四, 11 一月 2024 17:41:45 +0800 Subject: [PATCH] 保养拆分 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 42 insertions(+), 3 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java index 595167d..1a0d577 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java @@ -8,6 +8,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.dto.message.MessageDTO; import org.jeecg.common.api.vo.Result; @@ -17,17 +18,25 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.service.*; +import org.jeecg.modules.eam.vo.RepairReportExportVo; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysUserService; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; @@ -61,6 +70,8 @@ private IdentityService sysIdentityService; @Autowired private IFaultInfoService faultInfoService; + @Value("${jeecg.path.upload}") + private String upLoadPath; /** @@ -106,6 +117,7 @@ LoginUser curUser= (LoginUser) SecurityUtils.getSubject().getPrincipal(); equipmentReportRepair.setStatus("1"); equipmentReportRepair.setSource("1"); +// equipmentReportRepair.setType("1"); equipmentReportRepair.setIsCreateOrder(0); equipmentReportRepairService.save(equipmentReportRepair); String IS_PRODUCT_YES = "yes"; @@ -264,14 +276,14 @@ FaultInfo faultInfo = faultInfoService.getOne(new QueryWrapper<FaultInfo>().eq("quanlity_id",quanlityConfirm.getId()),false); if(ObjectUtils.isNotNull(faultInfo)){ String isConfirm2 = faultInfo.getIsConfirm(); - if(!isConfirm1.equals("yes")||isConfirm2.equals("yes")){ - return Result.error("楠屾敹澶辫触锛屼骇鍝佽川閲忛殣鎮g‘璁ゅ拰浜嬫晠鐧昏灏氭湭瀹屽満锛岃瀹屾垚纭鍚庡啀杩涜楠屾敹"); + if(!isConfirm1.equals("yes")||!isConfirm2.equals("yes")){ + return Result.error("楠屾敹澶辫触锛屼骇鍝佽川閲忛殣鎮g‘璁ゅ拰浜嬫晠鐧昏灏氭湭瀹屾垚锛岃瀹屾垚纭鍚庡啀杩涜楠屾敹"); } }else { return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜嬫晠鐧昏鍗�"); } }else { - return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜у钩璐ㄩ噺纭"); + return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜у搧璐ㄩ噺纭"); } } LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal(); @@ -294,4 +306,31 @@ } return Result.OK("楠屾敹鎴愬姛"); } + /** + * 瀵煎嚭excel + * + * @param request + * @param equipmentReportRepair + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, RepairReportExportVo equipmentReportRepair) { + // Step.1 缁勮鏌ヨ鏉′欢 + String title = "鏁呴殰鎶ヤ慨瀵煎嚭"; + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + // Step.2 鑾峰彇瀵煎嚭鏁版嵁 + List<RepairReportExportVo> exportList = equipmentReportRepairService.exportList(equipmentReportRepair); + + // Step.3 AutoPoi 瀵煎嚭Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + //姝ゅ璁剧疆鐨刦ilename鏃犳晥 ,鍓嶇浼氶噸鏇存柊璁剧疆涓�涓� + mv.addObject(NormalExcelConstants.FILE_NAME, title); + mv.addObject(NormalExcelConstants.CLASS, RepairReportExportVo.class); + //update-begin--Author:liusq Date:20210126 for锛氬浘鐗囧鍑烘姤閿欙紝ImageBasePath鏈缃�-------------------- + ExportParams exportParams=new ExportParams(title + "鎶ヨ〃", "瀵煎嚭浜�:" + sysUser.getRealname(), title); + exportParams.setImageBasePath(upLoadPath); + //update-end--Author:liusq Date:20210126 for锛氬浘鐗囧鍑烘姤閿欙紝ImageBasePath鏈缃�---------------------- + mv.addObject(NormalExcelConstants.PARAMS,exportParams); + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); + return mv; + } } -- Gitblit v1.9.3