1、平台兼容,15.0转换成15拼接jym内容

main
shisaiqun 2 years ago
parent 817baa355d
commit 160b1694e9
  1. 4
      app/build.gradle
  2. 1
      app/src/main/java/cn/org/landcloud/survey/MainActivity.java
  3. 79
      app/src/main/java/cn/org/landcloud/survey/data/DataRepositories.java
  4. 7
      app/src/main/java/cn/org/landcloud/survey/util/Utils.java

@ -37,7 +37,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.room:room-runtime:2.2.6" implementation "androidx.room:room-runtime:2.4.3"
annotationProcessor "androidx.room:room-compiler:2.2.6" annotationProcessor "androidx.room:room-compiler:2.4.3"
} }

@ -18,6 +18,7 @@ import androidx.core.content.ContextCompat;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import cn.org.landcloud.security.Util; import cn.org.landcloud.security.Util;

@ -16,7 +16,9 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.util.HashMap; import java.util.HashMap;
import cn.org.landcloud.security.Util; import cn.org.landcloud.security.Util;
@ -172,7 +174,7 @@ public class DataRepositories {
fj_phone_normal.setTBLX("JCTB"); fj_phone_normal.setTBLX("JCTB");
fj_phone_normal.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec20"); fj_phone_normal.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec20");
fj_phone_normal.setXZQDM("110101"); fj_phone_normal.setXZQDM("110101");
fj_phone_normal.setFJMC("110101"); fj_phone_normal.setFJMC("phone_1.jpg");
fj_phone_normal.setFJLX("0"); fj_phone_normal.setFJLX("0");
fj_phone_normal.setPSTZ("J"); fj_phone_normal.setPSTZ("J");
@ -205,19 +207,22 @@ public class DataRepositories {
//校验码 //校验码
StringBuffer content = new StringBuffer(); StringBuffer content = new StringBuffer();
// FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM // FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM
//注意,因平台问题,double类型15系统默认为15.0,需要NumberFormat转换成15拼接字符串生成校验码
content.append(fj_phone_normal.getFJHXZ()).append(","); content.append(fj_phone_normal.getFJHXZ()).append(",");
content.append(fj_phone_normal.getPSSJ()).append(","); content.append(fj_phone_normal.getPSSJ()).append(",");
content.append(fj_phone_normal.getLongitude()).append(","); content.append(Utils.doubleFormat(fj_phone_normal.getLongitude())).append(",");
content.append(fj_phone_normal.getLatitude()).append(","); content.append(Utils.doubleFormat(fj_phone_normal.getLatitude())).append(",");
content.append(fj_phone_normal.getPSFYJ()).append(","); content.append(Utils.doubleFormat(fj_phone_normal.getPSFYJ())).append(",");
content.append(fj_phone_normal.getPSJD()).append(","); content.append(Utils.doubleFormat(fj_phone_normal.getPSJD())).append(",");
content.append(fj_phone_normal.getPSHGJ()).append(","); content.append(Utils.doubleFormat(fj_phone_normal.getPSHGJ())).append(",");
content.append(fj_phone_normal.getPSRY()).append(","); content.append(fj_phone_normal.getPSRY()).append(",");
content.append(fj_phone_normal.getZSDM()); content.append(fj_phone_normal.getZSDM());
String jym = Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY); String jym = Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY);
fj_phone_normal.setJYM(jym); fj_phone_normal.setJYM(jym);
// SM2SignVO verify = SM2SignVerUtils.VerifySignSM2(Util.hexStringToBytes(TEST_PUBLICKEY), SM3Utils.sm3(content.toString()).getBytes(StandardCharsets.UTF_8), Util.hexStringToBytes(jym));
// SM2SignVO verify = SM2SignVerUtils.VerifySignSM2(Util.hexStringToBytes(TEST_PUBLICKEY), SM3Utils.sm3(tt).getBytes(StandardCharsets.UTF_8), Util.hexStringToBytes(jym));
// System.out.println("验签得到的R值:"+verify.getVerify_r()); // System.out.println("验签得到的R值:"+verify.getVerify_r());
// System.err.println("\n验签结果" +verify.isVerify()); // System.err.println("\n验签结果" +verify.isVerify());
@ -227,7 +232,7 @@ public class DataRepositories {
fj_phone_panoramic.setTBLX("JCTB"); fj_phone_panoramic.setTBLX("JCTB");
fj_phone_panoramic.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec21"); fj_phone_panoramic.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec21");
fj_phone_panoramic.setXZQDM("110101"); fj_phone_panoramic.setXZQDM("110101");
fj_phone_panoramic.setFJMC("110101"); fj_phone_panoramic.setFJMC("phone_panoramic_1.jpg");
fj_phone_panoramic.setFJLX("2"); fj_phone_panoramic.setFJLX("2");
fj_phone_panoramic.setPSTZ("J"); fj_phone_panoramic.setPSTZ("J");
@ -238,7 +243,7 @@ public class DataRepositories {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
fj_phone_panoramic.setPSSJ("2022:10:18 15:43:50"); fj_phone_panoramic.setPSSJ("2022-10-18 15:43:50");
//无人机时必填 //无人机时必填
// fj_phone_panoramic.setJDGD(null); // fj_phone_panoramic.setJDGD(null);
fj_phone_panoramic.setLongitude(119.9854813); fj_phone_panoramic.setLongitude(119.9854813);
@ -262,11 +267,11 @@ public class DataRepositories {
// FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM // FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM
content.append(fj_phone_panoramic.getFJHXZ()).append(","); content.append(fj_phone_panoramic.getFJHXZ()).append(",");
content.append(fj_phone_panoramic.getPSSJ()).append(","); content.append(fj_phone_panoramic.getPSSJ()).append(",");
content.append(fj_phone_panoramic.getLongitude()).append(","); content.append(Utils.doubleFormat(fj_phone_panoramic.getLongitude())).append(",");
content.append(fj_phone_panoramic.getLatitude()).append(","); content.append(Utils.doubleFormat(fj_phone_panoramic.getLatitude())).append(",");
content.append(fj_phone_panoramic.getPSFYJ()).append(","); content.append(Utils.doubleFormat(fj_phone_panoramic.getPSFYJ())).append(",");
content.append(fj_phone_panoramic.getPSJD()).append(","); content.append(Utils.doubleFormat(fj_phone_panoramic.getPSJD())).append(",");
content.append(fj_phone_panoramic.getPSHGJ()).append(","); content.append(Utils.doubleFormat(fj_phone_panoramic.getPSHGJ())).append(",");
content.append(fj_phone_panoramic.getPSRY()).append(","); content.append(fj_phone_panoramic.getPSRY()).append(",");
content.append(fj_phone_panoramic.getZSDM()); content.append(fj_phone_panoramic.getZSDM());
fj_phone_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); fj_phone_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY));
@ -277,7 +282,7 @@ public class DataRepositories {
fj_uav_normal.setTBLX("JCTB"); fj_uav_normal.setTBLX("JCTB");
fj_uav_normal.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec23"); fj_uav_normal.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec23");
fj_uav_normal.setXZQDM("110101"); fj_uav_normal.setXZQDM("110101");
fj_uav_normal.setFJMC("110101"); fj_uav_normal.setFJMC("photo_uav_1658133414992.jpg");
fj_uav_normal.setFJLX("1"); fj_uav_normal.setFJLX("1");
fj_uav_normal.setPSTZ("J"); fj_uav_normal.setPSTZ("J");
@ -288,7 +293,7 @@ public class DataRepositories {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
fj_uav_normal.setPSSJ("2022:07:18 16:35:21"); fj_uav_normal.setPSSJ("2022-07-18 16:35:21");
//无人机时必填 //无人机时必填
fj_uav_normal.setJDGD(-19d); fj_uav_normal.setJDGD(-19d);
fj_uav_normal.setLongitude(119.9855061); fj_uav_normal.setLongitude(119.9855061);
@ -312,11 +317,11 @@ public class DataRepositories {
// FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM // FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM
content.append(fj_uav_normal.getFJHXZ()).append(","); content.append(fj_uav_normal.getFJHXZ()).append(",");
content.append(fj_uav_normal.getPSSJ()).append(","); content.append(fj_uav_normal.getPSSJ()).append(",");
content.append(fj_uav_normal.getLongitude()).append(","); content.append(Utils.doubleFormat(fj_uav_normal.getLongitude())).append(",");
content.append(fj_uav_normal.getLatitude()).append(","); content.append(Utils.doubleFormat(fj_uav_normal.getLatitude())).append(",");
content.append(fj_uav_normal.getPSFYJ()).append(","); content.append(Utils.doubleFormat(fj_uav_normal.getPSFYJ())).append(",");
content.append(fj_uav_normal.getPSJD()).append(","); content.append(Utils.doubleFormat(fj_uav_normal.getPSJD())).append(",");
content.append(fj_uav_normal.getPSHGJ()).append(","); content.append(Utils.doubleFormat(fj_uav_normal.getPSHGJ())).append(",");
content.append(fj_uav_normal.getPSRY()).append(","); content.append(fj_uav_normal.getPSRY()).append(",");
content.append(fj_uav_normal.getZSDM()); content.append(fj_uav_normal.getZSDM());
fj_uav_normal.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); fj_uav_normal.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY));
@ -328,7 +333,7 @@ public class DataRepositories {
fj_uav_panoramic.setTBLX("JCTB"); fj_uav_panoramic.setTBLX("JCTB");
fj_uav_panoramic.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec24"); fj_uav_panoramic.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec24");
fj_uav_panoramic.setXZQDM("110101"); fj_uav_panoramic.setXZQDM("110101");
fj_uav_panoramic.setFJMC("110101"); fj_uav_panoramic.setFJMC("photo_uav_1658133423647_panoramic.jpg");
fj_uav_panoramic.setFJLX("3"); fj_uav_panoramic.setFJLX("3");
fj_uav_panoramic.setPSTZ("J"); fj_uav_panoramic.setPSTZ("J");
@ -339,7 +344,7 @@ public class DataRepositories {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
fj_uav_panoramic.setPSSJ("2022:07:18 16:36:44"); fj_uav_panoramic.setPSSJ("2022-07-18 16:36:44");
//无人机时必填 //无人机时必填
fj_uav_panoramic.setJDGD(-19d); fj_uav_panoramic.setJDGD(-19d);
fj_uav_panoramic.setLongitude(119.9855061); fj_uav_panoramic.setLongitude(119.9855061);
@ -363,11 +368,11 @@ public class DataRepositories {
// FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM // FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM
content.append(fj_uav_panoramic.getFJHXZ()).append(","); content.append(fj_uav_panoramic.getFJHXZ()).append(",");
content.append(fj_uav_panoramic.getPSSJ()).append(","); content.append(fj_uav_panoramic.getPSSJ()).append(",");
content.append(fj_uav_panoramic.getLongitude()).append(","); content.append(Utils.doubleFormat(fj_uav_panoramic.getLongitude())).append(",");
content.append(fj_uav_panoramic.getLatitude()).append(","); content.append(Utils.doubleFormat(fj_uav_panoramic.getLatitude())).append(",");
content.append(fj_uav_panoramic.getPSFYJ()).append(","); content.append(Utils.doubleFormat(fj_uav_panoramic.getPSFYJ())).append(",");
content.append(fj_uav_panoramic.getPSJD()).append(","); content.append(Utils.doubleFormat(fj_uav_panoramic.getPSJD())).append(",");
content.append(fj_uav_panoramic.getPSHGJ()).append(","); content.append(Utils.doubleFormat(fj_uav_panoramic.getPSHGJ())).append(",");
content.append(fj_uav_panoramic.getPSRY()).append(","); content.append(fj_uav_panoramic.getPSRY()).append(",");
content.append(fj_uav_panoramic.getZSDM()); content.append(fj_uav_panoramic.getZSDM());
fj_uav_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); fj_uav_panoramic.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY));
@ -377,7 +382,7 @@ public class DataRepositories {
fj_video.setTBLX("JCTB"); fj_video.setTBLX("JCTB");
fj_video.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec25"); fj_video.setTBBSM("8fd575622ffd45ff8ae9fba0b9c5ec25");
fj_video.setXZQDM("110101"); fj_video.setXZQDM("110101");
fj_video.setFJMC("110101"); fj_video.setFJMC("phone_video_1.mp4");
fj_video.setFJLX("4"); fj_video.setFJLX("4");
fj_video.setPSTZ("J"); fj_video.setPSTZ("J");
@ -393,9 +398,9 @@ public class DataRepositories {
// fj_video.setJDGD(null); // fj_video.setJDGD(null);
fj_video.setLongitude(119.9854736); fj_video.setLongitude(119.9854736);
fj_video.setLatitude(30.2776146); fj_video.setLatitude(30.2776146);
fj_video.setPSFYJ(15d); fj_video.setPSFYJ(15.1);
fj_video.setPSJD(230d); fj_video.setPSJD(230.1);
fj_video.setPSHGJ(0d); fj_video.setPSHGJ(0.1);
fj_video.setPSJJ(27d); fj_video.setPSJJ(27d);
fj_video.setXDGD(1.50d); fj_video.setXDGD(1.50d);
fj_video.setFJYSKD(480); fj_video.setFJYSKD(480);
@ -412,11 +417,11 @@ public class DataRepositories {
// FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM // FJHXZ,PSSJ,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSRY,ZSDM
content.append(fj_video.getFJHXZ()).append(","); content.append(fj_video.getFJHXZ()).append(",");
content.append(fj_video.getPSSJ()).append(","); content.append(fj_video.getPSSJ()).append(",");
content.append(fj_video.getLongitude()).append(","); content.append(Utils.doubleFormat(fj_video.getLongitude())).append(",");
content.append(fj_video.getLatitude()).append(","); content.append(Utils.doubleFormat(fj_video.getLatitude())).append(",");
content.append(fj_video.getPSFYJ()).append(","); content.append(Utils.doubleFormat(fj_video.getPSFYJ())).append(",");
content.append(fj_video.getPSJD()).append(","); content.append(Utils.doubleFormat(fj_video.getPSJD())).append(",");
content.append(fj_video.getPSHGJ()).append(","); content.append(Utils.doubleFormat(fj_video.getPSHGJ())).append(",");
content.append(fj_video.getPSRY()).append(","); content.append(fj_video.getPSRY()).append(",");
content.append(fj_video.getZSDM()); content.append(fj_video.getZSDM());
fj_video.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY)); fj_video.setJYM(Utils.makeJYM(content.toString(),Constants.TEST_PRIVATEKEY));

@ -1,6 +1,8 @@
package cn.org.landcloud.survey.util; package cn.org.landcloud.survey.util;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import cn.org.landcloud.security.Util; import cn.org.landcloud.security.Util;
import cn.org.landcloud.security.sm2.SM2; import cn.org.landcloud.security.sm2.SM2;
@ -28,4 +30,9 @@ public class Utils {
} }
return null; return null;
} }
public static String doubleFormat(double value) {
DecimalFormat df = new DecimalFormat("##########.#########");
return df.format(value);
}
} }

Loading…
Cancel
Save