|
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gis.common.constant.ConfigConstant;
|
|
|
import com.gis.common.constant.ErrorEnum;
|
|
|
import com.gis.common.constant.RedisConstant;
|
|
|
+import com.gis.common.constant.SomeDataConstant;
|
|
|
import com.gis.common.exception.BaseRuntimeException;
|
|
|
import com.gis.common.util.*;
|
|
|
import com.gis.domain.dto.*;
|
|
@@ -503,6 +504,52 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
String sceneCodes = getSceneCodes(scenes);
|
|
|
//保存热点的素材到表里面
|
|
|
saveHotsFodderId(scenes,entity.getId());
|
|
|
+
|
|
|
+ JSONObject coverInfo = someDataJson.getJSONObject("coverInfo");
|
|
|
+ if (coverInfo.containsKey("fodderId")){
|
|
|
+ JSONArray fodderId = coverInfo.getJSONArray("fodderId");
|
|
|
+ if (fodderId.size()>0){
|
|
|
+ //需要更新时候,先删除关联,在保存关联
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.coverInfo);
|
|
|
+ }
|
|
|
+ for (Object id : fodderId) {
|
|
|
+ saveOrEditFodder(entity, id,SomeDataConstant.coverInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject customMask = someDataJson.getJSONObject("customMask");
|
|
|
+ JSONObject earth= customMask.getJSONObject("earth");
|
|
|
+ JSONObject sky=customMask.getJSONObject("sky");
|
|
|
+ if (earth.containsKey("fodderId")&&ObjectUtil.isNotNull(earth.getLong("fodderId"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.customMask_earth);
|
|
|
+ saveOrEditFodder(entity, earth.getLong("fodderId"),SomeDataConstant.customMask_earth);
|
|
|
+ }
|
|
|
+ if (sky.containsKey("fodderId")&&ObjectUtil.isNotNull(sky.getLong("fodderId"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.customMask_sky);
|
|
|
+ saveOrEditFodder(entity, sky.getLong("fodderId"),SomeDataConstant.customMask_sky);
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject backgroundMusic = someDataJson.getJSONObject("backgroundMusic");
|
|
|
+ if (backgroundMusic.containsKey("id")&&ObjectUtil.isNotNull(backgroundMusic.getLong("id"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.backgroundMusic);
|
|
|
+ saveOrEditFodder(entity, backgroundMusic.getLong("id"),SomeDataConstant.backgroundMusic);
|
|
|
+ }
|
|
|
+ if (someDataJson.containsKey("logoId")&&ObjectUtil.isNotNull(someDataJson.getLong("logoId"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.logo);
|
|
|
+ saveOrEditFodder(entity, someDataJson.getLong("id"),SomeDataConstant.logo);
|
|
|
+ }
|
|
|
+ if (someDataJson.containsKey("pcIconId")&&ObjectUtil.isNotNull(someDataJson.getLong("pcIconId"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.pcIcon);
|
|
|
+ saveOrEditFodder(entity, someDataJson.getLong("pcIconId"),SomeDataConstant.pcIcon);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (someDataJson.containsKey("appIconId")&&ObjectUtil.isNotNull(someDataJson.getLong("appIconId"))){
|
|
|
+ workHotsFodderService.removeByWorkIdAndType(entity.getId(), SomeDataConstant.appIcon);
|
|
|
+ saveOrEditFodder(entity, someDataJson.getLong("appIconId"),SomeDataConstant.appIcon);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
entity.setSceneCodes(sceneCodes);
|
|
|
// 2022-12-19 作品类型
|
|
|
String type = getTypeBySceneCodes(sceneCodes);
|
|
@@ -526,6 +573,21 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void saveOrEditFodder(WorkEntity entity, Object id,String type) {
|
|
|
+ WorkHotsFodderEntity workHotsFodderEntity= workHotsFodderService.findByWorkIdAndFodderIdAndType(entity.getId(),Long.valueOf(String.valueOf(id)), type);
|
|
|
+ if (ObjectUtil.isNotNull(workHotsFodderEntity)){
|
|
|
+ workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
+ workHotsFodderEntity.setWorkId(entity.getId());
|
|
|
+ workHotsFodderService.update(workHotsFodderEntity);
|
|
|
+ }else {
|
|
|
+ workHotsFodderEntity=new WorkHotsFodderEntity();
|
|
|
+ workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
+ workHotsFodderEntity.setWorkId(entity.getId());
|
|
|
+ workHotsFodderEntity.setType(type);
|
|
|
+ workHotsFodderService.save(workHotsFodderEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* someDataToJson
|
|
|
* @param param someDataStr
|
|
@@ -547,16 +609,17 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
return join;
|
|
|
}
|
|
|
/**
|
|
|
- * 保存当前作品引用的素材
|
|
|
+ * 保存当前作品热点引用的素材
|
|
|
* @param param
|
|
|
*/
|
|
|
private void saveHotsFodderId(String param,String workId){
|
|
|
JSONArray array = JSONArray.parseArray(param);
|
|
|
for (Object o : array) {
|
|
|
JSONObject parse = JSONObject.parseObject(o.toString());
|
|
|
+ String sceneCode= parse.getString("sceneCode");
|
|
|
+
|
|
|
if (parse.containsKey("someData")) {
|
|
|
JSONObject someData = parse.getJSONObject("someData");
|
|
|
- String sceneCode= parse.getString("sceneCode");
|
|
|
log.info("素材包含someData,进行热点处理");
|
|
|
if (someData.containsKey("hotspots")){
|
|
|
JSONArray hotspots = someData.getJSONArray("hotspots");
|
|
@@ -569,16 +632,17 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
if (fodderId.size()>0){
|
|
|
//需要更新时候,先删除关联,在保存关联
|
|
|
- workHotsFodderService.removeBySceneCodeAndWorkIdAndTitleAndName(sceneCode,workId,name);
|
|
|
+ workHotsFodderService.removeBySceneCodeAndWorkIdAndType(sceneCode,workId, SomeDataConstant.hot);
|
|
|
}
|
|
|
for (Object id : fodderId) {
|
|
|
- WorkHotsFodderEntity entity= workHotsFodderService.findBySceneCodeAndWorkIdAndTitleAndNameAndFodderId(sceneCode,workId,hotspotTitle,name,Long.valueOf(String.valueOf(id)));
|
|
|
+ WorkHotsFodderEntity entity= workHotsFodderService.findBySceneCodeAndWorkIdAndTitleAndNameAndFodderIdAndType(sceneCode,workId,hotspotTitle,name,Long.valueOf(String.valueOf(id)), SomeDataConstant.hot);
|
|
|
if (ObjectUtil.isNotNull(entity)){
|
|
|
entity.setSceneCode(sceneCode);
|
|
|
entity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
entity.setWorkId(workId);
|
|
|
entity.setTitle(hotspotTitle);
|
|
|
entity.setName(name);
|
|
|
+ entity.setType(SomeDataConstant.hot);
|
|
|
workHotsFodderService.update(entity);
|
|
|
}else {
|
|
|
entity=new WorkHotsFodderEntity();
|
|
@@ -587,6 +651,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
entity.setWorkId(workId);
|
|
|
entity.setTitle(hotspotTitle);
|
|
|
entity.setName(name);
|
|
|
+ entity.setType(SomeDataConstant.hot);
|
|
|
workHotsFodderService.save(entity);
|
|
|
|
|
|
}
|
|
@@ -597,7 +662,32 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (parse.containsKey("explanation")){
|
|
|
+ JSONObject explanation = parse.getJSONObject("explanation");
|
|
|
+ if (explanation.containsKey("audioId")&&ObjectUtil.isNotNull(explanation.getLong("audioId"))){
|
|
|
+ Long audioId = explanation.getLong("audioId");
|
|
|
+ String audioName = explanation.getString("audioName");
|
|
|
+ workHotsFodderService.removeBySceneCodeWorkIdAndType(sceneCode,workId, SomeDataConstant.explanation_audio);
|
|
|
+ WorkHotsFodderEntity workHotsFodderEntity= workHotsFodderService.findByWorkIdAndFodderIdAndType(workId,audioId, SomeDataConstant.explanation_audio);
|
|
|
+ if (ObjectUtil.isNotNull(workHotsFodderEntity)){
|
|
|
+ workHotsFodderEntity.setSceneCode(sceneCode);
|
|
|
+ workHotsFodderEntity.setFodderId(audioId);
|
|
|
+ workHotsFodderEntity.setWorkId(workId);
|
|
|
+ workHotsFodderEntity.setName(audioName);
|
|
|
+ workHotsFodderEntity.setType(SomeDataConstant.explanation_audio);
|
|
|
+ workHotsFodderService.update(workHotsFodderEntity);
|
|
|
+ }else {
|
|
|
+ workHotsFodderEntity=new WorkHotsFodderEntity();
|
|
|
+ workHotsFodderEntity.setSceneCode(sceneCode);
|
|
|
+ workHotsFodderEntity.setFodderId(audioId);
|
|
|
+ workHotsFodderEntity.setWorkId(workId);
|
|
|
+ workHotsFodderEntity.setName(audioName);
|
|
|
+ workHotsFodderEntity.setType(SomeDataConstant.explanation_audio);
|
|
|
+ workHotsFodderService.save(workHotsFodderEntity);
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/**
|