抢购物品数据库表里增加当前一页
This commit is contained in:
@@ -71,6 +71,10 @@ public class LbGoods implements Serializable {
|
|||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@TableField("current_page")
|
||||||
|
@Schema(description = "当前页码(同步来源页)")
|
||||||
|
private Integer currentPage;
|
||||||
|
|
||||||
@TableField("created_at")
|
@TableField("created_at")
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
row.setTenantId(tid);
|
row.setTenantId(tid);
|
||||||
|
row.setCurrentPage(page);
|
||||||
applyDefaults(row);
|
applyDefaults(row);
|
||||||
if (row.getCreatedAt() == null) {
|
if (row.getCreatedAt() == null) {
|
||||||
row.setCreatedAt(now);
|
row.setCreatedAt(now);
|
||||||
@@ -471,10 +472,10 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
|||||||
entity.setTotalMoney(BigDecimal.ZERO);
|
entity.setTotalMoney(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if (entity.getIsShow() == null) {
|
if (entity.getIsShow() == null) {
|
||||||
entity.setIsShow(1);
|
entity.setIsShow(-1);
|
||||||
}
|
}
|
||||||
if (entity.getStatus() == null) {
|
if (entity.getStatus() == null) {
|
||||||
entity.setStatus(1);
|
entity.setStatus(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ public class LbPurchaseApplyServiceImpl
|
|||||||
/** 试用期包含的工作日天数(周一至周五),周六日不计入。 */
|
/** 试用期包含的工作日天数(周一至周五),周六日不计入。 */
|
||||||
private static final int TRIAL_WEEKDAY_COUNT = 3;
|
private static final int TRIAL_WEEKDAY_COUNT = 3;
|
||||||
|
|
||||||
/** 同事特权开通提醒中「特权开通日期」包含的工作日天数(与 syncHxrAdminColleagueVip 的 viptime 规则一致)。 */
|
/** 同事特权开通提醒中「特权开通日期」包含的工作日天数(开通日次日顺延至工作日起算,共 2 个工作日)。 */
|
||||||
private static final int COLLEAGUE_PRIVILEGE_WEEKDAY_COUNT = 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 = """
|
private static final String PARSE_SYSTEM_PROMPT = """
|
||||||
你是信息抽取助手。用户会提供一段「进货申请」相关的自然语言订货信息。
|
你是信息抽取助手。用户会提供一段「进货申请」相关的自然语言订货信息。
|
||||||
@@ -1090,7 +1090,7 @@ public class LbPurchaseApplyServiceImpl
|
|||||||
CellStyle groupStyle = createGroupStyle(workbook);
|
CellStyle groupStyle = createGroupStyle(workbook);
|
||||||
CellStyle dataStyle = createDataStyle(workbook);
|
CellStyle dataStyle = createDataStyle(workbook);
|
||||||
|
|
||||||
String[] headers = {"", "昵称", "手机号", "特权开通日期", "开通日期"};
|
String[] headers = {"提醒", "昵称", "手机号", "特权开通日期", "开通日期"};
|
||||||
Row headerRow = sheet.createRow(0);
|
Row headerRow = sheet.createRow(0);
|
||||||
headerRow.setHeightInPoints(22);
|
headerRow.setHeightInPoints(22);
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (int i = 0; i < headers.length; i++) {
|
||||||
@@ -1106,12 +1106,12 @@ public class LbPurchaseApplyServiceImpl
|
|||||||
createExportCell(row, 1, formatColleagueVipNickname(item), dataStyle);
|
createExportCell(row, 1, formatColleagueVipNickname(item), dataStyle);
|
||||||
createExportCell(row, 2, nullToEmpty(item.getColleaguePhone()), dataStyle);
|
createExportCell(row, 2, nullToEmpty(item.getColleaguePhone()), dataStyle);
|
||||||
createExportCell(row, 3, formatColleaguePrivilegeRange(item.getApplyDate()), dataStyle);
|
createExportCell(row, 3, formatColleaguePrivilegeRange(item.getApplyDate()), dataStyle);
|
||||||
createExportCell(row, 4, formatActivationDate(item.getApplyDate()), dataStyle);
|
createExportCell(row, 4, formatColleagueVipActivationDate(item.getApplyDate()), dataStyle);
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
int groupEndRow = rowIndex - 1;
|
int groupEndRow = rowIndex - 1;
|
||||||
Row firstRow = sheet.getRow(groupStartRow);
|
Row firstRow = sheet.getRow(groupStartRow);
|
||||||
createExportCell(firstRow, 0, COLLEAGUE_VIP_GROUP_LABEL, groupStyle);
|
createExportCell(firstRow, 0, "特权开通", groupStyle);
|
||||||
if (groupEndRow > groupStartRow) {
|
if (groupEndRow > groupStartRow) {
|
||||||
sheet.addMergedRegion(new CellRangeAddress(groupStartRow, groupEndRow, 0, 0));
|
sheet.addMergedRegion(new CellRangeAddress(groupStartRow, groupEndRow, 0, 0));
|
||||||
}
|
}
|
||||||
@@ -1119,7 +1119,7 @@ public class LbPurchaseApplyServiceImpl
|
|||||||
|
|
||||||
adjustExportColumnWidths(sheet, headers);
|
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");
|
String encoded = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
@@ -1219,12 +1219,42 @@ public class LbPurchaseApplyServiceImpl
|
|||||||
return item.getApplyUser() == null ? "" : item.getApplyUser().trim();
|
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) {
|
private static String formatColleaguePrivilegeRange(LocalDate applyDate) {
|
||||||
if (applyDate == null) {
|
if (applyDate == null) {
|
||||||
return "";
|
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);
|
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);
|
return start.format(PRIVILEGE_RANGE_FMT) + "-" + endDate.format(PRIVILEGE_RANGE_FMT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,14 @@
|
|||||||
<insert id="upsertBatch">
|
<insert id="upsertBatch">
|
||||||
INSERT INTO lb_goods (
|
INSERT INTO lb_goods (
|
||||||
id, tenant_id, old_id, user_id, title, image, price, total_money,
|
id, tenant_id, old_id, user_id, title, image, price, total_money,
|
||||||
quantity, seller_id, is_show, status, created_at, updated_at
|
quantity, seller_id, is_show, status, current_page, created_at, updated_at
|
||||||
) VALUES
|
) VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.id}, #{item.tenantId}, #{item.oldId}, #{item.userId}, #{item.title},
|
#{item.id}, #{item.tenantId}, #{item.oldId}, #{item.userId}, #{item.title},
|
||||||
#{item.image}, #{item.price}, #{item.totalMoney}, #{item.quantity},
|
#{item.image}, #{item.price}, #{item.totalMoney}, #{item.quantity},
|
||||||
#{item.sellerId}, #{item.isShow}, #{item.status}, #{item.createdAt}, #{item.updatedAt}
|
#{item.sellerId}, #{item.isShow}, #{item.status}, #{item.currentPage},
|
||||||
|
#{item.createdAt}, #{item.updatedAt}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
seller_id = VALUES(seller_id),
|
seller_id = VALUES(seller_id),
|
||||||
is_show = VALUES(is_show),
|
is_show = VALUES(is_show),
|
||||||
status = VALUES(status),
|
status = VALUES(status),
|
||||||
|
current_page = VALUES(current_page),
|
||||||
created_at = VALUES(created_at),
|
created_at = VALUES(created_at),
|
||||||
updated_at = VALUES(updated_at)
|
updated_at = VALUES(updated_at)
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ CREATE TABLE `lb_goods` (
|
|||||||
`quantity` VARCHAR(64) DEFAULT NULL COMMENT '数量描述(如:≈6盒)',
|
`quantity` VARCHAR(64) DEFAULT NULL COMMENT '数量描述(如:≈6盒)',
|
||||||
`seller_id` BIGINT DEFAULT NULL COMMENT '卖家用户ID',
|
`seller_id` BIGINT DEFAULT NULL COMMENT '卖家用户ID',
|
||||||
`is_show` TINYINT NOT NULL DEFAULT 1 COMMENT '是否展示:0否 1是',
|
`is_show` TINYINT NOT NULL DEFAULT 1 COMMENT '是否展示:0否 1是',
|
||||||
`status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态',
|
`status` TINYINT NOT NULL DEFAULT -1 COMMENT '状态',
|
||||||
|
`current_page` INT DEFAULT NULL COMMENT '当前页码(同步来源页)',
|
||||||
`created_at` DATETIME DEFAULT NULL COMMENT '创建时间',
|
`created_at` DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||||
`updated_at` DATETIME DEFAULT NULL COMMENT '更新时间',
|
`updated_at` DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
|||||||
8
src/main/sql/lb_goods_alter_add_current_page.sql
Normal file
8
src/main/sql/lb_goods_alter_add_current_page.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 升级脚本:为 lb_goods 表增加 current_page 列
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE `lb_goods`
|
||||||
|
ADD COLUMN `current_page` INT NULL DEFAULT NULL COMMENT '当前页码(同步来源页)' AFTER `status`;
|
||||||
8
src/main/sql/lb_goods_alter_status_default_minus_one.sql
Normal file
8
src/main/sql/lb_goods_alter_status_default_minus_one.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 升级脚本:lb_goods.status 默认值改为 -1
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE `lb_goods`
|
||||||
|
MODIFY COLUMN `status` TINYINT NOT NULL DEFAULT -1 COMMENT '状态';
|
||||||
Reference in New Issue
Block a user