From 24a1db60accc9149a43586dd4d8dc269dfa16d1c Mon Sep 17 00:00:00 2001 From: wangxuanran <3055088966@qq.com> Date: Mon, 12 Dec 2022 14:17:20 +0800 Subject: [PATCH] =?UTF-8?q?2022-12-12=20=E6=96=87=E4=BB=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=8F=92=E4=BB=B6=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CusCreateWorkFlowController.java | 9 ++-- ...delAsync.java => CusDataToModelAsync.java} | 4 +- .../service/DataAsyncConfigService.java | 6 +-- .../schroeder/action/PushSealTaskAction.java | 19 ++++---- .../PushSealTaskSealValue.java | 26 ++++++----- .../service/SchroederQRCodeService.java | 46 ++++++++++--------- .../model_data_async/AsyncTest.java | 16 +++++-- .../download_file/DownLoadFileTest.java | 39 ++++++++++++++-- 8 files changed, 104 insertions(+), 61 deletions(-) rename src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/{HrmDataToModelAsync.java => CusDataToModelAsync.java} (92%) diff --git a/src/main/java/com/api/xuanran/wang/saic_travel/model_create_workflow/controller/CusCreateWorkFlowController.java b/src/main/java/com/api/xuanran/wang/saic_travel/model_create_workflow/controller/CusCreateWorkFlowController.java index 3abb495..626d929 100644 --- a/src/main/java/com/api/xuanran/wang/saic_travel/model_create_workflow/controller/CusCreateWorkFlowController.java +++ b/src/main/java/com/api/xuanran/wang/saic_travel/model_create_workflow/controller/CusCreateWorkFlowController.java @@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject; import org.apache.log4j.Logger; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; -import weaver.xuanran.wang.common.util.CommonUtil; +import weaver.xuanran.wang.common.util.CommonUtil; // 工具类 import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -26,7 +26,7 @@ import java.util.stream.Collectors; @Path("/wxr/saicTravel/") public class CusCreateWorkFlowController { - private final Logger logger = Util.getLogger(); + private final Logger logger = Util.getLogger(); // 获取日志对象 @Path("cusCreateWorkFlow") @POST @@ -39,14 +39,15 @@ public class CusCreateWorkFlowController { String choiceData = request.getParameter("choiceData"); int modelId = Util.getIntValue(request.getParameter("modelId"), -1); List dataList = Arrays.stream(choiceData.split(",")).collect(Collectors.toList()); - List requestIds = CommonUtil.doCreateWorkFlow(modelId, dataList); + List requestIds = CommonUtil.doCreateWorkFlow(modelId, dataList); // 通过数据审批生成流程 List errorData = new ArrayList<>(); for (int i = 0; i < requestIds.size(); i++) { if (Util.getIntValue(requestIds.get(i), -1) < 0) { errorData.add(dataList.get(i)); } } - logger.error(Util.logStr("执行创建流程失败集合: {}",JSONObject.toJSONString(errorData))); + logger.error(Util.logStr("执行创建流程失败集合: {}",JSONObject.toJSONString(errorData))); // 构建日志字符串 return ApiResult.success(errorData); } } + diff --git a/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/HrmDataToModelAsync.java b/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/CusDataToModelAsync.java similarity index 92% rename from src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/HrmDataToModelAsync.java rename to src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/CusDataToModelAsync.java index 05b9fff..5145d79 100644 --- a/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/HrmDataToModelAsync.java +++ b/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/job/CusDataToModelAsync.java @@ -10,12 +10,12 @@ import weaver.xuanran.wang.saic_travel.model_data_async.service.DataAsyncConfigS /** - *

员工信息同步至建模

+ *

信息同步至建模

