物料同步保存修改从界面获取
This commit is contained in:
parent
05c29ab062
commit
741a69a0b6
|
@ -26,5 +26,9 @@ public interface IZjMaterielSynchronizationEventDao extends IBaseDao<ZjMaterielS
|
|||
Integer updatewlbm(ZjMaterielSynchronizationEventEntity entity);
|
||||
|
||||
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) {
|
||||
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}
|
||||
</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>
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ import com.hzya.frame.web.entity.JsonResultEntity;
|
|||
|
||||
/**
|
||||
* 致远OA接口类
|
||||
*
|
||||
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||
* @version 1.0
|
||||
* @content
|
||||
|
@ -24,7 +25,6 @@ public interface ISeeYonInterFace {
|
|||
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @Content: 提供给OA的标准接口方法,包含参数 entity 为OA 的data信息, , eventType 为事件类型
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
|
@ -59,13 +59,16 @@ public interface ISeeYonInterFace {
|
|||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
*
|
||||
* @param sysExtensionApi
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SysExtensionApiEntity colEventPre(SysExtensionApiEntity sysExtensionApi) throws Exception;
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听
|
||||
*
|
||||
* @param jsonObject
|
||||
* @return
|
||||
* @throws Exception
|
||||
|
@ -74,11 +77,18 @@ public interface ISeeYonInterFace {
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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());
|
||||
}
|
||||
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());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,6 +413,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
|
@ -480,7 +482,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
* @throws Exception
|
||||
*/
|
||||
@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)) {
|
||||
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
||||
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
|
||||
|
@ -489,19 +491,92 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
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;
|
||||
if (applist.size() == 0 ) {
|
||||
throw new BaseSystemException("根据formID:" + formAppId + "eventType:"+eventType+"未查询到API配置");
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@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