Commit 7fc025f8 authored by 赵啸非's avatar 赵啸非

添加解析表单参数数据

parent 96230503
Pipeline #2789 failed with stages
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.datum.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.OrderCol;
......@@ -120,23 +121,44 @@ public class DatumInfoFieldServiceImpl extends AbstractCRUDServiceImpl<DatumInfo
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.表格.getDesc());
infoField.setFieldValue(value);
//重新构建值
infoField.setFieldValue(buildTableStr(value));
infoField.setDataType(DataTypeEnum.数组.getDesc());
}
if(ObjectUtils.isEmpty(infoField.getFieldCode())){
log.info("未识别类型,key:{},json:",key,matterDatumPrintEntity.getFormContent());
if (ObjectUtils.isEmpty(infoField.getFieldCode())) {
log.info("未识别类型,key:{},json:", key, matterDatumPrintEntity.getFormContent());
continue;
}
infoFieldlist.add(infoField);
}
}catch (Exception e){
log.error("解析json错误,json=====>{}",matterDatumPrintEntity.getFormContent());
} catch (Exception e) {
log.error("解析json错误,json=====>{}", matterDatumPrintEntity.getFormContent());
}
return Rest.ok("解析保存成功!", infoFieldlist);
}
private String buildTableStr(String value) {
JSONArray jsonArray = new JSONArray();
JSONArray array = JSON.parseArray(value);
for (int i = 0; i < array.size(); i++) {
JSONObject jsonObject = array.getJSONObject(i);
JSONObject json = new JSONObject();
jsonObject.entrySet().stream().forEach(item->{
String key = item.getKey();
String targetKey = StrUtil.subAfter(key, "_", true);
json.put(targetKey,item.getValue());
});
jsonArray.add(json);
}
return jsonArray.toJSONString();
}
@Override
public Rest<List<DatumInfoFieldEntity>> distinctList(DatumInfoFieldQuery datumInfoFieldQuery, Context context) {
datumInfoFieldQuery.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
......@@ -150,7 +172,7 @@ public class DatumInfoFieldServiceImpl extends AbstractCRUDServiceImpl<DatumInfo
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
return Rest.ok("获取列表成功!",distiinctList);
return Rest.ok("获取列表成功!", distiinctList);
}
......@@ -184,6 +206,12 @@ public class DatumInfoFieldServiceImpl extends AbstractCRUDServiceImpl<DatumInfo
String string = jsonObject.getString("ck_13_参保险种_<职工基本医疗保险-生育保险-补充医疗保险->其他(___________)");
String str2="本人简历_i_3_职务";
System.out.println(StrUtil.subAfter(str2, "_", true));
System.out.println(string);
}
......
......@@ -67,7 +67,8 @@ POST {{baseUrl}}/datum/info/field/distinctList
Content-Type: application/json
{
"datum_print_id": 8,
"datumPrintId": 8,
"idCard":"",
"size": -1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment