修改master Entity

master
zengwh 3 years ago
parent b4fa323cc8
commit d584266629

@ -89,7 +89,7 @@ public class ArchiveMaster {
/** /**
* *
*/ */
private Date checkedDoctor; private String checkedDoctor;
/** /**

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.entity.filing.MessageSubordinate; import com.ann.entity.filing.MessageSubordinate;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -42,6 +43,7 @@ public class ScheduledJob implements Job {
List<MessageSubordinate> all = messageSubordinateService.findAllByStatus(0); List<MessageSubordinate> all = messageSubordinateService.findAllByStatus(0);
queueService.doSomething(all); queueService.doSomething(all);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.entity.filing.MessageSubordinate; import com.ann.entity.filing.MessageSubordinate;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -42,6 +43,7 @@ public class ScheduledJob2 implements Job {
List<MessageSubordinate> all = messageSubordinateService.findAllMessageSubordinateByError(); List<MessageSubordinate> all = messageSubordinateService.findAllMessageSubordinateByError();
queueService.doSomethingByError(all); queueService.doSomethingByError(all);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -6,6 +6,7 @@ import com.ann.service.ArchiveMasterService;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.GenerateService; import com.ann.service.impl.GenerateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -44,6 +45,7 @@ public class ScheduledJob3 implements Job {
QuartzUtils.pauseScheduleJob(scheduler, "group1", "job3"); QuartzUtils.pauseScheduleJob(scheduler, "group1", "job3");
generateService.doSomethingBySendTime(); generateService.doSomethingBySendTime();
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.service.ArchiveMasterService; import com.ann.service.ArchiveMasterService;
import com.ann.service.impl.GenerateService; import com.ann.service.impl.GenerateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -38,6 +39,7 @@ public class ScheduledJob4 implements Job {
QuartzUtils.pauseScheduleJob(scheduler, "group1", "job4"); QuartzUtils.pauseScheduleJob(scheduler, "group1", "job4");
queueService.doSomethingByHIS(); queueService.doSomethingByHIS();
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -1,5 +1,6 @@
package com.ann.job; package com.ann.job;
import com.ann.utils.ExceptionPrintUtil;
import org.quartz.*; import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@ -24,11 +25,16 @@ public class SchedulerAllJob {
* @throws SchedulerException * @throws SchedulerException
*/ */
public void scheduleJobs() throws SchedulerException { public void scheduleJobs() throws SchedulerException {
try {
Scheduler scheduler = schedulerFactoryBean.getScheduler(); Scheduler scheduler = schedulerFactoryBean.getScheduler();
scheduleJob1(scheduler); scheduleJob1(scheduler);
scheduleJob2(scheduler); scheduleJob2(scheduler);
scheduleJob3(scheduler); scheduleJob3(scheduler);
scheduleJob4(scheduler); scheduleJob4(scheduler);
} catch (SchedulerException e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
} }
/** /**

@ -1,12 +1,16 @@
package com.ann.service.impl; package com.ann.service.impl;
import com.ann.entity.interfaceEntity.ArchiveMaster; import com.ann.entity.interfaceEntity.ArchiveMaster;
import com.ann.job.ScheduledJob;
import com.ann.service.ArchiveMasterService; import com.ann.service.ArchiveMasterService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.WebServiceUtils; import com.ann.utils.WebServiceUtils;
import org.dom4j.Attribute; import org.dom4j.Attribute;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,6 +24,7 @@ import java.util.List;
*/ */
@Component @Component
public class GenerateService { public class GenerateService {
static final Logger logger = LoggerFactory.getLogger(GenerateService.class);
@Autowired @Autowired
ArchiveMasterService archiveMasterService; ArchiveMasterService archiveMasterService;
@ -36,7 +41,8 @@ public class GenerateService {
GenerateService.cancelSignContent = cancelSignContent; GenerateService.cancelSignContent = cancelSignContent;
} }
public void doSomethingBySendTime() throws Exception{ public void doSomethingBySendTime(){
try {
List<ArchiveMaster> all = archiveMasterService.findArchiveMasterBySendTime(); List<ArchiveMaster> all = archiveMasterService.findArchiveMasterBySendTime();
for (ArchiveMaster archiveMaster: all) { for (ArchiveMaster archiveMaster: all) {
if(archiveMaster != null){ if(archiveMaster != null){
@ -82,6 +88,11 @@ public class GenerateService {
archiveMasterService.updateSendTime(archiveMaster.getId(), null,1); archiveMasterService.updateSendTime(archiveMaster.getId(), null,1);
} }
} }
} catch (Exception e) {
logger.error("签收业务出错了");
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
} }
} }

@ -0,0 +1,40 @@
package com.ann.utils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2020/8/4 14:18
* @UpdateUser:
* @UpdateDate: 2020/8/4 14:18
* @UpdateRemark:
* @Version: 1.0
*/
public class ExceptionPrintUtil {
private static Logger log = LogManager.getLogger(ExceptionPrintUtil.class);
public static void printException(Exception e){
//方法名
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
log.error(exception);
try {
baos.flush();
baos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
Loading…
Cancel
Save