定時任務的xml:
com.boco.auto.AutoIPV6BusinessAlarmStatisticsReport
0 30 3 * * ?
Spring注入:
class="com.boco.web.struts.action.report.ReportCommonActionPipeRes"
parent="baseAction">
<!-- add liuhuipeng -->
class="com.boco.alarm.service.impl.VendorFaultReportServiceImpl">
定時任務:
public class AutoAlarmStatisticsReport implements Job{
static Logger logger = Logger.getLogger(AutoAlarmStatisticsReport.class) ;
private ReportCommonActionPipeRes pipeResAction;
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
logger.info("+++進入定時任務。+++");
generateReport();
}
public void generateReport(){
logger.info("modelName=AlarmStatistics");
pipeResAction = (ReportCommonActionPipeRes)StartupApp.getInstance().
getAppContext().getBean("reportpiperesource");
String modelName = "IPV6BusinessAlarmStatistics";
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String today = sdf.format(date);
this.pipeResAction.insertBusinessNEStatistics(modelName);
//insertBusinessNEStatistics(modelName);
}
}
調用此方法:
public boolean insertBusinessNEStatistics(String modelName){
boolean isOk = false;
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String createDate = sdf.format(date);
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date datestart = new Date();
String startDateString="";
startDateString= sdf1.format(datestart);
List Allist = new ArrayList();
String informixSql = statementManagementBean.getStatementByName(modelName.trim());
Map parameterMap = new HashMap();
if((null == informixSql)||informixSql.equalsIgnoreCase("no such table")){
return isOk;
}else{
String[] sql_Array = informixSql.split(";");
List<Map> dataList = new ArrayList<Map>();
for(String sql : sql_Array){
if(sql != null && sql.trim().length() > 0){
if(modelName.equalsIgnoreCase("AlarmStatistics")){
String procName = "{call pro_alarm_trans_counteveryday()}";
boolean isInsertflag= false;
//測試:
isInsertflag = true;
// try {
// isInsertflag = vendorfaultService.insertIPV6AlarmCount(procName);
// logger.info("++獲得告警標識:++"+isInsertflag);
// } catch (Exception e) {
// TODO: handle exception
// logger.error("error 錯誤的信息", e);
// }
if(isInsertflag == true){
try{
dataList = vendorfaultService.queyAlarm(parameterMap, sql.trim(), false);
}catch(Throwable t){
logger.error("error 錯誤的信息", t);
}
}else{
return isInsertflag;
}
}else{
//dataList = reportCommonDao.commonQuery(sql.trim(), parameterMap);
dataList = reportCommonDao.commonQuery(sql.trim(), parameterMap);
}
}
}
isOk = true;
}
return isOk;
}
自己找到了,原來這裡面是雙配置。自己就注入了一個。