稻花香仓库初始化
This commit is contained in:
46
src/com/seeyon/apps/src_dhxorganization/DhxPluginApi.java
Normal file
46
src/com/seeyon/apps/src_dhxorganization/DhxPluginApi.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.seeyon.apps.src_dhxorganization;
|
||||
|
||||
import com.seeyon.apps.common.plugin.api.APluginInfoApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_dhxorganization.constants.DhxConstants;
|
||||
|
||||
|
||||
public class DhxPluginApi extends APluginInfoApi {
|
||||
public DhxPluginApi() {
|
||||
}
|
||||
|
||||
public String getPluginId() {
|
||||
System.out.println(DhxConstants.getPluginId());
|
||||
return DhxConstants.getPluginId();
|
||||
}
|
||||
|
||||
public String getCreateUser() {
|
||||
return "橙阳科技";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "U8C集成管理";
|
||||
}
|
||||
|
||||
public ConfigVo getDefaultConfig() {
|
||||
ConfigVo configVo = new ConfigVo();
|
||||
DhxConstants[] var2 = DhxConstants.values();
|
||||
int var3 = var2.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
DhxConstants value = var2[var4];
|
||||
if (value != DhxConstants.plugin) {
|
||||
configVo.getDevParams().put(value.name(), value.getDefaultValue());
|
||||
configVo.getProdParams().put(value.name(), value.getDefaultValue());
|
||||
configVo.getParamMap().put(value.name(), value.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
return configVo;
|
||||
}
|
||||
|
||||
// public void registerCustomEvent(Map eventAndNodes) {
|
||||
// eventAndNodes.put("propertyDispose", "资产管理待办推送");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.seeyon.apps.src_dhxorganization.archive;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.common.workflow.constants.WorkFlowType;
|
||||
import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.apps.src_dhxorganization.util.Cap4ReturnUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.util.DhxHttpUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.util.ParamUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.constants.DhxConstants;
|
||||
import com.seeyon.apps.src_dhxorganization.vo.DhxResponse;
|
||||
import com.seeyon.cap4.form.api.FormDataApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
public abstract class ArchiveCommonNode extends ACommonSuperNode {
|
||||
|
||||
private static Log log = Log.get(ArchiveCommonNode.class);
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return DhxConstants.getPluginId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormParse() {
|
||||
return "json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkFlowType[] getTypes() {
|
||||
return new WorkFlowType[] {WorkFlowType.superNode};
|
||||
}
|
||||
|
||||
public ConfigVo getU8cConfig() {
|
||||
return cstConfigApi.getConfig(getPluginId());
|
||||
}
|
||||
|
||||
protected FormDataApi4Cap4 formDataApi4Cap4;
|
||||
|
||||
public void setFormDataApi4Cap4(FormDataApi4Cap4 formDataApi4Cap4) {
|
||||
this.formDataApi4Cap4 = formDataApi4Cap4;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception {
|
||||
SuperNodeContext context = new SuperNodeContext();
|
||||
System.out.println("开始处理单据"+getNodeId());
|
||||
ParamUtil paramUtil = new ParamUtil();
|
||||
String param = paramUtil.param(request,getMethod(),formDataVo);
|
||||
Cap4ReturnUtil cap4ReturnUtil = new Cap4ReturnUtil();
|
||||
try {
|
||||
FieldDataVo fhjg = formDataVo.getFieldData("U8C-返回结果");
|
||||
String value = fhjg.getStringValue();
|
||||
if(value.startsWith("推送U8C成功")) {
|
||||
return context.success("跳过:" + value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.setException(true);
|
||||
context.back("处理异常:OA跳过处理异常:" + e.getMessage());
|
||||
formDataVo.getNewFieldDataMap().put("U8C-返回结果", "处理异常:OA跳过处理异常:" + e.getMessage());
|
||||
}
|
||||
ConfigVo configVo = getU8cConfig();
|
||||
context.setNeedSave(true);
|
||||
String url = configVo.getParamVal(DhxConstants.test.name());
|
||||
url += getMethod();
|
||||
context.setRequest(param);
|
||||
context.setUrl(url);
|
||||
try {
|
||||
String u8cSystem = configVo.getParamVal(DhxConstants.test.name());
|
||||
log.info(param);
|
||||
String response = DhxHttpUtil.doPost(url, param);
|
||||
System.out.println(response);
|
||||
context.setResponse(response);
|
||||
DhxResponse u8cResponse = DhxHttpUtil.parseResponse(response);
|
||||
if(u8cResponse.isSuccess()) {
|
||||
cap4ReturnUtil.setParamReturn(getMethod(),u8cResponse,formDataVo,getNodeId());
|
||||
System.out.println("参数处理完成"+u8cResponse);
|
||||
log.info(u8cResponse.getData());
|
||||
System.out.println("推送成功显示"+u8cResponse.getStatus());
|
||||
context.success("推送U8C成功:" + u8cResponse.getStatus(), false);
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送成功:" + u8cResponse.getStatus());
|
||||
|
||||
} else {
|
||||
context.setErrMsg(u8cResponse.getMsg());
|
||||
context.back("推送U8C失败:" + u8cResponse.getMsg());
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:" + u8cResponse.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.setException(true);
|
||||
context.back("推送U8C失败:OA处理异常:" + e.getMessage());
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:OA处理异常" + e.getMessage());
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
public abstract String getMethod();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.seeyon.apps.src_dhxorganization.archive.node;
|
||||
|
||||
import com.seeyon.apps.src_dhxorganization.archive.ArchiveCommonNode;
|
||||
|
||||
public class UpdateHireFilesNode extends ArchiveCommonNode {
|
||||
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return "/seeyon/rest/cap4/form/soap/batch-update";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return "UpdateHireFilesNode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return "员工录用审批保存人才库信息";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.seeyon.apps.src_dhxorganization.constants;
|
||||
|
||||
public enum DhxConstants {
|
||||
|
||||
|
||||
plugin("ydctu8c","插件ID"),
|
||||
test("test","test");
|
||||
|
||||
DhxConstants(String defaultValue, String description) {
|
||||
this.defaultValue = defaultValue;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
private String defaultValue;
|
||||
private String description;
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static String getPluginId() {
|
||||
return plugin.defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.seeyon.apps.src_dhxorganization.member;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.common.workflow.constants.WorkFlowType;
|
||||
import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.apps.src_dhxorganization.util.Cap4ReturnUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.util.DhxHttpUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.util.ParamUtil;
|
||||
import com.seeyon.apps.src_dhxorganization.constants.DhxConstants;
|
||||
import com.seeyon.apps.src_dhxorganization.vo.DhxResponse;
|
||||
import com.seeyon.cap4.form.api.FormDataApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
public abstract class MemberCommonNode extends ACommonSuperNode {
|
||||
|
||||
|
||||
private static Log log = Log.get(MemberCommonNode.class);
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return DhxConstants.getPluginId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormParse() {
|
||||
return "json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkFlowType[] getTypes() {
|
||||
return new WorkFlowType[] {WorkFlowType.superNode};
|
||||
}
|
||||
|
||||
public ConfigVo getU8cConfig() {
|
||||
return cstConfigApi.getConfig(getPluginId());
|
||||
}
|
||||
|
||||
protected FormDataApi4Cap4 formDataApi4Cap4;
|
||||
|
||||
public void setFormDataApi4Cap4(FormDataApi4Cap4 formDataApi4Cap4) {
|
||||
this.formDataApi4Cap4 = formDataApi4Cap4;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception {
|
||||
SuperNodeContext context = new SuperNodeContext();
|
||||
System.out.println("开始处理单据"+getNodeId());
|
||||
ParamUtil paramUtil = new ParamUtil();
|
||||
String param = paramUtil.param(request,getMethod(),formDataVo);
|
||||
Cap4ReturnUtil cap4ReturnUtil = new Cap4ReturnUtil();
|
||||
try {
|
||||
FieldDataVo fhjg = formDataVo.getFieldData("U8C-返回结果");
|
||||
String value = fhjg.getStringValue();
|
||||
if(value.startsWith("推送U8C成功")) {
|
||||
return context.success("跳过:" + value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.setException(true);
|
||||
context.back("处理异常:OA跳过处理异常:" + e.getMessage());
|
||||
formDataVo.getNewFieldDataMap().put("U8C-返回结果", "处理异常:OA跳过处理异常:" + e.getMessage());
|
||||
}
|
||||
ConfigVo configVo = getU8cConfig();
|
||||
context.setNeedSave(true);
|
||||
String url = configVo.getParamVal(DhxConstants.test.name());
|
||||
url += getMethod();
|
||||
context.setRequest(param);
|
||||
context.setUrl(url);
|
||||
try {
|
||||
String u8cSystem = configVo.getParamVal(DhxConstants.test.name());
|
||||
log.info(param);
|
||||
String response = DhxHttpUtil.doPost(url, param);
|
||||
System.out.println(response);
|
||||
context.setResponse(response);
|
||||
DhxResponse u8cResponse = DhxHttpUtil.parseResponse(response);
|
||||
if(u8cResponse.isSuccess()) {
|
||||
cap4ReturnUtil.setParamReturn(getMethod(),u8cResponse,formDataVo,getNodeId());
|
||||
System.out.println("参数处理完成"+u8cResponse);
|
||||
log.info(u8cResponse.getData());
|
||||
System.out.println("推送成功显示"+u8cResponse.getStatus());
|
||||
context.success("推送U8C成功:" + u8cResponse.getStatus(), false);
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送成功:" + u8cResponse.getStatus());
|
||||
|
||||
} else {
|
||||
context.setErrMsg(u8cResponse.getMsg());
|
||||
context.back("推送U8C失败:" + u8cResponse.getMsg());
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:" + u8cResponse.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.setException(true);
|
||||
context.back("推送U8C失败:OA处理异常:" + e.getMessage());
|
||||
formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:OA处理异常" + e.getMessage());
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
public abstract String getMethod();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.seeyon.apps.src_dhxorganization.util;
|
||||
|
||||
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.src_dhxorganization.vo.DhxResponse;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
|
||||
|
||||
public class Cap4ReturnUtil {
|
||||
|
||||
public void setParamReturn(String method, DhxResponse dhxResponse, FormDataVo formDataVo, String nodeId) throws BusinessException, NoSuchFieldException {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.seeyon.apps.src_dhxorganization.util;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_dhxorganization.vo.DhxResponse;
|
||||
import com.seeyon.ctp.util.json.JSONUtil;
|
||||
|
||||
/**
|
||||
* 功能描述:<br>
|
||||
* <pre>
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @Author: HuangZhengguo
|
||||
* @Date: 2024/4/28
|
||||
*/
|
||||
public class DhxHttpUtil {
|
||||
|
||||
private DhxHttpUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static String doPost(String url, String body) throws Exception {
|
||||
|
||||
return HttpRequest.post(url).header("accept", "*/*")
|
||||
.header("connection", "")
|
||||
.body(body).execute().body();
|
||||
}
|
||||
|
||||
public static DhxResponse parseResponse(String response) throws Exception {
|
||||
try {
|
||||
JSONObject object = JSONUtil.parseJSONString(response, JSONObject.class);
|
||||
return new DhxResponse(object);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("Status", "0");
|
||||
jsonObject.put("Msg", "解析json异常");
|
||||
jsonObject.put("Data", response);
|
||||
return new DhxResponse(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String url = "";
|
||||
}
|
||||
|
||||
}
|
||||
10
src/com/seeyon/apps/src_dhxorganization/util/ParamUtil.java
Normal file
10
src/com/seeyon/apps/src_dhxorganization/util/ParamUtil.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.seeyon.apps.src_dhxorganization.util;
|
||||
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
|
||||
public class ParamUtil {
|
||||
|
||||
public String param(String request, String method , FormDataVo formDataVo){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
76
src/com/seeyon/apps/src_dhxorganization/vo/DhxResponse.java
Normal file
76
src/com/seeyon/apps/src_dhxorganization/vo/DhxResponse.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.seeyon.apps.src_dhxorganization.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 功能描述:<br>
|
||||
* <pre>
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @Author: HuangZhengguo
|
||||
* @Date: 2024/4/28
|
||||
*/
|
||||
public class DhxResponse {
|
||||
|
||||
private boolean success;
|
||||
private int status;
|
||||
private String msg;
|
||||
private String data;
|
||||
|
||||
|
||||
public DhxResponse(JSONObject object) {
|
||||
if(object.containsKey("Status")) {
|
||||
this.status = object.getInteger("Status");
|
||||
} else {
|
||||
this.status = object.getString("status").equals("success")?1:2;
|
||||
}
|
||||
this.success = (1 == status);
|
||||
if(object.containsKey("Msg")) {
|
||||
this.msg = object.getString("Msg");
|
||||
} else {
|
||||
this.msg = object.getString("errormsg");
|
||||
}
|
||||
if(object.containsKey("Data")) {
|
||||
this.data = object.getString("Data");
|
||||
} else {
|
||||
this.data = object.getString("data");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public DhxResponse setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public DhxResponse setStatus(int status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public DhxResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public DhxResponse setData(String data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user