* * @Author xuanran.wang * @Date 2022/12/1 15:20 */ -public class HrmDataToModelAsync extends BaseCronJob { +public class CusDataToModelAsync extends BaseCronJob { private final Logger logger = Util.getLogger(); diff --git a/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/service/DataAsyncConfigService.java b/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/service/DataAsyncConfigService.java index fef8ddf..c2fc8e8 100644 --- a/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/service/DataAsyncConfigService.java +++ b/src/main/java/weaver/xuanran/wang/saic_travel/model_data_async/service/DataAsyncConfigService.java @@ -2,7 +2,6 @@ package weaver.xuanran.wang.saic_travel.model_data_async.service; import aiyh.utils.Util; import aiyh.utils.excention.CustomerException; -import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.util.Assert; @@ -14,8 +13,6 @@ import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncD import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain; import weaver.xuanran.wang.saic_travel.model_data_async.config.mapper.DataAsyncConfigMapper; import weaver.xuanran.wang.saic_travel.model_data_async.constant.DataAsyncConstant; -import weaver.xuanran.wang.saic_travel.model_data_async.mapper.DataAsyncMapper; -import weaver.zwl.common.ToolUtil; import java.util.*; import java.util.stream.Collectors; @@ -99,8 +96,7 @@ public class DataAsyncConfigService { linkedHashMapList.add(copyMap); } } - List list = CusInfoToOAUtil.executeBatch(modelId, linkedHashMapList); - return list; + return CusInfoToOAUtil.executeBatch(modelId, linkedHashMapList); } /** *

根据配置将值转换

diff --git a/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java b/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java index d559208..5e53045 100644 --- a/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java +++ b/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java @@ -1,9 +1,9 @@ package weaver.xuanran.wang.schroeder.action; import aiyh.utils.Util; -import aiyh.utils.action.CusBaseAction; +import aiyh.utils.action.CusBaseAction; // 基础的action,实现一些基础的参数 import aiyh.utils.annotation.RequiredMark; -import aiyh.utils.excention.CustomerException; +import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM import weaver.conn.RecordSetTrans; import weaver.hrm.User; import weaver.workflow.request.RequestManager; @@ -16,7 +16,7 @@ import weaver.xuanran.wang.schroeder.service.SchroederQRCodeService; * @Author xuanran.wang * @Date 2022/11/30 16:08 */ -public class PushSealTaskAction extends CusBaseAction { +public class PushSealTaskAction extends CusBaseAction { // 基础的action,实现一些基础的参数 /** *

建模配置唯一标识

@@ -30,24 +30,25 @@ public class PushSealTaskAction extends CusBaseAction { @RequiredMark private String QRCodeField; - private final SchroederQRCodeService schroederQRCodeService = new SchroederQRCodeService(); + private final SchroederQRCodeService schroederQRCodeService = new SchroederQRCodeService(); // 施罗德业务方法 施罗德业务方法 - @Override + @Override // action 提交流程业务处理方法 具体业务逻辑实现 public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestManager requestManager) { log.info("---------- PushSealTaskSealValue Begin " + requestId + "----------"); - String scanNum = schroederQRCodeService.pushSealTask(onlyMark, billTable, requestId); + String scanNum = schroederQRCodeService.pushSealTask(onlyMark, billTable, requestId); // 推送数据创建任务 建模配置唯一标识 RecordSetTrans trans = requestManager.getRsTrans(); trans.setAutoCommit(false); - String updateSql = "update " + billTable + " set " + QRCodeField + " = ? where requestid = ?"; + String updateSql = "update " + billTable + " set " + QRCodeField + " = ? where requestid = ?"; // 二维码来源字段 try{ if(!trans.executeUpdate(updateSql, scanNum, requestId)){ - throw new CustomerException(Util.logStr("更新表单sql执行失败!sql : {}, 参数 scanNum : {}, requestId : {}", scanNum, requestId)); + throw new CustomerException(Util.logStr("更新表单sql执行失败!sql : {}, 参数 scanNum : {}, requestId : {}", scanNum, requestId)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } }catch (Exception e){ trans.rollback(); - throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage())); + throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } trans.commit(); } } + diff --git a/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java b/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java index 1ccb5d0..d4859d7 100644 --- a/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java +++ b/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java @@ -1,14 +1,14 @@ package weaver.xuanran.wang.schroeder.cus_field_value; import aiyh.utils.Util; -import aiyh.utils.excention.CustomerException; +import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import weaver.conn.RecordSet; -import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; -import weaver.zwl.common.ToolUtil; +import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; // 自定义获取参数值 +import weaver.zwl.common.ToolUtil; // 常用工具方法-公用类 import java.util.*; import java.util.stream.Collectors; @@ -19,14 +19,14 @@ import java.util.stream.Collectors; * @Author xuanran.wang * @Date 2022/12/2 16:10 */ -public class PushSealTaskSealValue implements CusInterfaceGetValue { - private final ToolUtil toolUtil = new ToolUtil(); +public class PushSealTaskSealValue implements CusInterfaceGetValue { // 自定义获取参数值 + private final ToolUtil toolUtil = new ToolUtil(); // 常用工具方法-公用类 构造方法 - private final Logger logger = Util.getLogger(); + private final Logger logger = Util.getLogger(); // 获取日志对象 - @Override + @Override // 获取参数值 public Object execute(Map mainMap, Map detailMap, String currentValue, Map pathParam) { - logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam))); + logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam))); // 构建日志字符串 // 接口字段 String sealSnField = pathParam.get("sealSnField"); String sealNumField = pathParam.get("sealNumField"); @@ -36,9 +36,9 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue { String sealNumCusSql = pathParam.get("sealNumCusSql"); // 非空校验 if(checkBlank(sealSnField, sealNumField, sealSnCusSql, sealNumCusSql)){ - throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam))); + throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } - logger.info(Util.logStr("当前值 : {}", currentValue)); + logger.info(Util.logStr("当前值 : {}", currentValue)); // 构建日志字符串 // 如果为空返回空集合 if(StringUtils.isBlank(currentValue)){ return Collections.emptyList(); @@ -50,8 +50,8 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue { } for (String val : currentValue.split(",")) { // 印章类型转换执行自定义sql - String inSealVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealSnCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); - String inSealNumVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealNumCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); + String inSealVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealSnCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); // 用数据库值,根据规则转换,获取其最终结果 + String inSealNumVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealNumCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); // 用数据库值,根据规则转换,获取其最终结果 HashMap map = new HashMap<>(); map.put(sealSnField, inSealVal); map.put(sealNumField, inSealNumVal); @@ -64,3 +64,5 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue { return Arrays.stream(args).anyMatch(StringUtils::isBlank); } } + + diff --git a/src/main/java/weaver/xuanran/wang/schroeder/service/SchroederQRCodeService.java b/src/main/java/weaver/xuanran/wang/schroeder/service/SchroederQRCodeService.java index d85909f..6b28b52 100644 --- a/src/main/java/weaver/xuanran/wang/schroeder/service/SchroederQRCodeService.java +++ b/src/main/java/weaver/xuanran/wang/schroeder/service/SchroederQRCodeService.java @@ -1,7 +1,7 @@ package weaver.xuanran.wang.schroeder.service; import aiyh.utils.Util; -import aiyh.utils.excention.CustomerException; +import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.util.HttpUtils; import com.alibaba.fastjson.JSON; @@ -44,10 +44,10 @@ public class SchroederQRCodeService { **/ private static final String STATUS_FIELD = "status"; private final DealWithMapping dealWithMapping = new DealWithMapping(); - private final Logger log = Util.getLogger(); + private final Logger log = Util.getLogger(); // 获取日志对象 private final HttpUtils httpUtils = new HttpUtils(); { - httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); + httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头 } /** @@ -61,10 +61,10 @@ public class SchroederQRCodeService { **/ public String pushSealTask(String onlyMark, String billTable, String requestId){ String res = ""; - RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); + RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); // 将配置参数通过唯一标识查询处理成树形结构 String cusWhere = Util.null2DefaultStr(requestMappingConfig.getCusWhereSql(),""); if(StringUtils.isNotBlank(cusWhere)){ - cusWhere = DealWithMapping.sbc2dbcCase(cusWhere); + cusWhere = DealWithMapping.sbc2dbcCase(cusWhere); // 全角转半角 } String selectMainSql = "select * from " + billTable + " where requestid = ? " + cusWhere; log.info("查询主表数据sql { " + selectMainSql + " }, requestId { " + requestId + " }"); @@ -72,43 +72,45 @@ public class SchroederQRCodeService { recordSet.executeQuery(selectMainSql, requestId); if (recordSet.next()) { dealWithMapping.setMainTable(billTable); - Map requestParam = dealWithMapping.getRequestParam(recordSet, requestMappingConfig); - log.info(Util.logStr("请求json : {}", JSONObject.toJSONString(requestParam))); + Map requestParam = dealWithMapping.getRequestParam(recordSet, requestMappingConfig); // 解析请求参数配置树,转换成请求参数 + log.info(Util.logStr("请求json : {}", JSONObject.toJSONString(requestParam))); // 构建日志字符串 String url = requestMappingConfig.getRequestUrl(); ResponeVo responeVo = null; try { responeVo = httpUtils.apiPost(url, requestParam); } catch (IOException e) { - throw new CustomerException(Util.logStr("发送印章请求发生异常! : {}", e.getMessage())); + throw new CustomerException(Util.logStr("发送印章请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } - Map headers = httpUtils.getGlobalCache().header; - if (responeVo.getCode() != SUCCESS_CODE) { - log.error(Util.logStr("can not fetch [{}],this request params is [{}]," + + Map headers = httpUtils.getGlobalCache().header; // 全局请求头 + if (responeVo.getCode() != SUCCESS_CODE) { // 相应状态码 + log.error(Util.logStr("can not fetch [{}],this request params is [{}]," + // 构建日志字符串 "this request heard is [{}],but response status code is [{}]," + - "this response is [{}]", url, JSON.toJSON(requestParam), JSON.toJSONString(headers), responeVo.getCode(), - responeVo.getEntityString())); - throw new CustomerException(Util.logStr("can not fetch [{}]", url)); + "this response is [{}]", url, JSON.toJSON(requestParam), JSON.toJSONString(headers), responeVo.getCode(), // 相应状态码 + responeVo.getEntityString())); // 相应内容 + throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } Map response; - log.info(Util.logStr("this response is [{}]", responeVo.getEntityString())); + log.info(Util.logStr("this response is [{}]", responeVo.getEntityString())); // 构建日志字符串 相应内容 try { - response = responeVo.getEntityMap(); - log.info(Util.logStr("接口响应:{}", JSONObject.toJSONString(response))); + response = responeVo.getEntityMap(); // 根据相应结果转化为map集合 + log.info(Util.logStr("接口响应:{}", JSONObject.toJSONString(response))); // 构建日志字符串 } catch (JsonProcessingException e) { - log.error(Util.logStr("push data error, can not parse response to map," + + log.error(Util.logStr("push data error, can not parse response to map," + // 构建日志字符串 "this response is [{}], url is [{}],request params is [{}], request heard is [{}];", - responeVo.getEntityString(), url, JSON.toJSONString(requestParam), JSON.toJSONString(headers))); - throw new CustomerException(Util.logStr("push data error, can not parse response to map")); + responeVo.getEntityString(), url, JSON.toJSONString(requestParam), JSON.toJSONString(headers))); // 相应内容 + throw new CustomerException(Util.logStr("push data error, can not parse response to map")); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } int status = (int) response.get(STATUS_FIELD); if(SUCCESS_STATUS != status){ - throw new CustomerException(Util.logStr("接口响应码不为0,接口响应信息:{}", Util.null2DefaultStr(response.get(MESSAGE_FIELD),""))); + throw new CustomerException(Util.logStr("接口响应码不为0,接口响应信息:{}", Util.null2DefaultStr(response.get(MESSAGE_FIELD),""))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串 } res = Util.null2DefaultStr(response.get(SCAN_NUM_FIELD),""); } if(StringUtils.isBlank(res)){ - throw new CustomerException("获取接口中响应任务字段为空, 请检查!"); + throw new CustomerException("获取接口中响应任务字段为空, 请检查!"); // 自定义异常类 create 2022/3/9 2:20 PM } return res; } } + + diff --git a/src/test/java/xuanran/wang/saic_travel/model_data_async/AsyncTest.java b/src/test/java/xuanran/wang/saic_travel/model_data_async/AsyncTest.java index fe7657e..a95e623 100644 --- a/src/test/java/xuanran/wang/saic_travel/model_data_async/AsyncTest.java +++ b/src/test/java/xuanran/wang/saic_travel/model_data_async/AsyncTest.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import weaver.formmode.data.ModeDataApproval; +import weaver.general.Util; import weaver.hrm.User; import weaver.xuanran.wang.common.util.CommonUtil; import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain; @@ -44,10 +45,17 @@ public class AsyncTest extends BaseTest { @Test public void testAsync(){ - DataAsyncMain config = dataAsyncConfigService.getDataAsyncConfigByUniqueCode("hrmAsyncTest"); - List data = dataAsyncConfigService.asyncModelData(config, 109); - List list = CommonUtil.doCreateWorkFlow(109, data); - log.info("触发成功 : " + JSONObject.toJSONString(list)); +// try { +// DataAsyncMain config = dataAsyncConfigService.getDataAsyncConfigByUniqueCode("wacoTest"); +// List data = dataAsyncConfigService.asyncModelData(config, 109); +// log.info("生成的数据id : " + JSONObject.toJSONString(data)); +// }catch (Exception e){ +// log.error("生成建模数据异常 : " + e.getMessage()); +// } +// List list = CommonUtil.doCreateWorkFlow(109, data); +// log.info("触发成功 : " + JSONObject.toJSONString(list)); + log.info("select hr.email from HrmResource hr where status in (0,1,2,3) AND "+ Util.getSubINClause("1,3,323,124,544","id","in") + " and " + Util.getSubINClause("1","id","not in")); + log.info(Util.getSubINClause("1,3,323,124,544","id","in",2)); } @Test diff --git a/src/test/java/xuanran/wang/schroeder/download_file/DownLoadFileTest.java b/src/test/java/xuanran/wang/schroeder/download_file/DownLoadFileTest.java index 70fe195..48ef944 100644 --- a/src/test/java/xuanran/wang/schroeder/download_file/DownLoadFileTest.java +++ b/src/test/java/xuanran/wang/schroeder/download_file/DownLoadFileTest.java @@ -4,8 +4,11 @@ import aiyh.utils.Util; import basetest.BaseTest; import com.alibaba.fastjson.JSONObject; import com.api.xuanran.wang.schroeder.download_file.mapper.DownLoadFileMapper; +import com.icbc.api.internal.apache.http.impl.cookie.S; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; import weaver.file.ImageFileManager; +import weaver.general.TimeUtil; import weaver.xuanran.wang.common.util.CommonUtil; import java.io.FileInputStream; @@ -14,7 +17,10 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Map; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; /** *

@@ -39,7 +45,34 @@ public class DownLoadFileTest extends BaseTest { @Test public void testImageFileInputSteam(){ - InputStream inputStreamById = ImageFileManager.getInputStreamById(705); - System.out.println("============="); + HashMap header = new HashMap<>(); + header.put("Content-Type", "application/json;charset=utf-8"); + header.put("Authorization", ""); + header.put("reqFrom", "1212"); + header.put("reqId", UUID.randomUUID().toString()); + header.put("reqTime", TimeUtil.getCurrentTimeString()); + log.info("header " + header); + } + + @Test + public void testParseStr(){ + + String str = ""; + String pattern = "(?<=\\{).+(?=})"; + Pattern compile = Pattern.compile(pattern); + Matcher matcher = compile.matcher(str); + while (matcher.find()){ + String group = matcher.group(); + if(StringUtils.isNotBlank(group)){ + if(group.startsWith("main.")){ + String replaceAll = group.replaceAll("#\\{.+}","黄齑淡饭"); + log.info("replaceAll : " + replaceAll); + }else if(group.startsWith("detail.")){ + + }else if(group.startsWith("sql.")){ + + } + } + } } }