Commit ab0e378b authored by 赵啸非's avatar 赵啸非

添加解析表单参数数据

parent 095a809e
Pipeline #2780 failed with stages
......@@ -4,10 +4,12 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.DataTypeEnum;
import com.mortals.xhx.common.code.FieldTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.WordUtil;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import com.mortals.xhx.module.datum.service.DatumInfoFieldService;
......@@ -104,37 +106,11 @@ public class MatterDatumPrintServiceImpl extends AbstractCRUDServiceImpl<MatterD
super.saveAfter(entity, context);
//拆解数据
if (!ObjectUtils.isEmpty(entity.getFormContent())) {
JSONObject json = JSON.parseObject(entity.getFormContent());
List<DatumInfoFieldEntity> infoFieldlist = new ArrayList<DatumInfoFieldEntity>();
for (String key : json.keySet()) {
DatumInfoFieldEntity infoField = new DatumInfoFieldEntity();
infoField.setDatumPrintId(entity.getId());
infoField.setIdCard(entity.getIdCard());
//通过key类型判断属性类型
boolean input = StrUtil.startWith(key, "i_");
List<String> split = StrUtil.split(key, "_");
if (input) {
if(split.size()>2){
String value = json.getString(key);
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.单行输入框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
infoFieldlist.add(infoField);
}
Rest<List<DatumInfoFieldEntity>> rest = datumInfoFieldService.parseFormContent(entity, context);
if (rest.getCode() == YesNoEnum.YES.getValue() && !ObjectUtils.isEmpty(rest.getData())) {
datumInfoFieldService.save(rest.getData());
}
}
}
......
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