diff --git a/main/java/shkd/repc/resm/formplugin/SetObjectFormPlugin.java b/main/java/shkd/repc/resm/formplugin/SetObjectFormPlugin.java index 08f32d3..1e24064 100644 --- a/main/java/shkd/repc/resm/formplugin/SetObjectFormPlugin.java +++ b/main/java/shkd/repc/resm/formplugin/SetObjectFormPlugin.java @@ -6,6 +6,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.Submit; import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.events.ClientCallBackEvent; import kd.bos.form.operate.FormOperate; import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.logging.Log; @@ -47,7 +48,8 @@ public class SetObjectFormPlugin extends AbstractFormPlugin implements Plugin { if (dataModel == null) return; Object value = this.getModel().getValue("id"); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(value, entityId); - DynamicObjectCollection entry = dynamicObject.getDynamicObjectCollection("entry_evaldetail"); + //表单插件直接处理视图数据-entry可能未保存 + DynamicObjectCollection entry=this.getModel().getEntryEntity("entry_evaldetail"); if (entry == null || entry.isEmpty()) return; String entryEvalUat = entry.get(0).getString("entryevaluatorstr"); if ("".equals(entryEvalUat)) { @@ -57,7 +59,10 @@ public class SetObjectFormPlugin extends AbstractFormPlugin implements Plugin { DynamicObject plane = BusinessDataServiceHelper.loadSingle("resm_investigationplan", qFilter.toArray()); if (plane == null) return; DynamicObject project = plane.getDynamicObject("qeug_project"); - if (project == null) return; + if (project == null) { + this.getView().showTipNotification("上游源单未填写项目"); + return; + } // 获取项目-所属组织 QFilter qFilter1 = new QFilter("id", QCP.equals, project.get("id")); DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle("repmd_projectbill", qFilter1.toArray()); diff --git a/main/java/shkd/repc/resm/formplugin/SetObjectListPlugin.java b/main/java/shkd/repc/resm/formplugin/SetObjectListPlugin.java index 7894f67..d02e976 100644 --- a/main/java/shkd/repc/resm/formplugin/SetObjectListPlugin.java +++ b/main/java/shkd/repc/resm/formplugin/SetObjectListPlugin.java @@ -12,6 +12,7 @@ import kd.bos.logging.LogFactory; import kd.bos.mvc.list.ListView; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; +import kd.bos.orm.util.CollectionUtils; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper; @@ -61,7 +62,10 @@ public class SetObjectListPlugin extends AbstractListPlugin implements Plugin { if (null != dynamicObject) { //考察任务分录 DynamicObjectCollection entry = dynamicObject.getDynamicObjectCollection("entry_evaldetail"); - if (entry == null || entry.isEmpty()) return; + if (entry == null || entry.isEmpty()){ + this.getView().showTipNotification("请先保存单据再提交"); + return; + } String entryEvalUat = entry.get(0).getString("entryevaluatorstr"); if ("".equals(entryEvalUat)) { Long orgId; @@ -70,7 +74,10 @@ public class SetObjectListPlugin extends AbstractListPlugin implements Plugin { DynamicObject plane = BusinessDataServiceHelper.loadSingle("resm_investigationplan", qFilter.toArray()); if (plane == null) return; DynamicObject project = plane.getDynamicObject("qeug_project"); - if (project == null) return; + if (project == null){ + this.getView().showTipNotification("上游源单未填写项目"); + return; + } // 获取项目-所属组织 QFilter qFilter1 = new QFilter("id", QCP.equals, project.get("id")); DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle("repmd_projectbill", qFilter1.toArray()); @@ -108,8 +115,10 @@ public class SetObjectListPlugin extends AbstractListPlugin implements Plugin { * @param dataModelEntry 取数模板 */ private void findParentOrgMatch(DynamicObjectCollection entry, Long orgId, DynamicObjectCollection dataModelEntry, String logotype) { - if (orgId == null) return; - + if (orgId == null){ + logger.warn("orgId为空"); + return; + } //取上级组织. List dptIds = new ArrayList<>(); dptIds.add(orgId); @@ -141,6 +150,11 @@ public class SetObjectListPlugin extends AbstractListPlugin implements Plugin { * @param logotype 考察人||评估人权重设置分录 */ private void creatExamData(List matchingRoles, DynamicObjectCollection entry, String logotype) { + if (matchingRoles == null || matchingRoles.isEmpty()) { + this.getView().showTipNotification("未匹配到任何考察人!"); + logger.warn("考察人列表为空"); + return; + } // 所有考察人(含重复) int totalCount = matchingRoles.size(); // 统计每个用户出现的次数