feat:硬件接口

This commit is contained in:
dzc committed 2025-01-06 11:34:40 +08:00
1 parent 85615ba3af
commit f1b216591f
44 files changed
+997 -95

No files matched your search

@@ -13,12 +13,12 @@ import java.util.Arrays;
@Getter
public enum HardTypeEnum {
SUPERMARKET(1, "超市"),
CANTEEN(2, "食堂"),
READ_CARD(3, "读卡器"),
DOOR(4, "生鲜柜"),
SUPERMARKET("1", "超市"),
CANTEEN("2", "食堂"),
READ_CARD("3", "读卡器"),
DOOR("4", "生鲜柜"),
;
private final Integer type;
private final String type;
private final String description;
public static HardTypeEnum valueOfByType(Integer type) {
@@ -0,0 +1,17 @@
package com.bsd.pjcloud.hard.api.dto.hard;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class HardBindDto {
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "设备ID")
private Long id;
@Schema(description = "mac地址", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "mac地址")
private String uniqueCode;
}
@@ -0,0 +1,71 @@
package com.bsd.pjcloud.hard.api.dto.hard;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
@Data
public class HardCreateOrderDto {
@Schema(description = "安卓订单code")
@NotNull(message = "安卓订单code不能为空")
private String androidOrderCode;
@Schema(description = "设备类型")
@NotNull(message = "设备类型不能为空")
private HardTypeEnum sysType;
@Schema(description = "商户id")
@NotNull(message = "商户id不能为空")
private Long merchantId;
@Schema(description = "设备id")
@NotNull(message = "设备id不能为空")
private Long hardwareId;
@Schema(description = "设备名")
private String hardwareName;
@Schema(description = "用餐类型")
@NotNull(message = "用餐类型不能为空")
private Integer hourType;
@Schema(description = "用户id")
@NotNull(message = "用户id不能为空")
private Long userId;
@Schema(description = "订单类型")
@NotNull(message = "订单类型不能为空")
private HardOrderTypeEnum orderType;
@Schema(description = "订单类型渠道id")
private Long orderSourceTypeId;
@Schema(description = "支付类型")
@NotNull(message = "支付类型不能为空")
private HardPayTypeEnum orderPayType;
@Schema(description = "购物车")
@NotEmpty(message = "购物车不能为空")
private List<HardCreateCarDto> list;
@Schema(description = "是否是离线订单")
private Boolean isOfflineOrder;
@Schema(description = "商品的简短描述")
private String productDesc;
private String clientIP;
private Long deptId;
@Schema(description = "离线支付是否成功")
private Boolean offlinePaySuccess;
}
@@ -0,0 +1,23 @@
package com.bsd.pjcloud.hard.api.dto.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class HardCreateCarDto {
@Schema(description = "父购物车id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long parentCarId;
@Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1034")
private Long productId;
// TODO 食堂特有
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20798")
private Integer productCount;
// TODO 超市特有
@Schema(description = "重量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20798")
private BigDecimal productWeight;
}
@@ -4,5 +4,5 @@ import com.bsd.pjcloud.hard.api.entity.order.HardwareOrderEntity;
import lombok.Data;
@Data
public class HardwareOrderDto extends HardwareOrderEntity {
public class HardOrderDto extends HardwareOrderEntity {
}
@@ -3,8 +3,7 @@ package com.bsd.pjcloud.hard.api.entity.order;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -15,6 +14,9 @@ import java.time.LocalDateTime;
* @author dzc
* @date 2025-01-05 16:44:54
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TenantTable
@TableName("hard_car")
@@ -3,8 +3,7 @@ package com.bsd.pjcloud.hard.api.entity.order;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
@@ -14,6 +13,9 @@ import java.time.LocalDateTime;
* @author dzc
* @date 2025-01-05 16:45:33
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TenantTable
@TableName("hard_parent_car")
@@ -6,11 +6,14 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.bsd.pjcloud.hard.api.dto.code.QRCodeDto;
import lombok.experimental.UtilityClass;
import org.apache.commons.lang3.tuple.ImmutablePair;
import javax.xml.stream.events.StartDocument;
@UtilityClass
public class HardUtil {
public Pair<String, String> generate(QRCodeDto dto) {
public ImmutablePair<String, String> generate(QRCodeDto dto) {
String fileName = "qrcode";
if (ObjectUtil.isEmpty(dto.getId())) {
fileName += "_unknown";
@@ -38,7 +41,7 @@ public class HardUtil {
fileName += "_" + dto.getPayType().toString();
}
String coeContent = Base64.encode(JSONUtil.toJsonStr(dto));
return new Pair<>(fileName, coeContent);
return ImmutablePair.of(fileName, coeContent);
}
}
@@ -4,5 +4,5 @@ import com.bsd.pjcloud.hard.api.entity.order.HardwareOrderEntity;
import lombok.Data;
@Data
public class HardwareOrderVo extends HardwareOrderEntity {
public class HardOrderVo extends HardwareOrderEntity {
}