| | |
| | | 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导入数据 |
| | |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle(headInfo); |
| | | messageDTO.setFromUser("数据导入小助手-小导"); |
| | | messageDTO.setCategory("导入操作附加信息"); |
| | | messageDTO.setCategory("导入信息"); |
| | | messageDTO.setContent(exceptionInfo); |
| | | messageDTO.setToUser(user.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | // QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>(); |
| | | String num = equipment.getNum(); |
| | | if(StringUtils.isNotBlank(num)){ |
| | | queryWrapper.like("num",num); |
| | | } |
| | | String name = equipment.getName(); |
| | | if(StringUtils.isNotBlank(name)){ |
| | | queryWrapper.like("name",name); |
| | | } |
| | | String workCenterId = equipment.getWorkCenterId(); |
| | | if(StringUtils.isNotBlank(workCenterId)){ |
| | | queryWrapper.eq("work_center_id",workCenterId); |
| | | } |
| | | //根据下次三保时间排序 |
| | | queryWrapper.orderByAsc("next_third_maintenance_time"); |
| | | |
| | | //如果startTime和endTime不为空,则查询下次三保时间在这个时间段内的设备 |
| | | if(equipment.getStartTime()!=null && equipment.getEndTime()!=null){ |
| | | queryWrapper.between("next_third_maintenance_time",equipment.getStartTime(),equipment.getEndTime()); |
| | | } |
| | | queryWrapper.orderByAsc("next_third_maintenance_time"); |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |