|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EmailSpringUtil emailSpringUtil; | 
|---|
|  |  |  | @XxlJob("emilTask") | 
|---|
|  |  |  | public ReturnT emilTask()throws IOException { | 
|---|
|  |  |  | public void emilTask()throws IOException { | 
|---|
|  |  |  | String startTime = DateUtils.dateToDateString(DateUtils.addDays(new Date(),-1),DateUtils.yyyy_MM_dd_EN); | 
|---|
|  |  |  | List<DeviceExcelDTO> list = deviceService.ListDeviceExcel(startTime,null,72); | 
|---|
|  |  |  | String path = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | log.error(String.format("生成excel失败,原因:%s",e)); | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|---|
|  |  |  | } catch (MessagingException e) { | 
|---|
|  |  |  | log.error(String.format("邮件发送失败,原因:%s",e)); | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|---|
|  |  |  | }finally { | 
|---|
|  |  |  | if(out != null){ | 
|---|
|  |  |  | out.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ReturnT.SUCCESS; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("邮件发送成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|