|
@@ -2,6 +2,7 @@ package com.fdkk.sxz.webApi.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fdkk.sxz.base.Result;
|
|
@@ -9,6 +10,7 @@ import com.fdkk.sxz.base.impl.BaseServiceImpl;
|
|
|
import com.fdkk.sxz.entity.ComponentModelUploadEntity;
|
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
|
|
|
import com.fdkk.sxz.exception.BusinessException;
|
|
|
+import com.fdkk.sxz.other.mq.TopicRabbitConfig;
|
|
|
import com.fdkk.sxz.util.CreateObjUtil;
|
|
|
import com.fdkk.sxz.util.OkHttpUtils;
|
|
|
import com.fdkk.sxz.util.UploadToOssUtil;
|
|
@@ -18,6 +20,7 @@ import com.fdkk.sxz.webApi.mapper.IComponentModelUploadMapper;
|
|
|
import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
|
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -58,6 +61,8 @@ public class ComponentModelUploadServiceImpl extends BaseServiceImpl<IComponentM
|
|
|
@Value("${max.obj.url}")
|
|
|
private String maxObjUrl;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ RabbitTemplate rabbitTemplate; //使用RabbitTemplate,这提供了接收/发送等等方
|
|
|
|
|
|
@Override
|
|
|
public ResponseModelComponent findComponent(Long id) {
|
|
@@ -125,8 +130,16 @@ public class ComponentModelUploadServiceImpl extends BaseServiceImpl<IComponentM
|
|
|
customComponentEntity.setName(param.getName());
|
|
|
customComponentEntity.setUserId(param.getUserId());
|
|
|
customComponentEntity.setFileId(componentModel.getFileId());
|
|
|
- ComponentModelUploadServiceImpl.log.info("处理缩略图");
|
|
|
|
|
|
+ if (param.getJsonData().containsKey("Param1")) {
|
|
|
+ JSONObject volume = param.getJsonData().getJSONObject("Param1").getJSONObject("volume");
|
|
|
+ customComponentEntity.setWidth(volume.getInteger("width"));
|
|
|
+ customComponentEntity.setDepth(volume.getInteger("depth"));
|
|
|
+ customComponentEntity.setHeight(volume.getInteger("height"));
|
|
|
+ param.getJsonData().getJSONObject("Param1").remove("volume");
|
|
|
+ }
|
|
|
+
|
|
|
+ ComponentModelUploadServiceImpl.log.info("处理缩略图");
|
|
|
//先执行python-NewResortForOne脚本,处理obj文件
|
|
|
CreateObjUtil.objHandle(buildPath + componentModel.getObjPath());
|
|
|
|
|
@@ -158,6 +171,9 @@ public class ComponentModelUploadServiceImpl extends BaseServiceImpl<IComponentM
|
|
|
ComponentModelUploadServiceImpl.log.info("上传obj到simpleObj-Mtl结束");
|
|
|
Boolean componentSaveFlag = customComponentService.save(customComponentEntity);
|
|
|
if (componentSaveFlag) {
|
|
|
+ rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MVIEW,
|
|
|
+ customComponentEntity.getId() + ":;2:;" + buildPath + componentModel.getObjPath().replace(".obj", ".mview") + ":;" + componentModel.getFileId());
|
|
|
+
|
|
|
componentModel.setPartsDetailId(customComponentEntity.getId());
|
|
|
updateById(componentModel);
|
|
|
}
|