|
@@ -1,6 +1,8 @@
|
|
package com.fdkankan.scene.service.impl;
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
|
+import cn.hutool.core.date.TimeInterval;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.net.multipart.UploadFile;
|
|
import cn.hutool.core.net.multipart.UploadFile;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -11,8 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
|
+import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.db.response.PageInfo;
|
|
import com.fdkankan.db.response.PageInfo;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.scene.bean.IconBean;
|
|
import com.fdkankan.scene.bean.IconBean;
|
|
@@ -27,10 +31,14 @@ import com.fdkankan.scene.service.IScenePlusService;
|
|
import com.fdkankan.scene.vo.*;
|
|
import com.fdkankan.scene.vo.*;
|
|
import com.fdkankan.web.response.ResultData;
|
|
import com.fdkankan.web.response.ResultData;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -239,36 +247,45 @@ public class SceneEvidenceServiceImpl extends ServiceImpl<ISceneEvidenceMapper,
|
|
return ResultData.ok(collect);
|
|
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);
|
|
|
|
- });
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void pushEvidence(BaseJsonArrayParamVO param) {
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
|
+ String kNo = scenePlus.getKNo();
|
|
|
|
+ for (JSONObject datum : param.getData()) {
|
|
|
|
+ manageHttpClient.push(datum);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void uploadScreenshot(MultipartFile[] files, String num) throws IOException {
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
|
+ if(scenePlus == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+ }
|
|
|
|
+ if(StrUtil.isEmpty(scenePlus.getKNo())){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> urlList = new ArrayList<>();
|
|
|
|
+ for (MultipartFile file : files) {
|
|
|
|
+ String fileName = file.getOriginalFilename();
|
|
|
|
+ // 获取文件后缀
|
|
|
|
+ String extName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
|
|
|
|
+ fileName = UUID.randomUUID().toString().concat(extName);
|
|
|
|
+ String path = String.format(ConstantFilePath.SCENE_TMP_PATH_V4, num).concat(fileName);
|
|
|
|
+ FileUtil.mkParentDirs(path);
|
|
|
|
+ file.transferTo(new File(path));
|
|
|
|
+ String ossPath = String.format(UploadFilePath.SCENE_NUM_PATH, num) + "screenshot/" + fileName;
|
|
|
|
+ fYunFileServiceInterface.uploadFile(path, ossPath);
|
|
|
|
+ urlList.add(ossPath);
|
|
|
|
+ FileUtils.delFile(path);
|
|
}
|
|
}
|
|
|
|
|
|
- System.out.println(data.toJSONString());
|
|
|
|
|
|
+ //调用案件系统接口,进行推送
|
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
|
+ param.put("kno", scenePlus.getKNo());
|
|
|
|
+ param.put("fileList", urlList);
|
|
|
|
+ manageHttpClient.pushScreenshot(param);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|