1.二维码增加ysk logo

2.耗材预警调整
This commit is contained in:
2024-07-26 17:04:55 +08:00
parent 95f529e4d7
commit b3fc438e78
3 changed files with 25 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.thread.ThreadUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -30,6 +31,7 @@ import java.math.BigDecimal;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
/**
* @author lyf
@@ -844,17 +846,6 @@ public class CartService {
log.info("开始发送mq消息消耗耗材消息内容{}", jsonObject2);
producer.cons(jsonObject2.toString());
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
// 发送判断耗材是否耗尽消息
JSONObject objectMsg = new JSONObject();
objectMsg.put("skuId", Integer.valueOf(cashierCart.getSkuId()));
objectMsg.put("shopId", Integer.valueOf(cashierCart.getShopId()));
producer.con_msg(objectMsg.toString());
}
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId")).concat("-").concat(shopId), array.toJSONString());
orderInfo.setDetailList(orderDetails);
JSONObject jsonObject1 = new JSONObject();
@@ -874,6 +865,18 @@ public class CartService {
// PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject12.toString(), jsonObject.getString("tableId").concat("-").concat(shopId), "", false);
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject12.toString(), jsonObject.getString("tableId").concat("-").concat(shopId), jsonObject.getString("userId"));
redisUtil.saveMessage(RedisCst.ORDER_EXPIRED.concat(orderId.toString()), orderId.toString(), 60 * 16L);
ThreadUtil.execAsync(() -> {
ThreadUtil.sleep(5, TimeUnit.SECONDS);
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
// 发送判断耗材是否耗尽消息
JSONObject objectMsg = new JSONObject();
objectMsg.put("skuId", Integer.valueOf(cashierCart.getSkuId()));
objectMsg.put("shopId", Integer.valueOf(cashierCart.getShopId()));
producer.con_msg(objectMsg.toString());
}
});
} catch (Exception e) {

View File

@@ -23,12 +23,16 @@ import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -56,9 +60,12 @@ public class UserService {
private final WxAccountUtil wxAccountUtil;
public UserService(FileService fileService, WxAccountUtil wxAccountUtil) {
private final ResourceLoader resourceLoader;
public UserService(FileService fileService, WxAccountUtil wxAccountUtil, ResourceLoader resourceLoader) {
this.fileService = fileService;
this.wxAccountUtil = wxAccountUtil;
this.resourceLoader = resourceLoader;
}
public JSONObject modityIntegral(IntegralVo integralVo, String userSign) {
@@ -254,7 +261,9 @@ public class UserService {
throw new MsgException("店铺不存在");
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId)), new QrConfig(100, 100), "png", outputStream);
Resource resource = resourceLoader.getResource("classpath:/static/logo.png");
InputStream inputStream = resource.getInputStream();
QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId)), new QrConfig(250, 250).setImg(ImageIO.read(inputStream)), "png", outputStream);
return fileService.uploadFileByInputStream(".png", new ByteArrayInputStream(outputStream.toByteArray()));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB