Browse Source

对接拼团数据1

master
wangfukang 2 weeks ago
parent
commit
adc28cf595
  1. 16
      hiver-admin/test-output/test-report.html
  2. 12
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java
  3. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  4. 11
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java
  5. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java
  6. 38
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java
  7. 2
      hiver-modules/hiver-mall/src/main/resources/db/shop_wallet_withdraw.sql
  8. 18
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml

16
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">十月 22, 2026 11:48:37</span></a>
<a href="#"><span class="badge badge-primary">十月 26, 2026 15:39:53</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>11:48:37 上午</span> / <span>0.024 secs</span></p>
<p class="text-sm"><span>15:39:54 下午</span> / <span>0.022 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,9 +92,9 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>10.22.2026 11:48:37</span>
<span class='badge badge-danger'>10.22.2026 11:48:37</span>
<span class='badge badge-default'>0.024 secs</span>
<span class='badge badge-success'>10.26.2026 15:39:54</span>
<span class='badge badge-danger'>10.26.2026 15:39:54</span>
<span class='badge badge-default'>0.022 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
</div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>11:48:37</td>
<td>15:39:54</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>十月 22, 2026 11:48:37</h3>
<h3>十月 26, 2026 15:39:53</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>十月 22, 2026 11:48:37</h3>
<h3>十月 26, 2026 15:39:54</h3>
</div></div>
</div>
<div class="col-md-3">

12
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();

6
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);

11
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<Shop> 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<AdminUserVo>().setData(vo);
}
private boolean isShopWalletWithdrawEnabled(Shop shop) {
return shop != null && !Integer.valueOf(0).equals(shop.getShowWalletWithdraw());
}
}

3
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;

38
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallOrderServiceImpl.java

@ -89,6 +89,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder
private static final int DELIVERY_TYPE_EXPRESS = 1; // 外卖
private static final int DELIVERY_TYPE_SELF = 2; // 自取
private static final int IS_RETURN_EXPRESS = 1; // 外卖
private static final String TARGET_SOCIAL_DELIVERY_REGION_ID = "2110300467664916480";
// 订单类型常量
private static final int ORDER_TYPE_NORMAL = 1; // 直接购买
@ -2105,6 +2106,20 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder
/**
* 构建基础订单对象
*/
private boolean isTargetSocialDeliveryRegion(CreateOrderDTO dto) {
if (dto == null || !TARGET_SOCIAL_DELIVERY_REGION_ID.equals(dto.getRegionId())) {
return false;
}
ShopArea region = shopAreaService.get(dto.getRegionId());
return region != null && Integer.valueOf(2).equals(region.getAreaKind());
}
private void applyTransferDelivery(MallOrder order, Shop shop) {
order.setTransferDelivery(1);
order.setTransferAddressId(shop.getTransferAddressId());
order.setTransferAddressName(shop.getTransferAddressName());
}
private MallOrder buildBaseOrder(CreateOrderDTO dto, int orderType, BigDecimal goodsAmount,
BigDecimal deliveryFee, BigDecimal packageFee) {
MallOrder order = new MallOrder();
@ -2117,8 +2132,8 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder
order.setSeckillOrder(dto.getSeckillOrder() != null && dto.getSeckillOrder() == 1 ? 1 : 0);
order.setReceiverPhone(user.getMobile());
order.setDeliveryType(dto.getDeliveryType());
order.setShopDelivery(DELIVERY_TYPE_EXPRESS == dto.getDeliveryType()
&& dto.getShopDelivery() != null && dto.getShopDelivery() == 1 ? 1 : 0);
boolean expressDelivery = DELIVERY_TYPE_EXPRESS == (dto.getDeliveryType() == null ? 0 : dto.getDeliveryType());
order.setShopDelivery(expressDelivery && Integer.valueOf(1).equals(dto.getShopDelivery()) ? 1 : 0);
order.setTransferDelivery(0);
order.setAddressId(dto.getAddressId());
order.setGetAreaId(dto.getGetAreaId());
@ -2173,11 +2188,20 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder
order.setShopName(shop.getShopName());
order.setShopPhone(shop.getContactPhone());
order.setShopAddress(shop.getShopAddress());
if (DELIVERY_TYPE_EXPRESS == dto.getDeliveryType()
&& Integer.valueOf(1).equals(shop.getSupportTransferDelivery())) {
order.setTransferDelivery(1);
order.setTransferAddressId(shop.getTransferAddressId());
order.setTransferAddressName(shop.getTransferAddressName());
if (expressDelivery && isTargetSocialDeliveryRegion(dto)) {
if (Integer.valueOf(1).equals(dto.getTransferDelivery())) {
if (!Integer.valueOf(1).equals(shop.getSupportTransferDelivery())
|| StringUtils.isBlank(shop.getTransferAddressId())) {
throw new RuntimeException("中转配送配置不完整");
}
order.setShopDelivery(0);
applyTransferDelivery(order, shop);
} else if (Integer.valueOf(1).equals(dto.getShopDelivery())) {
order.setShopDelivery(1);
order.setTransferDelivery(0);
}
} else if (expressDelivery && Integer.valueOf(1).equals(shop.getSupportTransferDelivery())) {
applyTransferDelivery(order, shop);
}
}
}

2
hiver-modules/hiver-mall/src/main/resources/db/shop_wallet_withdraw.sql

@ -0,0 +1,2 @@
ALTER TABLE `t_shop`
ADD COLUMN `show_wallet_withdraw` TINYINT NOT NULL DEFAULT 1 COMMENT '是否显示钱包余额并可提现 0否 1是' AFTER `balance`;

18
hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml

@ -31,6 +31,7 @@
<result column="ali_account" property="aliAccount" jdbcType="VARCHAR" />
<result column="ali_name" property="aliName" jdbcType="VARCHAR" />
<result column="balance" property="balance" jdbcType="VARCHAR" />
<result column="show_wallet_withdraw" property="showWalletWithdraw" jdbcType="INTEGER" />
<result column="attr_id" property="attrId" jdbcType="VARCHAR" />
<result column="printing_method" property="printingMethod" jdbcType="VARCHAR" />
<result column="printer_brand" property="printerBrand" jdbcType="VARCHAR" />
@ -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})
</insert>
@ -179,6 +180,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop
<if test="printerBrand != null" >
printer_brand,
</if>
<if test="showWalletWithdraw != null" >
show_wallet_withdraw,
</if>
<if test="printerSn != null" >
printer_sn,
</if>
@ -328,6 +332,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop
<if test="printerBrand != null" >
#{printerBrand,jdbcType=VARCHAR},
</if>
<if test="showWalletWithdraw != null" >
#{showWalletWithdraw,jdbcType=INTEGER},
</if>
<if test="printerSn != null" >
#{printerSn,jdbcType=VARCHAR},
</if>
@ -477,6 +484,9 @@ balance, attr_id, printing_method, printer_brand, printer_sn, printer_name, shop
<if test="printerBrand != null" >
printer_brand = #{printerBrand,jdbcType=VARCHAR},
</if>
<if test="showWalletWithdraw != null" >
show_wallet_withdraw = #{showWalletWithdraw,jdbcType=INTEGER},
</if>
<if test="printerSn != null" >
printer_sn = #{printerSn,jdbcType=VARCHAR},
</if>
@ -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},

Loading…
Cancel
Save