|
@@ -1,6 +1,7 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -12,12 +13,14 @@ import com.gis.common.util.*;
|
|
|
import com.gis.domain.dto.*;
|
|
|
import com.gis.domain.entity.FodderEntity;
|
|
|
import com.gis.domain.entity.WorkEntity;
|
|
|
+import com.gis.domain.entity.WorkHotsFodderEntity;
|
|
|
import com.gis.domain.vo.ReportWorkVo;
|
|
|
import com.gis.mapper.*;
|
|
|
import com.gis.oss.util.FileAndOssUtil;
|
|
|
import com.gis.oss.util.FileUtils;
|
|
|
import com.gis.oss.util.QrCodeUtils;
|
|
|
import com.gis.service.FodderService;
|
|
|
+import com.gis.service.WorkHotsFodderService;
|
|
|
import com.gis.service.WorkService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -69,6 +72,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
@Autowired
|
|
|
FileAndOssUtil fileAndOssUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ WorkHotsFodderService workHotsFodderService;
|
|
|
|
|
|
|
|
|
|
|
@@ -496,6 +501,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
String scenes = someDataJson.getString("scenes");
|
|
|
String sceneCodes = getSceneCodes(scenes);
|
|
|
+ //保存热点的素材到表里面
|
|
|
+ saveHotsFodderId(scenes,entity.getId());
|
|
|
entity.setSceneCodes(sceneCodes);
|
|
|
// 2022-12-19 作品类型
|
|
|
String type = getTypeBySceneCodes(sceneCodes);
|
|
@@ -539,7 +546,54 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
String join = StringUtils.join(list, ",");
|
|
|
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());
|
|
|
+ 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");
|
|
|
+ for (Object hotspot : hotspots) {
|
|
|
+ JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
|
|
|
+ JSONArray fodderId = hotspotJson.getJSONArray("fodderId");
|
|
|
+ String hotspotTitle = hotspotJson.getString("hotspotTitle");
|
|
|
+ String name = hotspotJson.getString("name");
|
|
|
+ for (Object id : fodderId) {
|
|
|
+ WorkHotsFodderEntity entity= workHotsFodderService.findBySceneCodeAndWorkIdAndTitleAndNameAndFodderId(sceneCode,workId,hotspotTitle,name,Long.valueOf(String.valueOf(id)));
|
|
|
+ if (ObjectUtil.isNotNull(entity)){
|
|
|
+ entity.setSceneCode(sceneCode);
|
|
|
+ entity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
+ entity.setWorkId(workId);
|
|
|
+ entity.setTitle(hotspotTitle);
|
|
|
+ entity.setName(name);
|
|
|
+ workHotsFodderService.update(entity);
|
|
|
+ }else {
|
|
|
+ entity=new WorkHotsFodderEntity();
|
|
|
+ entity.setSceneCode(sceneCode);
|
|
|
+ entity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
+ entity.setWorkId(workId);
|
|
|
+ entity.setTitle(hotspotTitle);
|
|
|
+ entity.setName(name);
|
|
|
+ workHotsFodderService.save(entity);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 2022-12-19
|
|
|
* 获取作品类型
|
|
@@ -586,7 +640,31 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 场景码字符串转list
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<String> getFodderIdList(String param){
|
|
|
+ JSONArray array = JSONArray.parseArray(param);
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ for (Object o : array) {
|
|
|
+ JSONObject parse = JSONObject.parseObject(o.toString());
|
|
|
+ JSONArray someData = parse.getJSONArray("someData");
|
|
|
+ for (Object someDatum : someData) {
|
|
|
+ JSONObject someDataJson = JSONObject.parseObject(someDatum.toString());
|
|
|
+ if (someDataJson.containsKey("hotspots")){
|
|
|
+ JSONArray hotspots = someDataJson.getJSONArray("hotspots");
|
|
|
+ for (Object hotspot : hotspots) {
|
|
|
+ JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
/**
|
|
|
* 更新二维码
|
|
|
*/
|