订单号命名修改
This commit is contained in:
@@ -2,7 +2,6 @@ package com.chaozhanggui.system.cashierservice.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit;
|
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||||
@@ -37,7 +36,8 @@ public class OrderController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/creatOrder")
|
@PostMapping("/creatOrder")
|
||||||
public Result createOrder(@RequestBody JSONObject jsonObject){
|
public Result createOrder(@RequestHeader String environment, @RequestBody JSONObject jsonObject){
|
||||||
|
jsonObject.put("environment",environment);
|
||||||
return Utils.runFunAndCheckKey(() -> cartService.createOrder(jsonObject), stringRedisTemplate, RedisCst.getLockKey("CREATE_ORDER_KEY"));
|
return Utils.runFunAndCheckKey(() -> cartService.createOrder(jsonObject), stringRedisTemplate, RedisCst.getLockKey("CREATE_ORDER_KEY"));
|
||||||
// return orderService.createOrder(shopTable.getTableId(),shopTable.getShopId(),shopTable.getUserId());
|
// return orderService.createOrder(shopTable.getTableId(),shopTable.getShopId(),shopTable.getUserId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.Enum.OrderUseTypeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopWxMsgTypeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.*;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
@@ -1209,7 +1210,7 @@ public class CartService {
|
|||||||
private TbOrderInfo getOrder(BigDecimal totalAmount, BigDecimal packAMount,
|
private TbOrderInfo getOrder(BigDecimal totalAmount, BigDecimal packAMount,
|
||||||
TbShopTable shopTable, String merchantId, JSONObject jsonObject, BigDecimal originAmount) {
|
TbShopTable shopTable, String merchantId, JSONObject jsonObject, BigDecimal originAmount) {
|
||||||
TbOrderInfo orderInfo = new TbOrderInfo();
|
TbOrderInfo orderInfo = new TbOrderInfo();
|
||||||
String orderNo = generateOrderNumber();
|
String orderNo = generateOrderNumber(jsonObject.getString("environment"));
|
||||||
orderInfo.setOrderNo(orderNo);
|
orderInfo.setOrderNo(orderNo);
|
||||||
orderInfo.setSettlementAmount(totalAmount);
|
orderInfo.setSettlementAmount(totalAmount);
|
||||||
orderInfo.setPackFee(packAMount);
|
orderInfo.setPackFee(packAMount);
|
||||||
@@ -1237,10 +1238,13 @@ public class CartService {
|
|||||||
return orderInfo;
|
return orderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String generateOrderNumber() {
|
public String generateOrderNumber(String environment) {
|
||||||
String date = DateUtils.getSdfTimes();
|
String date = DateUtils.getSdfTimes();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int randomNum = random.nextInt(900) + 100;
|
int randomNum = random.nextInt(900) + 100;
|
||||||
|
if ("alipay".equalsIgnoreCase(environment)) {
|
||||||
|
return "ALI" + date + randomNum;
|
||||||
|
}
|
||||||
return "WX" + date + randomNum;
|
return "WX" + date + randomNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -486,11 +486,11 @@ public class PayService {
|
|||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
.eq(TbOrderDetail::getStatus, "closed"));
|
||||||
|
// 打印消息
|
||||||
|
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||||
}
|
}
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||||
@@ -809,11 +809,11 @@ public class PayService {
|
|||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
.eq(TbOrderDetail::getStatus, "closed"));
|
||||||
|
// 打印消息
|
||||||
|
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||||
}
|
}
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||||
@@ -873,11 +873,11 @@ public class PayService {
|
|||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
.eq(TbOrderDetail::getStatus, "closed"));
|
||||||
|
// 打印消息
|
||||||
|
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||||
}
|
}
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||||
@@ -1032,11 +1032,11 @@ public class PayService {
|
|||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
.eq(TbOrderDetail::getStatus, "closed"));
|
||||||
|
// 打印消息
|
||||||
|
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||||
}
|
}
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||||
@@ -1109,11 +1109,11 @@ public class PayService {
|
|||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
.eq(TbOrderDetail::getStatus, "closed"));
|
||||||
|
// 打印消息
|
||||||
|
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||||
}
|
}
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||||
|
|||||||
Reference in New Issue
Block a user