Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -26,9 +26,14 @@ public class RabbitConfig {
|
||||
// 设置消息过期时间为 180000 毫秒(即 180 秒)
|
||||
args.put("x-message-ttl", 180000);
|
||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE, true, false, false, args);
|
||||
// return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE, true, false, false, null);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue orderCancelQueue() {
|
||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_CANCEL_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue orderStockQueue() {
|
||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_STOCK_QUEUE, true);
|
||||
|
||||
@@ -11,6 +11,7 @@ public interface RabbitConstants {
|
||||
|
||||
class Queue {
|
||||
public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
|
||||
public static final String ORDER_CANCEL_QUEUE = "order.cancel.queue";
|
||||
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,24 +17,35 @@ public class RabbitPublisher {
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
* 订单取消消息
|
||||
* 目前 用来回滚库存
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
public void sendOrderCancelMsg(String orderId) {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存损耗消息
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
public void sendOrderStockMsg(String orderId) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||
sendMsg(RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单打印消息
|
||||
* @param orderId
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
public void sendOrderPrintMsg(String orderId) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
}
|
||||
|
||||
private void sendMsg(String exchange, String queue, String msg) {
|
||||
rabbitTemplate.convertAndSend(activeProfile + "-" + exchange, activeProfile + "-" + queue, msg);
|
||||
|
||||
|
||||
private void sendMsg(String queue, String msg) {
|
||||
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,35 +40,9 @@ public class RedisConfig {
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
redisTemplate.setConnectionFactory(factory);
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForHash();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ValueOperations<String, String> valueOperations(RedisTemplate<String, String> redisTemplate) {
|
||||
return redisTemplate.opsForValue();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForList();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForSet();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForZSet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ public interface RedisCst {
|
||||
String LOGIN_CODE = "login:code:";
|
||||
String SYS_LOG_KEY = "sys:log:";
|
||||
|
||||
/**
|
||||
* key过期监听
|
||||
*/
|
||||
class classKeyExpired {
|
||||
//订单key过期
|
||||
public static final String EXPIRED_ORDER = "expired.order:";
|
||||
}
|
||||
|
||||
|
||||
String SMS_CODE = "sms:code:";
|
||||
@@ -41,7 +48,7 @@ public interface RedisCst {
|
||||
}
|
||||
|
||||
|
||||
static String getPrintOrderDetailKey(Long orderId) {
|
||||
return PRINT_ORDER_DETAIL + orderId;
|
||||
static String getPrintOrderDetailKey(Long orderId, Long detailId) {
|
||||
return PRINT_ORDER_DETAIL + orderId + ":" + detailId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.czg.service;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -17,6 +19,8 @@ import java.util.concurrent.TimeUnit;
|
||||
@Component
|
||||
public class RedisService {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(RedisService.class);
|
||||
|
||||
/**
|
||||
* 默认过期时长为24小时,单位:秒
|
||||
*/
|
||||
@@ -59,6 +63,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -83,6 +88,7 @@ public class RedisService {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -127,6 +133,7 @@ public class RedisService {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -148,6 +155,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -215,6 +223,7 @@ public class RedisService {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -235,6 +244,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -252,6 +262,7 @@ public class RedisService {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -273,6 +284,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -346,6 +358,7 @@ public class RedisService {
|
||||
try {
|
||||
return Boolean.TRUE.equals(redisTemplate.opsForSet().isMember(key, value));
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -471,6 +484,7 @@ public class RedisService {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -491,6 +505,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -507,6 +522,7 @@ public class RedisService {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -527,6 +543,7 @@ public class RedisService {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -544,6 +561,7 @@ public class RedisService {
|
||||
redisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("redis error:{}", e + "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
package com.czg.account.dto.ad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 店铺广告 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-26
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopAdDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
@NotNull(message = "id不为空", groups = {UpdateGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
@NotBlank(message = "展示位置不为空", groups = InsertGroup.class)
|
||||
private String showPosition;
|
||||
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
@NotBlank(message = "显示频率不为空", groups = InsertGroup.class)
|
||||
private String frequency;
|
||||
|
||||
/**
|
||||
* 广告状态:0未启用,1已启用
|
||||
*/
|
||||
@NotNull(message = "广告状态不为空", groups = InsertGroup.class)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
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_ad")
|
||||
public class ShopAd implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺id,如果是通用广告则为0
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
private String showPosition;
|
||||
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
private String frequency;
|
||||
|
||||
/**
|
||||
* 广告状态:0未启用,1已启用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopAd;
|
||||
|
||||
/**
|
||||
* 店铺广告 服务层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-26
|
||||
*/
|
||||
public interface ShopAdService extends IService<ShopAd> {
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import java.time.LocalDateTime;
|
||||
public interface OrderInfoService extends IService<OrderInfo> {
|
||||
|
||||
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
|
||||
HistoryOrderVo historyOrder(Long orderId);
|
||||
HistoryOrderVo historyOrder(Long orderId,String tableCode);
|
||||
OrderInfo createOrder(OrderInfoAddDTO param);
|
||||
|
||||
OrderInfo checkOrderPay(CheckOrderPay param);
|
||||
@@ -35,4 +35,6 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||
void refundCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
||||
|
||||
void upOrderInfo(OrderInfo orderInfo, BigDecimal payAmount, LocalDateTime payTime, Long payOrderId, PayEnums payType);
|
||||
|
||||
void expired(Long orderId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user