打印移动到order模块
This commit is contained in:
@@ -7,7 +7,6 @@ import com.czg.account.vo.LoginVO;
|
|||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.annotation.SaStaffCheckPermission;
|
import com.czg.annotation.SaStaffCheckPermission;
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.mq.PrintMqListener;
|
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -53,13 +52,11 @@ public class AuthorizationController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
|
||||||
PrintMqListener printMqListener;
|
|
||||||
@Resource
|
@Resource
|
||||||
RabbitPublisher rabbitPublisher;
|
RabbitPublisher rabbitPublisher;
|
||||||
@GetMapping("test")
|
@GetMapping("test")
|
||||||
public CzgResult<?> login() {
|
public CzgResult<?> login() {
|
||||||
rabbitPublisher.sendOrderPrintMsg("1");
|
rabbitPublisher.sendOrderPrintMsg("552");
|
||||||
// printMqListener.orderPrint("1");
|
// printMqListener.orderPrint("1");
|
||||||
// return CzgResult.success(Map.of("token", StpKit.USER.getShopId()));
|
// return CzgResult.success(Map.of("token", StpKit.USER.getShopId()));
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,21 +3,19 @@ package com.czg.mq;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
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.entity.PrintMachine;
|
||||||
import com.czg.account.service.MqLogService;
|
import com.czg.order.service.MqLogService;
|
||||||
import com.czg.account.service.PrintMachineService;
|
import com.czg.account.service.PrintMachineService;
|
||||||
import com.czg.config.RabbitConstants;
|
import com.czg.config.RabbitConstants;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderInfoService;
|
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 com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -32,12 +30,12 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class PrintMqListener {
|
public class PrintMqListener {
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private OrderInfoService orderInfoService;
|
private PrintMachineService printMachineService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MqLogService mqLogService;
|
private OrderInfoService orderInfoService;
|
||||||
@Resource
|
@Resource
|
||||||
private PrintMachineService printMachineService;
|
private MqLogService mqLogService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Resource
|
@Resource
|
||||||
private PrinterHandler printerHandler;
|
private PrinterHandler printerHandler;
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.czg.account.service;
|
package com.czg.order.service;
|
||||||
|
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import com.czg.account.entity.MqLog;
|
import com.czg.order.entity.MqLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务层。
|
* 服务层。
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import com.czg.account.entity.CallQueue;
|
import com.czg.account.entity.CallQueue;
|
||||||
import com.czg.account.service.CallQueueService;
|
import com.czg.account.service.CallQueueService;
|
||||||
import com.czg.service.account.mapper.CallQueueMapper;
|
import com.czg.service.account.mapper.CallQueueMapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* @since 2025-02-21
|
* @since 2025-02-21
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@DubboService
|
||||||
public class CallQueueServiceImpl extends ServiceImpl<CallQueueMapper, CallQueue> implements CallQueueService{
|
public class CallQueueServiceImpl extends ServiceImpl<CallQueueMapper, CallQueue> implements CallQueueService{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import com.czg.service.account.mapper.CallTableMapper;
|
import com.czg.service.account.mapper.CallTableMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
* @since 2025-02-21
|
* @since 2025-02-21
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@DubboService
|
||||||
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
|
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
|
||||||
// @DubboReference
|
// @DubboReference
|
||||||
private SysParamsService sysParamsService;
|
private SysParamsService sysParamsService;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import com.czg.account.entity.PrintMachine;
|
import com.czg.account.entity.PrintMachine;
|
||||||
import com.czg.account.service.PrintMachineService;
|
import com.czg.account.service.PrintMachineService;
|
||||||
import com.czg.service.account.mapper.PrintMachineMapper;
|
import com.czg.service.account.mapper.PrintMachineMapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* @since 2025-02-20
|
* @since 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@DubboService
|
||||||
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
|
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -29,6 +30,7 @@ import java.util.Objects;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@DubboService
|
@DubboService
|
||||||
|
@Service
|
||||||
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
||||||
@Resource
|
@Resource
|
||||||
private SysUserService sysUserService;
|
private SysUserService sysUserService;
|
||||||
|
|||||||
@@ -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{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -38,6 +39,7 @@ import static com.mybatisflex.core.query.QueryMethods.column;
|
|||||||
* @since 2025-02-08
|
* @since 2025-02-08
|
||||||
*/
|
*/
|
||||||
@DubboService
|
@DubboService
|
||||||
|
@Service
|
||||||
public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> implements ShopUserService {
|
public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> implements ShopUserService {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopUserFlowService shopUserFlowService;
|
private ShopUserFlowService shopUserFlowService;
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.czg.service.account.mapper;
|
package com.czg.service.order.mapper;
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.czg.account.entity.MqLog;
|
import com.czg.order.entity.MqLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 映射层。
|
* 映射层。
|
||||||
@@ -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.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.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.PrintMachine;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
@@ -17,15 +11,6 @@ import com.czg.order.entity.OrderInfo;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
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.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -34,14 +19,8 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.client.RestTemplate;
|
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.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +28,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FeiPrinter extends PrinterHandler implements PrinterImpl{
|
public class FeiPrinter extends PrinterHandler implements PrinterImpl {
|
||||||
@Resource
|
@Resource
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
@@ -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.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -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.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.ArrayUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
@@ -26,7 +23,7 @@ import com.czg.product.service.ProdSkuService;
|
|||||||
import com.czg.product.service.ProductService;
|
import com.czg.product.service.ProductService;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.service.RedisService;
|
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.dto.SysParamsDTO;
|
||||||
import com.czg.system.service.SysParamsService;
|
import com.czg.system.service.SysParamsService;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
@@ -40,7 +37,10 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
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;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,23 +53,23 @@ public abstract class PrinterHandler {
|
|||||||
protected PrinterHandler nextPrinter;
|
protected PrinterHandler nextPrinter;
|
||||||
protected String printerBrand;
|
protected String printerBrand;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
protected OrderDetailService orderDetailService;
|
||||||
|
@Resource
|
||||||
|
protected OrderInfoService orderInfoService;
|
||||||
@Resource
|
@Resource
|
||||||
protected RedisService redisService;
|
protected RedisService redisService;
|
||||||
@Resource
|
|
||||||
protected ShopUserService shopUserService;
|
|
||||||
@Resource
|
|
||||||
protected CallQueueService callQueueService;
|
|
||||||
@Resource
|
|
||||||
protected CallTableService callTableService;
|
|
||||||
@Resource
|
|
||||||
protected ShopInfoService shopInfoService;
|
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected SysParamsService sysParamsService;
|
protected SysParamsService sysParamsService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected OrderDetailService orderDetailService;
|
protected ShopUserService shopUserService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected OrderInfoService orderInfoService;
|
protected CallQueueService callQueueService;
|
||||||
|
@DubboReference
|
||||||
|
protected CallTableService callTableService;
|
||||||
|
@DubboReference
|
||||||
|
protected ShopInfoService shopInfoService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
protected ProductService productService;
|
protected ProductService productService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
@@ -150,7 +150,7 @@ public abstract class PrinterHandler {
|
|||||||
|
|
||||||
Map<Long, Boolean> canPrintProMap = partPrint || categoryIds.isEmpty() ? new HashMap<>() :
|
Map<Long, Boolean> canPrintProMap = partPrint || categoryIds.isEmpty() ? new HashMap<>() :
|
||||||
productService.list(new QueryWrapper().in(Product::getCategoryId, categoryIds).in(Product::getId, productIds))
|
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<>();
|
ArrayList<OrderDetail> orderDetails = new ArrayList<>();
|
||||||
tbOrderDetailList.forEach(item -> {
|
tbOrderDetailList.forEach(item -> {
|
||||||
@@ -194,7 +194,7 @@ public abstract class PrinterHandler {
|
|||||||
log.info("准备开始打印订单或菜品单");
|
log.info("准备开始打印订单或菜品单");
|
||||||
// 查询订单详情
|
// 查询订单详情
|
||||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||||
//仅打印后厨-一菜一品
|
//仅打印后厨一菜一品
|
||||||
switch (printMethod) {
|
switch (printMethod) {
|
||||||
case "one" -> onlyKitchen(machine, orderInfo, orderDetailList);
|
case "one" -> onlyKitchen(machine, orderInfo, orderDetailList);
|
||||||
case "normal" ->
|
case "normal" ->
|
||||||
@@ -334,6 +334,7 @@ public abstract class PrinterHandler {
|
|||||||
if (isTemporary == 1) {
|
if (isTemporary == 1) {
|
||||||
it.setProductName("【临】%s".formatted(it.getProductName()));
|
it.setProductName("【临】%s".formatted(it.getProductName()));
|
||||||
}
|
}
|
||||||
|
it.setPackAmount(it.getPackAmount() == null ? BigDecimal.ZERO : it.getPackAmount());
|
||||||
boolean isGift = it.getPackAmount().compareTo(BigDecimal.ZERO) == 0;
|
boolean isGift = it.getPackAmount().compareTo(BigDecimal.ZERO) == 0;
|
||||||
if (isGift) {
|
if (isGift) {
|
||||||
it.setProductName("【赠】%s".formatted(it.getProductName()));
|
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,
|
protected abstract void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum,
|
||||||
String codeUrl, LocalDateTime takeTime, String shopNote);
|
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("包含");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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.date.DateUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
@@ -14,7 +14,6 @@ import lombok.experimental.Accessors;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -201,7 +200,7 @@ public interface PrinterImpl {
|
|||||||
if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
|
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
||||||
for (int i = 0; i < subItems.size(); i++) {
|
for (int i = 0; i < subItems.size(); i++) {
|
||||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||||
int qty = subItems.getJSONObject(i).getInt("number");
|
int qty = subItems.getJSONObject(i).getInt("number");
|
||||||
@@ -325,7 +324,7 @@ public interface PrinterImpl {
|
|||||||
// builder.append("<S><L>备注: ").append(note).append(" </L></S><BR>");
|
// builder.append("<S><L>备注: ").append(note).append(" </L></S><BR>");
|
||||||
}
|
}
|
||||||
if (!StrUtil.isBlank(proGroupInfo) && JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
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++) {
|
for (int i = 0; i < subItems.size(); i++) {
|
||||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||||
int qty = subItems.getJSONObject(i).getInt("number");
|
int qty = subItems.getJSONObject(i).getInt("number");
|
||||||
@@ -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.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.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
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.PrintMachine;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
@@ -23,7 +19,6 @@ import org.springframework.util.MultiValueMap;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -55,7 +50,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
super("yxyPrinter");
|
super("yxyPrinter");
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrinterImpl.PrintSignLabel printSignLabel = new PrinterImpl.PrintSignLabel()
|
private PrintSignLabel printSignLabel = new PrintSignLabel()
|
||||||
.setBr("<BR>")
|
.setBr("<BR>")
|
||||||
.setCut("<PCUT>")
|
.setCut("<PCUT>")
|
||||||
.setOut("OUT")
|
.setOut("OUT")
|
||||||
@@ -67,7 +62,7 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
|||||||
.setBold(new String[]{"<B>", "</B>"});
|
.setBold(new String[]{"<B>", "</B>"});
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrinterImpl.PrintSignLabel getSignLabelInfo() {
|
public PrintSignLabel getSignLabelInfo() {
|
||||||
return printSignLabel;
|
return printSignLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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.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;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user