数据解析 校验表单填写字段一致性
This commit is contained in:
parent
8fb7de056e
commit
fd505e8a9d
|
|
@ -410,6 +410,7 @@ public class OfflineZipUnpackServiceImpl extends Service implements UnpackZipSer
|
|||
rs.executeQuery("select * from " + tableNameByRequestId + " where requestId = ?", requestId);
|
||||
|
||||
IgnoreCaseHashMap<String, Object> flowDataMap = ModeUtil.getSingleRecordMap(rs);
|
||||
baseBean.writeLog("flowDataMap==="+JSON.toJSONString(flowDataMap));
|
||||
|
||||
// 根据根结点,获取配置
|
||||
String rootPath = dataConfig.getRootPath();
|
||||
|
|
@ -785,22 +786,49 @@ public class OfflineZipUnpackServiceImpl extends Service implements UnpackZipSer
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean processFieldForCheck(JsonNode jsonNode, DataConfigDetail fieldDetail, Map<String, Formfield> fieldMap,String flowData) throws Exception {
|
||||
private boolean processFieldForCheck(JsonNode jsonNode, DataConfigDetail fieldDetail, Map<String, Formfield> fieldMap, String flowData) throws Exception {
|
||||
String fieldName = fieldDetail.getFieldName();
|
||||
JsonNode atNode = jsonNode.at(fieldDetail.getPath());
|
||||
baseBean.writeLog("fieldName==" + fieldName);
|
||||
|
||||
if (atNode != null) {
|
||||
String value = atNode.asText();
|
||||
if (StringUtils.isNotBlank(fieldDetail.getCondition()) && !value.equals(fieldDetail.getCondition())) {
|
||||
baseBean.writeLog("Condition==" + fieldDetail.getCondition());
|
||||
baseBean.writeLog("Condition value==" + value);
|
||||
return false;
|
||||
}
|
||||
|
||||
Formfield formfield = fieldMap.get(fieldName.toLowerCase());
|
||||
if (formfield == null) {
|
||||
baseBean.writeLog("formfield is null");
|
||||
return false;
|
||||
}
|
||||
String parseValue = Util.null2String(getFieldValue(fieldDetail, value, formfield));
|
||||
baseBean.writeLog("parseValue==" + parseValue);
|
||||
baseBean.writeLog("flowData==" + flowData);
|
||||
// 根据不同的字段类型,处理比较方式
|
||||
String fieldHtmlType = formfield.getFieldhtmltype();
|
||||
baseBean.writeLog("fieldHtmlType==" + fieldHtmlType);
|
||||
|
||||
return flowData.equals(Util.null2String(getFieldValue(fieldDetail, value, formfield)));
|
||||
// 下拉框、选择框、浏览按钮,比较时排序处理
|
||||
if ("3".equals(fieldHtmlType) || "5".equals(fieldHtmlType)) {
|
||||
// 分割字符串为数组
|
||||
String[] aArray = parseValue.split(",");
|
||||
String[] bArray = flowData.split(",");
|
||||
// 如果长度不同,直接返回false
|
||||
if (aArray.length != bArray.length) {
|
||||
return false;
|
||||
}
|
||||
// 排序数组
|
||||
Arrays.sort(aArray);
|
||||
Arrays.sort(bArray);
|
||||
|
||||
// 比较排序后的数组内容
|
||||
return Arrays.equals(aArray, bArray);
|
||||
}
|
||||
|
||||
return flowData.equals(parseValue);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,10 @@ public class FieldConvertUtil {
|
|||
}
|
||||
String[] split = value.split(separator);
|
||||
for (String s : split) {
|
||||
selectValues.add(ModeUtil.getSelectValue(formfield, s));
|
||||
String selectValue = ModeUtil.getSelectValue(formfield, s);
|
||||
if (StringUtils.isNotBlank(selectValue)) {
|
||||
selectValues.add(selectValue);
|
||||
}
|
||||
}
|
||||
object = StringUtils.join(selectValues, ",");
|
||||
if (StringUtils.isBlank(Util.null2String(object))) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue