Просмотр исходного кода

小程序流程重复表验证修改

ouyj 4 дней назад
Родитель
Сommit
056193e93d

+ 27 - 19
src/main/bpm/com/yw/bpm/client/action/BpmClientFlowForm2Action.java

@@ -5,6 +5,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 
 import com.yw.bpm.data.model.Data;
@@ -47,6 +49,7 @@ import net.sf.json.JSONObject;
  */
 public class BpmClientFlowForm2Action extends RequestAbs {
 
+	private static final Logger log = LoggerFactory.getLogger(BpmClientFlowForm2Action.class);
 	public final String serviceId = "bpm_20180525getflowform";
 
 	private ApplicationContext cxt = null;
@@ -263,7 +266,7 @@ public class BpmClientFlowForm2Action extends RequestAbs {
 					formElementList = bpmFormDao.getListOfFormElementByConditionsAddBDDZ(conditions);// 根据条件获取表单元素列表(添加表单动作)
 
 					HashMap<String, Object> repeatingForm = new HashMap<>();
-					repeatingForm.put("elementItem", formElementList);
+
 					List<Map<String, String>> repeatingFormElementList = new ArrayList<>();
 					for (int i = 0; i < formElementList.size(); i++) {
 						FormElement fe = formElementList.get(i);
@@ -280,6 +283,28 @@ public class BpmClientFlowForm2Action extends RequestAbs {
 							String enumstr = "{}";
 							fe.setTypeDetail(enumstr);
 						}
+
+						String l_element_id = fe.getElementId();
+						conditions.put("elementId", l_element_id);
+						String n_can_edit = "1";
+						String n_no_null = "0";
+						if (!StringUtil.isEmptyStr(tmodelId)) {
+							conditions.put("tmodelId", tmodelId);
+							FlowFormElement flowFormElement = bpmFlowModelDao
+									.getFlowFormElementByConditions(conditions);
+							n_no_null = flowFormElement.getNoNull().getValue();
+							int count = bpmFormDao.getCountOfCanEditForElement(conditions);
+							if (count == 0) {
+								n_can_edit = "0";
+							} else {
+								n_can_edit = flowFormElement.getCanEdit().getValue();
+							}
+						} else {
+							n_can_edit = "0";
+						}
+						fe.setCanEdit(n_can_edit);
+						fe.setNoNull(n_no_null);
+
 						String v_table_field = fe.getTableField();
 						StringBuffer sql = new StringBuffer("SELECT l_form_group_id,l_form_group_count,");
 						sql.append(v_table_field + " from oa_form_group_" + fe.getGroupId());
@@ -297,24 +322,6 @@ public class BpmClientFlowForm2Action extends RequestAbs {
 								}
 								String groupuid = (list.get(j).get("l_form_group_id")).toString();
 								String groupCount = (list.get(j).get("l_form_group_count")).toString();
-								String l_element_id = fe.getElementId();
-								conditions.put("elementId", l_element_id);
-								String n_can_edit = "1";
-								String n_no_null = "0";
-								if (!StringUtil.isEmptyStr(tmodelId)) {
-									conditions.put("tmodelId", tmodelId);
-									FlowFormElement flowFormElement = bpmFlowModelDao
-											.getFlowFormElementByConditions(conditions);
-									n_no_null = flowFormElement.getNoNull().getValue();
-									int count = bpmFormDao.getCountOfCanEditForElement(conditions);
-									if (count == 0) {
-										n_can_edit = "0";
-									} else {
-										n_can_edit = flowFormElement.getCanEdit().getValue();
-									}
-								} else {
-									n_can_edit = "0";
-								}
 
 								element.put("defaultValue", defaultValue);
 								element.put("canEdit", n_can_edit);
@@ -339,6 +346,7 @@ public class BpmClientFlowForm2Action extends RequestAbs {
 							}
 						}
 					}
+					repeatingForm.put("elementItem", formElementList);
 					repeatingForm.put("elements", repeatingFormElementList);
 					String repeatingFormStr = JSONObject.fromObject(repeatingForm).toString();
 

+ 27 - 21
src/main/bpm/com/yw/bpm/client/action/BpmClientFlowFormAction.java

@@ -356,7 +356,7 @@ public class BpmClientFlowFormAction extends RequestAbs {
 //					formElementList = bpmFormDao.getListOfFormElementByConditions(conditions);
 					formElementList = bpmFormDao.getListOfFormElementByConditionsAddBDDZ(conditions);
 					HashMap<String, Object> repeatingForm = new HashMap<>();
-					repeatingForm.put("elementItem", formElementList);
+
 					Map<String, List<Map<String, String>>> repeatingTableList = new HashMap<>();
 					for (int i = 0; i < formElementList.size(); i++) {
 						FormElement fe = formElementList.get(i);
@@ -373,6 +373,30 @@ public class BpmClientFlowFormAction extends RequestAbs {
 							String enumstr = "{}";
 							fe.setTypeDetail(enumstr);
 						}
+
+						String l_element_id = fe.getElementId();
+						conditions.put("elementId", l_element_id);
+						String n_can_edit = "1";
+						String n_no_null = "0";
+						String inputPrompt = fe.getInputPrompt();
+						String beCareful = fe.getBeCareful();
+						if (!StringUtil.isEmptyStr(l_tmodel_id)) {
+							conditions.put("tmodelId", l_tmodel_id);
+							FlowFormElement flowFormElement = bpmFlowModelDao
+									.getFlowFormElementByConditions(conditions);
+							n_no_null = flowFormElement.getNoNull().getValue();
+							int count = bpmFormDao.getCountOfCanEditForElement(conditions);
+							if (count == 0) {
+								n_can_edit = "0";
+							} else {
+								n_can_edit = flowFormElement.getCanEdit().getValue();
+							}
+						} else {
+							n_can_edit = "0";
+						}
+						fe.setCanEdit(n_can_edit);
+						fe.setNoNull(n_no_null);
+
 						String v_table_field = fe.getTableField();
 						StringBuffer sql = new StringBuffer("SELECT l_form_group_id,l_form_group_count,");
 						sql.append(v_table_field + " from oa_form_group_" + fe.getGroupId());
@@ -390,26 +414,7 @@ public class BpmClientFlowFormAction extends RequestAbs {
 								}
 								String groupuid = (list.get(j).get("l_form_group_id")).toString();
 								String groupCount = (list.get(j).get("l_form_group_count")).toString();
-								String l_element_id = fe.getElementId();
-								conditions.put("elementId", l_element_id);
-								String n_can_edit = "1";
-								String n_no_null = "0";
-								String inputPrompt = fe.getInputPrompt();
-								String beCareful = fe.getBeCareful();
-								if (!StringUtil.isEmptyStr(l_tmodel_id)) {
-									conditions.put("tmodelId", l_tmodel_id);
-									FlowFormElement flowFormElement = bpmFlowModelDao
-											.getFlowFormElementByConditions(conditions);
-									n_no_null = flowFormElement.getNoNull().getValue();
-									int count = bpmFormDao.getCountOfCanEditForElement(conditions);
-									if (count == 0) {
-										n_can_edit = "0";
-									} else {
-										n_can_edit = flowFormElement.getCanEdit().getValue();
-									}
-								} else {
-									n_can_edit = "0";
-								}
+
 
 								element.put("inputPrompt", inputPrompt);
 								element.put("beCareful", beCareful);
@@ -436,6 +441,7 @@ public class BpmClientFlowFormAction extends RequestAbs {
 							}
 						}
 					}
+					repeatingForm.put("elementItem", formElementList);
 					List<List<Map<String, String>>> repeatingFormElementList = new ArrayList<>(repeatingTableList.values());
 					repeatingForm.put("elements", repeatingFormElementList);
 					String repeatingFormStr = JSONObject.fromObject(repeatingForm).toString();

+ 19 - 0
src/main/bpm/com/yw/bpm/form/model/FormElement.java

@@ -132,6 +132,10 @@ public class FormElement {
 	
 	private List<FormEnumValue> enumValueList = new ArrayList<FormEnumValue>();
 
+	private String canEdit;
+
+	private String noNull;
+
 	/**
 	 * @return the elementId
 	 */
@@ -476,4 +480,19 @@ public class FormElement {
 		this.isShow2 = isShow2;
 	}
 
+	public String getCanEdit() {
+		return canEdit;
+	}
+
+	public void setCanEdit(String canEdit) {
+		this.canEdit = canEdit;
+	}
+
+	public String getNoNull() {
+		return noNull;
+	}
+
+	public void setNoNull(String noNull) {
+		this.noNull = noNull;
+	}
 }