111
This commit is contained in:
1 parent
c34b249d7f
commit
f4c4390352
114 files changed
+8278
-631
No files matched your search
+2
-2
@@ -18,7 +18,7 @@ public enum HardOrderTypeEnum {
|
||||
FOREIGN_TICKET("3", "外来人员"),
|
||||
STRIDE_DEPT("4", "跨单位"),
|
||||
ZY("5", "正元公务餐"),
|
||||
LB("6", "宁波银行(美好生活)"),
|
||||
THIRD_APP("6", "第三方app"),
|
||||
FARMER("7", "共富商城(助农)"),
|
||||
TOC_VISITOR("8", "toc访客购买(不记名用户)"),
|
||||
XFJ("9", "消费机支付"),
|
||||
@@ -32,7 +32,7 @@ public enum HardOrderTypeEnum {
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
public static final List<HardOrderTypeEnum> refundList = List.of(BELOW, RESERVE, FOREIGN_TICKET, ZY, LB, FARMER);
|
||||
public static final List<HardOrderTypeEnum> refundList = List.of(BELOW, RESERVE, FOREIGN_TICKET, ZY, THIRD_APP, FARMER);
|
||||
|
||||
public static final List<HardOrderTypeEnum> payList = List.of(BELOW, RESERVE);
|
||||
|
||||
|
||||
+6
@@ -55,6 +55,9 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeDeptMc
|
||||
|
||||
private List<String> orderPayTypeCodes;
|
||||
|
||||
@Schema(description = "是否有额外支付:true 有,false 无,null 不限制")
|
||||
private Boolean hasExtraPrice;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
private List<String> refundStatusCodes;
|
||||
@@ -69,6 +72,9 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeDeptMc
|
||||
*/
|
||||
private String afterSaleNo;
|
||||
|
||||
/** 第三方底单退款进度:NONE / PARTIAL / FULL / PROCESSING。 */
|
||||
private String thirdRefundState;
|
||||
|
||||
/**
|
||||
* 0 yyyy-MM-dd
|
||||
* 1 yyyy-MM
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.order;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/** 第三方应用底单按金额退款;金额单位为分。 */
|
||||
@Data
|
||||
public class HardThirdOrderRefundDto {
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long orderId;
|
||||
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
@Min(value = 1, message = "退款金额至少为1分")
|
||||
private Integer refundPrice;
|
||||
|
||||
@NotBlank(message = "退款请求编号不能为空")
|
||||
@Pattern(regexp = "[A-Za-z0-9_-]{16,40}", message = "退款请求编号格式不正确")
|
||||
private String requestNo;
|
||||
|
||||
@NotBlank(message = "退款原因不能为空")
|
||||
@Size(max = 200, message = "退款原因不能超过200字")
|
||||
private String applyReason;
|
||||
|
||||
@Size(max = 255, message = "补充说明不能超过255字")
|
||||
private String applyDescription;
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 订单列表实时统计。金额均为整数分,以字符串返回,避免累计金额溢出或前端精度丢失。 */
|
||||
@Data
|
||||
public class HardOrderStatisticsVo {
|
||||
|
||||
private Totals summary = new Totals();
|
||||
private List<Daily> daily = new ArrayList<>();
|
||||
private List<PayType> payTypes = new ArrayList<>();
|
||||
private Totals withoutPayTime = new Totals();
|
||||
private LocalDateTime generatedAt;
|
||||
|
||||
@Data
|
||||
public static class Totals {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orderCount = 0L;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private BigDecimal extraPrice = BigDecimal.ZERO;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private BigDecimal couponPrice = BigDecimal.ZERO;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private BigDecimal payPrice = BigDecimal.ZERO;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private BigDecimal refundPrice = BigDecimal.ZERO;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
public BigDecimal getNetPrice() {
|
||||
return payPrice.subtract(refundPrice);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Daily extends Totals {
|
||||
private LocalDate date;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class PayType extends Totals {
|
||||
private String payType;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Merchant extends Totals {
|
||||
private Long merchantId;
|
||||
private String merchantName;
|
||||
}
|
||||
|
||||
public record MerchantPage(List<Merchant> records, int current, int size, boolean hasMore,
|
||||
LocalDateTime generatedAt) {
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 第三方支付底单及其完整商品、售后记录。 */
|
||||
@Data
|
||||
public class HardThirdOrderDetailVo {
|
||||
private HardOrderVo order;
|
||||
private List<HardCarVo> products;
|
||||
private List<HardAfterSaleEntity> refunds;
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
|
||||
/** 第三方底单专用导出;长编号按文本输出,金额单位为元。 */
|
||||
@Data
|
||||
public class HardThirdOrderExcelVo {
|
||||
@ExcelProperty("第三方订单号")
|
||||
private String thirdOrderNo;
|
||||
@ExcelProperty("平台底单号")
|
||||
private String platformOrderId;
|
||||
@ExcelProperty("支付用户")
|
||||
private String username;
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
@ExcelProperty("用户部门")
|
||||
private String userDeptName;
|
||||
@ExcelProperty("支付商户")
|
||||
private String merchantName;
|
||||
@ExcelProperty("钱包编号")
|
||||
private String walletId;
|
||||
@ExcelProperty("商品描述")
|
||||
private String productDesc;
|
||||
@ExcelProperty("商品总额(元)")
|
||||
private BigDecimal totalPrice;
|
||||
@ExcelProperty("支付差额(元)")
|
||||
private BigDecimal extraPrice;
|
||||
@ExcelProperty("支付金额(元)")
|
||||
private BigDecimal payPrice;
|
||||
@ExcelProperty("累计退款(元)")
|
||||
private BigDecimal refundPrice;
|
||||
@ExcelProperty("剩余可退(元)")
|
||||
private BigDecimal remainingPrice;
|
||||
@ExcelProperty("底单状态")
|
||||
private String status;
|
||||
@ExcelProperty("创建时间")
|
||||
private String createTime;
|
||||
@ExcelProperty("支付时间")
|
||||
private String payTime;
|
||||
@ExcelProperty("最新退款时间")
|
||||
private String refundTime;
|
||||
|
||||
public static HardThirdOrderExcelVo from(HardOrderVo order) {
|
||||
HardThirdOrderExcelVo row = new HardThirdOrderExcelVo();
|
||||
row.setThirdOrderNo(order.getOrderNo());
|
||||
row.setPlatformOrderId(String.valueOf(order.getId()));
|
||||
row.setUsername(order.getUsername());
|
||||
row.setMobile(order.getUserMobile());
|
||||
row.setUserDeptName(order.getUserDeptName());
|
||||
row.setMerchantName(order.getMerchantName());
|
||||
row.setWalletId(order.getWalletId() == null ? "" : String.valueOf(order.getWalletId()));
|
||||
row.setProductDesc(order.getProductDesc());
|
||||
row.setTotalPrice(yuan(order.getTotalPrice()));
|
||||
row.setExtraPrice(yuan(order.getExtraPrice()));
|
||||
row.setPayPrice(yuan(order.getPayPrice()));
|
||||
row.setRefundPrice(yuan(order.getRefundPrice()));
|
||||
row.setRemainingPrice(order.getPayTime() == null ? BigDecimal.ZERO : row.getPayPrice().subtract(row.getRefundPrice()).max(BigDecimal.ZERO));
|
||||
row.setStatus(Arrays.stream(HardOrderStatusEnum.values()).filter(item -> item.getType().equals(order.getOrderStatus()))
|
||||
.map(HardOrderStatusEnum::getDescription).findFirst().orElse(order.getOrderStatus()));
|
||||
if (row.getRefundPrice().signum() > 0) row.setStatus(row.getRefundPrice().compareTo(row.getPayPrice()) >= 0 ? "已全额退款" : "已部分退款");
|
||||
if ("10".equals(order.getRefundStatus())) row.setStatus("退款处理中");
|
||||
row.setCreateTime(order.getCreateTime() == null ? "" : order.getCreateTime().toString().replace('T', ' '));
|
||||
row.setPayTime(order.getPayTime() == null ? "" : order.getPayTime().toString().replace('T', ' '));
|
||||
row.setRefundTime(order.getRefundTime() == null ? "" : order.getRefundTime().toString().replace('T', ' '));
|
||||
return row;
|
||||
}
|
||||
|
||||
private static BigDecimal yuan(Integer cents) {
|
||||
return BigDecimal.valueOf(cents == null ? 0 : cents).movePointLeft(2);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user