调整OA插件调用方式
This commit is contained in:
parent
8b00953f47
commit
a6af70de5f
|
@ -6,6 +6,7 @@ import com.hzya.frame.web.entity.JsonResultEntity;
|
|||
|
||||
/**
|
||||
* 致远OA接口类
|
||||
*
|
||||
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||
* @version 1.0
|
||||
* @content
|
||||
|
@ -17,18 +18,17 @@ public interface ISeeYonInterFace {
|
|||
* 发起OA表单方法
|
||||
* @content:
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-22 9:31
|
||||
* @date 2023-08-22 9:31
|
||||
* @param requestData 请求json
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @Content: 提供给OA的标准接口方法,包含参数 entity 为OA 的data信息, , eventType 为事件类型
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2020-12-24 10:36
|
||||
* @Date 2020-12-24 10:36
|
||||
* @Param [entity, eventType]
|
||||
* eventType:
|
||||
* 发起前事件 onBeforeStart ,
|
||||
|
@ -59,26 +59,36 @@ public interface ISeeYonInterFace {
|
|||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
*
|
||||
* @param sysExtensionApi
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi)throws Exception;
|
||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi) throws Exception;
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
JsonResultEntity colEventListener(JSONObject jsonObject)throws Exception;
|
||||
JsonResultEntity colEventListener(JSONObject jsonObject) throws Exception;
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听后置方法,调用三方接口
|
||||
*
|
||||
* @param jsonStr
|
||||
* @param formAppId
|
||||
* @param eventType
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String colEventPost(String jsonStr,String formAppId,String eventType)throws Exception;
|
||||
JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception;
|
||||
|
||||
|
||||
JsonResultEntity chengeBody(JSONObject jsonObject) throws Exception;
|
||||
|
||||
SysExtensionApiEntity chengeBodySetPlug(SysExtensionApiEntity entity);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.hzya.frame.seeyon.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao;
|
||||
import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity;
|
||||
import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity;
|
||||
|
@ -19,6 +19,7 @@ import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao
|
|||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
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;
|
||||
|
@ -28,6 +29,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -50,14 +52,30 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
private static final String sendUrl = "http://60.204.152.210/seeyon/";
|
||||
//速网esb地址
|
||||
private static final String baseUrl = "http://hzya.ufyct.com:9067/kangarooDataCenter/entranceController/externalCallInterface";
|
||||
@Resource
|
||||
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
|
||||
@Autowired
|
||||
private ISysApplicationApiService sysApplicationApiService;
|
||||
/**
|
||||
* 定义所支持的事件静态代码块
|
||||
*/
|
||||
private static final StringBuffer eventTypeBuffer = new StringBuffer();
|
||||
//基础档案类型
|
||||
private final String ARCHIVESTYPE = "archives";
|
||||
//流程表单类型
|
||||
private final String FLOWTYPE = "flow";
|
||||
//创建基础档案
|
||||
private final String CREATEARCHIVES = "create";
|
||||
//更新基础档案
|
||||
private final String UPDATEARCHIVES = "update";
|
||||
//创建基础档案
|
||||
private final String CREATEARCHIVESURL = "rest/form/import/";
|
||||
//创建基础档案
|
||||
private final String UPDATEARCHIVESURL = "rest/form/update";
|
||||
@Resource
|
||||
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
|
||||
@Autowired
|
||||
private ISysApplicationApiService sysApplicationApiService;
|
||||
@Resource
|
||||
private ISeeYonInterFaceDao seeYonInterFaceDao;
|
||||
//上一次同步时间
|
||||
private final String LAST_SYNCHRONISED_TIME = "";
|
||||
|
||||
{
|
||||
eventTypeBuffer.append("发起前事件 onBeforeStart ,");
|
||||
|
@ -75,24 +93,6 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
eventTypeBuffer.append("取回事件 onTakeBack,");
|
||||
}
|
||||
|
||||
//基础档案类型
|
||||
private final String ARCHIVESTYPE = "archives";
|
||||
//流程表单类型
|
||||
private final String FLOWTYPE = "flow";
|
||||
//创建基础档案
|
||||
private final String CREATEARCHIVES = "create";
|
||||
//更新基础档案
|
||||
private final String UPDATEARCHIVES = "update";
|
||||
//创建基础档案
|
||||
private final String CREATEARCHIVESURL = "rest/form/import/";
|
||||
//创建基础档案
|
||||
private final String UPDATEARCHIVESURL = "rest/form/update";
|
||||
@Resource
|
||||
private ISeeYonInterFaceDao seeYonInterFaceDao;
|
||||
|
||||
|
||||
//上一次同步时间
|
||||
private String LAST_SYNCHRONISED_TIME = "";
|
||||
/****
|
||||
* @Content:发起无流程表单接口实现
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
|
@ -100,7 +100,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
* @Param [templateCode 模版编码, sendLoginName 发送人登录帐号 ,xmlData ]
|
||||
* @return java.lang.Integer
|
||||
**/
|
||||
public static JsonResultEntity saveNoProcess(String templateCode , String interfaceUrl,String sendLoginName, String xmlData) {
|
||||
public static JsonResultEntity saveNoProcess(String templateCode, String interfaceUrl, String sendLoginName, String xmlData) {
|
||||
String token = getToken(RESTUSERNAME, RESTPASSWORD, sendLoginName);
|
||||
Map res = new HashMap();
|
||||
res.put("loginName", sendLoginName);
|
||||
|
@ -119,7 +119,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
res.put("token", token);
|
||||
res.put("moduleId", moduleId);
|
||||
res.put("templateCode", templateCode);
|
||||
logger.info("更新无流程表单参数:{}",JSON.toJSONString(res));
|
||||
logger.info("更新无流程表单参数:{}", JSON.toJSONString(res));
|
||||
String result = HttpRequest.put(sendUrl + interfaceUrl).header("token", token).body(JSON.toJSONString(res)).execute().body();
|
||||
logger.info("更新无流程表单执行结果:" + result);
|
||||
return BaseResult.getFailureMessageEntity("执行成功", result);
|
||||
|
@ -185,7 +185,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
List<JSONObject> attributeArray = JSON.parseArray(attributeArrayStr, JSONObject.class);
|
||||
JsonResultEntity result = null;
|
||||
if (ARCHIVESTYPE.equalsIgnoreCase(type)) {
|
||||
switch (templateCode){
|
||||
switch (templateCode) {
|
||||
//预留的
|
||||
case "abc123":
|
||||
break;
|
||||
|
@ -198,13 +198,13 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
|
||||
|
||||
@Override
|
||||
public JsonResultEntity thirdInterfaceSeeYonPlugInInterfaceEntrance(JSONObject requestData){
|
||||
public JsonResultEntity thirdInterfaceSeeYonPlugInInterfaceEntrance(JSONObject requestData) {
|
||||
String jsonStr = requestData.getString("jsonStr");
|
||||
JSONObject jsonObject = requestData.getJSONObject("jsonStr");
|
||||
OAWorkflowEventDataEntity entity = JSON.parseObject(jsonStr,OAWorkflowEventDataEntity.class);
|
||||
logger.info("监听OA事件入参:"+jsonObject.toJSONString());
|
||||
OAWorkflowEventDataEntity entity = JSON.parseObject(jsonStr, OAWorkflowEventDataEntity.class);
|
||||
logger.info("监听OA事件入参:" + jsonObject.toJSONString());
|
||||
JSONObject formBeanData = jsonObject.getJSONObject("businessDataStr");
|
||||
String eventType = jsonObject.getString("eventType") ;
|
||||
String eventType = jsonObject.getString("eventType");
|
||||
/** 流程ID*/
|
||||
String summaryId = entity.getSummaryId();
|
||||
/** 节点ID*/
|
||||
|
@ -223,73 +223,74 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
//formApp 最好过滤一下
|
||||
|
||||
|
||||
String result = null;
|
||||
JsonResultEntity result = null;
|
||||
try {
|
||||
//流程事件处理
|
||||
result = colEventPost(jsonStr, formApp, eventType);
|
||||
}catch (Exception e){
|
||||
return BaseResult.getFailureMessageEntity("传递失败",e.getMessage());
|
||||
}
|
||||
try {
|
||||
/** 根据事件类型处理相关事件*/
|
||||
switch (eventType) {
|
||||
/** 发起前事件*/
|
||||
case "onBeforeStart":
|
||||
break;
|
||||
/** 发起事件*/
|
||||
case "onStart":
|
||||
//流程发起 新增grpu8单据
|
||||
break;
|
||||
/** 终止前事件*/
|
||||
case "onBeforeStop":
|
||||
break;
|
||||
/** 终止事件*/
|
||||
case "onStop":
|
||||
//流程终止,更新grpu8单据
|
||||
break;
|
||||
/** 撤销前事件*/
|
||||
case "onBeforeCancel":
|
||||
break;
|
||||
/** 撤销事件*/
|
||||
case "onCancel":
|
||||
//流程撤销,更新grpu8单据
|
||||
break;
|
||||
/** 结束事件*/
|
||||
case "onProcessFinished":
|
||||
break;
|
||||
/** 处理前事件*/
|
||||
case "onBeforeFinishWorkitem":
|
||||
/** 根据form处理相关业务表单的数据*/
|
||||
switch (formApp) {
|
||||
case "abc123":
|
||||
break;
|
||||
default:
|
||||
return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, "");
|
||||
}
|
||||
break;
|
||||
/** 处理事件*/
|
||||
case "onFinishWorkitem":
|
||||
break;
|
||||
/** 回退前事件*/
|
||||
case "onBeforeStepBack":
|
||||
break;
|
||||
/** 回退事件*/
|
||||
case "onStepBack":
|
||||
break;
|
||||
/** 取回前事件*/
|
||||
case "onBeforeTakeBack":
|
||||
break;
|
||||
/** 取回事件*/
|
||||
case "onTakeBack":
|
||||
break;
|
||||
default:
|
||||
// throw new RuntimeException("传入了非法事件类型!请参照:" + eventTypeBuffer.toString());
|
||||
return BaseResult.getFailureMessageEntity("传入了非法事件类型!请参照:" + eventTypeBuffer.toString(), "", "");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("传递成功", result);
|
||||
}catch (Exception e){
|
||||
return BaseResult.getFailureMessageEntity("传递失败",e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return BaseResult.getFailureMessageEntity("传递失败", e.getMessage());
|
||||
}
|
||||
return result;
|
||||
// try {
|
||||
// /** 根据事件类型处理相关事件*/
|
||||
// switch (eventType) {
|
||||
// /** 发起前事件*/
|
||||
// case "onBeforeStart":
|
||||
// break;
|
||||
// /** 发起事件*/
|
||||
// case "onStart":
|
||||
// //流程发起 新增grpu8单据
|
||||
// break;
|
||||
// /** 终止前事件*/
|
||||
// case "onBeforeStop":
|
||||
// break;
|
||||
// /** 终止事件*/
|
||||
// case "onStop":
|
||||
// //流程终止,更新grpu8单据
|
||||
// break;
|
||||
// /** 撤销前事件*/
|
||||
// case "onBeforeCancel":
|
||||
// break;
|
||||
// /** 撤销事件*/
|
||||
// case "onCancel":
|
||||
// //流程撤销,更新grpu8单据
|
||||
// break;
|
||||
// /** 结束事件*/
|
||||
// case "onProcessFinished":
|
||||
// break;
|
||||
// /** 处理前事件*/
|
||||
// case "onBeforeFinishWorkitem":
|
||||
// /** 根据form处理相关业务表单的数据*/
|
||||
// switch (formApp) {
|
||||
// case "abc123":
|
||||
// break;
|
||||
// default:
|
||||
// return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, "");
|
||||
// }
|
||||
// break;
|
||||
// /** 处理事件*/
|
||||
// case "onFinishWorkitem":
|
||||
// break;
|
||||
// /** 回退前事件*/
|
||||
// case "onBeforeStepBack":
|
||||
// break;
|
||||
// /** 回退事件*/
|
||||
// case "onStepBack":
|
||||
// break;
|
||||
// /** 取回前事件*/
|
||||
// case "onBeforeTakeBack":
|
||||
// break;
|
||||
// /** 取回事件*/
|
||||
// case "onTakeBack":
|
||||
// break;
|
||||
// default:
|
||||
//// throw new RuntimeException("传入了非法事件类型!请参照:" + eventTypeBuffer.toString());
|
||||
// return BaseResult.getFailureMessageEntity("传入了非法事件类型!请参照:" + eventTypeBuffer.toString(), "", "");
|
||||
// }
|
||||
// return BaseResult.getSuccessMessageEntity("传递成功", result);
|
||||
// }catch (Exception e){
|
||||
// return BaseResult.getFailureMessageEntity("传递失败",e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,8 +298,8 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
public JsonResultEntity thirdInterfaceSeeYonDefinitionRePush(JSONObject jsonObject) throws Exception {
|
||||
JSONObject requestData = jsonObject.getJSONObject("jsonStr");
|
||||
JSONArray resultEntityArray = new JSONArray();
|
||||
if(null == requestData){
|
||||
throw new BaseSystemException("参数传递错误需要jsonStr!");
|
||||
if (null == requestData) {
|
||||
throw new BaseSystemException("参数传递错误需要jsonStr!");
|
||||
}
|
||||
//表单模版ID
|
||||
String formAppId = requestData.getString("formAppId");
|
||||
|
@ -308,24 +309,24 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
String dataSourceCode = requestData.getString("dataSourceCode");
|
||||
//主表ID集合 formMainIds
|
||||
JSONArray formMainIds = requestData.getJSONArray("formMainIds");
|
||||
if(StrUtil.isEmpty(eventType)){
|
||||
throw new BaseSystemException("需要传递eventType 参照致远OA事件!");
|
||||
if (StrUtil.isEmpty(eventType)) {
|
||||
throw new BaseSystemException("需要传递eventType 参照致远OA事件!");
|
||||
}
|
||||
if(StrUtil.isEmpty(formAppId)){
|
||||
throw new BaseSystemException("需要传递formAppId 参照致远OA 表 CAP_FORM_DEFINITION!");
|
||||
if (StrUtil.isEmpty(formAppId)) {
|
||||
throw new BaseSystemException("需要传递formAppId 参照致远OA 表 CAP_FORM_DEFINITION!");
|
||||
}
|
||||
if(StrUtil.isEmpty(dataSourceCode)){
|
||||
throw new BaseSystemException("需要传递dataSourceCode 参照中台表 sys_data_source!");
|
||||
if (StrUtil.isEmpty(dataSourceCode)) {
|
||||
throw new BaseSystemException("需要传递dataSourceCode 参照中台表 sys_data_source!");
|
||||
}
|
||||
if(null == formMainIds || formMainIds.size() == 0){
|
||||
throw new BaseSystemException("需要传递业务主表数据id集合,不允许全量推送!");
|
||||
if (null == formMainIds || formMainIds.size() == 0) {
|
||||
throw new BaseSystemException("需要传递业务主表数据id集合,不允许全量推送!");
|
||||
}
|
||||
|
||||
SeeYonInterFaceEntity seeYonInterFaceEntity = new SeeYonInterFaceEntity();
|
||||
BeanUtil.copyProperties(requestData,seeYonInterFaceEntity);
|
||||
BeanUtil.copyProperties(requestData, seeYonInterFaceEntity);
|
||||
List<SeeYonInterFaceEntity> seeYonInterFaceEntityList = seeYonInterFaceDao.queryDefinitionInfo(seeYonInterFaceEntity);
|
||||
if(null != seeYonInterFaceEntityList && seeYonInterFaceEntityList.size() >0){
|
||||
for(SeeYonInterFaceEntity interFaceEntity : seeYonInterFaceEntityList){
|
||||
if (null != seeYonInterFaceEntityList && seeYonInterFaceEntityList.size() > 0) {
|
||||
for (SeeYonInterFaceEntity interFaceEntity : seeYonInterFaceEntityList) {
|
||||
String field_info = interFaceEntity.getField_info();
|
||||
JSONObject infoJson = JSON.parseObject(field_info);
|
||||
//获取主表信息
|
||||
|
@ -338,7 +339,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
/** 设置主表查询条件*/
|
||||
interFaceEntity.setTabName(formMainTableName);
|
||||
interFaceEntity.setDataSourceCode(dataSourceCode);
|
||||
interFaceEntity.setFormMainIds( formMainIds.toJavaList(String.class) );
|
||||
interFaceEntity.setFormMainIds(formMainIds.toJavaList(String.class));
|
||||
|
||||
List<Map<String, Object>> forMainList = seeYonInterFaceDao.queryDefinitionData(interFaceEntity);
|
||||
for (Map<String, Object> forMainRow : forMainList) {
|
||||
|
@ -350,11 +351,11 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
String forMainId = String.valueOf(forMainRow.get("ID"));
|
||||
//组装主表数据
|
||||
for (Map.Entry<String, Object> entry : forMainRow.entrySet()) {
|
||||
formMainObj.put(entry.getKey().toLowerCase(),entry.getValue());
|
||||
}
|
||||
formMainObj.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
//组装明细表数据
|
||||
if(null != formSons && formSons.size() > 0){
|
||||
for(Object formSon : formSons){
|
||||
if (null != formSons && formSons.size() > 0) {
|
||||
for (Object formSon : formSons) {
|
||||
JSONObject son = JSON.parseObject(JSON.toJSONString(formSon));
|
||||
//明细数据
|
||||
String sonTableName = son.getString("tableName");
|
||||
|
@ -368,38 +369,38 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
//组装明细数据
|
||||
JSONObject forSonJson = new JSONObject();
|
||||
for (Map.Entry<String, Object> entry : forSons.entrySet()) {
|
||||
forSonJson.put(entry.getKey().toLowerCase(),entry.getValue());
|
||||
}
|
||||
forSonJson.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
jsonArray.add(forSonJson);
|
||||
}
|
||||
//设置明细表数据
|
||||
seeYonBean.put(sonTableName,jsonArray);
|
||||
seeYonBean.put(sonTableName, jsonArray);
|
||||
}
|
||||
}
|
||||
|
||||
seeYonBean.put(formMainTableName,formMainObj);
|
||||
seeYonBean.put(formMainTableName, formMainObj);
|
||||
JSONObject rePushRequestData = new JSONObject();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("formApp",formAppId);
|
||||
object.put("eventType",eventType);
|
||||
object.put("businessDataStr",seeYonBean.toJSONString());
|
||||
object.put("affairId","");
|
||||
object.put("summaryId",requestData.getString("summaryId"));
|
||||
object.put("currentActivityId","");
|
||||
object.put("id",forMainId);
|
||||
object.put("hzyaExtData",requestData.getJSONObject("hzyaExtData"));
|
||||
logger.info("Method:thirdInterfaceSeeYonDefinitionRePush 组装seeYonBean DATA: {}",seeYonBean.toJSONString());
|
||||
object.put("formApp", formAppId);
|
||||
object.put("eventType", eventType);
|
||||
object.put("businessDataStr", seeYonBean.toJSONString());
|
||||
object.put("affairId", "");
|
||||
object.put("summaryId", requestData.getString("summaryId"));
|
||||
object.put("currentActivityId", "");
|
||||
object.put("id", forMainId);
|
||||
object.put("hzyaExtData", requestData.getJSONObject("hzyaExtData"));
|
||||
logger.info("Method:thirdInterfaceSeeYonDefinitionRePush 组装seeYonBean DATA: {}", seeYonBean.toJSONString());
|
||||
|
||||
rePushRequestData.put("jsonStr",object);
|
||||
rePushRequestData.put("jsonStr", object);
|
||||
|
||||
|
||||
JsonResultEntity resultEntity = thirdInterfaceSeeYonPlugInInterfaceEntrance(rePushRequestData);
|
||||
if(null != resultEntity){
|
||||
JsonResultEntity resultEntity = thirdInterfaceSeeYonPlugInInterfaceEntrance(rePushRequestData);
|
||||
if (null != resultEntity) {
|
||||
resultEntityArray.add(resultEntity.getAttribute());
|
||||
}else{
|
||||
JSONObject jsonResultEntity = new JSONObject();
|
||||
jsonResultEntity.put("msg","从新推送失败");
|
||||
jsonResultEntity.put("id",forMainId);
|
||||
} else {
|
||||
JSONObject jsonResultEntity = new JSONObject();
|
||||
jsonResultEntity.put("msg", "从新推送失败");
|
||||
jsonResultEntity.put("id", forMainId);
|
||||
resultEntityArray.add(jsonResultEntity);
|
||||
|
||||
}
|
||||
|
@ -407,11 +408,12 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
}
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("从新推送执行结束",resultEntityArray);
|
||||
return BaseResult.getSuccessMessageEntity("从新推送执行结束", resultEntityArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
|
@ -426,10 +428,10 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
sysApplicationDatabaseEntity.setAppId(applicationEntity.getId());
|
||||
sysApplicationDatabaseEntity.setDataSourceCode("master");
|
||||
List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity);
|
||||
if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){
|
||||
if (sysDataSourceEntities != null && sysDataSourceEntities.size() > 0) {
|
||||
String parm = entity.getBodys();
|
||||
JSONObject jsonObject = JSONObject.parseObject(parm);
|
||||
jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode());
|
||||
jsonObject.put("dataSourceCode", sysDataSourceEntities.get(0).getSourceCode());
|
||||
entity.setBodys(jsonObject.toJSONString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -448,24 +450,24 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
@Override
|
||||
public JsonResultEntity colEventListener(JSONObject jsonObject) throws Exception {
|
||||
try {
|
||||
if (null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("jsonStr"))){
|
||||
if (null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("jsonStr"))) {
|
||||
SeeYonInterFaceEntity entity = jsonObject.getJSONObject("jsonStr").toJavaObject(SeeYonInterFaceEntity.class);
|
||||
JSONObject requestData = new JSONObject();
|
||||
//表单模版ID
|
||||
requestData.put("formAppId", entity.getFormAppId());
|
||||
//事件事件类型
|
||||
requestData.put("eventType",entity.getEventType());
|
||||
requestData.put("eventType", entity.getEventType());
|
||||
//数据源编码
|
||||
requestData.put("dataSourceCode",entity.getDataSourceCode());
|
||||
requestData.put("formMainIds",entity.getFormMainIds());
|
||||
requestData.put("summaryId",entity.getSummaryId());
|
||||
requestData.put("dataSourceCode", entity.getDataSourceCode());
|
||||
requestData.put("formMainIds", entity.getFormMainIds());
|
||||
requestData.put("summaryId", entity.getSummaryId());
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("jsonStr",requestData);
|
||||
jsonStr.put("jsonStr", requestData);
|
||||
thirdInterfaceSeeYonDefinitionRePush(jsonStr);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("流程事件通知接口出错:{}",e);
|
||||
return BaseResult.getSuccessMessageEntity("失败",e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("流程事件通知接口出错:{}", e);
|
||||
return BaseResult.getSuccessMessageEntity("失败", e.getMessage());
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("成功");
|
||||
}
|
||||
|
@ -480,28 +482,101 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String colEventPost(String jsonStr, String formAppId, String eventType) throws Exception {
|
||||
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)){
|
||||
public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception {
|
||||
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) {
|
||||
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
||||
sysApplicationApiEntity.setHeaderIn(formAppId+"_"+eventType);
|
||||
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
|
||||
List<SysApplicationApiEntity> applist = sysApplicationApiService.queryLike(sysApplicationApiEntity);
|
||||
if (CollectionUtil.isNotEmpty(applist)){
|
||||
if (applist.size() > 1){
|
||||
throw new BaseSystemException("根据formID:" + formAppId+"查询出多条数据");
|
||||
if (CollectionUtil.isNotEmpty(applist)) {
|
||||
if (applist.size() > 1) {
|
||||
throw new BaseSystemException("根据formID:" + formAppId + "查询出多条数据");
|
||||
}
|
||||
if (applist.size() == 0 ) {
|
||||
throw new BaseSystemException("根据formID:" + formAppId + "eventType:"+eventType+"未查询到API配置");
|
||||
}
|
||||
SysApplicationApiEntity sysApp = applist.get(0);
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>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:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(jsonStr).timeout(60000).execute().body();
|
||||
logger.info("调用中台返回的参数:{}",body);
|
||||
return body;
|
||||
JSONArray headerArray = JSONArray.parseArray(sysApp.getHeaderIn());
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (null == plugId) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
throw new BaseSystemException("根据formID:" + formAppId + "未获取到head参数");
|
||||
}
|
||||
|
||||
|
||||
// Map<String, String> headerMap = MapBuilder.<String, String>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)
|
||||
logger.info("jsonStr,formAppId,eventType为空!执行错误"+jsonStr+formAppId+eventType);
|
||||
throw new BaseSystemException("jsonStr,formAppId,eventType为空!执行错误");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity chengeBody(JSONObject object) throws Exception {
|
||||
JSONObject jsonstr = object.getJSONObject("jsonStr");
|
||||
PluginBaseEntity pluginBaseEntity = null;
|
||||
JsonResultEntity result;
|
||||
String pluginId = jsonstr.getString("plugId");
|
||||
pluginBaseEntity = PluginUtils.getPluginsById(pluginId);
|
||||
if (null == pluginBaseEntity) {
|
||||
throw new BaseSystemException("根据ID获取插件错误!请传入正确的 pluginId");
|
||||
} else {
|
||||
//执行业务逻辑代码
|
||||
result = pluginBaseEntity.executeBusiness(object);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysExtensionApiEntity chengeBodySetPlug(SysExtensionApiEntity entity) {
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
JSONObject jsonObject = JSONObject.parseObject(entity.getBodys());
|
||||
jsonObject.put("plugId", headers.get("plugId"));
|
||||
entity.setBodys(jsonObject.toJSONString());
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue