|
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@@ -76,22 +77,23 @@ public class CopyCaseService {
|
|
|
|
|
|
public void copyCase(Integer oldCaseId){
|
|
|
Integer newCaseId = this.cpCaseEntity(oldCaseId);
|
|
|
+
|
|
|
this.cpCaseExtractDetail(oldCaseId,newCaseId);
|
|
|
this.cpCaseFile(oldCaseId,newCaseId);
|
|
|
- this.cpCaseFusion(oldCaseId,newCaseId);
|
|
|
this.cpCaseImg(oldCaseId,newCaseId);
|
|
|
this.cpCaseInquest(oldCaseId,newCaseId);
|
|
|
this.cpCaseNum(oldCaseId,newCaseId);
|
|
|
this.cpCaseSettings(oldCaseId,newCaseId);
|
|
|
this.cpCaseSettingsResource(oldCaseId,newCaseId);
|
|
|
- this.cpCaseTag(oldCaseId,newCaseId);
|
|
|
this.cpCaseVideo(oldCaseId,newCaseId);
|
|
|
this.cpCaseViewByCaseId(oldCaseId,newCaseId);
|
|
|
this.cpFusionGuide(oldCaseId,newCaseId);
|
|
|
this.cpCaseScript(oldCaseId,newCaseId);
|
|
|
this.cpImgTag(oldCaseId,newCaseId);
|
|
|
+ HashMap<Integer, Integer> fusionNumIdMap = this.cpCaseFusion(oldCaseId, newCaseId);
|
|
|
|
|
|
- this.cpPath(oldCaseId,newCaseId);
|
|
|
+ this.cpCaseTag(oldCaseId,newCaseId,fusionNumIdMap);
|
|
|
+ this.cpPath(oldCaseId,newCaseId,fusionNumIdMap);
|
|
|
this.cpAnimation(oldCaseId,newCaseId);
|
|
|
}
|
|
|
|
|
@@ -178,10 +180,11 @@ public class CopyCaseService {
|
|
|
/**
|
|
|
* 复制案件编辑器关联关系
|
|
|
*/
|
|
|
- private void cpCaseFusion(Integer oldCaseId, Integer newCaseId) {
|
|
|
+ private HashMap<Integer,Integer> cpCaseFusion(Integer oldCaseId, Integer newCaseId) {
|
|
|
+ HashMap<Integer,Integer> fusionNumIdMap = new HashMap<>();
|
|
|
List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(oldCaseId);
|
|
|
if(listByCaseId == null || listByCaseId.isEmpty()){
|
|
|
- return;
|
|
|
+ return fusionNumIdMap;
|
|
|
}
|
|
|
for (CaseFusion entity : listByCaseId) {
|
|
|
Integer oldFusionId = entity.getFusionId();
|
|
@@ -190,10 +193,12 @@ public class CopyCaseService {
|
|
|
caseFusionService.save(entity);
|
|
|
|
|
|
cpCaseViewByFusionId(oldFusionId,entity.getFusionId(),newCaseId);
|
|
|
- cpFusionNum(oldFusionId,entity.getFusionId());
|
|
|
+ cpFusionNum(oldFusionId,entity.getFusionId(),fusionNumIdMap);
|
|
|
|
|
|
cpFusionMeter(oldFusionId,entity.getFusionId());
|
|
|
+
|
|
|
}
|
|
|
+ return fusionNumIdMap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -300,7 +305,7 @@ public class CopyCaseService {
|
|
|
/**
|
|
|
* 复制案件标注
|
|
|
*/
|
|
|
- private void cpCaseTag(Integer oldCaseId, Integer newCaseId) {
|
|
|
+ private void cpCaseTag(Integer oldCaseId, Integer newCaseId, HashMap<Integer, Integer> fusionNumIdMap ) {
|
|
|
List<CaseTag> listByCaseId = caseTagService.getListByCaseId(oldCaseId);
|
|
|
if(listByCaseId == null || listByCaseId.isEmpty()){
|
|
|
return;
|
|
@@ -321,6 +326,7 @@ public class CopyCaseService {
|
|
|
for (CaseTagPoint caseTagPoint : caseTagPointList) {
|
|
|
caseTagPoint.setTagPointId(null);
|
|
|
caseTagPoint.setTagId(newTagId);
|
|
|
+ caseTagPoint.setFusionNumId(fusionNumIdMap.get(caseTagPoint.getFusionNumId()));
|
|
|
caseTagPointService.save(caseTagPoint);
|
|
|
}
|
|
|
|
|
@@ -441,15 +447,17 @@ public class CopyCaseService {
|
|
|
/**
|
|
|
* 复制案件编辑器ID
|
|
|
*/
|
|
|
- private void cpFusionNum(Integer oldFusionId, Integer newFusionId) {
|
|
|
+ private void cpFusionNum(Integer oldFusionId, Integer newFusionId,HashMap<Integer,Integer> fusionNumIdMap) {
|
|
|
List<FusionNum> listByCaseId = fusionNumService.getByFusionId(oldFusionId);
|
|
|
if(listByCaseId == null || listByCaseId.isEmpty()){
|
|
|
return;
|
|
|
}
|
|
|
for (FusionNum entity : listByCaseId) {
|
|
|
+ Integer oldId = entity.getFusionNumId();
|
|
|
entity.setFusionNumId(null);
|
|
|
entity.setFusionId(newFusionId);
|
|
|
fusionNumService.save(entity);
|
|
|
+ fusionNumIdMap.put(oldId,entity.getFusionNumId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -474,11 +482,18 @@ public class CopyCaseService {
|
|
|
/**
|
|
|
* 复制路线
|
|
|
*/
|
|
|
- private void cpPath(Integer oldCaseId,Integer newCaseId){
|
|
|
+ private void cpPath(Integer oldCaseId,Integer newCaseId,HashMap<Integer, Integer> fusionNumIdMap){
|
|
|
List<CasePath> casePaths = casePathService.getByCaseId(oldCaseId);
|
|
|
for (CasePath casePath : casePaths) {
|
|
|
casePath.setId(null);
|
|
|
casePath.setCaseId(newCaseId);
|
|
|
+ String oldPath = casePath.getPath();
|
|
|
+ String path = oldPath;
|
|
|
+ for (Integer oldId : fusionNumIdMap.keySet()) {
|
|
|
+ path = oldPath.replaceAll("\"modelId\":\""+oldId+"\"","\"fusionNumId\":\""+fusionNumIdMap.get(oldId)+"\"");
|
|
|
+ }
|
|
|
+ casePath.setPath(path);
|
|
|
+
|
|
|
casePathService.save(casePath);
|
|
|
}
|
|
|
}
|