Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai 2025-02-26 17:42:15 +08:00
commit 813672656d
25 changed files with 264 additions and 120 deletions

View File

@ -7,7 +7,6 @@ import com.czg.account.vo.LoginVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaStaffCheckPermission;
import com.czg.config.RabbitPublisher;
import com.czg.mq.PrintMqListener;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import jakarta.annotation.Resource;
@ -53,13 +52,11 @@ public class AuthorizationController {
return CzgResult.success();
}
@Resource
PrintMqListener printMqListener;
@Resource
RabbitPublisher rabbitPublisher;
@GetMapping("test")
public CzgResult<?> login() {
rabbitPublisher.sendOrderPrintMsg("1");
rabbitPublisher.sendOrderPrintMsg("552");
// printMqListener.orderPrint("1");
// return CzgResult.success(Map.of("token", StpKit.USER.getShopId()));
return CzgResult.success();

View File

@ -0,0 +1,14 @@
package com.czg.controller.admin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 存酒管理
* @author Administrator
*/
@RestController
@RequestMapping
public class ShopStorageGoodController {
}

View File

@ -3,21 +3,19 @@ package com.czg.mq;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.entity.MqLog;
import com.czg.order.entity.MqLog;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.MqLogService;
import com.czg.order.service.MqLogService;
import com.czg.account.service.PrintMachineService;
import com.czg.config.RabbitConstants;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.czg.service.account.print.PrinterHandler;
import com.czg.service.order.print.PrinterHandler;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@ -32,12 +30,12 @@ import java.util.List;
@Slf4j
public class PrintMqListener {
@DubboReference
private OrderInfoService orderInfoService;
private PrintMachineService printMachineService;
@Resource
private MqLogService mqLogService;
private OrderInfoService orderInfoService;
@Resource
private PrintMachineService printMachineService;
private MqLogService mqLogService;
@Lazy
@Resource
private PrinterHandler printerHandler;

View File

@ -0,0 +1,68 @@
package com.czg.account.dto;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 酒品表 实体类
*
* @author zs
* @since 2025-02-26
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ShopStorageGoodDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 酒品名
*/
private String name;
/**
* 图片地址
*/
private String imgUrl;
/**
* 单位
*/
private String unit;
/**
* 有效期()
*/
private Integer period;
/**
* 0:未删除1:已删除
*/
private Integer isDel;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 0:手动1:商品
*/
private Integer source;
/**
* 商户Id
*/
private Long shopId;
}

View File

@ -0,0 +1,74 @@
package com.czg.account.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 酒品表 实体类
*
* @author zs
* @since 2025-02-26
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_storage_good")
public class ShopStorageGood implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 酒品名
*/
private String name;
/**
* 图片地址
*/
private String imgUrl;
/**
* 单位
*/
private String unit;
/**
* 有效期()
*/
private Integer period;
/**
* 0:未删除1:已删除
*/
private Integer isDel;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 0:手动1:商品
*/
private Integer source;
/**
* 商户Id
*/
private Long shopId;
}

View File

@ -0,0 +1,14 @@
package com.czg.account.service;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopStorageGood;
/**
* 酒品表 服务层
*
* @author zs
* @since 2025-02-26
*/
public interface ShopStorageGoodService extends IService<ShopStorageGood> {
}

View File

@ -1,6 +1,5 @@
package com.czg.account.entity;
package com.czg.order.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;

View File

@ -1,7 +1,7 @@
package com.czg.account.service;
package com.czg.order.service;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.MqLog;
import com.czg.order.entity.MqLog;
/**
* 服务层

View File

@ -1,30 +0,0 @@
package com.czg.service.account.enums;
import lombok.Getter;
/**
* 订单状态枚举类
*/
@Getter
public enum OrderStatusEnums {
UNPAID("unpaid", "待支付"),
IN_PRODUCTION("in_production", "制作中"),
WAIT_OUT("wait_out", "待取餐"),
DONE("done", "订单完成"),
REFUNDING("refunding", "申请退单"),
REFUND("refund", "退单"),
PART_REFUND("part_refund", "部分退单"),
CANCELLED("cancelled", "取消订单");
private final String code;
private final String msg;
OrderStatusEnums(String code, String msg) {
this.code = code;
this.msg = msg;
}
}

View File

@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopStorageGood;
/**
* 酒品表 映射层
*
* @author zs
* @since 2025-02-26
*/
public interface ShopStorageGoodMapper extends BaseMapper<ShopStorageGood> {
}

View File

@ -4,6 +4,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.CallQueue;
import com.czg.account.service.CallQueueService;
import com.czg.service.account.mapper.CallQueueMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
* @since 2025-02-21
*/
@Service
@DubboService
public class CallQueueServiceImpl extends ServiceImpl<CallQueueMapper, CallQueue> implements CallQueueService{
}

View File

@ -23,6 +23,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.service.account.mapper.CallTableMapper;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@ -38,6 +39,7 @@ import java.util.stream.Collectors;
* @since 2025-02-21
*/
@Service
@DubboService
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
// @DubboReference
private SysParamsService sysParamsService;

View File

@ -12,6 +12,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.service.account.mapper.PrintMachineMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
* @since 2025-02-20
*/
@Service
@DubboService
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
@Override

View File

@ -21,6 +21,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
@ -29,6 +30,7 @@ import java.util.Objects;
* @author Administrator
*/
@DubboService
@Service
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
@Resource
private SysUserService sysUserService;

View File

@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopStorageGood;
import com.czg.account.service.ShopStorageGoodService;
import com.czg.service.account.mapper.ShopStorageGoodMapper;
import org.springframework.stereotype.Service;
/**
* 酒品表 服务层实现
*
* @author zs
* @since 2025-02-26
*/
@Service
public class ShopStorageGoodServiceImpl extends ServiceImpl<ShopStorageGoodMapper, ShopStorageGood> implements ShopStorageGoodService{
}

View File

