文档拆分条款-处理时间,文件,人员选择类型字段
This commit is contained in:
+57
-1
@@ -309,10 +309,66 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
public int insertInfo(Map<String, Object> parameter, String id){
|
||||
StringBuilder fieldsBuilder = new StringBuilder(); // 字段名称
|
||||
StringBuilder valuesBuilder = new StringBuilder(); // 字段值
|
||||
|
||||
// 查询全部字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 文件类型字段
|
||||
List<OnlCgformField> onlFieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldFieldList = onlFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
// 日期类型字段(单日期选择)
|
||||
List<OnlCgformField> onlFieldDateList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlFieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
// 人员选择类型
|
||||
List<OnlCgformField> onlFieldPersonList = fieldList.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlFieldPersonList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
List<String> fieldPersonIdList = new ArrayList<>();
|
||||
fieldPersonList.forEach(item->{
|
||||
String fieldPersonId = item + "_id";
|
||||
fieldPersonIdList.add(fieldPersonId);
|
||||
});
|
||||
for (Map.Entry<String, Object> entry : parameter.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
valuesBuilder.append("," + "'" + value + "'");
|
||||
// 处理日期,文件,人员选择类型的字段
|
||||
//处理日期格式
|
||||
if (fieldDateList.contains(key) && ("creation_time".equals(key) || "modify_time".equals(key))) {
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
value = "str_to_date('" + value + "','%Y-%m-%d')";
|
||||
} else {
|
||||
value = null;
|
||||
}
|
||||
valuesBuilder.append("," + value);
|
||||
} else if (fieldFieldList.contains(key)) {
|
||||
//处理文件类型
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
// value = valueTemp;
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
ossFileService.updateFileInfo(oSSFileList);
|
||||
valuesBuilder.append("," + "'" + valueTemp + "'");
|
||||
} else {
|
||||
valuesBuilder.append("," + "'" + value + "'");
|
||||
}
|
||||
} else if(fieldPersonList.contains(key)){
|
||||
// 人员选择类型
|
||||
value = parameter.get(key+"_id");
|
||||
valuesBuilder.append("," + "'" + value + "'");
|
||||
|
||||
|
||||
} else if(fieldPersonIdList.contains(key)){
|
||||
continue;
|
||||
} else {
|
||||
valuesBuilder.append("," + "'" + value + "'");
|
||||
}
|
||||
|
||||
fieldsBuilder.append("," + key);
|
||||
}
|
||||
String mustFields = "id,creation_user,creation_time,modify_user,modify_time,sys_org_code";
|
||||
|
||||
Reference in New Issue
Block a user