| | |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.base.entity.Constructor; |
| | | import org.jeecg.modules.base.service.IConstructorService; |
| | | import org.jeecg.modules.base.service.IFactoryModelService; |
| | |
| | | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | |
| | | import org.jeecg.modules.eam.vo.EquipmentExportVo; |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | 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.*; |
| | |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Value("${jeecg.path.upload}") |
| | | private String upLoadPath; |
| | | |
| | | |
| | | /** |
| | |
| | | public ModelAndView exportXls(HttpServletRequest request, Equipment equipment) { |
| | | return super.exportXls(request, equipment, Equipment.class, "设备台账导出"); |
| | | } |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param equipment |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:exportXls") |
| | | @RequestMapping(value = "/exportXlsNew") |
| | | public ModelAndView exportXlsNew(HttpServletRequest request, Equipment equipment) { |
| | | // Step.1 组装查询条件 |
| | | // QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap()); |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | // 过滤选中数据 |
| | | // String selections = request.getParameter("selections"); |
| | | // if (oConvertUtils.isNotEmpty(selections)) { |
| | | // List<String> selectionList = Arrays.asList(selections.split(",")); |
| | | // queryWrapper.in("id",selectionList); |
| | | // } |
| | | // // Step.2 获取导出数据 |
| | | // List<T> exportList = service.list(queryWrapper); |
| | | |
| | | List<Map<String, Object>> mapList = equipmentService.exportXlsNew(); |
| | | |
| | | // Step.3 AutoPoi 导出Excel |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | //此处设置的filename无效 ,前端会重更新设置一下 |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "设备台账导出"); |
| | | mv.addObject(NormalExcelConstants.CLASS, EquipmentExportVo.class); |
| | | //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置-------------------- |
| | | ExportParams exportParams=new ExportParams("设备台账导出" + "报表", "导出人:" + sysUser.getRealname(), "设备台账导出"); |
| | | exportParams.setImageBasePath(upLoadPath); |
| | | //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置---------------------- |
| | | mv.addObject(NormalExcelConstants.PARAMS,exportParams); |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mapList); |
| | | return mv; |
| | | } |
| | | |
| | | // /** |
| | | // * 通过excel导入数据 |