去除小票打印二维码
This commit is contained in:
@@ -7,6 +7,7 @@ import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.netty.PushToAppChannelHandlerAdapter;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
@@ -54,6 +55,9 @@ public class CartService {
|
||||
@Autowired
|
||||
private TbSystemCouponsMapper systemCouponsMapper;
|
||||
|
||||
@Autowired
|
||||
private RabbitProducer producer;
|
||||
|
||||
public void initCart(JSONObject jsonObject) {
|
||||
String tableId = jsonObject.getString("tableId");
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
@@ -295,6 +299,15 @@ public class CartService {
|
||||
cashierCart.setRefundNumber(0);
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("cartId",cashierCart.getId());
|
||||
jsonObject.put("type","create");
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
|
||||
return cashierCart;
|
||||
} catch (Exception e) {
|
||||
log.error("长链接错误 addCart{}", e.getMessage());
|
||||
@@ -583,6 +596,8 @@ public class CartService {
|
||||
public void clearCart(JSONObject jsonObject) {
|
||||
try {
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
if (redisUtil.exists(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId)))) {
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
||||
if (Objects.isNull(array) || array.isEmpty() || array.size() < 1) {
|
||||
@@ -590,6 +605,7 @@ public class CartService {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(array.get(i).toString(), TbCashierCart.class);
|
||||
redisUtil.secAdd(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), cashierCart.getNumber().toString());
|
||||
productSkuMapper.updateAddStockById(jsonObject.getString("skuId"), cashierCart.getNumber());
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -602,6 +618,16 @@ public class CartService {
|
||||
jsonObject1.put("type", "clearCart");
|
||||
jsonObject1.put("amount", BigDecimal.ZERO);
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject2=new JSONObject();
|
||||
jsonObject2.put("type","delete");
|
||||
jsonObject2.put("skuIds",skuIds);
|
||||
jsonObject2.put("shopId",shopId);
|
||||
producer.cons(jsonObject2.toString());
|
||||
|
||||
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), jsonObject.getString("tableId").concat("-").concat(shopId), "", false);
|
||||
} catch (Exception e) {
|
||||
log.info("长链接错误 clearCart{}", e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user