|
|
@@ -2,6 +2,7 @@ package com.zhongshu.card.server.core.test;
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import com.zhongshu.card.server.core.util.ValidateResult;
|
|
|
import com.zhongshu.card.server.core.util.ValidateUtils;
|
|
|
import groovy.lang.GroovyShell;
|
|
|
@@ -18,39 +19,41 @@ import java.util.Map;
|
|
|
*/
|
|
|
public class Test {
|
|
|
public static void main(String[] args) {
|
|
|
- Snowflake snowflake = new Snowflake();
|
|
|
- String orderNo = String.valueOf(snowflake.nextId());
|
|
|
- System.out.println(orderNo + " = " + orderNo.length());
|
|
|
-
|
|
|
- String str = "123abc@";
|
|
|
- ValidateResult result = ValidateUtils.validatePassWord(str);
|
|
|
- System.out.println("结果:" + result.isSuccess() + " = " + result.getMsg()
|
|
|
- + " == " + ValidateUtils.isPhoneNumber("18723497166"));
|
|
|
-
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("orderNo", orderNo);
|
|
|
- map.put("age", 24);
|
|
|
- map.put("money", BigDecimal.valueOf(563.21));
|
|
|
- System.out.println("map = " + JSONUtil.toJsonStr(map));
|
|
|
-
|
|
|
- BigDecimal b1 = BigDecimal.valueOf(54.32);
|
|
|
- BigDecimal b2 = BigDecimal.valueOf(564.32);
|
|
|
- System.out.println("m= " + b1.divide(b2, 5, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
- GroovyShell groovyShell = new GroovyShell();
|
|
|
- String res = " println 'Hello, Groovy!' ";
|
|
|
- Object result1 = groovyShell.evaluate(res);
|
|
|
- System.out.println("result1 = " + result1);
|
|
|
-
|
|
|
- try {
|
|
|
- String stt = "我是";
|
|
|
- byte[] encoded = Base64.getEncoder().encode(stt.getBytes("utf-8"));
|
|
|
- System.out.println("base64 = " + new String(encoded));
|
|
|
- byte[] stt1 = Base64.getDecoder().decode(encoded);
|
|
|
- System.out.println("stt1 = " + new String(stt1));
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+// Snowflake snowflake = new Snowflake();
|
|
|
+// String orderNo = String.valueOf(snowflake.nextId());
|
|
|
+// System.out.println(orderNo + " = " + orderNo.length());
|
|
|
+//
|
|
|
+// String str = "123abc@";
|
|
|
+// ValidateResult result = ValidateUtils.validatePassWord(str);
|
|
|
+// System.out.println("结果:" + result.isSuccess() + " = " + result.getMsg()
|
|
|
+// + " == " + ValidateUtils.isPhoneNumber("18723497166"));
|
|
|
+//
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
+// map.put("orderNo", orderNo);
|
|
|
+// map.put("age", 24);
|
|
|
+// map.put("money", BigDecimal.valueOf(563.21));
|
|
|
+// System.out.println("map = " + JSONUtil.toJsonStr(map));
|
|
|
+//
|
|
|
+// BigDecimal b1 = BigDecimal.valueOf(54.32);
|
|
|
+// BigDecimal b2 = BigDecimal.valueOf(564.32);
|
|
|
+// System.out.println("m= " + b1.divide(b2, 5, RoundingMode.HALF_UP));
|
|
|
+//
|
|
|
+// GroovyShell groovyShell = new GroovyShell();
|
|
|
+// String res = " println 'Hello, Groovy!' ";
|
|
|
+// Object result1 = groovyShell.evaluate(res);
|
|
|
+// System.out.println("result1 = " + result1);
|
|
|
+//
|
|
|
+// try {
|
|
|
+// String stt = "我是";
|
|
|
+// byte[] encoded = Base64.getEncoder().encode(stt.getBytes("utf-8"));
|
|
|
+// System.out.println("base64 = " + new String(encoded));
|
|
|
+// byte[] stt1 = Base64.getDecoder().decode(encoded);
|
|
|
+// System.out.println("stt1 = " + new String(stt1));
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+ String phone = "766";
|
|
|
+ System.out.println(CommonUtil.getPhoneLast4(phone));
|
|
|
|
|
|
}
|
|
|
}
|