Browse Source

四维深巡

dengsixing 4 tháng trước cách đây
mục cha
commit
2647607fda
1 tập tin đã thay đổi với 10 bổ sung7 xóa
  1. 10 7
      src/main/java/com/fdkankan/modeling/ModelingApplication.java

+ 10 - 7
src/main/java/com/fdkankan/modeling/ModelingApplication.java

@@ -14,6 +14,7 @@ import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -41,6 +42,9 @@ public class ModelingApplication implements CommandLineRunner {
 	@Resource
 	private RedisLockUtil redisLockUtil;
 
+	@Value("${spring.profiles.active:#{null}}")
+	private String profiles;
+
 	@Autowired(required = false)
 	private Optional<FYunFileServiceInterface> fYunFileService;
 
@@ -56,15 +60,14 @@ public class ModelingApplication implements CommandLineRunner {
 	@Override
 	public void run(String... args) throws Exception {
 
-		String path = System.getProperty("java.class.path");
-		System.out.println(path);
-
 		log.info("fYunFileService.isPresent():{}", fYunFileService.isPresent());
-		if(fYunFileService.isPresent()){
+		if(fYunFileService.isPresent() && StrUtil.isNotEmpty(profiles)){
 			//更新弹性伸缩jar包
-//			boolean lock = redisLockUtil.lock("uploadModelingJar", 300);
-//			if(lock){
-//			}
+			boolean lock = redisLockUtil.lock("uploadModelingJar", 300);
+			if(lock){
+				String jarPath = System.getProperty("java.class.path");
+				fYunFileService.get().uploadFile(jarPath, "elastic_model_jar/" + profiles + "/" + FileUtil.getName(jarPath));
+			}
 		}
 
 	}