小程序店铺信息接口
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
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-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopTableDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 客座数,允许的客座数量
|
||||
*/
|
||||
private Integer maxCapacity;
|
||||
|
||||
/**
|
||||
* 台桌排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 区域Id
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 是否接受网络预定
|
||||
*/
|
||||
private Integer isPredate;
|
||||
|
||||
/**
|
||||
* 网络预定台桌支付金额
|
||||
*/
|
||||
private BigDecimal predateAmount;
|
||||
|
||||
/**
|
||||
* idle-空闲 using-使用中 subscribe预定,closed--关台, opening 开台中,cleaning 台桌清理中
|
||||
*/
|
||||
private String status;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
private String qrcode;
|
||||
|
||||
/**
|
||||
* 自动清台 0手动 1自动
|
||||
*/
|
||||
private Integer autoClear;
|
||||
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime useTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 已点商品数量
|
||||
*/
|
||||
private Integer productNum;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 应付金额
|
||||
*/
|
||||
private BigDecimal realAmount;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer useNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.czg.account.dto.shopinfo;
|
||||
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopTable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ShopInfoByCodeDTO {
|
||||
/**
|
||||
* 当前用户距离店铺的米数
|
||||
*/
|
||||
private double distance;
|
||||
/**
|
||||
* 店铺信息
|
||||
*/
|
||||
private ShopInfo shopInfo;
|
||||
/**
|
||||
* 台桌信息
|
||||
*/
|
||||
private ShopTable shopTable;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.czg.enums.ShopTableStatusEnum;
|
||||
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.math.BigDecimal;
|
||||
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-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_table")
|
||||
public class ShopTable implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 客座数,允许的客座数量
|
||||
*/
|
||||
private Integer maxCapacity;
|
||||
|
||||
/**
|
||||
* 台桌排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 区域Id
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 是否接受网络预定
|
||||
*/
|
||||
private Integer isPredate;
|
||||
|
||||
/**
|
||||
* 网络预定台桌支付金额
|
||||
*/
|
||||
private BigDecimal predateAmount;
|
||||
|
||||
/**
|
||||
* idle-空闲 using-使用中 subscribe预定,closed--关台, opening 开台中,cleaning 台桌清理中
|
||||
*/
|
||||
private String status;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
private String tableCode;
|
||||
|
||||
/**
|
||||
* 自动清台 0手动 1自动
|
||||
*/
|
||||
private Integer autoClear;
|
||||
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
private LocalDateTime useTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 已点商品数量
|
||||
*/
|
||||
private Integer productNum;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 应付金额
|
||||
*/
|
||||
private BigDecimal realAmount;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer useNum;
|
||||
|
||||
public boolean canUseByStatus() {
|
||||
return !ShopTableStatusEnum.CLOSED.equalsVal(status) && !ShopTableStatusEnum.CLEANING.equalsVal(status) && !ShopTableStatusEnum.SUBSCRIBE.equalsVal(status);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.PageDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoByCodeDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoEditDTO;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
@@ -18,4 +19,6 @@ public interface ShopInfoService extends IService<ShopInfo> {
|
||||
Boolean edit(ShopInfoEditDTO shopInfoEditDTO);
|
||||
|
||||
ShopInfo detail();
|
||||
|
||||
ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopTable;
|
||||
|
||||
/**
|
||||
* 台桌配置 服务层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface ShopTableService extends IService<ShopTable> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.czg.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 台桌状态枚举
|
||||
* @author Administrator
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum ShopTableStatusEnum {
|
||||
// 空闲
|
||||
IDLE("idle"),
|
||||
// 使用中
|
||||
USING("using"),
|
||||
// 关台
|
||||
CLOSED("closed"),
|
||||
// 预定
|
||||
SUBSCRIBE("subscribe"),
|
||||
// 清台
|
||||
CLEANING("cleaning");
|
||||
private final String value;
|
||||
|
||||
ShopTableStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equalsVal(String val) {
|
||||
return val.equals(value);
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,19 @@ import lombok.Getter;
|
||||
public enum ShopUserFlowBizEnum {
|
||||
// 会员充值
|
||||
CASH_IN("cashIn"),
|
||||
// 重置奖励
|
||||
AWARD_IN("awardIn"),
|
||||
// 微信小程序充值
|
||||
WECHAT_IN("wechatIn"),
|
||||
// 支付宝小程序重置
|
||||
ALIPAY_IN("alipayIn"),
|
||||
// 订单支付奖励
|
||||
ORDER_PAY("orderPay"),
|
||||
// 订单退款
|
||||
ORDER_REFUND("orderRefund"),
|
||||
// 充值退款
|
||||
RECHARGE_REFUND("rechargeRefund"),
|
||||
// 管理员手动增减余额
|
||||
ADMIN_IN("adminIn");
|
||||
private final String code;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.czg.utils;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public class GeoUtil {
|
||||
// 地球半径,单位:公里
|
||||
private static final double EARTH_RADIUS = 6371.0;
|
||||
|
||||
/**
|
||||
* 计算两点之间的球面距离
|
||||
* @param lat1 第一个点的纬度
|
||||
* @param lon1 第一个点的经度
|
||||
* @param lat2 第二个点的纬度
|
||||
* @param lon2 第二个点的经度
|
||||
* @return 距离(单位:米)
|
||||
*/
|
||||
public static double getDistance(double lat1, double lon1, double lat2, double lon2) {
|
||||
// 将角度转换为弧度
|
||||
double radLat1 = Math.toRadians(lat1);
|
||||
double radLat2 = Math.toRadians(lat2);
|
||||
double deltaLat = radLat2 - radLat1;
|
||||
double deltaLon = Math.toRadians(lon2 - lon1);
|
||||
|
||||
// Haversine 公式
|
||||
double a = Math.pow(Math.sin(deltaLat / 2), 2) +
|
||||
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(deltaLon / 2), 2);
|
||||
double c = 2 * Math.asin(Math.sqrt(a));
|
||||
|
||||
// 计算距离(米)
|
||||
return EARTH_RADIUS * c * 1000;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user