超市自定义商品

This commit is contained in:
seesaw
2024-12-02 10:48:06 +08:00
parent b82ddbd3a9
commit 850f10ac4f
3 changed files with 12 additions and 3 deletions

View File

@ -161,7 +161,7 @@ public class AppCardController {
@Operation(summary = "管理充值") @Operation(summary = "管理充值")
public CommonResult<Boolean> rechargeByAdmin(@RequestBody RechargeVO vo) { public CommonResult<Boolean> rechargeByAdmin(@RequestBody RechargeVO vo) {
BillingRespMoneyVO haveWithoutMoney = billingService.getHaveWithoutMoney(SecurityFrameworkUtils.getLoginUserId()); BillingRespMoneyVO haveWithoutMoney = billingService.getHaveWithoutMoney(SecurityFrameworkUtils.getLoginUserId());
if (haveWithoutMoney.getWithoutMoney().compareTo(BigDecimal.ZERO)!=0){ if (haveWithoutMoney.getWithoutMoney().compareTo(BigDecimal.ZERO)>0){
throw exception(BILLING_NOT_COMPLETE); throw exception(BILLING_NOT_COMPLETE);
} }
cardService.rechargeByAdmin(vo); cardService.rechargeByAdmin(vo);

View File

@ -198,7 +198,9 @@ public class AppStoreController {
@Operation(summary = "添加二维码订单") @Operation(summary = "添加二维码订单")
public String payByCodeOrder(@RequestBody StoreOrderDto dto) { public String payByCodeOrder(@RequestBody StoreOrderDto dto) {
AddReqVO addReqVO = orderService.codePay(dto); AddReqVO addReqVO = orderService.codePay(dto);
if(CollectionUtil.isNotEmpty(addReqVO.getList())){
memberAsyncService.batchRecord(addReqVO); memberAsyncService.batchRecord(addReqVO);
}
return JsonUtils.toJsonString(StoreResult.success(null)); return JsonUtils.toJsonString(StoreResult.success(null));
} }

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.member.service.storeorder; package cn.iocoder.yudao.module.member.service.storeorder;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -54,6 +55,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -232,6 +234,9 @@ public class StoreOrderServiceImpl implements StoreOrderService {
addReqVO.setOutType(OutTypeEnum.SELL.getCode()); addReqVO.setOutType(OutTypeEnum.SELL.getCode());
List<GoodsInfoReqVO> infos = new ArrayList<>(); List<GoodsInfoReqVO> infos = new ArrayList<>();
for (StoreGoodsDto detail : dto.getEquipmentGoodsCustoms()){ for (StoreGoodsDto detail : dto.getEquipmentGoodsCustoms()){
if(detail.getGoodsId() == null){
continue;
}
GoodsInfoReqVO vo = new GoodsInfoReqVO(); GoodsInfoReqVO vo = new GoodsInfoReqVO();
BeanUtil.copyProperties(detail,vo); BeanUtil.copyProperties(detail,vo);
vo.setCarteenId(storeId); vo.setCarteenId(storeId);
@ -239,7 +244,9 @@ public class StoreOrderServiceImpl implements StoreOrderService {
infos.add(vo); infos.add(vo);
} }
addReqVO.setList(infos); addReqVO.setList(infos);
if(CollectionUtil.isNotEmpty(infos)){
storeGoodsInventoryService.createStoreGoodsInventory(addReqVO); storeGoodsInventoryService.createStoreGoodsInventory(addReqVO);
}
StoreOrderDO order = createOrder(dto,StoreOrderStatusEnum.COMPLETE.getCode()); StoreOrderDO order = createOrder(dto,StoreOrderStatusEnum.COMPLETE.getCode());
Double totalPrice = order.getTotalPrice(); Double totalPrice = order.getTotalPrice();