|
@@ -1,19 +1,35 @@
|
|
|
package com.fdkankan.modeling;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
+import com.fdkankan.modeling.constants.SysConstants;
|
|
|
+import com.fdkankan.modeling.entity.BuildLog;
|
|
|
+import com.fdkankan.modeling.service.IBuildLogService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@SpringBootApplication
|
|
|
@EnableScheduling
|
|
|
@ComponentScan(basePackages = {"com.fdkankan.*"})
|
|
|
@MapperScan("com.fdkankan.**.mapper")
|
|
|
@EnableDiscoveryClient
|
|
|
-public class ModelingApplication {
|
|
|
+@Slf4j
|
|
|
+public class ModelingApplication implements CommandLineRunner {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBuildLogService buildLogService;
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
@@ -24,4 +40,23 @@ public class ModelingApplication {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void run(String... args) throws Exception {
|
|
|
+
|
|
|
+// String lockPath = null;
|
|
|
+// try {
|
|
|
+// if(StrUtil.isNotEmpty(SysConstants.hostName)){
|
|
|
+// List<BuildLog> list = buildLogService.list(new LambdaQueryWrapper<BuildLog>().eq(BuildLog::getHostName, SysConstants.hostName).eq(BuildLog::getStatus, 0).orderByDesc(BuildLog::getId));
|
|
|
+// if(CollUtil.isNotEmpty(list)){
|
|
|
+// BuildLog buildLog = list.get(0);
|
|
|
+// lockPath = buildLog.getDataSource() + "/.lockdirectory";
|
|
|
+// if(FileUtil.exist(lockPath)){
|
|
|
+// FileUtil.del(lockPath);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }catch (Exception e){
|
|
|
+// log.warn("删除上一计算中场景文件锁失败,logPath:{}", lockPath, e);
|
|
|
+// }
|
|
|
+ }
|
|
|
}
|