diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index 80a054e..64a9751 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -63,10 +63,10 @@ public class Util extends weaver.general.Util { private static final UtilService utilService = new UtilService(); private static final RecordSet rs = new RecordSet(); private static final String LOGGER_NAME = "cusAYH"; - static ToolUtil toolUtil = new ToolUtil(); private static final RecordsetUtil recordsetUtil = new RecordsetUtil(); private static final UtilMapper mapper = getMapper(UtilMapper.class); private static final LoggerUtil loggerUtil = new LoggerUtil(); + static ToolUtil toolUtil = new ToolUtil(); private static volatile Logger log = null; /** @@ -1806,20 +1806,13 @@ public class Util extends weaver.general.Util { public static String getErrString(Throwable throwable) { StringWriter stringWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(stringWriter, true)); - new Thread(() -> { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } finally { - try { - stringWriter.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - }); - return stringWriter.getBuffer().toString(); + String errStr = stringWriter.getBuffer().toString(); + try { + stringWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return errStr; } /** diff --git a/src/main/java/aiyh/utils/apirequest/ApiRequestUtil.java b/src/main/java/aiyh/utils/apirequest/ApiRequestUtil.java deleted file mode 100644 index d5aa93d..0000000 --- a/src/main/java/aiyh/utils/apirequest/ApiRequestUtil.java +++ /dev/null @@ -1,12 +0,0 @@ -package aiyh.utils.apirequest; - -/** - *

第三方请求工具类

- *

create 2022/1/22 0022 20:15

- * - * @author EBU7-dev1-ayh - */ - - -public class ApiRequestUtil { -} diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/ModelDataHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/ModelDataHandler.java index 8ee61f8..7077f0d 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/ModelDataHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/ModelDataHandler.java @@ -12,7 +12,25 @@ import aiyh.utils.apirequest.pojo.ApiRequestMain; * @author EBU7-dev1-ayh */ - +/* + * 彩蛋 2 书接上回 + * + * + * 客户想再上级面前表扬我,让给我加点工资 ----> 主要是怕我没做完项目就离职 + * + * 后来客户问老板,我会不会项目没做完离职,老板自信的说不会: + * 评了优秀员工,奖励iPhone12一个 + * 年会抽奖抽中 无人机\ps4任选 + * 所以坚定我不会离职 (可是,算错了,调薪没成功就已经打算离职了) + * + * 客户之前似乎争取过让我涨薪,但是具体情况不知道 + * + * 客户说 那个是抽奖嘛,那你给人家加工资了没 + * + * 老板说 加了,加了百分之29% + * + * 后续自行寻找 + */ public class ModelDataHandler implements IDataSourceHandler { @Override public ParamConfigInfo parseDataSource(ApiRequestData apiRequestData) { diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/WorkflowDataHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/WorkflowDataHandler.java index 9737ec8..5f9e3c5 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/WorkflowDataHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/datasource/WorkflowDataHandler.java @@ -27,7 +27,22 @@ import java.util.Map; * @author EBU7-dev1-ayh */ - +/* + * 彩蛋3 书接上回 + * + * 好吧,刚好我知道了这件事 + * 我震惊了,加薪了我竟然不知道,离大谱 + * 不过客户争取加工资的还要一个同事,他加了,我没加(本来无所谓,大不了问问调薪机制,但是老板们说的破大防了) + * + * 这一刻,公司的印象全没了,路走死了啊! + * + * 好了,这回离职的想法更加坚定了 + * + * 当这个注释被看到的时候就是离职的时候(或许没看到就离职了,后来的同学有幸看到注释的话, + * 好好想想什么样的场景,自己拿捏,在项目中加班是常事,但是依然没有加班工资,且有时候你会被好几个项目经理一起催, + * 结局就是加班到凌晨,免费劳动力。) + * + */ public class WorkflowDataHandler implements IDataSourceHandler { private final DataSourceMapper mapper = Util.getMapper(DataSourceMapper.class); @@ -56,8 +71,9 @@ public class WorkflowDataHandler implements IDataSourceHandler { /** * 查询流程明细表数据,并通过明细表数据解析请求参数 + * * @param apiRequestData api请求配置参数对象 - * @param mainData 流程主表数据信息 + * @param mainData 流程主表数据信息 * @return api请求参数信息 */ public List> parseValueForDetail(ApiRequestData apiRequestData, Map mainData) { @@ -65,6 +81,10 @@ public class WorkflowDataHandler implements IDataSourceHandler { List> detailList = mapper.selectDetailData(requestDetailTableName, String.valueOf(mainData.get("id"))); // 获取api请求配置明细表配置信息 List paramDetailList = apiRequestData.getParamDetailList(); +// 树形结构转换 + paramDetailList = Util.listToTree(paramDetailList, ApiRequestParamData::getLineNum, ApiRequestParamData::getParentLine, + ApiRequestParamData::getChildList, ApiRequestParamData::setChildList, + parentLine -> parentLine == null || parentLine <= 0); // 创建参数处理对象 ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class); ParamTypeHandlerFactory paramTypeHandlerFactory = factory.createParamHandlerFactory(ParamTypeHandlerFactory.class); @@ -78,12 +98,18 @@ public class WorkflowDataHandler implements IDataSourceHandler { dataMap.put("detail", detail); List paramInfoList = new ArrayList<>(); for (ApiRequestParamData paramDetail : paramDetailList) { +// 获取值转换类型对应的枚举对象 ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(paramDetail.getValueRule()); ParamTypeEnum paramTypeEnum = ParamTypeEnum.get(paramDetail.getParamType()); +// 通过工厂获取对应的参数处理对象 IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum); IParamTypeHandler paramTypeHandler = paramTypeHandlerFactory.createParamHandler(paramTypeEnum); - Object value = paramTypeHandler.getValue(paramDetail, paramHandler,dataMap); +// 处理参数值类型 + Object value = paramTypeHandler.getValue(paramDetail, paramHandler, dataMap); +// 参数类型转换 ParamInfo paramInfo = BeanMapper.INSTANCE.apiRequestData2ParamInfo(paramDetail); +// 设置子结点 + paramInfo.setChildList(paramDetail.getParamInfoList()); paramInfo.setParamValue(value); paramInfoList.add(paramInfo); } diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ListTypeHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ListTypeHandler.java index 43a2e7e..1e2e32d 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ListTypeHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ListTypeHandler.java @@ -1,9 +1,12 @@ package aiyh.utils.apirequest.core.typehandler.paramtype; +import aiyh.utils.Util; import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler; import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler; import aiyh.utils.apirequest.entity.ApiRequestParamData; +import aiyh.utils.apirequest.mapper.ParamValueParseMapper; +import java.util.List; import java.util.Map; /** @@ -16,8 +19,21 @@ import java.util.Map; public class ListTypeHandler implements IParamTypeHandler { + private ParamValueParseMapper mapper = Util.getMapper(ParamValueParseMapper.class); + @Override public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map dataMap) { return null; } + + + public List> getDataListBySql(ApiRequestParamData paramData, Map dataMap){ + mapper.selectListByCustomerSql(paramData.getCustomerValue(),dataMap); + return null; + } + + public List> getDataListByDetail(){ + + return null; + } } diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ObjectTypeHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ObjectTypeHandler.java index 4dc4db6..8cd8036 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ObjectTypeHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramtype/ObjectTypeHandler.java @@ -1,9 +1,20 @@ package aiyh.utils.apirequest.core.typehandler.paramtype; +import aiyh.utils.apirequest.core.factory.AbstractFactory; +import aiyh.utils.apirequest.core.factory.AbstractFactoryImpl; +import aiyh.utils.apirequest.core.factory.ParamTypeHandlerFactory; +import aiyh.utils.apirequest.core.factory.ParamValueRuleHandlerFactory; import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler; import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler; import aiyh.utils.apirequest.entity.ApiRequestParamData; +import aiyh.utils.apirequest.entity.ParamInfo; +import aiyh.utils.apirequest.enumtype.ParamTypeEnum; +import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum; +import aiyh.utils.apirequest.mapsturct.BeanMapper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -16,8 +27,30 @@ import java.util.Map; public class ObjectTypeHandler implements IParamTypeHandler { + private final AbstractFactory factory = new AbstractFactoryImpl(); @Override public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map dataMap) { + List childList = paramData.getChildList(); + if(childList == null || childList.size() == 0){ + return new HashMap<>(2); + } + ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class); + ParamTypeHandlerFactory paramTypeHandlerFactory = factory.createParamHandlerFactory(ParamTypeHandlerFactory.class); + List paramInfoList = new ArrayList<>(); +// 对子项进行解析和类型转换 + for (ApiRequestParamData apiRequestParamData : childList) { +// 获取转换规则对应的枚举对象 + ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(apiRequestParamData.getValueRule()); + ParamTypeEnum paramTypeEnum = ParamTypeEnum.get(apiRequestParamData.getParamType()); + IParamTypeHandler paramTypeHandler = paramTypeHandlerFactory.createParamHandler(paramTypeEnum); + IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum); + Object value = paramTypeHandler.getValue(apiRequestParamData, paramHandler,dataMap); + ParamInfo paramInfo = BeanMapper.INSTANCE.apiRequestData2ParamInfo(apiRequestParamData); + paramInfo.setParamValue(value); + paramInfoList.add(paramInfo); + } + paramData.setParamInfoList(paramInfoList); return null; } + } diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CurrentDataTimeRuleHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CurrentDataTimeRuleHandler.java index 2123cc7..3348780 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CurrentDataTimeRuleHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CurrentDataTimeRuleHandler.java @@ -2,7 +2,6 @@ package aiyh.utils.apirequest.core.typehandler.paramvalue; import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler; import aiyh.utils.apirequest.entity.ApiRequestParamData; -import aiyh.utils.apirequest.pojo.ApiRequestParamDetail; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CustomerSqlRuleHandler.java b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CustomerSqlRuleHandler.java index c3743ed..13d114a 100644 --- a/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CustomerSqlRuleHandler.java +++ b/src/main/java/aiyh/utils/apirequest/core/typehandler/paramvalue/CustomerSqlRuleHandler.java @@ -43,6 +43,7 @@ public class CustomerSqlRuleHandler implements IParamValueRuleHandler { if (paramTypeEnum == ParamTypeEnum.LIST_TYPE) { List> maps = mapper.selectListByCustomerSql(sqlStr, dataMap); dataMap.put(name, maps); + return null; } // 如果是Object类型,则需要查询Map类型的数据,并将数据保存在dataMap中 if (paramTypeEnum == ParamTypeEnum.OBJECT_TYPE) { diff --git a/src/main/java/aiyh/utils/apirequest/entity/ApiRequestParamData.java b/src/main/java/aiyh/utils/apirequest/entity/ApiRequestParamData.java index 2374c0b..d770937 100644 --- a/src/main/java/aiyh/utils/apirequest/entity/ApiRequestParamData.java +++ b/src/main/java/aiyh/utils/apirequest/entity/ApiRequestParamData.java @@ -1,6 +1,10 @@ package aiyh.utils.apirequest.entity; import aiyh.utils.apirequest.pojo.ApiRequestParamDetail; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; /** *

Api 请求参数配置业务对象

@@ -9,6 +13,9 @@ import aiyh.utils.apirequest.pojo.ApiRequestParamDetail; * @author EBU7-dev1-ayh */ - +@EqualsAndHashCode(callSuper = true) +@Data public class ApiRequestParamData extends ApiRequestParamDetail { + private List childList; + private List paramInfoList; } diff --git a/src/main/java/aiyh/utils/apirequest/entity/ParamInfo.java b/src/main/java/aiyh/utils/apirequest/entity/ParamInfo.java index 1efa372..d20a440 100644 --- a/src/main/java/aiyh/utils/apirequest/entity/ParamInfo.java +++ b/src/main/java/aiyh/utils/apirequest/entity/ParamInfo.java @@ -1,6 +1,5 @@ package aiyh.utils.apirequest.entity; -import aiyh.utils.apirequest.pojo.ApiRequestParamDetail; import lombok.Data; import java.util.List; diff --git a/src/main/java/aiyh/utils/apirequest/mapper/ParamValueParseMapper.java b/src/main/java/aiyh/utils/apirequest/mapper/ParamValueParseMapper.java index 443c971..8024421 100644 --- a/src/main/java/aiyh/utils/apirequest/mapper/ParamValueParseMapper.java +++ b/src/main/java/aiyh/utils/apirequest/mapper/ParamValueParseMapper.java @@ -20,18 +20,20 @@ public interface ParamValueParseMapper { /** * 查询自定义SQL - * @param sql 自定义SQL字符串 + * + * @param sql 自定义SQL字符串 * @param map 参数 * @return 查询到的数据 */ @Select(custom = true) @CaseConversion(false) - public String selectCustomerSql(@SqlString String sql, Map map); + public String selectCustomerSql(@SqlString String sql, Map map); /** * 自定义查询SQL对象 - * @param sqlStr 自定义SQL字符串 + * + * @param sqlStr 自定义SQL字符串 * @param dataMap 参数 * @return 查询到的数据 */ @@ -42,11 +44,34 @@ public interface ParamValueParseMapper { /** * 自定义查询SQL集合 - * @param sql 自定义SQL字符串 + * + * @param sql 自定义SQL字符串 * @param dataMap 参数 * @return 查询到的数据 */ @Select(custom = true) @CaseConversion(false) - public List> selectListByCustomerSql(@SqlString String sql, Map dataMap); + public List> selectListByCustomerSql(@SqlString String sql, Map dataMap); + + /** + * 查询普通数组的请求参数类型 + * + * @param sql 自定义SQL字符串 + * @param dataMap 参数 + * @return 查询到的数据 + */ + @Select(custom = true) + @CaseConversion(false) + public List selectStringListByCustomerSql(@SqlString String sql, Map dataMap); + + /** + * 查询普通数组请求参数类型 + * + * @param sql 自定义SQL字符串 + * @param dataMap 参数 + * @return 查询到的数据 + */ + @Select(custom = true) + @CaseConversion(false) + public List selectIntegerListByCustomerSql(@SqlString String sql, Map dataMap); } diff --git a/src/main/java/aiyh/utils/apirequest/service/ApiRequestService.java b/src/main/java/aiyh/utils/apirequest/service/ApiRequestService.java index c67c420..eb9c72a 100644 --- a/src/main/java/aiyh/utils/apirequest/service/ApiRequestService.java +++ b/src/main/java/aiyh/utils/apirequest/service/ApiRequestService.java @@ -15,6 +15,7 @@ import aiyh.utils.apirequest.pojo.ApiRequestMain; import aiyh.utils.apirequest.pojo.ApiRequestParamDetail; import lombok.Data; import lombok.Setter; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Objects; @@ -28,6 +29,20 @@ import java.util.concurrent.atomic.AtomicReference; * @author EBU7-dev1-ayh */ +/* + +* 彩蛋1 + +* 2022/02/14 开完会后和上级谈工资的事情 +* 结果说每年固定时间调薪,12月份时我没满半年,调薪失败,并画下一个大饼,今年六月有我 +* 调薪额度200-2000 +* +* 2022/02/13 客户在之前的工作中对我十分认可 +* 问我将我包下来在项目上能不能有更多的工资,我说结算方式不一样,不管包与不包,都是 一样的 +* +* 后续更加精彩,记得找找,就在这个文件的方法调用里面(说不定在实现类里面哦) +* */ + @Setter @Data public class ApiRequestService { @@ -52,22 +67,44 @@ public class ApiRequestService { this.interceptor = interceptor; } + public void requestById(int id){ + ApiRequestMain apiRequestMain = getApiRequestMainById(id); + ParamConfigInfo paramConfigInfo = parseParam(apiRequestMain); + + } + + public void requestByMark(){ + + } + /** * 获取数据库配置信息 * - * @param id 配置id + * @param mark 配置唯一标识 * @return */ - public ApiRequestMain getApiRequestMain(int id) { - AtomicReference apiRequestMain = new AtomicReference<>(mapper.selectApiConfigById(id)); + public ApiRequestMain getApiRequestMainByMark(String mark) { + AtomicReference apiRequestMain = new AtomicReference<>(mapper.selectApiConfigByOnlyMark(mark)); + return getApiRequestMain(apiRequestMain); + } + + /** + * 获取配置信息 + * @param apiRequestMain 配置信息主表 + * @return + */ + @Nullable + private ApiRequestMain getApiRequestMain(AtomicReference apiRequestMain) { if (Objects.isNull(apiRequestMain.get())) { return null; } +// 查询配置表明细信息 List paramDetailList = mapper.selectApiParamListByMainId(apiRequestMain.get().getId()); apiRequestMain.get().setParamDetailList(paramDetailList); List heardDetailList = mapper.selectApiHeardListByMainId(apiRequestMain.get().getId()); apiRequestMain.get().setHeardDetailList(heardDetailList); +// 回调拦截器 Optional.ofNullable(interceptor).map(interceptor -> { Optional.ofNullable(interceptor.parseBefore(apiRequestMain.get())).map(v -> { apiRequestMain.set(v); @@ -78,20 +115,33 @@ public class ApiRequestService { return apiRequestMain.get(); } + + /** + * 获取数据库配置信息 + * + * @param id 配置id + * @return + */ + public ApiRequestMain getApiRequestMainById(int id) { + AtomicReference apiRequestMain = new AtomicReference<>(mapper.selectApiConfigById(id)); + return getApiRequestMain(apiRequestMain); + } + /** * 解析参数值 - * + * ┗( ▔, ▔ )┛ Σσ(・Д・;)我我我什么都没做!!! * @param apiRequestMain 主表配置信息 * @return 解析后的参数值 */ public ParamConfigInfo parseParam(ApiRequestMain apiRequestMain) { +// 抽象工厂获取参数数据源处理对象 DataSourceHandlerFactory dataSourceHandlerFactory = abstractFactory.createParamHandlerFactory(DataSourceHandlerFactory.class); DataSourceRuleEnum dataSourceRuleEnum = DataSourceRuleEnum.get(apiRequestMain.getDataSource()); IDataSourceHandler paramHandler = dataSourceHandlerFactory.createParamHandler(dataSourceRuleEnum); ApiRequestData apiRequestData = BeanMapper.INSTANCE.apiRequestMain2Data(apiRequestMain); apiRequestData.setApiBaseInfo(this.apiBaseInfo); +// 解析数据参数 AtomicReference paramConfigInfo = new AtomicReference<>(paramHandler.parseDataSource(apiRequestData)); -// TODO 解析配置表中的参数 Optional.ofNullable(interceptor).map(interceptor -> { Optional.ofNullable(interceptor.parseAfter(paramConfigInfo.get())).map(v -> { paramConfigInfo.set(v); @@ -130,3 +180,8 @@ public class ApiRequestService { } } + + + + + diff --git a/src/main/java/com/api/aiyh_pcn/async_organization/ExportExcel.java b/src/main/java/com/api/aiyh_pcn/async_organization/ExportExcel.java index b462c59..adc6f1a 100644 --- a/src/main/java/com/api/aiyh_pcn/async_organization/ExportExcel.java +++ b/src/main/java/com/api/aiyh_pcn/async_organization/ExportExcel.java @@ -74,8 +74,9 @@ public class ExportExcel { Employee e = employeeList.get(i); // toolUtil.writeErrorLog("item数据库:" + e); if (e.getJOBCODEID() == null || e.getJOBCODEID() == 0){ - toolUtil.writeErrorLog("数据出现错误:" + e); - continue; +// toolUtil.writeErrorLog("数据出现错误:" + e); + e.setJOBCODEID(-0L); +// continue; } Row row = sheet.createRow(i + 2); row.createCell(0).setCellValue(e.getUserID()); diff --git a/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java b/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java index b41efc1..efa90a8 100644 --- a/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java +++ b/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java @@ -90,12 +90,9 @@ public class ConfigTableData { tableName + " where id = ?"; ToolUtil toolUtil = new ToolUtil(); - toolUtil.writeDebuggerLog("接收到参数tableName{" + tableName + "},fieldName{" + fieldName + "}configId{" + configId); - toolUtil.writeDebuggerLog("sql:" + queryBuilder); rs.executeQuery(queryBuilder,configId); if(rs.next()){ String docIds = Util.null2String(rs.getString(1)); - toolUtil.writeDebuggerLog("查询到数据:" + docIds); return docIds.split(","); } return new String[0]; diff --git a/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java b/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java index a742d1d..9826126 100644 --- a/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java +++ b/src/main/java/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java @@ -66,7 +66,6 @@ public class DocTemplateDao { public int[] copyFile(int userId, String tableName, String fieldName, String configId) { this.userId = userId; String[] templateData = ConfigTableData.getTemplateData(tableName, fieldName, configId); - this.toolUtil.writeDebuggerLog("模板数据:" + Arrays.toString(templateData)); int[] array = Arrays.stream(templateData).mapToInt(Integer::parseInt).toArray(); return this.copyFile(array); } @@ -138,7 +137,6 @@ public class DocTemplateDao { .uPut("seccategory", docCategory.split(",")[docCategory.split(",").length - 1]); Where whereIn = Util.createPrepWhereImpl().whereAnd("id").whereInList(list); PrepSqlResultImpl updateResult = Util.createSqlBuilder().updateSql("docdetail", updateMap, whereIn); - this.toolUtil.writeDebuggerLog(updateResult.getSqlStr() + " : " + updateResult.getArgs()); return rs.executeUpdate(updateResult.getSqlStr(), updateResult.getArgs()); } return false; diff --git a/src/main/java/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java b/src/main/java/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java index 95106c1..52f41db 100644 --- a/src/main/java/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java +++ b/src/main/java/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java @@ -34,7 +34,6 @@ public class CopyAttachment { @Produces(MediaType.APPLICATION_JSON) public String copyAttachment(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map params) { - this.toolUtil.writeDebuggerLog("文件拷贝,接收参数:" + params); User user = HrmUserVarify.getUser(request, response); return CopyAttachmentService.copyFile(user,params); } @@ -45,7 +44,6 @@ public class CopyAttachment { @Produces(MediaType.APPLICATION_JSON) public String deleteFile(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("docIds") String docIds) { - this.toolUtil.writeDebuggerLog("文件删除,接收参数:" + docIds); return CopyAttachmentService.deleteFile(docIds); } @@ -54,7 +52,6 @@ public class CopyAttachment { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public String queryConfig(@PathParam("workflowId") String workflowId) { - this.toolUtil.writeDebuggerLog("获取配置参数,接收参数为: " + workflowId); return ApiResult.success(ConfigTableData.getConfig(workflowId)); } @@ -64,7 +61,6 @@ public class CopyAttachment { @Produces(MediaType.APPLICATION_JSON) public String queryFilesData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map params){ - this.toolUtil.writeDebuggerLog("查看文件信息,接收参数:" + params); User user = HrmUserVarify.getUser(request, response); return CopyAttachmentService.queryFilesData(user, params); } diff --git a/src/main/java/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java b/src/main/java/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java index 851eeee..9dbc64e 100644 --- a/src/main/java/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java +++ b/src/main/java/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java @@ -39,9 +39,43 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; /** + * 法大大集成 + * * @author EBU7-dev1-ayh * @create 2021/11/3 0003 14:51 */ + + +// 写这个代码的时候只有我和上帝知道在写啥 2021/11/10 + +// 好了,现在只有上帝知道了 2022/02/16 + +/* + * 2022/02/18 + *你可能觉得自己看懂下面的代码了, + + *然而你并没有,相信我。 + + *糊弄过去算了,不然你会好多个晚上睡不着觉, + + *嘴里骂着这段注释,觉得自己很聪明, + + *真能“优化”下面的代码。 + + *现在关上文件,去玩点别的吧。 + + */ + +/* + * 听说你要改这里面的逻辑 + * + * 听一句劝,别试图在一座屎山上面拉屎 + * + * 当屎山崩塌的时候,没有一个拉屎的是无辜的 + * + * 当你决定动这个文件的时候,你就要面对无尽的折磨 + * + * */ public class FaDDContractService { private final ToolUtil toolUtil = new ToolUtil(); private final String contractInfoTable = "uf_contract_info"; @@ -971,17 +1005,12 @@ public class FaDDContractService { private PushAPushEmailEntity queryEmailInfo(int workflowType, String requestId) { PushAPushEmailEntity pushAPushEmailEntity = faDDContractMapping.queryEmailInfo(workflowType); Map workflowData = getWorkflowData(String.valueOf(workflowType), requestId); - toolUtil.writeDebuggerLog("获取到邮件配置参数:" + JSON.toJSONString(pushAPushEmailEntity)); - toolUtil.writeDebuggerLog("查询到的数据:===> " + JSON.toJSONString(workflowData)); String parsingTitle = parsingValue(pushAPushEmailEntity.getEmailTitle(), workflowData); - toolUtil.writeDebuggerLog("parsingTitle解析后的值:" + parsingTitle); pushAPushEmailEntity.setEmailTitle(parsingTitle); String parsingEmail = parsingValue(pushAPushEmailEntity.getEmailAddress(), workflowData); - toolUtil.writeDebuggerLog("parsingEmail解析后的值:" + parsingEmail); pushAPushEmailEntity.setEmailAddress(parsingEmail); try { String parsingContent = parsingValue(pushAPushEmailEntity.getEmailContent(), workflowData); - toolUtil.writeDebuggerLog("parsingContent解析后的值:" + parsingContent); pushAPushEmailEntity.setEmailContent(parsingContent); } catch (Exception e) { toolUtil.writeDebuggerLog("解析出错:" + e.toString()); diff --git a/src/main/java/com/api/aiyh_pcn/fadada/web/FaDDContractController.java b/src/main/java/com/api/aiyh_pcn/fadada/web/FaDDContractController.java index 2c437a8..8c448af 100644 --- a/src/main/java/com/api/aiyh_pcn/fadada/web/FaDDContractController.java +++ b/src/main/java/com/api/aiyh_pcn/fadada/web/FaDDContractController.java @@ -160,7 +160,6 @@ public class FaDDContractController { @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response contractDownload(@PathParam("requestId") String requestId) { - toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId); try { UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO); diff --git a/src/main/java/com/api/aiyh_pcn/patentWall/controller/PatentWallController.java b/src/main/java/com/api/aiyh_pcn/patentWall/controller/PatentWallController.java index 887bb73..6a6e4df 100644 --- a/src/main/java/com/api/aiyh_pcn/patentWall/controller/PatentWallController.java +++ b/src/main/java/com/api/aiyh_pcn/patentWall/controller/PatentWallController.java @@ -7,6 +7,7 @@ import com.api.aiyh_pcn.patentWall.service.PatentWallService; import com.api.aiyh_pcn.patentWall.vo.PatentVO; import com.api.aiyh_pcn.patentWall.vo.SearchInputVO; import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.log4j.Logger; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -28,16 +29,22 @@ import java.util.Map; @Path("/patten/") public class PatentWallController { private final PatentWallService patentWallService = new PatentWallService(); + private final Logger logger = Util.getLogger(); @Path("/getSearchList/{prefix}") @GET @Produces(MediaType.APPLICATION_JSON) public String getPatentList(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("prefix") String prefix){ - User user = HrmUserVarify.getUser(request, response); - int languageId = user.getLanguage(); - List result = patentWallService.getSearchList(prefix,languageId); - return ApiResult.success(result); + try { + User user = HrmUserVarify.getUser(request, response); + int languageId = user.getLanguage(); + List result = patentWallService.getSearchList(prefix,languageId); + return ApiResult.success(result); + }catch (Exception e){ + logger.error("捕获到异常信息:" + Util.getErrString(e)); + return ApiResult.error("捕获到调用异常信息"); + } } @Path("/getList/{prefix}") @@ -45,8 +52,13 @@ public class PatentWallController { @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public String getPatentList(@RequestBody List filterWheres, @PathParam("prefix") String prefix){ - List result = patentWallService.getList(filterWheres,prefix); - return ApiResult.success(result); + try { + List result = patentWallService.getList(filterWheres,prefix); + return ApiResult.success(result); + }catch (Exception e){ + logger.error("捕获到异常信息:" + Util.getErrString(e)); + return ApiResult.error("捕获到调用异常信息"); + } } @Path("/clearConf") diff --git a/src/main/java/com/api/aiyh_pcn/patentWall/service/PatentWallService.java b/src/main/java/com/api/aiyh_pcn/patentWall/service/PatentWallService.java index 7402847..8f0c9ce 100644 --- a/src/main/java/com/api/aiyh_pcn/patentWall/service/PatentWallService.java +++ b/src/main/java/com/api/aiyh_pcn/patentWall/service/PatentWallService.java @@ -9,6 +9,7 @@ import com.api.aiyh_pcn.patentWall.vo.LinkUrlVO; import com.api.aiyh_pcn.patentWall.vo.PatentVO; import com.api.aiyh_pcn.patentWall.vo.SearchInputVO; import com.api.aiyh_pcn.patentWall.vo.SelectOptionsVo; +import org.apache.log4j.Logger; import weaver.conn.RecordSet; import java.beans.BeanInfo; @@ -28,344 +29,347 @@ import java.util.regex.Pattern; * @create 2021/11/25 0025 15:23 */ public class PatentWallService { - private final PatentWallMapping patentWallMapping = new PatentWallMapping(); - private final ToolUtil toolUtil = new ToolUtil(); - private Map patentWallConf; - private Map patentWallSearchConf; - private final RecordSet rs = new RecordSet(); + private final PatentWallMapping patentWallMapping = new PatentWallMapping(); + private final ToolUtil toolUtil = new ToolUtil(); + private final RecordSet rs = new RecordSet(); + private Map patentWallConf; + private Map patentWallSearchConf; + private final Logger logger = Util.getLogger(); - /** - * 查询搜索框配置信息 - * - * @param prefix 前缀 - * @return 配置信息 - */ - public List getSearchList(String prefix, int languageId) { - Map patentWallSearchConf = getPatentWallSearchConf(prefix + ".search"); - String dataResource = String.valueOf(patentWallSearchConf.get("dataResource")); - List> inputs = - (List>) patentWallSearchConf.get("inputs"); - List searchInputList = new ArrayList<>(); - for (Map input : inputs) { - SearchInputVO searchInputVO = new SearchInputVO(); - int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0")); - String dbFieldName = Util.null2String(input.get("dbFieldName")); - String value = Util.null2String(input.get("value")); - String labelName = Util.null2String(input.get("labelName")); - Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"), "0")); - Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"), "0")); - Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"), "false")); - searchInputVO.setType(type); - searchInputVO.setLabelName(labelName); - searchInputVO.setSearchType(searchType); - searchInputVO.setDbFieldName(dbFieldName); - searchInputVO.setLabelIndex(labelIndex); - searchInputVO.setLabelIndex(labelIndex); - searchInputVO.setMultiple(multiple); - searchInputVO.setValue(value); - searchInputList.add(searchInputVO); - switch (type) { - case 1: - // 下拉框 查询options - List optionsVos = - getSelectOptions(dataResource, dbFieldName, languageId); - searchInputVO.setSelectOptions(optionsVos); - case 2: - // 单行文本 - break; - case 3: - // 日期 - case 4: - // 单人力资源 - break; - case 5: - // 多人力资源 - break; - case 6: - // 流程路径 - break; - case 7: - // 多流程路径 - break; - default: - toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!"); - break; - } - } - return searchInputList; - } - - private List getSelectOptions( - String dataResource, String dbFieldName, int languageId) { - List> selectOptions = - patentWallMapping.getSelectOptions(dataResource, dbFieldName); - List optionsVos = new ArrayList<>(); - SelectOptionsVo optionsDefault = new SelectOptionsVo(); - optionsDefault.setSelected(true); - optionsDefault.setKey(""); - optionsDefault.setShowname(""); - optionsVos.add(optionsDefault); - for (Map selectOption : selectOptions) { - SelectOptionsVo optionsVo = new SelectOptionsVo(); - optionsVo.setSelected(false); - optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"), "")); - String selectName = Util.null2DefaultStr(selectOption.get("selectname"), ""); - String showName = selectName; - if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) { - String pattern = "(`~`" + languageId + " )(?