| | |
| | | } |
| | | |
| | | public String getBizidnameByTask(String taskId) { |
| | | TaskInfo taskInfo = taskInfoMapper.selectOne(new LambdaQueryWrapper<TaskInfo>().eq(TaskInfo::getTaskId, taskId)); |
| | | return taskInfo.getName(); |
| | | List<LotInfo> lotInfos = patchesMapper.selectList(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getTaskId, taskId)); |
| | | String taskName = lotInfos.get(0).getTaskName(); |
| | | return taskName; |
| | | } |
| | | |
| | | public static String enSM2(String data, String pubKey) throws InvalidCipherTextException, IOException { |
| | |
| | | " \"1581F6QAD241800B6V95\",\n" + |
| | | " \"1581F6QAD241500BDZ3J\"\n" + |
| | | " ],\n" + |
| | | " \"bizidname\": \"2023年度全国国土变更调查举证模块\",\n" + |
| | | " \"taskid\": \"f78aed9f-86cd-4a49-87da-bbb9c7a1941d\",\n" + |
| | | " \"tasklist\": [\n" + |
| | | " {\n" + |
| | | " \"bsm\": \"2028107171717717107171017\",\n" + |
| | | " \"xzqdm\": \"310000\",\n" + |
| | | " \"dkbh\": \"ndbg201102U0172710711\",\n" + |
| | | " \"dklx\": \"ndbg2024\",\n" + |
| | | " \"dkmc\": \"小桥头\",\n" + |
| | | " \"dkmj\": 20.5,\n" + |
| | | " \"dkfw\": \"MULTIPOLYGON(((115.85261028414699 28.628065910491646,115.85234952636368 28.627469892700983,115.85043542990357 28.628240439727712,115.85050295853954 28.62842805760428,115.85071376127738 28.628739229859185,115.85080329411801 28.628869938164858,115.85261028414699 28.628065910491646)))\",\n" + |
| | | " \"bz\": null\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"bsm\": \"207\",\n" + |
| | | " \"xzqdm\": \"31000\",\n" + |
| | | " \"dkbh\": \"n1\",\n" + |
| | | " \"dklx\": \"n4\",\n" + |
| | | " \"dkmc\": \"小桥\",\n" + |
| | | " \"dkmj\": 20.5,\n" + |
| | | " \"dkfw\": \"MULTIPOLYGON(((115.86528871951153 28.625287925196325,115.86561708513025 28.625787612007546,115.86815834948467 28.624602640426623,115.86773004650362 28.62425999804172,115.86528871951153 28.625287925196325)))\",\n" + |
| | | " \"bz\": null\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"bsm\": \"20281071717177177\",\n" + |
| | | " \"xzqdm\": \"31000\",\n" + |
| | |
| | | */ |
| | | Integer saveFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException; |
| | | |
| | | void saveFiles(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException; |
| | | void saveFiles(String workspaceId, FileUploadDTO file,File mediaFile); |
| | | // void saveNailFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException; |
| | | |
| | | // void saveZipFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException; |
| | |
| | | Object data = ImgUtil.getInfo(downloadedFile); |
| | | fileEntity.setDroneData(data); |
| | | updateStatue(file.getName()); |
| | | saveFiles(workspaceId,file,downloadedFile); |
| | | } |
| | | return mapper.insert(fileEntity); |
| | | } |
| | | public void saveFiles(String workspaceId, FileUploadDTO file) { |
| | | public void saveFiles(String workspaceId, FileUploadDTO file,File mediaFile) { |
| | | // 更新文件状态 |
| | | updateStatue(file.getName()); |
| | | // updateStatue(file.getName()); |
| | | |
| | | try { |
| | | // 下载文件 |
| | | boolean endsWithMp4 = file.getObjectKey().endsWith(".mp4"); |
| | | |
| | | if (endsWithMp4) { |
| | | // 处理视频文件 |
| | | // MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file); |
| | | // zipEntity.setWorkspaceId(workspaceId); |
| | | // zipEntity.setFileId(UUID.randomUUID().toString()); |
| | | // zipMapper.insert(zipEntity); |
| | | |
| | | // 处理视频文件的其他逻辑(如果有) |
| | | } else { |
| | | // 处理图片文件 |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File downloadedFile = TbFjServiceImpl.downloadFile(url); |
| | | File nailFile = new File(ImgZipUtil.compressImage(downloadedFile, 50).toURI()); |
| | | File nailFile = new File(ImgZipUtil.compressImage(mediaFile, 50).toURI()); |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file); |
| | | Object data = ImgUtil.getInfo(downloadedFile); |
| | | nailEntity.setIsadd(0); |
| | | Object data = ImgUtil.getInfo(mediaFile); |
| | | // nailEntity.setIsadd(0); |
| | | nailEntity.setIsOriginal(false); |
| | | nailEntity.setDronedata(data); |
| | | nailEntity.setWorkspaceId(workspaceId); |
| | |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | |
| | | // 上传图片文件 |
| | | // uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", file.getObjectKey(), downloadedFile, "image/jpeg"); |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg"); |
| | | // uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg"); |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg"); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg"); |
| | | nailMapper.insert(nailEntity); |
| | | |
| | | // 处理压缩后的图片文件(如果有) |
| | | // File zipFile = new File(ImgZipUtil.compressImageAndGetFile(downloadedFile, 0.5f).toURI()); |
| | | // MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file); |
| | | // zipEntity.setIsOriginal(false); |
| | | // zipEntity.setWorkspaceId(workspaceId); |
| | | // zipEntity.setFileName("zip" + file.getName()); |
| | | // zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName()); |
| | | // zipEntity.setFilePath("zip" + file.getPath()); |
| | | // String zipName = zipEntity.getObjectKey(); |
| | | // zipEntity.setFileId(UUID.randomUUID().toString()); |
| | | File zipFile = new File(ImgZipUtil.compressImageAndGetFile(mediaFile, 0.5f).toURI()); |
| | | MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file); |
| | | zipEntity.setIsOriginal(false); |
| | | zipEntity.setWorkspaceId(workspaceId); |
| | | zipEntity.setFileName("zip" + file.getName()); |
| | | zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName()); |
| | | zipEntity.setFilePath("zip" + file.getPath()); |
| | | String zipName = zipEntity.getObjectKey(); |
| | | zipEntity.setFileId(UUID.randomUUID().toString()); |
| | | |
| | | // 上传压缩文件 |
| | | // uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), zipName, zipFile, "image/jpeg"); |
| | | // uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", zipName, zipFile, "image/jpeg"); |
| | | // zipMapper.insert(zipEntity); |
| | | } |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), zipName, zipFile, "image/jpeg"); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", zipName, zipFile, "image/jpeg"); |
| | | zipMapper.insert(zipEntity); |
| | | |
| | | } catch (IOException | ImageProcessingException e) { |
| | | // 处理异常 |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | @GetMapping("/getExcel") |
| | | public ResponseEntity<byte[]> exportExcel(@RequestParam String workspaceId) { |
| | | List<LotInfo> lotInfos = getPatchesService.listLotinfo(workspaceId); |
| | | public ResponseEntity<byte[]> exportExcel(@RequestParam String ids) { |
| | | // List<LotInfo> lotInfos = getPatchesService.listLotinfo(workspaceId); |
| | | try { |
| | | List<LotInfo> lotInfos = getPatchesService.getLotInfosByIDs(ids); |
| | | ByteArrayInputStream excelStream = ExcelUtil.exportLotInfoToExcel(lotInfos); |
| | | byte[] excelData = excelStream.readAllBytes(); |
| | | excelStream.close(); |
| | |
| | | return new ResponseEntity<>(excelData, headers, HttpStatus.OK); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new ResponseEntity<>(("Failed to generate Excel file.").getBytes(), HttpStatus.INTERNAL_SERVER_ERROR); |
| | | return new ResponseEntity<>(("生成excel失败.").getBytes(), HttpStatus.INTERNAL_SERVER_ERROR); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<LotInfo>listLotinfo(String workspaceID); |
| | | |
| | | void insertLotinfo(List<LotInfo> list); |
| | | |
| | | List<LotInfo> getLotInfosByIDs(String idsStr); |
| | | LotInfo getLotinfoToDb(String dkbh); |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | mapper.insert(list.get(i)); |
| | | } |
| | | } |
| | | public List<LotInfo> getLotInfosByIDs(String idsStr) { |
| | | List<String> idList = Arrays.asList(idsStr.split(",")); |
| | | return mapper.selectBatchIds(idList); |
| | | } |
| | | } |
| | |
| | | entity.setSize(getFileSize(file)) ; |
| | | entity.setHash(sm3(bytesArray)); |
| | | entity.setCount(dkbhSet.size());// 统计dkbh的数量 |
| | | entity.setUrl(territoryConfigPojo.getResultGtsave()+"/"+dbName); |
| | | entity.setUrl(territoryConfigPojo.getResultGtsave()+dbName); |
| | | entity.setRegioncode(code); |
| | | entity.setExtension(".db"); |
| | | entity.setAttachmentCount(count); |