抢购物品数据库表里增加当前一页

This commit is contained in:
2026-05-30 11:58:41 +08:00
parent 4fb389ea3a
commit cfcbde95dd
7 changed files with 66 additions and 12 deletions

View File

@@ -71,6 +71,10 @@ public class LbGoods implements Serializable {
@Schema(description = "状态")
private Integer status;
@TableField("current_page")
@Schema(description = "当前页码(同步来源页)")
private Integer currentPage;
@TableField("created_at")
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@@ -300,6 +300,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
continue;
}
row.setTenantId(tid);
row.setCurrentPage(page);
applyDefaults(row);
if (row.getCreatedAt() == null) {
row.setCreatedAt(now);
@@ -471,10 +472,10 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
entity.setTotalMoney(BigDecimal.ZERO);
}
if (entity.getIsShow() == null) {
entity.setIsShow(1);
entity.setIsShow(-1);
}
if (entity.getStatus() == null) {
entity.setStatus(1);
entity.setStatus(-1);
}
}

View File

@@ -97,10 +97,10 @@ public class LbPurchaseApplyServiceImpl
/** 试用期包含的工作日天数(周一至周五),周六日不计入。 */
private static final int TRIAL_WEEKDAY_COUNT = 3;
/** 同事特权开通提醒中「特权开通日期」包含的工作日天数(与 syncHxrAdminColleagueVip 的 viptime 规则一致)。 */
/** 同事特权开通提醒中「特权开通日期」包含的工作日天数(开通日次日顺延至工作日起算,共 2 个工作日)。 */
private static final int COLLEAGUE_PRIVILEGE_WEEKDAY_COUNT = 2;
private static final String COLLEAGUE_VIP_GROUP_LABEL = "开通特权提醒";
private static final String COLLEAGUE_VIP_GROUP_LABEL = "特权提醒";
private static final String PARSE_SYSTEM_PROMPT = """
你是信息抽取助手。用户会提供一段「进货申请」相关的自然语言订货信息。
@@ -1090,7 +1090,7 @@ public class LbPurchaseApplyServiceImpl
CellStyle groupStyle = createGroupStyle(workbook);
CellStyle dataStyle = createDataStyle(workbook);
String[] headers = {"", "昵称", "手机号", "特权开通日期", "开通日期"};
String[] headers = {"提醒", "昵称", "手机号", "特权开通日期", "开通日期"};
Row headerRow = sheet.createRow(0);
headerRow.setHeightInPoints(22);
for (int i = 0; i < headers.length; i++) {
@@ -1106,12 +1106,12 @@ public class LbPurchaseApplyServiceImpl
createExportCell(row, 1, formatColleagueVipNickname(item), dataStyle);
createExportCell(row, 2, nullToEmpty(item.getColleaguePhone()), dataStyle);
createExportCell(row, 3, formatColleaguePrivilegeRange(item.getApplyDate()), dataStyle);
createExportCell(row, 4, formatActivationDate(item.getApplyDate()), dataStyle);
createExportCell(row, 4, formatColleagueVipActivationDate(item.getApplyDate()), dataStyle);
rowIndex++;
}
int groupEndRow = rowIndex - 1;
Row firstRow = sheet.getRow(groupStartRow);
createExportCell(firstRow, 0, COLLEAGUE_VIP_GROUP_LABEL, groupStyle);
createExportCell(firstRow, 0, "特权开通", groupStyle);
if (groupEndRow > groupStartRow) {
sheet.addMergedRegion(new CellRangeAddress(groupStartRow, groupEndRow, 0, 0));
}
@@ -1119,7 +1119,7 @@ public class LbPurchaseApplyServiceImpl
adjustExportColumnWidths(sheet, headers);
String filename = "开通特权提醒_" + LocalDateTime.now().format(EXPORT_FILENAME_TS) + ".xlsx";
String filename = "特权提醒_" + LocalDateTime.now().format(EXPORT_FILENAME_TS) + ".xlsx";
String encoded = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@@ -1219,12 +1219,42 @@ public class LbPurchaseApplyServiceImpl
return item.getApplyUser() == null ? "" : item.getApplyUser().trim();
}
/** 同事特权「开通日期」:申请日加 1 个自然日,若落在周六日则顺延到下一工作日。 */
private static LocalDate computeColleagueVipActivationDate(LocalDate applyDate) {
if (applyDate == null || applyDate.equals(LocalDate.MIN)) {
return null;
}
return firstWeekdayOnOrAfter(applyDate.plusDays(1));
}
/** 同事特权「特权开通日期」起点:开通日加 1 个自然日,若落在周六日则顺延到下一工作日。 */
private static LocalDate computeColleagueVipPrivilegeStart(LocalDate activationDate) {
if (activationDate == null) {
return null;
}
return firstWeekdayOnOrAfter(activationDate.plusDays(1));
}
private static String formatColleagueVipActivationDate(LocalDate applyDate) {
LocalDate activation = computeColleagueVipActivationDate(applyDate);
if (activation == null) {
return "";
}
return activation.getYear() + "/" + activation.getMonthValue() + "/" + activation.getDayOfMonth();
}
private static String formatColleaguePrivilegeRange(LocalDate applyDate) {
if (applyDate == null) {
return "";
}
LocalDate start = firstWeekdayOnOrAfter(applyDate);
LocalDate activation = computeColleagueVipActivationDate(applyDate);
if (activation == null) {
return "";
}
LocalDate start = computeColleagueVipPrivilegeStart(activation);
LocalDate endDate = endOfInclusiveWeekdaySpan(start, COLLEAGUE_PRIVILEGE_WEEKDAY_COUNT, null);
start = start.minusDays(1);
endDate = endDate.minusDays(1);
return start.format(PRIVILEGE_RANGE_FMT) + "-" + endDate.format(PRIVILEGE_RANGE_FMT);
}