Merge remote-tracking branch 'origin/master'
# Conflicts: # pjcloud-canteen/pjcloud-canteen-api/src/main/java/com/bsd/pjcloud/canteen/api/feign/RemoteOnlineCanteenSpuService.java
This commit is contained in:
commit
67dc0fdd98
10 files changed
+163
-26
No files matched your search
+6
@@ -7,10 +7,16 @@ import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class HardCreateOrderDto {
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.order.app;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class HardAppCreateOrderDto {
|
||||
|
||||
@NotNull(message = "父订单id不能为空")
|
||||
private Long carParentId;
|
||||
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@NotNull(message = "钱包类型不能为空")
|
||||
private WalletTypeCodeEnum walletType;
|
||||
|
||||
@NotNull(message = "订单类型不能为空")
|
||||
private HardOrderTypeEnum orderType;
|
||||
|
||||
@NotNull(message = "支付类型不能为空")
|
||||
private HardPayTypeEnum payType;
|
||||
|
||||
private Long orderSourceTypeId;
|
||||
|
||||
}
|
||||
@@ -104,12 +104,6 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-canteen-biz</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-supermarket-api</artifactId>
|
||||
@@ -118,7 +112,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-supermarket-biz</artifactId>
|
||||
<artifactId>pjcloud-canteen-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
+13
@@ -9,9 +9,14 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -53,6 +58,14 @@ public class HardOrderController {
|
||||
public R appDetail(@RequestParam Long id) {
|
||||
return R.ok(hardwareOrderService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "app创建订单", description = "app创建订单")
|
||||
@GetMapping("/app/create-order")
|
||||
public R appCreateOrder(@RequestParam Long carParentId) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
HardAppCreateOrderDto dto = HardAppCreateOrderDto.builder().carParentId(carParentId).walletType(WalletTypeCodeEnum.CANTEEN).userId(user.getId()).orderType(HardOrderTypeEnum.RESERVE).payType(HardPayTypeEnum.WALLET_DEFAULT).build();
|
||||
return R.ok(hardwareOrderService.appCreateOrder(dto));
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
|
||||
+7
@@ -7,7 +7,9 @@ import com.bsd.pjcloud.hard.api.dto.app.HardCarSaveOrUpdateDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardCarVo;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -19,10 +21,14 @@ public interface HardCarService extends IService<HardCarEntity> {
|
||||
|
||||
List<HardCarVo> getByOrderId(Long orderId);
|
||||
|
||||
List<HardCarEntity> getByParentCarId(Long parentCarId);
|
||||
|
||||
List<HardCarEntity> mchDetail(Long merchantId, Long userId);
|
||||
|
||||
Integer computerCarTotalPrice(@NotNull HardTypeEnum sysType, @NotEmpty List<HardCreateCarDto> list);
|
||||
|
||||
HardParentCarEntity getParentCarById(Long id);
|
||||
|
||||
/**
|
||||
* 新增或者更新购物车
|
||||
* @param dto
|
||||
@@ -38,6 +44,7 @@ public interface HardCarService extends IService<HardCarEntity> {
|
||||
*/
|
||||
Long createCard(Long userId, Long merchantId, HardTypeEnum sysType, List<HardCreateCarDto> list);
|
||||
|
||||
|
||||
/**
|
||||
* 生成购买商品的描述
|
||||
* @param sysType 订单类型
|
||||
|
||||
+10
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
@@ -17,6 +19,14 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
|
||||
Long createOrder(HardCreateOrderDto dto);
|
||||
|
||||
/**
|
||||
* 创建app订单
|
||||
*
|
||||
* @param dto 父订单id
|
||||
* @return
|
||||
*/
|
||||
Long appCreateOrder(@Valid HardAppCreateOrderDto dto);
|
||||
|
||||
/**
|
||||
* 快速扣款
|
||||
*
|
||||
|
||||
+29
-17
@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteOnlineCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.app.HardCarSaveOrUpdateDto;
|
||||
@@ -23,7 +24,7 @@ import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardParentCarMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketUnitSkuService;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketUnitEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.SupermarketUnitWithSpuVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -50,7 +51,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
private final HardOrderMapper hardCarMapper;
|
||||
private final HardParentCarMapper hardParentCarMapper;
|
||||
|
||||
private final RemoteCanteenSpuService canteenSpuService;
|
||||
private final RemoteOnlineCanteenSpuService onlineCanteenSpuService;
|
||||
private final RemoteSupermarketUnitSkuService supermarketUnitSkuService;
|
||||
|
||||
@Override
|
||||
@@ -62,34 +63,45 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
public List<HardCarEntity> mchDetail(Long merchantId, Long userId) {
|
||||
HardParentCarEntity parentCarDO = getParentCar(merchantId, userId);
|
||||
if (ObjectUtil.isEmpty(parentCarDO)) return null;
|
||||
return list(new LambdaQueryWrapper<HardCarEntity>().eq(HardCarEntity::getParentCarId, parentCarDO.getId()));
|
||||
return getByParentCarId(parentCarDO.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardCarVo> getByOrderId(Long orderId) {
|
||||
HardOrderEntity order = hardCarMapper.selectById(orderId);
|
||||
if (ObjectUtil.isEmpty(order)) return null;
|
||||
List<HardCarEntity> list = baseMapper.selectList(new LambdaQueryWrapper<HardCarEntity>()
|
||||
.eq(HardCarEntity::getParentCarId, order.getParentCarId())
|
||||
);
|
||||
List<HardCarEntity> list = getByParentCarId(order.getParentCarId());
|
||||
return BeanUtils.toBean(list, HardCarVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardCarEntity> getByParentCarId(Long parentCarId) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<HardCarEntity>()
|
||||
.eq(HardCarEntity::getParentCarId, parentCarId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardParentCarEntity getParentCarById(Long id) {
|
||||
return hardParentCarMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOrUpload(HardCarSaveOrUpdateDto dto) {
|
||||
List<HardCreateCarDto> carList = dto.getList().stream().filter(v -> v.getProductCount() > 0).toList();
|
||||
HardParentCarEntity parentCar = getParentCar(dto.getMerchantId(), dto.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(parentCar)) {
|
||||
baseMapper.delete(new LambdaQueryWrapper<HardCarEntity>().eq(HardCarEntity::getParentCarId, parentCar.getId()));
|
||||
// 添加购物车
|
||||
getSelf().appCreateCard(parentCar.getId(), HardTypeEnum.CANTEEN, dto.getList());
|
||||
getSelf().appCreateCard(parentCar.getId(), HardTypeEnum.CANTEEN, carList);
|
||||
return;
|
||||
}
|
||||
// 添加父订单
|
||||
HardParentCarEntity parentCarObj = HardParentCarEntity.builder().userId(dto.getUserId()).merchantId(dto.getMerchantId()).orderStatus(HardOrderStatusEnum.CREATE.getType()).build();
|
||||
hardParentCarMapper.insert(parentCarObj);
|
||||
// 添加购物车
|
||||
getSelf().appCreateCard(parentCar.getId(), HardTypeEnum.CANTEEN, dto.getList());
|
||||
getSelf().appCreateCard(parentCarObj.getId(), HardTypeEnum.CANTEEN, carList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +110,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
return switch (sysType) {
|
||||
case CANTEEN -> {
|
||||
// 查询食堂商品
|
||||
List<CanteenSpuEntity> supList = (List<CanteenSpuEntity>) canteenSpuService.getSpuListByIds(productIds).getData();
|
||||
List<CanteenOnlineSpuEntity> supList = onlineCanteenSpuService.getSpuListByIds(productIds).getData();
|
||||
AtomicInteger canteenTotalPrice = new AtomicInteger();
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
@@ -135,7 +147,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
// 食堂
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.CANTEEN)) {
|
||||
List<HardCarEntity> carObjectList = new ArrayList<>();
|
||||
List<CanteenSpuEntity> supList = (List<CanteenSpuEntity>) canteenSpuService.getSpuListByIds(productIds).getData();
|
||||
List<CanteenOnlineSpuEntity> supList = onlineCanteenSpuService.getSpuListByIds(productIds).getData();
|
||||
for (HardCreateCarDto v : productList) {
|
||||
HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build();
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
@@ -156,15 +168,15 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
// 超市
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.SUPERMARKET)) {
|
||||
List<HardCarEntity> carObjectList = new ArrayList<>();
|
||||
List<SupermarketUnitEntity> supList = (List<SupermarketUnitEntity>) supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
||||
List<SupermarketUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
||||
for (HardCreateCarDto v : productList) {
|
||||
HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build();
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
int totalPrice = v.getProductCount() * spu.getRetailPrice();
|
||||
item.setProductId(spu.getId());
|
||||
item.setProductName("");
|
||||
item.setProductName(spu.getProductName());
|
||||
item.setProductPrice(spu.getRetailPrice());
|
||||
item.setProductPic("");
|
||||
item.setProductPic(spu.getPicUrl());
|
||||
item.setTotalPrice((long) totalPrice);
|
||||
item.setProductCount(v.getProductCount());
|
||||
item.setProductWeight(new BigDecimal(0));
|
||||
@@ -180,7 +192,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
StringBuffer str = new StringBuffer();
|
||||
List<Long> productIds = list.stream().map(HardCreateCarDto::getProductId).toList();
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.CANTEEN)) {
|
||||
List<CanteenSpuEntity> supList = (List<CanteenSpuEntity>) canteenSpuService.getSpuListByIds(productIds).getData();
|
||||
List<CanteenOnlineSpuEntity> supList = onlineCanteenSpuService.getSpuListByIds(productIds).getData();
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
str.append(spu.getName()).append("x").append(v.getProductCount()).append(";");
|
||||
@@ -188,10 +200,10 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.SUPERMARKET)) {
|
||||
List<SupermarketUnitEntity> supList = (List<SupermarketUnitEntity>) supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
||||
List<SupermarketUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
str.append("").append("x").append(v.getProductCount()).append(";");
|
||||
str.append(spu.getProductName()).append("x").append(v.getProductCount()).append(";");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+58
@@ -11,9 +11,13 @@ import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
@@ -27,6 +31,7 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.*;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,6 +41,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -127,6 +134,57 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long appCreateOrder(@Valid HardAppCreateOrderDto dto) {
|
||||
// 钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), dto.getWalletType()).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
|
||||
// 查询父订单
|
||||
HardParentCarEntity parentCar = hardCarService.getParentCarById(dto.getCarParentId());
|
||||
if (ObjectUtil.isEmpty(parentCar)) throw new RuntimeException("购物车不存在");
|
||||
// 查询父购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(dto.getCarParentId());
|
||||
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在");
|
||||
Integer balance = wallet.getBalance();
|
||||
int totalPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum();
|
||||
if (balance < totalPrice) {
|
||||
throw new RuntimeException("钱包余额不足");
|
||||
}
|
||||
// 是否需要支付
|
||||
boolean isPay = isPay(dto.getOrderType(), dto.getPayType());
|
||||
// 获取商品描述
|
||||
List<HardCreateCarDto> carListDto = carList.stream().map(v -> {
|
||||
HardCreateCarDto entity = new HardCreateCarDto();
|
||||
entity.setParentCarId(dto.getCarParentId());
|
||||
entity.setProductId(v.getProductId());
|
||||
entity.setProductWeight(v.getProductWeight());
|
||||
entity.setProductCount(v.getProductCount());
|
||||
return entity;
|
||||
}).toList();
|
||||
HardTypeEnum hardType = ObjectUtil.equals(dto.getWalletType(), WalletTypeCodeEnum.CANTEEN) ? HardTypeEnum.CANTEEN : HardTypeEnum.SUPERMARKET;
|
||||
String subject = hardCarService.computerCarSubject(hardType, carListDto);
|
||||
// 添加硬件订单
|
||||
HardOrderEntity orderObj = HardOrderEntity.builder()
|
||||
.userId(dto.getUserId())
|
||||
.parentCarId(dto.getCarParentId())
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.merchantId(parentCar.getMerchantId())
|
||||
.orderType(dto.getOrderType().getType())
|
||||
.payType(dto.getPayType().getType())
|
||||
.orderSourceTypeId(dto.getOrderSourceTypeId())
|
||||
.totalPrice(totalPrice)
|
||||
.extraPrice(0)
|
||||
.isOfflineOrder(YesNoEnum.NO.getCode())
|
||||
.productDesc(subject)
|
||||
.build();
|
||||
if (isPay) orderObj.setWalletId(wallet.getId());
|
||||
baseMapper.insert(orderObj);
|
||||
// 钱包扣款
|
||||
if (isPay) fastReduceBalance(orderObj);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fastReduceBalance(HardOrderEntity order) {
|
||||
boolean isPay = isPay(HardOrderTypeEnum.valueOfByType(order.getOrderType()), HardPayTypeEnum.valueOfByType(order.getPayType()));
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ package com.bsd.pjcloud.supermarket.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarket.vo.SupermarketUnitWithSpuVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -46,5 +47,5 @@ public interface RemoteSupermarketUnitSkuService {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/supermarketUnit/ad/getSupermarketUnits")
|
||||
R getSupermarketUnits(@RequestBody List<Long> ids);
|
||||
R<List<SupermarketUnitWithSpuVo>> getSupermarketUnits(@RequestBody List<Long> ids);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: pjcloud-register:8848
|
||||
server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
config:
|
||||
|
||||
Reference in new issue
Block a user