@ -25,6 +25,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.RoundingMode;
@ -38,6 +39,7 @@ import static com.mybatisflex.core.query.QueryMethods.column;
* @since 2025-02-08
*/
@DubboService
@Service
public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> implements ShopUserService {
@Resource
private ShopUserFlowService shopUserFlowService;

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopStorageGoodMapper">
</mapper>

View File

@ -1,7 +1,7 @@
package com.czg.service.account.mapper;
package com.czg.service.order.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.MqLog;
import com.czg.order.entity.MqLog;
/**
* 映射层

View File

@ -1,14 +1,8 @@
package com.czg.service.account.print;
package com.czg.service.order.print;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.entity.PrintMachine;
import com.czg.account.entity.ShopInfo;
import com.czg.account.service.ShopInfoService;
@ -17,15 +11,6 @@ import com.czg.order.entity.OrderInfo;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@ -34,14 +19,8 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -49,7 +28,7 @@ import java.util.List;
*/
@Component
@Slf4j
public class FeiPrinter extends PrinterHandler implements PrinterImpl{
public class FeiPrinter extends PrinterHandler implements PrinterImpl {
@Resource
private RestTemplate restTemplate;

View File

@ -1,4 +1,4 @@
package com.czg.service.account.print;
package com.czg.service.order.print;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,10 +1,7 @@
package com.czg.service.account.print;
package com.czg.service.order.print;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray;
@ -26,7 +23,7 @@ import com.czg.product.service.ProdSkuService;
import com.czg.product.service.ProductService;
import com.czg.resp.CzgResult;
import com.czg.service.RedisService;
import com.czg.service.account.enums.OrderStatusEnums;
import com.czg.service.order.enums.OrderStatusEnums;
import com.czg.system.dto.SysParamsDTO;
import com.czg.system.service.SysParamsService;
import com.mybatisflex.core.query.QueryWrapper;
@ -40,7 +37,10 @@ import org.apache.dubbo.config.annotation.DubboReference;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -53,23 +53,23 @@ public abstract class PrinterHandler {
protected PrinterHandler nextPrinter;
protected String printerBrand;
@Resource
protected OrderDetailService orderDetailService;
@Resource
protected OrderInfoService orderInfoService;
@Resource
protected RedisService redisService;
@Resource
protected ShopUserService shopUserService;
@Resource
protected CallQueueService callQueueService;
@Resource
protected CallTableService callTableService;
@Resource
protected ShopInfoService shopInfoService;
@DubboReference
protected SysParamsService sysParamsService;
@DubboReference
protected OrderDetailService orderDetailService;
protected ShopUserService shopUserService;
@DubboReference
protected OrderInfoService orderInfoService;
protected CallQueueService callQueueService;
@DubboReference
protected CallTableService callTableService;
@DubboReference
protected ShopInfoService shopInfoService;
@DubboReference
protected ProductService productService;
@DubboReference
@ -150,7 +150,7 @@ public abstract class PrinterHandler {
Map<Long, Boolean> canPrintProMap = partPrint || categoryIds.isEmpty() ? new HashMap<>() :
productService.list(new QueryWrapper().in(Product::getCategoryId, categoryIds).in(Product::getId, productIds))
.stream().collect(Collectors.toMap(com.czg.product.entity.Product::getId, i -> true));
.stream().collect(Collectors.toMap(Product::getId, i -> true));
ArrayList<OrderDetail> orderDetails = new ArrayList<>();
tbOrderDetailList.forEach(item -> {
@ -194,7 +194,7 @@ public abstract class PrinterHandler {
log.info("准备开始打印订单或菜品单");
// 查询订单详情
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
//仅打印后厨-一菜一品
//仅打印后厨一菜一品
switch (printMethod) {
case "one" -> onlyKitchen(machine, orderInfo, orderDetailList);
case "normal" ->
@ -334,6 +334,7 @@ public abstract class PrinterHandler {
if (isTemporary == 1) {
it.setProductName("【临】%s".formatted(it.getProductName()));
}
it.setPackAmount(it.getPackAmount() == null ? BigDecimal.ZERO : it.getPackAmount());
boolean isGift = it.getPackAmount().compareTo(BigDecimal.ZERO) == 0;
if (isGift) {
it.setProductName("【赠】%s".formatted(it.getProductName()));
@ -424,17 +425,4 @@ public abstract class PrinterHandler {
protected abstract void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum,
String codeUrl, LocalDateTime takeTime, String shopNote);
public static void main(String[] args) {
String a = "1【赠1】1【临1】1【等叫1】1";
if (!a.contains("【赠】")) {
System.out.println("不包含");
}
if (a.indexOf("【临】") != -1) {
System.out.println("包含");
}
if (a.indexOf("【等叫】") != -1) {
System.out.println("包含");
}
}
}

View File

@ -1,4 +1,4 @@
package com.czg.service.account.print;
package com.czg.service.order.print;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.CharsetUtil;
@ -14,7 +14,6 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -201,7 +200,7 @@ public interface PrinterImpl {
if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
continue;
}
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
for (int i = 0; i < subItems.size(); i++) {
String proName = subItems.getJSONObject(i).getStr("proName");
int qty = subItems.getJSONObject(i).getInt("number");
@ -325,7 +324,7 @@ public interface PrinterImpl {
// builder.append("<S><L>备注: ").append(note).append(" </L></S><BR>");
}
if (!StrUtil.isBlank(proGroupInfo) && JSONUtil.isTypeJSONArray(proGroupInfo)) {
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
for (int i = 0; i < subItems.size(); i++) {
String proName = subItems.getJSONObject(i).getStr("proName");
int qty = subItems.getJSONObject(i).getInt("number");

View File

@ -1,13 +1,9 @@
package com.czg.service.account.print;
package com.czg.service.order.print;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.czg.account.entity.PrintMachine;
import com.czg.account.entity.ShopInfo;
import com.czg.account.service.ShopInfoService;
@ -23,7 +19,6 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
@ -55,7 +50,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
super("yxyPrinter");
}
private PrinterImpl.PrintSignLabel printSignLabel = new PrinterImpl.PrintSignLabel()
private PrintSignLabel printSignLabel = new PrintSignLabel()
.setBr("<BR>")
.setCut("<PCUT>")
.setOut("OUT")
@ -67,7 +62,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
.setBold(new String[]{"<B>", "</B>"});
@Override
public PrinterImpl.PrintSignLabel getSignLabelInfo() {
public PrintSignLabel getSignLabelInfo() {
return printSignLabel;
}

View File

@ -1,9 +1,9 @@
package com.czg.service.account.service.impl;
package com.czg.service.order.service.impl;
import com.czg.order.entity.MqLog;
import com.czg.order.service.MqLogService;
import com.czg.service.order.mapper.MqLogMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.MqLog;
import com.czg.account.service.MqLogService;
import com.czg.service.account.mapper.MqLogMapper;
import org.springframework.stereotype.Service;
/**

View File

@ -2,6 +2,6 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.MqLogMapper">
<mapper namespace="com.czg.service.order.mapper.MqLogMapper">
</mapper>