feat:
1. add merchant trade module
This commit is contained in:
@@ -3,7 +3,6 @@ alter table merchant_application
|
||||
alter table merchant_application
|
||||
drop column wechat_account;
|
||||
|
||||
|
||||
drop table if exists merchant_payout_account;
|
||||
create table merchant_payout_account
|
||||
(
|
||||
@@ -23,8 +22,6 @@ create table merchant_payout_account
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
create index idx_merchant_payout_account_user_id on merchant_payout_account (user_id) where is_deleted = 0;
|
||||
|
||||
|
||||
comment on table merchant_payout_account is '商家收款资料表';
|
||||
comment on column merchant_payout_account.id is '主键';
|
||||
comment on column merchant_payout_account.user_id is '用户id';
|
||||
@@ -40,3 +37,249 @@ comment on column merchant_payout_account.update_user is '修改人';
|
||||
comment on column merchant_payout_account.update_time is '修改时间';
|
||||
comment on column merchant_payout_account.status is '状态';
|
||||
comment on column merchant_payout_account.is_deleted is '是否已删除';
|
||||
|
||||
|
||||
drop table if exists market_daily_summary;
|
||||
CREATE TABLE market_daily_summary
|
||||
(
|
||||
-- 主键(可选,用于 ORM)
|
||||
id int8 not null primary key,
|
||||
|
||||
-- 用户基础信息
|
||||
user_id int8 not null,
|
||||
user_account VARCHAR(64) NOT NULL DEFAULT '',
|
||||
user_name VARCHAR(128) NOT NULL DEFAULT '',
|
||||
stat_date DATE NOT NULL, -- 统计日期,如 '2026-04-29'
|
||||
|
||||
-- === 直推 & 团队 ===
|
||||
direct_referral_count int4 NOT NULL DEFAULT 0, -- 直推人数(累计)
|
||||
new_direct_referral_count int4 NOT NULL DEFAULT 0, -- 当日新增直推人数
|
||||
team_total_count int4 NOT NULL DEFAULT 0, -- 团队人数(累计)
|
||||
new_team_count int4 NOT NULL DEFAULT 0, -- 当日新增团队人数
|
||||
|
||||
-- === 福利值 ===
|
||||
total_benefits_value decimal(18, 2) NOT NULL DEFAULT 0.00, -- 总福利值
|
||||
increase_benefits_value decimal(18, 2) NOT NULL DEFAULT 0.00, -- 当日新增福利值
|
||||
|
||||
-- === 直推人福利包相关 ===
|
||||
direct_with_benefit_package_count int4 NOT NULL DEFAULT 0, -- 当日持有福利包的直推人数
|
||||
direct_new_benefit_packages JSONB NOT NULL DEFAULT '[]', -- 当日直推人新增的福利包明细(数组)
|
||||
direct_benefit_package_face_total decimal(18, 2) NOT NULL DEFAULT 0.00, -- 直推人福利包面值总和
|
||||
direct_accelerated_value decimal(18, 2) NOT NULL DEFAULT 0.00, -- 直推人福利包可提供加速的值(排除后台划拨)
|
||||
benefit_level int2 NOT NULL DEFAULT 0, -- 当日福利积分系统等级
|
||||
|
||||
-- === 直推人现金下单相关 ===
|
||||
cash_order_direct_count int4 NOT NULL DEFAULT 0, -- 当日现金下单的直推人数
|
||||
cash_order_direct_amount decimal(18, 2) NOT NULL DEFAULT 0.00, -- 当日直推人现金下单金额
|
||||
cash_dividend_eligible_direct decimal(18, 2) NOT NULL DEFAULT 0.00, -- 直推人可提供的现金分红金额(排除线下支付)
|
||||
commission_level int2 NOT NULL DEFAULT 0, -- 当日佣金分红系统等级
|
||||
|
||||
-- === 自己福利包相关 ===
|
||||
self_new_benefit_packages JSONB NOT NULL DEFAULT '[]', -- 当日自己新增福利包(明细数组)
|
||||
self_new_benefit_face_value decimal(18, 2) NOT NULL DEFAULT 0.00, -- 当日自己新增福利包面值
|
||||
self_accelerated_value decimal(18, 2) NOT NULL DEFAULT 0.00, -- 自己新增福利包可提供加速的值
|
||||
total_remaining_benefit_face decimal(18, 2) NOT NULL DEFAULT 0.00, -- 福利包总剩余面值
|
||||
total_accelerated_by_packages decimal(18, 2) NOT NULL DEFAULT 0.00, -- 福利包加速了多少值(累计)
|
||||
|
||||
-- === 自己现金消费相关 ===
|
||||
cash_commission_paid decimal(18, 2) NOT NULL DEFAULT 0.00, -- 现金分红了多少(即佣金)
|
||||
self_cash_consumption_amount decimal(18, 2) NOT NULL DEFAULT 0.00, -- 当日现金消费金额(排除线下支付)
|
||||
self_cash_dividend_eligible decimal(18, 2) NOT NULL DEFAULT 0.00, -- 自己可提供分红的金额(排除线下支付)
|
||||
|
||||
-- 时间戳
|
||||
remark varchar(255) not null default '',
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4,
|
||||
is_deleted int4 default 0,
|
||||
UNIQUE (user_id, stat_date)
|
||||
|
||||
);
|
||||
-- 核心索引
|
||||
CREATE INDEX idx_user_daily_summary_stat_date ON market_daily_summary (stat_date);
|
||||
CREATE INDEX idx_user_daily_summary_user_id ON market_daily_summary (user_id);
|
||||
CREATE INDEX idx_user_daily_summary_update_time ON market_daily_summary (update_time);
|
||||
|
||||
-- 如需查询 JSON 内容,可加 GIN 索引(按需)
|
||||
CREATE INDEX idx_direct_new_benefit_packages ON market_daily_summary USING GIN (direct_new_benefit_packages);
|
||||
CREATE INDEX idx_self_new_benefit_packages ON market_daily_summary USING GIN (self_new_benefit_packages);
|
||||
|
||||
comment on table market_daily_summary is '用户日汇总表';
|
||||
COMMENT ON COLUMN market_daily_summary.id IS '主键';
|
||||
COMMENT ON COLUMN market_daily_summary.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN market_daily_summary.user_account IS '用户账号';
|
||||
COMMENT ON COLUMN market_daily_summary.user_name IS '用户姓名';
|
||||
COMMENT ON COLUMN market_daily_summary.stat_date IS '统计日期,如 ''2026-04-29''';
|
||||
|
||||
-- === 直推 & 团队 ===
|
||||
COMMENT ON COLUMN market_daily_summary.direct_referral_count IS '直推人数(累计)';
|
||||
COMMENT ON COLUMN market_daily_summary.new_direct_referral_count IS '当日新增直推人数';
|
||||
COMMENT ON COLUMN market_daily_summary.team_total_count IS '团队人数(累计)';
|
||||
COMMENT ON COLUMN market_daily_summary.new_team_count IS '当日新增团队人数';
|
||||
|
||||
-- === 福利值 ===
|
||||
COMMENT ON COLUMN market_daily_summary.total_benefits_value IS '总福利值';
|
||||
COMMENT ON COLUMN market_daily_summary.increase_benefits_value IS '当日新增福利值';
|
||||
|
||||
-- === 直推人福利包相关 ===
|
||||
COMMENT ON COLUMN market_daily_summary.direct_with_benefit_package_count IS '当日持有福利包的直推人数';
|
||||
COMMENT ON COLUMN market_daily_summary.direct_new_benefit_packages IS '当日直推人新增的福利包明细(数组)';
|
||||
COMMENT ON COLUMN market_daily_summary.direct_benefit_package_face_total IS '直推人福利包面值总和';
|
||||
COMMENT ON COLUMN market_daily_summary.direct_accelerated_value IS '直推人福利包可提供加速的值(排除后台划拨)';
|
||||
COMMENT ON COLUMN market_daily_summary.benefit_level IS '当日福利积分系统等级';
|
||||
|
||||
-- === 直推人现金下单相关 ===
|
||||
COMMENT ON COLUMN market_daily_summary.cash_order_direct_count IS '当日现金下单的直推人数';
|
||||
COMMENT ON COLUMN market_daily_summary.cash_order_direct_amount IS '当日直推人现金下单金额';
|
||||
COMMENT ON COLUMN market_daily_summary.cash_dividend_eligible_direct IS '直推人可提供的现金分红金额(排除线下支付)';
|
||||
COMMENT ON COLUMN market_daily_summary.commission_level IS '当日佣金分红系统等级';
|
||||
|
||||
-- === 自己福利包相关 ===
|
||||
COMMENT ON COLUMN market_daily_summary.self_new_benefit_packages IS '当日自己新增福利包(明细数组)';
|
||||
COMMENT ON COLUMN market_daily_summary.self_new_benefit_face_value IS '当日自己新增福利包面值';
|
||||
COMMENT ON COLUMN market_daily_summary.self_accelerated_value IS '自己新增福利包可提供加速的值';
|
||||
COMMENT ON COLUMN market_daily_summary.total_remaining_benefit_face IS '福利包总剩余面值';
|
||||
COMMENT ON COLUMN market_daily_summary.total_accelerated_by_packages IS '福利包加速了多少值(累计)';
|
||||
|
||||
-- === 自己现金消费相关 ===
|
||||
COMMENT ON COLUMN market_daily_summary.cash_commission_paid IS '现金分红了多少(即佣金)';
|
||||
COMMENT ON COLUMN market_daily_summary.self_cash_consumption_amount IS '当日现金消费金额(排除线下支付)';
|
||||
COMMENT ON COLUMN market_daily_summary.self_cash_dividend_eligible IS '自己可提供分红的金额(排除线下支付)';
|
||||
|
||||
-- 时间戳
|
||||
comment on column market_daily_summary.remark is '备注';
|
||||
comment on column market_daily_summary.create_user is '创建人';
|
||||
comment on column market_daily_summary.create_dept is '创建部门';
|
||||
comment on column market_daily_summary.create_time is '创建时间';
|
||||
comment on column market_daily_summary.update_user is '修改人';
|
||||
comment on column market_daily_summary.update_time is '修改时间';
|
||||
comment on column market_daily_summary.status is '状态';
|
||||
comment on column market_daily_summary.is_deleted is '是否已删除';
|
||||
|
||||
|
||||
drop table if exists market_merchant_order;
|
||||
CREATE TABLE market_merchant_order
|
||||
(
|
||||
id int8 not null primary key,
|
||||
user_id int8 not null,
|
||||
seller_id int8 not null,
|
||||
product_name varchar(255) not null default '',
|
||||
product_id int8 not null,
|
||||
thumb_image_url text not null,
|
||||
inventory_id int8 not null,
|
||||
store_name varchar(255) not null,
|
||||
unit_price decimal(10, 2) default 0.00 not null,
|
||||
gift_type int4 default 0 NOT NULL,
|
||||
unit_gift_amount decimal(10, 2) default 0.00 not null,
|
||||
quantity int2 default 0 not null,
|
||||
total_amount decimal(10, 2) default 0.00 not null,
|
||||
total_gift_amount decimal(10, 2) default 0.00 not null,
|
||||
payout_account_id int8 not null,
|
||||
account_type int4 not null default -1,
|
||||
account_number varchar(255) not null default '',
|
||||
account_url text not null default '',
|
||||
account_holder_name varchar(255) default '' not null,
|
||||
consignee_phone varchar(128) NOT NULL,
|
||||
consignee varchar(128) NOT NULL,
|
||||
delivery_address text not null,
|
||||
payment_voucher_url text not null,
|
||||
express_no VARCHAR(100) NULL,
|
||||
remark varchar(255) not null default '',
|
||||
version int4 not null default 0,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_market_merchant_order_user_id ON market_merchant_order (user_id) where is_deleted = 0;
|
||||
CREATE INDEX idx_market_merchant_order_seller_id ON market_merchant_order (seller_id) where is_deleted = 0;
|
||||
CREATE INDEX idx_market_merchant_order_product_id ON market_merchant_order (product_id) where is_deleted = 0;
|
||||
CREATE INDEX idx_market_merchant_order_inventory_id ON market_merchant_order (inventory_id) where is_deleted = 0;
|
||||
|
||||
|
||||
COMMENT ON TABLE market_merchant_order IS '自营商家订单';
|
||||
COMMENT ON COLUMN market_merchant_order.id IS '主键';
|
||||
COMMENT ON COLUMN market_merchant_order.user_id IS '下单用户ID';
|
||||
COMMENT ON COLUMN market_merchant_order.seller_id IS '商家ID';
|
||||
COMMENT ON COLUMN market_merchant_order.product_name IS '商品名称';
|
||||
COMMENT ON COLUMN market_merchant_order.product_id IS '商品ID';
|
||||
COMMENT ON COLUMN market_merchant_order.thumb_image_url IS '商品缩略图URL';
|
||||
COMMENT ON COLUMN market_merchant_order.inventory_id IS '库存ID(或SKU ID)';
|
||||
COMMENT ON COLUMN market_merchant_order.store_name IS '店铺名称';
|
||||
COMMENT ON COLUMN market_merchant_order.unit_price IS '商品单价';
|
||||
COMMENT ON COLUMN market_merchant_order.gift_type IS '赠品类型(1:福利积分, 2:现金券, 3:佣金)';
|
||||
COMMENT ON COLUMN market_merchant_order.unit_gift_amount IS '单件商品附带的赠品金额(如红包或福利值)';
|
||||
COMMENT ON COLUMN market_merchant_order.quantity IS '购买数量';
|
||||
COMMENT ON COLUMN market_merchant_order.total_amount IS '订单总金额';
|
||||
COMMENT ON COLUMN market_merchant_order.total_gift_amount IS '赠品总金额';
|
||||
COMMENT ON COLUMN market_merchant_order.payout_account_id IS '上架收款账户ID';
|
||||
COMMENT ON COLUMN market_merchant_order.account_type IS '收款账户类型(1:支付宝, 2:微信, 3:银行卡)';
|
||||
COMMENT ON COLUMN market_merchant_order.account_number IS '收款账号(银行卡号)';
|
||||
COMMENT ON COLUMN market_merchant_order.account_url IS '收款账户二维码或链接';
|
||||
COMMENT ON COLUMN market_merchant_order.account_holder_name IS '收款人姓名';
|
||||
COMMENT ON COLUMN market_merchant_order.consignee_phone IS '收货人手机号';
|
||||
COMMENT ON COLUMN market_merchant_order.consignee IS '收货人姓名';
|
||||
COMMENT ON COLUMN market_merchant_order.delivery_address IS '收货地址';
|
||||
COMMENT ON COLUMN market_merchant_order.payment_voucher_url IS '付款凭证截图URL';
|
||||
COMMENT ON COLUMN market_merchant_order.express_no IS '快递单号';
|
||||
COMMENT ON COLUMN market_merchant_order.remark IS '订单备注';
|
||||
COMMENT ON COLUMN market_merchant_order.create_user IS '创建人用户ID';
|
||||
COMMENT ON COLUMN market_merchant_order.create_dept IS '创建部门ID';
|
||||
COMMENT ON COLUMN market_merchant_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_merchant_order.update_user IS '更新人用户ID';
|
||||
COMMENT ON COLUMN market_merchant_order.update_time IS '更新时间';
|
||||
COMMENT ON COLUMN market_merchant_order.status IS '订单状态(0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款)';
|
||||
COMMENT ON COLUMN market_merchant_order.is_deleted IS '逻辑删除标志(0:未删除, 1:已删除)';
|
||||
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669598012903425', '1123598815738675201', 'dailySummary', '用户日汇总表', 'menu', '/market/daily-summary',
|
||||
NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669598012903426', '2049669598012903425', 'dailySummary_add', '新增', 'add', '/market/daily-summary/add',
|
||||
'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669598012903427', '2049669598012903425', 'dailySummary_edit', '修改', 'edit', '/market/daily-summary/edit',
|
||||
'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669598012903428', '2049669598012903425', 'dailySummary_delete', '删除', 'delete',
|
||||
'/api/blade-dailysummary/dailySummary/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669598012903429', '2049669598012903425', 'dailySummary_view', '查看', 'view', '/market/daily-summary/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669574994563074', '1123598815738675201', 'merchantOrder', '自营商家订单', 'menu', '/market/merchant-order',
|
||||
NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669574994563075', '2049669574994563074', 'merchantOrder_add', '新增', 'add', '/market/merchant-order/add',
|
||||
'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669574994563076', '2049669574994563074', 'merchantOrder_edit', '修改', 'edit',
|
||||
'/market/merchant-order/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669574994563077', '2049669574994563074', 'merchantOrder_delete', '删除', 'delete',
|
||||
'/api/blade-merchantorder/merchantOrder/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2049669574994563078', '2049669574994563074', 'merchantOrder_view', '查看', 'view',
|
||||
'/market/merchant-order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class DailyBenefitLogProcessor {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,23 +1,22 @@
|
||||
package org.springblade.modules.api.market;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.*;
|
||||
import org.springblade.modules.api.response.MerchantStatusResponse;
|
||||
import org.springblade.modules.api.vo.MarketMerchantCatalogApiVO;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
|
||||
import org.springblade.modules.market.service.IMarketMerchantApplicationService;
|
||||
import org.springblade.modules.market.service.IMerchantInventoryService;
|
||||
import org.springblade.modules.market.service.IMerchantPayoutAccountService;
|
||||
import org.springblade.modules.market.service.IMerchantCatalogService;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.market.eums.PayoutAccountType;
|
||||
import org.springblade.modules.market.service.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -38,6 +37,8 @@ public class MarketMerchantController {
|
||||
|
||||
private final IMerchantPayoutAccountService payoutAccountService;
|
||||
|
||||
private final IMerchantOrderService orderService;
|
||||
|
||||
@PostMapping("/merchant-apply")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "自营商家认证提交")
|
||||
@@ -122,4 +123,75 @@ public class MarketMerchantController {
|
||||
return R.status(inventoryService.publish(AuthUtil.getUserId(), request.getProductId(), request.getNum(), request.getPrice(), request.getGiftType(), request.getGiftAmount()));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "商品分页")
|
||||
public R<IPage<MerchantProductApiVO>> list(String shop, Query query) {
|
||||
return R.data(inventoryService.selectProductInventoryPageByShop(Condition.getPage(query), shop));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "商品详情")
|
||||
public R<MerchantProductDetailApiVO> detail(Long id) {
|
||||
return R.data(inventoryService.getDetailById(AuthUtil.getUserId(), id));
|
||||
}
|
||||
|
||||
@GetMapping("/order-list")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "买家订单分页")
|
||||
public R<IPage<MerchantOrderApiVO>> orderList(Integer status, Query query) {
|
||||
return R.data(orderService.selectOrderPageByUserId(Condition.getPage(query), AuthUtil.getUserId(), status));
|
||||
}
|
||||
|
||||
@GetMapping("/seller-order-list")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "商家订单分页")
|
||||
public R<IPage<MerchantOrderApiVO>> sellerOrderList(Integer status, Query query) {
|
||||
return R.data(orderService.selectSellerOrderPageByUserId(Condition.getPage(query), AuthUtil.getUserId(), status));
|
||||
}
|
||||
|
||||
@GetMapping("/order-detail")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "订单详情")
|
||||
public R<MerchantOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.getDetailById(AuthUtil.getUserId(), id));
|
||||
}
|
||||
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "下单")
|
||||
public R<Long> createOrder(@Valid @RequestBody CreateMerchantOrderRequest request) {
|
||||
return R.data(orderService.createOrder(AuthUtil.getUserId(), request.getItemCode(), PayoutAccountType.fromCode(request.getPaymentType()), request.getAddress(), request.getConsignee(), request.getConsigneePhone(), request.getQuantity(), request.getRemark()));
|
||||
}
|
||||
|
||||
@PostMapping("/confirm-payment")
|
||||
@ApiOperationSupport(order = 14)
|
||||
@Operation(summary = "确认支付")
|
||||
public R confirmPayment(@Valid @RequestBody ConfirmMerchantOrderPaymentRequest request) {
|
||||
return R.status(orderService.confirmPayment(AuthUtil.getUserId(), request.getId(), request.getPaymentVoucherUrl()));
|
||||
}
|
||||
|
||||
@PostMapping("/confirm-shipment")
|
||||
@ApiOperationSupport(order = 15)
|
||||
@Operation(summary = "确认发货")
|
||||
public R confirmShipment(@Valid @RequestBody ConfirmMerchantOrderShipmentRequest request) {
|
||||
return R.status(orderService.confirmShipment(AuthUtil.getUserId(), request.getId(), request.getExpressNo()));
|
||||
}
|
||||
|
||||
@PostMapping("/confirm-receipt")
|
||||
@ApiOperationSupport(order = 16)
|
||||
@Operation(summary = "确认收货")
|
||||
public R confirmReceipt(@Valid @RequestBody ConfirmMerchantOrderReceiptRequest request) {
|
||||
return R.status(orderService.confirmReceipt(AuthUtil.getUserId(), request.getId()));
|
||||
}
|
||||
|
||||
@PostMapping("/cancel-order")
|
||||
@ApiOperationSupport(order = 17)
|
||||
@Operation(summary = "取消订单")
|
||||
public R cancelOrder(@Valid @RequestBody CancelMerchantOrderRequest request) {
|
||||
return R.status(orderService.cancelOrder(AuthUtil.getUserId(), request.getId(), request.getRemark()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CancelMerchantOrderRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效订单")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "无效备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConfirmMerchantOrderPaymentRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效订单")
|
||||
private Long id;
|
||||
|
||||
@NotEmpty(message = "无效凭证")
|
||||
private String paymentVoucherUrl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConfirmMerchantOrderReceiptRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效订单")
|
||||
private Long id;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConfirmMerchantOrderShipmentRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效订单")
|
||||
private Long id;
|
||||
|
||||
@NotEmpty(message = "无效快递编号")
|
||||
private String expressNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CreateMerchantOrderRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "商品编号为空")
|
||||
private Long itemCode;
|
||||
|
||||
@NotNull
|
||||
private Integer paymentType;
|
||||
|
||||
@NotEmpty
|
||||
private String address;
|
||||
|
||||
@NotEmpty(message = "请填写联系人")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "请填写联系电话")
|
||||
private String consigneePhone;
|
||||
|
||||
@NotNull(message = "商品数量不能为空")
|
||||
@Min(value = 1, message = "无效商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MerchantOrderApiVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String thumbImageUrl;
|
||||
|
||||
private String storeName;
|
||||
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
private Integer giftType;
|
||||
|
||||
private BigDecimal unitGiftAmount;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal totalGiftAmount;
|
||||
|
||||
private Integer accountType;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MerchantOrderDetailApiVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String thumbImageUrl;
|
||||
|
||||
private String storeName;
|
||||
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
private Integer giftType;
|
||||
|
||||
private BigDecimal unitGiftAmount;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal totalGiftAmount;
|
||||
|
||||
private Integer accountType;
|
||||
|
||||
private String accountNumber;
|
||||
|
||||
private String accountUrl;
|
||||
|
||||
private String accountHolderName;
|
||||
|
||||
private String consigneePhone;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String deliveryAddress;
|
||||
|
||||
private String paymentVoucherUrl;
|
||||
|
||||
private String expressNo;
|
||||
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class MerchantProductApiVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String thumbImageUrl;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String shop;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantCatalogEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MerchantProductDetailApiVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String shop;
|
||||
|
||||
private List<String> mainImageUrls;
|
||||
|
||||
private List<String> detailImageUrls;
|
||||
|
||||
private List<Spec> specs;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private List<Integer> payoutAccountTypes;
|
||||
|
||||
@Data
|
||||
public static class Spec implements Serializable {
|
||||
|
||||
private String attr;
|
||||
|
||||
private String value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.modules.common.event.merchant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class CancelOrderEvent implements Serializable {
|
||||
|
||||
private final Long orderId;
|
||||
|
||||
private final Long userId;
|
||||
|
||||
private final String productName;
|
||||
|
||||
private final Integer quantity;
|
||||
|
||||
private final String reason;
|
||||
|
||||
private final MarketBusinessModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.modules.common.event.merchant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class ConfirmPaymentEvent implements Serializable {
|
||||
|
||||
private final Long orderId;
|
||||
|
||||
private final Long userId;
|
||||
|
||||
private final String voucherUrl;
|
||||
|
||||
private final BigDecimal amount;
|
||||
|
||||
private final MarketBusinessModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.modules.common.event.merchant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class ConfirmReceiptEvent implements Serializable {
|
||||
|
||||
private final Long orderId;
|
||||
|
||||
private final Long userId;
|
||||
|
||||
private final Long sellerId;
|
||||
|
||||
private final BigDecimal amount;
|
||||
|
||||
private final MarketBusinessModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.springblade.modules.common.event.merchant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class ConfirmShipmentEvent implements Serializable {
|
||||
|
||||
private final Long orderId;
|
||||
|
||||
private final Long userId;
|
||||
|
||||
private final String expressNo;
|
||||
|
||||
|
||||
private final MarketBusinessModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.springblade.modules.common.event.merchant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class CreateOrderEvent implements Serializable {
|
||||
|
||||
private final Long orderId;
|
||||
|
||||
private final String productName;
|
||||
|
||||
private final Integer quantity;
|
||||
|
||||
private final Long userId;
|
||||
|
||||
private final MarketBusinessModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package org.springblade.modules.common.listener;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.modules.common.eums.NoticeType;
|
||||
import org.springblade.modules.common.event.merchant.*;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.event.TransactionPhase;
|
||||
import org.springframework.transaction.event.TransactionalEventListener;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class MerchantNoticeListener {
|
||||
|
||||
private final ICommonUserNoticeService noticeService;
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void onCreateOrderSuccess(CreateOrderEvent event) {
|
||||
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
|
||||
notice.setUserId(event.getUserId());
|
||||
notice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
notice.setModuleType(event.getModule().getCode());
|
||||
notice.setTitle(event.getModule().getDisplayName());
|
||||
notice.setContent(String.format("您的商品[%s]被用户购买了[%d]件,订单<id>%s</id>,请及时关注。", event.getProductName(), event.getQuantity(), event.getOrderId()));
|
||||
noticeService.save(notice);
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
|
||||
public void onCreateOrderFailure(CreateOrderEvent event) {
|
||||
log.warn("创建订单事务回滚,orderId={}", event.getOrderId());
|
||||
}
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void onConfirmPaymentSuccess(ConfirmPaymentEvent event) {
|
||||
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
|
||||
notice.setUserId(event.getUserId());
|
||||
notice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
notice.setModuleType(event.getModule().getCode());
|
||||
notice.setTitle(event.getModule().getDisplayName());
|
||||
notice.setContent(String.format("您的商家订单<id>%s</id>的用户已经确认支付,总金额[%.2f],请及时查看并发货。\n<img>%s</img>", event.getOrderId(), event.getAmount(), event.getVoucherUrl()));
|
||||
noticeService.save(notice);
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
|
||||
public void onConfirmPaymentFailure(ConfirmPaymentEvent event) {
|
||||
log.warn("确认支付事务回滚,orderId={}", event.getOrderId());
|
||||
}
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void onConfirmShipmentSuccess(ConfirmShipmentEvent event) {
|
||||
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
|
||||
notice.setUserId(event.getUserId());
|
||||
notice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
notice.setModuleType(event.getModule().getCode());
|
||||
notice.setTitle(event.getModule().getDisplayName());
|
||||
notice.setContent(String.format("您的订单<id>%s</id>已经发货,快递单号[%s],请及时查收。", event.getOrderId(), event.getExpressNo()));
|
||||
noticeService.save(notice);
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
|
||||
public void onConfirmShipmentFailure(ConfirmShipmentEvent event) {
|
||||
log.warn("确认发货事务回滚,orderId={}", event.getOrderId());
|
||||
}
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void onConfirmReceiptSuccess(ConfirmReceiptEvent event) {
|
||||
CommonUserNoticeEntity buyerNotice = new CommonUserNoticeEntity();
|
||||
buyerNotice.setUserId(event.getUserId());
|
||||
buyerNotice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
buyerNotice.setModuleType(event.getModule().getCode());
|
||||
buyerNotice.setTitle(event.getModule().getDisplayName());
|
||||
buyerNotice.setContent(String.format("您的订单<id>%s</id>已经确认收货,商品附赠的[%.2f]福利积分已到账,请核对查收。", event.getOrderId(), event.getAmount()));
|
||||
noticeService.save(buyerNotice);
|
||||
CommonUserNoticeEntity sellerNotice = new CommonUserNoticeEntity();
|
||||
sellerNotice.setUserId(event.getSellerId());
|
||||
sellerNotice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
sellerNotice.setModuleType(MarketBusinessModule.MERCHANT_SELLER_ORDER.getCode());
|
||||
sellerNotice.setTitle(event.getModule().getDisplayName());
|
||||
sellerNotice.setContent(String.format("您的商家订单<id>%s</id>已经确认收货,请经常关注您的库存,敬祝商祺。", event.getOrderId()));
|
||||
noticeService.save(sellerNotice);
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
|
||||
public void onConfirmReceiptFailure(ConfirmReceiptEvent event) {
|
||||
log.warn("确认收货事务回滚,orderId={}", event.getOrderId());
|
||||
}
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void onCancelOrderSuccess(CancelOrderEvent event) {
|
||||
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
|
||||
notice.setUserId(event.getUserId());
|
||||
notice.setNoticeType(NoticeType.MARKET_USER.getCode());
|
||||
notice.setModuleType(event.getModule().getCode());
|
||||
notice.setTitle(event.getModule().getDisplayName());
|
||||
notice.setContent(String.format("您的商家订单<id>%s</id>已被取消,用户填写的取消的原因是[%s];您的商品[%s]已经退回[%d]件库存,请核对。", event.getOrderId(), event.getReason(), event.getProductName(), event.getQuantity()));
|
||||
noticeService.save(notice);
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
|
||||
public void onCancelOrderFailure(CancelOrderEvent event) {
|
||||
log.warn("取消订单事务回滚,orderId={}", event.getOrderId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||
import org.springblade.modules.market.wrapper.MarketDailySummaryWrapper;
|
||||
import org.springblade.modules.market.service.IMarketDailySummaryService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 控制器
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/daily-summary")
|
||||
@Tag(name = "用户日汇总表", description = "用户日汇总表接口")
|
||||
public class MarketDailySummaryController extends BladeController {
|
||||
|
||||
private final IMarketDailySummaryService dailySummaryService;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入dailySummary")
|
||||
public R<MarketDailySummaryVO> detail(MarketDailySummaryEntity dailySummary) {
|
||||
MarketDailySummaryEntity detail = dailySummaryService.getOne(Condition.getQueryWrapper(dailySummary));
|
||||
return R.data(MarketDailySummaryWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 用户日汇总表 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入dailySummary")
|
||||
public R<IPage<MarketDailySummaryVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> dailySummary, Query query) {
|
||||
IPage<MarketDailySummaryEntity> pages = dailySummaryService.page(Condition.getPage(query), Condition.getQueryWrapper(dailySummary, MarketDailySummaryEntity.class));
|
||||
return R.data(MarketDailySummaryWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户日汇总表 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入dailySummary")
|
||||
public R<IPage<MarketDailySummaryVO>> page(MarketDailySummaryVO dailySummary, Query query) {
|
||||
IPage<MarketDailySummaryVO> pages = dailySummaryService.selectDailySummaryPage(Condition.getPage(query), dailySummary);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户日汇总表 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入dailySummary")
|
||||
public R save(@Valid @RequestBody MarketDailySummaryEntity dailySummary) {
|
||||
return R.status(dailySummaryService.save(dailySummary));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户日汇总表 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入dailySummary")
|
||||
public R update(@Valid @RequestBody MarketDailySummaryEntity dailySummary) {
|
||||
return R.status(dailySummaryService.updateById(dailySummary));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户日汇总表 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入dailySummary")
|
||||
public R submit(@Valid @RequestBody MarketDailySummaryEntity dailySummary) {
|
||||
return R.status(dailySummaryService.saveOrUpdate(dailySummary));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户日汇总表 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(dailySummaryService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@IsAdmin
|
||||
@GetMapping("/export-dailySummary")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "导出数据", description = "传入dailySummary")
|
||||
public void exportDailySummary(@Parameter(hidden = true) @RequestParam Map<String, Object> dailySummary, BladeUser bladeUser, HttpServletResponse response) {
|
||||
QueryWrapper<MarketDailySummaryEntity> queryWrapper = Condition.getQueryWrapper(dailySummary, MarketDailySummaryEntity.class);
|
||||
//if (!AuthUtil.isAdministrator()) {
|
||||
// queryWrapper.lambda().eq(DailySummary::getTenantId, bladeUser.getTenantId());
|
||||
//}
|
||||
//queryWrapper.lambda().eq(DailySummaryEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||
List<MarketDailySummaryExcel> list = dailySummaryService.exportDailySummary(queryWrapper);
|
||||
ExcelUtil.export(response, "用户日汇总表数据" + DateUtil.time(), "用户日汇总表数据表", list, MarketDailySummaryExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantOrderVO;
|
||||
import org.springblade.modules.market.excel.MerchantOrderExcel;
|
||||
import org.springblade.modules.market.wrapper.MerchantOrderWrapper;
|
||||
import org.springblade.modules.market.service.IMerchantOrderService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 自营商家订单 控制器
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/merchant-order")
|
||||
@Tag(name = "自营商家订单", description = "自营商家订单接口")
|
||||
public class MerchantOrderController extends BladeController {
|
||||
|
||||
private final IMerchantOrderService merchantOrderService;
|
||||
|
||||
/**
|
||||
* 自营商家订单 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入merchantOrder")
|
||||
public R<MerchantOrderVO> detail(MerchantOrderEntity merchantOrder) {
|
||||
MerchantOrderEntity detail = merchantOrderService.getOne(Condition.getQueryWrapper(merchantOrder));
|
||||
return R.data(MerchantOrderWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 自营商家订单 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入merchantOrder")
|
||||
public R<IPage<MerchantOrderVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> merchantOrder, Query query) {
|
||||
IPage<MerchantOrderEntity> pages = merchantOrderService.page(Condition.getPage(query), Condition.getQueryWrapper(merchantOrder, MerchantOrderEntity.class));
|
||||
return R.data(MerchantOrderWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家订单 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入merchantOrder")
|
||||
public R<IPage<MerchantOrderVO>> page(MerchantOrderVO merchantOrder, Query query) {
|
||||
IPage<MerchantOrderVO> pages = merchantOrderService.selectMerchantOrderPage(Condition.getPage(query), merchantOrder);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家订单 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入merchantOrder")
|
||||
public R save(@Valid @RequestBody MerchantOrderEntity merchantOrder) {
|
||||
return R.status(merchantOrderService.save(merchantOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家订单 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入merchantOrder")
|
||||
public R update(@Valid @RequestBody MerchantOrderEntity merchantOrder) {
|
||||
return R.status(merchantOrderService.updateById(merchantOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家订单 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入merchantOrder")
|
||||
public R submit(@Valid @RequestBody MerchantOrderEntity merchantOrder) {
|
||||
return R.status(merchantOrderService.saveOrUpdate(merchantOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家订单 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(merchantOrderService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@IsAdmin
|
||||
@GetMapping("/export-merchantOrder")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "导出数据", description = "传入merchantOrder")
|
||||
public void exportMerchantOrder(@Parameter(hidden = true) @RequestParam Map<String, Object> merchantOrder, BladeUser bladeUser, HttpServletResponse response) {
|
||||
QueryWrapper<MerchantOrderEntity> queryWrapper = Condition.getQueryWrapper(merchantOrder, MerchantOrderEntity.class);
|
||||
//if (!AuthUtil.isAdministrator()) {
|
||||
// queryWrapper.lambda().eq(MerchantOrder::getTenantId, bladeUser.getTenantId());
|
||||
//}
|
||||
//queryWrapper.lambda().eq(MerchantOrderEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||
List<MerchantOrderExcel> list = merchantOrderService.exportMerchantOrder(queryWrapper);
|
||||
ExcelUtil.export(response, "自营商家订单数据" + DateUtil.time(), "自营商家订单数据表", list, MerchantOrderExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,10 @@ package org.springblade.modules.market.convert;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springblade.modules.api.vo.MarketMerchantCatalogApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantOrderDetailApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductDetailApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantCatalogEntity;
|
||||
|
||||
@@ -22,4 +25,9 @@ public interface MarketMerchantConvert {
|
||||
|
||||
List<MerchantPayoutAccountApiVO> convertMerchantPayoutAccountEntityToApiVOList(List<MerchantPayoutAccountEntity> merchantPayoutAccountEntityList);
|
||||
|
||||
MerchantProductDetailApiVO.Spec convertMerchantCatalogEntitySpecToMerchantProductDetailApiVOSpec(MerchantCatalogEntity.Spec spec);
|
||||
|
||||
List<MerchantProductDetailApiVO.Spec> convertMerchantCatalogEntitySpecListToMerchantProductDetailApiVOSpecList(List<MerchantCatalogEntity.Spec> specList);
|
||||
|
||||
MerchantOrderDetailApiVO convertMerchantOrderEntityToApiVO(MerchantOrderEntity merchantOrderEntity);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@ public enum MarketBusinessModule {
|
||||
CASH_ACCELERATION("现金动态加速", "cash_acceleration"),
|
||||
MERCHANT_PURCHASING("自营商城进货", "merchant_purchasing"),
|
||||
MERCHANT_PUBLISH("自营商城上架商品", "merchant_publish"),
|
||||
MERCHANT_UNLIST("自营商城下架商品", "merchant_unlist");
|
||||
MERCHANT_UNLIST("自营商城下架商品", "merchant_unlist"),
|
||||
MERCHANT_ORDER("自营商城订单", "merchant_order"),
|
||||
MERCHANT_SELLER_ORDER("自营商城商家订单", "merchant_seller_order"),
|
||||
;
|
||||
|
||||
@Getter
|
||||
private final String displayName;
|
||||
|
||||
@@ -13,7 +13,7 @@ public enum MerchantGiftType {
|
||||
|
||||
private final String desc;
|
||||
|
||||
MerchantGiftType(int code, String desc){
|
||||
MerchantGiftType(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public enum MerchantGiftType {
|
||||
return merchantGiftType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("未知的赠品类型 code: " + code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
|
||||
/**
|
||||
* 用户日汇总表 Excel实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MarketDailySummaryExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("用户账号")
|
||||
private String userAccount;
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("用户姓名")
|
||||
private String userName;
|
||||
/**
|
||||
* 统计日期,如 '2026-04-29'
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("统计日期,如 '2026-04-29'")
|
||||
private Date statDate;
|
||||
/**
|
||||
* 直推人数(累计)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("直推人数(累计)")
|
||||
private Integer directReferralCount;
|
||||
/**
|
||||
* 当日新增直推人数
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日新增直推人数")
|
||||
private Integer newDirectReferralCount;
|
||||
/**
|
||||
* 团队人数(累计)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("团队人数(累计)")
|
||||
private Integer teamTotalCount;
|
||||
/**
|
||||
* 当日新增团队人数
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日新增团队人数")
|
||||
private Integer newTeamCount;
|
||||
/**
|
||||
* 总福利值
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("总福利值")
|
||||
private BigDecimal totalBenefitsValue;
|
||||
/**
|
||||
* 当日新增福利值
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日新增福利值")
|
||||
private BigDecimal increaseBenefitsValue;
|
||||
/**
|
||||
* 当日持有福利包的直推人数
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日持有福利包的直推人数")
|
||||
private Integer directWithBenefitPackageCount;
|
||||
/**
|
||||
* 当日直推人新增的福利包明细(数组)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日直推人新增的福利包明细(数组)")
|
||||
private Object directNewBenefitPackages;
|
||||
/**
|
||||
* 直推人福利包面值总和
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("直推人福利包面值总和")
|
||||
private BigDecimal directBenefitPackageFaceTotal;
|
||||
/**
|
||||
* 直推人福利包可提供加速的值(排除后台划拨)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("直推人福利包可提供加速的值(排除后台划拨)")
|
||||
private BigDecimal directAcceleratedValue;
|
||||
/**
|
||||
* 当日福利积分系统等级
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日福利积分系统等级")
|
||||
private Short benefitLevel;
|
||||
/**
|
||||
* 当日现金下单的直推人数
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日现金下单的直推人数")
|
||||
private Integer cashOrderDirectCount;
|
||||
/**
|
||||
* 当日直推人现金下单金额
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日直推人现金下单金额")
|
||||
private BigDecimal cashOrderDirectAmount;
|
||||
/**
|
||||
* 直推人可提供的现金分红金额(排除线下支付)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("直推人可提供的现金分红金额(排除线下支付)")
|
||||
private BigDecimal cashDividendEligibleDirect;
|
||||
/**
|
||||
* 当日佣金分红系统等级
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日佣金分红系统等级")
|
||||
private Short commissionLevel;
|
||||
/**
|
||||
* 当日自己新增福利包(明细数组)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日自己新增福利包(明细数组)")
|
||||
private Object selfNewBenefitPackages;
|
||||
/**
|
||||
* 当日自己新增福利包面值
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日自己新增福利包面值")
|
||||
private BigDecimal selfNewBenefitFaceValue;
|
||||
/**
|
||||
* 自己新增福利包可提供加速的值
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("自己新增福利包可提供加速的值")
|
||||
private BigDecimal selfAcceleratedValue;
|
||||
/**
|
||||
* 福利包总剩余面值
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("福利包总剩余面值")
|
||||
private BigDecimal totalRemainingBenefitFace;
|
||||
/**
|
||||
* 福利包加速了多少值(累计)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("福利包加速了多少值(累计)")
|
||||
private BigDecimal totalAcceleratedByPackages;
|
||||
/**
|
||||
* 现金分红了多少(即佣金)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("现金分红了多少(即佣金)")
|
||||
private BigDecimal cashCommissionPaid;
|
||||
/**
|
||||
* 当日现金消费金额(排除线下支付)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("当日现金消费金额(排除线下支付)")
|
||||
private BigDecimal selfCashConsumptionAmount;
|
||||
/**
|
||||
* 自己可提供分红的金额(排除线下支付)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("自己可提供分红的金额(排除线下支付)")
|
||||
private BigDecimal selfCashDividendEligible;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("是否已删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
|
||||
/**
|
||||
* 自营商家订单 Excel实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MerchantOrderExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
/**
|
||||
* 下单用户ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("下单用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商家ID")
|
||||
private Long sellerId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品名称")
|
||||
private String productName;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品ID")
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品缩略图URL
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品缩略图URL")
|
||||
private String thumbImageUrl;
|
||||
/**
|
||||
* 库存ID(或SKU ID)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("库存ID(或SKU ID)")
|
||||
private Long inventoryId;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("店铺名称")
|
||||
private String storeName;
|
||||
/**
|
||||
* 商品单价
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品单价")
|
||||
private BigDecimal unitPrice;
|
||||
/**
|
||||
* 赠品类型(1:福利积分, 2:现金券, 3:佣金)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("赠品类型(1:福利积分, 2:现金券, 3:佣金)")
|
||||
private Integer giftType;
|
||||
/**
|
||||
* 单件商品附带的赠品金额(如红包或福利值)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("单件商品附带的赠品金额(如红包或福利值)")
|
||||
private BigDecimal unitGiftAmount;
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("购买数量")
|
||||
private Short quantity;
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("订单总金额")
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 赠品总金额
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("赠品总金额")
|
||||
private BigDecimal totalGiftAmount;
|
||||
/**
|
||||
* 上架收款账户ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("上架收款账户ID")
|
||||
private Long payoutAccountId;
|
||||
/**
|
||||
* 收款账户类型(1:支付宝, 2:微信, 3:银行卡)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收款账户类型(1:支付宝, 2:微信, 3:银行卡)")
|
||||
private Integer accountType;
|
||||
/**
|
||||
* 收款账号(银行卡号)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收款账号(银行卡号)")
|
||||
private String accountNumber;
|
||||
/**
|
||||
* 收款账户二维码或链接
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收款账户二维码或链接")
|
||||
private String accountUrl;
|
||||
/**
|
||||
* 收款人姓名
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收款人姓名")
|
||||
private String accountHolderName;
|
||||
/**
|
||||
* 收货人手机号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收货人手机号")
|
||||
private String consigneePhone;
|
||||
/**
|
||||
* 收货人姓名
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收货人姓名")
|
||||
private String consignee;
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收货地址")
|
||||
private String deliveryAddress;
|
||||
/**
|
||||
* 付款凭证截图URL
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("付款凭证截图URL")
|
||||
private String paymentVoucherUrl;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("快递单号")
|
||||
private String expressNo;
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("订单备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 逻辑删除标志(0:未删除, 1:已删除)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("逻辑删除标志(0:未删除, 1:已删除)")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.mapper;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 Mapper 接口
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public interface MarketDailySummaryMapper extends BaseMapper<MarketDailySummaryEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param dailySummary 查询参数
|
||||
* @return List<DailySummaryVO>
|
||||
*/
|
||||
List<MarketDailySummaryVO> selectDailySummaryPage(IPage page, MarketDailySummaryVO dailySummary);
|
||||
|
||||
|
||||
/**
|
||||
* 获取导出数据
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return List<DailySummaryExcel>
|
||||
*/
|
||||
List<MarketDailySummaryExcel> exportDailySummary(@Param("ew") Wrapper<MarketDailySummaryEntity> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.modules.market.mapper.MarketDailySummaryMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="dailySummaryResultMap" type="org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="user_account" property="userAccount"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="stat_date" property="statDate"/>
|
||||
<result column="direct_referral_count" property="directReferralCount"/>
|
||||
<result column="new_direct_referral_count" property="newDirectReferralCount"/>
|
||||
<result column="team_total_count" property="teamTotalCount"/>
|
||||
<result column="new_team_count" property="newTeamCount"/>
|
||||
<result column="total_benefits_value" property="totalBenefitsValue"/>
|
||||
<result column="increase_benefits_value" property="increaseBenefitsValue"/>
|
||||
<result column="direct_with_benefit_package_count" property="directWithBenefitPackageCount"/>
|
||||
<result column="direct_new_benefit_packages" property="directNewBenefitPackages"/>
|
||||
<result column="direct_benefit_package_face_total" property="directBenefitPackageFaceTotal"/>
|
||||
<result column="direct_accelerated_value" property="directAcceleratedValue"/>
|
||||
<result column="benefit_level" property="benefitLevel"/>
|
||||
<result column="cash_order_direct_count" property="cashOrderDirectCount"/>
|
||||
<result column="cash_order_direct_amount" property="cashOrderDirectAmount"/>
|
||||
<result column="cash_dividend_eligible_direct" property="cashDividendEligibleDirect"/>
|
||||
<result column="commission_level" property="commissionLevel"/>
|
||||
<result column="self_new_benefit_packages" property="selfNewBenefitPackages"/>
|
||||
<result column="self_new_benefit_face_value" property="selfNewBenefitFaceValue"/>
|
||||
<result column="self_accelerated_value" property="selfAcceleratedValue"/>
|
||||
<result column="total_remaining_benefit_face" property="totalRemainingBenefitFace"/>
|
||||
<result column="total_accelerated_by_packages" property="totalAcceleratedByPackages"/>
|
||||
<result column="cash_commission_paid" property="cashCommissionPaid"/>
|
||||
<result column="self_cash_consumption_amount" property="selfCashConsumptionAmount"/>
|
||||
<result column="self_cash_dividend_eligible" property="selfCashDividendEligible"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectDailySummaryPage" resultMap="dailySummaryResultMap">
|
||||
select * from market_daily_summary where is_deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="exportDailySummary" resultType="org.springblade.modules.market.excel.MarketDailySummaryExcel">
|
||||
SELECT * FROM market_daily_summary ${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -28,6 +28,7 @@ package org.springblade.modules.market.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantInventoryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantInventoryVO;
|
||||
|
||||
@@ -45,10 +46,10 @@ public interface MerchantInventoryMapper extends BaseMapper<MerchantInventoryEnt
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param productInventory 查询参数
|
||||
* @param vo 查询参数
|
||||
* @return List<ProductInventoryVO>
|
||||
*/
|
||||
List<MerchantInventoryVO> selectProductInventoryPage(IPage page, MerchantInventoryVO productInventory);
|
||||
List<MerchantInventoryVO> selectProductInventoryPage(IPage page, MerchantInventoryVO vo);
|
||||
|
||||
List<MarketMerchantInventoryApiVO> selectProductInventoryApiList(Long userId);
|
||||
|
||||
@@ -57,4 +58,7 @@ public interface MerchantInventoryMapper extends BaseMapper<MerchantInventoryEnt
|
||||
int reduceInventory(Long id, Integer num, Long userId, Integer version);
|
||||
|
||||
int unlistInventory(Long id, Integer num, Long userId, Integer version);
|
||||
|
||||
List<MerchantProductApiVO> selectProductInventoryPageByShop(IPage page, String shop);
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,25 @@
|
||||
select * from merchant_product_inventory where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectProductInventoryPageByShop" resultType="org.springblade.modules.api.vo.MerchantProductApiVO">
|
||||
select
|
||||
id as id,
|
||||
product_name as name,
|
||||
thumb_image_url as thumbImageUrl,
|
||||
unit_price as price,
|
||||
unit_gift_amount as amount,
|
||||
gift_type as type,
|
||||
store_name as shop
|
||||
from
|
||||
merchant_product_inventory
|
||||
where is_deleted = 0
|
||||
and status = 1
|
||||
<if test="shop != null">
|
||||
and store_name = #{shop}
|
||||
</if>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectProductInventoryApiList" resultType="org.springblade.modules.api.vo.MarketMerchantInventoryApiVO">
|
||||
select *
|
||||
from merchant_product_inventory
|
||||
@@ -56,7 +75,7 @@
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and user_id = #{userId}
|
||||
and (stock - #{num}) >= 0
|
||||
and stock >= #{num}
|
||||
and status = 1
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.mapper;
|
||||
|
||||
import org.springblade.modules.api.vo.MerchantOrderApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantOrderVO;
|
||||
import org.springblade.modules.market.excel.MerchantOrderExcel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自营商家订单 Mapper 接口
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public interface MerchantOrderMapper extends BaseMapper<MerchantOrderEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param merchantOrder 查询参数
|
||||
* @return List<MerchantOrderVO>
|
||||
*/
|
||||
List<MerchantOrderVO> selectMerchantOrderPage(IPage page, MerchantOrderVO merchantOrder);
|
||||
|
||||
|
||||
/**
|
||||
* 获取导出数据
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return List<MerchantOrderExcel>
|
||||
*/
|
||||
List<MerchantOrderExcel> exportMerchantOrder(@Param("ew") Wrapper<MerchantOrderEntity> queryWrapper);
|
||||
|
||||
List<MerchantOrderApiVO> selectOrderPageByUserId(IPage page, Long userId, Integer status);
|
||||
|
||||
List<MerchantOrderApiVO> selectSellerOrderPageByUserId(IPage page, Long userId, Integer status);
|
||||
|
||||
int updateOrderStatusForConfirmPayment(Long id, Long userId, String voucherUrl, Integer version);
|
||||
|
||||
int updateOrderStatusForConfirmShipment(Long id, Long userId, String expressNo, Integer version);
|
||||
|
||||
int updateOrderStatusForConfirmReceipt(Long id, Long userId, Integer version);
|
||||
|
||||
int updateOrderStatusForCancel(Long id, Long userId, String reason, Integer version);
|
||||
|
||||
int updateOrderStatusForTimeout(Long id, Long userId, Integer version);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.modules.market.mapper.MerchantOrderMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="merchantOrderResultMap" type="org.springblade.modules.market.pojo.entity.MerchantOrderEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="seller_id" property="sellerId"/>
|
||||
<result column="product_name" property="productName"/>
|
||||
<result column="product_id" property="productId"/>
|
||||
<result column="thumb_image_url" property="thumbImageUrl"/>
|
||||
<result column="inventory_id" property="inventoryId"/>
|
||||
<result column="store_name" property="storeName"/>
|
||||
<result column="unit_price" property="unitPrice"/>
|
||||
<result column="gift_type" property="giftType"/>
|
||||
<result column="unit_gift_amount" property="unitGiftAmount"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="total_amount" property="totalAmount"/>
|
||||
<result column="total_gift_amount" property="totalGiftAmount"/>
|
||||
<result column="payout_account_id" property="payoutAccountId"/>
|
||||
<result column="account_type" property="accountType"/>
|
||||
<result column="account_number" property="accountNumber"/>
|
||||
<result column="account_url" property="accountUrl"/>
|
||||
<result column="account_holder_name" property="accountHolderName"/>
|
||||
<result column="consignee_phone" property="consigneePhone"/>
|
||||
<result column="consignee" property="consignee"/>
|
||||
<result column="delivery_address" property="deliveryAddress"/>
|
||||
<result column="payment_voucher_url" property="paymentVoucherUrl"/>
|
||||
<result column="express_no" property="expressNo"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectMerchantOrderPage" resultMap="merchantOrderResultMap">
|
||||
select *
|
||||
from market_merchant_order
|
||||
where is_deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="exportMerchantOrder" resultType="org.springblade.modules.market.excel.MerchantOrderExcel">
|
||||
SELECT *
|
||||
FROM market_merchant_order ${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderPageByUserId" resultType="org.springblade.modules.api.vo.MerchantOrderApiVO">
|
||||
select * from market_merchant_order where is_deleted = 0 and user_id = #{userId}
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<select id="selectSellerOrderPageByUserId" resultType="org.springblade.modules.api.vo.MerchantOrderApiVO">
|
||||
select * from market_merchant_order where is_deleted = 0 and seller_id = #{userId}
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<update id="updateOrderStatusForConfirmPayment">
|
||||
update market_merchant_order
|
||||
set payment_voucher_url = #{voucherUrl},
|
||||
status = 1,
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and user_id = #{userId}
|
||||
and status = 0
|
||||
and is_deleted = 0
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderStatusForConfirmShipment">
|
||||
update market_merchant_order
|
||||
set express_no = #{expressNo},
|
||||
status = 3,
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and seller_id = #{userId}
|
||||
and status = 1
|
||||
and is_deleted = 0
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderStatusForConfirmReceipt">
|
||||
update market_merchant_order
|
||||
set status = 4,
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and user_id = #{userId}
|
||||
and status = 3
|
||||
and is_deleted = 0
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderStatusForCancel">
|
||||
update market_merchant_order
|
||||
set status = 2,
|
||||
remark = #{remark},
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and user_id = #{userId}
|
||||
and status = 0
|
||||
and is_deleted = 0
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderStatusForTimeout">
|
||||
update market_merchant_order
|
||||
set status = 5,
|
||||
version = version + 1
|
||||
where id = #{id}
|
||||
and user_id = #{userId}
|
||||
and status = 0
|
||||
and is_deleted = 0
|
||||
and version = #{version}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.dto;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 数据传输对象实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MarketDailySummaryDTO extends MarketDailySummaryEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.dto;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家订单 数据传输对象实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantOrderDTO extends MerchantOrderEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("market_daily_summary")
|
||||
@Schema(description = "DailySummary对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MarketDailySummaryEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Schema(description = "用户账号")
|
||||
private String userAccount;
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
@Schema(description = "用户姓名")
|
||||
private String userName;
|
||||
/**
|
||||
* 统计日期,如 '2026-04-29'
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "统计日期,如 '2026-04-29'")
|
||||
private Date statDate;
|
||||
/**
|
||||
* 直推人数(累计)
|
||||
*/
|
||||
@Schema(description = "直推人数(累计)")
|
||||
private Integer directReferralCount;
|
||||
/**
|
||||
* 当日新增直推人数
|
||||
*/
|
||||
@Schema(description = "当日新增直推人数")
|
||||
private Integer newDirectReferralCount;
|
||||
/**
|
||||
* 团队人数(累计)
|
||||
*/
|
||||
@Schema(description = "团队人数(累计)")
|
||||
private Integer teamTotalCount;
|
||||
/**
|
||||
* 当日新增团队人数
|
||||
*/
|
||||
@Schema(description = "当日新增团队人数")
|
||||
private Integer newTeamCount;
|
||||
/**
|
||||
* 总福利值
|
||||
*/
|
||||
@Schema(description = "总福利值")
|
||||
private BigDecimal totalBenefitsValue;
|
||||
/**
|
||||
* 当日新增福利值
|
||||
*/
|
||||
@Schema(description = "当日新增福利值")
|
||||
private BigDecimal increaseBenefitsValue;
|
||||
/**
|
||||
* 当日持有福利包的直推人数
|
||||
*/
|
||||
@Schema(description = "当日持有福利包的直推人数")
|
||||
private Integer directWithBenefitPackageCount;
|
||||
/**
|
||||
* 当日直推人新增的福利包明细(数组)
|
||||
*/
|
||||
@Schema(description = "当日直推人新增的福利包明细(数组)")
|
||||
private Object directNewBenefitPackages;
|
||||
/**
|
||||
* 直推人福利包面值总和
|
||||
*/
|
||||
@Schema(description = "直推人福利包面值总和")
|
||||
private BigDecimal directBenefitPackageFaceTotal;
|
||||
/**
|
||||
* 直推人福利包可提供加速的值(排除后台划拨)
|
||||
*/
|
||||
@Schema(description = "直推人福利包可提供加速的值(排除后台划拨)")
|
||||
private BigDecimal directAcceleratedValue;
|
||||
/**
|
||||
* 当日福利积分系统等级
|
||||
*/
|
||||
@Schema(description = "当日福利积分系统等级")
|
||||
private Short benefitLevel;
|
||||
/**
|
||||
* 当日现金下单的直推人数
|
||||
*/
|
||||
@Schema(description = "当日现金下单的直推人数")
|
||||
private Integer cashOrderDirectCount;
|
||||
/**
|
||||
* 当日直推人现金下单金额
|
||||
*/
|
||||
@Schema(description = "当日直推人现金下单金额")
|
||||
private BigDecimal cashOrderDirectAmount;
|
||||
/**
|
||||
* 直推人可提供的现金分红金额(排除线下支付)
|
||||
*/
|
||||
@Schema(description = "直推人可提供的现金分红金额(排除线下支付)")
|
||||
private BigDecimal cashDividendEligibleDirect;
|
||||
/**
|
||||
* 当日佣金分红系统等级
|
||||
*/
|
||||
@Schema(description = "当日佣金分红系统等级")
|
||||
private Short commissionLevel;
|
||||
/**
|
||||
* 当日自己新增福利包(明细数组)
|
||||
*/
|
||||
@Schema(description = "当日自己新增福利包(明细数组)")
|
||||
private Object selfNewBenefitPackages;
|
||||
/**
|
||||
* 当日自己新增福利包面值
|
||||
*/
|
||||
@Schema(description = "当日自己新增福利包面值")
|
||||
private BigDecimal selfNewBenefitFaceValue;
|
||||
/**
|
||||
* 自己新增福利包可提供加速的值
|
||||
*/
|
||||
@Schema(description = "自己新增福利包可提供加速的值")
|
||||
private BigDecimal selfAcceleratedValue;
|
||||
/**
|
||||
* 福利包总剩余面值
|
||||
*/
|
||||
@Schema(description = "福利包总剩余面值")
|
||||
private BigDecimal totalRemainingBenefitFace;
|
||||
/**
|
||||
* 福利包加速了多少值(累计)
|
||||
*/
|
||||
@Schema(description = "福利包加速了多少值(累计)")
|
||||
private BigDecimal totalAcceleratedByPackages;
|
||||
/**
|
||||
* 现金分红了多少(即佣金)
|
||||
*/
|
||||
@Schema(description = "现金分红了多少(即佣金)")
|
||||
private BigDecimal cashCommissionPaid;
|
||||
/**
|
||||
* 当日现金消费金额(排除线下支付)
|
||||
*/
|
||||
@Schema(description = "当日现金消费金额(排除线下支付)")
|
||||
private BigDecimal selfCashConsumptionAmount;
|
||||
/**
|
||||
* 自己可提供分红的金额(排除线下支付)
|
||||
*/
|
||||
@Schema(description = "自己可提供分红的金额(排除线下支付)")
|
||||
private BigDecimal selfCashDividendEligible;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家订单 实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("market_merchant_order")
|
||||
@Schema(description = "MerchantOrder对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantOrderEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 下单用户ID
|
||||
*/
|
||||
@Schema(description = "下单用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
@Schema(description = "商家ID")
|
||||
private Long sellerId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品缩略图URL
|
||||
*/
|
||||
@Schema(description = "商品缩略图URL")
|
||||
private String thumbImageUrl;
|
||||
/**
|
||||
* 库存ID(或SKU ID)
|
||||
*/
|
||||
@Schema(description = "库存ID(或SKU ID)")
|
||||
private Long inventoryId;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Schema(description = "店铺名称")
|
||||
private String storeName;
|
||||
/**
|
||||
* 商品单价
|
||||
*/
|
||||
@Schema(description = "商品单价")
|
||||
private BigDecimal unitPrice;
|
||||
/**
|
||||
* 赠品类型(1:福利积分, 2:现金券, 3:佣金)
|
||||
*/
|
||||
@Schema(description = "赠品类型(1:福利积分, 2:现金券, 3:佣金)")
|
||||
private Integer giftType;
|
||||
/**
|
||||
* 单件商品附带的赠品金额(如红包或福利值)
|
||||
*/
|
||||
@Schema(description = "单件商品附带的赠品金额(如红包或福利值)")
|
||||
private BigDecimal unitGiftAmount;
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
@Schema(description = "购买数量")
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额")
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 赠品总金额
|
||||
*/
|
||||
@Schema(description = "赠品总金额")
|
||||
private BigDecimal totalGiftAmount;
|
||||
/**
|
||||
* 上架收款账户ID
|
||||
*/
|
||||
@Schema(description = "上架收款账户ID")
|
||||
private Long payoutAccountId;
|
||||
/**
|
||||
* 收款账户类型(1:支付宝, 2:微信, 3:银行卡)
|
||||
*/
|
||||
@Schema(description = "收款账户类型(1:支付宝, 2:微信, 3:银行卡)")
|
||||
private Integer accountType;
|
||||
/**
|
||||
* 收款账号(银行卡号)
|
||||
*/
|
||||
@Schema(description = "收款账号(银行卡号)")
|
||||
private String accountNumber;
|
||||
/**
|
||||
* 收款账户二维码或链接
|
||||
*/
|
||||
@Schema(description = "收款账户二维码或链接")
|
||||
private String accountUrl;
|
||||
/**
|
||||
* 收款人姓名
|
||||
*/
|
||||
@Schema(description = "收款人姓名")
|
||||
private String accountHolderName;
|
||||
/**
|
||||
* 收货人手机号
|
||||
*/
|
||||
@Schema(description = "收货人手机号")
|
||||
private String consigneePhone;
|
||||
/**
|
||||
* 收货人姓名
|
||||
*/
|
||||
@Schema(description = "收货人姓名")
|
||||
private String consignee;
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
@Schema(description = "收货地址")
|
||||
private String deliveryAddress;
|
||||
/**
|
||||
* 付款凭证截图URL
|
||||
*/
|
||||
@Schema(description = "付款凭证截图URL")
|
||||
private String paymentVoucherUrl;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
@Schema(description = "快递单号")
|
||||
private String expressNo;
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
@Schema(description = "订单备注")
|
||||
private String remark;
|
||||
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 视图实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MarketDailySummaryVO extends MarketDailySummaryEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家订单 视图实体类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantOrderVO extends MerchantOrderEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 服务类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public interface IMarketDailySummaryService extends BaseService<MarketDailySummaryEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param dailySummary 查询参数
|
||||
* @return IPage<DailySummaryVO>
|
||||
*/
|
||||
IPage<MarketDailySummaryVO> selectDailySummaryPage(IPage<MarketDailySummaryVO> page, MarketDailySummaryVO dailySummary);
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return List<DailySummaryExcel>
|
||||
*/
|
||||
List<MarketDailySummaryExcel> exportDailySummary(Wrapper<MarketDailySummaryEntity> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -28,6 +28,8 @@ package org.springblade.modules.market.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductDetailApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantInventoryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantInventoryVO;
|
||||
|
||||
@@ -54,7 +56,16 @@ public interface IMerchantInventoryService extends BaseService<MerchantInventory
|
||||
|
||||
boolean increase(Long userId, Long productId, Integer num);
|
||||
|
||||
boolean reduceById(Long id, Integer num);
|
||||
|
||||
boolean releaseById(Long id, Integer num);
|
||||
|
||||
boolean unlist(Long userId, Long productId);
|
||||
|
||||
boolean publish(Long userId, Long productId, Integer num, BigDecimal price, Integer giftType, BigDecimal giftAmount);
|
||||
|
||||
IPage<MerchantProductApiVO> selectProductInventoryPageByShop(IPage<MerchantProductApiVO> page, String shop);
|
||||
|
||||
MerchantProductDetailApiVO getDetailById(Long userId, Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import org.springblade.modules.api.vo.MerchantOrderApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantOrderDetailApiVO;
|
||||
import org.springblade.modules.market.eums.PayoutAccountType;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantOrderVO;
|
||||
import org.springblade.modules.market.excel.MerchantOrderExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自营商家订单 服务类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public interface IMerchantOrderService extends BaseService<MerchantOrderEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param merchantOrder 查询参数
|
||||
* @return IPage<MerchantOrderVO>
|
||||
*/
|
||||
IPage<MerchantOrderVO> selectMerchantOrderPage(IPage<MerchantOrderVO> page, MerchantOrderVO merchantOrder);
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return List<MerchantOrderExcel>
|
||||
*/
|
||||
List<MerchantOrderExcel> exportMerchantOrder(Wrapper<MerchantOrderEntity> queryWrapper);
|
||||
|
||||
Long createOrder(Long userId, Long id, PayoutAccountType payoutAccountType, String address, String consignee, String consigneePhone, Integer quantity, String remark);
|
||||
|
||||
IPage<MerchantOrderApiVO> selectOrderPageByUserId(IPage<MerchantOrderApiVO> page, Long userId, Integer status);
|
||||
|
||||
IPage<MerchantOrderApiVO> selectSellerOrderPageByUserId(IPage<MerchantOrderApiVO> page, Long userId, Integer status);
|
||||
|
||||
MerchantOrderDetailApiVO getDetailById(Long userId, Long id);
|
||||
|
||||
boolean confirmPayment(Long userId, Long id, String voucherUrl);
|
||||
|
||||
boolean confirmShipment(Long userId, Long id, String expressNo);
|
||||
|
||||
boolean confirmReceipt(Long userId, Long id);
|
||||
|
||||
boolean cancelOrder(Long userId, Long id, String reason);
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
|
||||
import org.springblade.modules.market.eums.PayoutAccountType;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -53,4 +54,5 @@ public interface IMerchantPayoutAccountService extends BaseService<MerchantPayou
|
||||
|
||||
List<MerchantPayoutAccountApiVO> accountListByUserId(Long userId);
|
||||
|
||||
MerchantPayoutAccountEntity accountByUserIdAndType(Long userId, PayoutAccountType payoutAccountType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||
import org.springblade.modules.market.mapper.MarketDailySummaryMapper;
|
||||
import org.springblade.modules.market.service.IMarketDailySummaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 服务实现类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Service
|
||||
public class MarketDailySummaryServiceImpl extends BaseServiceImpl<MarketDailySummaryMapper, MarketDailySummaryEntity> implements IMarketDailySummaryService {
|
||||
|
||||
@Override
|
||||
public IPage<MarketDailySummaryVO> selectDailySummaryPage(IPage<MarketDailySummaryVO> page, MarketDailySummaryVO dailySummary) {
|
||||
return page.setRecords(baseMapper.selectDailySummaryPage(page, dailySummary));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MarketDailySummaryExcel> exportDailySummary(Wrapper<MarketDailySummaryEntity> queryWrapper) {
|
||||
List<MarketDailySummaryExcel> dailySummaryList = baseMapper.exportDailySummary(queryWrapper);
|
||||
//dailySummaryList.forEach(dailySummary -> {
|
||||
// dailySummary.setTypeName(DictCache.getValue(DictEnum.YES_NO, DailySummary.getType()));
|
||||
//});
|
||||
return dailySummaryList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,10 @@ import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.redis.ratelimiter.RateLimiter;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductDetailApiVO;
|
||||
import org.springblade.modules.market.convert.MarketMerchantConvert;
|
||||
import org.springblade.modules.market.eums.*;
|
||||
import org.springblade.modules.market.mapper.MerchantInventoryMapper;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
@@ -52,6 +56,7 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -153,6 +158,37 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean reduceById(Long id, Integer num) {
|
||||
if (id == null || num == null || num <= 0) {
|
||||
throw new IllegalArgumentException("无效参数");
|
||||
}
|
||||
MerchantInventoryEntity inventory = getById(id);
|
||||
if (Objects.isNull(inventory)) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
if (baseMapper.reduceInventory(id, num, inventory.getUserId(), inventory.getVersion()) != 1) {
|
||||
throw new ServiceException("扣件库存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseById(Long id, Integer num) {
|
||||
if (id == null || num == null || num <= 0) {
|
||||
throw new IllegalArgumentException("无效参数");
|
||||
}
|
||||
MerchantInventoryEntity inventory = getById(id);
|
||||
if (Objects.isNull(inventory)) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
if (baseMapper.increaseInventory(id, num, inventory.getUserId(), inventory.getVersion()) != 1) {
|
||||
throw new ServiceException("释放库存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RateLimiter(value = "inventory:limiter", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -227,7 +263,7 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
}
|
||||
|
||||
boolean exists = payoutAccountService.exists(Wrappers.lambdaQuery(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getIsDeleted, 0));
|
||||
if (!exists){
|
||||
if (!exists) {
|
||||
throw new ServiceException("请先绑定收款方式");
|
||||
}
|
||||
|
||||
@@ -295,4 +331,41 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MerchantProductApiVO> selectProductInventoryPageByShop(IPage<MerchantProductApiVO> page, String shop) {
|
||||
return page.setRecords(baseMapper.selectProductInventoryPageByShop(page, shop));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantProductDetailApiVO getDetailById(Long userId, Long id) {
|
||||
if (Objects.isNull(id) || Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
boolean hasVerifyRealName = MarketInfoCache.hasVerifyRealName(userId);
|
||||
if (!hasVerifyRealName) {
|
||||
throw new ServiceException("请先实名");
|
||||
}
|
||||
MerchantInventoryEntity inventory = getById(id);
|
||||
if (Objects.isNull(inventory)) {
|
||||
throw new ServiceException("库存不足");
|
||||
}
|
||||
MerchantCatalogEntity catalog = catalogService.getById(inventory.getProductId());
|
||||
if (Objects.isNull(catalog)) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
List<MerchantPayoutAccountApiVO> payoutAccountApiVOList = payoutAccountService.accountListByUserId(inventory.getUserId());
|
||||
MerchantProductDetailApiVO vo = new MerchantProductDetailApiVO();
|
||||
vo.setId(inventory.getId());
|
||||
vo.setName(inventory.getProductName());
|
||||
vo.setShop(inventory.getStoreName());
|
||||
vo.setMainImageUrls(catalog.getMainImageUrls());
|
||||
vo.setDetailImageUrls(catalog.getDetailImageUrls());
|
||||
vo.setSpecs(MarketMerchantConvert.INSTANCE.convertMerchantCatalogEntitySpecListToMerchantProductDetailApiVOSpecList(catalog.getSpecs()));
|
||||
vo.setPrice(inventory.getUnitPrice());
|
||||
vo.setAmount(inventory.getUnitGiftAmount());
|
||||
vo.setType(inventory.getGiftType());
|
||||
vo.setPayoutAccountTypes(payoutAccountApiVOList.stream().map(MerchantPayoutAccountApiVO::getAccountType).filter(Objects::nonNull).toList());
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.common.cache.MarketInfoCache;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.redis.ratelimiter.RateLimiter;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.modules.api.vo.MerchantOrderApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantOrderDetailApiVO;
|
||||
import org.springblade.modules.common.eums.OrderStatus;
|
||||
import org.springblade.modules.common.event.merchant.*;
|
||||
import org.springblade.modules.market.convert.MarketMerchantConvert;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.eums.MerchantGiftType;
|
||||
import org.springblade.modules.market.eums.PayoutAccountType;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantInventoryEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantOrderVO;
|
||||
import org.springblade.modules.market.excel.MerchantOrderExcel;
|
||||
import org.springblade.modules.market.mapper.MerchantOrderMapper;
|
||||
import org.springblade.modules.market.service.*;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 自营商家订单 服务实现类
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MerchantOrderServiceImpl extends BaseServiceImpl<MerchantOrderMapper, MerchantOrderEntity> implements IMerchantOrderService {
|
||||
|
||||
private final IMerchantInventoryService inventoryService;
|
||||
|
||||
private final IMarketUserHierarchyService hierarchyService;
|
||||
|
||||
private final IMerchantPayoutAccountService payoutAccountService;
|
||||
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
@Override
|
||||
public IPage<MerchantOrderVO> selectMerchantOrderPage(IPage<MerchantOrderVO> page, MerchantOrderVO merchantOrder) {
|
||||
return page.setRecords(baseMapper.selectMerchantOrderPage(page, merchantOrder));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MerchantOrderExcel> exportMerchantOrder(Wrapper<MerchantOrderEntity> queryWrapper) {
|
||||
List<MerchantOrderExcel> merchantOrderList = baseMapper.exportMerchantOrder(queryWrapper);
|
||||
//merchantOrderList.forEach(merchantOrder -> {
|
||||
// merchantOrder.setTypeName(DictCache.getValue(DictEnum.YES_NO, MerchantOrder.getType()));
|
||||
//});
|
||||
return merchantOrderList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RateLimiter(value = "merchant:order", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
public Long createOrder(Long userId, Long id, PayoutAccountType payoutAccountType, String address, String consignee, String consigneePhone, Integer quantity, String remark) {
|
||||
if (Objects.isNull(userId) || Objects.isNull(id) || Objects.isNull(payoutAccountType) || StringUtil.isBlank(address) || StringUtil.isBlank(consignee) || StringUtil.isBlank(consigneePhone) || Objects.isNull(quantity) || quantity < 1) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
if (!MarketInfoCache.hasVerifyRealName(userId)) {
|
||||
throw new ServiceException("请先实名");
|
||||
}
|
||||
MerchantInventoryEntity inventory = inventoryService.getById(id);
|
||||
if (Objects.isNull(inventory)) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
if (inventory.getStock() < quantity) {
|
||||
throw new ServiceException("库存不足");
|
||||
}
|
||||
if (Objects.equals(userId, inventory.getUserId())) {
|
||||
throw new ServiceException("请勿购买自己的商品");
|
||||
}
|
||||
boolean inDirectLineage = hierarchyService.isInDirectLineage(inventory.getUserId(), userId);
|
||||
if (!inDirectLineage) {
|
||||
throw new ServiceException("您所选购的商品库存不足");
|
||||
}
|
||||
boolean reduced = inventoryService.reduceById(inventory.getId(), quantity);
|
||||
if (!reduced) {
|
||||
throw new ServiceException("扣减库存失败");
|
||||
}
|
||||
MerchantPayoutAccountEntity payoutAccount = payoutAccountService.accountByUserIdAndType(inventory.getUserId(), payoutAccountType);
|
||||
if (Objects.isNull(payoutAccount)) {
|
||||
throw new ServiceException("商家不支持的收款方式");
|
||||
}
|
||||
|
||||
MerchantOrderEntity order = new MerchantOrderEntity();
|
||||
order.setUserId(userId);
|
||||
order.setSellerId(inventory.getUserId());
|
||||
order.setProductName(inventory.getProductName());
|
||||
order.setProductId(inventory.getProductId());
|
||||
order.setThumbImageUrl(inventory.getThumbImageUrl());
|
||||
order.setInventoryId(inventory.getId());
|
||||
order.setStoreName(inventory.getStoreName());
|
||||
order.setUnitPrice(inventory.getUnitPrice());
|
||||
order.setGiftType(inventory.getGiftType());
|
||||
order.setUnitGiftAmount(inventory.getUnitGiftAmount());
|
||||
order.setQuantity(quantity);
|
||||
order.setTotalAmount(inventory.getUnitPrice().multiply(BigDecimal.valueOf(quantity)));
|
||||
order.setTotalGiftAmount(inventory.getUnitGiftAmount().multiply(BigDecimal.valueOf(quantity)));
|
||||
order.setPayoutAccountId(payoutAccount.getId());
|
||||
order.setAccountType(payoutAccountType.getCode());
|
||||
order.setAccountNumber(payoutAccount.getAccountNumber());
|
||||
order.setAccountUrl(payoutAccount.getAccountUrl());
|
||||
order.setAccountHolderName(payoutAccount.getHolderName());
|
||||
order.setConsignee(consignee);
|
||||
order.setConsigneePhone(consigneePhone);
|
||||
order.setDeliveryAddress(address);
|
||||
order.setRemark(remark);
|
||||
order.setStatus(OrderStatus.PENDING_PAYMENT.getCode());
|
||||
if (!save(order)) {
|
||||
throw new ServiceException("下单失败");
|
||||
}
|
||||
Long orderId = order.getId();
|
||||
publisher.publishEvent(new CreateOrderEvent(orderId, inventory.getProductName(), quantity, inventory.getUserId(), MarketBusinessModule.MERCHANT_SELLER_ORDER));
|
||||
return orderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MerchantOrderApiVO> selectOrderPageByUserId(IPage<MerchantOrderApiVO> page, Long userId, Integer status) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
return page.setRecords(baseMapper.selectOrderPageByUserId(page, userId, status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MerchantOrderApiVO> selectSellerOrderPageByUserId(IPage<MerchantOrderApiVO> page, Long userId, Integer status) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
return page.setRecords(baseMapper.selectSellerOrderPageByUserId(page, userId, status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantOrderDetailApiVO getDetailById(Long userId, Long id) {
|
||||
if (Objects.isNull(userId) || Objects.isNull(id)) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
MerchantOrderEntity order = getById(id);
|
||||
if (order == null) {
|
||||
throw new ServiceException("订单不存在");
|
||||
}
|
||||
boolean isBuyer = Objects.equals(order.getUserId(), userId);
|
||||
boolean isSeller = Objects.equals(order.getSellerId(), userId);
|
||||
|
||||
if (!isBuyer && !isSeller) {
|
||||
throw new ServiceException("您无权操作此订单");
|
||||
}
|
||||
return MarketMerchantConvert.INSTANCE.convertMerchantOrderEntityToApiVO(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RateLimiter(value = "merchant:order", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
public boolean confirmPayment(Long userId, Long id, String voucherUrl) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
MerchantOrderEntity order = getById(id);
|
||||
if (Objects.isNull(order) || !Objects.equals(order.getUserId(), userId)) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (StringUtil.isBlank(voucherUrl)) {
|
||||
throw new ServiceException("无效凭证");
|
||||
}
|
||||
int updated = baseMapper.updateOrderStatusForConfirmPayment(id, userId, voucherUrl, order.getVersion());
|
||||
if (updated != 1) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
publisher.publishEvent(new ConfirmPaymentEvent(order.getId(), order.getSellerId(), voucherUrl, order.getTotalAmount(), MarketBusinessModule.MERCHANT_SELLER_ORDER));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RateLimiter(value = "merchant:order", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
public boolean confirmShipment(Long userId, Long id, String expressNo) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
MerchantOrderEntity order = getById(id);
|
||||
if (Objects.isNull(order) || !Objects.equals(order.getSellerId(), userId)) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (StringUtil.isBlank(expressNo)) {
|
||||
throw new ServiceException("无效快递单号");
|
||||
}
|
||||
int updated = baseMapper.updateOrderStatusForConfirmShipment(id, userId, expressNo, order.getVersion());
|
||||
if (updated != 1) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
publisher.publishEvent(new ConfirmShipmentEvent(order.getId(), order.getUserId(), expressNo, MarketBusinessModule.MERCHANT_ORDER));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RateLimiter(value = "merchant:order", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
public boolean confirmReceipt(Long userId, Long id) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
MerchantOrderEntity order = getById(id);
|
||||
if (Objects.isNull(order) || !Objects.equals(order.getUserId(), userId)) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
int updated = baseMapper.updateOrderStatusForConfirmReceipt(id, userId, order.getVersion());
|
||||
if (updated != 1) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
MerchantGiftType giftType = MerchantGiftType.getByCode(order.getGiftType());
|
||||
switch (Objects.requireNonNull(giftType)) {
|
||||
case BENEFIT_POINT -> {
|
||||
Boolean added = benefitPointService.addBenefitPoint(new MarketBenefitPointApiDTO(userId, order.getTotalGiftAmount(), BigDecimal.ZERO, MarketBusinessModule.MERCHANT_ORDER, order.getId(), JSON.toJSONString(order), "自营商城订单赠品"));
|
||||
if (!added) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
}
|
||||
case CASH_COUPON, COMMISSION -> {
|
||||
}
|
||||
}
|
||||
publisher.publishEvent(new ConfirmReceiptEvent(order.getId(), order.getUserId(), order.getSellerId(), order.getTotalGiftAmount(), MarketBusinessModule.MERCHANT_ORDER));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RateLimiter(value = "merchant:order", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
|
||||
public boolean cancelOrder(Long userId, Long id, String reason) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效用户");
|
||||
}
|
||||
MerchantOrderEntity order = getById(id);
|
||||
if (Objects.isNull(order) || !Objects.equals(order.getUserId(), userId)) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
int updated = baseMapper.updateOrderStatusForCancel(id, userId, reason, order.getVersion());
|
||||
if (updated != 1) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
MerchantInventoryEntity inventory = inventoryService.getById(order.getInventoryId());
|
||||
if (Objects.isNull(inventory)) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
|
||||
boolean released = inventoryService.releaseById(inventory.getId(), order.getQuantity());
|
||||
if (!released) {
|
||||
throw new ServiceException("释放库存失败");
|
||||
}
|
||||
publisher.publishEvent(new CancelOrderEvent(id, order.getSellerId(), inventory.getProductName(), order.getQuantity(), reason, MarketBusinessModule.MERCHANT_SELLER_ORDER));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -63,24 +63,24 @@ public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPa
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submitPayoutAccount(Long userId, Integer type, String url, String number, String holder) {
|
||||
if (Objects.isNull(url) || Objects.isNull(type) || StringUtil.isBlank(holder)) {
|
||||
if (Objects.isNull(type) || StringUtil.isBlank(holder)) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
PayoutAccountType currentType = PayoutAccountType.fromCode(type);
|
||||
if (currentType == PayoutAccountType.BANK_ACCOUNT) {
|
||||
if (StringUtil.isBlank(number)) {
|
||||
throw new ServiceException("请填写卡号");
|
||||
}
|
||||
} else {
|
||||
if (StringUtil.isBlank(url)) {
|
||||
throw new ServiceException("请上传收款码");
|
||||
}
|
||||
}
|
||||
Integer merchantType = MarketInfoCache.checkMerchantType(userId);
|
||||
MerchantType cuurentMerchantType = MerchantType.fromCode(merchantType);
|
||||
if (cuurentMerchantType == MerchantType.UNREVIEWED) {
|
||||
throw new ServiceException("无效商家");
|
||||
}
|
||||
PayoutAccountType currentType = PayoutAccountType.fromCode(type);
|
||||
if (currentType == PayoutAccountType.BANK_ACCOUNT){
|
||||
if (StringUtil.isBlank(number)){
|
||||
throw new ServiceException("请填写卡号");
|
||||
}
|
||||
}else {
|
||||
if (StringUtil.isBlank(url)){
|
||||
throw new ServiceException("请上传收款码");
|
||||
}
|
||||
}
|
||||
LambdaUpdateWrapper<MerchantPayoutAccountEntity> wrapper = Wrappers.lambdaUpdate(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getAccountType, currentType.getCode());
|
||||
if (exists(wrapper)) {
|
||||
boolean updated = update(wrapper.set(MerchantPayoutAccountEntity::getIsDeleted, 1));
|
||||
@@ -110,4 +110,9 @@ public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPa
|
||||
return MarketMerchantConvert.INSTANCE.convertMerchantPayoutAccountEntityToApiVOList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantPayoutAccountEntity accountByUserIdAndType(Long userId, PayoutAccountType payoutAccountType) {
|
||||
return getOne(Wrappers.lambdaQuery(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getAccountType, payoutAccountType.getCode()).eq(MerchantPayoutAccountEntity::getIsDeleted, 0).orderByDesc(MerchantPayoutAccountEntity::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MarketDailySummaryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户日汇总表 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public class MarketDailySummaryWrapper extends BaseEntityWrapper<MarketDailySummaryEntity, MarketDailySummaryVO> {
|
||||
|
||||
public static MarketDailySummaryWrapper build() {
|
||||
return new MarketDailySummaryWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarketDailySummaryVO entityVO(MarketDailySummaryEntity dailySummary) {
|
||||
MarketDailySummaryVO dailySummaryVO = Objects.requireNonNull(BeanUtil.copyProperties(dailySummary, MarketDailySummaryVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(dailySummary.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(dailySummary.getUpdateUser());
|
||||
//dailySummaryVO.setCreateUserName(createUser.getName());
|
||||
//dailySummaryVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return dailySummaryVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantOrderEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantOrderVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自营商家订单 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author RayL
|
||||
* @since 2026-04-30
|
||||
*/
|
||||
public class MerchantOrderWrapper extends BaseEntityWrapper<MerchantOrderEntity, MerchantOrderVO> {
|
||||
|
||||
public static MerchantOrderWrapper build() {
|
||||
return new MerchantOrderWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantOrderVO entityVO(MerchantOrderEntity merchantOrder) {
|
||||
MerchantOrderVO merchantOrderVO = Objects.requireNonNull(BeanUtil.copyProperties(merchantOrder, MerchantOrderVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(merchantOrder.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(merchantOrder.getUpdateUser());
|
||||
//merchantOrderVO.setCreateUserName(createUser.getName());
|
||||
//merchantOrderVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return merchantOrderVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -305,6 +305,36 @@ blade:
|
||||
- method: POST
|
||||
pattern: /market/merchant/unlist-inventory
|
||||
crypto: "sha1"
|
||||
- method: GET
|
||||
pattern: /market/merchant/list
|
||||
crypto: "sha1"
|
||||
- method: GET
|
||||
pattern: /market/merchant/detail
|
||||
crypto: "sha1"
|
||||
- method: GET
|
||||
pattern: /market/market/merchant/order-list
|
||||
crypto: "sha1"
|
||||
- method: GET
|
||||
pattern: /market/merchant/seller-order-list
|
||||
crypto: "sha1"
|
||||
- method: GET
|
||||
pattern: /market/merchant/order-detail
|
||||
crypto: "sha1"
|
||||
- method: POST
|
||||
pattern: /market/merchant/create-order
|
||||
crypto: "sha1"
|
||||
- method: POST
|
||||
pattern: /market/merchant/confirm-payment
|
||||
crypto: "sha1"
|
||||
- method: POST
|
||||
pattern: /market/merchant/confirm-shipment
|
||||
crypto: "sha1"
|
||||
- method: POST
|
||||
pattern: /market/merchant/confirm-receipt
|
||||
crypto: "sha1"
|
||||
- method: POST
|
||||
pattern: /market/merchant/cancel-order
|
||||
crypto: "sha1"
|
||||
#多终端认证配置
|
||||
client:
|
||||
- client-id: web-admin
|
||||
|
||||
Reference in New Issue
Block a user