|
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.common.constant.SceneConstant;
|
|
|
+import com.fdkankan.common.constant.SceneKind;
|
|
|
import com.fdkankan.common.constant.SceneVersionType;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
@@ -21,6 +23,7 @@ import com.fdkankan.manage_jp.entity.*;
|
|
|
import com.fdkankan.manage_jp.exception.BusinessException;
|
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.mapper.ISceneProMapper;
|
|
|
+import com.fdkankan.manage_jp.mapper.ISceneUpgradeMapper;
|
|
|
import com.fdkankan.manage_jp.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage_jp.util.GenerateNumUtil;
|
|
@@ -28,6 +31,8 @@ import com.fdkankan.manage_jp.util.SceneResourcePath;
|
|
|
import com.fdkankan.manage_jp.util.SnowflakeIdGenerator;
|
|
|
import com.fdkankan.manage_jp.vo.request.SceneParam;
|
|
|
import com.fdkankan.manage_jp.vo.response.SceneVo;
|
|
|
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -35,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.util.*;
|
|
@@ -78,6 +84,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
IUserRoleService userRoleService;
|
|
|
@Autowired
|
|
|
ITmColdStorageService tmColdStorageService;
|
|
|
+ @Autowired
|
|
|
+ private RabbitMqProducer mqProducer;
|
|
|
+ @Value("${queue.modeling.obj.modeling-pre}")
|
|
|
+ private String queueObjModelingPre;
|
|
|
+ @Autowired
|
|
|
+ private ISceneUpgradeMapper sceneUpgradeMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Long getCountByUserIds(List<Long> userIds) {
|
|
@@ -298,4 +311,76 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
updateWrapper.set(ScenePro::getLaserTitle,sceneNewTitle);
|
|
|
this.update(updateWrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void generateObjFile(String num) {
|
|
|
+
|
|
|
+ ScenePro sceneProEntity = this.getByNum(num);
|
|
|
+ ScenePlus scenePlusEntity = scenePlusService.getByNum(num);
|
|
|
+ if(ObjectUtils.isEmpty(sceneProEntity) && ObjectUtils.isEmpty(scenePlusEntity)){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIT);
|
|
|
+ }
|
|
|
+ laserService.updateBuildObjStatus(num,2);
|
|
|
+
|
|
|
+ Integer sceneSource = sceneProEntity == null ? scenePlusEntity.getSceneSource() : sceneProEntity.getSceneSource();
|
|
|
+ if(sceneSource != 4){
|
|
|
+ throw new BusinessException(ResultCode.GENERATE_OBJ_ERROR_TYPE);
|
|
|
+ }
|
|
|
+ String path = null;
|
|
|
+ ScenePlusExt scenePlusExt = null;
|
|
|
+ if(scenePlusEntity != null){
|
|
|
+ scenePlusExt = scenePlusExtService.getByPlusId(scenePlusEntity.getId());
|
|
|
+ if(scenePlusExt == null){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_ERROR);
|
|
|
+ }
|
|
|
+ path = scenePlusExt.getDataSource();
|
|
|
+ }else {
|
|
|
+ path = sceneProEntity.getDataSource();
|
|
|
+ }
|
|
|
+ String ossPath = path.replace("/mnt/data","home")+"/data.fdage";
|
|
|
+ if(!fYunFileServiceInterface.fileExist(ossPath)){
|
|
|
+ throw new BusinessException(ResultCode.GENERATE_OBJ_ERROR);
|
|
|
+ }
|
|
|
+ // 获取最新的场景名称
|
|
|
+ JSONObject sceneInfo = laserService.getSceneByNum(num);
|
|
|
+ if(sceneProEntity == null){
|
|
|
+ sendMqMsg(num,scenePlusExt.getAlgorithm(),scenePlusExt.getBuildType(),scenePlusExt.getDataSource());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper
|
|
|
+ .set(ScenePro::getStatus, 0)
|
|
|
+ .set(ScenePro::getIsObj, 1)
|
|
|
+ .set(ScenePro::getIsUpgrade, 2) // 升级中
|
|
|
+ .set(ScenePro::getSceneName, sceneInfo.getString("title"))
|
|
|
+ .eq(ScenePro::getNum, sceneProEntity.getNum());
|
|
|
+ this.update(updateWrapper);
|
|
|
+
|
|
|
+ //同步到scenePlus、scenePlus
|
|
|
+ //同步到scenePlus、scenePlus
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+ if(Objects.nonNull(scenePlus)){
|
|
|
+ sceneUpgradeMapper.deleteScenePlus(num);
|
|
|
+ sceneUpgradeMapper.deleteScenePlusExt(scenePlus.getId());
|
|
|
+ }
|
|
|
+ sceneUpgradeMapper.transferScenePlus(num);
|
|
|
+ scenePlus = scenePlusService.getByNum(num);
|
|
|
+ String sceneKind = sceneProEntity.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
|
|
|
+ sceneUpgradeMapper.transferScenePlusExt(num, scenePlus.getId(), sceneKind);
|
|
|
+
|
|
|
+ sendMqMsg(sceneProEntity.getNum(),sceneProEntity.getAlgorithm(),sceneProEntity.getBuildType(),sceneProEntity.getDataSource());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void sendMqMsg(String num ,String algorithm,String buildType,String dataSource) {
|
|
|
+ log.info("开始发送激光场景生成obj mq消息");
|
|
|
+ // 发送MQ
|
|
|
+ BuildSceneCallMessage mqMsg = new BuildSceneCallMessage();
|
|
|
+ mqMsg.setSceneNum(num);
|
|
|
+ mqMsg.setAlgorithm(algorithm);
|
|
|
+ mqMsg.setBuildType(buildType);
|
|
|
+ mqMsg.setPath(dataSource);
|
|
|
+ mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
|
|
|
+ }
|
|
|
}
|