Browse Source

对接拼团数据1

master
wangfukang 3 weeks ago
parent
commit
56b0fc050d
  1. 16
      hiver-admin/test-output/test-report.html
  2. 2
      hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java
  3. 39
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java
  4. 26
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java
  5. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SeckillGroupProduct.java
  6. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java
  7. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SeckillGroupProductDTO.java
  8. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SeckillGroupProductVO.java
  9. 179
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/quartz/MerchantSettlementTask.java
  10. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SeckillGroupProductServiceImpl.java
  11. 1
      hiver-modules/hiver-mall/src/main/resources/db/seckill_group.sql
  12. 7
      hiver-modules/hiver-mall/src/main/resources/db/seckill_group_product_merchant_type.sql
  13. 2
      hiver-modules/hiver-mall/src/main/resources/db/shop_area_commission_ratio.sql
  14. 3
      hiver-modules/hiver-mall/src/main/resources/db/shop_area_parent_agent.sql
  15. 1
      hiver-modules/hiver-mall/src/main/resources/mapper/SeckillGroupProductMapper.xml
  16. 44
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.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">八月 26, 2026 18:43:14</span></a>
<a href="#"><span class="badge badge-primary">九月 02, 2026 15:11:22</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>18:43:15 下午</span> / <span>0.04 secs</span></p>
<p class="text-sm"><span>15:11:23 下午</span> / <span>0.028 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'>08.26.2026 18:43:15</span>
<span class='badge badge-danger'>08.26.2026 18:43:15</span>
<span class='badge badge-default'>0.04 secs</span>
<span class='badge badge-success'>09.02.2026 15:11:23</span>
<span class='badge badge-danger'>09.02.2026 15:11:23</span>
<span class='badge badge-default'>0.028 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>18:43:15</td>
<td>15:11:23</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>八月 26, 2026 18:43:14</h3>
<h3>九月 02, 2026 15:11:22</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>八月 26, 2026 18:43:15</h3>
<h3>九月 02, 2026 15:11:23</h3>
</div></div>
</div>
<div class="col-md-3">

2
hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java

