From adc28cf59544cb4d87228ae274ef8b32f97f5d99 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Mon, 26 Oct 2026 17:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8B=BC=E5=9B=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hiver-admin/test-output/test-report.html | 16 ++++---- .../ReturnCommissionController.java | 12 +++++- .../hiver/mall/controller/ShopController.java | 6 +++ .../mall/controller/WorkerController.java | 11 ++++++ .../main/java/cc/hiver/mall/entity/Shop.java | 3 ++ .../mybatis/MallOrderServiceImpl.java | 38 +++++++++++++++---- .../resources/db/shop_wallet_withdraw.sql | 2 + .../src/main/resources/mapper/ShopMapper.xml | 18 +++++++-- 8 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 hiver-modules/hiver-mall/src/main/resources/db/shop_wallet_withdraw.sql diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index 801bfa36..79fb416f 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • -ʮÔÂ 22, 2026 11:48:37 +ʮÔÂ 26, 2026 15:39:53
  • @@ -84,7 +84,7 @@

    passTest

    -

    11:48:37 ÉÏÎç / 0.024 secs

    +

    15:39:54 ÏÂÎç / 0.022 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -10.22.2026 11:48:37 -10.22.2026 11:48:37 -0.024 secs +10.26.2026 15:39:54 +10.26.2026 15:39:54 +0.022 secs
    @@ -104,7 +104,7 @@ Pass - 11:48:37 + 15:39:54 Test passed @@ -128,13 +128,13 @@

    Started

    -

    ʮÔÂ 22, 2026 11:48:37

    +

    ʮÔÂ 26, 2026 15:39:53

    Ended

    -

    ʮÔÂ 22, 2026 11:48:37

    +

    ʮÔÂ 26, 2026 15:39:54

    diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java index b1b957a4..81b36c12 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java @@ -187,8 +187,12 @@ public class ReturnCommissionController { if (shop == null) { return ResultUtil.error("商铺不存在!"); } + if (!isShopWalletWithdrawEnabled(shop)) { + return ResultUtil.error("该店铺已设置不显示钱包余额且不可提现!"); + } returnCommission.setRemark("商家" + shop.getShopName() + "提现"); - if (shop.getBalance().compareTo(returnCommission.getCommission()) < 0) { + final BigDecimal shopBalance = shop.getBalance() == null ? BigDecimal.ZERO : shop.getBalance(); + if (shopBalance.compareTo(returnCommission.getCommission()) < 0) { // 如果提现金额大于余额,则不允许提现 return ResultUtil.error("提现金额不可大于佣金余额!"); } @@ -217,7 +221,7 @@ public class ReturnCommissionController { //returnCommission.setShopAfterRebateAmount(shopAfterRebateAmount); // 3. 更新店铺返佣金额 //shop.setRebateAmount(shopAfterRebateAmount); - shop.setBalance(shop.getBalance().subtract(commission)); + shop.setBalance(shopBalance.subtract(commission)); shopService.update(shop); //增加余额变动记录 @@ -514,6 +518,10 @@ public class ReturnCommissionController { return null; } + private boolean isShopWalletWithdrawEnabled(Shop shop) { + return shop != null && !Integer.valueOf(0).equals(shop.getShowWalletWithdraw()); + } + private boolean isValidAliAccount(String aliAccount) { final String account = aliAccount == null ? "" : aliAccount.trim(); return PHONE_PATTERN.matcher(account).matches() || EMAIL_PATTERN.matcher(account).matches(); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java index 64da2430..a38b2916 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java @@ -151,6 +151,9 @@ public class ShopController { if (shop.getStoreConsumeOnly() == null) { shop.setStoreConsumeOnly(0); } + if (shop.getShowWalletWithdraw() == null) { + shop.setShowWalletWithdraw(1); + } shopService.save(shop); @@ -205,6 +208,9 @@ public class ShopController { if (shop.getStoreConsumeOnly() != null) { oldShop.setStoreConsumeOnly(shop.getStoreConsumeOnly()); } + if (shop.getShowWalletWithdraw() == null && oldShop.getShowWalletWithdraw() == null) { + oldShop.setShowWalletWithdraw(1); + } UpdateUtils.copyNonNullProperties(shop, oldShop); // 4. 更新数据库(此时更新的是带有完整数据的 oldShop,不会误清空其他字段) shopService.update(oldShop); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java index dbd5f6a8..6c236b0a 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java @@ -776,10 +776,21 @@ public class WorkerController { User user = userService.findById(userId); Worker worker = workerService.findByUserId(userId); List shops = shopService.getShopByUserid(userId); + if (shops != null) { + for (Shop shop : shops) { + if (!isShopWalletWithdrawEnabled(shop)) { + shop.setBalance(BigDecimal.ZERO); + } + } + } AdminUserVo vo = new AdminUserVo(); vo.setWorker(worker); vo.setShop(shops); vo.setUser(user); return new ResultUtil().setData(vo); } + + private boolean isShopWalletWithdrawEnabled(Shop shop) { + return shop != null && !Integer.valueOf(0).equals(shop.getShowWalletWithdraw()); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java index d448c656..abbd8fdb 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java @@ -139,6 +139,9 @@ public class Shop extends HiverBaseEntity { @ApiModelProperty(value = "账户余额") private BigDecimal balance; + @ApiModelProperty(value = "是否显示钱包余额并可提现 0否 1是") + private Integer showWalletWithdraw = 1; + @ApiModelProperty(value = "店铺规格库分类id") private String attrId; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java index 11cba5e5..10791275 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java @@ -89,6 +89,7 @@ public class MallOrderServiceImpl extends ServiceImpl + @@ -66,7 +67,7 @@ id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region, region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time, end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name, -balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop_images,shop_lename,shop_lecard, +balance, show_wallet_withdraw, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop_images,shop_lename,shop_lecard, shop_score,isbrandflag,subtitle,shoprank,sale_count,is_student,client_id,merchant_type, support_shop_delivery,order_bkge,shop_delivery_location,shop_delivery_duration,worker_id,worker_name,worker_phone, support_transfer_delivery,transfer_delivery_duration,transfer_address_id,transfer_address_name @@ -90,14 +91,14 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop insert into t_shop (id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region, region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time, end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name, - balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop_images, shop_lename, shop_lecard, shop_score, + balance, show_wallet_withdraw, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop_images, shop_lename, shop_lecard, shop_score, isbrandflag, subtitle,shoprank, sale_count,is_student,client_id,merchant_type, support_shop_delivery, order_bkge, shop_delivery_location, shop_delivery_duration, worker_id, worker_name, worker_phone, support_transfer_delivery, transfer_delivery_duration, transfer_address_id, transfer_address_name) values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR}, #{regionId,jdbcType=VARCHAR}, #{shopArea,jdbcType=VARCHAR}, #{shopAreaTitle,jdbcType=VARCHAR}, #{shopType,jdbcType=VARCHAR}, #{shopTypeTitle,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{aliAccount,jdbcType=VARCHAR}, #{aliName,jdbcType=VARCHAR}, - #{balance,jdbcType=VARCHAR}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}, #{printerBrand,jdbcType=VARCHAR}, #{printerSn,jdbcType=VARCHAR}, #{printerName,jdbcType=VARCHAR}, #{shopImages,jdbcType=VARCHAR}, #{shopLename,jdbcType=VARCHAR}, #{shopLecard,jdbcType=VARCHAR}, #{shopScore,jdbcType=DECIMAL}, #{isbrandflag,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR}, #{shoprank,jdbcType=INTEGER}, #{saleCount,jdbcType=INTEGER}, #{isStudent,jdbcType=INTEGER},#{clientId,jdbcType=VARCHAR}, #{merchantType,jdbcType=INTEGER}, + #{balance,jdbcType=VARCHAR}, #{showWalletWithdraw,jdbcType=INTEGER}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}, #{printerBrand,jdbcType=VARCHAR}, #{printerSn,jdbcType=VARCHAR}, #{printerName,jdbcType=VARCHAR}, #{shopImages,jdbcType=VARCHAR}, #{shopLename,jdbcType=VARCHAR}, #{shopLecard,jdbcType=VARCHAR}, #{shopScore,jdbcType=DECIMAL}, #{isbrandflag,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR}, #{shoprank,jdbcType=INTEGER}, #{saleCount,jdbcType=INTEGER}, #{isStudent,jdbcType=INTEGER},#{clientId,jdbcType=VARCHAR}, #{merchantType,jdbcType=INTEGER}, #{supportShopDelivery,jdbcType=INTEGER}, #{orderBkge,jdbcType=DECIMAL}, #{shopDeliveryLocation,jdbcType=INTEGER}, #{shopDeliveryDuration,jdbcType=INTEGER}, #{workerId,jdbcType=VARCHAR}, #{workerName,jdbcType=VARCHAR}, #{workerPhone,jdbcType=VARCHAR}, #{supportTransferDelivery,jdbcType=INTEGER}, #{transferDeliveryDuration,jdbcType=INTEGER}, #{transferAddressId,jdbcType=VARCHAR}, #{transferAddressName,jdbcType=VARCHAR}) @@ -179,6 +180,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop printer_brand, + + show_wallet_withdraw, + printer_sn, @@ -328,6 +332,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop #{printerBrand,jdbcType=VARCHAR}, + + #{showWalletWithdraw,jdbcType=INTEGER}, + #{printerSn,jdbcType=VARCHAR}, @@ -477,6 +484,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop printer_brand = #{printerBrand,jdbcType=VARCHAR}, + + show_wallet_withdraw = #{showWalletWithdraw,jdbcType=INTEGER}, + printer_sn = #{printerSn,jdbcType=VARCHAR}, @@ -578,6 +588,7 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop remark = #{remark,jdbcType=LONGVARCHAR}, printing_method = #{printingMethod,jdbcType=VARCHAR}, printer_brand = #{printerBrand,jdbcType=VARCHAR}, + show_wallet_withdraw = #{showWalletWithdraw,jdbcType=INTEGER}, printer_sn = #{printerSn,jdbcType=VARCHAR}, printer_name = #{printerName,jdbcType=VARCHAR}, shop_images = #{shopImages,jdbcType=VARCHAR}, @@ -637,6 +648,7 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop attr_id = #{attrId,jdbcType=VARCHAR}, printing_method = #{printingMethod,jdbcType=VARCHAR}, printer_brand = #{printerBrand,jdbcType=VARCHAR}, + show_wallet_withdraw = #{showWalletWithdraw,jdbcType=INTEGER}, printer_sn = #{printerSn,jdbcType=VARCHAR}, printer_name = #{printerName,jdbcType=VARCHAR}, shop_images = #{shopImages,jdbcType=VARCHAR},