|
@@ -12,6 +12,7 @@ import cn.hutool.core.thread.ThreadUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
import com.fdkankan.fusion.common.util.*;
|
|
import com.fdkankan.fusion.common.util.*;
|
|
@@ -69,6 +70,8 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
ITmCameraService tmCameraService;
|
|
ITmCameraService tmCameraService;
|
|
@Autowired
|
|
@Autowired
|
|
ThreadService threadService;
|
|
ThreadService threadService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IUploadChunkService uploadChunkService;
|
|
|
|
|
|
@Value("${upload.query-path}")
|
|
@Value("${upload.query-path}")
|
|
private String queryPath;
|
|
private String queryPath;
|
|
@@ -144,6 +147,9 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
Set<String> deptIdset = page.getRecords().stream().map(ModelVo::getDeptId).collect(Collectors.toSet());
|
|
Set<String> deptIdset = page.getRecords().stream().map(ModelVo::getDeptId).collect(Collectors.toSet());
|
|
HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
|
|
HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
|
|
for (ModelVo model : page.getRecords()) {
|
|
for (ModelVo model : page.getRecords()) {
|
|
|
|
+ if(model.getModelId() == null){
|
|
|
|
+ model.setCreateStatus(0);
|
|
|
|
+ }
|
|
if( model.getModelId() != null && StringUtils.isEmpty(model.getNum()) ) {
|
|
if( model.getModelId() != null && StringUtils.isEmpty(model.getNum()) ) {
|
|
model.setNum(model.getModelId().toString());
|
|
model.setNum(model.getModelId().toString());
|
|
}
|
|
}
|
|
@@ -167,33 +173,52 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void delete(Integer modelId) {
|
|
|
|
- List<CaseNumEntity> caseNumEntityList = caseNumService.getByNum(modelId.toString());
|
|
|
|
- List<FusionNum> fusionNumList = fusionNumService.getByNum(modelId.toString());
|
|
|
|
- if(caseNumEntityList.size() >0 || fusionNumList.size() >0){
|
|
|
|
- StringBuilder title = new StringBuilder();
|
|
|
|
- List<Integer> caseIdIds = caseNumEntityList.parallelStream().map(CaseNumEntity::getCaseId).collect(Collectors.toList());
|
|
|
|
- if(caseIdIds.size() >0){
|
|
|
|
- List<CaseEntity> list = caseService.getByIds(caseIdIds);
|
|
|
|
- List<String> collect = list.parallelStream().map(CaseEntity::getCaseTitle).collect(Collectors.toList());
|
|
|
|
- for (String str : collect) {
|
|
|
|
- title.append(str).append(",");
|
|
|
|
- }
|
|
|
|
- if(title.length()>0){
|
|
|
|
- title.delete(title.length()-1,title.length());
|
|
|
|
|
|
+ public void delete(Integer modelId,Integer uploadId) {
|
|
|
|
+ if(modelId != null){
|
|
|
|
+ List<CaseNumEntity> caseNumEntityList = caseNumService.getByNum(modelId.toString());
|
|
|
|
+ List<FusionNum> fusionNumList = fusionNumService.getByNum(modelId.toString());
|
|
|
|
+ if(caseNumEntityList.size() >0 || fusionNumList.size() >0){
|
|
|
|
+ StringBuilder title = new StringBuilder();
|
|
|
|
+ List<Integer> caseIdIds = caseNumEntityList.parallelStream().map(CaseNumEntity::getCaseId).collect(Collectors.toList());
|
|
|
|
+ if(caseIdIds.size() >0){
|
|
|
|
+ List<CaseEntity> list = caseService.getByIds(caseIdIds);
|
|
|
|
+ List<String> collect = list.parallelStream().map(CaseEntity::getCaseTitle).collect(Collectors.toList());
|
|
|
|
+ for (String str : collect) {
|
|
|
|
+ title.append(str).append(",");
|
|
|
|
+ }
|
|
|
|
+ if(title.length()>0){
|
|
|
|
+ title.delete(title.length()-1,title.length());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,title));
|
|
|
|
+ }
|
|
|
|
+ Model model = this.getById(modelId);
|
|
|
|
+ if(model == null ){
|
|
|
|
+ throw new BusinessException(ResultCode.MODEL_NOT_EXIST);
|
|
|
|
+ }
|
|
|
|
+ this.removeById(modelId);
|
|
|
|
+ fusionNumService.deleteByModelId(modelId);
|
|
|
|
+ if(StringUtils.isNotBlank(model.getModelGlbUrl())){
|
|
|
|
+ uploadService.deleteOssUrl(model.getModelGlbUrl());
|
|
|
|
+ }
|
|
|
|
+ if(model.getUploadId() != null){
|
|
|
|
+ this.updateUploadId(model.getModelId(),null);
|
|
}
|
|
}
|
|
- throw new BusinessException(ResultCode.CASE_USE.code, String.format(ResultCode.CASE_USE.msg,title));
|
|
|
|
- }
|
|
|
|
- Model model = this.getById(modelId);
|
|
|
|
- if(model == null ){
|
|
|
|
- throw new BusinessException(ResultCode.MODEL_NOT_EXIST);
|
|
|
|
}
|
|
}
|
|
- this.removeById(modelId);
|
|
|
|
- fusionNumService.deleteByModelId(modelId);
|
|
|
|
- if(StringUtils.isNotBlank(model.getModelGlbUrl())){
|
|
|
|
- uploadService.deleteOssUrl(model.getModelGlbUrl());
|
|
|
|
|
|
+ if(modelId == null && uploadId != null){
|
|
|
|
+ UploadChunk uploadChunk = uploadChunkService.getById(uploadId);
|
|
|
|
+ if(uploadChunk != null){
|
|
|
|
+ uploadChunkService.removeById(uploadChunk.getId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void updateUploadId(Integer modelId,Integer uploadId) {
|
|
|
|
+ LambdaUpdateWrapper<Model> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(Model::getModelId,modelId);
|
|
|
|
+ wrapper.set(Model::getUploadId,uploadId);
|
|
|
|
+ this.update(wrapper);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|