|
@@ -1,14 +1,19 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.net.multipart.UploadFile;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.db.response.PageInfo;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.scene.bean.IconBean;
|
|
|
import com.fdkankan.scene.entity.*;
|
|
@@ -48,6 +53,8 @@ public class SceneEvidenceServiceImpl extends ServiceImpl<ISceneEvidenceMapper,
|
|
|
private ISceneIconService sceneIconService;
|
|
|
@Resource
|
|
|
private ManageHttpClient manageHttpClient;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
|
|
|
@Override
|
|
|
public void saveEvidence(SaveEvidenceParamVO param) throws Exception {
|
|
@@ -201,6 +208,68 @@ public class SceneEvidenceServiceImpl extends ServiceImpl<ISceneEvidenceMapper,
|
|
|
|
|
|
@Override
|
|
|
public ResultData refreshTraceEvidenceInfoList(String kno) {
|
|
|
- return null;
|
|
|
+ return manageHttpClient.refreshTraceEvidenceInfoList(kno);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData syncTraceEvidence(SaveEvidenceParamVO param) throws Exception {
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
+ if (scenePlus == null)
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+
|
|
|
+ List<JSONObject> collect = param.getDataList().stream().map(v -> {
|
|
|
+ JSONObject data = v.getData();
|
|
|
+ JSONArray medias = data.getJSONArray("media");
|
|
|
+ if (CollUtil.isNotEmpty(medias)) {
|
|
|
+ medias.stream().forEach(m -> {
|
|
|
+ JSONObject media = (JSONObject) m;
|
|
|
+ String path = media.getString("path");
|
|
|
+ String fileName = FileUtil.getName(path);
|
|
|
+ String newFileName = UUID.randomUUID().toString() + "." + FileUtil.extName(fileName);
|
|
|
+ String meshKey = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + newFileName;
|
|
|
+ fYunFileServiceInterface.copyFileInBucket(path, meshKey);
|
|
|
+ media.put("src", newFileName);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ this.saveEvidence(param);
|
|
|
+
|
|
|
+ return ResultData.ok(collect);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ JSONObject test = new JSONObject();
|
|
|
+ JSONArray medias = new JSONArray();
|
|
|
+ JSONObject media = new JSONObject();
|
|
|
+ media.put("src","name");
|
|
|
+ media.put("type","image");
|
|
|
+ JSONObject media2 = new JSONObject();
|
|
|
+ media2.put("src","name2");
|
|
|
+ media2.put("type","image2");
|
|
|
+ medias.add(media);
|
|
|
+ medias.add(media2);
|
|
|
+ test.put("media", medias);
|
|
|
+ System.out.println(test.toJSONString());
|
|
|
+
|
|
|
+ JSONObject data = JSON.parseObject(test.toJSONString());
|
|
|
+
|
|
|
+ JSONArray mediaList = data.getJSONArray("media");
|
|
|
+ if(CollUtil.isNotEmpty(mediaList)){
|
|
|
+ mediaList.stream().forEach(m->{
|
|
|
+ JSONObject media3 = (JSONObject) m;
|
|
|
+ String path = media3.getString("path");
|
|
|
+ String fileName = FileUtil.getName(path);
|
|
|
+ String newFileName = UUID.randomUUID().toString() + "." + FileUtil.extName(fileName);
|
|
|
+// String meshKey = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + newFileName;
|
|
|
+// fYunFileServiceInterface.copyFileInBucket(path, meshKey);
|
|
|
+ media3.put("src", newFileName);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println(data.toJSONString());
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|