|
|
@@ -27,6 +27,7 @@ import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DataIntegrityViolationException;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -852,6 +853,14 @@ public class JcJyController {
|
|
|
resultMap.put("message", "保存检查项目成功");
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
+ if (e instanceof DataIntegrityViolationException) {
|
|
|
+ if (e.getMessage().contains("将截断字符串或二进制数据")) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "项目名称超长,请缩短名称");
|
|
|
+ log.error("系统异常,错误信息{项目名称超长}");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
e.printStackTrace();
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "保存检查项目失败,错误信息:【" + e.getMessage() + "】");
|
|
|
@@ -1230,6 +1239,14 @@ public class JcJyController {
|
|
|
resultMap.put("message", "保存检验项目成功");
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
+ if (e instanceof DataIntegrityViolationException) {
|
|
|
+ if (e.getMessage().contains("将截断字符串或二进制数据")) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "项目名称超长,请缩短名称");
|
|
|
+ log.error("系统异常,错误信息{项目名称超长}");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
e.printStackTrace();
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "保存检验项目失败,错误信息:【" + e.getMessage() + "】");
|