wangliang 4 лет назад
Родитель
Сommit
57e956a3c3

+ 2 - 7
themis-admin/src/main/java/com/qmth/themis/admin/api/TBUserController.java

@@ -680,13 +680,8 @@ public class TBUserController {
                 String errorColumn = e.getCause().toString();
                 String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
                         .replaceAll("'", "");
-                if (Objects.nonNull(columnStr) && columnStr.contains(SystemConstant.SQL_UNIQUE_ERROR)) {
-                    throw new BusinessException(
-                            "机构id[" + orgId + "]下的" + FieldUniqueEnum.org_login_name.getCode() + "数据不允许重复插入");
-                } else {
-                    throw new BusinessException(
-                            "机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
-                }
+                throw new BusinessException(
+                        "机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
             } else if (e instanceof BusinessException) {
                 throw new BusinessException(e.getMessage());
             } else {

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -299,7 +299,7 @@ public class SystemConstant {
 
     public static final String configCache = "config:cache::";
 
-    public static final String SQL_UNIQUE_ERROR = "#23000";
+//    public static final String SQL_UNIQUE_ERROR = "#23000";
     //    /**
     //     * ehcache配置
     //     */

+ 2 - 8
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamActivityServiceImpl.java

@@ -6,7 +6,6 @@ import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
-import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TEExamActivityMapper;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.response.MonitorStreamDto;
@@ -333,13 +332,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
                 String errorColumn = e.getCause().toString();
                 String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
                         .replaceAll("'", "");
-                if (Objects.nonNull(columnStr) && columnStr.contains(SystemConstant.SQL_UNIQUE_ERROR)) {
-                    throw new BusinessException(
-                            "机构id[" + teExamActivityList.get(0).getExamId() + "]下的" + FieldUniqueEnum.t_e_exam_activity_examId_code_Idx.getCode() + "数据不允许重复插入");
-                } else {
-                    throw new BusinessException(
-                            "机构id[" + teExamActivityList.get(0).getExamId() + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
-                }
+                throw new BusinessException(
+                        "机构id[" + teExamActivityList.get(0).getExamId() + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
             } else if (e instanceof BusinessException) {
                 throw new BusinessException(e.getMessage());
             } else {