diff --git a/ecology-weaver.iml b/ecology-weaver.iml index de7167e..66ad733 100644 --- a/ecology-weaver.iml +++ b/ecology-weaver.iml @@ -20,17 +20,17 @@ - + - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index d43c80a..a52f01b 100644 --- a/pom.xml +++ b/pom.xml @@ -73,13 +73,13 @@ 8 8 - - - org.projectors - lombok - ${lombok.version} - - + + + + + + + diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index 80abe36..82c9213 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -14,6 +14,7 @@ import aiyh.utils.sqlUtil.whereUtil.impl.WhereImpl; import aiyh.utils.zwl.common.ToolUtil; import cn.hutool.core.util.ObjectUtil; import com.ibm.icu.text.SimpleDateFormat; +import org.apache.dubbo.common.utils.CollectionUtils; import org.h2.util.StringUtils; import weaver.common.util.string.StringUtil; import weaver.conn.RecordSet; @@ -1618,6 +1619,10 @@ public class Util extends weaver.general.Util { return docCategorys; } + public static String getDocCategorys(int workflowId, String docField) { + return getDocCategorys(String.valueOf(workflowId),docField); + } + /** * 根据流程和流程字段查询文档目录 * @@ -1814,4 +1819,55 @@ public class Util extends weaver.general.Util { public static T getMapper(Class t) { return recordsetUtil.getMapper(t); } + + + /** + * join方法 + * @param coll + * @param split + * @return + */ + public static String join(Collection coll, String split) { + if (CollectionUtils.isEmpty(coll)) { + return ""; + } else { + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + + String s; + for(Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) { + s = (String)item.next(); + if (isFirst) { + isFirst = false; + } else { + sb.append(split); + } + } + + return sb.toString(); + } + } + + + public static String intJoin(Collection coll, String split) { + if (CollectionUtils.isEmpty(coll)) { + return ""; + } else { + StringBuilder sb = new StringBuilder(); + boolean isFirst = true; + + String s; + for(Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) { + Object next = item.next(); + s = next == null ? "" : String.valueOf(next); + if (isFirst) { + isFirst = false; + } else { + sb.append(split); + } + } + + return sb.toString(); + } + } } diff --git a/src/main/java/aiyh/utils/httpUtil/HttpManager.java b/src/main/java/aiyh/utils/httpUtil/HttpManager.java index f524875..dde4b2f 100644 --- a/src/main/java/aiyh/utils/httpUtil/HttpManager.java +++ b/src/main/java/aiyh/utils/httpUtil/HttpManager.java @@ -26,9 +26,9 @@ public class HttpManager { */ - private static final int CONNECT_TIMEOUT = 30000; - private static final int CONNECTION_REQUEST_TIMEOUT = 10000; - private static final int SOCKET_TIMEOUT = 30000; + private static final int CONNECT_TIMEOUT = 1000 * 60 * 3; + private static final int CONNECTION_REQUEST_TIMEOUT = 1000 * 60 * 3; + private static final int SOCKET_TIMEOUT = 10000 * 60 * 3; private static final int MAX_TOTAL = 500; private static final int MAX_PRE_ROUTE = 500; diff --git a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java index a608863..49c7a31 100644 --- a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java +++ b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java @@ -32,19 +32,19 @@ public class RecordsetUtil implements InvocationHandler { @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public Object invoke(Object proxy, Method method, Object[] args) { SqlHandler sqlHandler = new SqlHandler(); toolUtil.writeDebuggerLog(String.format("%s===>Preparing to parse SQL", proxy.getClass().getName())); - RecordSet rs = new RecordSet(); ResultMapper resultMapper = new ResultMapper(); Select select = method.getAnnotation(Select.class); if (select != null) { // 查询 + RecordSet rs = new RecordSet(); String sql = select.value(); boolean custom = select.custom(); PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args); - System.out.println(handler); + toolUtil.writeDebuggerLog(handler.toString()); if (handler.getArgs().isEmpty()) { rs.executeQuery(handler.getSqlStr()); } else { @@ -56,9 +56,11 @@ public class RecordsetUtil implements InvocationHandler { if (update != null) { // 查询 + RecordSet rs = new RecordSet(); String sql = update.value(); boolean custom = update.custom(); PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args); + toolUtil.writeDebuggerLog(handler.toString()); Class returnType = method.getReturnType(); boolean b; if (handler.getArgs().isEmpty()) { @@ -83,9 +85,11 @@ public class RecordsetUtil implements InvocationHandler { Insert insert = method.getAnnotation(Insert.class); if (insert != null) { // 查询 + RecordSet rs = new RecordSet(); String sql = insert.value(); boolean custom = insert.custom(); PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args); + toolUtil.writeDebuggerLog(handler.toString()); Class returnType = method.getReturnType(); boolean b; if (handler.getArgs().isEmpty()) { @@ -103,9 +107,11 @@ public class RecordsetUtil implements InvocationHandler { Delete delete = method.getAnnotation(Delete.class); if (delete != null) { // 查询 + RecordSet rs = new RecordSet(); String sql = delete.value(); boolean custom = delete.custom(); PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args); + toolUtil.writeDebuggerLog(handler.toString()); Class returnType = method.getReturnType(); boolean b; if (handler.getArgs().isEmpty()) { diff --git a/src/main/java/aiyh/utils/recordset/ResultMapper.java b/src/main/java/aiyh/utils/recordset/ResultMapper.java index 944b35c..174ee85 100644 --- a/src/main/java/aiyh/utils/recordset/ResultMapper.java +++ b/src/main/java/aiyh/utils/recordset/ResultMapper.java @@ -105,6 +105,27 @@ public class ResultMapper { boolean enable = annotation == null ? true : annotation.value(); String[] columnName = rs.getColumnName(); String[] columnTypeName = rs.getColumnTypeName(); + int[] columnTypes = rs.getColumnType(); + if(columnTypeName == null){ + columnTypeName = new String[columnTypes.length]; + for (int i = 0 ; i < columnTypes.length; i ++) { + int type = columnTypes[i]; + switch (type){ + case -1: + columnTypeName[i] = "TEXT"; + break; + case 4: + columnTypeName[i] = "INT"; + break; + case 12: + columnTypeName[i] = "VARCHAR"; + break; + default: + columnTypeName[i] = "VARCHAR"; + } + } + } + try { for (int i = 0; i < columnName.length; i++) { String columnType = columnTypeName[i]; diff --git a/src/main/java/aiyh/utils/recordset/SqlHandler.java b/src/main/java/aiyh/utils/recordset/SqlHandler.java index fd591b0..33c92d7 100644 --- a/src/main/java/aiyh/utils/recordset/SqlHandler.java +++ b/src/main/java/aiyh/utils/recordset/SqlHandler.java @@ -124,6 +124,16 @@ public class SqlHandler { Object value = getValueByRegx(regx, field, other, arg, false); parseSql = parseSql.replaceFirst(pattern, value.toString()); } + pattern = "\\$t\\{\\s*(?(?\\w+)(\\.?(?\\S+))*)\\s*}"; + compile = Pattern.compile(pattern); + matcher = compile.matcher(parseSql); + while (matcher.find()) { + String regx = matcher.group("regx"); + String field = matcher.group("field"); + String other = matcher.group("other"); + Object value = getValueByRegx(regx, field, other, arg, true); + parseSql = parseSql.replaceFirst(pattern, value.toString()); + } pattern = "#\\{\\s*(?(?\\w+)(\\.?(?\\S+))*)\\s*}"; compile = Pattern.compile(pattern); matcher = compile.matcher(parseSql); diff --git a/src/main/java/com/api/aiyh_pcn/patentWall/entity/PatentEntity.java b/src/main/java/com/api/aiyh_pcn/patentWall/entity/PatentEntity.java index aaee1e5..0fae9be 100644 --- a/src/main/java/com/api/aiyh_pcn/patentWall/entity/PatentEntity.java +++ b/src/main/java/com/api/aiyh_pcn/patentWall/entity/PatentEntity.java @@ -2,7 +2,8 @@ package com.api.aiyh_pcn.patentWall.entity; /** * @author EBU7-dev1-ayh - * @create 2021/11/25 0025 15:30 + * create 2021/11/25 0025 15:30 + * */ diff --git a/src/main/resources/WEB-INF/log4jinit.properties b/src/main/resources/WEB-INF/log4jinit.properties index c0bfbe4..e653c74 100644 --- a/src/main/resources/WEB-INF/log4jinit.properties +++ b/src/main/resources/WEB-INF/log4jinit.properties @@ -165,9 +165,10 @@ log4j.additivity.cloudstore=false #cus log log4j.logger.cus=INFO,ERROR,cus log4j.appender.cus=org.apache.log4j.DailyRollingFileAppender +log4j.appender.cus.Encoding=UTF-8 log4j.appender.cus.DatePattern='_'yyyyMMdd'.log' log4j.appender.cus.File=@cus/cus.log log4j.appender.cus.layout=org.apache.log4j.PatternLayout log4j.appender.cus.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %m%n #log4j.appender.cuslog.Threshold = INFO -log4j.additivity.cus=false \ No newline at end of file +log4j.additivity.cus=false diff --git a/src/test/java/apiTest/httputils_test/HttpUtilsTest.java b/src/test/java/apiTest/httputils_test/HttpUtilsTest.java new file mode 100644 index 0000000..03f09b8 --- /dev/null +++ b/src/test/java/apiTest/httputils_test/HttpUtilsTest.java @@ -0,0 +1,11 @@ +package apiTest.httputils_test; + +/** + * create 2021/12/23 0023 14:29 + * + * @author EBU7-dev1-ayh + */ + + +public class HttpUtilsTest { +} diff --git a/src/test/java/pcn/copy/TestCopy.java b/src/test/java/pcn/copy/TestCopy.java index 968a19f..5bb4540 100644 --- a/src/test/java/pcn/copy/TestCopy.java +++ b/src/test/java/pcn/copy/TestCopy.java @@ -1,6 +1,8 @@ package pcn.copy; +import aiyh.utils.Util; import com.alibaba.fastjson.JSON; +import com.api.aiyh_pcn.multipleCopy.mapper.MultipleCopyMapper; import com.api.aiyh_pcn.multipleCopy.pojo.CopyMultipleMain; import com.api.aiyh_pcn.multipleCopy.services.MultipleCopyService; import com.api.aiyh_pcn.multipleCopy.vo.MultipleCopyConfigVO; @@ -8,6 +10,9 @@ import org.apache.commons.lang.StringUtils; import org.junit.Before; import org.junit.Test; +import java.util.List; +import java.util.Map; + /** * @author EBU7-dev1-ayh * create 2021/12/22 0022 17:27 @@ -25,10 +30,20 @@ public class TestCopy { @Test public void test(){ MultipleCopyService multipleCopyService = new MultipleCopyService(); - MultipleCopyConfigVO configInfo = multipleCopyService.getConfigInfo("48"); + List configInfo = multipleCopyService.getConfigInfo("48"); System.out.println(JSON.toJSONString(configInfo)); } + + @Test + public void test1(){ + MultipleCopyMapper mapper = Util.getMapper(MultipleCopyMapper.class); + Map info = mapper.selectModelFiles("uf_copy_test2021011", 1); + System.out.println(info); + Map info1 = mapper.selectModelFiles("uf_copy_test2021011", 1); + System.out.println(info1); + } + @Test public void testUtil(){ String str = "1,2"; diff --git a/src/test/java/utilTest/UtilTest.java b/src/test/java/utilTest/UtilTest.java index d3fdd68..cf1720b 100644 --- a/src/test/java/utilTest/UtilTest.java +++ b/src/test/java/utilTest/UtilTest.java @@ -1,11 +1,12 @@ package utilTest; import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigMainDTO; import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; -import aiyh.utils.sqlUtil.whereUtil.Where; import com.alibaba.fastjson.JSON; +import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService; import entity.ImageInfo; import mybatisTest.mapper.IMapperTest; import org.apache.commons.lang3.StringUtils; @@ -178,12 +179,12 @@ public class UtilTest { @Test - public void builderSelect(){ + public void builderSelect() { // 将以下数据插入到数据库中,比如 inset into name ,email values('update_name','update_email') - Map map = new HashMap<>(); - map.put("name","update_name"); - map.put("email","update_email"); - map.put("phone","update_phone"); + Map map = new HashMap<>(); + map.put("name", "update_name"); + map.put("email", "update_email"); + map.put("phone", "update_phone"); // 构建SQL PrepSqlResultImpl sqlResult = Util.createSqlBuilder().insertSql( @@ -192,11 +193,11 @@ public class UtilTest { System.out.println(sqlResult); RecordSet rs = new RecordSet(); // 执行SQL - rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); } @Test - public void getRsValue(){ + public void getRsValue() { String sql = "select * from table"; RecordSet rs = new RecordSet(); rs.executeQuery(sql); @@ -216,9 +217,8 @@ public class UtilTest { } - @Test - public void testSqlUtil(){ + public void testSqlUtil() { // 获取代理对象 IMapperTest mapper = Util.getMapper(IMapperTest.class); // 调用方法并获取返回值 @@ -228,7 +228,7 @@ public class UtilTest { @Test - public void testRequest(){ + public void testRequest() { // 构建工具实体 HttpUtils httpUtils = new HttpUtils(); // 获取该对象内的全局 请求头,可以对put来添加请求头信息 @@ -252,9 +252,32 @@ public class UtilTest { } @Test - public void testReadProp(){ + public void testReadProp() { Map patentWall = Util.readProperties2Map("PatentWall", "aiyh.patentWall.search"); System.out.println(JSON.toJSONString(patentWall)); + } + + @Test + public void testTerr() { + FaDDContractService faDDContractService = new FaDDContractService(); + + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree("2"); + System.out.println(JSON.toJSONString(apiConfigMainDTO)); + // 查询签署数据 + List> dataArr = faDDContractService.getDataArr("68071", "45", "formtable_main_17", "formtable_main_17_dt1"); +// 处理数据 + List> maps = faDDContractService.objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + System.out.println(JSON.toJSONString(maps)); + } + + + @Test + public void te(){ + String test = ",7629,7632,"; + System.out.println(test.contains(",7632,")); + } + + } diff --git a/src/test/java/utilTest/UtilsTestMapper.java b/src/test/java/utilTest/UtilsTestMapper.java new file mode 100644 index 0000000..e8184ee --- /dev/null +++ b/src/test/java/utilTest/UtilsTestMapper.java @@ -0,0 +1,28 @@ +package utilTest; + +import aiyh.utils.annotation.recordset.*; +import utilTest.entity.TestEntity; + +import java.util.List; +import java.util.Map; + +/** + * create 2022/1/10 0010 19:57 + * + * @author EBU7-dev1-ayh + */ + +@SqlMapper +public interface UtilsTestMapper { + + @Select(value = "select * from uf_copy_multiple") + public List> selectAll(); + + + @Select(custom = true) +// @CaseConversion(false) + public TestEntity selectOne(@SqlString String sql, @ParamMapper("id") int id); + + @Select(value = "select * from uf_copy_multiple where name = #{name} and age = #{age} and sex = ${sex}") + void selectOneByMap(Map map); +}