|
@@ -168,65 +168,7 @@ public class SceneUpgradeToV4Service implements ISceneUpgradeToV4Service {
|
|
|
String path = sceneProExt.getDataSource();
|
|
|
|
|
|
//生成热点json文件
|
|
|
- Integer tags = Integer.valueOf(CommonStatus.NO.code());
|
|
|
- Set<String> icons = new HashSet<>();
|
|
|
- String hotJson = uploadToOssUtil.getObjectContent("4dkankan", dataPath + "hot.json");
|
|
|
- JSONArray newHotArr = new JSONArray();
|
|
|
- if(StrUtil.isNotBlank(hotJson)){
|
|
|
- JSONArray hotArr = JSON.parseArray(hotJson);
|
|
|
- if(hotArr.size() > 0){
|
|
|
- tags = Integer.valueOf(CommonStatus.YES.code());
|
|
|
- for(int i=0; i < hotArr.size(); i++){
|
|
|
- JSONObject oldHot = (JSONObject)hotArr.get(i);
|
|
|
- String styleId = oldHot.getString("styleId");
|
|
|
-
|
|
|
- JSONObject newHot = new JSONObject();
|
|
|
- newHot.put("createTime", Calendar.getInstance().getTimeInMillis() + i);
|
|
|
- newHot.put("icon", styleId);
|
|
|
-
|
|
|
- newHot.put("position", oldHot.getJSONObject("position"));
|
|
|
-
|
|
|
- JSONObject media = new JSONObject();
|
|
|
- newHot.put("media", media);
|
|
|
- JSONObject fileName = oldHot.getJSONObject("fileName");
|
|
|
- Set<Entry<String, Object>> entries = null;
|
|
|
- if(fileName != null){
|
|
|
- entries = fileName.entrySet();
|
|
|
- }
|
|
|
- if(CollUtil.isNotEmpty(entries)){
|
|
|
- for (Entry<String, Object> entry : entries) {
|
|
|
- JSONArray arr = new JSONArray();
|
|
|
- media.put(entry.getKey(), arr);
|
|
|
- JSONObject o = new JSONObject();
|
|
|
- arr.add(o);
|
|
|
- String fileSrc = ((String) entry.getValue());
|
|
|
- o.put("src", oldHot.getString("sid") + fileSrc.substring(fileSrc.lastIndexOf(".")));
|
|
|
- o.put("name", fileSrc);
|
|
|
- }
|
|
|
- }
|
|
|
- newHot.put("type", oldHot.getString("mediaType"));
|
|
|
- newHot.put("title", oldHot.getString("label"));
|
|
|
- newHot.put("content", oldHot.getString("description"));
|
|
|
- newHot.put("sid", oldHot.getString("sid"));
|
|
|
-
|
|
|
- if(StrUtil.isNotBlank(styleId)){
|
|
|
- icons.add(styleId);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- String hotJsonEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "hot.json";
|
|
|
- String hotJsonViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "hot.json";
|
|
|
- uploadToOssUtil.upload(hotJson.getBytes(), hotJsonEditPath);
|
|
|
- uploadToOssUtil.upload(hotJson.getBytes(), hotJsonViewPath);
|
|
|
-
|
|
|
- //写到本地文件
|
|
|
- JSONObject localObject = new JSONObject();
|
|
|
- localObject.put("tags", newHotArr);
|
|
|
- localObject.put("icons", icons);
|
|
|
- String hotJsonPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "hot.json";
|
|
|
- FileUtils.writeFile(hotJsonPath, localObject.toJSONString());
|
|
|
- }
|
|
|
+ Integer tags = this.createHotJson(dataPath, num);
|
|
|
|
|
|
boolean existLoadingLogo = false;
|
|
|
//生成编辑表
|
|
@@ -519,6 +461,69 @@ public class SceneUpgradeToV4Service implements ISceneUpgradeToV4Service {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Integer createHotJson(String dataPath, String num) throws IOException {
|
|
|
+ Integer tags = Integer.valueOf(CommonStatus.NO.code());
|
|
|
+// Set<String> icons = new HashSet<>();
|
|
|
+// String hotJson = uploadToOssUtil.getObjectContent("4dkankan", dataPath + "hot.json");
|
|
|
+// JSONArray newHotArr = new JSONArray();
|
|
|
+// if(StrUtil.isNotBlank(hotJson)){
|
|
|
+// JSONArray hotArr = JSON.parseArray(hotJson);
|
|
|
+// if(hotArr.size() > 0){
|
|
|
+// tags = Integer.valueOf(CommonStatus.YES.code());
|
|
|
+// for(int i=0; i < hotArr.size(); i++){
|
|
|
+// JSONObject oldHot = (JSONObject)hotArr.get(i);
|
|
|
+// String styleId = oldHot.getString("styleId");
|
|
|
+//
|
|
|
+// JSONObject newHot = new JSONObject();
|
|
|
+// newHot.put("createTime", Calendar.getInstance().getTimeInMillis() + i);
|
|
|
+// newHot.put("icon", styleId);
|
|
|
+//
|
|
|
+// newHot.put("position", oldHot.getJSONObject("position"));
|
|
|
+//
|
|
|
+// JSONObject media = new JSONObject();
|
|
|
+// newHot.put("media", media);
|
|
|
+// JSONObject fileName = oldHot.getJSONObject("fileName");
|
|
|
+// Set<Entry<String, Object>> entries = null;
|
|
|
+// if(fileName != null){
|
|
|
+// entries = fileName.entrySet();
|
|
|
+// }
|
|
|
+// if(CollUtil.isNotEmpty(entries)){
|
|
|
+// for (Entry<String, Object> entry : entries) {
|
|
|
+// JSONArray arr = new JSONArray();
|
|
|
+// media.put(entry.getKey(), arr);
|
|
|
+// JSONObject o = new JSONObject();
|
|
|
+// arr.add(o);
|
|
|
+// String fileSrc = ((String) entry.getValue());
|
|
|
+// o.put("src", oldHot.getString("sid") + fileSrc.substring(fileSrc.lastIndexOf(".")));
|
|
|
+// o.put("name", fileSrc);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// newHot.put("type", oldHot.getString("mediaType"));
|
|
|
+// newHot.put("title", oldHot.getString("label"));
|
|
|
+// newHot.put("content", oldHot.getString("description"));
|
|
|
+// newHot.put("sid", oldHot.getString("sid"));
|
|
|
+//
|
|
|
+// if(StrUtil.isNotBlank(styleId)){
|
|
|
+// icons.add(styleId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// String hotJsonEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "hot.json";
|
|
|
+// String hotJsonViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "hot.json";
|
|
|
+// uploadToOssUtil.upload(hotJson.getBytes(), hotJsonEditPath);
|
|
|
+// uploadToOssUtil.upload(hotJson.getBytes(), hotJsonViewPath);
|
|
|
+//
|
|
|
+// //写到本地文件
|
|
|
+// JSONObject localObject = new JSONObject();
|
|
|
+// localObject.put("tags", newHotArr);
|
|
|
+// localObject.put("icons", icons);
|
|
|
+// String hotJsonPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "hot.json";
|
|
|
+// FileUtils.writeFile(hotJsonPath, localObject.toJSONString());
|
|
|
+// }
|
|
|
+ return tags;
|
|
|
+ }
|
|
|
+
|
|
|
private void copyFileOss(String num, AtomicInteger completeCnt, AtomicInteger count, List<String> keyList, String sourcePath, String targetPah){
|
|
|
if(CollUtil.isEmpty(keyList))
|
|
|
return;
|