| | |
| | | package com.dji.sample.territory.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.dji.sample.media.model.MediaFileEntity; |
| | | import com.dji.sample.media.util.ImgUtil; |
| | | import com.dji.sample.patches.config.pojo.PatchesConfigPojo; |
| | | import com.dji.sample.patches.model.entity.LotInfo; |
| | | import com.dji.sample.territory.dao.ITbFjMapper; |
| | |
| | | |
| | | public void insertOneData(MediaFileEntity mediaFile, LotInfo lotInfo) throws Exception { |
| | | TbFjEntity tbFj = dbConvertToEntity(mediaFile, lotInfo); |
| | | if (tbFj.getFjysgd()==3000){ |
| | | if (tbFj.getFjysgd() == 3000) { |
| | | tbFjMapper.insert(tbFj); |
| | | } |
| | | } |
| | |
| | | // double x = Double.parseDouble(((formatCoordinate(coordinates[1])))); |
| | | // double y = Double.parseDouble(((formatCoordinate(coordinates[0])))); |
| | | //本地数据库没有的数据在FJ表非空用0 |
| | | int psjd = 0; |
| | | double psjd = WaterMarkUtil.convertAngle(gimbalYawDegree); |
| | | int pshgj = 0; |
| | | String psry = "中图智绘无人机"; |
| | | String zsdm = "23C8CCC61E3042FBA6A658F319337B1A"; |
| | |
| | | String head = "http://dev.jxpskj.com:9000/cloud-bucket"; |
| | | String url = head + key; |
| | | File file = downloadFile(url); |
| | | // JSONObject jsonObjects = JSONObject.parseObject(ImgUtil.getInfo(file)); |
| | | JSONObject jsons = (JSONObject) (ImgUtil.getInfo(file)); |
| | | String str = jsons.toJSONString(); |
| | | String newstr = str.replace("+", ""); |
| | | JSONObject json = JSON.parseObject(newstr); |
| | | Double pitch = json.getDouble("GimbalPitchDegree"); |
| | | String focal = json.getString("FocalLength"); |
| | | String numberPart = focal.replaceAll("[^\\d]", ""); |
| | | int psjj = Integer.parseInt(numberPart); |
| | | json.getString("GimbalYawDegree"); |
| | | String fjhxz = HashUtil.SM3Hash(file); |
| | | BufferedImage image = ImageIO.read(file); |
| | | int width = image.getWidth(); |
| | |
| | | //对应图片和视频文件进行不同处理 |
| | | boolean endsWith = key.endsWith(".mp4"); |
| | | if (!endsWith) { |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree); |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree); |
| | | FJ = fileToByteArray(file1); |
| | | } else { |
| | | file1 = VideoZipUtil.compressVideo(file, 800000, 128000, 1280, 720); |
| | |
| | | .Latitude(truncateToSevenDecimalPlaces(lat)) |
| | | .longitude(truncateToSevenDecimalPlaces(lng)) |
| | | .fj(FJ) |
| | | .psjj(psjj) |
| | | .fjmc(fjmc) |
| | | .fjlx(fjlx) |
| | | .psfyj(gimbalYawDegree) |
| | | .psfyj(pitch) |
| | | .pssj(pssj) |
| | | .psjd(psjd) |
| | | .psjd((int) psjd) |
| | | .fjhxz(fjhxz) |
| | | .pshgj(pshgj) |
| | | .zsdm(zsdm) |
| | |
| | | BigDecimal bd = new BigDecimal(value).setScale(2, RoundingMode.DOWN); |
| | | return bd.doubleValue(); |
| | | } |
| | | |
| | | public static Double truncateToSevenDecimalPlaces(Double value) { |
| | | if (value == null) { |
| | | return null; // 处理null值情况 |