累计购买数量

This commit is contained in:
2025-12-19 11:10:41 +08:00
parent 800e61cb1f
commit f5de005c21
3 changed files with 4 additions and 4 deletions

View File

@@ -27,5 +27,5 @@ public interface GbWareService extends IService<GbWare> {
boolean deleteGbWare(Long id);
// 累计拼团数+1
void upGbWareGroupedNum(Long id);
void upGbWareGroupedNum(Long id, Integer num);
}

View File

@@ -83,11 +83,11 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
}
@Override
public void upGbWareGroupedNum(Long id) {
public void upGbWareGroupedNum(Long id, Integer num) {
GbWare ware = getById(id);
if (ware != null) {
GbWare upWare = new GbWare();
upWare.setGroupedNum(ware.getGroupedNum() == null ? 1 : ware.getGroupedNum() + 1);
upWare.setGroupedNum(ware.getGroupedNum() == null ? num : ware.getGroupedNum() + num);
update(upWare, query().eq(GbWare::getId, id));
}
}

View File

@@ -257,6 +257,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
record.setPayOrderId(payOrderId);
record.setPayTime(LocalDateTime.now());
record.setVerifyCode(CzgRandomUtils.randomNumber(12, true));
wareService.upGbWareGroupedNum(record.getWareId(), record.getNum());
if (StrUtil.isBlank(record.getGroupOrderNo())) {
GbWare ware = wareService.getById(record.getWareId());
if (ware == null || ware.getOnlineStatus() == 0 || ware.getIsDel()) {
@@ -304,7 +305,6 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
if (order.getCurrentPeopleNum().equals(order.getGroupPeopleNum())) {
order.setStatus("success");
order.setGroupEndTime(LocalDateTime.now());
wareService.upGbWareGroupedNum(order.getWareId());
record.setStatus("待核销");
GbOrderDetail upRecord = new GbOrderDetail();
upRecord.setStatus("待核销");