添加runner ,启动时发送获取日航班计划的消息
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.gzzn.omms.msgexchangeapi.runner;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
|
||||
import com.gzzn.omms.msgexchangeapi.dao.CmoutmsgDao;
|
||||
import com.gzzn.omms.msgexchangeapi.entiy.Cmoutmsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entiy.msg.rqfd.RefdMsg;
|
||||
import com.gzzn.omms.msgexchangeapi.entiy.msg.rqfd.RefdMsgBody;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.DateTimeUtil;
|
||||
|
||||
|
||||
public class AppRunner implements CommandLineRunner {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(AppRunner.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private CmoutmsgDao cmoutmsgDao;
|
||||
|
||||
@Autowired
|
||||
private IExchangeService exchangeService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
Cmoutmsg cmoutmsg = new Cmoutmsg();
|
||||
|
||||
|
||||
RefdMsgBody body = new RefdMsgBody();
|
||||
body.setStdb(
|
||||
DateTimeUtil.gtFormatStr(
|
||||
new Date(),
|
||||
"ddMMMyyHHmm",
|
||||
Locale.ENGLISH)
|
||||
.toUpperCase()
|
||||
);
|
||||
RefdMsg msg = new RefdMsg();
|
||||
msg.setRefd(body);
|
||||
|
||||
|
||||
cmoutmsg.setCminmsgsClobMsg(exchangeService.objectToXmlstr(msg));
|
||||
cmoutmsg.setCminmsgsStatus("VALID");
|
||||
|
||||
cmoutmsgDao.save(cmoutmsg);
|
||||
}//end function run
|
||||
}
|
||||
Reference in New Issue
Block a user