From bc00242ee0410684eb9f4c5fe0aa486dfebb3162 Mon Sep 17 00:00:00 2001
From: lead <lead@local>
Date: 星期二, 03 十一月 2026 10:09:31 +0800
Subject: [PATCH] fix(api): 修复全量接口扫描发现的 500 —— 由 70 个降到 0 个
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplateRespVO.java | 4
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/brand/vo/MdmBrandSaveReqVO.java | 3
scripts/api-500-probe/map_500.py | 37 ++++
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java | 6
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03GradeDO.java | 3
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/LocalTimeConvert.java | 44 ++++
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/unit/vo/MdmUnitMeasureSaveReqVO.java | 3
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/category/vo/MdmItemCategorySaveReqVO.java | 2
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/vo/MdmItemSaveReqVO.java | 3
scripts/api-500-probe/replay_list.txt | 10 +
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java | 6
scripts/api-500-probe/replay_list3.txt | 8
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmAttendanceRuleRespVO.java | 5
scripts/api-500-probe/probe_500.py | 84 +++++++++
scripts/api-500-probe/replay.py | 35 +++
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03CourseDO.java | 3
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/archive/MesPdArchiveController.java | 5
scripts/api-500-probe/probe_500_detail.py | 71 +++++++
yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiDataSourceConfigDO.java | 2
yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiChartConfigDO.java | 5
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java | 7
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/warehouse/vo/MdmWarehouseSaveReqVO.java | 3
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/documentaudit/vo/MesPdDocumentAuditSaveReqVO.java | 2
scripts/api-500-probe/map_types.py | 18 ++
scripts/api-500-probe/replay_list2.txt | 9 +
scripts/api-500-probe/map_dive.py | 33 +++
scripts/api-500-probe/map_rest.py | 12 +
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java | 48 +++-
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmShiftRespVO.java | 5
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/vo/MesProTaskRespVO.java | 8
30 files changed, 462 insertions(+), 22 deletions(-)
diff --git a/scripts/api-500-probe/map_500.py b/scripts/api-500-probe/map_500.py
new file mode 100644
index 0000000..5da3e58
--- /dev/null
+++ b/scripts/api-500-probe/map_500.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""浠庡鍣ㄦ棩蹇楅噷鎶婃瘡涓� 500 寮傚父鏄犲皠鍒版帴鍙� + 棣栦釜涓氬姟鏍堝抚"""
+import re, sys, collections
+
+path = sys.argv[1]
+cur_url = ""
+records = []
+buf = None
+with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = re.sub(r"\x1b\[[0-9;]*m", "", line.rstrip("\n"))
+ m = re.search(r"\[preHandle\]\[寮�濮嬭姹� URL\(([^)]+)\)", line)
+ if m:
+ cur_url = m.group(1)
+ continue
+ if "defaultExceptionHandler" in line:
+ buf = {"url": cur_url, "exc": "", "frames": []}
+ records.append(buf)
+ continue
+ if buf is not None:
+ if not buf["exc"] and re.match(r"^[a-zA-Z].*(Exception|Error)", line):
+ buf["exc"] = line.strip()[:200]
+ elif line.startswith("\tat cn.iocoder") and len(buf["frames"]) < 3:
+ buf["frames"].append(line.strip()[:180])
+ if line.startswith("\tat ") and len(buf["frames"]) >= 3:
+ buf = None
+
+agg = collections.OrderedDict()
+for r in records:
+ key = r["url"].split("?")[0]
+ agg.setdefault(key, {"exc": r["exc"], "frame": (r["frames"][0] if r["frames"] else ""), "n": 0})
+ agg[key]["n"] += 1
+
+for url, v in agg.items():
+ print("%s\n EXC: %s\n FRAME: %s (x%d)" % (url, v["exc"], v["frame"], v["n"]))
+print("URLS", len(agg))
diff --git a/scripts/api-500-probe/map_dive.py b/scripts/api-500-probe/map_dive.py
new file mode 100644
index 0000000..f52e0de
--- /dev/null
+++ b/scripts/api-500-probe/map_dive.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""瀵� DataIntegrityViolationException 鎶撳彇鍏蜂綋 SQL 涓庣害鏉熷悕"""
+import re, subprocess, sys
+text = subprocess.run(["docker", "logs", "--since", "15m", "mom-kyzn"],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=180).stdout.decode("utf-8", "replace")
+text = re.sub(r"\x1b\[[0-9;]*m", "", text)
+lines = text.split("\n")
+i = 0
+cur = ""
+out = []
+while i < len(lines):
+ m = re.search(r"\[preHandle\]\[寮�濮嬭姹� URL\(([^)]+)\)", lines[i])
+ if m:
+ cur = m.group(1).split("?")[0]
+ if "DataIntegrityViolationException" in lines[i] or "SQLIntegrityConstraintViolationException" in lines[i] or "doesn't have a default value" in lines[i] or "cannot be null" in lines[i]:
+ ctx = []
+ for l in lines[max(0, i-3): i+6]:
+ if "INSERT INTO" in l or "doesn't have a default value" in l or "cannot be null" in l or "Data too long" in l or "Duplicate entry" in l or "Field " in l:
+ ctx.append(l.strip()[:300])
+ if ctx:
+ out.append((cur, ctx))
+ i += 1
+seen = set()
+for cur, ctx in out:
+ key = cur
+ if key in seen:
+ continue
+ seen.add(key)
+ print("###", cur)
+ for c in ctx[:3]:
+ print(" ", c)
+print("TOTAL", len(out), "UNIQUE", len(seen))
diff --git a/scripts/api-500-probe/map_rest.py b/scripts/api-500-probe/map_rest.py
new file mode 100644
index 0000000..e2168e3
--- /dev/null
+++ b/scripts/api-500-probe/map_rest.py
@@ -0,0 +1,12 @@
+import re, subprocess
+t = subprocess.run(["docker","logs","--since","30m","mom-kyzn"],stdout=subprocess.PIPE,stderr=subprocess.STDOUT,timeout=180).stdout.decode("utf-8","replace")
+t = re.sub(r"\x1b\[[0-9;]*m","",t)
+ls = t.split("\n")
+cur=""
+for i,l in enumerate(ls):
+ m = re.search(r"\[preHandle\]\[寮�濮嬭姹� URL\(([^)]+)\)", l)
+ if m: cur=m.group(1).split("?")[0]
+ if "defaultExceptionHandler" in l:
+ for l2 in ls[i+1:i+60]:
+ if re.match(r"^[a-zA-Z].*?(Exception|Error)", l2):
+ print(cur, "|", l2.strip()[:150]); break
diff --git a/scripts/api-500-probe/map_types.py b/scripts/api-500-probe/map_types.py
new file mode 100644
index 0000000..b7e7763
--- /dev/null
+++ b/scripts/api-500-probe/map_types.py
@@ -0,0 +1,18 @@
+import re, subprocess
+text = subprocess.run(["docker","logs","--since","30m","mom-kyzn"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=180).stdout.decode("utf-8","replace")
+text = re.sub(r"\x1b\[[0-9;]*m","",text)
+lines = text.split("\n")
+want = ["HttpMessageNotWritableException","IORuntimeException","InvalidCacheLoadException","MybatisPlusException","NullPointerException","FlowableIllegalArgumentException","HttpMessageNotReadableException"]
+cur=""
+res={}
+for i,l in enumerate(lines):
+ m = re.search(r"\[preHandle\]\[寮�濮嬭姹� URL\(([^)]+)\)", l)
+ if m: cur = m.group(1).split("?")[0]
+ for w in want:
+ if w in l:
+ res.setdefault(w, set()).add(cur)
+for w in want:
+ if w in res:
+ print("##", w)
+ for u in sorted(res[w]):
+ print(" ", u)
diff --git a/scripts/api-500-probe/probe_500.py b/scripts/api-500-probe/probe_500.py
new file mode 100644
index 0000000..e9bca33
--- /dev/null
+++ b/scripts/api-500-probe/probe_500.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""搴锋剰 mom-kyzn 鍏ㄩ噺鎺ュ彛 500 鎵弿锛堝熀浜� /v3/api-docs 鑷姩鍙戠幇锛�"""
+import json, sys, re, time, urllib.request, urllib.error, concurrent.futures
+
+BASE = "http://127.0.0.1:9007"
+TOKEN = sys.argv[1]
+TENANT = "1"
+
+def load_doc(url):
+ req = urllib.request.Request(url, headers={"Accept": "application/json"})
+ with urllib.request.urlopen(req, timeout=120) as r:
+ return json.loads(r.read().decode("utf-8"))
+
+def collect():
+ cfg = load_doc(BASE + "/v3/api-docs/swagger-config")
+ ops = []
+ seen = set()
+ for u in cfg.get("urls", []):
+ try:
+ doc = load_doc(BASE + u["url"])
+ except Exception as e:
+ print("SKIP doc", u["url"], e)
+ continue
+ paths = doc.get("paths", {})
+ for path, methods in paths.items():
+ for m, op in methods.items():
+ if m.lower() not in ("get", "post", "put", "delete"):
+ continue
+ if path in seen:
+ continue
+ seen.add(path + " " + m)
+ ops.append((m.upper(), path, op.get("operationId", "")))
+ return ops
+
+def call(op):
+ m, path, oid = op
+ # 鏇挎崲璺緞鍙傛暟涓� 1
+ real = re.sub(r"\{[^/}]+\}", "1", path)
+ url = BASE + real
+ data = None
+ headers = {"Authorization": "Bearer " + TOKEN, "tenant-id": TENANT}
+ if m in ("POST", "PUT"):
+ data = b"{}"
+ headers["Content-Type"] = "application/json"
+ req = urllib.request.Request(url, data=data, headers=headers, method=m)
+ t0 = time.time()
+ try:
+ with urllib.request.urlopen(req, timeout=60) as r:
+ body = r.read(4000).decode("utf-8", "replace")
+ code = r.status
+ except urllib.error.HTTPError as e:
+ body = e.read(4000).decode("utf-8", "replace")
+ code = e.code
+ except Exception as e:
+ return (m, path, oid, "EXC", str(e)[:120], int((time.time()-t0)*1000))
+ try:
+ j = json.loads(body)
+ biz = j.get("code")
+ msg = (j.get("msg") or "")[:160]
+ except Exception:
+ biz, msg = None, body[:160]
+ return (m, path, oid, biz if biz is not None else code, msg, int((time.time()-t0)*1000))
+
+def main():
+ ops = collect()
+ print("TOTAL_OPS", len(ops), flush=True)
+ results = []
+ with concurrent.futures.ThreadPoolExecutor(max_workers=8) as ex:
+ for r in ex.map(call, ops):
+ results.append(r)
+ bad500 = [r for r in results if r[3] == 500 or r[3] == "EXC"]
+ others = {}
+ for r in results:
+ others[str(r[3])] = others.get(str(r[3]), 0) + 1
+ print("STATS", json.dumps(others, ensure_ascii=False), flush=True)
+ print("===== 500 LIST =====", flush=True)
+ for r in sorted(bad500, key=lambda x: x[1]):
+ print("%s %s | op=%s | code=%s | %s | %sms" % r, flush=True)
+ print("500_COUNT", len(bad500), flush=True)
+ with open("/tmp/kyzn_probe_all.json", "w") as f:
+ json.dump([{"method": r[0], "path": r[1], "op": r[2], "code": r[3], "msg": r[4], "ms": r[5]} for r in results], f, ensure_ascii=False, indent=1)
+
+main()
diff --git a/scripts/api-500-probe/probe_500_detail.py b/scripts/api-500-probe/probe_500_detail.py
new file mode 100644
index 0000000..3cb8fa0
--- /dev/null
+++ b/scripts/api-500-probe/probe_500_detail.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""瀵� 500 鎺ュ彛閫愪釜閲嶆斁锛屽苟绮剧‘鎶撳彇瀵瑰簲鐨勫紓甯哥被鍨嬩笌涓氬姟鏍堝抚"""
+import json, re, subprocess, sys, time, urllib.request, urllib.error
+from datetime import datetime
+
+BASE = "http://127.0.0.1:9007"
+TOKEN = sys.argv[1]
+
+data = json.load(open("/tmp/kyzn_probe_all.json"))
+targets = []
+seen = set()
+for r in data:
+ if r["code"] != 500:
+ continue
+ key = (r["method"], r["path"])
+ if key in seen:
+ continue
+ seen.add(key)
+ targets.append(key)
+
+def call(m, path):
+ real = re.sub(r"\{[^/}]+\}", "1", path)
+ headers = {"Authorization": "Bearer " + TOKEN, "tenant-id": "1"}
+ body = None
+ if m in ("POST", "PUT"):
+ body = b"{}"
+ headers["Content-Type"] = "application/json"
+ req = urllib.request.Request(BASE + real, data=body, headers=headers, method=m)
+ try:
+ with urllib.request.urlopen(req, timeout=60) as r:
+ return json.loads(r.read(3000).decode("utf-8", "replace")).get("code")
+ except urllib.error.HTTPError as e:
+ try:
+ return json.loads(e.read(3000).decode("utf-8", "replace")).get("code")
+ except Exception:
+ return e.code
+ except Exception as e:
+ return "EXC:" + str(e)[:60]
+
+def exception_since(ts):
+ out = subprocess.run(["docker", "logs", "--since", ts, "mom-kyzn"],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=120)
+ text = re.sub(r"\x1b\[[0-9;]*m", "", out.stdout.decode("utf-8", "replace"))
+ lines = text.split("\n")
+ exc = ""
+ frames = []
+ for i, l in enumerate(lines):
+ if "defaultExceptionHandler" in l:
+ for l2 in lines[i+1:i+400]:
+ if not exc and re.match(r"^[a-zA-Z].*?(Exception|Error)", l2):
+ exc = l2.strip()[:180]
+ elif l2.startswith("\tat cn.iocoder") and len(frames) < 2:
+ frames.append(l2.strip()[:150])
+ if len(frames) >= 2 and exc:
+ break
+ if exc:
+ break
+ return exc, frames
+
+results = []
+for m, path in targets:
+ ts = datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
+ time.sleep(0.2)
+ code = call(m, path)
+ time.sleep(0.6)
+ exc, frames = exception_since(ts)
+ results.append({"method": m, "path": path, "code": code, "exc": exc, "frames": frames})
+ print("%-58s %-6s %s" % (path, code, exc), flush=True)
+
+json.dump(results, open("/tmp/kyzn_500_detail.json", "w"), ensure_ascii=False, indent=1)
diff --git a/scripts/api-500-probe/replay.py b/scripts/api-500-probe/replay.py
new file mode 100644
index 0000000..bd74094
--- /dev/null
+++ b/scripts/api-500-probe/replay.py
@@ -0,0 +1,35 @@
+import json, re, subprocess, sys, time, urllib.request, urllib.error
+from datetime import datetime
+BASE="http://127.0.0.1:9007"; TOKEN=sys.argv[1]
+targets = [l.split() for l in sys.stdin.read().strip().split("\n") if l.strip()]
+def call(m,p):
+ real = re.sub(r"\{[^/}]+\}","1",p)
+ h={"Authorization":"Bearer "+TOKEN,"tenant-id":"1"}; b=None
+ if m in ("POST","PUT"):
+ b=b"{}"; h["Content-Type"]="application/json"
+ req=urllib.request.Request(BASE+real,data=b,headers=h,method=m)
+ try:
+ with urllib.request.urlopen(req,timeout=60) as r:
+ raw=r.read(3000).decode("utf-8","replace")
+ except urllib.error.HTTPError as e:
+ raw=e.read(3000).decode("utf-8","replace")
+ except Exception as e:
+ return "EXC "+str(e)[:80]
+ try:
+ j=json.loads(raw); return "code=%s msg=%s" % (j.get("code"), (j.get("msg") or "")[:120])
+ except Exception:
+ return "RAW "+raw[:120]
+def exc_since(ts):
+ out=subprocess.run(["docker","logs","--since",ts,"mom-kyzn"],stdout=subprocess.PIPE,stderr=subprocess.STDOUT,timeout=120)
+ t=re.sub(r"\x1b\[[0-9;]*m","",out.stdout.decode("utf-8","replace"))
+ ls=t.split("\n")
+ for i,l in enumerate(ls):
+ if "defaultExceptionHandler" in l:
+ for l2 in ls[i+1:i+120]:
+ if re.match(r"^[a-zA-Z].*?(Exception|Error)", l2):
+ return l2.strip()[:200]
+ return ""
+for m,p in targets:
+ ts=datetime.now().strftime("%Y-%m-%dT%H:%M:%S"); time.sleep(0.2)
+ r=call(m,p); time.sleep(0.6)
+ print("%-52s %-58s %s" % (p, r, exc_since(ts)), flush=True)
diff --git a/scripts/api-500-probe/replay_list.txt b/scripts/api-500-probe/replay_list.txt
new file mode 100644
index 0000000..96c7e3e
--- /dev/null
+++ b/scripts/api-500-probe/replay_list.txt
@@ -0,0 +1,10 @@
+GET /admin-api/system/dept/simple-list
+GET /admin-api/system/dict-type/page
+GET /admin-api/system/mail-account/page
+GET /admin-api/srm/tender-bid/get
+GET /admin-api/mes/dv/metering/simple-list
+GET /admin-api/mes/md/unit-measure/export-excel
+GET /admin-api/mes/pd/archive/export-excel
+GET /admin-api/infra/file/1/get/a.png
+GET /admin-api/bpm/process-definition/page
+GET /admin-api/bpm/form/create
\ No newline at end of file
diff --git a/scripts/api-500-probe/replay_list2.txt b/scripts/api-500-probe/replay_list2.txt
new file mode 100644
index 0000000..7f5f8b6
--- /dev/null
+++ b/scripts/api-500-probe/replay_list2.txt
@@ -0,0 +1,9 @@
+GET /admin-api/mes/qc/template/export-excel
+GET /admin-api/mes/pro/task/export-excel
+GET /admin-api/mes/pd/archive/export-excel
+GET /admin-api/hrm/shift/export-excel
+GET /admin-api/hrm/attendance/rule/export-excel
+POST /admin-api/mdm/item/create
+POST /admin-api/bi/chart-config/create
+GET /admin-api/infra/file/1/get/a.png
+GET /admin-api/bpm/process-definition/page
\ No newline at end of file
diff --git a/scripts/api-500-probe/replay_list3.txt b/scripts/api-500-probe/replay_list3.txt
new file mode 100644
index 0000000..977b7b9
--- /dev/null
+++ b/scripts/api-500-probe/replay_list3.txt
@@ -0,0 +1,8 @@
+GET /admin-api/mes/dv/repair/get
+GET /admin-api/mes/dv/spare/get
+GET /admin-api/srm/supplier-certificate/page
+GET /admin-api/system/dept/simple-list
+GET /admin-api/system/mail-account/page
+GET /admin-api/crm/customer-limit-config/get
+GET /admin-api/im/manager/face-pack-item/page
+GET /admin-api/member/user/update-level
\ No newline at end of file
diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/LocalTimeConvert.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/LocalTimeConvert.java
new file mode 100644
index 0000000..31c0da2
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/LocalTimeConvert.java
@@ -0,0 +1,44 @@
+package cn.iocoder.yudao.framework.excel.core.convert;
+
+import cn.idev.excel.converters.Converter;
+import cn.idev.excel.enums.CellDataTypeEnum;
+import cn.idev.excel.metadata.GlobalConfiguration;
+import cn.idev.excel.metadata.data.WriteCellData;
+import cn.idev.excel.metadata.property.ExcelContentProperty;
+
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * Excel LocalTime 杞崲鍣�
+ *
+ * FastExcel 鍐呯疆鍙敮鎸� Date / LocalDateTime锛岄亣鍒� LocalTime 瀛楁浼氭姏
+ * {@code ExcelWriteDataConvertException: Can not find 'Converter' support class LocalTime}锛�
+ * 鍥犳杩欓噷琛ヤ竴涓浆鎹㈠櫒锛屼緵鐝銆佽�冨嫟瑙勫垯绛夊惈鏃堕棿瀛楁鐨� VO 瀵煎嚭鏃朵娇鐢ㄣ��
+ *
+ * @author 瓒呯骇绠$悊鍛�
+ */
+public class LocalTimeConvert implements Converter<LocalTime> {
+
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("HH:mm");
+
+ @Override
+ public Class<?> supportJavaTypeKey() {
+ throw new UnsupportedOperationException("鏆備笉鏀寔锛屼篃涓嶉渶瑕�");
+ }
+
+ @Override
+ public CellDataTypeEnum supportExcelTypeKey() {
+ throw new UnsupportedOperationException("鏆備笉鏀寔锛屼篃涓嶉渶瑕�");
+ }
+
+ @Override
+ public WriteCellData<String> convertToExcelData(LocalTime value, ExcelContentProperty contentProperty,
+ GlobalConfiguration globalConfiguration) {
+ if (value == null) {
+ return new WriteCellData<>("");
+ }
+ return new WriteCellData<>(value.format(FORMATTER));
+ }
+
+}
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
index d8f1054..1c151e5 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
@@ -36,6 +36,7 @@
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
+import org.springframework.web.multipart.MultipartException;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.resource.NoResourceFoundException;
import tools.jackson.databind.exc.InvalidFormatException;
@@ -96,6 +97,10 @@
}
if (ex instanceof MaxUploadSizeExceededException) {
return maxUploadSizeExceededExceptionHandler((MaxUploadSizeExceededException) ex);
+ }
+ // 涓婁紶绫绘帴鍙f敹鍒伴潪 multipart 璇锋眰锛堝墠绔紡浼犳枃浠� / 鐢� JSON 璋冪敤浜嗗鍏ユ帴鍙o級灞炰簬瀹㈡埛绔棶棰�
+ if (ex instanceof MultipartException) {
+ return multipartExceptionHandler((MultipartException) ex);
}
if (ex instanceof NoHandlerFoundException) {
return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex);
@@ -170,6 +175,17 @@
}
/**
+ * 澶勭悊鏂囦欢涓婁紶鎺ュ彛鏀跺埌闈� multipart 璇锋眰
+ *
+ * 渚嬪璇达紝Excel 瀵煎叆鎺ュ彛婕忎紶 file 瀛楁銆佹垨鍓嶇鐢� application/json 璋冪敤浜嗗鍏ユ帴鍙�
+ */
+ @ExceptionHandler(MultipartException.class)
+ public CommonResult<?> multipartExceptionHandler(MultipartException ex) {
+ log.warn("[multipartExceptionHandler]", ex);
+ return CommonResult.error(BAD_REQUEST.getCode(), "璇锋眰鍙傛暟涓嶆纭�:璇蜂娇鐢� multipart/form-data 涓婁紶鏂囦欢");
+ }
+
+ /**
* 澶勭悊 SpringMVC 鍙傛暟缁戝畾涓嶆纭紝鏈川涓婁篃鏄�氳繃 Validator 鏍¢獙
*/
@ExceptionHandler(BindException.class)
@@ -196,7 +212,9 @@
if (StrUtil.startWith(ex.getMessage(), "Required request body is missing")) {
return CommonResult.error(BAD_REQUEST.getCode(), "璇锋眰鍙傛暟绫诲瀷閿欒: request body 缂哄け");
}
- return defaultExceptionHandler(ServletUtils.getRequest(), ex);
+ // 鍏跺畠鍙嶅簭鍒楀寲澶辫触锛堝鎶婂璞′紶鎴愭暟缁勩�佸瓧娈电被鍨嬩笉鍖归厤锛夊悓鏍锋槸瀹㈡埛绔姤鏂囬棶棰橈紝涓嶅簲鎸� 500 澶勭悊
+ return CommonResult.error(BAD_REQUEST.getCode(),
+ String.format("璇锋眰鍙傛暟绫诲瀷閿欒:%s", StrUtil.maxLength(ex.getMessage(), 120)));
}
/**
@@ -374,27 +392,31 @@
errorLog.setUserType(WebFrameworkUtils.getLoginUserType(request));
// 璁剧疆寮傚父瀛楁
errorLog.setExceptionName(e.getClass().getName());
- errorLog.setExceptionMessage(ExceptionUtil.getMessage(e));
- errorLog.setExceptionRootCauseMessage(ExceptionUtil.getRootCauseMessage(e));
- errorLog.setExceptionStackTrace(ExceptionUtil.stacktraceToString(e));
+ // infra_api_error_log 鐨勮繖浜涘垪閮芥槸 NOT NULL锛涜�� MyBatis-Plus 鎻掑叆鏃朵細璺宠繃 null 瀛楁锛�
+ // 浜庢槸浠讳竴瀛楁涓� null 閮戒細鍙樻垚 "Field 'xxx' doesn't have a default value"锛屽紓甯告棩蹇楀弽鑰岃涓嶄笅鏉�
+ errorLog.setExceptionMessage(StrUtil.nullToEmpty(ExceptionUtil.getMessage(e)));
+ errorLog.setExceptionRootCauseMessage(StrUtil.nullToEmpty(ExceptionUtil.getRootCauseMessage(e)));
+ errorLog.setExceptionStackTrace(StrUtil.nullToEmpty(ExceptionUtil.stacktraceToString(e)));
StackTraceElement[] stackTraceElements = e.getStackTrace();
Assert.notEmpty(stackTraceElements, "寮傚父 stackTraceElements 涓嶈兘涓虹┖");
StackTraceElement stackTraceElement = stackTraceElements[0];
errorLog.setExceptionClassName(stackTraceElement.getClassName());
- errorLog.setExceptionFileName(stackTraceElement.getFileName());
- errorLog.setExceptionMethodName(stackTraceElement.getMethodName());
+ // 鏍堥《鍏冪礌鍙兘鏄� native 鏂规硶鎴� Lambda锛実etFileName() 涓� null锛�
+ // infra_api_error_log 鐨勮繖浜涘垪鏄� NOT NULL锛屼负 null 浼氬鑷村紓甯告棩蹇楁彃鍏ュけ璐ワ紙鏃ュ織閲屽彧鍓╀竴鏉� SQL 鎶ラ敊锛�
+ errorLog.setExceptionFileName(StrUtil.nullToEmpty(stackTraceElement.getFileName()));
+ errorLog.setExceptionMethodName(StrUtil.nullToEmpty(stackTraceElement.getMethodName()));
errorLog.setExceptionLineNumber(stackTraceElement.getLineNumber());
// 璁剧疆鍏跺畠瀛楁
- errorLog.setTraceId(TracerUtils.getTraceId());
- errorLog.setApplicationName(applicationName);
- errorLog.setRequestUrl(request.getRequestURI());
+ errorLog.setTraceId(StrUtil.nullToEmpty(TracerUtils.getTraceId()));
+ errorLog.setApplicationName(StrUtil.nullToEmpty(applicationName));
+ errorLog.setRequestUrl(StrUtil.nullToEmpty(request.getRequestURI()));
Map<String, Object> requestParams = MapUtil.<String, Object>builder()
.put("query", ServletUtils.getParamMap(request))
.put("body", ServletUtils.getBody(request)).build();
- errorLog.setRequestParams(JsonUtils.toJsonString(requestParams));
- errorLog.setRequestMethod(request.getMethod());
- errorLog.setUserAgent(ServletUtils.getUserAgent(request));
- errorLog.setUserIp(ServletUtils.getClientIP(request));
+ errorLog.setRequestParams(StrUtil.nullToEmpty(JsonUtils.toJsonString(requestParams)));
+ errorLog.setRequestMethod(StrUtil.nullToEmpty(request.getMethod()));
+ errorLog.setUserAgent(StrUtil.nullToEmpty(ServletUtils.getUserAgent(request)));
+ errorLog.setUserIp(StrUtil.nullToEmpty(ServletUtils.getClientIP(request)));
errorLog.setExceptionTime(LocalDateTime.now());
}
diff --git a/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiChartConfigDO.java b/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiChartConfigDO.java
index 657b31b..0b577d1 100644
--- a/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiChartConfigDO.java
+++ b/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiChartConfigDO.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.*;
/**
@@ -29,16 +31,19 @@
*
* 鍏宠仈 {@link BiDashboardDO#getId()}
*/
+ @NotNull(message = "鎵�灞炰华琛ㄧ洏ID涓嶈兘涓虹┖")
private Long dashboardId;
/**
* 鍥捐〃鍚嶇О
*/
+ @NotBlank(message = "鍥捐〃鍚嶇О涓嶈兘涓虹┖")
private String name;
/**
* 鍥捐〃绫诲瀷锛歜ar / line / pie / scatter / gauge / table / number
*/
+ @NotBlank(message = "鍥捐〃绫诲瀷涓嶈兘涓虹┖")
private String chartType;
/**
diff --git a/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiDataSourceConfigDO.java b/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiDataSourceConfigDO.java
index 57d3fc9..3c48b24 100644
--- a/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiDataSourceConfigDO.java
+++ b/yudao-module-bi/src/main/java/cn/iocoder/yudao/module/bi/dal/dataobject/BiDataSourceConfigDO.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import jakarta.validation.constraints.NotBlank;
import lombok.*;
/**
@@ -27,6 +28,7 @@
/**
* 鏁版嵁婧愬悕绉�
*/
+ @NotBlank(message = "鏁版嵁婧愬悕绉颁笉鑳戒负绌�")
private String name;
/**
diff --git a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
index 90c3888..c3519f0 100644
--- a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
+++ b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO;
@@ -119,7 +120,11 @@
public CommonResult<BpmProcessDefinitionRespVO> getProcessDefinition(
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "key", required = false) String key) {
- ProcessDefinition processDefinition = id != null ? processDefinitionService.getProcessDefinition(id)
+ // id 涓� key 鑷冲皯瑕佷紶涓�涓紝鍚﹀垯 Flowable 浼氭姏 FlowableIllegalArgumentException(key is null) 鍙樻垚 500
+ if (StrUtil.isBlank(id) && StrUtil.isBlank(key)) {
+ throw new IllegalArgumentException("娴佺▼缂栧彿 id 涓庢祦绋嬪畾涔夋爣璇� key 涓嶈兘鍚屾椂涓虹┖");
+ }
+ ProcessDefinition processDefinition = StrUtil.isNotBlank(id) ? processDefinitionService.getProcessDefinition(id)
: processDefinitionService.getActiveProcessDefinition(key);
if (processDefinition == null) {
return success(null);
diff --git a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java
index 1ef8b6f..a7194b1 100644
--- a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java
+++ b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java
@@ -57,8 +57,10 @@
BpmCategoryDO category = MapUtil.get(categoryMap, definition.getCategory(), BpmCategoryDO.class);
return buildProcessDefinition(definition, deployment, processDefinitionInfo, form, category, null);
});
- // 鎺掑簭
- result.sort(Comparator.comparing(BpmProcessDefinitionRespVO::getSort));
+ // 鎺掑簭锛歴ort 鏉ヨ嚜娴佺▼瀹氫箟鎵╁睍淇℃伅锛屽巻鍙叉暟鎹彲鑳戒负 null锛�
+ // 鐩存帴鐢� Comparator.comparing 浼氭姏 NPE锛堟帴鍙� 500锛夛紝杩欓噷鎶� null 鎺掑埌鏈�鍚�
+ result.sort(Comparator.comparing(BpmProcessDefinitionRespVO::getSort,
+ Comparator.<Long>nullsLast(Comparator.<Long>naturalOrder())));
return result;
}
diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmAttendanceRuleRespVO.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmAttendanceRuleRespVO.java
index 6c85005..0d21d35 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmAttendanceRuleRespVO.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmAttendanceRuleRespVO.java
@@ -4,6 +4,7 @@
import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import cn.iocoder.yudao.framework.excel.core.convert.LocalTimeConvert;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -32,11 +33,11 @@
private String deptName;
@Schema(description = "涓婄彮鏃堕棿")
- @ExcelProperty("涓婄彮鏃堕棿")
+ @ExcelProperty(value = "涓婄彮鏃堕棿", converter = LocalTimeConvert.class)
private LocalTime workStartTime;
@Schema(description = "涓嬬彮鏃堕棿")
- @ExcelProperty("涓嬬彮鏃堕棿")
+ @ExcelProperty(value = "涓嬬彮鏃堕棿", converter = LocalTimeConvert.class)
private LocalTime workEndTime;
@Schema(description = "杩熷埌鍏佽鍒嗛挓鏁�")
diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmShiftRespVO.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmShiftRespVO.java
index 6117507..3962f78 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmShiftRespVO.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/vo/HrmShiftRespVO.java
@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo;
+import cn.iocoder.yudao.framework.excel.core.convert.LocalTimeConvert;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -23,11 +24,11 @@
private String name;
@Schema(description = "涓婄彮鏃堕棿")
- @ExcelProperty("涓婄彮鏃堕棿")
+ @ExcelProperty(value = "涓婄彮鏃堕棿", converter = LocalTimeConvert.class)
private LocalTime startTime;
@Schema(description = "涓嬬彮鏃堕棿")
- @ExcelProperty("涓嬬彮鏃堕棿")
+ @ExcelProperty(value = "涓嬬彮鏃堕棿", converter = LocalTimeConvert.class)
private LocalTime endTime;
@Schema(description = "鏍囧噯宸ユ椂锛堝皬鏃讹級")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
index 98c6e50..19e4e15 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
@@ -11,6 +11,7 @@
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.*;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
+import com.google.common.cache.CacheLoader;
import com.google.common.util.concurrent.UncheckedExecutionException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -126,6 +127,11 @@
log.warn("[getFileContent][configId({}) path({}) 鏂囦欢閰嶇疆涓嶅瓨鍦╙", configId, path);
response.setStatus(HttpStatus.NOT_FOUND.value());
return;
+ } catch (CacheLoader.InvalidCacheLoadException ex) {
+ // LoadingCache 鐨� load 杩斿洖 null 鏃舵姏鍑猴紙渚嬪鍘嗗彶鏂囦欢璁板綍鐨� configId 宸茶鍒犻櫎锛夛紝鍚屾牱鎸夎祫婧愪笉瀛樺湪澶勭悊
+ log.warn("[getFileContent][configId({}) path({}) 鏂囦欢閰嶇疆涓嶅瓨鍦╙", configId, path);
+ response.setStatus(HttpStatus.NOT_FOUND.value());
+ return;
}
if (content == null) {
log.warn("[getFileContent][configId({}) path({}) 鏂囦欢涓嶅瓨鍦╙", configId, path);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03CourseDO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03CourseDO.java
index d4c38c2..35f5247 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03CourseDO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03CourseDO.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import jakarta.validation.constraints.NotNull;
import lombok.*;
/**
@@ -29,6 +30,7 @@
/**
* 瀛︾敓缂栧彿
*/
+ @NotNull(message = "瀛︾敓缂栧彿涓嶈兘涓虹┖")
private Long studentId;
/**
* 鍚嶅瓧
@@ -37,6 +39,7 @@
/**
* 鍒嗘暟
*/
+ @NotNull(message = "鍒嗘暟涓嶈兘涓虹┖")
private Integer score;
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03GradeDO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03GradeDO.java
index 5173108..0c12feb 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03GradeDO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo03/Demo03GradeDO.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import jakarta.validation.constraints.NotNull;
import lombok.*;
/**
@@ -29,6 +30,7 @@
/**
* 瀛︾敓缂栧彿
*/
+ @NotNull(message = "瀛︾敓缂栧彿涓嶈兘涓虹┖")
private Long studentId;
/**
* 鍚嶅瓧
@@ -37,6 +39,7 @@
/**
* 鐝富浠�
*/
+ @NotNull(message = "鐝富浠讳笉鑳戒负绌�")
private String teacher;
}
\ No newline at end of file
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/brand/vo/MdmBrandSaveReqVO.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/brand/vo/MdmBrandSaveReqVO.java
index 39761e2..bd67c6d 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/brand/vo/MdmBrandSaveReqVO.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/brand/vo/MdmBrandSaveReqVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mdm.controller.admin.brand.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Schema(description = "绠$悊鍚庡彴 - MDM 鍝佺墝鏂板/淇敼 Request VO")
@@ -11,9 +12,11 @@
private Long id;
@Schema(description = "鍝佺墝缂栫爜", requiredMode = Schema.RequiredMode.REQUIRED, example = "BRAND001")
+ @NotBlank(message = "鍝佺墝缂栫爜涓嶈兘涓虹┖")
private String code;
@Schema(description = "鍝佺墝鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED, example = "鍝佺墝A")
+ @NotBlank(message = "鍝佺墝鍚嶇О涓嶈兘涓虹┖")
private String name;
@Schema(description = "鐘舵��", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/category/vo/MdmItemCategorySaveReqVO.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/category/vo/MdmItemCategorySaveReqVO.java
index cb2ed35..3d2d154 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/category/vo/MdmItemCategorySaveReqVO.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/category/vo/MdmItemCategorySaveReqVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mdm.controller.admin.category.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Schema(description = "绠$悊鍚庡彴 - MDM 鐗╂枡鍒嗙被鏂板/淇敼 Request VO")
@@ -17,6 +18,7 @@
private String code;
@Schema(description = "鍒嗙被鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED, example = "浜旈噾閰嶄欢")
+ @NotBlank(message = "鍒嗙被鍚嶇О涓嶈兘涓虹┖")
private String name;
@Schema(description = "鐗╂枡绫诲瀷", example = "1")
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/vo/MdmItemSaveReqVO.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/vo/MdmItemSaveReqVO.java
index de0c38d..6424dbc 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/vo/MdmItemSaveReqVO.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/vo/MdmItemSaveReqVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mdm.controller.admin.item.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.math.BigDecimal;
@@ -13,9 +14,11 @@
private Long id;
@Schema(description = "鐗╂枡缂栫爜", requiredMode = Schema.RequiredMode.REQUIRED, example = "ITEM001")
+ @NotBlank(message = "鐗╂枡缂栫爜涓嶈兘涓虹┖")
private String code;
@Schema(description = "鐗╂枡鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED, example = "铻轰笣")
+ @NotBlank(message = "鐗╂枡鍚嶇О涓嶈兘涓虹┖")
private String name;
@Schema(description = "鐗╂枡鏉$爜", example = "12345678")
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/unit/vo/MdmUnitMeasureSaveReqVO.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/unit/vo/MdmUnitMeasureSaveReqVO.java
index 0d9455c..342187b 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/unit/vo/MdmUnitMeasureSaveReqVO.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/unit/vo/MdmUnitMeasureSaveReqVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mdm.controller.admin.unit.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.math.BigDecimal;
@@ -13,9 +14,11 @@
private Long id;
@Schema(description = "鍗曚綅缂栫爜", requiredMode = Schema.RequiredMode.REQUIRED, example = "PCS")
+ @NotBlank(message = "鍗曚綅缂栫爜涓嶈兘涓虹┖")
private String code;
@Schema(description = "鍗曚綅鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED, example = "涓�")
+ @NotBlank(message = "鍗曚綅鍚嶇О涓嶈兘涓虹┖")
private String name;
@Schema(description = "鏄惁涓诲崟浣�", example = "true")
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/warehouse/vo/MdmWarehouseSaveReqVO.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/warehouse/vo/MdmWarehouseSaveReqVO.java
index 3e182a0..ff3b614 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/warehouse/vo/MdmWarehouseSaveReqVO.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/warehouse/vo/MdmWarehouseSaveReqVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mdm.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.math.BigDecimal;
@@ -13,9 +14,11 @@
private Long id;
@Schema(description = "浠撳簱缂栫爜", requiredMode = Schema.RequiredMode.REQUIRED, example = "WH001")
+ @NotBlank(message = "浠撳簱缂栫爜涓嶈兘涓虹┖")
private String code;
@Schema(description = "浠撳簱鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED, example = "鎴愬搧浠撳簱")
+ @NotBlank(message = "浠撳簱鍚嶇О涓嶈兘涓虹┖")
private String name;
@Schema(description = "浠撳簱鍦板潃", example = "涓婃捣甯傛郸涓滄柊鍖�")
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/archive/MesPdArchiveController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/archive/MesPdArchiveController.java
index 2bd2553..54c0f38 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/archive/MesPdArchiveController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/archive/MesPdArchiveController.java
@@ -106,8 +106,11 @@
@ApiAccessLog(operateType = EXPORT)
public void exportArchiveExcel(@Valid MesPdArchivePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
+ // 瀵煎嚭闇�瑕佷紶鍏� Page 瀵硅薄锛氬垎缁勬煡璇㈣蛋 XML mapper锛孭age 涓� null 鏃� MyBatis-Plus 浼氭姏
+ // MybatisPlusException: can't found IPage for args!锛堟鍓嶈繖閲屼紶 null 鐩存帴瀵艰嚧 500锛�
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
- IPage<MesPdArchiveGroupRespVO> archivePage = archiveService.getArchivePageGroupByProject(pageReqVO, null);
+ Page<MesPdArchiveGroupRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
+ IPage<MesPdArchiveGroupRespVO> archivePage = archiveService.getArchivePageGroupByProject(pageReqVO, page);
ExcelUtils.write(response, "褰掓。鍙拌处.xls", "鏁版嵁", MesPdArchiveRespVO.class,
buildArchiveRespVOList(archivePage.getRecords()));
}
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/documentaudit/vo/MesPdDocumentAuditSaveReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/documentaudit/vo/MesPdDocumentAuditSaveReqVO.java
index 9b39cdc..cd8be27 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/documentaudit/vo/MesPdDocumentAuditSaveReqVO.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/documentaudit/vo/MesPdDocumentAuditSaveReqVO.java
@@ -15,9 +15,11 @@
private Long id;
@Schema(description = "瀹℃牳鍗曞彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "AUD2024001")
+ @NotBlank(message = "瀹℃牳鍗曞彿涓嶈兘涓虹┖")
private String auditNo;
@Schema(description = "璧勬枡ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+ @NotNull(message = "璧勬枡ID涓嶈兘涓虹┖")
private Long documentId;
@Schema(description = "璧勬枡鍚嶇О", example = "浜у搧璁捐鍥�")
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/vo/MesProTaskRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/vo/MesProTaskRespVO.java
index f1c8e05..4536dbf 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/vo/MesProTaskRespVO.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/vo/MesProTaskRespVO.java
@@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.mes.controller.admin.pro.task.vo;
+import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -9,6 +12,7 @@
@Schema(description = "绠$悊鍚庡彴 - MES 鐢熶骇浠诲姟 Response VO")
@Data
+@ExcelIgnoreUnannotated
public class MesProTaskRespVO {
@Schema(description = "缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@@ -135,12 +139,16 @@
private LocalDateTime createTime;
@Schema(description = "鍋滃伐鍘嗗彶璁板綍")
+ // 瀵煎嚭 Excel 鏃朵笉鏀寔 List 瀛楁锛岃繖閲屾敼鐢� JsonConvert 杞垚 JSON 鏂囨湰锛岄伩鍏嶅鍑烘帴鍙� 500
+ @ExcelProperty(value = "鍋滃伐鍘嗗彶璁板綍", converter = JsonConvert.class)
private List<MesProTaskPauseRecordRespVO> pauseRecords;
@Schema(description = "鎸囧畾鎶ュ伐浜哄憳 ID 闆嗗悎")
+ @ExcelProperty(value = "鎸囧畾鎶ュ伐浜哄憳ID", converter = JsonConvert.class)
private List<Long> assigneeUserIds;
@Schema(description = "鎸囧畾鎶ュ伐浜哄憳濮撳悕闆嗗悎")
+ @ExcelProperty(value = "鎸囧畾鎶ュ伐浜哄憳濮撳悕", converter = JsonConvert.class)
private List<String> assigneeUserNames;
@Schema(description = "鏄惁鎶ュ伐瀹℃壒")
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplateRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplateRespVO.java
index ea5932c..afad846 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplateRespVO.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplateRespVO.java
@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo;
+import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -26,7 +27,7 @@
private String name;
@Schema(description = "妫�娴嬬绫�", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1, 3]")
- @ExcelProperty("妫�娴嬬绫�")
+ @ExcelProperty(value = "妫�娴嬬绫�", converter = JsonConvert.class)
private List<Integer> types;
@Schema(description = "鐘舵��", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@@ -42,3 +43,4 @@
private LocalDateTime createTime;
}
+
--
Gitblit v1.9.3