Merge branch 'ww' into test

This commit is contained in:
2024-09-20 10:52:21 +08:00
4 changed files with 32 additions and 5 deletions

View File

@@ -1,12 +1,13 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO;
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.service.FileService;
@@ -174,6 +175,18 @@ public class CommonController {
return new Result(CodeEnum.SUCCESS, extendMapper.queryByShopIdAndAutoKey(Integer.valueOf(map.get("shopId").toString()),map.get("autokey")));
}
/**
* 交班
*/
@GetMapping("common/handoverData")
public Result handoverData(String shopId) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("type", "handover");
PushToClientChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(),shopId);
return Result.success(CodeEnum.SUCCESS);
}
// 检查手机号格式是否正确的方法
private boolean isValidPhoneNumber(String phone) {
return phone.matches("^1[3-9]\\d{9}$");

View File

@@ -14,7 +14,11 @@ import java.util.List;
@WebFilter(urlPatterns = {"/cashierService/*"},filterName = "customFilter")
public class CustomFilter implements Filter {
private static final List<String> unFilterUrlList= Arrays.asList("/cashierService/notify/notifyCallBack","/cashierService/notify/memberInCallBack");
private static final List<String> unFilterUrlList =
Arrays.asList(
"/cashierService/notify/notifyCallBack",
"/cashierService/notify/memberInCallBack"
);
private boolean isfilter(String url){

View File

@@ -160,6 +160,19 @@ public class PushToClientChannelHandlerAdapter extends NettyChannelHandlerAdapte
});
}
@Async
public void AppSendInfo(String message, String shopId) {
log.info("长链接发送交班数据。");
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(shopId);
if (webSockets != null) {
for (ChannelHandlerContext ctx : webSockets.values()) {
sendMesToApp(message, ctx);
}
}
}
//发送打印消息 有重发机制
public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) {
log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo"));
retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message);

View File

@@ -391,9 +391,6 @@ public class ProductService {
if (!CollectionUtils.isEmpty(products)) {
products.parallelStream().forEach(it -> {
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
if (it.getName().equals("烤牛肉")) {
System.out.println("单位:"+tbShopUnit.getName());
}
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
if(check){
List<TbProductGroup> tbProductGroups = tbProductGroupMapper.selectByProductId(it.getShopId(), it.getId().toString());