From 2baa228f10d3ea38a693fa5baa4774c74c07c609 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Thu, 29 May 2025 18:58:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=8F=92=E4=BB=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=BA=90=E3=80=81?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=A4=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbs8/service/impl/CbsLogServiceImpl.java | 7 +-- .../service/impl/SeeYonInterFaceImpl.java | 60 ++++++++----------- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java index 07a89a52..5ff114e9 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java @@ -38,8 +38,7 @@ public class CbsLogServiceImpl extends BaseService implemen Logger log = LoggerFactory.getLogger(getClass()); private ICbsLogDao cbsLogDao; - @Value("${OA.data_source_code:}") - private String oa_data_source_code; + @Autowired public void setCbsLogDao(ICbsLogDao cbsLogDao) { this.cbsLogDao = cbsLogDao; @@ -84,7 +83,7 @@ public class CbsLogServiceImpl extends BaseService implemen //根据oaid判断是否在日志表中存在,如果存在,则更新,如果不存在,则新增 CbsLogEntity cbsLogEntityResend=new CbsLogEntity(); cbsLogEntityResend.setOa_id(cbsLogEntity.getOa_id()); - cbsLogEntityResend.setDataSourceCode(oa_data_source_code); + cbsLogEntityResend.setDataSourceCode(cbsLogEntity.getDataSourceCode()); List queryList = query(cbsLogEntityResend); if(CollectionUtils.isEmpty(queryList)){ String data = StrUtil.format(getXmlTemplate(),title,pay_company,payee,amount,cbs_apply_code,bill_code,oa_id,tab_name_ch,tab_name_en,pay_state,message,apply_state,successed); @@ -108,7 +107,7 @@ public class CbsLogServiceImpl extends BaseService implemen logEntity.setApply_state(apply_state); logEntity.setSuccessed(successed); logEntity.setBill_code(cbsLogEntity.getBill_code()); - logEntity.setDataSourceCode(oa_data_source_code); + logEntity.setDataSourceCode(cbsLogEntity.getDataSourceCode()); try { update(logEntity); }catch (Exception e){ diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java index b2e196b3..3c183aee 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java @@ -23,6 +23,7 @@ import com.hzya.frame.util.PluginUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -495,55 +496,44 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace { throw new BaseSystemException("根据formID:" + formAppId + "eventType:"+eventType+"未查询到API配置"); } SysApplicationApiEntity sysApp = applist.get(0); + //数据源配置 + SysApplicationDatabaseEntity sysApiDatabase = new SysApplicationDatabaseEntity(); + sysApiDatabase.setAppId(sysApp.getAppId()); + List apiDataBaseList = sysApplicationDatabaseDao.queryDSBase(sysApiDatabase); + if (CollectionUtils.isNotEmpty(apiDataBaseList) && apiDataBaseList.size() == 1){ + sysApiDatabase = apiDataBaseList.get(0); + } JSONArray headerArray = JSONArray.parseArray(sysApp.getHeaderIn()); + Map headerMap = new HashMap<>(); if (null != headerArray && headerArray.size() > 0) { - String plugId = null; for (int i = 0; i < headerArray.size(); i++) { JSONObject querys = headerArray.getJSONObject(i); //query 只有基本类型,不用循环判断下级 //判断参数是否有值 //获取对象下面的层级数据 String parameterName = querys.getString("parameterName"); - if (null != parameterName && "plugId".equals(parameterName)) { - plugId = querys.getString("example"); - break; - } + String example = querys.getString("example"); + headerMap.put(parameterName,example); } - if (null == plugId) { + if (headerMap.isEmpty()){ throw new BaseSystemException("根据formID:" + formAppId + "未获取到head参数"); - } else { - PluginBaseEntity pluginBaseEntity = null; - JsonResultEntity result; - pluginBaseEntity = PluginUtils.getPluginsById(plugId); - if (null == pluginBaseEntity) { - throw new BaseSystemException("根据ID获取插件错误!请传入正确的 pluginId"); - } else { - //执行业务逻辑代码 - JSONObject reqJson = new JSONObject(); - reqJson.put("jsonStr",jsonStr); - reqJson.put("formAppId",formAppId); - reqJson.put("eventType",eventType); - result = pluginBaseEntity.executeBusiness(reqJson); - return result; - } } - - + PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(headerMap.get("plugId")); + if (null == pluginBaseEntity) { + throw new BaseSystemException("根据ID获取插件错误!请传入正确的 pluginId"); + } + //执行业务逻辑代码 + JSONObject reqJson = new JSONObject(); + reqJson.put("jsonStr",jsonStr); + reqJson.put("formAppId",formAppId); + reqJson.put("eventType",eventType); + reqJson.put("headers",JSON.toJSONString(headerMap)); + reqJson.put("sourceCode",sysApiDatabase.getSourceCode());//数据源编码,参数名和定时任务调用插件保持一致 + JsonResultEntity result = pluginBaseEntity.executeBusiness(reqJson); + return result; } else { throw new BaseSystemException("根据formID:" + formAppId + "未获取到head参数"); } - - -// Map headerMap = MapBuilder.create(true) -// .put("apiCode", String.valueOf(sysApp.getApiCode())) -// //这里用中台做为发送方 -// .put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj") -// .put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") -// .put("appId",String.valueOf(sysApp.getAppCode())) -// .build(); -// String body = HttpRequest.post("http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(jsonStr).timeout(60000).execute().body(); -// logger.info("调用中台返回的参数:{}",body); -// return body; } }else{ // StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)