parent
66ad9e41d2
commit
4612125c75
|
@ -1,6 +1,7 @@
|
|||
package com.hzya.frame.seeyon.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
|
@ -55,4 +56,29 @@ public interface ISeeYonInterFace {
|
|||
* @throws Exception
|
||||
*/
|
||||
JsonResultEntity thirdInterfaceSeeYonDefinitionRePush(JSONObject jsonObject) throws Exception;
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
* @param sysExtensionApi
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi)throws Exception;
|
||||
/**
|
||||
* seeyon流程事件监听
|
||||
* @param jsonObject
|
||||
* @return
|
||||
* @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;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity;
|
|||
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||
import com.hzya.frame.sysnew.application.api.service.ISysApplicationApiService;
|
||||
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.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
|
@ -47,7 +51,8 @@ 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;
|
||||
/**
|
||||
|
@ -221,82 +226,76 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
/** 表单表的FORM ID,用此字段标记是哪个流程*/
|
||||
String formApp = entity.getFormApp();
|
||||
|
||||
|
||||
//formApp 最好过滤一下
|
||||
|
||||
|
||||
String result = null;
|
||||
/** 根据事件类型处理相关事件*/
|
||||
switch (eventType) {
|
||||
/** 发起前事件*/
|
||||
case "onBeforeStart":
|
||||
break;
|
||||
/** 发起事件*/
|
||||
case "onStart":
|
||||
break;
|
||||
/** 终止前事件*/
|
||||
case "onBeforeStop":
|
||||
break;
|
||||
/** 终止事件*/
|
||||
case "onStop":
|
||||
break;
|
||||
/** 撤销前事件*/
|
||||
case "onBeforeCancel":
|
||||
break;
|
||||
/** 撤销事件*/
|
||||
case "onCancel":
|
||||
break;
|
||||
/** 结束事件*/
|
||||
case "onProcessFinished":
|
||||
if (StrUtil.isNotEmpty(formApp)){
|
||||
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
||||
sysApplicationApiEntity.setHeaderIn(formApp);
|
||||
List<SysApplicationApiEntity> applist = sysApplicationApiService.queryByLike(sysApplicationApiEntity);
|
||||
if (CollectionUtil.isNotEmpty(applist)){
|
||||
if (applist.size() > 1){
|
||||
return BaseResult.getFailureMessageEntity("根据formID:" + formApp+"查询出多条数据", "");
|
||||
}
|
||||
SysApplicationApiEntity sysApp = applist.get(0);
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", String.valueOf(sysApp.getApiCode()))
|
||||
.put("publicKey","ZJYAlF4yjkjZaXmjLOUqsoGzTHAlWpoTdqT7/AEYaXIwpXNCe7eDIk+3zDUT+v578prj")
|
||||
.put("secretKey","RJTPEoOSDdaBeoxoMs465tcTqy38bRag+12S7kIv2Lxd38wgLeVfWVl/ipVKVu8Qj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")
|
||||
.put("appId","800018")
|
||||
.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);
|
||||
}
|
||||
}
|
||||
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(), "", "");
|
||||
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());
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("传递成功", result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -331,7 +330,6 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
SeeYonInterFaceEntity seeYonInterFaceEntity = new SeeYonInterFaceEntity();
|
||||
BeanUtil.copyProperties(requestData,seeYonInterFaceEntity);
|
||||
List<SeeYonInterFaceEntity> seeYonInterFaceEntityList = seeYonInterFaceDao.queryDefinitionInfo(seeYonInterFaceEntity);
|
||||
System.out.println(seeYonInterFaceEntityList);
|
||||
if(null != seeYonInterFaceEntityList && seeYonInterFaceEntityList.size() >0){
|
||||
for(SeeYonInterFaceEntity interFaceEntity : seeYonInterFaceEntityList){
|
||||
String field_info = interFaceEntity.getField_info();
|
||||
|
@ -417,4 +415,98 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
}
|
||||
return BaseResult.getSuccessMessageEntity("从新推送执行结束",resultEntityArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity colEventPre(SysExtensionApiEntity entity) throws Exception {
|
||||
try {
|
||||
SysApplicationEntity applicationEntity = entity.getSendApp();
|
||||
SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity();
|
||||
sysApplicationDatabaseEntity.setSts("Y");
|
||||
sysApplicationDatabaseEntity.setDbStatus("1");
|
||||
sysApplicationDatabaseEntity.setAppId(applicationEntity.getId());
|
||||
sysApplicationDatabaseEntity.setDataSourceCode("master");
|
||||
List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity);
|
||||
if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){
|
||||
String parm = entity.getBodys();
|
||||
JSONObject jsonObject = JSONObject.parseObject(parm);
|
||||
jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode());
|
||||
entity.setBodys(jsonObject.toJSONString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public JsonResultEntity colEventListener(JSONObject jsonObject) throws Exception {
|
||||
try {
|
||||
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("dataSourceCode",entity.getDataSourceCode());
|
||||
requestData.put("formMainIds",entity.getFormMainIds());
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("jsonStr",requestData);
|
||||
thirdInterfaceSeeYonDefinitionRePush(jsonStr);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("流程事件通知接口出错:{}",e);
|
||||
return BaseResult.getSuccessMessageEntity("失败",e.getMessage());
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听后置方法,调用三方接口
|
||||
*
|
||||
* @param jsonStr
|
||||
* @param formAppId
|
||||
* @param eventType
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String 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);
|
||||
List<SysApplicationApiEntity> applist = sysApplicationApiService.queryLike(sysApplicationApiEntity);
|
||||
if (CollectionUtil.isNotEmpty(applist)){
|
||||
if (applist.size() > 1){
|
||||
throw new BaseSystemException("根据formID:" + formAppId+"查询出多条数据");
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue