|
@@ -1,16 +1,24 @@
|
|
|
package com.sxtvs.open.api.h5template.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+
|
|
|
import com.sxtvs.open.api.h5template.entity.H5Operate;
|
|
|
-import com.sxtvs.open.api.h5template.entity.H5OperateForm;
|
|
|
-import com.sxtvs.open.api.h5template.entity.H5Template;
|
|
|
import com.sxtvs.open.api.h5template.mapper.H5OperateMapper;
|
|
|
import com.sxtvs.open.api.h5template.service.IH5OperateService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.sxtvs.open.core.sls.AliyunLogger;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.net.URI;
|
|
|
+
|
|
|
+import java.net.http.HttpClient;
|
|
|
+import java.net.http.HttpRequest;
|
|
|
+import java.net.http.HttpResponse;
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
/**
|
|
@@ -27,6 +35,15 @@ public class H5OperateServiceImpl extends ServiceImpl<H5OperateMapper, H5Operate
|
|
|
@Resource
|
|
|
private H5OperateFormServiceImpl h5OperateFormService;
|
|
|
|
|
|
+ @Value("${build.url}")
|
|
|
+ private String buildUrl;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AliyunLogger logger;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StringRedisTemplate redisTemplate;
|
|
|
+
|
|
|
@Transactional
|
|
|
public void store(H5Operate h5Operate){
|
|
|
h5Operate.setH5Status(0);
|
|
@@ -40,6 +57,9 @@ public class H5OperateServiceImpl extends ServiceImpl<H5OperateMapper, H5Operate
|
|
|
h5OperateFormService.store(h5Operate);
|
|
|
save(h5Operate);
|
|
|
}
|
|
|
+
|
|
|
+ //通知编译
|
|
|
+ this.syncGet(buildUrl);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -48,6 +68,24 @@ public class H5OperateServiceImpl extends ServiceImpl<H5OperateMapper, H5Operate
|
|
|
h5Operate.setUpdateTime(LocalDateTime.now());
|
|
|
h5OperateFormService.update(h5Operate);
|
|
|
updateById(h5Operate);
|
|
|
+ //通知编译
|
|
|
+ this.syncGet(buildUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void syncGet(String url){
|
|
|
+ new Thread(() -> {
|
|
|
+ HttpClient client = HttpClient.newHttpClient();
|
|
|
+ HttpRequest request = HttpRequest.newBuilder()
|
|
|
+ .uri(URI.create(url))
|
|
|
+ .build();
|
|
|
+ client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
|
|
+ .thenApply(HttpResponse::body)
|
|
|
+ .thenAccept(s -> {
|
|
|
+ logger.info("build", s);
|
|
|
+ })
|
|
|
+ .join();
|
|
|
+ }).start();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|