|
@@ -16,7 +16,6 @@ import com.qmth.exam.reserve.bean.category.CategoryCacheBean;
|
|
import com.qmth.exam.reserve.bean.category.CategoryInfo;
|
|
import com.qmth.exam.reserve.bean.category.CategoryInfo;
|
|
import com.qmth.exam.reserve.bean.login.LoginUser;
|
|
import com.qmth.exam.reserve.bean.login.LoginUser;
|
|
import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
|
|
import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
|
|
-import com.qmth.exam.reserve.bean.task.ApplyTaskVO;
|
|
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingReq;
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingReq;
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingSingleVO;
|
|
import com.qmth.exam.reserve.bean.teaching.TeachingSingleVO;
|
|
@@ -26,7 +25,6 @@ import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
|
|
import com.qmth.exam.reserve.dao.CategoryDao;
|
|
import com.qmth.exam.reserve.dao.CategoryDao;
|
|
import com.qmth.exam.reserve.entity.CategoryEntity;
|
|
import com.qmth.exam.reserve.entity.CategoryEntity;
|
|
import com.qmth.exam.reserve.enums.CategoryLevel;
|
|
import com.qmth.exam.reserve.enums.CategoryLevel;
|
|
-import com.qmth.exam.reserve.enums.ImportStatus;
|
|
|
|
import com.qmth.exam.reserve.enums.Role;
|
|
import com.qmth.exam.reserve.enums.Role;
|
|
import com.qmth.exam.reserve.service.CategoryService;
|
|
import com.qmth.exam.reserve.service.CategoryService;
|
|
import com.qmth.exam.reserve.util.PageUtil;
|
|
import com.qmth.exam.reserve.util.PageUtil;
|
|
@@ -242,6 +240,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
throw new StatusException("请选择教学点所在城市");
|
|
throw new StatusException("请选择教学点所在城市");
|
|
}
|
|
}
|
|
checkTeachingExist(orgId, req, req.getId() != null);
|
|
checkTeachingExist(orgId, req, req.getId() != null);
|
|
|
|
+ checkTeachingNameExist(req.getId(), req.getName());
|
|
}
|
|
}
|
|
|
|
|
|
private void checkTeachingExist(Long orgId, TeachingSaveReq req, boolean idFlag) {
|
|
private void checkTeachingExist(Long orgId, TeachingSaveReq req, boolean idFlag) {
|
|
@@ -255,6 +254,16 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void checkTeachingNameExist(Long id, String teachingName) {
|
|
|
|
+ LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(CategoryEntity::getName, teachingName);
|
|
|
|
+ wrapper.notIn(id != null, CategoryEntity::getId, id);
|
|
|
|
+ List<CategoryEntity> categoryEntities = baseMapper.selectList(wrapper);
|
|
|
|
+ if (!categoryEntities.isEmpty()) {
|
|
|
|
+ throw new StatusException(" 教学点名称已经存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<CategoryVO> listCity(LoginUser user) {
|
|
public List<CategoryVO> listCity(LoginUser user) {
|
|
LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -306,7 +315,12 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
} else if (name.length() > 50) {
|
|
} else if (name.length() > 50) {
|
|
msg.append(" 教学点名称不能超过50个字符");
|
|
msg.append(" 教学点名称不能超过50个字符");
|
|
} else {
|
|
} else {
|
|
- category.setName(name);
|
|
|
|
|
|
+ List<CategoryEntity> categoryEntities = listTeachingByName(name);
|
|
|
|
+ if(categoryEntities != null && !categoryEntities.isEmpty()) {
|
|
|
|
+ msg.append(" 教学点名称不能重复");
|
|
|
|
+ } else {
|
|
|
|
+ category.setName(name);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
String cityName = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
|
|
String cityName = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
|
|
Long cityId = null;
|
|
Long cityId = null;
|
|
@@ -349,6 +363,12 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
return failRecords;
|
|
return failRecords;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<CategoryEntity> listTeachingByName(String name) {
|
|
|
|
+ LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(CategoryEntity::getName, name);
|
|
|
|
+ return list(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void updateTeachingCapacity(Long teachingId) {
|
|
public void updateTeachingCapacity(Long teachingId) {
|
|
baseMapper.updateTeachingCapacity(teachingId);
|
|
baseMapper.updateTeachingCapacity(teachingId);
|
|
@@ -381,6 +401,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
baseMapper.insert(category);
|
|
baseMapper.insert(category);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
|
|
private Long getIdByName(String cityName, List<CategoryVO> cityList) {
|
|
private Long getIdByName(String cityName, List<CategoryVO> cityList) {
|
|
for (CategoryVO city : cityList) {
|
|
for (CategoryVO city : cityList) {
|