|
@@ -34,6 +34,9 @@ public class SysHelpServiceImpl implements SysHelpService {
|
|
|
if (StrUtil.isEmpty(helpQuestionClassification.getName())) {
|
|
if (StrUtil.isEmpty(helpQuestionClassification.getName())) {
|
|
|
throw BusinessRuntimeException.getInstance("分类名称不能为空");
|
|
throw BusinessRuntimeException.getInstance("分类名称不能为空");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (helpQuestionClassification.getSort() == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("排序不能为空");
|
|
|
|
|
+ }
|
|
|
if (helpQuestionClassification.getGoodsId() != null) {
|
|
if (helpQuestionClassification.getGoodsId() != null) {
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(helpQuestionClassification.getGoodsId());
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(helpQuestionClassification.getGoodsId());
|
|
|
if (goodsDon == null || !goodsDon.getDeleted()) {
|
|
if (goodsDon == null || !goodsDon.getDeleted()) {
|
|
@@ -54,6 +57,13 @@ public class SysHelpServiceImpl implements SysHelpService {
|
|
|
if (helpQuestionClassification.getGoodsId() == null && StrUtil.isEmpty(helpQuestionClassification.getLogo())) {
|
|
if (helpQuestionClassification.getGoodsId() == null && StrUtil.isEmpty(helpQuestionClassification.getLogo())) {
|
|
|
throw BusinessRuntimeException.getInstance("未关联平台,请上传对应问题分类logo");
|
|
throw BusinessRuntimeException.getInstance("未关联平台,请上传对应问题分类logo");
|
|
|
}
|
|
}
|
|
|
|
|
+ HelpQuestionClassification classification = classificationMapper.selectOne(Wrappers.lambdaQuery(HelpQuestionClassification.class)
|
|
|
|
|
+ .eq(HelpQuestionClassification::getDeleted, true)
|
|
|
|
|
+ .eq(HelpQuestionClassification::getSort, helpQuestionClassification.getSort())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (classification != null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("排序相同");
|
|
|
|
|
+ }
|
|
|
classificationMapper.insert(helpQuestionClassification);
|
|
classificationMapper.insert(helpQuestionClassification);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -66,18 +76,36 @@ public class SysHelpServiceImpl implements SysHelpService {
|
|
|
if (exits == null || !exits.getDeleted()) {
|
|
if (exits == null || !exits.getDeleted()) {
|
|
|
throw BusinessRuntimeException.getInstance("分类已被删除");
|
|
throw BusinessRuntimeException.getInstance("分类已被删除");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (helpQuestionClassification.getSort() != null) {
|
|
|
|
|
+ HelpQuestionClassification classification = classificationMapper.selectOne(Wrappers.lambdaQuery(HelpQuestionClassification.class)
|
|
|
|
|
+ .eq(HelpQuestionClassification::getDeleted, true)
|
|
|
|
|
+ .eq(HelpQuestionClassification::getSort, helpQuestionClassification.getSort())
|
|
|
|
|
+ .ne(HelpQuestionClassification::getId, helpQuestionClassification.getId())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (classification != null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("排序相同");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
classificationMapper.updateById(helpQuestionClassification);
|
|
classificationMapper.updateById(helpQuestionClassification);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void saveHelpQuestion(HelpQuestion helpQuestion) {
|
|
public void saveHelpQuestion(HelpQuestion helpQuestion) {
|
|
|
- if (ObjectUtil.hasEmpty(helpQuestion.getClassificationId(), helpQuestion.getName(), helpQuestion.getContent())) {
|
|
|
|
|
|
|
+ if (ObjectUtil.hasEmpty(helpQuestion.getClassificationId(), helpQuestion.getName(), helpQuestion.getContent(), helpQuestion.getSort())) {
|
|
|
throw BusinessRuntimeException.getInstance("请补充必填项");
|
|
throw BusinessRuntimeException.getInstance("请补充必填项");
|
|
|
}
|
|
}
|
|
|
HelpQuestionClassification classification = classificationMapper.selectById(helpQuestion.getClassificationId());
|
|
HelpQuestionClassification classification = classificationMapper.selectById(helpQuestion.getClassificationId());
|
|
|
if (classification == null || !classification.getDeleted()) {
|
|
if (classification == null || !classification.getDeleted()) {
|
|
|
throw BusinessRuntimeException.getInstance("分类不存在");
|
|
throw BusinessRuntimeException.getInstance("分类不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+ HelpQuestion helpQuestion1 = helpQuestionMapper.selectOne(Wrappers.lambdaQuery(HelpQuestion.class)
|
|
|
|
|
+ .eq(HelpQuestion::getDeleted, true)
|
|
|
|
|
+ .eq(HelpQuestion::getClassificationId, helpQuestion.getClassificationId())
|
|
|
|
|
+ .eq(HelpQuestion::getSort, helpQuestion.getSort())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (helpQuestion1 != null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("排序相同");
|
|
|
|
|
+ }
|
|
|
helpQuestionMapper.insert(helpQuestion);
|
|
helpQuestionMapper.insert(helpQuestion);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -93,6 +121,17 @@ public class SysHelpServiceImpl implements SysHelpService {
|
|
|
if (helpQuestion.getClassificationId() != null && !exits.getClassificationId().equals(helpQuestion.getClassificationId())) {
|
|
if (helpQuestion.getClassificationId() != null && !exits.getClassificationId().equals(helpQuestion.getClassificationId())) {
|
|
|
throw BusinessRuntimeException.getInstance("问题所属分类无法修改");
|
|
throw BusinessRuntimeException.getInstance("问题所属分类无法修改");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (helpQuestion.getSort() != null) {
|
|
|
|
|
+ HelpQuestion helpQuestion1 = helpQuestionMapper.selectOne(Wrappers.lambdaQuery(HelpQuestion.class)
|
|
|
|
|
+ .eq(HelpQuestion::getDeleted, true)
|
|
|
|
|
+ .eq(HelpQuestion::getClassificationId, helpQuestion.getClassificationId())
|
|
|
|
|
+ .eq(HelpQuestion::getSort, helpQuestion.getSort())
|
|
|
|
|
+ .ne(HelpQuestion::getId, helpQuestion.getId())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (helpQuestion1 != null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("排序相同");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
helpQuestionMapper.updateById(helpQuestion);
|
|
helpQuestionMapper.updateById(helpQuestion);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|