From 341fa9e043b40107743fabb6b194e9a9d083176d Mon Sep 17 00:00:00 2001 From: wangxuanran <3055088966@qq.com> Date: Mon, 31 Jul 2023 16:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=A7=91=E6=8A=80=E8=80=83?= =?UTF-8?q?=E5=8B=A4action=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/CusRestTemplateResponse.java | 56 ++++++++++++++++++- .../wfset/action/KqFreezeVacationAction.java | 4 +- .../wang/log/test/CusApiLogUtilTest.java | 2 + 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/main/java/aiyh/utils/cus_rest/pojo/CusRestTemplateResponse.java b/src/main/java/aiyh/utils/cus_rest/pojo/CusRestTemplateResponse.java index da5c838..ce9dc6f 100644 --- a/src/main/java/aiyh/utils/cus_rest/pojo/CusRestTemplateResponse.java +++ b/src/main/java/aiyh/utils/cus_rest/pojo/CusRestTemplateResponse.java @@ -14,7 +14,7 @@ import java.util.function.Consumer; /** - *

自定义请求条件

+ *

自定义请求

* * @author xuanran.wang * @date 2023/4/6 19:34 @@ -24,25 +24,79 @@ import java.util.function.Consumer; @AllArgsConstructor @NoArgsConstructor public class CusRestTemplateResponse { + /** + *

响应对象

+ **/ private ResponeVo vo; + /** + *

请求参数

+ **/ private Object requestParam; + /** + *

接口成功字段标识

+ **/ private String successField; + /** + *

接口请求成功时响应值

+ **/ private Object successValue; + /** + *

接口响应错误字段名

+ **/ private String errorMsg; + /** + *

data字段路径

+ **/ private String dataKey; + /** + *

接口响应信息

+ **/ private String msg; + /** + *

接口响应map

+ **/ private Map response; + /** + *

解密接口 如果接口有加密可自行实现解密接口

+ **/ private CusDataDecipher cusDataDecipher; + /** + *

请求url

+ **/ private String url; + /** + *

运行异常

+ **/ private Exception exception; + /** + *

请求完是否执行响应验证 默认做校验

+ **/ @Builder.Default private boolean checkResponse = true; + /** + *

错误回调

+ **/ private BiConsumer errorCallBack; + /** + *

是否将日志写入建模 默认不写入

+ **/ @Builder.Default private boolean writeLog = false; + /** + *

日志实体类

+ **/ private CusApiLogBaseDto logDto; + /** + *

日志模块id

+ **/ private String logModelId; + /** + *

成功回调

+ **/ private Consumer successCallBack; + /** + *

是否异步写日志 默认异步

+ **/ @Builder.Default private boolean asyncWriteLog = true; diff --git a/src/main/java/com/engine/kq/wfset/action/KqFreezeVacationAction.java b/src/main/java/com/engine/kq/wfset/action/KqFreezeVacationAction.java index 53f8d9f..b06633f 100755 --- a/src/main/java/com/engine/kq/wfset/action/KqFreezeVacationAction.java +++ b/src/main/java/com/engine/kq/wfset/action/KqFreezeVacationAction.java @@ -163,9 +163,9 @@ public class KqFreezeVacationAction extends BaseBean implements Action { RecordSet tempRs = new RecordSet(); String sql = "select duration from " + billTable + " where requestid = ?"; if(CollectionUtils.isNotEmpty(splitBeans)){ - if (tempRs.execute(sql, requestId) && tempRs.next()) { + if (tempRs.executeQuery(sql, requestId) && tempRs.next()) { for (SplitBean splitBean : splitBeans) { - String workflowDuration = Util.null2String(tempRs.getString(1)); + String workflowDuration = Util.null2String(tempRs.getString("duration")); if(StringUtils.isBlank(workflowDuration)){ continue; } diff --git a/src/test/java/xuanran/wang/log/test/CusApiLogUtilTest.java b/src/test/java/xuanran/wang/log/test/CusApiLogUtilTest.java index 5fe9bb2..f2987a2 100644 --- a/src/test/java/xuanran/wang/log/test/CusApiLogUtilTest.java +++ b/src/test/java/xuanran/wang/log/test/CusApiLogUtilTest.java @@ -43,6 +43,8 @@ public class CusApiLogUtilTest extends BaseTest { .successField("code") .successValue(0) .errorMsg("msg") + .writeLog(true) + .asyncWriteLog(false) .logDto(demoDto) .build();