物料同步保存修改从界面获取
This commit is contained in:
parent
05c29ab062
commit
741a69a0b6
|
@ -26,5 +26,9 @@ public interface IZjMaterielSynchronizationEventDao extends IBaseDao<ZjMaterielS
|
||||||
Integer updatewlbm(ZjMaterielSynchronizationEventEntity entity);
|
Integer updatewlbm(ZjMaterielSynchronizationEventEntity entity);
|
||||||
|
|
||||||
List<ZjMaterielSynchronizationEventEntity> queryById(ZjMaterielSynchronizationEventEntity entity1);
|
List<ZjMaterielSynchronizationEventEntity> queryById(ZjMaterielSynchronizationEventEntity entity1);
|
||||||
|
|
||||||
|
List<ZjMaterielSynchronizationEventEntity> getmeiji(ZjMaterielSynchronizationEventEntity zjMaterielSynchronizationEventEntity);
|
||||||
|
|
||||||
|
List<ZjMaterielSynchronizationEventEntity> getuser(ZjMaterielSynchronizationEventEntity user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,5 +44,15 @@ public class ZjMaterielSynchronizationEventDaoImpl extends MybatisGenericDao<ZjM
|
||||||
public List<ZjMaterielSynchronizationEventEntity> queryById(ZjMaterielSynchronizationEventEntity entity) {
|
public List<ZjMaterielSynchronizationEventEntity> queryById(ZjMaterielSynchronizationEventEntity entity) {
|
||||||
return (List<ZjMaterielSynchronizationEventEntity>) super.selectList(getSqlIdPrifx() + "queryById",entity);
|
return (List<ZjMaterielSynchronizationEventEntity>) super.selectList(getSqlIdPrifx() + "queryById",entity);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
public List<ZjMaterielSynchronizationEventEntity> getmeiji(ZjMaterielSynchronizationEventEntity entity) {
|
||||||
|
return (List<ZjMaterielSynchronizationEventEntity>) super.selectList(getSqlIdPrifx() + "getmeiji",entity);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
public List<ZjMaterielSynchronizationEventEntity> getuser(ZjMaterielSynchronizationEventEntity entity) {
|
||||||
|
return (List<ZjMaterielSynchronizationEventEntity>) super.selectList(getSqlIdPrifx() + "getuser",entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,38 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getmeiji" resultType="com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity"
|
||||||
|
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
showvalue as accName
|
||||||
|
from CTP_ENUM_ITEM
|
||||||
|
where REF_ENUMID in (
|
||||||
|
'-183521076637120167', -- field0038
|
||||||
|
'8744672489280851787', -- field0008
|
||||||
|
'-7143577122323478491', -- field0009 field0010 field0022 field0035
|
||||||
|
'-9054856313904676186', -- field0012
|
||||||
|
'-8777711854515435336', -- field0014
|
||||||
|
'7306464606663623197', -- field0017
|
||||||
|
'3731163912961082997', -- field0018
|
||||||
|
'612018623748066455', -- field0019
|
||||||
|
'-5893688452217157155', -- field0020
|
||||||
|
'-8682849565428789486', -- field0033
|
||||||
|
'3282520586982344070', -- field0034
|
||||||
|
'1314047672872420014', -- field0040
|
||||||
|
'6435913155541223805', -- field0042
|
||||||
|
'7788441092115810835', -- field0047
|
||||||
|
'-7568576445236623045' -- field0048
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
<select id="getuser" resultType="com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity"
|
||||||
|
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
name as accName
|
||||||
|
from v_user_view_all
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 致远OA接口类
|
* 致远OA接口类
|
||||||
|
*
|
||||||
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @content
|
* @content
|
||||||
|
@ -24,7 +25,6 @@ public interface ISeeYonInterFace {
|
||||||
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
|
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @Content: 提供给OA的标准接口方法,包含参数 entity 为OA 的data信息, , eventType 为事件类型
|
* @Content: 提供给OA的标准接口方法,包含参数 entity 为OA 的data信息, , eventType 为事件类型
|
||||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
@ -59,13 +59,16 @@ public interface ISeeYonInterFace {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* seeyon流程事件监听前置方法,绑定数据源
|
* seeyon流程事件监听前置方法,绑定数据源
|
||||||
|
*
|
||||||
* @param sysExtensionApi
|
* @param sysExtensionApi
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi) throws Exception;
|
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* seeyon流程事件监听
|
* seeyon流程事件监听
|
||||||
|
*
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -74,11 +77,18 @@ public interface ISeeYonInterFace {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* seeyon流程事件监听后置方法,调用三方接口
|
* seeyon流程事件监听后置方法,调用三方接口
|
||||||
|
*
|
||||||
* @param jsonStr
|
* @param jsonStr
|
||||||
* @param formAppId
|
* @param formAppId
|
||||||
* @param eventType
|
* @param eventType
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @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.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.map.MapBuilder;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao;
|
import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao;
|
||||||
import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity;
|
import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity;
|
||||||
import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity;
|
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.database.entity.SysApplicationDatabaseEntity;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
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.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import com.hzya.frame.web.exception.BaseSystemException;
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
|
@ -28,6 +29,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -50,14 +52,30 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
private static final String sendUrl = "http://60.204.152.210/seeyon/";
|
private static final String sendUrl = "http://60.204.152.210/seeyon/";
|
||||||
//速网esb地址
|
//速网esb地址
|
||||||
private static final String baseUrl = "http://hzya.ufyct.com:9067/kangarooDataCenter/entranceController/externalCallInterface";
|
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 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 ,");
|
eventTypeBuffer.append("发起前事件 onBeforeStart ,");
|
||||||
|
@ -75,24 +93,6 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
eventTypeBuffer.append("取回事件 onTakeBack,");
|
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:发起无流程表单接口实现
|
* @Content:发起无流程表单接口实现
|
||||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
@ -223,73 +223,74 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
//formApp 最好过滤一下
|
//formApp 最好过滤一下
|
||||||
|
|
||||||
|
|
||||||
String result = null;
|
JsonResultEntity result = null;
|
||||||
try {
|
try {
|
||||||
//流程事件处理
|
//流程事件处理
|
||||||
result = colEventPost(jsonStr, formApp, eventType);
|
result = colEventPost(jsonStr, formApp, eventType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return BaseResult.getFailureMessageEntity("传递失败", e.getMessage());
|
return BaseResult.getFailureMessageEntity("传递失败", e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
return result;
|
||||||
/** 根据事件类型处理相关事件*/
|
// try {
|
||||||
switch (eventType) {
|
// /** 根据事件类型处理相关事件*/
|
||||||
/** 发起前事件*/
|
// switch (eventType) {
|
||||||
case "onBeforeStart":
|
// /** 发起前事件*/
|
||||||
break;
|
// case "onBeforeStart":
|
||||||
/** 发起事件*/
|
// break;
|
||||||
case "onStart":
|
// /** 发起事件*/
|
||||||
//流程发起 新增grpu8单据
|
// case "onStart":
|
||||||
break;
|
// //流程发起 新增grpu8单据
|
||||||
/** 终止前事件*/
|
// break;
|
||||||
case "onBeforeStop":
|
// /** 终止前事件*/
|
||||||
break;
|
// case "onBeforeStop":
|
||||||
/** 终止事件*/
|
// break;
|
||||||
case "onStop":
|
// /** 终止事件*/
|
||||||
//流程终止,更新grpu8单据
|
// case "onStop":
|
||||||
break;
|
// //流程终止,更新grpu8单据
|
||||||
/** 撤销前事件*/
|
// break;
|
||||||
case "onBeforeCancel":
|
// /** 撤销前事件*/
|
||||||
break;
|
// case "onBeforeCancel":
|
||||||
/** 撤销事件*/
|
// break;
|
||||||
case "onCancel":
|
// /** 撤销事件*/
|
||||||
//流程撤销,更新grpu8单据
|
// case "onCancel":
|
||||||
break;
|
// //流程撤销,更新grpu8单据
|
||||||
/** 结束事件*/
|
// break;
|
||||||
case "onProcessFinished":
|
// /** 结束事件*/
|
||||||
break;
|
// case "onProcessFinished":
|
||||||
/** 处理前事件*/
|
// break;
|
||||||
case "onBeforeFinishWorkitem":
|
// /** 处理前事件*/
|
||||||
/** 根据form处理相关业务表单的数据*/
|
// case "onBeforeFinishWorkitem":
|
||||||
switch (formApp) {
|
// /** 根据form处理相关业务表单的数据*/
|
||||||
case "abc123":
|
// switch (formApp) {
|
||||||
break;
|
// case "abc123":
|
||||||
default:
|
// break;
|
||||||
return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, "");
|
// default:
|
||||||
}
|
// return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, "");
|
||||||
break;
|
// }
|
||||||
/** 处理事件*/
|
// break;
|
||||||
case "onFinishWorkitem":
|
// /** 处理事件*/
|
||||||
break;
|
// case "onFinishWorkitem":
|
||||||
/** 回退前事件*/
|
// break;
|
||||||
case "onBeforeStepBack":
|
// /** 回退前事件*/
|
||||||
break;
|
// case "onBeforeStepBack":
|
||||||
/** 回退事件*/
|
// break;
|
||||||
case "onStepBack":
|
// /** 回退事件*/
|
||||||
break;
|
// case "onStepBack":
|
||||||
/** 取回前事件*/
|
// break;
|
||||||
case "onBeforeTakeBack":
|
// /** 取回前事件*/
|
||||||
break;
|
// case "onBeforeTakeBack":
|
||||||
/** 取回事件*/
|
// break;
|
||||||
case "onTakeBack":
|
// /** 取回事件*/
|
||||||
break;
|
// case "onTakeBack":
|
||||||
default:
|
// break;
|
||||||
// throw new RuntimeException("传入了非法事件类型!请参照:" + eventTypeBuffer.toString());
|
// default:
|
||||||
return BaseResult.getFailureMessageEntity("传入了非法事件类型!请参照:" + eventTypeBuffer.toString(), "", "");
|
//// throw new RuntimeException("传入了非法事件类型!请参照:" + eventTypeBuffer.toString());
|
||||||
}
|
// return BaseResult.getFailureMessageEntity("传入了非法事件类型!请参照:" + eventTypeBuffer.toString(), "", "");
|
||||||
return BaseResult.getSuccessMessageEntity("传递成功", result);
|
// }
|
||||||
}catch (Exception e){
|
// return BaseResult.getSuccessMessageEntity("传递成功", result);
|
||||||
return BaseResult.getFailureMessageEntity("传递失败",e.getMessage());
|
// }catch (Exception e){
|
||||||
}
|
// return BaseResult.getFailureMessageEntity("传递失败",e.getMessage());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,6 +413,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* seeyon流程事件监听前置方法,绑定数据源
|
* seeyon流程事件监听前置方法,绑定数据源
|
||||||
|
*
|
||||||
* @param entity
|
* @param entity
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -480,7 +482,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String colEventPost(String jsonStr, String formAppId, String eventType) throws Exception {
|
public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception {
|
||||||
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) {
|
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) {
|
||||||
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
||||||
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
|
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
|
||||||
|
@ -489,19 +491,92 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||||
if (applist.size() > 1) {
|
if (applist.size() > 1) {
|
||||||
throw new BaseSystemException("根据formID:" + formAppId + "查询出多条数据");
|
throw new BaseSystemException("根据formID:" + formAppId + "查询出多条数据");
|
||||||
}
|
}
|
||||||
SysApplicationApiEntity sysApp = applist.get(0);
|
if (applist.size() == 0 ) {
|
||||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
throw new BaseSystemException("根据formID:" + formAppId + "eventType:"+eventType+"未查询到API配置");
|
||||||
.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;
|
|
||||||
}
|
}
|
||||||
|
SysApplicationApiEntity sysApp = applist.get(0);
|
||||||
|
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;
|
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