|
@@ -44,10 +44,11 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteDao, ExamSiteEntity
|
|
private ExamSiteCacheService examSiteCacheService;
|
|
private ExamSiteCacheService examSiteCacheService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<CategoryVO> listExamSite(Long teachingId) {
|
|
|
|
|
|
+ public List<CategoryVO> listExamSite(Long teachingId, Boolean flag) {
|
|
|
|
+ flag = flag != null && flag;
|
|
QueryWrapper<ExamSiteEntity> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<ExamSiteEntity> wrapper = new QueryWrapper<>();
|
|
LambdaQueryWrapper<ExamSiteEntity> lw = wrapper.lambda();
|
|
LambdaQueryWrapper<ExamSiteEntity> lw = wrapper.lambda();
|
|
- lw.eq(ExamSiteEntity::getEnable, Boolean.TRUE);
|
|
|
|
|
|
+ lw.eq(flag, ExamSiteEntity::getEnable, Boolean.TRUE);
|
|
lw.eq(ExamSiteEntity::getCategoryId, teachingId);
|
|
lw.eq(ExamSiteEntity::getCategoryId, teachingId);
|
|
lw.orderByAsc(ExamSiteEntity::getCode);
|
|
lw.orderByAsc(ExamSiteEntity::getCode);
|
|
List<ExamSiteEntity> list = this.baseMapper.selectList(wrapper);
|
|
List<ExamSiteEntity> list = this.baseMapper.selectList(wrapper);
|
|
@@ -152,12 +153,16 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteDao, ExamSiteEntity
|
|
String code = trimAndNullIfBlank(line.get(EXCEL_HEADER[0]));
|
|
String code = trimAndNullIfBlank(line.get(EXCEL_HEADER[0]));
|
|
if (StringUtils.isBlank(code)) {
|
|
if (StringUtils.isBlank(code)) {
|
|
msg.append(" 考点代码不能为空");
|
|
msg.append(" 考点代码不能为空");
|
|
|
|
+ } else if (code.length() > 20) {
|
|
|
|
+ msg.append(" 考点代码不能超过20个字符");
|
|
} else {
|
|
} else {
|
|
site.setCode(code);
|
|
site.setCode(code);
|
|
}
|
|
}
|
|
String name = trimAndNullIfBlank(line.get(EXCEL_HEADER[1]));
|
|
String name = trimAndNullIfBlank(line.get(EXCEL_HEADER[1]));
|
|
if (StringUtils.isBlank(name)) {
|
|
if (StringUtils.isBlank(name)) {
|
|
msg.append(" 考点名称不能为空");
|
|
msg.append(" 考点名称不能为空");
|
|
|
|
+ } else if (name.length() > 100) {
|
|
|
|
+ msg.append(" 考点名称不能超过100个字符");
|
|
} else {
|
|
} else {
|
|
site.setName(name);
|
|
site.setName(name);
|
|
}
|
|
}
|
|
@@ -182,6 +187,8 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteDao, ExamSiteEntity
|
|
String address = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
|
|
String address = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
|
|
if (StringUtils.isBlank(address)) {
|
|
if (StringUtils.isBlank(address)) {
|
|
msg.append(" 考点地址不能为空");
|
|
msg.append(" 考点地址不能为空");
|
|
|
|
+ } else if (address.length() > 200) {
|
|
|
|
+ msg.append(" 考点地址不能超过200个字符");
|
|
} else {
|
|
} else {
|
|
site.setAddress(address);
|
|
site.setAddress(address);
|
|
}
|
|
}
|
|
@@ -258,14 +265,17 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteDao, ExamSiteEntity
|
|
if (req.getTeachingId() == null) {
|
|
if (req.getTeachingId() == null) {
|
|
throw new StatusException("请选择考点所属教学点");
|
|
throw new StatusException("请选择考点所属教学点");
|
|
}
|
|
}
|
|
- if (req.getId() == null) {
|
|
|
|
- LambdaQueryWrapper<ExamSiteEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
- wrapper.eq(ExamSiteEntity::getCategoryId, req.getTeachingId());
|
|
|
|
- wrapper.eq(ExamSiteEntity::getCode, req.getCode());
|
|
|
|
- ExamSiteEntity existSite = baseMapper.selectOne(wrapper);
|
|
|
|
- if (existSite != null) {
|
|
|
|
- throw new StatusException("考点代码:" + req.getCode() + "已经存在");
|
|
|
|
- }
|
|
|
|
|
|
+ checkExamSiteExist(req, req.getId() != null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void checkExamSiteExist(ExamSiteSaveReq req, boolean idFlag) {
|
|
|
|
+ LambdaQueryWrapper<ExamSiteEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(ExamSiteEntity::getCategoryId, req.getTeachingId());
|
|
|
|
+ wrapper.eq(ExamSiteEntity::getCode, req.getCode());
|
|
|
|
+ wrapper.notIn(idFlag, ExamSiteEntity::getId, req.getId());
|
|
|
|
+ ExamSiteEntity existSite = baseMapper.selectOne(wrapper);
|
|
|
|
+ if (existSite != null) {
|
|
|
|
+ throw new StatusException("考点代码:" + req.getCode() + "已经存在");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|