|
@@ -136,9 +136,13 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
|
|
@Override
|
|
@Override
|
|
public boolean updateById(ModelUploadEntity entity) {
|
|
public boolean updateById(ModelUploadEntity entity) {
|
|
boolean updateById = super.updateById(entity);
|
|
boolean updateById = super.updateById(entity);
|
|
- if (updateById) {
|
|
|
|
|
|
+ ModelUploadEntity byId = super.findById(entity.getId());
|
|
|
|
+ if (updateById && ObjectUtil.isNotNull(byId)) {
|
|
cacheChannel.set(region, "id::" + entity.getId(), entity, 60 * 30);
|
|
cacheChannel.set(region, "id::" + entity.getId(), entity, 60 * 30);
|
|
cacheChannel.set(region, "fileId::" + entity.getFileId(), entity, 60 * 30);
|
|
cacheChannel.set(region, "fileId::" + entity.getFileId(), entity, 60 * 30);
|
|
|
|
+ } else {
|
|
|
|
+ cacheChannel.evict(region, "id::" + entity.getId());
|
|
|
|
+ cacheChannel.evict(region, "fileId::" + entity.getFileId());
|
|
}
|
|
}
|
|
return updateById;
|
|
return updateById;
|
|
}
|
|
}
|
|
@@ -310,75 +314,73 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
|
|
@Override
|
|
@Override
|
|
public ResponseModelCustom findCustom(Long id) {
|
|
public ResponseModelCustom findCustom(Long id) {
|
|
ModelUploadEntity entity = findById(id);
|
|
ModelUploadEntity entity = findById(id);
|
|
-
|
|
|
|
ResponseModelCustom responseModelCustomUpload = new ResponseModelCustom();
|
|
ResponseModelCustom responseModelCustomUpload = new ResponseModelCustom();
|
|
- responseModelCustomUpload.setId(entity.getId());
|
|
|
|
- responseModelCustomUpload.setCreateTime(entity.getCreateTime());
|
|
|
|
- responseModelCustomUpload.setUserId(entity.getUserId());
|
|
|
|
- responseModelCustomUpload.setStatus(entity.getStatus());
|
|
|
|
- responseModelCustomUpload.setProgress(entity.getProgress());
|
|
|
|
- responseModelCustomUpload.setThumPath(entity.getThumPath());
|
|
|
|
- responseModelCustomUpload.setThumStatus(entity.getThumStatus());
|
|
|
|
- if (ObjectUtil.isNotNull(entity.getPartsDetailId())) {
|
|
|
|
- CustomProductEntity customProductEntity = customProductService.findById(entity.getPartsDetailId());
|
|
|
|
- responseModelCustomUpload.setName(customProductEntity.getName());
|
|
|
|
- responseModelCustomUpload.setCustomTypeId(customProductEntity.getParentId());
|
|
|
|
- responseModelCustomUpload.setModelId(customProductEntity.getId());
|
|
|
|
- } else {
|
|
|
|
- responseModelCustomUpload.setCustomTypeId(0L);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (ObjectUtil.isNotNull(entity.getCacheData())) {
|
|
|
|
- JSONObject cache = JSONObject.parseObject(entity.getCacheData());
|
|
|
|
- if (cache.containsKey("cacheData")) {
|
|
|
|
- JSONObject cacheData = cache.getJSONObject("cacheData");
|
|
|
|
- responseModelCustomUpload.setWidth(cacheData.getDouble("width"));
|
|
|
|
- responseModelCustomUpload.setDepth(cacheData.getDouble("depth"));
|
|
|
|
- responseModelCustomUpload.setHeight(cacheData.getDouble("height"));
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(entity)) {
|
|
|
|
+ responseModelCustomUpload.setId(entity.getId());
|
|
|
|
+ responseModelCustomUpload.setCreateTime(entity.getCreateTime());
|
|
|
|
+ responseModelCustomUpload.setUserId(entity.getUserId());
|
|
|
|
+ responseModelCustomUpload.setStatus(entity.getStatus());
|
|
|
|
+ responseModelCustomUpload.setProgress(entity.getProgress());
|
|
|
|
+ responseModelCustomUpload.setThumPath(entity.getThumPath());
|
|
|
|
+ responseModelCustomUpload.setThumStatus(entity.getThumStatus());
|
|
|
|
+ if (ObjectUtil.isNotNull(entity.getPartsDetailId())) {
|
|
|
|
+ CustomProductEntity customProductEntity = customProductService.findById(entity.getPartsDetailId());
|
|
|
|
+ responseModelCustomUpload.setName(customProductEntity.getName());
|
|
|
|
+ responseModelCustomUpload.setCustomTypeId(customProductEntity.getParentId());
|
|
|
|
+ responseModelCustomUpload.setModelId(customProductEntity.getId());
|
|
} else {
|
|
} else {
|
|
- responseModelCustomUpload.setWidth(cache.getDouble("width"));
|
|
|
|
- responseModelCustomUpload.setDepth(cache.getDouble("depth"));
|
|
|
|
- responseModelCustomUpload.setHeight(cache.getDouble("height"));
|
|
|
|
|
|
+ responseModelCustomUpload.setCustomTypeId(0L);
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
- if (entity.getStatus() != -1) {
|
|
|
|
- JSONArray componentArray = new JSONArray();
|
|
|
|
- List<ComponentModelUploadEntity> componentModelUploadEntities = componentModelUploadService.findPartsModelUploadId(entity.getId());
|
|
|
|
- for (ComponentModelUploadEntity componentModelUploadEntity : componentModelUploadEntities) {
|
|
|
|
-
|
|
|
|
- JSONObject json = new JSONObject();
|
|
|
|
- json.put("id", componentModelUploadEntity.getId());
|
|
|
|
- json.put("name", componentModelUploadEntity.getFileId());
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (ObjectUtil.isNotNull(componentModelUploadEntity.getPartsDetailId())) {
|
|
|
|
- CustomComponentEntity componentEntity = customComponentService.findById(componentModelUploadEntity.getPartsDetailId());
|
|
|
|
- if (ObjectUtil.isNotNull(componentEntity)) {
|
|
|
|
- json.put("customComponentTypeId", componentEntity.getComponentTypeId());
|
|
|
|
- json.put("title", componentEntity.getName());
|
|
|
|
- json.put("modelId", componentEntity.getId());
|
|
|
|
- }
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(entity.getCacheData())) {
|
|
|
|
+ JSONObject cache = JSONObject.parseObject(entity.getCacheData());
|
|
|
|
+ if (cache.containsKey("cacheData")) {
|
|
|
|
+ JSONObject cacheData = cache.getJSONObject("cacheData");
|
|
|
|
+ responseModelCustomUpload.setWidth(cacheData.getDouble("width"));
|
|
|
|
+ responseModelCustomUpload.setDepth(cacheData.getDouble("depth"));
|
|
|
|
+ responseModelCustomUpload.setHeight(cacheData.getDouble("height"));
|
|
} else {
|
|
} else {
|
|
- json.put("customComponentTypeId", 0);
|
|
|
|
|
|
+ responseModelCustomUpload.setWidth(cache.getDouble("width"));
|
|
|
|
+ responseModelCustomUpload.setDepth(cache.getDouble("depth"));
|
|
|
|
+ responseModelCustomUpload.setHeight(cache.getDouble("height"));
|
|
}
|
|
}
|
|
|
|
|
|
- json.put("objPath", componentModelUploadEntity.getObjPath());
|
|
|
|
- json.put("thumPath", componentModelUploadEntity.getThumPath());
|
|
|
|
- json.put("mtlPath", componentModelUploadEntity.getMtlPath());
|
|
|
|
- if (ObjectUtil.isNotNull(componentModelUploadEntity.getCacheData())) {
|
|
|
|
- JSONObject componentCache = JSON.parseObject(componentModelUploadEntity.getCacheData());
|
|
|
|
- json.put("width", componentCache.getJSONObject("deploy").getDouble("width"));
|
|
|
|
- json.put("depth", componentCache.getJSONObject("deploy").getDouble("depth"));
|
|
|
|
- json.put("height", componentCache.getJSONObject("deploy").getDouble("height"));
|
|
|
|
- json.put("origin", componentCache.get("origin"));
|
|
|
|
|
|
+ }
|
|
|
|
+ if (entity.getStatus() != -1) {
|
|
|
|
+ JSONArray componentArray = new JSONArray();
|
|
|
|
+ List<ComponentModelUploadEntity> componentModelUploadEntities = componentModelUploadService.findPartsModelUploadId(entity.getId());
|
|
|
|
+ for (ComponentModelUploadEntity componentModelUploadEntity : componentModelUploadEntities) {
|
|
|
|
+
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ json.put("id", componentModelUploadEntity.getId());
|
|
|
|
+ json.put("name", componentModelUploadEntity.getFileId());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotNull(componentModelUploadEntity.getPartsDetailId())) {
|
|
|
|
+ CustomComponentEntity componentEntity = customComponentService.findById(componentModelUploadEntity.getPartsDetailId());
|
|
|
|
+ if (ObjectUtil.isNotNull(componentEntity)) {
|
|
|
|
+ json.put("customComponentTypeId", componentEntity.getComponentTypeId());
|
|
|
|
+ json.put("title", componentEntity.getName());
|
|
|
|
+ json.put("modelId", componentEntity.getId());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ json.put("customComponentTypeId", 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ json.put("objPath", componentModelUploadEntity.getObjPath());
|
|
|
|
+ json.put("thumPath", componentModelUploadEntity.getThumPath());
|
|
|
|
+ json.put("mtlPath", componentModelUploadEntity.getMtlPath());
|
|
|
|
+ if (ObjectUtil.isNotNull(componentModelUploadEntity.getCacheData())) {
|
|
|
|
+ JSONObject componentCache = JSON.parseObject(componentModelUploadEntity.getCacheData());
|
|
|
|
+ json.put("width", componentCache.getJSONObject("deploy").getDouble("width"));
|
|
|
|
+ json.put("depth", componentCache.getJSONObject("deploy").getDouble("depth"));
|
|
|
|
+ json.put("height", componentCache.getJSONObject("deploy").getDouble("height"));
|
|
|
|
+ json.put("origin", componentCache.get("origin"));
|
|
|
|
+ }
|
|
|
|
+ componentArray.add(json);
|
|
}
|
|
}
|
|
- componentArray.add(json);
|
|
|
|
|
|
+ responseModelCustomUpload.setComponentSlots(componentArray);
|
|
}
|
|
}
|
|
- responseModelCustomUpload.setComponentSlots(componentArray);
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
return responseModelCustomUpload;
|
|
return responseModelCustomUpload;
|
|
}
|
|
}
|
|
}
|
|
}
|