|
|
@@ -2,15 +2,13 @@ package com.zhongshu.card.server.core.test;
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.zhongshu.card.client.utils.type.DataState;
|
|
|
-import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
-import com.zhongshu.card.server.core.util.DateUtils;
|
|
|
import com.zhongshu.card.server.core.util.ValidateResult;
|
|
|
import com.zhongshu.card.server.core.util.ValidateUtils;
|
|
|
import groovy.lang.GroovyShell;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.util.Base64;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -39,18 +37,20 @@ public class Test {
|
|
|
BigDecimal b2 = BigDecimal.valueOf(564.32);
|
|
|
System.out.println("m= " + b1.divide(b2, 5, RoundingMode.HALF_UP));
|
|
|
|
|
|
- BigDecimal per = BigDecimal.ZERO;
|
|
|
- if (b1.compareTo(BigDecimal.ZERO) > 0 && b2.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- per = (b1.subtract(b2)).divide(b2, 4, BigDecimal.ROUND_HALF_UP)
|
|
|
- .multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }
|
|
|
-
|
|
|
- System.out.println("per: " + per);
|
|
|
-
|
|
|
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();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|