12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.platform.iec;
- import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
- import com.platform.iec.master.MasterSysDataHandler;
- import com.ydl.iec.iec104.config.Iec104Config;
- import com.ydl.iec.iec104.server.Iec104MasterFactory;
- import com.ydl.iec.util.Iec104Util;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.boot.CommandLineRunner;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
- import java.util.TimeZone;
- /**
- * @Description
- * @Author chenli
- * @Date 2019/7/22
- * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
- */
- @SpringBootApplication(scanBasePackages = {"com.platform"}, exclude = {
- DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
- @Slf4j
- public class IecApplication implements CommandLineRunner {
- public static void main(String[] args) {
- TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
- SpringApplication.run(IecApplication.class, args);
- }
- @Override
- public void run(String... args) throws Exception {
- log.info("启动主服务,监听iec……………………………………");
- Iec104Config iec104Config = new Iec104Config();
- iec104Config.setFrameAmountMax((short) 1);
- iec104Config.setTerminnalAddress((short) 1);
- Iec104MasterFactory.createTcpClientMaster(Iec104Util.host, Iec104Util.port).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run();
- Thread.sleep(1000000);
- }
- /**
- * 每小时,五分钟
- * {秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
- */
- // @Scheduled(cron = "0 */1 * * * ?")
- /* private void configureTasks() {
- log.info("执行总召唤");
- Iec104ThreadLocal.getScheduledTaskPool().sendStartFrame();
- Iec104ThreadLocal.getScheduledTaskPool().sendGeneralCall();
- log.info("执行总召唤,定时任务时间: " + LocalDateTime.now());
- }*/
- }
|