2021-11-14 15:29:16 +08:00
|
|
|
|
package customization.test;
|
|
|
|
|
|
|
|
|
|
import aiyh.utils.Util;
|
|
|
|
|
import aiyh.utils.fileUtil.WatermarkPoint;
|
|
|
|
|
import aiyh.utils.fileUtil.WatermarkPointEnum;
|
|
|
|
|
import aiyh.utils.fileUtil.WritWatermark;
|
|
|
|
|
import aiyh.utils.httpUtil.HttpManager;
|
|
|
|
|
import aiyh.utils.httpUtil.ResponeVo;
|
|
|
|
|
import aiyh.utils.httpUtil.staticUtil.GlobalStaticCache;
|
|
|
|
|
import aiyh.utils.httpUtil.staticUtil.HttpStaticUtils;
|
|
|
|
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
|
|
|
|
import aiyh.utils.mapUtil.ParaMap;
|
|
|
|
|
import aiyh.utils.mapUtil.UtilHashMap;
|
|
|
|
|
import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl;
|
|
|
|
|
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
|
|
|
|
import aiyh.utils.sqlUtil.whereUtil.Where;
|
|
|
|
|
import com.api.aiyh_guijiu.service.WorkflowQueueService;
|
|
|
|
|
import com.api.aiyh_guijiu.vo.PicPsVO;
|
2021-11-29 10:15:16 +08:00
|
|
|
|
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
|
2021-11-25 21:46:05 +08:00
|
|
|
|
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
2021-11-14 15:29:16 +08:00
|
|
|
|
import com.drew.imaging.ImageMetadataReader;
|
|
|
|
|
import com.drew.imaging.ImageProcessingException;
|
|
|
|
|
import com.drew.metadata.Directory;
|
|
|
|
|
import com.drew.metadata.Metadata;
|
|
|
|
|
import com.drew.metadata.Tag;
|
|
|
|
|
import com.mzlion.core.http.ContentType;
|
|
|
|
|
import org.apache.http.HttpEntity;
|
|
|
|
|
import org.apache.http.NameValuePair;
|
|
|
|
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
|
|
import org.apache.http.client.methods.HttpGet;
|
|
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
|
|
import org.apache.http.entity.StringEntity;
|
|
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
|
|
import org.h2.util.StringUtils;
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
import org.junit.Test;
|
2021-11-29 10:15:16 +08:00
|
|
|
|
import sun.font.FontDesignMetrics;
|
2021-11-14 15:29:16 +08:00
|
|
|
|
import weaver.aiyh_quanshi.RequestApi;
|
|
|
|
|
import weaver.aiyh_quanshi.entity.QsResponse;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.file.ImageFileManager;
|
|
|
|
|
import weaver.fna.invoice.utils.HttpUtil;
|
|
|
|
|
import weaver.general.GCONST;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.LinkOption;
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
import java.nio.file.attribute.BasicFileAttributeView;
|
|
|
|
|
import java.nio.file.attribute.BasicFileAttributes;
|
|
|
|
|
import java.security.KeyManagementException;
|
|
|
|
|
import java.security.KeyStoreException;
|
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
2021-11-25 21:46:05 +08:00
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
2021-11-14 15:29:16 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author EBU7-dev1-ayh
|
|
|
|
|
* @create 2021/8/23 0023 17:55
|
|
|
|
|
* 工具类测试
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class AiyhUtilTest extends BaseTest {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testParaMap() {
|
|
|
|
|
// 使map可以链式调用,但是只支持String,Object的泛型,写死了
|
|
|
|
|
Map<String, Object> map = ParaMap.create()
|
|
|
|
|
.put("name", "aiyh")
|
|
|
|
|
.put("age", 22)
|
|
|
|
|
.put("sex", "男");
|
|
|
|
|
System.out.println(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testUtilMap() {
|
|
|
|
|
UtilHashMap<String, Object> map = Util.createUtilHashMap().uPut("id", 1).uPut("name", "%aiyh%");
|
|
|
|
|
map.uPut("key", null).uPut(null, "value");
|
|
|
|
|
System.out.println(map);
|
|
|
|
|
// 过滤键值都不为null,返回一个新的map,不影响原来的map
|
|
|
|
|
Map<String, Object> newMap = map.filter((key, value) -> !Objects.isNull(key) && !Objects.isNull(value));
|
|
|
|
|
System.out.println(newMap);
|
|
|
|
|
// UtilLinkedHashMap用法一样。
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建SQL条件
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testWhere() {
|
|
|
|
|
System.out.println(aiyh.utils.Util.createSqlBuilder().updateSql("docimagefile"
|
|
|
|
|
, ParaMap.create().put("imagefileid", 2)
|
|
|
|
|
, aiyh.utils.Util.createPrepWhereImpl().whereAnd("docid").whereEqual(1)).getSqlStr());
|
|
|
|
|
Where where = Util.createPrepWhereImpl()
|
|
|
|
|
.whereOr("test").whereEqual(2)
|
|
|
|
|
.whereAnd("id").whereEqual(1)
|
|
|
|
|
.whereOr("name").whereLike("%aiyh%");
|
|
|
|
|
// 等效于下面代码
|
|
|
|
|
// Where where = new PrepWhereImpl();
|
|
|
|
|
// where.whereAnd("id").whereEqual(1).whereOr("name").whereLike("%aiyh%");
|
|
|
|
|
System.out.println(where.getSql());
|
|
|
|
|
System.out.println(where.getArgs());
|
|
|
|
|
// WhereImpl类用法类似,但不推荐使用
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testInnerPrepWhere() {
|
|
|
|
|
Where where = Util.createPrepWhereImpl()
|
|
|
|
|
.whereAnd("id").whereEqual(1)
|
|
|
|
|
.andInnerWhere("test").whereEqual("9")
|
|
|
|
|
.whereOr("innerOr").whereEqual("yes").endInnerWhere()
|
|
|
|
|
.whereOr("name").whereLike("%aiyh%");
|
|
|
|
|
System.out.println(where.getSql());
|
|
|
|
|
System.out.println(where.getArgs());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testInnerWhere() {
|
|
|
|
|
Where where = Util.createWhereImpl()
|
|
|
|
|
.whereAnd("id").whereEqual(1)
|
|
|
|
|
.andInnerWhere("test").whereEqual("9")
|
|
|
|
|
.whereOr("innerOr").whereEqual("yes").endInnerWhere()
|
|
|
|
|
.whereOr("name").whereLike("%aiyh%");
|
|
|
|
|
System.out.println(where.getSql());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建单条插入SQL
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testBuilderSql1() {
|
|
|
|
|
// 创建键值对对应关系map
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", "1");
|
|
|
|
|
map.put("name", "aiyh");
|
|
|
|
|
map.put("age", "22");
|
|
|
|
|
map.put("job", "java 开发");
|
|
|
|
|
map.put("isnull", null);
|
|
|
|
|
PrepSqlResultImpl insertSql = Util.createSqlBuilder().insertSql("tableName", map);
|
|
|
|
|
System.out.println(insertSql.getSqlStr());
|
|
|
|
|
System.out.println(insertSql.getArgs());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建批量插入SQL
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testBuilderSql2() {
|
|
|
|
|
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
|
|
|
|
|
// 创建键值对对应关系map
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
map.put("id", i);
|
|
|
|
|
map.put("name", "aiyh" + i);
|
|
|
|
|
map.put("age", "22");
|
|
|
|
|
map.put("job", "java 开发");
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().insertBatchSql("tableName", list);
|
|
|
|
|
System.out.println(batchSqlResult.getSqlStr());
|
|
|
|
|
System.out.println(batchSqlResult.getBatchList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建单条更新SQL
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testBuilderSql3() {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("lastname", "aiyh");
|
|
|
|
|
map.put("loginid", "aiyh");
|
|
|
|
|
Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("22058");
|
|
|
|
|
PrepSqlResultImpl updateSql = Util.createSqlBuilder().updateSql("hrmresource", map, where);
|
|
|
|
|
System.out.println(updateSql.getSqlStr());
|
|
|
|
|
System.out.println(updateSql.getArgs());
|
|
|
|
|
RecordSet recordSet = new RecordSet();
|
|
|
|
|
recordSet.executeUpdate(updateSql.getSqlStr(), updateSql.getArgs());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建批量更新SQL
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testBuilderSql4() {
|
|
|
|
|
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
|
|
|
|
|
List<Where> whereList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
map.put("name", "aiyh" + i);
|
|
|
|
|
map.put("age", "22");
|
|
|
|
|
map.put("job", "java 开发");
|
|
|
|
|
list.add(map);
|
|
|
|
|
Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual(i);
|
|
|
|
|
whereList.add(where);
|
|
|
|
|
}
|
|
|
|
|
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tableName", list, whereList);
|
|
|
|
|
System.out.println(batchSqlResult.getSqlStr());
|
|
|
|
|
System.out.println(batchSqlResult.getBatchList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testHttpClient() throws IOException, JSONException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
|
|
|
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection("");
|
|
|
|
|
HttpGet httpGet = new HttpGet("https://www.baidu.com");
|
|
|
|
|
CloseableHttpResponse execute = httpConnection.execute(httpGet);
|
|
|
|
|
HttpEntity entity = execute.getEntity();
|
|
|
|
|
System.out.println(EntityUtils.toString(entity, StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList
|
|
|
|
|
// yZGiC98iGbbyQXw3WG19w5rE3swjU3ld
|
|
|
|
|
// CloseableHttpClient httpConnection1 = HttpManager.getHttpConnection();
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("page", 1);
|
|
|
|
|
HttpPost httpPost = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
|
|
|
|
|
StringEntity stringEntity = new StringEntity(param.toString());
|
|
|
|
|
stringEntity.setContentType(ContentType.APPLICATION_JSON.toString());
|
|
|
|
|
httpPost.setEntity(stringEntity);
|
|
|
|
|
httpPost.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
|
|
|
|
|
httpPost.setHeader("content-type", ContentType.APPLICATION_JSON.toString());
|
|
|
|
|
CloseableHttpResponse execute1 = httpConnection.execute(httpPost);
|
|
|
|
|
HttpEntity entity1 = execute1.getEntity();
|
|
|
|
|
System.out.println(EntityUtils.toString(entity1, StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
// CloseableHttpClient httpConnection2 = HttpManager.getHttpConnection();
|
|
|
|
|
HttpPost httpPost1 = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
|
|
|
|
|
List<NameValuePair> nvps = new ArrayList<>();
|
|
|
|
|
nvps.add(new BasicNameValuePair("name", "value"));
|
|
|
|
|
httpPost1.setEntity(new UrlEncodedFormEntity(nvps));
|
|
|
|
|
httpPost1.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
|
|
|
|
|
CloseableHttpResponse execute2 = httpConnection.execute(httpPost1);
|
|
|
|
|
HttpEntity entity2 = execute2.getEntity();
|
|
|
|
|
System.out.println(EntityUtils.toString(entity2, StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
ResponeVo post = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList", null);
|
|
|
|
|
System.out.println();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testUtil() throws IOException {
|
|
|
|
|
GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
|
|
|
|
|
ResponeVo responeVo = HttpStaticUtils.apiGet("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
|
|
|
|
|
System.out.println("=========" + Arrays.toString(responeVo.getAllHeaders()));
|
|
|
|
|
System.out.println(responeVo.getEntityString());
|
|
|
|
|
System.out.println(responeVo.getEntityMap());
|
|
|
|
|
System.out.println(responeVo.getCode());
|
|
|
|
|
System.out.println(responeVo.getEntity(TestVo.class));
|
|
|
|
|
TestVo entity = responeVo.getEntity(TestVo.class);
|
|
|
|
|
entity.getItems().forEach(item -> System.out.println(item.getCurrency() + " => " + item.getLocalCurrency() + " : " + item.getRate()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testCallBack() throws IOException {
|
|
|
|
|
HttpStaticUtils.apiGet("https://www.baidu.com/s", new HashMap<String, String>() {{
|
|
|
|
|
put("wd", "java");
|
|
|
|
|
put("ie", "utf-8");
|
|
|
|
|
}}, null, response -> {
|
|
|
|
|
try {
|
|
|
|
|
System.out.println(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
|
|
|
|
|
System.out.println(response.getStatusLine().getStatusCode());
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPost() throws IOException {
|
|
|
|
|
GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
|
|
|
|
|
GlobalStaticCache.paramMap.put("", "");
|
|
|
|
|
long l = System.currentTimeMillis();
|
|
|
|
|
ResponeVo responeVo = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList",
|
|
|
|
|
null, null);
|
|
|
|
|
long l1 = System.currentTimeMillis();
|
|
|
|
|
System.out.println(l1 - l);
|
|
|
|
|
TestVo entity = responeVo.getEntity(TestVo.class);
|
|
|
|
|
System.out.println(entity);
|
|
|
|
|
System.out.println(responeVo.getEntityMap());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testAsync() throws IOException, ExecutionException, InterruptedException {
|
|
|
|
|
HttpUtils httpUtils = new HttpUtils();
|
|
|
|
|
httpUtils.getGlobalCache().header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
|
|
|
|
|
long l = System.currentTimeMillis();
|
|
|
|
|
Future<ResponeVo> responeVoFuture = httpUtils.asyncApiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList",
|
|
|
|
|
null, null);
|
|
|
|
|
long l1 = System.currentTimeMillis();
|
|
|
|
|
System.out.println(l1 - l);
|
|
|
|
|
System.out.println("test");
|
|
|
|
|
ResponeVo responeVo = responeVoFuture.get();
|
|
|
|
|
long l2 = System.currentTimeMillis();
|
|
|
|
|
System.out.println(l2 - l1);
|
|
|
|
|
System.out.println(l2 - l);
|
|
|
|
|
System.out.println("aaaa");
|
|
|
|
|
System.out.println(responeVo.getEntityMap());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPDFUTil() throws IOException {
|
|
|
|
|
// File file = new File("C:\\Users\\77449\\Pictures\\Saved Pictures\\7c3fbba87cac45568374bdb64622f8d2!400x400.png");
|
|
|
|
|
// String path = WritWatermark.addWatermark(file, "C:\\Users\\77449\\Pictures\\Saved Pictures\\2.jpg",
|
|
|
|
|
// "这个是水印\nthis is water", "宋体", 0, new Color(249, 231, 186), 0, 20, 0);
|
|
|
|
|
// System.out.println(path);
|
|
|
|
|
// Files.delete(Paths.get(path));
|
|
|
|
|
|
|
|
|
|
// ImageFileManager imageFileManager ImageFileManager();
|
|
|
|
|
// imageFileManager.getInputStreamById();
|
|
|
|
|
// imageFileManager.saveImageFileByInputStream();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPDfUtil2() throws IOException {
|
|
|
|
|
/*ImageFileManager imageFileManager = new ImageFileManager();
|
|
|
|
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(3639);
|
|
|
|
|
Image image = ImageIO.read(inputStreamById);
|
|
|
|
|
int width = image.getWidth(null);
|
|
|
|
|
int height = image.getHeight(null);
|
|
|
|
|
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
|
|
|
|
Graphics graphics = bufferedImage.createGraphics();
|
|
|
|
|
graphics.drawImage(image, 0, 0, width, height, null);
|
|
|
|
|
graphics.setColor(new Color(200, 120, 120));
|
|
|
|
|
graphics.setFont(new Font("宋体", 0, 50));
|
|
|
|
|
String[] pressTexts = "我是水印".split("\n");
|
|
|
|
|
for (int i = 0; i < pressTexts.length; i++) {
|
|
|
|
|
graphics.drawString(pressTexts[i], 20, 20 + (50 * (i + 1)) + (int) Math.round((height * 0.02)));
|
|
|
|
|
}
|
|
|
|
|
graphics.dispose();
|
|
|
|
|
FileOutputStream fileOutputStream1 = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg", "utf-8"));
|
|
|
|
|
ImageIO.write(bufferedImage, "jpg", fileOutputStream1);
|
|
|
|
|
fileOutputStream1.close();
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
|
|
|
|
ImageOutputStream imOut = ImageIO.createImageOutputStream(bs);
|
|
|
|
|
ImageIO.write(bufferedImage, "jpg", imOut);
|
|
|
|
|
//将图片转为inputStream流
|
|
|
|
|
InputStream inputStream = new ByteArrayInputStream(bs.toByteArray());
|
|
|
|
|
int i = imageFileManager.saveImageFileByInputStream(new FileInputStream("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg"), "水印1.jpg");
|
|
|
|
|
System.out.println(i);*/
|
|
|
|
|
|
|
|
|
|
int i = WritWatermark.addTextTileWatermarkById(3639, "文字水印测试!", new Color(200, 100, 155),
|
|
|
|
|
"宋体", 0, 50, -40, 0.5F,1, 300, 100, 200);
|
|
|
|
|
//FileInputStream fs = new FileInputStream(URLDecoder.decode("I:\\wind主题\\开始按钮\\gLogoMid-v3.png","utf-8"));
|
|
|
|
|
|
|
|
|
|
// int i = WritWatermark.addPicWatermarkById(3639, 3724,new WatermarkPoint(WatermarkPointEnum.CENTER), -45, 0.5F);
|
|
|
|
|
|
|
|
|
|
InputStream inputStreamById1 = ImageFileManager.getInputStreamById(i);
|
|
|
|
|
Image image1 = ImageIO.read(inputStreamById1);
|
|
|
|
|
int width1 = image1.getWidth(null);
|
|
|
|
|
int height1 = image1.getHeight(null);
|
|
|
|
|
BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB);
|
|
|
|
|
Graphics graphics1 = bufferedImage1.createGraphics();
|
|
|
|
|
graphics1.drawImage(image1, 0, 0, width1, height1, null);
|
|
|
|
|
graphics1.dispose();
|
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\水印1-1.jpg", "utf-8"));
|
|
|
|
|
ImageIO.write(bufferedImage1, "jpg", fileOutputStream);
|
|
|
|
|
fileOutputStream.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testCase() {
|
|
|
|
|
String query = "select * from uf_temp_attachment";
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery(query);
|
|
|
|
|
// 如果有时间转换,需要添加自定义注解weaver.aiyh_pcn.aiyh.aiyh.utils.annotation.DateFormatAn,指定个话类型
|
|
|
|
|
TestCaseVo testCaseVo = Util.recordeSet2Entity(rs, TestCaseVo.class, true);
|
|
|
|
|
System.out.println(testCaseVo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void creatJava() throws IOException {
|
|
|
|
|
Util.creatJavaFileByTable("uf_htmb", "createJava.test.createFile");
|
|
|
|
|
String selectConfigBase = "select lf.id, lf.is_out_user,lf.is_sell_change,lf.will_write, " +
|
|
|
|
|
"wfvw.fieldname as will_write_field,wfvw.tablename as will_write_table, " +
|
|
|
|
|
"lf.is_customer_address,lf.workflow_type, lf.customer_id, " +
|
|
|
|
|
"lf.change_setting, wslu.selectvalue as update_mark, " +
|
|
|
|
|
"lf.manager_type, lf.customer_manager, wfvm.fieldname as manager_field, " +
|
|
|
|
|
"wsli.selectvalue as insert_mark,wfv.fieldname as update_insert, " +
|
|
|
|
|
"wfv.tablename as update_insert_table " +
|
|
|
|
|
"from uf_external_law_fir as lf " +
|
|
|
|
|
"left join workflow_selectitem as wslu on wslu.id = lf.update_mark " +
|
|
|
|
|
"left join workflow_selectitem as wsli on wsli.id = lf.insert_mark " +
|
|
|
|
|
"left join workflow_field_view as wfv on wfv.id = lf.update_insert " +
|
|
|
|
|
"left join workflow_field_view as wfvm on wfvm.id = lf.manager_field " +
|
|
|
|
|
"left join workflow_field_view as wfvw on wfvw.id = lf.will_write_field " +
|
|
|
|
|
"where workflow_type in " +
|
|
|
|
|
"(select id from workflow_base where activeVersionID in " +
|
|
|
|
|
"(select activeVersionID from workflow_base where id = 2) or id = 2)";
|
|
|
|
|
Util.creatJavaFileBySql(selectConfigBase, "testSqlJava", "createJava.test.createFile");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPicPs() {
|
|
|
|
|
FileInputStream fileInputStream = null;
|
|
|
|
|
try {
|
|
|
|
|
BasicFileAttributeView basicview = Files.getFileAttributeView(Paths.get("C:\\Users\\77449\\Desktop\\5dc086a14941f4d5aeec44068986d04.jpg"), BasicFileAttributeView.class,
|
|
|
|
|
LinkOption.NOFOLLOW_LINKS);
|
|
|
|
|
BasicFileAttributes attr;
|
|
|
|
|
try {
|
|
|
|
|
attr = basicview.readAttributes();
|
|
|
|
|
//attr.lastModifiedTime();
|
|
|
|
|
Date lastmodfiyTimeDate = new Date(attr.lastModifiedTime().toMillis());
|
|
|
|
|
Date createTimeDate = new Date(attr.creationTime().toMillis());
|
|
|
|
|
System.out.println(lastmodfiyTimeDate);
|
|
|
|
|
System.out.println(createTimeDate);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
// 获取媒体数据
|
|
|
|
|
fileInputStream = new FileInputStream(
|
|
|
|
|
URLDecoder.decode("C:\\Users\\77449\\Desktop\\8308CC261209F70EBC82293C4092C8B5.jpg",
|
|
|
|
|
"utf-8"));
|
|
|
|
|
Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream);
|
|
|
|
|
// 遍历Directory对象,每个对象里面包含标签
|
|
|
|
|
for (Directory directory : metadata.getDirectories()) {
|
|
|
|
|
String directoryName = directory.getName();
|
|
|
|
|
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|
|
|
|
|
|| directoryName.contains("Adobe")) {
|
|
|
|
|
System.out.println("图片经过Adobe Photoshop!");
|
|
|
|
|
}
|
|
|
|
|
System.out.println(directoryName);
|
|
|
|
|
for (Tag tag : directory.getTags()) {
|
|
|
|
|
if ("Software".equalsIgnoreCase(tag.getTagName())) {
|
|
|
|
|
if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())
|
|
|
|
|
|| tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) {
|
|
|
|
|
System.out.println("图片经过 Adobe Photoshop!");
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("图片经过 " + tag.getDescription() + "!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("User Comment".equalsIgnoreCase(tag.getTagName())) {
|
|
|
|
|
try {
|
|
|
|
|
com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription());
|
|
|
|
|
System.out.println("图片经过手机端图片处理软件,软件未知!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println(tag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (ImageProcessingException | IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if (fileInputStream != null) {
|
|
|
|
|
try {
|
|
|
|
|
fileInputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testPic() {
|
|
|
|
|
PicPsVO picPsVO = PicPsVO.PicPsVOBuilder.aPicPsVO()
|
|
|
|
|
.docId(0)
|
|
|
|
|
.fileId(0)
|
|
|
|
|
.fileName("name")
|
|
|
|
|
.build();
|
|
|
|
|
// 通过物理文件的id进行获取对应的输入流信息。
|
|
|
|
|
ImageFileManager imageFileManager = new ImageFileManager();
|
|
|
|
|
// 通过文件id获取输入流
|
|
|
|
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(3786);
|
|
|
|
|
FileInputStream fileInputStream = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
fileInputStream = new FileInputStream(
|
|
|
|
|
URLDecoder.decode("C:\\Users\\77449\\Desktop\\50c42dffc1d2af366364daf0adcd694.jpg",
|
|
|
|
|
"utf-8"));
|
|
|
|
|
// 获取媒体数据
|
|
|
|
|
Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream);
|
|
|
|
|
// 遍历Directory对象,每个对象里面包含标签
|
|
|
|
|
for (Directory directory : metadata.getDirectories()) {
|
|
|
|
|
String directoryName = directory.getName();
|
|
|
|
|
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|
|
|
|
|
|| directoryName.contains("Adobe")) {
|
|
|
|
|
if (picPsVO.getScore() > 80) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!");
|
|
|
|
|
picPsVO.setScore(80);
|
|
|
|
|
}
|
|
|
|
|
String model = "";
|
|
|
|
|
for (Tag tag : directory.getTags()) {
|
|
|
|
|
if(tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())){
|
|
|
|
|
System.out.println(tag + " ===============> ");
|
|
|
|
|
}
|
|
|
|
|
System.out.println(tag);
|
|
|
|
|
if ("Software".equalsIgnoreCase(tag.getTagName())) {
|
|
|
|
|
if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())
|
|
|
|
|
|| tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) {
|
|
|
|
|
picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!");
|
|
|
|
|
picPsVO.setScore(100);
|
|
|
|
|
} else {
|
|
|
|
|
if (picPsVO.getScore() > 70) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
picPsVO.setDescribe("图片经过" + tag.getDescription() + "软件,注意审核!");
|
|
|
|
|
picPsVO.setScore(70);
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(model) && picPsVO.getDescribe().contains(model)) {
|
|
|
|
|
picPsVO.setDescribe("");
|
|
|
|
|
picPsVO.setScore(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("Model".equalsIgnoreCase(tag.getTagName())) {
|
|
|
|
|
model = tag.getDescription();
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(picPsVO.getDescribe())) {
|
|
|
|
|
if (picPsVO.getDescribe().contains(tag.getDescription())) {
|
|
|
|
|
picPsVO.setDescribe("");
|
|
|
|
|
picPsVO.setScore(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("User Comment".equalsIgnoreCase(tag.getTagName())) {
|
|
|
|
|
try {
|
|
|
|
|
if (picPsVO.getScore() > 60) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription());
|
|
|
|
|
picPsVO.setDescribe("图片经过手机端图片处理软件,软件未知!请注意审核!");
|
|
|
|
|
picPsVO.setScore(60);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
if (picPsVO.getScore() > 30) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
picPsVO.setDescribe("图片可能经过未知软件!请注意审核!");
|
|
|
|
|
picPsVO.setScore(30);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (ImageProcessingException | IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if(fileInputStream != null){
|
|
|
|
|
try {
|
|
|
|
|
fileInputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println(picPsVO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testRe2String(){
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String query = "select id from workflow_base " +
|
|
|
|
|
"where activeVersionID in (select activeVersionID " +
|
|
|
|
|
"from workflow_base where id = ?) or id = ?";
|
|
|
|
|
rs.executeQuery(query,2,2);
|
|
|
|
|
System.out.println(Util.recordeSet2Array(rs, Integer.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testConfig(){
|
|
|
|
|
WorkflowQueueService workflowQueueService = new WorkflowQueueService();
|
|
|
|
|
// String watermarkConfig = workflowQueueService.getWatermarkConfig("2");
|
|
|
|
|
// System.out.println(watermarkConfig);
|
|
|
|
|
// String picIsPs = workflowQueueService.getPicIsPs("259,260,261");
|
|
|
|
|
// System.out.println(picIsPs);
|
|
|
|
|
|
|
|
|
|
// String workflowConflictConfig = workflowQueueService.getWorkflowConflictConfig("3");
|
|
|
|
|
// System.out.println(workflowConflictConfig);
|
|
|
|
|
|
|
|
|
|
// String picPsConfig = workflowQueueService.getPicPsConfig();
|
|
|
|
|
// System.out.println(picPsConfig);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// String watermarkConfig = workflowQueueService.getWatermarkConfig();
|
|
|
|
|
// System.out.println(watermarkConfig);
|
|
|
|
|
|
|
|
|
|
Properties prop = new Properties();
|
|
|
|
|
try {
|
|
|
|
|
// 通过输入缓冲流进行读取配置文件
|
|
|
|
|
InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties")));
|
|
|
|
|
// 加载输入流
|
|
|
|
|
prop.load(InputStream);
|
|
|
|
|
// 根据关键字获取value值
|
|
|
|
|
Enumeration<?> enumeration = prop.propertyNames();
|
|
|
|
|
while (enumeration.hasMoreElements()){
|
|
|
|
|
String key = (String) enumeration.nextElement();
|
|
|
|
|
System.out.println(key);
|
|
|
|
|
System.out.println(prop.getProperty(key));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testE(){
|
|
|
|
|
System.out.println(!"-1".equals("1002095"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testLock(){
|
|
|
|
|
// Lock lock = new ReentrantLock();
|
|
|
|
|
// lock.lock();
|
|
|
|
|
// lock.unlock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testMap(){
|
|
|
|
|
String query = "select * from meeting where id = ?";
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery(query,8);
|
|
|
|
|
Map<String, Object> stringObjectMap = Util.recordSet2Map(rs,true);
|
|
|
|
|
System.out.println(stringObjectMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<String,Object> getPropertiesMap(String prx){
|
|
|
|
|
Properties prop = new Properties();
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
// 通过输入缓冲流进行读取配置文件
|
|
|
|
|
InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties")));
|
|
|
|
|
// 加载输入流
|
|
|
|
|
prop.load(InputStream);
|
|
|
|
|
// 根据关键字获取value值
|
|
|
|
|
Enumeration<?> enumeration = prop.propertyNames();
|
|
|
|
|
while (enumeration.hasMoreElements()){
|
|
|
|
|
String key = (String) enumeration.nextElement();
|
|
|
|
|
if(key.contains(prx)){
|
|
|
|
|
map.put(key.replace(prx + ".", ""),prop.getProperty(key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void getProp2Map(){
|
|
|
|
|
System.out.println(GCONST.getPropertyPath());
|
|
|
|
|
System.out.println(Util.null2String(null,"-1"));
|
|
|
|
|
Map<String, Object> propertiesMap = Util.getProperties2Map("test","aiyh.test");
|
|
|
|
|
System.out.println(propertiesMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void getInfo(){
|
|
|
|
|
RequestApi requestApi = new RequestApi();
|
|
|
|
|
QsResponse quanShiInfo = requestApi.getQuanShiInfo("59733978");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testHttpUtil() throws IOException {
|
|
|
|
|
// HttpUtil
|
|
|
|
|
HttpUtils httpUtils = new HttpUtils();
|
|
|
|
|
httpUtils.getGlobalCache().header.put("authentication","8cb0ddd0fd07424e9e77140d1f7378ab");
|
|
|
|
|
ResponeVo files = httpUtils.apiUploadFileById("http://192.168.3.2:8081/upload/fileUpload",
|
|
|
|
|
713, "files", "2008年全国统一高考英语试卷(全国卷Ⅱ)(含解析版).doc",
|
|
|
|
|
new HashMap<String,Object>(){{
|
|
|
|
|
put("fileName","2008年全国统一高考英语试卷(全国卷Ⅱ)(含解析版).doc");
|
|
|
|
|
}}, null);
|
|
|
|
|
System.out.println(files.getEntityString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testHttpInvoice(){
|
|
|
|
|
net.sf.json.JSONObject jsonObject = HttpUtil.postImage(new byte[1], new User());
|
|
|
|
|
System.out.println(jsonObject);
|
|
|
|
|
}
|
2021-11-25 21:46:05 +08:00
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void getMap() {
|
|
|
|
|
Map<String, Object> patentWall = Util.getProperties2Map("PatentWall", "aiyh.patentWall");
|
|
|
|
|
List<String> args = new ArrayList<>();
|
|
|
|
|
patentWall.forEach((key,value)->{
|
|
|
|
|
System.out.println("key ——> " + key);
|
|
|
|
|
String pattern = "\\$\\{(?<field>(\\s\\S)+?)}";
|
|
|
|
|
Pattern compile = Pattern.compile(pattern);
|
|
|
|
|
Matcher matcher = compile.matcher(String.valueOf(value));
|
|
|
|
|
System.out.println("value --> " + value);
|
|
|
|
|
String parsing = String.valueOf(value);
|
|
|
|
|
while (matcher.find()){
|
|
|
|
|
System.out.println("解析 ---> " + matcher.group("field"));
|
|
|
|
|
parsing = parsing.replaceFirst(pattern,"反正是对的");
|
|
|
|
|
System.out.println("解析后———> " + parsing);
|
|
|
|
|
}
|
|
|
|
|
pattern = "#\\{(?<field>(\\s\\S)+?)}";
|
|
|
|
|
compile = Pattern.compile(pattern);
|
|
|
|
|
matcher = compile.matcher(String.valueOf(parsing));
|
|
|
|
|
while (matcher.find()){
|
|
|
|
|
parsing = parsing.replaceFirst(pattern,"?");
|
|
|
|
|
args.add("haoba ");
|
|
|
|
|
}
|
|
|
|
|
pattern = "#sql\\{(?<field>([\\s\\S])+?)}";
|
|
|
|
|
compile = Pattern.compile(pattern);
|
|
|
|
|
matcher = compile.matcher(parsing);
|
|
|
|
|
while (matcher.find()){
|
|
|
|
|
System.out.println("============执行SQL============");
|
|
|
|
|
System.out.println(matcher.group("field"));
|
|
|
|
|
System.out.println(args);
|
|
|
|
|
System.out.println("============执行SQL结束============");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
args.clear();
|
|
|
|
|
});
|
|
|
|
|
System.out.println(patentWall);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testFormat(){
|
|
|
|
|
System.out.printf("sql %s,参数 %s%n","我是SQL","我是参数");
|
|
|
|
|
}
|
2021-11-29 10:15:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testGetList(){
|
|
|
|
|
PatentWallService patentWallService = new PatentWallService();
|
2021-12-01 10:22:22 +08:00
|
|
|
|
patentWallService.getList(null,"");
|
2021-11-29 10:15:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testWidth(){
|
|
|
|
|
Font font = new Font("微软雅黑", Font.PLAIN,10);
|
|
|
|
|
int wordWidth = getWordWidth(font, "我不知道具体是怎么回事,反正我不清楚");
|
|
|
|
|
System.out.println(wordWidth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getWordWidth(Font font, String content) {
|
|
|
|
|
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font);
|
|
|
|
|
int width = 0;
|
|
|
|
|
for (int i = 0; i < content.length(); i++) {
|
|
|
|
|
width += metrics.charWidth(content.charAt(i));
|
|
|
|
|
}
|
|
|
|
|
return width;
|
|
|
|
|
}
|
2021-11-25 21:46:05 +08:00
|
|
|
|
}
|