|
@@ -32,6 +32,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
@@ -501,6 +502,33 @@ public class ManagerController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 删除模型详情
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("删除模型详情")
|
|
|
+ @RequestMapping(value = "/removeModelDetail", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "ids", value = "id集合", dataType = "List")})
|
|
|
+ @NoAuthentication
|
|
|
+ @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
|
|
|
+ public Result removeModelDetail(@RequestBody RequestRenovationPartsDetailManager param) {
|
|
|
+ if (param.getIds() == null) {
|
|
|
+ return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
+ }
|
|
|
+ param.getIds().forEach(a -> {
|
|
|
+ boolean removeById = renovationPartsDetailService.removeById(a);
|
|
|
+ ManagerController.log.info("删除renovationPartsDetailEntity-{}", removeById);
|
|
|
+ ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(a);
|
|
|
+ if (modelUploadEntity != null) {
|
|
|
+ modelUploadService.removeById(modelUploadEntity.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* 修改模型详情(编辑,是否显示,删除)
|
|
|
*
|
|
|
* @return
|
|
@@ -755,67 +783,68 @@ public class ManagerController extends BaseController {
|
|
|
@RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
|
|
|
+ @ApiImplicitParam(name = "examine", value = "0未审核 1审核中 2审核通过 -1审核失败 ", dataType = "String")})
|
|
|
@NoAuthentication
|
|
|
@AroundLog(name = "更新模型审核状态")
|
|
|
@Transactional(rollbackFor = BusinessException.class)
|
|
|
public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) throws IOException {
|
|
|
- if (param.getId() == null || param.getExamine() == null) {
|
|
|
+ if (param.getIds() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
-
|
|
|
- RenovationPartsDetailEntity renovationPartsDetailEntity = renovationPartsDetailService.findById(param.getId());
|
|
|
- renovationPartsDetailEntity.setId(param.getId());
|
|
|
-
|
|
|
- if (param.getExamine().intValue() == 1) {
|
|
|
- ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(param.getId());
|
|
|
- if (ObjectUtil.isNotNull(modelUploadEntity)) {
|
|
|
- //入库前先提交模型到模型库,失败返回提示
|
|
|
- String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- JSONArray array = new JSONArray();
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("Name", renovationPartsDetailEntity.getName());
|
|
|
- object.put("UserID", modelUploadEntity.getUserId());
|
|
|
- String postfix = "datasmith";
|
|
|
- if (modelUploadEntity.getFileType() == 0) {
|
|
|
- postfix = "fbx";
|
|
|
- }
|
|
|
- object.put("Postfix", postfix);
|
|
|
- object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
|
|
|
- array.add(object);
|
|
|
- jsonObject.put("version", version);
|
|
|
-
|
|
|
-
|
|
|
- // TODO 使用队列操作
|
|
|
- ManagerController.log.info("更新模型库,syncmodel接口参数:" + jsonObject.toJSONString());
|
|
|
- uploadToOssUtil.uploadTo4dTjw(array.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
|
|
|
- version + "/SyncData.json");
|
|
|
- String message = param.getId() + ":;" + "1" + ":;" + jsonObject.toString();
|
|
|
- rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
|
|
|
-
|
|
|
- uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""),
|
|
|
- renovationPartsDetailEntity.getImg().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
- uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""),
|
|
|
- renovationPartsDetailEntity.getPath().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
- if (ObjectUtil.isNotNull(renovationPartsDetailEntity.getMviewPath())) {
|
|
|
- uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""),
|
|
|
- renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
- uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""));
|
|
|
- renovationPartsDetailEntity.setMviewPath(renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/"));
|
|
|
+ if (!CollectionUtils.isEmpty(param.getIds())) {
|
|
|
+ for (Long id : param.getIds()) {
|
|
|
+ RenovationPartsDetailEntity renovationPartsDetailEntity = renovationPartsDetailService.findById(id);
|
|
|
+ renovationPartsDetailEntity.setId(id);
|
|
|
+ renovationPartsDetailEntity.setExamine(1);
|
|
|
+ ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(id);
|
|
|
+ if (ObjectUtil.isNotNull(modelUploadEntity)) {
|
|
|
+ //入库前先提交模型到模型库,失败返回提示
|
|
|
+ String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("Name", renovationPartsDetailEntity.getName());
|
|
|
+ object.put("UserID", modelUploadEntity.getUserId());
|
|
|
+ String postfix = "datasmith";
|
|
|
+ if (modelUploadEntity.getFileType() == 0) {
|
|
|
+ postfix = "fbx";
|
|
|
+ }
|
|
|
+ object.put("Postfix", postfix);
|
|
|
+ object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
|
|
|
+ array.add(object);
|
|
|
+ jsonObject.put("version", version);
|
|
|
+
|
|
|
+
|
|
|
+ // TODO 使用队列操作
|
|
|
+ ManagerController.log.info("更新模型库,syncmodel接口参数:" + jsonObject.toJSONString());
|
|
|
+ uploadToOssUtil.uploadTo4dTjw(array.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
|
|
|
+ version + "/SyncData.json");
|
|
|
+ String message = param.getId() + ":;" + "1" + ":;" + jsonObject.toString();
|
|
|
+ rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
|
|
|
+
|
|
|
+ uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""),
|
|
|
+ renovationPartsDetailEntity.getImg().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
+ uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""),
|
|
|
+ renovationPartsDetailEntity.getPath().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
+ if (ObjectUtil.isNotNull(renovationPartsDetailEntity.getMviewPath())) {
|
|
|
+ uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""),
|
|
|
+ renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/").replace(prefix, ""));
|
|
|
+ uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""));
|
|
|
+ renovationPartsDetailEntity.setMviewPath(renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/"));
|
|
|
+ }
|
|
|
+
|
|
|
+ uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""));
|
|
|
+ uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""));
|
|
|
+
|
|
|
+ renovationPartsDetailEntity.setImg(renovationPartsDetailEntity.getImg().replace("/temp/", "/models/"));
|
|
|
+ renovationPartsDetailEntity.setHighImg(renovationPartsDetailEntity.getHighImg().replace("/temp/", "/models/"));
|
|
|
+ renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
|
|
|
}
|
|
|
|
|
|
- uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""));
|
|
|
- uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""));
|
|
|
-
|
|
|
- renovationPartsDetailEntity.setImg(renovationPartsDetailEntity.getImg().replace("/temp/", "/models/"));
|
|
|
- renovationPartsDetailEntity.setHighImg(renovationPartsDetailEntity.getHighImg().replace("/temp/", "/models/"));
|
|
|
- renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
|
|
|
+ renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
-
|
|
|
|
|
|
return Result.success();
|
|
|
}
|