lyhzzz hace 1 semana
padre
commit
c9109bebce

+ 16 - 20
4dkankan-utils-dxf/src/main/java/com/fdkankan/dxf/parse/utils/LaserMeterToDxfUtil.java

@@ -127,17 +127,18 @@ public class LaserMeterToDxfUtil {
         Vector3 point3d2 = new Vector3(point2.getDouble("x"),point2.getDouble("y"),point2.getDouble("z"));
         Vector3 startPoint;
         Vector3 endPoint ;
-        if(viewpoint == 0){ //俯视角
-            startPoint = new Vector3((point1.getDouble("x") ) * 100 ,(point1.getDouble("y")) * 100,0);
-            endPoint = new Vector3((point2.getDouble("x") ) * 100 ,(point2.getDouble("y")) * 100,0);
-        }else if(viewpoint ==1) {
-            startPoint = new Vector3((point1.getDouble("x") ) * 100 ,(point1.getDouble("z")) * 100,0);
-            endPoint = new Vector3((point2.getDouble("x") ) * 100 ,(point2.getDouble("z")) * 100,0);
-        }else {
-            startPoint = new Vector3((point1.getDouble("y") ) * 100 ,(point1.getDouble("z")) * 100,0);
-            endPoint = new Vector3((point2.getDouble("y") ) * 100 ,(point2.getDouble("z")) * 100,0);
-        }
-
+//        if(viewpoint == 0){ //俯视角
+//            startPoint = new Vector3((point1.getDouble("x") ) * 100 ,(point1.getDouble("y")) * 100,(point1.getDouble("z")) * 100);
+//            endPoint = new Vector3((point2.getDouble("x") ) * 100 ,(point2.getDouble("y")) * 100,(point2.getDouble("z")) * 100);
+//        }else if(viewpoint ==1) {
+//            startPoint = new Vector3((point1.getDouble("x") ) * 100 ,(point1.getDouble("z")) * 100,0);
+//            endPoint = new Vector3((point2.getDouble("x") ) * 100 ,(point2.getDouble("z")) * 100,0);
+//        }else {
+//            startPoint = new Vector3((point1.getDouble("y") ) * 100 ,(point1.getDouble("z")) * 100,0);
+//            endPoint = new Vector3((point2.getDouble("y") ) * 100 ,(point2.getDouble("z")) * 100,0);
+//        }
+        startPoint = new Vector3((point1.getDouble("x") ) * 100 ,(point1.getDouble("y")) * 100,(point1.getDouble("z")) * 100);
+        endPoint = new Vector3((point2.getDouble("x") ) * 100 ,(point2.getDouble("y")) * 100,(point2.getDouble("z")) * 100);
         pointSet.add(startPoint);
         pointSet.add(endPoint);
         drawLinePoint(startPoint,endPoint,dxfDocWriter);
@@ -147,8 +148,9 @@ public class LaserMeterToDxfUtil {
 
         double px = startPoint.getX() + (2.0/5.0) * (endPoint.getX() - startPoint.getX());
         double py = startPoint.getY() + (2.0/5.0) * (endPoint.getY() - startPoint.getY());
+        double pz = startPoint.getZ() + (2.0/5.0) * (endPoint.getZ() - startPoint.getZ());
 
-        Vector3 vector3 = new Vector3(px   , py  , 0);
+        Vector3 vector3 = new Vector3(px   , py  , pz);
         dxfText.setStartPoint(vector3);
         dxfText.setText(bigDecimal.toString()+"m");
         dxfText.setAngle(angleBetween(startPoint,endPoint));
@@ -159,8 +161,8 @@ public class LaserMeterToDxfUtil {
 
     public static void drawLinePoint(Vector3 point,Vector3 point2,DxfDocWriter dxfDocWriter){
         DxfLine dxfLine = new DxfLine();
-        dxfLine.setStartPoint(new Vector3(point.getX(), point.getY(), 0));
-        dxfLine.setEndPoint(new Vector3(point2.getX(), point2.getY(), 0));
+        dxfLine.setStartPoint(new Vector3(point.getX(), point.getY(), point.getZ()));
+        dxfLine.setEndPoint(new Vector3(point2.getX(), point2.getY(), point2.getZ()));
         dxfLine.setColor(new Color(255,255,255));
         dxfDocWriter.addEntity(dxfLine);
     }
@@ -192,12 +194,6 @@ public class LaserMeterToDxfUtil {
         String inPath ="D:\\cad\\work\\111\\1.json";
         String outPath ="D:\\cad\\work\\111\\"+new Date().getTime()+".dxf";
         LaserMeterToDxfUtil.toDxf(new File(inPath),outPath, 0);  //俯视
-        Thread.sleep(1000L);
-        String outPath2 ="D:\\cad\\work\\111\\"+new Date().getTime()+".dxf";
-        LaserMeterToDxfUtil.toDxf(new File(inPath),outPath2, 1); //正视
-        Thread.sleep(1000L);
-        String outPath3 ="D:\\cad\\work\\111\\"+new Date().getTime()+".dxf";
-        LaserMeterToDxfUtil.toDxf(new File(inPath),outPath3, 2); //侧视
     }
 
 

+ 2 - 2
4dkankan-utils-sign/src/main/java/com/fdkankan/sign/AesUtil.java

@@ -106,7 +106,7 @@ public class AesUtil {
      * 测试
      */
     public static void main(String args[]) throws Exception {
-        String data = "Aa123456";
+        String data = "Aa111111";
 //        String key = getRandomStringKey();  //0000001210830863
 //        String iv = getRandomStringIv();    //1xo1ub7m2rsz92ev
 
@@ -115,7 +115,7 @@ public class AesUtil {
         String enData = encrypt(data, key, iv);
 
         System.out.println(enData);
-        System.out.println(desEncrypt("TZzjrkwzWTLne1McWX+VaA==", key, iv));
+        System.out.println(desEncrypt("vvEsbkugGPaFjGJeZ6MHK2joojv0juIMeUoa\\/oJMUi8=", key, iv));
     }
 }
 

+ 90 - 0
4dkankan-utils-sign/src/main/java/com/fdkankan/sign/Base64Converter.java

@@ -0,0 +1,90 @@
+package com.fdkankan.sign;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Base64;
+
+public class Base64Converter {
+
+    public final static Base64.Encoder encoder = Base64.getEncoder();
+    final static Base64.Decoder decoder = Base64.getDecoder();
+    static char[] arr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
+
+    /**
+     * 给字符串加密
+     * @param text
+     * @return
+     */
+    public static String encode(String text) {
+        byte[] textByte = new byte[0];
+        try {
+            textByte = text.getBytes("UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        String encodedText = encoder.encodeToString(textByte);
+        return encodedText;
+    }
+
+    /**
+     * 给字符串加密
+     * @param textByte
+     * @return
+     */
+    public static String encode(byte[] textByte) {
+        return encoder.encodeToString(textByte);
+    }
+
+    /**
+     * 将加密后的字符串进行解密
+     * @param encodedText
+     * @return
+     */
+    public static String decode(String encodedText) {
+        String text = null;
+        try {
+            text = new String(decoder.decode(encodedText), "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return text;
+    }
+
+    /**
+     * 根据逻辑截取加密后的密碼
+     * @param text
+     * @return
+     */
+    public static String subText(String text){
+        //去掉前8位字符串
+        text = text.substring(8);
+        //去掉后8位字符串
+        text = text.substring(0, text.length() - 8);
+        //最后两个字符串换到前面,并且去掉剩下的后8位字符串
+        String result = text.substring(text.length() - 2) + text.substring(0, text.length() - 10);
+        return result;
+    }
+
+
+    public static  String getEncode(String str){
+        int num = 2;
+        String front = randomWord(8);
+        String middle = randomWord(8);
+        String end = randomWord(8);
+
+        String str1 = str.substring(0, num);
+        String str2 = str.substring(num);
+
+        return front + str2 + middle + str1 + end ;
+    }
+
+    public static String randomWord ( Integer min) {
+        String str = "";
+        Integer range = min;
+        // 随机产生
+        for (int i = 0; i < range; i++) {
+            int pos = (int) Math.round(Math.random() * (arr.length - 1));
+            str += arr[pos];
+        }
+        return str;
+    }
+}

+ 1 - 1
4dkankan-utils-sign/src/main/java/com/fdkankan/sign/RsaUtils.java

@@ -31,7 +31,7 @@ public class RsaUtils {
 		KeyPairInfo keyPair = getKeyPair();
 		String publicKey = keyPair.getPublicKey();
 		String privateKey = keyPair.getPrivateKey();
-		String appId = "cs";
+		String appId = "tsxh";
 		System.out.println(appId+":");
 		System.out.println("appId:"+ MD5.create().digestHex(appId));
 		System.out.println("公钥:"+publicKey);