| | |
| | | String secret = SM4Util.generateSM4Key(); |
| | | String jsonBody = buildRequestBody(registDto); |
| | | String base64 = SM4Util.encrypt(secret, jsonBody); |
| | | String keys=Utils.encrypt(secret,"04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F"); |
| | | String keys=Utils.encrypt(secret,"04CF7CAE31B5130D1D5D1AC1DC2778D94533868A8D57FC02BBD97B688E07145DAAA96462DC83D9F348261F738D51C049770C43BA53B584917C9E30C6221B737CDD"); |
| | | String enSM2=Utils.hexToBase64(keys); |
| | | // 设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | |
| | | |
| | | // 使用 Hutool 的 JSONUtil 解析 JSON 字符串 |
| | | JSONObject jsonObject = JSONUtil.parseObj(response.getBody()); |
| | | |
| | | // 提取 data 字段的值 |
| | | String dataValue = jsonObject.getStr("data"); |
| | | |
| | | return SM4Util.decrypt(data,dataValue); |
| | | } catch (Exception e) { |
| | | // 异常处理 |
| | | throw new IllegalArgumentException("无人机机场注册失败: " + e.getMessage()); |
| | | return(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | DeviceExpanSionEntity drone = expanSionMapper.selectOne(new LambdaQueryWrapper<DeviceExpanSionEntity>() |
| | | .eq(DeviceExpanSionEntity::getWorkspaceId, workspaceId) |
| | | .eq(DeviceExpanSionEntity::getType, 1)); |
| | | registPort(airport); |
| | | AddDeviceDto dto = deviceEntityToDto(drone); |
| | | String secret = SM4Util.generateSM4Key(); |
| | | // 构建请求体 |
| | | String jsonBody = buildRequestBody(dto); |
| | | String base64 = SM4Util.encrypt(secret, jsonBody); |
| | | String keys=Utils.encrypt(secret,"04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F"); |
| | | String keys=Utils.encrypt(secret,"04CF7CAE31B5130D1D5D1AC1DC2778D94533868A8D57FC02BBD97B688E07145DAAA96462DC83D9F348261F738D51C049770C43BA53B584917C9E30C6221B737CDD"); |
| | | String enSM2=Utils.hexToBase64(keys); |
| | | // registPort(airport); |
| | | // 设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | |
| | | String.class); |
| | | HttpHeaders responseHeaders = response.getHeaders(); |
| | | String responseSecret = responseHeaders.getFirst("x-lc-secret"); |
| | | |
| | | String data=deSM2(responseSecret, "00D631FD5615416EAB63D33A9E66E801F95DE840567504210080006081DE877AE3"); |
| | | |
| | | // 使用 Hutool 的 JSONUtil 解析 JSON 字符串 |
| | | JSONObject jsonObject = JSONUtil.parseObj(response.getBody()); |
| | | // 提取 data 字段的值 |
| | |
| | | return SM4Util.decrypt(data,dataValue); |
| | | } catch (Exception e) { |
| | | // 异常处理 |
| | | return ("无人机机场设备注册失败: " + e.getMessage()); |
| | | return (e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> getDroneState(String deviceId) throws Exception { |
| | | String key = SM4Util.generateSM4Key(); |
| | | String secret = Utils.encrypt(key, "04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F"); |
| | | String secret = Utils.encrypt(key, "04CF7CAE31B5130D1D5D1AC1DC2778D94533868A8D57FC02BBD97B688E07145DAAA96462DC83D9F348261F738D51C049770C43BA53B584917C9E30C6221B737CDD"); |
| | | DroneStateDto data = getAirportFromCache(deviceId); |
| | | String json = JSON.toJSONString(data); |
| | | String SM4Screct = SM4Util.encrypt(key, json); |
| | |
| | | @Override |
| | | public Map<String, String> AddTask(String base64, String Secret, String username) throws Exception { |
| | | ReturnTaskParam param = new ReturnTaskParam(); |
| | | //获取SM4密钥 |
| | | String secret = SM4Util.generateSM4Key(); |
| | | //对SM4密钥进行SM2加密 |
| | | String retse = Utils.encrypt(secret, "04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F"); |
| | | String taskId = UUID.randomUUID().toString(); |
| | | String traceid = UUID.randomUUID().toString(); |
| | | //通过SM2私钥解密请求头里的secret获取SM4密钥 |
| | | String sm4Secrect = deSM2(Secret, "00D631FD5615416EAB63D33A9E66E801F95DE840567504210080006081DE877AE3"); |
| | | //使用从请求头里获取的SM4密钥解析请求参数 |
| | | String decryptedJson = SM4Util.decrypt(sm4Secrect, base64); |
| | | JSONObject jsonObject = new JSONObject(decryptedJson); |
| | | AddTaskDto addTaskDto = jsonToDto(jsonObject); |
| | | TaskInfo taskInfo = new TaskInfo(); |
| | | //获取设备Id |
| | | List<String> listx = convertStringToList(addTaskDto.getDeviceid()); |
| | | taskInfo.setId(traceid); |
| | | taskInfo.setTaskId(taskId); |
| | |
| | | for (TaskListDto taskListDto : tasklist) { |
| | | LotInfo lotInfo = convertToLotInfo(taskListDto); |
| | | lotInfo.setTaskId(taskId); |
| | | // |
| | | lotInfo.setType(1); |
| | | lotInfo.setTaskName(addTaskDto.getBizidname()); |
| | | lotInfo.setUserName(username); |
| | |
| | | String secret = SM4Util.generateSM4Key(); |
| | | String traceId = UUID.randomUUID().toString(); |
| | | Map<String,String> info =new HashMap<>(); |
| | | String retse = Utils.encrypt(secret, "04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F"); |
| | | String retse = Utils.encrypt(secret, "04CF7CAE31B5130D1D5D1AC1DC2778D94533868A8D57FC02BBD97B688E07145DAAA96462DC83D9F348261F738D51C049770C43BA53B584917C9E30C6221B737CDD"); |
| | | if (entity != null) { |
| | | DbUploadDto dto = DbEntityToDto(entity); |
| | | String data=buildRequestBody(dto); |
| | |
| | | System.out.println("秘钥对:" + createKeyPair); |
| | | String privateKey = createKeyPair.get(KeyConstant.PRIVATE_KEY); |
| | | String publicKey = createKeyPair.get(KeyConstant.PUBLIC_KEY); |
| | | String text = "2bc304ccba171672"; |
| | | String text = "5e7e49d94182bf4f"; |
| | | String encrypt = Utils.encrypt(text, "04225AACF606D800EA3C2C31FCF8FB161B15F7A8D0460DEB91013D4F228C455E76A2ED8D71BC6525B5DC5CC015C155479D8839950344AEE438A3A6305C90F8269F",ModeTypeEnum.BASE_MODE.getType()); |
| | | System.out.println("加密后密文:" + Utils.hexToBase64(encrypt)); |
| | | String decrypt = Utils.decrypt(text, "00D631FD5615416EAB63D33A9E66E801F95DE840567504210080006081DE877AE3",ModeTypeEnum.BASE_MODE.getType()); |
| | | String decrypt = Utils.decrypt(encrypt, "00D631FD5615416EAB63D33A9E66E801F95DE840567504210080006081DE877AE3",ModeTypeEnum.BASE_MODE.getType()); |
| | | // System.out.println("解密后明文:" + decrypt); |
| | | } |
| | | |
| | |
| | | */ |
| | | List<MediaFileDTO> getAllFilesByWorkspaceId(String workspaceId); |
| | | |
| | | void saveMarkFile(String workspaceId, FileUploadDTO files, File file1); |
| | | void saveMarkFile(String workspaceId, FileUploadDTO files, File file1,String dkbh); |
| | | PaginationData<MediaFileEntity> mediaQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName,String worksapceId,String isVedio,String jobId); |
| | | |
| | | PaginationData<MediaFileNailEntity> mediaNailQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName, String workspaceId, String type); |
| | |
| | | return Optional.ofNullable(fileEntity); |
| | | } |
| | | |
| | | public void saveMarkFile(String workspaceId, FileUploadDTO files, File file1) { |
| | | public void saveMarkFile(String workspaceId, FileUploadDTO files, File file1,String dkbh) { |
| | | try { |
| | | MediaFileMarkEntity file=fileUploadConvertToMarkEntity(files); |
| | | MediaFileMarkEntity mediaFileMarkEntity = new MediaFileMarkEntity(); |
| | |
| | | mediaFileMarkEntity.setObjectKey("/mark" + file.getFilePath() + "/" + file.getFileName()); |
| | | mediaFileMarkEntity.setFileName("mark" + file.getFileName()); |
| | | mediaFileMarkEntity.setFilePath("mark" + file.getFilePath()); |
| | | // uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", mediaFileMarkEntity.getObjectKey(), nailFile, "image/jpeg"); |
| | | long timestamp = convertToTimestamp(files.getMetadata().getCreatedTime()); |
| | | int type=getLotInfo(dkbh); |
| | | File markFile = new File(WaterMarkUtil.addWatermark(file1, timestamp, files.getMetadata().getShootPosition().getLat(), |
| | | files.getMetadata().getShootPosition().getLng(), files.getMetadata().getGimbalYawDegree(),type).toURI()); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", mediaFileMarkEntity.getObjectKey(), markFile, "image/jpeg"); |
| | | markMapper.insert(mediaFileMarkEntity); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | updateStatue(file.getName()); |
| | | saveFiles(workspaceId, file, downloadedFile); |
| | | if (isPlane==1){ |
| | | saveMarkFile(workspaceId, file, downloadedFile); |
| | | } |
| | | } |
| | | if (fileEntity.getFileName().endsWith("~")) { |
| | | fileEntity.setDkbh(getDkbh(fileEntity.getFileName())); |
| | | saveMarkFile(workspaceId, file, downloadedFile, fileEntity.getDkbh()); |
| | | } |
| | | waylineJobService.getName(fileEntity.getJobId()); |
| | | } |
| | | return mapper.insert(fileEntity); |
| | | } |
| | | |
| | |
| | | .eq(MediaFileEntity::getJobId, jobId)); |
| | | } |
| | | |
| | | public int getLotInfo(String dkbh){ |
| | | LotInfo lotInfo=patchesMapper.selectOne(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, dkbh)); |
| | | return lotInfo.getType(); |
| | | } |
| | | public int checkWaylineType(String jobId) { |
| | | WaylineJobEntity jobEntity = jobMapper.selectOne(new LambdaQueryWrapper<WaylineJobEntity>().eq(WaylineJobEntity::getJobId, jobId)); |
| | | WaylineFileEntity fileEntity=fileMapper.selectOne(new LambdaQueryWrapper<WaylineFileEntity>().eq(WaylineFileEntity::getWaylineId, jobEntity.getFileId())); |
| | |
| | | //对应图片和视频文件进行不同处理 |
| | | boolean endsWith = key.endsWith(".mp4"); |
| | | if (!endsWith) { |
| | | file1 = waterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree,lotInfo.getType()); |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree,lotInfo.getType()); |
| | | byte[] bytesArray = Files.readAllBytes(file1.toPath()); |
| | | fjhxz= sm3(bytesArray); |
| | | FJ = fileToByteArray(file1); |
| | |
| | | * @return 添加水印并压缩后的图片文件。 |
| | | * @throws IOException 如果读取或保存图片失败。 |
| | | */ |
| | | public File addWatermark(File file, Long pssj, Double lat, Double lng, Double angles, int type) throws IOException, FontFormatException { |
| | | public static File addWatermark(File file, Long pssj, Double lat, Double lng, Double angles, int type) throws IOException, FontFormatException { |
| | | double anglses = convertAngle(angles); |
| | | String angel = angle(anglses); |
| | | Long timestamp = pssj; // 例如:Unix 时间戳(以秒为单位) |
| | |
| | | # url: jdbc:mysql://182.108.40.114:3308/drone_zt_test?useSSL=false&allowPublicKeyRetrieval=true |
| | | # username: root |
| | | # password: yshb@123 |
| | | url: jdbc:mysql://139.196.74.78:3306/drone_o_test?useSSL=false&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://139.196.74.78:3306/drone_test?useSSL=false&allowPublicKeyRetrieval=true |
| | | username: root |
| | | password: jxpskj_2018 |
| | | sqlite-resource: |
| | |
| | | # BASIC parameters are required. |
| | | BASIC: |
| | | protocol: MQTT # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum |
| | | host: 182.108.40.114 |
| | | port: 31883 |
| | | username: root |
| | | password: root |
| | | host: 139.196.74.78 |
| | | port: 1883 |
| | | username: manage |
| | | password: 123456 |
| | | # host: 127.0.0.1 |
| | | # port: 1883 |
| | | # username: guest |
| | |
| | | path: |
| | | # 最初连接到mqtt时需要订阅的主题 多个订阅用 "," . |
| | | # inbound-topic: sys/product/+/status,thing/product/+/requests,thing/product/+/osd |
| | | inbound-topic: sys/product/+/+,thing/product/+/+ |
| | | inbound-topic: sys/product/+/status,thing/product/+/requests,thing/product/+/osd |
| | | DRC: |
| | | protocol: ws # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum |
| | | host: 182.108.40.114 |
| | | port: 35675 |
| | | path: /ws |
| | | protocol: WS # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum |
| | | host: 139.196.74.78 |
| | | port: 8083 |
| | | path: /mqtt |
| | | |
| | | oss: |
| | | enable: true |