diff --git a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderDetailsResponseVo.java b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderDetailsResponseVo.java new file mode 100644 index 00000000..156c84db --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/OrderDetailsResponseVo.java @@ -0,0 +1,356 @@ +package com.ghy.web.pojo.vo; + +import com.ghy.common.enums.OrderStatus; +import com.ghy.common.utils.DateUtils; +import com.ghy.common.utils.ObjectUtils; +import com.ghy.customer.domain.CustomerAddress; +import com.ghy.order.domain.OrderGoods; +import com.ghy.order.domain.OrderMaster; +import com.ghy.worker.domain.Worker; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + + +/** + * @author : 但星霖 + * @date : 2022-05-30 20:04 + * 订单列表返回数据vo + */ +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class OrderDetailsResponseVo implements Serializable { + + /** + * 序号 + */ + private Long id; + + /** + * 商户ID + */ + private Long deptId; + + /** + * 订单编码 + */ + private String code; + + /** + * 订单序号 + */ + private Long orderId; + + /** + * 订单消费者信息。 + */ + private OrderCustomDetails customDetails; + + /** + * 订单详细信息 + */ + private List detailsList; + + /** + * 订单状态 + */ + private OrderState state; + + /** + * 便签数据 + */ + private OrderMemo memo; + + /** + * 订单流转信息, + */ + private OrderCirculation circulation; + + /** + * 商家信息 + */ + private OrderBusiness business; + + /** + * 接单数据信息 + */ + private OrderReceiving receiving; + + /** + * 订单状态 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderState { + + /** + * 订单状态 + */ + private Integer orderStatus; + + /** + * 订单枚举 + */ + private OrderStatus orderStatusEnum; + + /** + * 订单枚举翻译 + */ + private String orderStatusDesc; + + /** + * 时间 + * 对应不同对状态展现不同对时间数据。 + * 发布时间/接单时间/完成时间 + * 格式为转移后对yyyy-mm-dd hh:ss:mm + */ + private String receivingTime; + + /** + * 修改上门时间次数 + * 单一字段展现。 + */ + private Integer doorFrequency; + + public static OrderState modelDataSupplement(OrderMaster orderMaster){ + OrderState orderState = new OrderState(); + orderState.setOrderStatus(orderMaster.getOrderStatus()); + if(ObjectUtils.isNotNull(orderMaster.getOrderStatus())){ + OrderStatus orderStatusByEnum = OrderStatus.parse(orderMaster.getOrderStatus()); + if(ObjectUtils.isNotNull(orderStatusByEnum)){ + orderState.setOrderStatusEnum(orderStatusByEnum); + orderState.setOrderStatus(orderStatusByEnum.code()); + orderState.setOrderStatusDesc(orderStatusByEnum.desc()); + } + } + if(ObjectUtils.isNull(orderState.getReceivingTime())){ + orderState.setReceivingTime("--"); + }else { + orderState.setReceivingTime(orderState.getReceivingTime()); + } + // todo 此处缺少上门次数字段。 + return orderState; + } + + } + + /** + * 便签数据 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderMemo { + /** + * 便签数据 + */ + private String memoStr; + } + + + /** + * 流转信息 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderCirculation { + /** + * 流转信息文本数据 + */ + private String circulationStr; + + /** + * 流转信息管理员Id + */ + private String circulationUserId; + } + + /** + * 商家信息 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderBusiness { + /** + * 商家id + */ + private String businessId; + + /** + * 商家姓名 + */ + private String businessUserName; + + /** + * 商家电话 + */ + private String businessUserPhone; + } + + /** + * 接单信息 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderReceiving { + /** + * 接单人用户Id + */ + private Long receivingUserId; + + /** + * 接单人用户姓名 + */ + private String receivingUserName; + + /** + * 接单人用户电话 + */ + private String receivingUserPhone; + + /** + * 操作人用户Id + */ + private Long operationUserId; + + /** + * 操作人用户姓名 + */ + private String operationUserName; + + /** + * 操作人用户电话 + */ + private String operationUserPhone; + + public static OrderReceiving modelDataSupplement(Worker workerByReceiving, Worker workerByOperation){ + OrderReceiving orderReceiving = new OrderReceiving(); + // 接单人 + if(ObjectUtils.isNotNull(workerByReceiving)){ + orderReceiving.setReceivingUserId(workerByReceiving.getWorkerId()); + orderReceiving.setReceivingUserName(workerByReceiving.getName()); + orderReceiving.setReceivingUserPhone(workerByReceiving.getPhone()); + } + // 操作人 + if(ObjectUtils.isNotNull(workerByOperation)){ + orderReceiving.setOperationUserId(workerByReceiving.getWorkerId()); + orderReceiving.setOperationUserName(workerByReceiving.getName()); + orderReceiving.setOperationUserPhone(workerByReceiving.getPhone()); + } + return orderReceiving; + } + + } + + /** + * 订单详情 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderDetails { + /** + * 商品规格id + */ + private Long goodsId; + + /** + * 商品名称 + */ + private String goodsName; + + /** + * 商品数量 + */ + private Integer goodsNum; + + /** + * 已服务数量 + */ + private Integer serverGoodsNum; + + /** + * 完成时间 + */ + private String finishTime; + + public static OrderDetails modelDataSupplement(OrderGoods orderGoods){ + OrderDetails orderDetails = new OrderDetails(); + if(ObjectUtils.isNotNull(orderGoods)){ + orderDetails.setGoodsId(orderGoods.getGoodsId()); + orderDetails.setGoodsName(orderGoods.getGoodsName()); + orderDetails.setGoodsNum(orderGoods.getGoodsNum()); + orderDetails.setServerGoodsNum(orderGoods.getServerGoodsNum()); + if(ObjectUtils.isNotNull(orderGoods.getFinishTime())){ + orderDetails.setFinishTime(DateUtils.getDateTimeFormat(orderGoods.getFinishTime())); + }else { + orderDetails.setFinishTime("--"); + } + } + return orderDetails; + } + } + + + /** + * 订单消费者信息 + */ + @Data + @EqualsAndHashCode(callSuper = false) + public static class OrderCustomDetails { + /** + * 消费者id + */ + private Long customerId; + + /** + * 收件人姓名 + */ + private String name; + + /** + * 收件人手机号 + */ + private String phone; + + /** + * 省 + */ + private String provinceName; + + /** + * 市 + */ + private String cityName; + + /** + * 区 + */ + private String countryName; + + /** + * 详细地址 + */ + private String address; + + public static OrderCustomDetails modelDataSupplement(CustomerAddress customerAddress){ + OrderCustomDetails orderCustomDetails = new OrderCustomDetails(); + if(ObjectUtils.isNotNull(customerAddress)){ + orderCustomDetails.setCustomerId(customerAddress.getCustomerId()); + orderCustomDetails.setAddress(customerAddress.getAddress()); + orderCustomDetails.setCityName(customerAddress.getCityName()); + orderCustomDetails.setPhone(customerAddress.getPhone()); + orderCustomDetails.setProvinceName(customerAddress.getProvinceName()); + orderCustomDetails.setName(customerAddress.getName()); + orderCustomDetails.setCountryName(customerAddress.getCountryName()); + } + return orderCustomDetails; + } + } + + + +} diff --git a/ghy-common/src/main/java/com/ghy/common/enums/IEnumType.java b/ghy-common/src/main/java/com/ghy/common/enums/IEnumType.java new file mode 100644 index 00000000..3e16fd12 --- /dev/null +++ b/ghy-common/src/main/java/com/ghy/common/enums/IEnumType.java @@ -0,0 +1,19 @@ +package com.ghy.common.enums; + +/** + * 为了能统一处理数据库中定义的各种状态,状态枚举都需要实现此接口 + * + * @author chunhao.guo + * @date 2020-03-11 + */ +public interface IEnumType { + /** + * 数据库中定义的 数字 状态码 + */ + int code(); + + /** + * 简单描述 + */ + String desc(); +} diff --git a/ghy-common/src/main/java/com/ghy/common/utils/ObjectUtils.java b/ghy-common/src/main/java/com/ghy/common/utils/ObjectUtils.java new file mode 100644 index 00000000..4ed36908 --- /dev/null +++ b/ghy-common/src/main/java/com/ghy/common/utils/ObjectUtils.java @@ -0,0 +1,70 @@ +package com.ghy.common.utils; + +import java.lang.reflect.Array; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +/** + * 对象工具类 + * @since 2022-05-31 + * @author 但星霖 + */ +public class ObjectUtils { + + /** + * 判断object是否为空,集合会校验size + */ + public static boolean isNull(Object... objs) { + for (Object obj : objs) { + if (isEmpty(obj)) { + return true; + } + } + return false; + } + + /** + * 判断object是否不为空,集合会校验size + */ + public static boolean isNotNull(Object... obj) { + return !isNull(obj); + } + + /** + * 对象非空判断 + */ + public static boolean isNotEmpty(Object obj) { + return !isEmpty(obj); + } + + /** + * 对象空判断 + */ + public static boolean isEmpty(Object obj) { + if (obj == null) { + return true; + } + + if (obj.getClass().isArray()) { + return Array.getLength(obj) == 0; + } + if (obj instanceof CharSequence) { + return ((CharSequence) obj).length() == 0; + } + if (obj instanceof Collection) { + return ((Collection) obj).isEmpty(); + } + if (obj instanceof Map) { + return ((Map) obj).isEmpty(); + } + if (obj instanceof Iterable) { + return !((Iterable) obj).iterator().hasNext(); + } + if (obj instanceof Iterator) { + return !((Iterator) obj).hasNext(); + } + // else + return false; + } +}