|
@@ -15,20 +15,18 @@ import com.fdkankan.contro.entity.SceneFileBuild;
|
|
|
import com.fdkankan.contro.entity.SceneFilename;
|
|
|
import com.fdkankan.contro.entity.SceneOrigBd;
|
|
|
import com.fdkankan.contro.entity.ScenePlus;
|
|
|
+import com.fdkankan.contro.httpclient.MjHttpClient;
|
|
|
import com.fdkankan.contro.service.*;
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.local.constant.LocalConstants;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
|
-import com.fdkankan.web.util.RSAEncrypt;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.codec.binary.Base64;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
@@ -47,6 +45,8 @@ public class MjServiceImpl implements MjService {
|
|
|
private IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
private ISceneFilenameService sceneFilenameService;
|
|
|
+ @Resource
|
|
|
+ private MjHttpClient mjHttpClient;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -54,7 +54,7 @@ public class MjServiceImpl implements MjService {
|
|
|
|
|
|
List<SceneOrigBd> list = sceneOrigBdService.list(new LambdaQueryWrapper<SceneOrigBd>().eq(SceneOrigBd::getStatus, CommonSuccessStatus.WAITING.code()));
|
|
|
|
|
|
- if(CollUtil.isEmpty(list)){
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
for (SceneOrigBd v : list) {
|
|
@@ -66,15 +66,15 @@ public class MjServiceImpl implements MjService {
|
|
|
|
|
|
ScenePlus scenePlus = null;
|
|
|
List<SceneFilename> SceneFilenames = sceneFilenameService.list(new LambdaQueryWrapper<SceneFilename>().eq(SceneFilename::getUnicode, unicode));
|
|
|
- if(CollUtil.isNotEmpty(SceneFilenames)){
|
|
|
+ if (CollUtil.isNotEmpty(SceneFilenames)) {
|
|
|
String num = SceneFilenames.get(0).getNum();
|
|
|
- if(StrUtil.isNotEmpty(num)){
|
|
|
+ if (StrUtil.isNotEmpty(num)) {
|
|
|
scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//如果场景正在计算,跳过,等待下一次定时任务进入时在进行处理
|
|
|
- if(Objects.nonNull(scenePlus) && scenePlus.getSceneStatus() == SceneStatus.wait.code()){
|
|
|
+ if (Objects.nonNull(scenePlus) && scenePlus.getSceneStatus() == SceneStatus.wait.code()) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -93,8 +93,8 @@ public class MjServiceImpl implements MjService {
|
|
|
|
|
|
SceneFileBuild sceneFileBuild = sceneFileBuildService.getOne(new LambdaQueryWrapper<SceneFileBuild>().eq(SceneFileBuild::getUnicode, unicode));
|
|
|
String fileId = null;
|
|
|
- if(Objects.isNull(sceneFileBuild)){
|
|
|
- fileId = String.valueOf(new SnowflakeIdGenerator(0,0).nextId());
|
|
|
+ if (Objects.isNull(sceneFileBuild)) {
|
|
|
+ fileId = String.valueOf(new SnowflakeIdGenerator(0, 0).nextId());
|
|
|
sceneFileBuild = new SceneFileBuild();
|
|
|
sceneFileBuild.setFileId(fileId);
|
|
|
sceneFileBuild.setUnicode(unicode);
|
|
@@ -102,17 +102,17 @@ public class MjServiceImpl implements MjService {
|
|
|
sceneFileBuild.setCreateTime(new Date());
|
|
|
sceneFileBuild.setRecStatus(RecStatus.VALID.code());
|
|
|
sceneFileBuildService.save(sceneFileBuild);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
fileId = sceneFileBuild.getFileId();
|
|
|
}
|
|
|
- String realDataSource = ConstantFilePath.BUILD_MODEL_PATH + snCode + "/" + fileId + "/" + unicode;
|
|
|
+ String realDataSource = ConstantFilePath.BUILD_MODEL_PATH + snCode + "/" + fileId + "/" + unicode;
|
|
|
String realOssHomePath = SceneUtil.getHomePath(realDataSource);
|
|
|
String realOssHomeAbsolutePath = LocalConstants.BASE_PATH + fYunFileConfig.getBucket() + "/" + realOssHomePath;
|
|
|
FileUtil.loopFiles(zipDir).stream().forEach(file -> {
|
|
|
- FileUtil.copy(file.getAbsolutePath(), file.getAbsolutePath().replace(zipDir, realOssHomeAbsolutePath), true);
|
|
|
+ FileUtil.copy(file.getAbsolutePath(), file.getAbsolutePath().replace(zipDir, realOssHomeAbsolutePath), true);
|
|
|
});
|
|
|
|
|
|
- sceneFileBuildService.noticeBuild(unicode, filename);
|
|
|
+ sceneFileBuildService.noticeBuild(unicode, filename, realDataSource);
|
|
|
v.setStatus(CommonSuccessStatus.SUCCESS.code());
|
|
|
} catch (Exception e) {
|
|
|
v.setStatus(CommonSuccessStatus.FAIL.code());
|
|
@@ -121,17 +121,13 @@ public class MjServiceImpl implements MjService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
- String paramsStr = "90d95cdb5#1111#333#90d95cdb5_20250115175933#123";
|
|
|
- byte[] res = RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()),
|
|
|
- paramsStr.getBytes(StandardCharsets.UTF_8));
|
|
|
- System.out.println(new Base64().encodeToString(res));
|
|
|
-
|
|
|
- byte[] res2 = RSAEncrypt.decrypt(RSAEncrypt.loadPrivateKeyByStr(RSAEncrypt.loadPrivateKeyByFile()),
|
|
|
- new Base64().decode(new Base64().encodeToString(res)));
|
|
|
- String restr = new String(res2, "UTF-8");
|
|
|
- System.out.println(restr);
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public void distributeDetailDone(String status, String filename) {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("data", status);
|
|
|
+ param.put("filename", filename);
|
|
|
+ mjHttpClient.done(param);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|