@ -15,7 +15,7 @@ public interface DealingsRecordConstant {
/**
*
*/
String[] TYPE_REMARK = {"配送订单佣金","售后退款","配送排名奖励","商家提现","配送员提现","免单奖励","商家结算","用户提现","白嫖中奖","学院排位赛排名奖励","配送员原因退款扣款","商家原因退款补发配送佣金","商家退款/售后扣款"};
String[] TYPE_REMARK = {"配送订单佣金","售后退款","配送排名奖励","商家提现","配送员提现","免单奖励","商家结算","用户提现","白嫖中奖","学院排位赛排名奖励","配送员原因退款扣款","商家原因退款补发配送佣金","商家退款/售后扣款","二级代理返佣"};
/**
*交易类型0:增加 1 提现 2消费 3售后

39
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java

@ -20,6 +20,8 @@ import cc.hiver.mall.utils.AliPayNewUtil;
import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -123,6 +125,32 @@ public class ReturnCommissionController {
return new ResultUtil<List<ReturnCommission>>().setData(list);
}
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(value = "分页查询提现记录", httpMethod = "GET")
public Result page(@RequestParam(value = "shopId", required = false) String shopId,
@RequestParam(value = "workerId", required = false) String workerId,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
if (StringUtils.isEmpty(shopId) && StringUtils.isEmpty(workerId)) {
return ResultUtil.error("店铺id或配送员id不能为空!");
}
final QueryWrapper<ReturnCommission> queryWrapper = new QueryWrapper<>();
if (!StringUtils.isEmpty(shopId)) {
queryWrapper.eq("shop_id", shopId);
}
if (!StringUtils.isEmpty(workerId)) {
queryWrapper.eq("worker_id", workerId);
}
queryWrapper.orderByDesc("create_time");
final Integer currentPage = pageNumber == null ? pageNum : pageNumber;
final IPage<ReturnCommission> page = returnCommissionService.page(
new Page<>(defaultPage(currentPage), defaultPageSize(pageSize)),
queryWrapper
);
return new ResultUtil<IPage<ReturnCommission>>().setData(page);
}
@Transactional
@RequestMapping(value = "/handleReturn", method = RequestMethod.POST)
@ApiOperation("店铺提现处理")
@ -523,6 +551,17 @@ public class ReturnCommissionController {
return returnCommission.getId();
}
private int defaultPage(Integer pageNum) {
return pageNum == null || pageNum < 1 ? 1 : pageNum;
}
private int defaultPageSize(Integer pageSize) {
if (pageSize == null || pageSize < 1) {
return 10;
}
return Math.min(pageSize, 100);
}
private String buildRequestLockKey(String withdrawId) {
return "return_commission:request:" + withdrawId;
}

26
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java

@ -128,6 +128,10 @@ public class ShopAreaController {
}else{
ShopArea.setIsParent(true);
}
Result validateResult = normalizeRootAreaAgent(ShopArea);
if (validateResult != null) {
return validateResult;
}
ShopArea d = shopAreaService.save(ShopArea);
// 如果不是添加的一级 判断设置上级为父节点标识
if (!CommonConstant.PARENT_ID.equals(ShopArea.getParentId())) {
@ -155,6 +159,10 @@ public class ShopAreaController {
if (ShopArea.getId().equals(ShopArea.getParentId())) {
return ResultUtil.error("上级节点不能为自己");
}
Result validateResult = normalizeRootAreaAgent(ShopArea);
if (validateResult != null) {
return validateResult;
}
ShopArea old = shopAreaService.get(ShopArea.getId());
String oldParentId = old.getParentId();
String oldTitle = old.getTitle();
@ -276,4 +284,22 @@ public class ShopAreaController {
});
}
private Result normalizeRootAreaAgent(ShopArea shopArea) {
if (!CommonConstant.PARENT_ID.equals(shopArea.getParentId())) {
shopArea.setParentAgentId(null);
shopArea.setParentAgentName(null);
shopArea.setCommissionRatio(0);
return null;
}
Integer commissionRatio = shopArea.getCommissionRatio();
if (commissionRatio == null) {
shopArea.setCommissionRatio(0);
return null;
}
if (commissionRatio < 0 || commissionRatio > 100) {
return ResultUtil.error("返佣比例需为0或1-100之间的整数");
}
return null;
}
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SeckillGroupProduct.java

@ -74,6 +74,9 @@ public class SeckillGroupProduct extends HiverBaseEntity {
@ApiModelProperty(value = "商家所属圈层ID快照")
private String shoArea;
@ApiModelProperty(value = "商家类型:1外卖商家 2团购商家")
private Integer merchantType;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "秒杀开始时间")

9
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java

@ -55,6 +55,15 @@ public class ShopArea extends HiverBaseEntity {
@Column(nullable = false, columnDefinition = "int default 1")
private Integer deliveryEnabled = 1;
@ApiModelProperty(value = "上级代理id")
private String parentAgentId;
@ApiModelProperty(value = "上级代理名称")
private String parentAgentName;
@ApiModelProperty(value = "返佣比例,按百分比计算")
private Integer commissionRatio = 0;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "父节点名称")

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SeckillGroupProductDTO.java

@ -37,6 +37,9 @@ public class SeckillGroupProductDTO {
@ApiModelProperty(value = "商家所属圈层ID")
private String shoArea;
@ApiModelProperty(value = "商家类型:1外卖商家 2团购商家")
private Integer merchantType;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "秒杀开始时间")

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SeckillGroupProductVO.java

@ -74,6 +74,9 @@ public class SeckillGroupProductVO {
@ApiModelProperty(value = "商家所属圈层ID")
private String shoArea;
@ApiModelProperty(value = "商家类型:1外卖商家 2团购商家")
private Integer merchantType;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "秒杀开始时间")

179
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/quartz/MerchantSettlementTask.java

@ -1,29 +1,38 @@
package cc.hiver.mall.quartz;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.entity.User;
import cc.hiver.core.entity.Worker;
import cc.hiver.core.service.UserService;
import cc.hiver.core.serviceimpl.WorkerServiceImpl;
import cc.hiver.mall.dao.ShopAreaDao;
import cc.hiver.mall.dao.mapper.MallReturnOrderGoodsMapper;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopTakeawayService;
import cc.hiver.mall.service.mybatis.MallOrderService;
import cc.hiver.mall.service.mybatis.MallRefundRecordService;
import cc.hiver.mall.service.mybatis.MallSettlementRecordService;
import cc.hiver.mall.service.mybatis.WorkerDailyBalanceRecordService;
import cc.hiver.mall.service.mybatis.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
@Slf4j
@Component
public class MerchantSettlementTask {
private static final BigDecimal ONE_PERCENT = new BigDecimal("0.01");
private static final String SECOND_AGENT_REBATE_LINK_PREFIX = "SECOND_AGENT_REBATE:";
@Autowired
private MallOrderService mallOrderService;
@Autowired
@ -40,6 +49,12 @@ public class MerchantSettlementTask {
private ShopService shopService;
@Autowired
private WorkerDailyBalanceRecordService workerDailyBalanceRecordService;
@Autowired
private ShopAreaDao shopAreaDao;
@Autowired
private UserService userService;
@Autowired
private DealingsRecordService dealingsRecordService;
@Scheduled(cron = "0 0 2 * * ?")
public void executeSettlement() {
@ -109,6 +124,26 @@ public class MerchantSettlementTask {
log.info("[MerchantSettlementTask] Daily settlement calculation finished.");
}
@Scheduled(cron = "0 0 3 * * ?")
public void executeSecondAgentRebate() {
LocalDate settlementDate = LocalDate.now().minusDays(1);
log.info("[MerchantSettlementTask] Starting second agent rebate, date={}", settlementDate);
try {
List<ShopArea> areas = shopAreaDao.findByParentIdOrderBySortOrder(CommonConstant.PARENT_ID);
for (ShopArea area : areas) {
try {
processSecondAgentRebate(area, settlementDate);
} catch (Exception e) {
log.error("[MerchantSettlementTask] Failed to process second agent rebate, regionId={}",
area == null ? null : area.getId(), e);
}
}
} catch (Exception e) {
log.error("[MerchantSettlementTask] Error processing second agent rebates", e);
}
log.info("[MerchantSettlementTask] Second agent rebate finished, date={}", settlementDate);
}
private void saveWorkerDailyBalanceRecord(Worker worker, LocalDate balanceDate) {
if (worker == null
|| worker.getWorkerStatus() == null
@ -137,6 +172,106 @@ public class MerchantSettlementTask {
workerDailyBalanceRecordService.saveOrUpdate(record);
}
private void processSecondAgentRebate(ShopArea area, LocalDate settlementDate) {
if (area == null
|| StringUtils.isBlank(area.getId())
|| StringUtils.isBlank(area.getParentAgentId())
|| area.getCommissionRatio() == null
|| area.getCommissionRatio() <= 0) {
return;
}
if (area.getCommissionRatio() > 100) {
log.warn("[MerchantSettlementTask] Skip second agent rebate, invalid commissionRatio={}, regionId={}",
area.getCommissionRatio(), area.getId());
return;
}
String linkId = SECOND_AGENT_REBATE_LINK_PREFIX + area.getId() + ":" + settlementDate;
String dealingsWay = safeText(area.getTitle()) + DealingsRecordConstant.TYPE_REMARK[13];
if (existsSecondAgentRebate(linkId)) {
log.info("[MerchantSettlementTask] Second agent rebate already exists, regionId={}, date={}",
area.getId(), settlementDate);
return;
}
BigDecimal headquartersDeduction = calculateHeadquartersDeduction(area.getId(), settlementDate);
if (headquartersDeduction.compareTo(BigDecimal.ZERO) <= 0) {
return;
}
BigDecimal rebateAmount = money(headquartersDeduction
.multiply(rateDecimal(BigDecimal.valueOf(area.getCommissionRatio()))));
if (rebateAmount.compareTo(BigDecimal.ZERO) <= 0) {
return;
}
User agent = userService.findById(area.getParentAgentId());
if (agent == null) {
log.warn("[MerchantSettlementTask] Skip second agent rebate, agent not found, regionId={}, agentId={}",
area.getId(), area.getParentAgentId());
return;
}
agent.setDepoBal(safeAmount(agent.getDepoBal()).add(rebateAmount));
userService.update(agent);
DealingsRecord dealingsRecord = new DealingsRecord();
dealingsRecord.setDealingsWay(dealingsWay);
dealingsRecord.setAmount(rebateAmount);
dealingsRecord.setRegionId(area.getId());
dealingsRecord.setLinkUserId(agent.getId());
dealingsRecord.setLinkId(linkId);
dealingsRecord.setDealingsTime(new Date());
dealingsRecord.setLinkType(DealingsRecordConstant.TYPE[0]);
dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[0]);
dealingsRecord.setCreateBy(agent.getId());
dealingsRecord.setCreateByName(agent.getNickname());
dealingsRecord.setRemark("结算日期:" + settlementDate
+ ",返佣比例:" + area.getCommissionRatio() + "%");
dealingsRecordService.save(dealingsRecord);
log.info("[MerchantSettlementTask] Second agent rebate success, regionId={}, agentId={}, amount={}, date={}",
area.getId(), agent.getId(), rebateAmount, settlementDate);
}
private boolean existsSecondAgentRebate(String linkId) {
LambdaQueryWrapper<DealingsRecord> qw = new LambdaQueryWrapper<>();
qw.eq(DealingsRecord::getLinkId, linkId);
return dealingsRecordService.count(qw) > 0;
}
private BigDecimal calculateHeadquartersDeduction(String regionId, LocalDate settlementDate) {
Date start = startOfDay(settlementDate);
Date end = endOfDay(settlementDate);
List<MallOrder> orders = mallOrderService.list(new LambdaQueryWrapper<MallOrder>()
.eq(MallOrder::getRegionId, regionId)
.ge(MallOrder::getPayTime, start)
.le(MallOrder::getPayTime, end)
.notIn(MallOrder::getStatus, 0, 6));
List<MallRefundRecord> refunds = mallRefundRecordService.list(new LambdaQueryWrapper<MallRefundRecord>()
.eq(MallRefundRecord::getRegionId, regionId)
.ge(MallRefundRecord::getSuccessTime, start)
.le(MallRefundRecord::getSuccessTime, end)
.in(MallRefundRecord::getStatus, 1, 4));
List<WorkerDailyBalanceRecord> workerBalanceRecords = workerDailyBalanceRecordService.list(
new LambdaQueryWrapper<WorkerDailyBalanceRecord>()
.eq(WorkerDailyBalanceRecord::getRegionId, regionId)
.eq(WorkerDailyBalanceRecord::getBalanceDate, settlementDate));
BigDecimal grossFlow = orders.stream()
.map(MallOrder::getTotalAmount)
.map(this::safeAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal refundAmount = sumRefundAmount(refunds, 1);
BigDecimal afterSaleAmount = sumRefundAmount(refunds, 4);
BigDecimal effectiveFlow = grossFlow.subtract(refundAmount).subtract(afterSaleAmount);
BigDecimal deliveryFeeAmount = sumPositiveWorkerBalance(workerBalanceRecords);
return effectiveFlow.subtract(deliveryFeeAmount).multiply(ONE_PERCENT);
}
private void processUnsettledOrder(MallOrder order) {
if (!isMerchantSettlementOrder(order)) {
return;
@ -278,6 +413,42 @@ public class MerchantSettlementTask {
return amount == null ? BigDecimal.ZERO : amount;
}
private BigDecimal money(BigDecimal amount) {
return safeAmount(amount).setScale(2, BigDecimal.ROUND_HALF_UP);
}
private BigDecimal sumRefundAmount(List<MallRefundRecord> refunds, int status) {
return refunds.stream()
.filter(item -> item.getStatus() != null && item.getStatus() == status)
.map(MallRefundRecord::getRefundAmount)
.map(this::safeAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
private BigDecimal sumPositiveWorkerBalance(List<WorkerDailyBalanceRecord> records) {
return records.stream()
.map(WorkerDailyBalanceRecord::getDailyBalance)
.map(this::safeAmount)
.filter(amount -> amount.compareTo(BigDecimal.ZERO) > 0)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
private Date startOfDay(LocalDate date) {
return Date.from(LocalDateTime.of(date, LocalTime.MIN)
.atZone(ZoneId.systemDefault())
.toInstant());
}
private Date endOfDay(LocalDate date) {
return Date.from(LocalDateTime.of(date, LocalTime.MAX)
.atZone(ZoneId.systemDefault())
.toInstant());
}
private String safeText(String value) {
return value == null ? "" : value;
}
private BigDecimal goodsPackageAmount(MallOrder order) {
if (order == null) {
return BigDecimal.ZERO;

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SeckillGroupProductServiceImpl.java

@ -363,6 +363,7 @@ public class SeckillGroupProductServiceImpl extends ServiceImpl<SeckillGroupProd
vo.setShopAddress(product.getShopAddress());
vo.setGetAreaId(product.getGetAreaId());
vo.setShoArea(product.getShoArea());
vo.setMerchantType(resolveMerchantType(product));
vo.setStartTime(product.getStartTime());
vo.setEndTime(product.getEndTime());
vo.setOrderFiled(product.getOrderFiled());
@ -429,12 +430,28 @@ public class SeckillGroupProductServiceImpl extends ServiceImpl<SeckillGroupProd
target.setShopAddress(shop.getShopAddress());
target.setGetAreaId(CharSequenceUtil.isBlank(dto.getGetAreaId()) ? shop.getRegionId() : dto.getGetAreaId());
target.setShoArea(CharSequenceUtil.isBlank(dto.getShoArea()) ? shop.getShopArea() : dto.getShoArea());
target.setMerchantType(dto.getMerchantType() == null ? shop.getMerchantType() : dto.getMerchantType());
} else {
target.setGetAreaId(dto.getGetAreaId());
target.setShoArea(dto.getShoArea());
target.setMerchantType(dto.getMerchantType());
}
}
private Integer resolveMerchantType(SeckillGroupProduct product) {
if (product == null) {
return null;
}
if (product.getMerchantType() != null) {
return product.getMerchantType();
}
if (CharSequenceUtil.isBlank(product.getShopId())) {
return null;
}
Shop shop = shopService.get(product.getShopId());
return shop == null ? null : shop.getMerchantType();
}
private void validateSaveDto(SeckillGroupProductDTO dto, boolean edit) {
if (dto == null) {
throw new IllegalArgumentException("参数不能为空");

1
hiver-modules/hiver-mall/src/main/resources/db/seckill_group.sql

@ -41,6 +41,7 @@ CREATE TABLE `t_seckill_group_product` (
`shop_address` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商家地址快照',
`get_area_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '取货区域ID,便于下单传参',
`sho_area` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商家所属圈层ID快照',
`merchant_type` int DEFAULT NULL COMMENT '商家类型:1外卖商家 2团购商家',
`start_time` datetime DEFAULT NULL COMMENT '秒杀开始时间',
`end_time` datetime DEFAULT NULL COMMENT '秒杀结束时间',
`order_filed` int DEFAULT 0 COMMENT '人工排序值,越大越靠前',

7
hiver-modules/hiver-mall/src/main/resources/db/seckill_group_product_merchant_type.sql

@ -0,0 +1,7 @@
ALTER TABLE `t_seckill_group_product`
ADD COLUMN `merchant_type` int DEFAULT NULL COMMENT '商家类型:1外卖商家 2团购商家' AFTER `sho_area`;
UPDATE `t_seckill_group_product` p
LEFT JOIN `t_shop` s ON p.`shop_id` = s.`id`
SET p.`merchant_type` = s.`merchant_type`
WHERE p.`merchant_type` IS NULL;

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

@ -0,0 +1,2 @@
ALTER TABLE `t_shop_area`
ADD COLUMN `commission_ratio` int(11) NOT NULL DEFAULT 0 COMMENT '返佣比例,按百分比计算';

3
hiver-modules/hiver-mall/src/main/resources/db/shop_area_parent_agent.sql

@ -0,0 +1,3 @@
ALTER TABLE `t_shop_area`
ADD COLUMN `parent_agent_id` varchar(64) DEFAULT NULL COMMENT '上级代理id',
ADD COLUMN `parent_agent_name` varchar(128) DEFAULT NULL COMMENT '上级代理名称';

1
hiver-modules/hiver-mall/src/main/resources/mapper/SeckillGroupProductMapper.xml

@ -27,6 +27,7 @@
<result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
<result column="get_area_id" jdbcType="VARCHAR" property="getAreaId"/>
<result column="sho_area" jdbcType="VARCHAR" property="shoArea"/>
<result column="merchant_type" jdbcType="INTEGER" property="merchantType"/>
<result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="order_filed" jdbcType="INTEGER" property="orderFiled"/>

44
hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml

@ -15,10 +15,14 @@
<result column="title" property="title" jdbcType="VARCHAR" />
<result column="is_canteen" property="isCanteen" jdbcType="INTEGER" />
<result column="delivery_enabled" property="deliveryEnabled" jdbcType="INTEGER" />
<result column="parent_agent_id" property="parentAgentId" jdbcType="VARCHAR" />
<result column="parent_agent_name" property="parentAgentName" jdbcType="VARCHAR" />
<result column="commission_ratio" property="commissionRatio" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, create_by, create_time, del_flag, update_by, update_time, is_parent, parent_id,
sort_order, status, title, is_canteen, delivery_enabled
sort_order, status, title, is_canteen, delivery_enabled, parent_agent_id, parent_agent_name,
commission_ratio
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
@ -34,11 +38,13 @@
insert into t_shop_area (id, create_by, create_time,
del_flag, update_by, update_time,
is_parent, parent_id, sort_order,
status, title, is_canteen, delivery_enabled)
status, title, is_canteen, delivery_enabled, parent_agent_id, parent_agent_name,
commission_ratio)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{isParent,jdbcType=BIT}, #{parentId,jdbcType=VARCHAR}, #{sortOrder,jdbcType=DECIMAL},
#{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{isCanteen,jdbcType=INTEGER}, #{deliveryEnabled,jdbcType=INTEGER})
#{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{isCanteen,jdbcType=INTEGER}, #{deliveryEnabled,jdbcType=INTEGER},
#{parentAgentId,jdbcType=VARCHAR}, #{parentAgentName,jdbcType=VARCHAR}, #{commissionRatio,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.ShopArea" >
insert into t_shop_area
@ -82,6 +88,15 @@
<if test="deliveryEnabled != null" >
delivery_enabled,
</if>
<if test="parentAgentId != null" >
parent_agent_id,
</if>
<if test="parentAgentName != null" >
parent_agent_name,
</if>
<if test="commissionRatio != null" >
commission_ratio,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
@ -123,6 +138,15 @@
<if test="deliveryEnabled != null" >
#{deliveryEnabled,jdbcType=INTEGER},
</if>
<if test="parentAgentId != null" >
#{parentAgentId,jdbcType=VARCHAR},
</if>
<if test="parentAgentName != null" >
#{parentAgentName,jdbcType=VARCHAR},
</if>
<if test="commissionRatio != null" >
#{commissionRatio,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.ShopArea" >
@ -164,6 +188,15 @@
<if test="deliveryEnabled != null" >
delivery_enabled = #{deliveryEnabled,jdbcType=INTEGER},
</if>
<if test="parentAgentId != null" >
parent_agent_id = #{parentAgentId,jdbcType=VARCHAR},
</if>
<if test="parentAgentName != null" >
parent_agent_name = #{parentAgentName,jdbcType=VARCHAR},
</if>
<if test="commissionRatio != null" >
commission_ratio = #{commissionRatio,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -180,7 +213,10 @@
status = #{status,jdbcType=INTEGER},
title = #{title,jdbcType=VARCHAR},
is_canteen = #{isCanteen,jdbcType=VARCHAR},
delivery_enabled = #{deliveryEnabled,jdbcType=INTEGER}
delivery_enabled = #{deliveryEnabled,jdbcType=INTEGER},
parent_agent_id = #{parentAgentId,jdbcType=VARCHAR},
parent_agent_name = #{parentAgentName,jdbcType=VARCHAR},
commission_ratio = #{commissionRatio,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save