|
|
|
@ -3,40 +3,30 @@ package cn.org.landcloud.survey.data; |
|
|
|
|
import static cn.org.landcloud.survey.util.Constants.CERT_ORG_CODE; |
|
|
|
|
import static cn.org.landcloud.survey.util.Constants.TEST_CER; |
|
|
|
|
import static cn.org.landcloud.survey.util.Constants.TEST_CERT_ORG_PUBLICKEY; |
|
|
|
|
import static cn.org.landcloud.survey.util.Constants.TEST_PUBLICKEY; |
|
|
|
|
|
|
|
|
|
import android.content.Context; |
|
|
|
|
import android.os.Environment; |
|
|
|
|
import android.util.Base64; |
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
import androidx.exifinterface.media.ExifInterface; |
|
|
|
|
|
|
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.text.NumberFormat; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
import cn.org.landcloud.security.Util; |
|
|
|
|
import cn.org.landcloud.security.sm2.SM2SignVO; |
|
|
|
|
import cn.org.landcloud.security.sm2.SM2SignVerUtils; |
|
|
|
|
import cn.org.landcloud.security.sm3.SM3Utils; |
|
|
|
|
import cn.org.landcloud.survey.util.Constants; |
|
|
|
|
import cn.org.landcloud.survey.util.FileIOUtils; |
|
|
|
|
import cn.org.landcloud.survey.util.TimeUtils; |
|
|
|
|
import cn.org.landcloud.survey.util.Utils; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.DBInfo; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.DCHSXX; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.FJ; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.JMXX; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.KZXXYSJ; |
|
|
|
|
import cn.org.landcloud.survey.data.bean.TBJBXX; |
|
|
|
|
import cn.org.landcloud.survey.util.Constants; |
|
|
|
|
import cn.org.landcloud.survey.util.FileIOUtils; |
|
|
|
|
import cn.org.landcloud.survey.util.TimeUtils; |
|
|
|
|
import cn.org.landcloud.survey.util.Utils; |
|
|
|
|
|
|
|
|
|
public class DataRepositories { |
|
|
|
|
|
|
|
|
@ -181,15 +171,9 @@ public class DataRepositories { |
|
|
|
|
fj_phone_normal.setPSTZ("J"); |
|
|
|
|
|
|
|
|
|
File file = new File(Environment.getExternalStorageDirectory(),RELATIVE_FJ_DIR+"phone_1.jpg"); |
|
|
|
|
ExifInterface exifInterface; |
|
|
|
|
fj_phone_normal.setFJ(FileIOUtils.readFile2BytesByChannel(file)); |
|
|
|
|
try { |
|
|
|
|
fj_phone_normal.setFJHXZ(SM3Utils.sm3(file)); |
|
|
|
|
exifInterface = new ExifInterface(file); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_ARTIST, Base64Encode("test")); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, decimalToDMS(119.9854736)); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE, decimalToDMS(30.2776146)); |
|
|
|
|
exifInterface.saveAttributes(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
@ -220,9 +204,9 @@ public class DataRepositories { |
|
|
|
|
content.append(fj_phone_normal.getPSSJ()).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_normal.getLongitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_normal.getLatitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_normal.getPSFYJ())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_normal.getPSJD())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_normal.getPSHGJ())).append(","); |
|
|
|
|
content.append(fj_phone_normal.getPSFYJ()).append(","); |
|
|
|
|
content.append(fj_phone_normal.getPSJD()).append(","); |
|
|
|
|
content.append(fj_phone_normal.getPSHGJ()).append(","); |
|
|
|
|
content.append(fj_phone_normal.getPSRY()).append(","); |
|
|
|
|
content.append(fj_phone_normal.getZSDM()); |
|
|
|
|
String jym = Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY); |
|
|
|
@ -248,11 +232,6 @@ public class DataRepositories { |
|
|
|
|
fj_phone_panoramic.setFJ(FileIOUtils.readFile2BytesByChannel(file)); |
|
|
|
|
try { |
|
|
|
|
fj_phone_panoramic.setFJHXZ(SM3Utils.sm3(file)); |
|
|
|
|
exifInterface = new ExifInterface(file); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_ARTIST, Base64Encode("test")); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, decimalToDMS(119.9854813)); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE, decimalToDMS(30.2775860)); |
|
|
|
|
exifInterface.saveAttributes(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
@ -282,9 +261,9 @@ public class DataRepositories { |
|
|
|
|
content.append(fj_phone_panoramic.getPSSJ()).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_panoramic.getLongitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_panoramic.getLatitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_panoramic.getPSFYJ())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_panoramic.getPSJD())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_phone_panoramic.getPSHGJ())).append(","); |
|
|
|
|
content.append(fj_phone_panoramic.getPSFYJ()).append(","); |
|
|
|
|
content.append(fj_phone_panoramic.getPSJD()).append(","); |
|
|
|
|
content.append(fj_phone_panoramic.getPSHGJ()).append(","); |
|
|
|
|
content.append(fj_phone_panoramic.getPSRY()).append(","); |
|
|
|
|
content.append(fj_phone_panoramic.getZSDM()); |
|
|
|
|
fj_phone_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); |
|
|
|
@ -303,11 +282,6 @@ public class DataRepositories { |
|
|
|
|
fj_uav_normal.setFJ(FileIOUtils.readFile2BytesByChannel(file)); |
|
|
|
|
try { |
|
|
|
|
fj_uav_normal.setFJHXZ(SM3Utils.sm3(file)); |
|
|
|
|
exifInterface = new ExifInterface(file); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_ARTIST, Base64Encode("kmap")); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, decimalToDMS(119.9855061)); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE, decimalToDMS(30.2774821)); |
|
|
|
|
exifInterface.saveAttributes(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
@ -337,9 +311,9 @@ public class DataRepositories { |
|
|
|
|
content.append(fj_uav_normal.getPSSJ()).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_normal.getLongitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_normal.getLatitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_normal.getPSFYJ())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_normal.getPSJD())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_normal.getPSHGJ())).append(","); |
|
|
|
|
content.append(fj_uav_normal.getPSFYJ()).append(","); |
|
|
|
|
content.append(fj_uav_normal.getPSJD()).append(","); |
|
|
|
|
content.append(fj_uav_normal.getPSHGJ()).append(","); |
|
|
|
|
content.append(fj_uav_normal.getPSRY()).append(","); |
|
|
|
|
content.append(fj_uav_normal.getZSDM()); |
|
|
|
|
fj_uav_normal.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); |
|
|
|
@ -359,11 +333,6 @@ public class DataRepositories { |
|
|
|
|
fj_uav_panoramic.setFJ(FileIOUtils.readFile2BytesByChannel(file)); |
|
|
|
|
try { |
|
|
|
|
fj_uav_panoramic.setFJHXZ(SM3Utils.sm3(file)); |
|
|
|
|
exifInterface = new ExifInterface(file); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_ARTIST, Base64Encode("kmap")); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, decimalToDMS(119.9855061)); |
|
|
|
|
exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE, decimalToDMS(30.2774821)); |
|
|
|
|
exifInterface.saveAttributes(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
@ -393,9 +362,9 @@ public class DataRepositories { |
|
|
|
|
content.append(fj_uav_panoramic.getPSSJ()).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_panoramic.getLongitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_panoramic.getLatitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_panoramic.getPSFYJ())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_panoramic.getPSJD())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_uav_panoramic.getPSHGJ())).append(","); |
|
|
|
|
content.append(fj_uav_panoramic.getPSFYJ()).append(","); |
|
|
|
|
content.append(fj_uav_panoramic.getPSJD()).append(","); |
|
|
|
|
content.append(fj_uav_panoramic.getPSHGJ()).append(","); |
|
|
|
|
content.append(fj_uav_panoramic.getPSRY()).append(","); |
|
|
|
|
content.append(fj_uav_panoramic.getZSDM()); |
|
|
|
|
fj_uav_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); |
|
|
|
@ -442,9 +411,9 @@ public class DataRepositories { |
|
|
|
|
content.append(fj_video.getPSSJ()).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_video.getLongitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_video.getLatitude())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_video.getPSFYJ())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_video.getPSJD())).append(","); |
|
|
|
|
content.append(Utils.doubleFormat(fj_video.getPSHGJ())).append(","); |
|
|
|
|
content.append(fj_video.getPSFYJ()).append(","); |
|
|
|
|
content.append(fj_video.getPSJD()).append(","); |
|
|
|
|
content.append(fj_video.getPSHGJ()).append(","); |
|
|
|
|
content.append(fj_video.getPSRY()).append(","); |
|
|
|
|
content.append(fj_video.getZSDM()); |
|
|
|
|
fj_video.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); |
|
|
|
@ -500,22 +469,4 @@ public class DataRepositories { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String Base64Encode(String s) { |
|
|
|
|
return Base64.encodeToString(s.getBytes(), Base64.DEFAULT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 经纬度 转 度分秒 |
|
|
|
|
* |
|
|
|
|
* @param value - latitude or longitude |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private String decimalToDMS(double value) { |
|
|
|
|
int num1 = (int) Math.floor(value); |
|
|
|
|
int num2 = (int) Math.floor((value - num1) * 60); |
|
|
|
|
double num3 = (value - ((double) num1 + ((double) num2 / 60))) * 360000000; |
|
|
|
|
return num1 + "/1," + num2 + "/1," + num3 + "/100000"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|