2026-06-14代码初始提交

This commit is contained in:
2026-06-14 00:17:35 +08:00
parent 650b4657ec
commit 7e845f22dc
4 changed files with 267 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
package com.seeyon.apps.src_edocInspection;
import com.seeyon.apps.common.plugin.api.APluginInfoApi;
import com.seeyon.apps.common.plugin.vo.ConfigVo;
import com.seeyon.apps.ydctu8c.constants.U8cConstants;
public class EdocInspectionPluginApi extends APluginInfoApi {
public EdocInspectionPluginApi() {
}
public String getPluginId() {
System.out.println(U8cConstants.getPluginId());
return U8cConstants.getPluginId();
}
public String getCreateUser() {
return "橙阳科技";
}
public String getDescription() {
return "公文督办管理";
}
public ConfigVo getDefaultConfig() {
ConfigVo configVo = new ConfigVo();
U8cConstants[] var2 = U8cConstants.values();
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
U8cConstants value = var2[var4];
if (value != U8cConstants.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", "资产管理待办推送");
// }
}

View File

@@ -0,0 +1,30 @@
package com.seeyon.apps.src_edocInspection.constants;
public enum EdocInspectionConstants {
plugin("src_edocInspection","插件ID"),
loginName("","流程创建人名称"),
formCode("","流程模板编号")
;
EdocInspectionConstants(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;
}
}

View File

@@ -0,0 +1,126 @@
package com.seeyon.apps.src_edocInspection.event;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.event.ACommonWorkflowEvent;
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
import com.seeyon.apps.ext.workflow.vo.WorkflowEventContext;
import com.seeyon.apps.src_edocInspection.constants.EdocInspectionConstants;
import com.seeyon.apps.src_edocInspection.util.FormExportUtil;
import com.seeyon.cap4.form.bean.FormDataMasterBean;
import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.services.ServiceException;
import com.seeyon.ctp.util.annotation.Inject;
import com.seeyon.v3x.services.form.FormFactory;
import com.seeyon.v3x.services.form.bean.FormExport;
import com.seeyon.v3x.services.form.bean.SubordinateFormExport;
import com.seeyon.v3x.services.form.bean.ValueExport;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class EdocInspectionEvent extends ACommonWorkflowEvent {
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
public ConfigVo getHxinvoiceConfig() {
return cstConfigApi.getConfig(getPluginId());
}
@Override
public String getId() {
return "edocInspectionEvent";
}
@Override
public String getLabel() {
return "公文督办流程创建提交前监听";
}
@Override
public String getPluginId() {
return EdocInspectionConstants.getPluginId();
}
@Override
public String getFormParse() {
return "json";
}
@Override
public WorkFlowType[] getTypes() {
return new WorkFlowType[] { WorkFlowType.onBeforeFinishWorkItem };
}
@Inject
private FormFactory formFactory;
@Override
protected WorkflowEventContext proceed(String request, FormDataVo formDataVo, WorkFlowType workFlowType, FormDataMasterBean formDataMasterBean) {
WorkflowEventContext context = new WorkflowEventContext();
ConfigVo configVo = getHxinvoiceConfig();
FormExportUtil formExportUtil = new FormExportUtil();
// 获取参数信息,解读枚举字段是否为推送流程
JSONObject req = JSONObject.parseObject(request);
String isPust = req.getString("isPust");
if("0".equals(isPust)){
context.setSuccess(true);
context.setErrMsg("不推送公文督办流程,跳过流程。");
return context;
}
// 解读data数据json数据转流程数据
Map<String,Object> map = new HashMap<>();
List<List<Map<String, Object>>> allSubMapsList = new ArrayList<>();
// 解析JSON数据区分主表字段和明细表字段
for (String key : req.keySet()) {
if ("ispust".equals(key)) {
continue;
}
Object value = req.get(key);
if (value instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) value;
List<Map<String, Object>> subMaps = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject item = jsonArray.getJSONObject(i);
Map<String, Object> subMap = new HashMap<>();
for (String subKey : item.keySet()) {
subMap.put(subKey, item.get(subKey));
}
subMaps.add(subMap);
}
allSubMapsList.add(subMaps);
} else {
map.put(key, value);
}
}
// 调用流程推送方法推送流程
FormExport formExport = new FormExport();
List<ValueExport> valueExports = formExportUtil.setFormValue(map);
List<SubordinateFormExport> subordinateFormExports = new ArrayList<>();
for (List<Map<String, Object>> subMaps : allSubMapsList) {
subordinateFormExports.addAll(formExportUtil.setSubordinateFormValue(subMaps));
}
formExport.setValues(valueExports);
formExport.setSubordinateForms(subordinateFormExports);
String loginName = configVo.getParamVal(EdocInspectionConstants.loginName.name());
String formCode = configVo.getParamVal(EdocInspectionConstants.formCode.name());
// 流程推送成功返回成功状态推送公文
try{
formFactory.importBusinessFormData(loginName, formCode,formExport, new String[] {});
context.setSuccess(true);
context.setErrMsg("公文督办流程创建成功");
} catch (ServiceException e) {
context.setSuccess(false);
context.setErrMsg("督办流程创建失败,请检查数据"+e);
throw new RuntimeException(e);
}
return context;
}
}

View File

@@ -0,0 +1,65 @@
package com.seeyon.apps.src_edocInspection.util;
import com.seeyon.v3x.services.form.bean.RecordExport;
import com.seeyon.v3x.services.form.bean.SubordinateFormExport;
import com.seeyon.v3x.services.form.bean.ValueExport;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
//创建无流程表单数据处理工具类
public class FormExportUtil {
/**
* 设置主表信息
* @param map 设置主表字段。Map<主表显示名称,主表数据>
* @return
*/
public List<ValueExport> setFormValue(Map<String, Object> map ){
// 创建返回值对象
List<ValueExport> valueExports = new ArrayList<ValueExport>();
ValueExport valueExport ;
// 获取参数信息(显示名称)
Set<String> keys = map.keySet();
if(keys.size()>0) {
// 对控件赋值
for (String key : keys) {
if(map.get(key) != null ){
valueExport = new ValueExport();
valueExport.setDisplayName(key);
valueExport.setValue(map.get(key).toString());
valueExports.add(valueExport);
}
// System.out.println(key+":"+map.get(key));
}
}
return valueExports;
}
/**
* 设置从表信息
* @param lists 设置主表字段。List<Map<显示名称,数据值>>
*/
public List<SubordinateFormExport> setSubordinateFormValue(List<Map<String, Object>> lists){
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
List<RecordExport> recordExports = new ArrayList<RecordExport>();
List<ValueExport> valueExports;
RecordExport recordExport;
for(int i = 0 ; i < lists.size() ; i++) {
recordExport = new RecordExport();
valueExports = setFormValue(lists.get(i));
recordExport.setRecord(valueExports);
recordExports.add(recordExport);
}
subordinateFormExport.setValues(recordExports);
subordinateFormExports.add(subordinateFormExport);
return subordinateFormExports;
}
}