|
@@ -129,7 +129,6 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
|
|
public Long saveExamRule(BasicExamRule examRule) {
|
|
public Long saveExamRule(BasicExamRule examRule) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
examRule.setSchoolId(schoolId);
|
|
examRule.setSchoolId(schoolId);
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
|
|
|
|
List<FieldsDto> extendFieldList = JSONObject.parseArray(examRule.getExtendFields(), FieldsDto.class);
|
|
List<FieldsDto> extendFieldList = JSONObject.parseArray(examRule.getExtendFields(), FieldsDto.class);
|
|
if (!CollectionUtils.isEmpty(extendFieldList)) {
|
|
if (!CollectionUtils.isEmpty(extendFieldList)) {
|
|
@@ -137,14 +136,14 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
|
|
Map<String, List<FieldsDto>> byCodeCollect = extendFieldList.stream().collect(Collectors.groupingBy(FieldsDto::getCode));
|
|
Map<String, List<FieldsDto>> byCodeCollect = extendFieldList.stream().collect(Collectors.groupingBy(FieldsDto::getCode));
|
|
for (Map.Entry<String, List<FieldsDto>> entry : byCodeCollect.entrySet()) {
|
|
for (Map.Entry<String, List<FieldsDto>> entry : byCodeCollect.entrySet()) {
|
|
if (entry.getValue().size() > 1) {
|
|
if (entry.getValue().size() > 1) {
|
|
- throw ExceptionResultEnum.ERROR.exception("扩展字段中字段变量名[" + entry.getKey() + "]有" + entry.getValue().size() + "个重复");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("字段变量名[" + entry.getKey() + "]有" + entry.getValue().size() + "个重复");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 校验扩展字段名称是否重复
|
|
// 校验扩展字段名称是否重复
|
|
Map<String, List<FieldsDto>> byNameCollect = extendFieldList.stream().collect(Collectors.groupingBy(FieldsDto::getName));
|
|
Map<String, List<FieldsDto>> byNameCollect = extendFieldList.stream().collect(Collectors.groupingBy(FieldsDto::getName));
|
|
for (Map.Entry<String, List<FieldsDto>> entry : byNameCollect.entrySet()) {
|
|
for (Map.Entry<String, List<FieldsDto>> entry : byNameCollect.entrySet()) {
|
|
if (entry.getValue().size() > 1) {
|
|
if (entry.getValue().size() > 1) {
|
|
- throw ExceptionResultEnum.ERROR.exception("扩展字段中字段名称[" + entry.getKey() + "]有" + entry.getValue().size() + "个重复");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("字段名称[" + entry.getKey() + "]有" + entry.getValue().size() + "个重复");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -153,7 +152,7 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
|
|
for (FieldsDto fieldsDto : extendFieldList) {
|
|
for (FieldsDto fieldsDto : extendFieldList) {
|
|
long count = requiredFieldList.stream().filter(t -> t.getCode().equals(fieldsDto.getCode())).count();
|
|
long count = requiredFieldList.stream().filter(t -> t.getCode().equals(fieldsDto.getCode())).count();
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
- throw ExceptionResultEnum.ERROR.exception("扩展字段中字段变量名[" + fieldsDto.getCode() + "]在必选字段中已存在");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("字段变量名[" + fieldsDto.getCode() + "]在基础字段中已使用");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -161,11 +160,12 @@ public class BasicExamRuleServiceImpl extends ServiceImpl<BasicExamRuleMapper, B
|
|
for (FieldsDto fieldsDto : extendFieldList) {
|
|
for (FieldsDto fieldsDto : extendFieldList) {
|
|
long count = requiredFieldList.stream().filter(t -> t.getName().equals(fieldsDto.getName())).count();
|
|
long count = requiredFieldList.stream().filter(t -> t.getName().equals(fieldsDto.getName())).count();
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
- throw ExceptionResultEnum.ERROR.exception("扩展字段中字段名称[" + fieldsDto.getName() + "]在必选字段中已存在");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("字段名称[" + fieldsDto.getName() + "]在基础字段中已使用");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
// 新增
|
|
// 新增
|
|
if (examRule.getId() == null) {
|
|
if (examRule.getId() == null) {
|
|
examRule.insertInfo(sysUser.getId());
|
|
examRule.insertInfo(sysUser.getId());
|