|
@@ -1,16 +1,21 @@
|
|
|
package com.fdkk.sxz.webApi.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.fdkk.sxz.base.BaseController;
|
|
|
import com.fdkk.sxz.base.Result;
|
|
|
+import com.fdkk.sxz.entity.ComponentModelUploadEntity;
|
|
|
+import com.fdkk.sxz.entity.ModelUploadEntity;
|
|
|
import com.fdkk.sxz.entity.RenovationPartsDetailEntity;
|
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
|
|
|
import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
|
|
|
import com.fdkk.sxz.util.OkHttpUtils;
|
|
|
import com.fdkk.sxz.util.RedisUtil;
|
|
|
import com.fdkk.sxz.util.UploadToOssUtil;
|
|
|
+import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
|
|
|
+import com.fdkk.sxz.webApi.service.IModelUploadService;
|
|
|
import com.fdkk.sxz.webApi.service.IRenovationPartsDetailService;
|
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomProductFirstclassifyService;
|
|
@@ -21,6 +26,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.oschina.j2cache.CacheChannel;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -54,6 +60,14 @@ public class testController extends BaseController {
|
|
|
@Autowired
|
|
|
private ICustomComponentService customComponentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IModelUploadService modelUploadService;
|
|
|
+
|
|
|
+ @Value("${prefix.ali}")
|
|
|
+ private String prefix;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IComponentModelUploadService componentModelUploadService;
|
|
|
|
|
|
/**
|
|
|
* 替换所有为空的路径
|
|
@@ -68,8 +82,18 @@ public class testController extends BaseController {
|
|
|
for (RenovationPartsDetailEntity renovationPartsDetailEntity : list) {
|
|
|
if (ObjectUtil.isNotNull(renovationPartsDetailEntity.getMviewPath()) && StrUtil.isNotBlank(renovationPartsDetailEntity.getMviewPath())) {
|
|
|
if (!uploadToOssUtil.existFileToOSS(renovationPartsDetailEntity.getMviewPath(), "4d-tjw")) {
|
|
|
- renovationPartsDetailEntity.setMviewPath("");
|
|
|
- renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
+ ModelUploadEntity byFileId = modelUploadService.findByFileId(renovationPartsDetailEntity.getName());
|
|
|
+ String path = byFileId.getObjPath().replace(".obj", ".mview");
|
|
|
+ if (ObjectUtil.isNotNull(byFileId) && FileUtil.exist(path)) {
|
|
|
+ uploadToOssUtil.uploadTo4dTjw(path, "domain/eHome/furniture/temp/" + renovationPartsDetailEntity.getName() + ".mview");
|
|
|
+ renovationPartsDetailEntity.setMviewPath(prefix + "domain/eHome/furniture/temp/" + renovationPartsDetailEntity.getName() + ".mview");
|
|
|
+ renovationPartsDetailEntity.setMviewStatus(2);
|
|
|
+ renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
+ } else {
|
|
|
+ renovationPartsDetailEntity.setMviewPath("");
|
|
|
+ renovationPartsDetailEntity.setMviewStatus(-1);
|
|
|
+ renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -77,8 +101,21 @@ public class testController extends BaseController {
|
|
|
for (CustomComponentEntity customComponentEntity : list1) {
|
|
|
if (ObjectUtil.isNotNull(customComponentEntity.getMviewPath()) && StrUtil.isNotBlank(customComponentEntity.getMviewPath())) {
|
|
|
if (!uploadToOssUtil.existFileToOSS(customComponentEntity.getMviewPath(), "4d-tjw")) {
|
|
|
- customComponentEntity.setMviewPath("");
|
|
|
- customComponentService.updateById(customComponentEntity);
|
|
|
+ ComponentModelUploadEntity byFileId = componentModelUploadService.findByFileId(customComponentEntity.getFileId());
|
|
|
+
|
|
|
+ String path = byFileId.getObjPath().replace(".obj", ".mview");
|
|
|
+ if (ObjectUtil.isNotNull(byFileId) && FileUtil.exist(path)) {
|
|
|
+ uploadToOssUtil.uploadTo4dTjw(path, "domain/eHome/furniture/models/" + customComponentEntity.getFileId() + ".mview");
|
|
|
+
|
|
|
+ customComponentEntity.setMviewPath(prefix + "domain/eHome/furniture/models/" + customComponentEntity.getFileId() + ".mview");
|
|
|
+ customComponentEntity.setMviewStatus(2);
|
|
|
+ customComponentService.updateById(customComponentEntity);
|
|
|
+ } else {
|
|
|
+ customComponentEntity.setMviewPath("");
|
|
|
+ customComponentEntity.setMviewStatus(-1);
|
|
|
+ customComponentService.updateById(customComponentEntity);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|