|
@@ -16,6 +16,7 @@ import com.fdkankan.manage.httpClient.param.WorkOfflineDTO;
|
|
|
import com.fdkankan.manage.httpClient.vo.OverallParam;
|
|
|
import com.fdkankan.manage.httpClient.vo.OverallVo;
|
|
|
import com.fdkankan.manage.service.IDownService;
|
|
|
+import com.fdkankan.manage.task.ThreadService;
|
|
|
import com.fdkankan.manage.vo.response.DownVo;
|
|
|
import com.fdkankan.manage.vo.response.DownloadProcessVo;
|
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
@@ -31,20 +32,18 @@ import org.springframework.stereotype.Service;
|
|
|
@Slf4j
|
|
|
public class OverallService {
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
OverallClient overallClient;
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
RabbitMqProducer rabbitMqProducer;
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
IDownService downService;
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
FyunConfig fyunConfig;
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ @Lazy
|
|
|
+ ThreadService threadService;
|
|
|
|
|
|
private static String appId ="BDA385EC848C1A425F746869011C8D23";
|
|
|
private static String key ="appId";
|
|
@@ -75,7 +74,7 @@ public class OverallService {
|
|
|
String jsonString = JSONObject.toJSONString(data);
|
|
|
WorkOfflineDTO dto = JSONObject.parseObject(jsonString,WorkOfflineDTO.class);
|
|
|
redisUtil.set(redisKey,jsonString,RedisKeyUtil.overallDownOfflineProgressKeyTime);
|
|
|
- run(dto,redisKey);
|
|
|
+ threadService.overallDownScene(dto,redisKey);
|
|
|
return dto;
|
|
|
}catch (Exception e){
|
|
|
log.info("全景看看访问失败:{}",e);
|
|
@@ -84,42 +83,7 @@ public class OverallService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void downScene(String downloadUrl, String path) {
|
|
|
- ShellUtil.yunDownload(downloadUrl.replace(fyunConfig.getFyunHost(), ""),path +"/mesh");
|
|
|
- }
|
|
|
|
|
|
- @Async
|
|
|
- public void run(WorkOfflineDTO dto,String redisKey){
|
|
|
- try {
|
|
|
- if(dto.getSceneCodes() != null && !dto.getSceneCodes().isEmpty()){ //下载场景mesh离线包
|
|
|
- for (String sceneCode : dto.getSceneCodes()) {
|
|
|
- log.info("下载mesh场景:{}",sceneCode);
|
|
|
- DownVo downVo = downService.checkDownLoad(sceneCode, 1);
|
|
|
- if(downVo.getDownloadStatus() == 3 && StringUtils.isNotBlank(downVo.getDownloadUrl())){
|
|
|
- downScene(downVo.getDownloadUrl(),dto.getPath());
|
|
|
- }else {
|
|
|
- DownVo down = downService.down(sceneCode, 1);
|
|
|
- if(down.getDownloadStatus() == 1){
|
|
|
- DownloadProcessVo downloadProcessVo = downService.downloadProcess(sceneCode, 1);
|
|
|
- if(downloadProcessVo.getStatus() == 1003){
|
|
|
- log.info("下载场景失败:{}",sceneCode);
|
|
|
- throw new BusinessException(ResultCode.DOWN_SCENE_ERROR);
|
|
|
- }
|
|
|
- while (downloadProcessVo.getStatus() != 1002 ){
|
|
|
- downloadProcessVo = downService.downloadProcess(sceneCode, 1);
|
|
|
- Thread.sleep(2000L);
|
|
|
- }
|
|
|
- downScene(downloadProcessVo.getUrl(),dto.getPath());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- dto.setProgress(50);
|
|
|
- redisUtil.set(redisKey,JSONObject.toJSONString(dto),RedisKeyUtil.overallDownOfflineProgressKeyTime);
|
|
|
- rabbitMqProducer.sendByWorkQueue("qjkk-work-offline", BeanUtil.beanToMap(dto));
|
|
|
- }catch (Exception e){
|
|
|
- log.info("执行失败:{}",e);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
+
|
|
|
}
|