| | |
| | | import com.dji.sample.territory.model.entity.TbFjEntity; |
| | | import com.dji.sample.territory.service.ITbFJService; |
| | | import com.dji.sample.territory.utils.*; |
| | | import com.dji.sample.territory.utils.jym.SM2SignVO; |
| | | import com.dji.sample.territory.utils.jym.SM2SignVerUtils; |
| | | import com.dji.sample.territory.utils.jym.Util; |
| | | import org.bouncycastle.crypto.params.ECPrivateKeyParameters; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | |
| | | import static com.dji.sample.territory.utils.CoordinateSystemUtil.*; |
| | | import static com.dji.sample.territory.utils.SM2SignUtil.getSM2PrivateKey; |
| | | import static com.dji.sample.territory.utils.SM2SignUtil.signWithSM2; |
| | | import static com.dji.sample.territory.utils.SM3.addJym; |
| | | import static com.dji.sample.territory.utils.SM3.sm3; |
| | | |
| | | @Service |
| | | @DS("sqlite-ret") |
| | |
| | | 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"); |
| | | double pitch = json.getDouble("GimbalPitchDegree"); |
| | | String focal = json.getString("FocalLength"); |
| | | String numberPart = focal.replaceAll("[^\\d]", ""); |
| | | int psjj = Integer.parseInt(numberPart); |
| | |
| | | boolean endsWith = key.endsWith(".mp4"); |
| | | if (!endsWith) { |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree); |
| | | fjhxz = String.valueOf(SM3HashExample.HaXi(new File(file1.toURI()))); |
| | | byte[] bytesArray = Files.readAllBytes(file1.toPath()); |
| | | fjhxz= sm3(bytesArray); |
| | | FJ = fileToByteArray(file1); |
| | | } else { |
| | | file1 = VideoZipUtil.compressVideo(file, 800000, 128000, 1280, 720); |
| | | FJ = fileToByteArray(file1); |
| | | } |
| | | String hxz = HashUtil.calculateHash((fjhxz + "," + pssj + "," + lng + "," + lat + "," + gimbalYawDegree + "," + psjd + "," + pshgj + "," + psry + "," + zsdm).getBytes()); |
| | | String jym=SM2SignExamples.jym(hxz); |
| | | StringBuffer buffer=SM3.addStringBuffer(fjhxz,pssj,truncateToSevenDecimalPlaces(lng),truncateToSevenDecimalPlaces(lat),(int)pitch,(int)psjd,pshgj,psry,zsdm); |
| | | String jyms= SM3.addJym(buffer); |
| | | TbFjEntity.TbFjEntityBuilder builder = TbFjEntity.builder(); |
| | | if (lotInfo != null) { |
| | | builder.bsm(bsm) |
| | |
| | | .pshgj(pshgj) |
| | | .zsdm(zsdm) |
| | | .psry(psry) |
| | | .jym(jym) |
| | | .jym(jyms) |
| | | .url(url) |
| | | .pstz(pstz) |
| | | .fjyskd(width) |
| | |
| | | BigDecimal bd = new BigDecimal(value).setScale(7, RoundingMode.DOWN); |
| | | return bd.doubleValue(); |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String s= String.valueOf(SM3HashExample.HaXi(new File("src/main/resources/FJ_10.jpeg"))); |
| | | System.out.println(s); |
| | | } |
| | | } |