|
|
@@ -11,6 +11,7 @@ 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.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.CommonSuccessStatus;
|
|
|
@@ -25,6 +26,7 @@ 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.ExportBoxModelDTO;
|
|
|
import com.fdkankan.scene.dto.NjsBoxModelDTO;
|
|
|
import com.fdkankan.scene.dto.SaveBoxModelDTO;
|
|
|
import com.fdkankan.scene.entity.NjsSceneBoxModel;
|
|
|
@@ -37,6 +39,7 @@ 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 com.fdkankan.scene.vo.DeleteSidListParamVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -130,7 +133,6 @@ public class NjsSceneBoxModelServiceImpl extends ServiceImpl<INjsSceneBoxModelMa
|
|
|
bean.setLoaded(CommonStatus.YES.code().intValue());
|
|
|
bean.setStatus(CommonSuccessStatus.SUCCESS.code());
|
|
|
}
|
|
|
- bean.setSid(bean.getInfo().getString("sid"));
|
|
|
this.save(bean);
|
|
|
|
|
|
//如果是上转本地obj的方式,需要将obj转glb
|
|
|
@@ -158,9 +160,11 @@ public class NjsSceneBoxModelServiceImpl extends ServiceImpl<INjsSceneBoxModelMa
|
|
|
List<NjsBoxModelDTO> collect = boxModels.stream().map(m -> {
|
|
|
JSONObject boxModel = JSON.parseObject(JSON.toJSONString(m));
|
|
|
Long createTime = boxModel.getLong("createTime");
|
|
|
+ boolean visible = boxModel.getBooleanValue("visible");
|
|
|
return NjsBoxModelDTO.builder()
|
|
|
.modelName(boxModel.getString("zipName"))
|
|
|
.sourceType("mesh")
|
|
|
+ .visible(visible ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code())
|
|
|
.createTime(createTime == null ? null : DateExtUtil.date(createTime))
|
|
|
.build();
|
|
|
}).collect(Collectors.toList());
|
|
|
@@ -180,15 +184,15 @@ public class NjsSceneBoxModelServiceImpl extends ServiceImpl<INjsSceneBoxModelMa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void batchDisplay(BathUpdateNjsBoxModelParamVO param) {
|
|
|
+ public void batchVisible(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.getVisible() != null){
|
|
|
+ wrapper.set(NjsSceneBoxModel::getVisible, param.getVisible());
|
|
|
}
|
|
|
- if(param.getDisplaySize() != null){
|
|
|
- wrapper.set(NjsSceneBoxModel::getDisplaySize, param.getDisplaySize());
|
|
|
+ if(param.getVisibleSize() != null){
|
|
|
+ wrapper.set(NjsSceneBoxModel::getVisibleSize, param.getVisibleSize());
|
|
|
}
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
@@ -282,4 +286,64 @@ public class NjsSceneBoxModelServiceImpl extends ServiceImpl<INjsSceneBoxModelMa
|
|
|
public static void main(String[] args) {
|
|
|
System.out.println(Instant.EPOCH.toEpochMilli());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void export(ExportBoxModelDTO param) {
|
|
|
+ LambdaQueryWrapper<NjsSceneBoxModel> wrapper = new LambdaQueryWrapper();
|
|
|
+ wrapper.eq(NjsSceneBoxModel::getNum, param.getNum());
|
|
|
+ boolean queryMeshModel = true;//因为meshmodel没有颜色和形状,所以这里,只要颜色和形状有入参,就可以不用去查meshmodel了
|
|
|
+ if(StrUtil.isNotEmpty(param.getColour())){
|
|
|
+ wrapper.eq(NjsSceneBoxModel::getColour, param.getColour());
|
|
|
+ queryMeshModel = false;
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(param.getShape())){
|
|
|
+ wrapper.eq(NjsSceneBoxModel::getShape, param.getShape());
|
|
|
+ queryMeshModel = false;
|
|
|
+ }
|
|
|
+ List<NjsBoxModelDTO> results = new ArrayList<>();
|
|
|
+
|
|
|
+ //先查询mesh编辑器model
|
|
|
+ if(queryMeshModel){
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+ 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(StrUtil.isNotEmpty(param.getModelName())){
|
|
|
+ wrapper.like(NjsSceneBoxModel::getModelName, param.getModelName());
|
|
|
+ //如果名称入参不为空,需要过滤meshboxmodel
|
|
|
+ if(!results.isEmpty()){
|
|
|
+ results = results.stream().filter(v->v.getModelName().contains(param.getModelName())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ List<NjsSceneBoxModel> list = this.list(wrapper);
|
|
|
+
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ List<NjsBoxModelDTO> njsBoxModelDTOS = BeanUtil.copyToList(list, NjsBoxModelDTO.class);
|
|
|
+ njsBoxModelDTOS.stream().forEach(v->v.setSourceType("model"));
|
|
|
+ results.addAll(njsBoxModelDTOS);
|
|
|
+ }
|
|
|
+
|
|
|
+ results.stream()
|
|
|
+ .sorted(
|
|
|
+ Comparator.comparing(
|
|
|
+ NjsBoxModelDTO::getCreateTime,
|
|
|
+ Comparator.nullsLast(Date::compareTo)
|
|
|
+ ).reversed()
|
|
|
+ ).collect(Collectors.toList());
|
|
|
+
|
|
|
+ }
|
|
|
}
|