|
@@ -259,50 +259,15 @@ public class FsCourseFinishTempServiceImpl implements IFsCourseFinishTempService
|
|
|
|
|
|
// 3. 检查是否需要更新
|
|
|
boolean shouldUpdate = true;
|
|
|
- int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
|
|
-
|
|
|
- // Convert input dates to full YYYYMMDD format
|
|
|
- String fullMonthDay = String.valueOf(currentYear) + monthDay; // becomes YYYYMMDD
|
|
|
- String fullDayOfMonth = String.valueOf(currentYear) +
|
|
|
- String.format("%02d", Calendar.getInstance().get(Calendar.MONTH) + 1) +
|
|
|
- String.format("%02d", Integer.parseInt(dayOfMonth));
|
|
|
|
|
|
for (String mark : allOldMarks) {
|
|
|
- Matcher numMatcher = Pattern.compile("\\*(\\d{1,4})完").matcher(mark);
|
|
|
- if (numMatcher.find()) {
|
|
|
- String numStr = numMatcher.group(1);
|
|
|
- String fullOldDate;
|
|
|
-
|
|
|
- if (numStr.length() <= 2) { // 处理 "*D完" 格式
|
|
|
-
|
|
|
- int day = Integer.parseInt(numStr);
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
- int currentMonth = cal.get(Calendar.MONTH) + 1;
|
|
|
- int currentDay = cal.get(Calendar.DAY_OF_MONTH);
|
|
|
- int year = cal.get(Calendar.YEAR);
|
|
|
-
|
|
|
- // 获取上个月的最大天数
|
|
|
- int prevMonth = (currentMonth == 1) ? 12 : currentMonth - 1;
|
|
|
- int prevYear = (currentMonth == 1) ? year - 1 : year;
|
|
|
- cal.set(prevYear, prevMonth - 1, 1); // Calendar 月份是 0-based
|
|
|
- int maxDaysInPrevMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
|
|
-
|
|
|
- // 如果 day > 上个月的天数,说明是上个月的日期
|
|
|
- if (day > maxDaysInPrevMonth || day > currentDay + 7) {
|
|
|
- currentMonth = prevMonth;
|
|
|
- year = prevYear;
|
|
|
- }
|
|
|
-
|
|
|
- fullOldDate = String.format("%04d%02d%02d", year, currentMonth, day);
|
|
|
-
|
|
|
- // 比较日期
|
|
|
- if (Integer.parseInt(fullOldDate) >= Integer.parseInt(fullMonthDay) ||
|
|
|
- Integer.parseInt(fullOldDate) >= Integer.parseInt(fullDayOfMonth)) {
|
|
|
- shouldUpdate = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
+ String normalizedOldMark = normalizeMarkFormat(mark);
|
|
|
+ // 直接比较字符串是否相等
|
|
|
+ if (normalizedOldMark.equals(newNotes) ||
|
|
|
+ normalizedOldMark.equals(newNotesDay)) {
|
|
|
+ shouldUpdate = false;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -349,7 +314,7 @@ public class FsCourseFinishTempServiceImpl implements IFsCourseFinishTempService
|
|
|
|
|
|
break;
|
|
|
} else {
|
|
|
- if (attempt==2 && (qwResult.getErrcode() == 45033 || qwResult.getErrcode()== -1 || qwResult.getErrcode()== 60020)) {
|
|
|
+ if (attempt==2 && (qwResult.getErrcode() == 45033 || qwResult.getErrcode()== -1 || qwResult.getErrcode()== 60020 )) {
|
|
|
QwCourseFinishRemarkRty remarkRty=new QwCourseFinishRemarkRty();
|
|
|
remarkRty.setQwUserId(externalContact.getUserId());
|
|
|
remarkRty.setCorpId(externalContact.getCorpId());
|
|
@@ -385,6 +350,33 @@ public class FsCourseFinishTempServiceImpl implements IFsCourseFinishTempService
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 标准化标记格式,将不同格式统一为标准格式
|
|
|
+ * 例如: "*5完" -> "*05完", "*305完" -> "*0305完" (如果是3位数字)
|
|
|
+ */
|
|
|
+ private String normalizeMarkFormat(String mark) {
|
|
|
+ Matcher matcher = Pattern.compile("\\*(\\d{1,4})完").matcher(mark);
|
|
|
+ if (matcher.find()) {
|
|
|
+ String digits = matcher.group(1);
|
|
|
+
|
|
|
+ // 根据数字长度进行标准化
|
|
|
+ switch (digits.length()) {
|
|
|
+ case 1: // "*D完" -> "*0D完"
|
|
|
+ return "*0" + digits + "完";
|
|
|
+ case 2: // "*DD完" -> 保持不变
|
|
|
+ return mark;
|
|
|
+ case 3: // "*DDD完" -> 可能是 "*MDD完" 或 "*DDM完",统一为4位
|
|
|
+ // 假设是月日格式,补零到4位 "*0MDD完"
|
|
|
+ return "*0" + digits + "完";
|
|
|
+ case 4: // "*MMDD完" -> 保持不变
|
|
|
+ return mark;
|
|
|
+ default:
|
|
|
+ return mark;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mark;
|
|
|
+ }
|
|
|
+
|
|
|
// @Override
|
|
|
// public void updateFsCourseFinishTempByCompanyUserId() {
|
|
|
// List<FsCourseFinishTemp> fsCourseFinishTemps = fsCourseFinishTempMapper.selectFsCourseFinishTempByCompanyList();
|