Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
dcc60f5841
|
|
@ -139,7 +139,6 @@ public class OrderController {
|
||||||
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
|
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
|
||||||
String userId = jsonObject.getString("accountId");
|
String userId = jsonObject.getString("accountId");
|
||||||
orderVo.setMerchantId(Integer.valueOf(userId));
|
orderVo.setMerchantId(Integer.valueOf(userId));
|
||||||
orderVo.setUserId(jsonObject.getString("staffId"));
|
|
||||||
return orderService.createOrder(orderVo, clientType, token, null, true);
|
return orderService.createOrder(orderVo, clientType, token, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,12 @@ public class OrderService {
|
||||||
*/
|
*/
|
||||||
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) {
|
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) {
|
||||||
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
||||||
return getShopEatTypeInfoDTO(shopId, eatModel, tableId);
|
return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopEatTypeInfoDTO getEatModelUnCheck(Object shopId, String tableId) {
|
||||||
|
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
||||||
|
return getShopEatTypeInfoDTO(shopId, eatModel, tableId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -171,7 +176,7 @@ public class OrderService {
|
||||||
*/
|
*/
|
||||||
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) {
|
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) {
|
||||||
String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
||||||
return getShopEatTypeInfoDTO(shopId, eatModel, tableId);
|
return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -182,14 +187,14 @@ public class OrderService {
|
||||||
* @param tableId 台桌id
|
* @param tableId 台桌id
|
||||||
* @return just餐类型信息
|
* @return just餐类型信息
|
||||||
*/
|
*/
|
||||||
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) {
|
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId, boolean isCheckModel) {
|
||||||
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
|
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
|
||||||
.eq(TbShopInfo::getId, shopId));
|
.eq(TbShopInfo::getId, shopId));
|
||||||
if (shopInfo == null) {
|
if (shopInfo == null) {
|
||||||
throw new MsgException("店铺信息不存在");
|
throw new MsgException("店铺信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shopInfo.getEatModel().contains(eatModel)) {
|
if (!shopInfo.getEatModel().contains(eatModel) && isCheckModel) {
|
||||||
throw new MsgException("当前店铺未开启此就餐模式");
|
throw new MsgException("当前店铺未开启此就餐模式");
|
||||||
}
|
}
|
||||||
boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel);
|
boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel);
|
||||||
|
|
@ -273,8 +278,13 @@ public class OrderService {
|
||||||
if (number == null) {
|
if (number == null) {
|
||||||
return Result.fail(CodeEnum.PARAM);
|
return Result.fail(CodeEnum.PARAM);
|
||||||
}
|
}
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, tableId);
|
|
||||||
|
|
||||||
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO;
|
||||||
|
if (StrUtil.isBlank(tableId)) {
|
||||||
|
shopEatTypeInfoDTO = getEatModelUnCheck(shopId, tableId);
|
||||||
|
}else {
|
||||||
|
shopEatTypeInfoDTO = checkEatModel(shopId, tableId);
|
||||||
|
}
|
||||||
|
|
||||||
// 台桌点单
|
// 台桌点单
|
||||||
boolean isSeatCart = productId != null && TableConstant.CashierCart.ID.equals(productId.toString());
|
boolean isSeatCart = productId != null && TableConstant.CashierCart.ID.equals(productId.toString());
|
||||||
|
|
@ -633,8 +643,12 @@ public class OrderService {
|
||||||
if (StringUtils.isEmpty(shopId)) {
|
if (StringUtils.isEmpty(shopId)) {
|
||||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||||
}
|
}
|
||||||
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO;
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), tableId);
|
if (StrUtil.isBlank(tableId)) {
|
||||||
|
shopEatTypeInfoDTO = getEatModelUnCheck(Integer.valueOf(shopId), tableId);
|
||||||
|
}else {
|
||||||
|
shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), tableId);
|
||||||
|
}
|
||||||
String day = DateUtils.getDay();
|
String day = DateUtils.getDay();
|
||||||
|
|
||||||
String finalMasterId1 = masterId;
|
String finalMasterId1 = masterId;
|
||||||
|
|
@ -889,8 +903,12 @@ public class OrderService {
|
||||||
if (shopInfo == null) {
|
if (shopInfo == null) {
|
||||||
throw new MsgException("店铺信息不存在");
|
throw new MsgException("店铺信息不存在");
|
||||||
}
|
}
|
||||||
|
ShopEatTypeInfoDTO eatTypeInfoDTO;
|
||||||
ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId());
|
if (StrUtil.isBlank(orderVo.getTableId())) {
|
||||||
|
eatTypeInfoDTO = getEatModelUnCheck(orderVo.getShopId(), orderVo.getTableId());
|
||||||
|
}else {
|
||||||
|
eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId());
|
||||||
|
}
|
||||||
|
|
||||||
if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(eatTypeInfoDTO.getUseType()) && StrUtil.isBlank(eatTypeInfoDTO.getUseType())) {
|
if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(eatTypeInfoDTO.getUseType()) && StrUtil.isBlank(eatTypeInfoDTO.getUseType())) {
|
||||||
throw new MsgException("店内就餐必须选择桌码");
|
throw new MsgException("店内就餐必须选择桌码");
|
||||||
|
|
|
||||||
|
|
@ -941,6 +941,7 @@ public class PayService {
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
||||||
orderInfo.setMemberId(vipUserId.toString());
|
orderInfo.setMemberId(vipUserId.toString());
|
||||||
|
orderInfo.setUserId(shopUser.getUserId());
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
//更新购物车状态
|
//更新购物车状态
|
||||||
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId());
|
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId());
|
||||||
|
|
@ -1252,7 +1253,7 @@ public class PayService {
|
||||||
hasNormalReturn = true;
|
hasNormalReturn = true;
|
||||||
saleAmount = saleAmount.add(orderDetail.getPrice());
|
saleAmount = saleAmount.add(orderDetail.getPrice());
|
||||||
if (remainNum.compareTo(BigDecimal.ZERO) <= 0) {
|
if (remainNum.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
returnAmount = orderDetail.getPriceAmount();
|
returnAmount = returnAmount.add(orderDetail.getPriceAmount());
|
||||||
packAMount = orderDetail.getPackAmount();
|
packAMount = orderDetail.getPackAmount();
|
||||||
} else {
|
} else {
|
||||||
currentDetailAMount = orderDetail.getPriceAmount()
|
currentDetailAMount = orderDetail.getPriceAmount()
|
||||||
|
|
@ -1297,7 +1298,7 @@ public class PayService {
|
||||||
throw new MsgException("退款金额必须大于0");
|
throw new MsgException("退款金额必须大于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
oldOrderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO));
|
oldOrderInfo.setCouponInfoList(couponInfoDTO == null ? null : JSONObject.toJSONString(couponInfoDTO));
|
||||||
|
|
||||||
// 保存剩余未退款的订单详情
|
// 保存剩余未退款的订单详情
|
||||||
if (!remainOrderDetailList.isEmpty()) {
|
if (!remainOrderDetailList.isEmpty()) {
|
||||||
|
|
@ -1325,6 +1326,9 @@ public class PayService {
|
||||||
returnOrder.setPayAmount(returnAmount);
|
returnOrder.setPayAmount(returnAmount);
|
||||||
mPOrderInfoMapper.insert(returnOrder);
|
mPOrderInfoMapper.insert(returnOrder);
|
||||||
|
|
||||||
|
for (TbOrderDetail orderDetail : detailList) {
|
||||||
|
orderDetail.setOrderId(returnOrder.getId());
|
||||||
|
}
|
||||||
|
|
||||||
updateStockAndRecord(detailList);
|
updateStockAndRecord(detailList);
|
||||||
mpOrderDetailService.updateBatchById(detailList);
|
mpOrderDetailService.updateBatchById(detailList);
|
||||||
|
|
@ -1399,7 +1403,7 @@ public class PayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Object returnOrder(ReturnOrderDTO returnOrderDTO) {
|
public Object returnOrder(ReturnOrderDTO returnOrderDTO) {
|
||||||
TbOrderInfo orderInfo = mPOrderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
|
TbOrderInfo orderInfo = mPOrderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
|
||||||
.eq(TbOrderInfo::getId, returnOrderDTO.getOrderId())
|
.eq(TbOrderInfo::getId, returnOrderDTO.getOrderId())
|
||||||
|
|
@ -1500,8 +1504,10 @@ public class PayService {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
returnCoupon(orderInfo, true);
|
returnCoupon(orderInfo, true);
|
||||||
// 返还积分
|
// 返还积分
|
||||||
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(),
|
if (orderInfo.getMemberId() != null && orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
|
||||||
"用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(),
|
||||||
|
"用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mPOrderInfoMapper.updateById(orderInfo);
|
mPOrderInfoMapper.updateById(orderInfo);
|
||||||
|
|
|
||||||
|
|
@ -486,6 +486,7 @@
|
||||||
<if test="commdityName != null and commdityName!='' ">
|
<if test="commdityName != null and commdityName!='' ">
|
||||||
and a.name like CONCAT('%',#{commdityName},'%')
|
and a.name like CONCAT('%',#{commdityName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
and type != 'coupon'
|
||||||
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -512,6 +513,8 @@
|
||||||
<if test="commdityName != null and commdityName!='' ">
|
<if test="commdityName != null and commdityName!='' ">
|
||||||
and a.name like CONCAT('%',#{commdityName},'%')
|
and a.name like CONCAT('%',#{commdityName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
and type != 'coupon'
|
||||||
|
|
||||||
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -524,6 +527,8 @@
|
||||||
<if test="commdityName != null and commdityName!='' ">
|
<if test="commdityName != null and commdityName!='' ">
|
||||||
and a.name like CONCAT('%',#{commdityName},'%')
|
and a.name like CONCAT('%',#{commdityName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
and type != 'coupon'
|
||||||
|
|
||||||
and b.is_grounding=0 GROUP BY a.id ORDER BY a.`sort`
|
and b.is_grounding=0 GROUP BY a.id ORDER BY a.`sort`
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue