|
@@ -318,7 +318,7 @@ public Result<OctopusKeyPerson> addKeyPerson(Long userId, String name, String or
|
|
|
kp.setDepartment(department != null ? department.trim() : null);
|
|
kp.setDepartment(department != null ? department.trim() : null);
|
|
|
kp.setTitle(title != null ? title.trim() : null);
|
|
kp.setTitle(title != null ? title.trim() : null);
|
|
|
kp.setFirstMeetScene(firstMeetScene != null ? firstMeetScene.trim() : null);
|
|
kp.setFirstMeetScene(firstMeetScene != null ? firstMeetScene.trim() : null);
|
|
|
- kp.setFirstMeetTime(firstMeetTime != null ? java.sql.Timestamp.valueOf(firstMeetTime) : null);
|
|
|
|
|
|
|
+ kp.setFirstMeetTime(parseFlexibleTimestamp(firstMeetTime));
|
|
|
kp.setKnowWay(knowWay != null ? knowWay.trim() : null);
|
|
kp.setKnowWay(knowWay != null ? knowWay.trim() : null);
|
|
|
kp.setContactInfo(contactInfo != null ? contactInfo.trim() : null);
|
|
kp.setContactInfo(contactInfo != null ? contactInfo.trim() : null);
|
|
|
kp.setReferrerId(referrerId);
|
|
kp.setReferrerId(referrerId);
|
|
@@ -327,6 +327,34 @@ public Result<OctopusKeyPerson> addKeyPerson(Long userId, String name, String or
|
|
|
return Result.success(kp);
|
|
return Result.success(kp);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 宽松解析首次见面时间,兼容前端实际发送的三种格式:
|
|
|
|
|
+ * - 仅日期 "2026-10-10"(小程序 date picker)
|
|
|
|
|
+ * - ISO 8601 "2026-10-10T14:30:00" / 带毫秒 "2026-10-10T14:30:00.123"
|
|
|
|
|
+ * - MySQL/Timestamp.toString 风格 "2026-10-10 14:30:00" / "2026-10-10 14:30:00.0"
|
|
|
|
|
+ * 空值/解析失败返回 null(字段为选填,沿用 addEffect 对 happenedAt 的宽容处理)。
|
|
|
|
|
+ */
|
|
|
|
|
+ private java.util.Date parseFlexibleTimestamp(String s) {
|
|
|
|
|
+ if (s == null) return null;
|
|
|
|
|
+ s = s.trim();
|
|
|
|
|
+ if (s.isEmpty()) return null;
|
|
|
|
|
+ String[] patterns = {
|
|
|
|
|
+ "yyyy-MM-dd'T'HH:mm:ss.SSS",
|
|
|
|
|
+ "yyyy-MM-dd'T'HH:mm:ss",
|
|
|
|
|
+ "yyyy-MM-dd HH:mm:ss.SSS",
|
|
|
|
|
+ "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
+ "yyyy-MM-dd"
|
|
|
|
|
+ };
|
|
|
|
|
+ for (String p : patterns) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(p);
|
|
|
|
|
+ sdf.setLenient(false);
|
|
|
|
|
+ return new java.sql.Timestamp(sdf.parse(s).getTime());
|
|
|
|
|
+ } catch (Exception ignored) { /* 尝试下一种格式 */ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public Result<OctopusKeyPerson> updateKeyPerson(Long userId, Long id, Map<String, Object> params) {
|
|
public Result<OctopusKeyPerson> updateKeyPerson(Long userId, Long id, Map<String, Object> params) {
|
|
|
OctopusKeyPerson kp = keyPersonMapper.selectById(id);
|
|
OctopusKeyPerson kp = keyPersonMapper.selectById(id);
|
|
|
if (kp == null || !kp.getUserId().equals(userId)) {
|
|
if (kp == null || !kp.getUserId().equals(userId)) {
|