dengsixing пре 1 месец
родитељ
комит
36ed65c4aa

+ 43 - 0
src/main/java/com/fdkankan/scene/constant/BoxModelType.java

@@ -0,0 +1,43 @@
+package com.fdkankan.scene.constant;
+
+import com.fdkankan.common.constant.InvoiceType;
+
+/**
+ * 空间三维模型类型
+ */
+public enum BoxModelType {
+
+    //upload-上传 draw-手绘 library-模型库
+    UPLOAD("upload", "上传"),
+    DRAW("draw", "手绘"),
+    LIBRARY("library", "模型库");
+
+    private String code;
+    private String message;
+
+    private BoxModelType(String code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public String code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public static BoxModelType get(String code){
+        BoxModelType[] values = BoxModelType.values();
+        String enumValue = null;
+        for(BoxModelType eachValue : values){
+            enumValue = eachValue.code();
+            if(enumValue.equals(code)){
+                return eachValue;
+            }
+        }
+        return null;
+    }
+
+}

+ 27 - 0
src/main/java/com/fdkankan/scene/constant/NjsErrorCode.java

@@ -0,0 +1,27 @@
+package com.fdkankan.scene.constant;
+
+public enum NjsErrorCode {
+    NOT_EXISTS(20000, "数据不存在或已被删除"),
+    TRANSFING(20001, "转换中,不允许修改"),
+
+    ;
+    private Integer code;
+    private String message;
+
+    private NjsErrorCode(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return this.code;
+    }
+
+    public String message() {
+        return this.message;
+    }
+
+    public String formatMessage(Object... args) {
+        return String.format(this.message, args);
+    }
+}

+ 33 - 0
src/main/java/com/fdkankan/scene/controller/NjsSceneBoxModelController.java

@@ -1,9 +1,13 @@
 package com.fdkankan.scene.controller;
 
 
+import com.fdkankan.scene.dto.NjsBoxModelDTO;
 import com.fdkankan.scene.dto.SaveBoxModelDTO;
 import com.fdkankan.scene.mapper.INjsSceneBoxModelMapper;
 import com.fdkankan.scene.service.INjsSceneBoxModelService;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.BathUpdateNjsBoxModelParamVO;
+import com.fdkankan.scene.vo.DeleteSidListParamVO;
 import com.fdkankan.web.response.ResultData;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -13,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
 
 /**
  * <p>
@@ -35,6 +41,33 @@ public class NjsSceneBoxModelController {
         return ResultData.ok();
     }
 
+    @PostMapping("list")
+    public ResultData<List<NjsBoxModelDTO>> list(@RequestBody @Valid BaseSceneParamVO param){
+        return ResultData.ok(sceneBoxModelService.listNjsBoxModel(param));
+    }
+
+    /**
+     * 批量修改 是否显示或显示尺寸
+     * @param param
+     * @return
+     */
+    @PostMapping("batchDisplay")
+    public ResultData<Void> batchDisplay(@RequestBody @Valid BathUpdateNjsBoxModelParamVO param){
+        sceneBoxModelService.batchDisplay(param);
+        return ResultData.ok();
+    }
+
+    /**
+     * 批量修改 是否显示或显示尺寸
+     * @param param
+     * @return
+     */
+    @PostMapping("batchDelete")
+    public ResultData<Void> batchDelete(@RequestBody @Valid BathUpdateNjsBoxModelParamVO param) throws IOException {
+        sceneBoxModelService.batchDelete(param);
+        return ResultData.ok();
+    }
+
 
 
 

+ 77 - 0
src/main/java/com/fdkankan/scene/dto/NjsBoxModelDTO.java

@@ -0,0 +1,77 @@
+package com.fdkankan.scene.dto;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class NjsBoxModelDTO {
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    private String num;
+
+    /**
+     * json信息
+     */
+    private JSONObject info;
+
+    /**
+     * 模型类型
+     */
+    private String modelType;
+
+    /**
+     * 名称哦
+     */
+    private String modelName;
+
+    /**
+     * 颜色
+     */
+    private String colour;
+
+    /**
+     * 形状
+     */
+    private String shape;
+
+
+    /**
+     * glb存储路径
+     */
+    private String glbKey;
+
+    /**
+     * 状态(-1-失败,0-等待,1-成功)
+     */
+    private Integer status;
+
+    private Integer loaded;
+
+    private Integer display;
+
+    private Integer displaySize;
+
+    private Date createTime;
+
+    //数据来源 mesh  model
+    private String sourceType;
+
+
+
+}

+ 6 - 2
src/main/java/com/fdkankan/scene/dto/SaveBoxModelDTO.java

@@ -4,11 +4,15 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.scene.vo.BaseSceneParamVO;
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
+
 @Data
 public class SaveBoxModelDTO extends BaseSceneParamVO {
 
-    private String key;
-    //upload-上传 draw-手绘
+    private Long id;
+
+    @NotBlank
+    //upload-上传 draw-手绘 library-模型库
     private String modelType;
 
     private String modelName;

+ 17 - 4
src/main/java/com/fdkankan/scene/entity/NjsSceneBoxModel.java

@@ -46,14 +46,14 @@ public class NjsSceneBoxModel implements Serializable {
     /**
      * 模型类型
      */
-    @TableField("obj_type")
-    private String objType;
+    @TableField("model_type")
+    private String modelType;
 
     /**
      * 名称哦
      */
-    @TableField("obj_name")
-    private String objName;
+    @TableField("model_name")
+    private String modelName;
 
     /**
      * 颜色
@@ -98,5 +98,18 @@ public class NjsSceneBoxModel implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    @TableField("display")
+    private Integer display;
+
+    @TableField("display_size")
+    private Integer displaySize;
+
+    @TableField("reason")
+    private String reason;
+
+    @TableField("sid")
+    private String sid;
+
+
 
 }

+ 48 - 0
src/main/java/com/fdkankan/scene/listener/NjsRabbitMqListener.java

@@ -0,0 +1,48 @@
+package com.fdkankan.scene.listener;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.scene.entity.DownloadTourVideo;
+import com.fdkankan.scene.service.INjsSceneBoxModelService;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Component
+public class NjsRabbitMqListener {
+
+    @Autowired
+    private INjsSceneBoxModelService sceneBoxModelService;
+
+    /**
+     * 开启了手动确认模式,如果没有手动确认,消费者不会重试,当服务重启时会再次消费,因为rabbitmq认为你还没有处理完你的业务
+     * queuesToDeclare = @Queue("${queue.modeling.modeling-test}"),  如果队列不不存在会自动创建队列
+     * concurrency = "3"    设置消费线程数,每个线程每次只拉取一条消息消费
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("njs-obj-to-glb"),
+            concurrency = "10"
+    )
+    public void objToGlb(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("OBJ转GLB开始,id:{},content:{}", messageId, msg);
+        JSONObject param = JSON.parseObject(msg);
+        try {
+            sceneBoxModelService.objToGlb(param);
+        } catch (Exception e) {
+            log.error("objToGlb 转换失败", e);
+        }
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+        log.info("OBJ转GLB结束,id:{}", messageId);
+    }
+
+
+}

+ 0 - 1
src/main/java/com/fdkankan/scene/listener/RabbitMqListener.java

@@ -123,5 +123,4 @@ public class RabbitMqListener {
         log.info("去除人像结束,id:{},queue:{},content:{}", messageId, "remove-portrait", msg);
     }
 
-
 }

+ 16 - 0
src/main/java/com/fdkankan/scene/service/INjsSceneBoxModelService.java

@@ -1,10 +1,16 @@
 package com.fdkankan.scene.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.scene.dto.NjsBoxModelDTO;
 import com.fdkankan.scene.dto.SaveBoxModelDTO;
 import com.fdkankan.scene.entity.NjsSceneBoxModel;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.BathUpdateNjsBoxModelParamVO;
 
 import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +23,14 @@ import javax.validation.Valid;
 public interface INjsSceneBoxModelService extends IService<NjsSceneBoxModel> {
 
     void saveBoxModel(@Valid SaveBoxModelDTO dto);
+
+    List<NjsBoxModelDTO> listNjsBoxModel(@Valid BaseSceneParamVO param);
+
+    void batchDisplay(@Valid BathUpdateNjsBoxModelParamVO param);
+
+    void batchDelete(@Valid BathUpdateNjsBoxModelParamVO param) throws IOException;
+
+    void objToGlb(JSONObject param) throws Exception;
+
+    void publicNjsSceneBoxModel(String num) throws IOException;
 }

+ 230 - 5
src/main/java/com/fdkankan/scene/service/impl/NjsSceneBoxModelServiceImpl.java

@@ -1,15 +1,54 @@
 package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.exceptions.ExceptionUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.lang.UUID;
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.DateExtUtil;
+import com.fdkankan.common.util.OBJToGLBUtil;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.ComputerUtil;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.constant.BoxModelType;
+import com.fdkankan.scene.constant.NjsErrorCode;
+import com.fdkankan.scene.dto.NjsBoxModelDTO;
 import com.fdkankan.scene.dto.SaveBoxModelDTO;
 import com.fdkankan.scene.entity.NjsSceneBoxModel;
+import com.fdkankan.scene.entity.SceneEditInfo;
+import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.mapper.INjsSceneBoxModelMapper;
 import com.fdkankan.scene.service.INjsSceneBoxModelService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneEditInfoService;
+import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.BathUpdateNjsBoxModelParamVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.time.Instant;
+import java.util.*;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * NJS-模型编辑器数据表 服务实现类
@@ -18,21 +57,207 @@ import org.springframework.stereotype.Service;
  * @author 
  * @since 2026-01-09
  */
+@Slf4j
 @Service
 public class NjsSceneBoxModelServiceImpl extends ServiceImpl<INjsSceneBoxModelMapper, NjsSceneBoxModel> implements INjsSceneBoxModelService {
 
-    @Override
-    public void saveBoxModel(SaveBoxModelDTO dto) {
+    @Resource
+    private RabbitMqProducer mqProducer;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
 
-        NjsSceneBoxModel bean = BeanUtil.toBean(dto, NjsSceneBoxModel.class);
-        if(dto.getModelType().equals("upload")){
+//    private static Set<Long> TRANSFER_IDS = new HashSet<>();
+//
+//    private static ExecutorService executor = Executors.newFixedThreadPool(10);
+//
+//    /**
+//     * 每隔十分钟拉取一次压缩包
+//     */
+//    @Scheduled(fixedDelay = 60*1000, initialDelay = 1000)
+//    public void transferGlb() {
+//        log.info("推送模型转换开始");
+//        LambdaQueryWrapper<NjsSceneBoxModel> wrapper = new LambdaQueryWrapper<>();
+//        wrapper.in(NjsSceneBoxModel::getStatus, CommonSuccessStatus.WAITING.code());
+//        int limit = 10;
+//        if(!TRANSFER_IDS.isEmpty()){
+//            wrapper.notIn(NjsSceneBoxModel::getId, TRANSFER_IDS);
+//            limit = limit - TRANSFER_IDS.size();
+//        }
+//        wrapper.orderByAsc(NjsSceneBoxModel::getCreateTime);
+//        wrapper.last("limit " + limit);
+//        List<NjsSceneBoxModel> list = this.list(wrapper);
+//        if(list.isEmpty()){
+//            log.info("无数据推送模型转换");
+//            return;
+//        }
+//
+//        List<CompletableFuture<Void>> futures = list.stream()
+//                .map(item -> CompletableFuture.runAsync(
+//                        () -> (item), executor
+//                ))
+//                .toList();
+//
+//        CompletableFuture.allOf(
+//                futures.toArray(new CompletableFuture[0])
+//        ).join();
+//
+//        executor.shutdown();
+//
+//        log.info("推送模型转换结束");
+//    }
+//
+//    private void transferGlb
 
+    @Override
+    public void saveBoxModel(SaveBoxModelDTO dto) {
+        NjsSceneBoxModel bean = null;
+        if(dto.getId() != null){
+            bean = this.getById(dto.getId());
+            if(bean == null){
+                throw new BusinessException(NjsErrorCode.NOT_EXISTS.code(), NjsErrorCode.NOT_EXISTS.message());
+            }
+            if(bean.getStatus().equals(CommonSuccessStatus.WAITING.code())){
+                throw new BusinessException(NjsErrorCode.TRANSFING.code(), NjsErrorCode.TRANSFING.message());
+            }
         }else{
-            bean.setLoaded(CommonStatus.YES.compareTo());
+            bean = BeanUtil.toBean(dto, NjsSceneBoxModel.class);
+        }
+        if(dto.getModelType().equals("draw")){
+            bean.setLoaded(CommonStatus.YES.code().intValue());
             bean.setStatus(CommonSuccessStatus.SUCCESS.code());
         }
         this.save(bean);
 
+        //如果是上转本地obj的方式,需要将obj转glb
+        if(BoxModelType.UPLOAD.code().equals(dto.getModelType())){
+            JSONObject content = new JSONObject();
+            content.put("id", bean.getId());
+            mqProducer.sendByWorkQueue("njs-obj-to-glb", content);
+        }
+    }
+
+
+    @Override
+    public List<NjsBoxModelDTO> listNjsBoxModel(BaseSceneParamVO param) {
+        List<NjsSceneBoxModel> list = lambdaQuery().eq(NjsSceneBoxModel::getNum, param.getNum()).list();
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        List<NjsBoxModelDTO> results = new ArrayList<>();
+        if(CollUtil.isNotEmpty(list)){
+            List<NjsBoxModelDTO> njsBoxModelDTOS = BeanUtil.copyToList(list, NjsBoxModelDTO.class);
+            njsBoxModelDTOS.stream().forEach(v->v.setSourceType("model"));
+            results.addAll(njsBoxModelDTOS);
+        }
+        if(StrUtil.isNotEmpty(sceneEditInfo.getBoxModels())){
+            JSONArray boxModels = JSON.parseArray(sceneEditInfo.getBoxModels());
+            List<NjsBoxModelDTO> collect = boxModels.stream().map(m -> {
+                JSONObject boxModel = JSON.parseObject(JSON.toJSONString(m));
+                Long createTime = boxModel.getLong("createTime");
+                return NjsBoxModelDTO.builder()
+                        .modelName(boxModel.getString("zipName"))
+                        .sourceType("mesh")
+                        .createTime(createTime == null ? null : DateExtUtil.date(createTime))
+                        .build();
+            }).collect(Collectors.toList());
+            results.addAll(collect);
+        }
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+
+        return  results.stream()
+                .sorted(
+                        Comparator.comparing(
+                                NjsBoxModelDTO::getCreateTime,
+                                Comparator.nullsLast(Date::compareTo)
+                        ).reversed()
+                ).collect(Collectors.toList());
+    }
+
+    @Override
+    public void batchDisplay(BathUpdateNjsBoxModelParamVO param) {
+        LambdaUpdateWrapper<NjsSceneBoxModel> wrapper = new LambdaUpdateWrapper();
+        wrapper.eq(NjsSceneBoxModel::getNum, param.getNum());
+        wrapper.in(NjsSceneBoxModel::getId, param.getIdList());
+        if(param.getDisplay() != null){
+            wrapper.set(NjsSceneBoxModel::getDisplay, param.getDisplay());
+        }
+        if(param.getDisplaySize() != null){
+            wrapper.set(NjsSceneBoxModel::getDisplaySize, param.getDisplaySize());
+        }
+        this.update(wrapper);
+    }
+
+    @Override
+    public void batchDelete(BathUpdateNjsBoxModelParamVO param) throws IOException {
+        List<NjsSceneBoxModel> list = lambdaQuery().eq(NjsSceneBoxModel::getNum, param.getNum()).in(NjsSceneBoxModel::getId, param.getIdList()).list();
+        if(list.isEmpty()){
+            return;
+        }
+        lambdaUpdate().eq(NjsSceneBoxModel::getNum, param.getNum()).in(NjsSceneBoxModel::getId, param.getIdList()).remove();
+        //删除文件
+        for (NjsSceneBoxModel njsSceneBoxModel : list) {
+            String key = String.format(UploadFilePath.USER_EDIT_PATH, njsSceneBoxModel.getNum()) + "njsBoxModel" + File.separator + njsSceneBoxModel.getSid() + ".glb";
+            if(fYunFileService.fileExist(key)){
+                fYunFileService.deleteFile(key);
+            }
+        }
+    }
+
+    @Override
+    public void objToGlb(JSONObject param) throws Exception {
+        Long id = param.getLong("id");
+        NjsSceneBoxModel njsSceneBoxModel = this.getById(id);
+        if(njsSceneBoxModel == null){
+            return;
+        }
+        String uuid = UUID.randomUUID().toString();
+        String origKey = njsSceneBoxModel.getOrigKey();
+        String workDir = String.format(ConstantFilePath.SCENE_USER_PATH_V4, njsSceneBoxModel.getNum()) + "objToGlb" + File.separator + uuid + File.separator;
+        try {
+            String zipPath = workDir + FileUtil.getName(origKey);
+            fYunFileService.downloadFile(origKey, zipPath);
+            //解压
+            ZipUtil.unzip(zipPath, workDir, CharsetUtil.CHARSET_GBK);
+            //转glb
+            String glbPath = workDir + uuid + ".glb";
+            OBJToGLBUtil.objToGlb(workDir, glbPath);
+            //上传glb
+            if(!ComputerUtil.checkComputeCompleted(glbPath, 5, 200)){
+                throw new RuntimeException("转glb失败");
+            }
+            String key = String.format(UploadFilePath.USER_EDIT_PATH, njsSceneBoxModel.getNum()) + "njsBoxModel" + File.separator + njsSceneBoxModel.getSid() + ".glb";
+            fYunFileService.uploadFile(glbPath, key);
+            njsSceneBoxModel.setStatus(CommonSuccessStatus.SUCCESS.code());
+        }catch (Exception e){
+            log.error("模型编辑器-模型转换失败, num:{}, sid:{}", njsSceneBoxModel.getNum(), njsSceneBoxModel.getSid(), e);
+            njsSceneBoxModel.setReason(ExceptionUtil.stacktraceToString(e, 3000));
+            njsSceneBoxModel.setStatus(CommonSuccessStatus.FAIL.code());
+        }finally{
+            this.updateById(njsSceneBoxModel);
+            //删除文件
+            fYunFileService.deleteFile(origKey);
+            FileUtil.del(workDir);
+        }
+    }
+
+    @Override
+    public void publicNjsSceneBoxModel(String num) throws IOException {
+        List<NjsSceneBoxModel> list = lambdaQuery().eq(NjsSceneBoxModel::getNum, num)
+                .eq(NjsSceneBoxModel::getStatus, CommonSuccessStatus.SUCCESS.code()).list();
+        String njsBoxModelKey = String.format(UploadFilePath.USER_EDIT_PATH, num) + "njsBoxModels.json";
+        if(list.isEmpty() && fYunFileService.fileExist(njsBoxModelKey)){
+            fYunFileService.deleteFile(njsBoxModelKey);
+            return;
+        }
+        fYunFileService.uploadFile(JSON.toJSONString(list).getBytes(StandardCharsets.UTF_8), njsBoxModelKey);
+    }
 
+    public static void main(String[] args) {
+        System.out.println(Instant.EPOCH.toEpochMilli());
     }
 }

+ 17 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -120,6 +120,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     private ISceneDynamicPanelService sceneDynamicPanelService;
     @Autowired
     private IWbService wbService;
+    @Autowired
+    private INjsSceneBoxModelService njsSceneBoxModelService;
 
     @Transactional
     @Override
@@ -281,6 +283,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         sceneJson.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
 
+        //njs 发布空间模型
+        njsSceneBoxModelService.publicNjsSceneBoxModel(num);
+
         //本地写sceneJson文件
         String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
         FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
@@ -511,6 +516,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         sceneInfoVO.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
 
+        //njs空间模型
+        long count = njsSceneBoxModelService.count(new LambdaQueryWrapper<NjsSceneBoxModel>().eq(NjsSceneBoxModel::getNum, num));
+        sceneInfoVO.setHasNjsBoxModel(count > 0 ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code());
+
         return sceneInfoVO;
     }
 
@@ -633,6 +642,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         sceneInfoVO.setPayStatus(scenePlus.getPayStatus());
 
+        //njs空间模型
+        String njsBoxModelKey = String.format(UploadFilePath.USER_EDIT_PATH, num) + "njsBoxModels.json";
+        String njsBoxModelStr = fYunFileService.getFileContent(njsBoxModelKey);
+        JSONArray njsBoxModelArr = JSON.parseArray(njsBoxModelStr);
+        if(!njsBoxModelArr.isEmpty()){
+            sceneInfoVO.setHasNjsBoxModel(CommonStatus.YES.code().intValue());
+        }
+
         return sceneInfoVO;
     }
 

+ 26 - 0
src/main/java/com/fdkankan/scene/vo/BathUpdateNjsBoxModelParamVO.java

@@ -0,0 +1,26 @@
+package com.fdkankan.scene.vo;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/2/18
+ **/
+@Data
+public class BathUpdateNjsBoxModelParamVO extends BaseSceneParamVO{
+
+    @NotEmpty(message = "idList不能为空")
+    private List<Long> idList;
+
+    private Integer display;
+
+    private Integer displaySize;
+
+}

+ 2 - 0
src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java

@@ -272,4 +272,6 @@ public class SceneInfoVO {
 
     private Integer hasFloorplanAi;
 
+    private Integer hasNjsBoxModel;
+
 }