|
@@ -0,0 +1,165 @@
|
|
|
|
|
+package com.cyksj.model.excel;
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
|
|
|
+import com.alibaba.excel.annotation.ExcelProperty;
|
|
|
|
|
+import com.cyksj.model.entity.VipOrderDon;
|
|
|
|
|
+import com.ejlchina.searcher.bean.DbField;
|
|
|
|
|
+import com.ejlchina.searcher.bean.SearchBean;
|
|
|
|
|
+import lombok.Getter;
|
|
|
|
|
+import lombok.Setter;
|
|
|
|
|
+
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.math.RoundingMode;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 项目名: yhlxj11111111
|
|
|
|
|
+ * 文件名: ExcelVipOrderDonData
|
|
|
|
|
+ * 创建者: JavaZou
|
|
|
|
|
+ * 创建时间:2025/10/13 14:11
|
|
|
|
|
+ */
|
|
|
|
|
+@Getter
|
|
|
|
|
+@Setter
|
|
|
|
|
+@SearchBean(tables = "vip_order_don o left join user u on u.id = o.user_id",
|
|
|
|
|
+ where = ":condition:"
|
|
|
|
|
+)
|
|
|
|
|
+@ExcelIgnoreUnannotated
|
|
|
|
|
+public class ExcelVipOrderDonData {
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.id")
|
|
|
|
|
+ private Long id;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.order_no")
|
|
|
|
|
+ @ExcelProperty("订单号")
|
|
|
|
|
+ private String orderNo;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.created_time")
|
|
|
|
|
+ @ExcelProperty("创建时间")
|
|
|
|
|
+ private Date createdTime;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.user_id")
|
|
|
|
|
+ @ExcelProperty("用户ID")
|
|
|
|
|
+ private Long userId;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("u.nickname")
|
|
|
|
|
+ @ExcelProperty("用户名")
|
|
|
|
|
+ private String nickname;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.num")
|
|
|
|
|
+ private Integer num;
|
|
|
|
|
+
|
|
|
|
|
+ @ExcelProperty("开通时长")
|
|
|
|
|
+ private String numStr;
|
|
|
|
|
+
|
|
|
|
|
+ @ExcelProperty("减免金额")
|
|
|
|
|
+ private String reduceStr;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.money/100")
|
|
|
|
|
+ @ExcelProperty("金额")
|
|
|
|
|
+ private BigDecimal money;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.status")
|
|
|
|
|
+ private VipOrderDon.Status status;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.status")
|
|
|
|
|
+ @ExcelProperty("状态")
|
|
|
|
|
+ private String statusStr;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.refund_money/100")
|
|
|
|
|
+ @ExcelProperty("退款金额")
|
|
|
|
|
+ private BigDecimal refundMoney;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.refund_balance/100")
|
|
|
|
|
+ @ExcelProperty("退款余额")
|
|
|
|
|
+ private BigDecimal refundBalance;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("if(o.popularize_id is null,null,(select name from channel_popularize cp where cp.id = o.popularize_id limit 1))")
|
|
|
|
|
+ @ExcelProperty("渠道")
|
|
|
|
|
+ private String channel = "自然渠道";
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.order_type")
|
|
|
|
|
+ private Integer orderType;
|
|
|
|
|
+
|
|
|
|
|
+ @ExcelProperty("订单类型")
|
|
|
|
|
+ private String orderTypeStr;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.transaction_id")
|
|
|
|
|
+ private String transactionId;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("case when u.login_phone != '' then 'phone' when u.email != '' then 'email' when u.open_id != '' then 'wechat' else 'wechat' end")
|
|
|
|
|
+ private String register;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("case when u.login_phone != '' then concat('手机号',login_phone) when u.email != '' then concat('邮箱',email) when u.open_id != '' then '微信授权' else '微信授权' end")
|
|
|
|
|
+ @ExcelProperty("注册方式")
|
|
|
|
|
+ private String registerStr;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 登录注册手机号
|
|
|
|
|
+ */
|
|
|
|
|
+ @DbField("u.login_phone")
|
|
|
|
|
+ private String loginPhone;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 登录注册邮箱
|
|
|
|
|
+ */
|
|
|
|
|
+ @DbField("u.email")
|
|
|
|
|
+ private String email;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 实际抵扣金额
|
|
|
|
|
+ */
|
|
|
|
|
+ @DbField("o.actually_deduct_money")
|
|
|
|
|
+ private BigDecimal actuallyDeductMoney = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.balance")
|
|
|
|
|
+ private BigDecimal balance;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.refund_desc")
|
|
|
|
|
+ private String refundDesc;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.type")
|
|
|
|
|
+ private VipOrderDon.Type type;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.popularize_id")
|
|
|
|
|
+ private Long popularizeId;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.pay_time")
|
|
|
|
|
+ private Date payTime;
|
|
|
|
|
+
|
|
|
|
|
+ @DbField("o.pay_title")
|
|
|
|
|
+ private String payTitle;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 银河币
|
|
|
|
|
+ */
|
|
|
|
|
+ @DbField("select galaxy_coin from order_don_galaxy_coin_record ord where ord.order_id = o.id limit 1")
|
|
|
|
|
+ private BigDecimal galaxyCoin;
|
|
|
|
|
+
|
|
|
|
|
+ public String getNumStr() {
|
|
|
|
|
+ return this.num + "个月";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getStatusStr() {
|
|
|
|
|
+ return this.status.getDesc();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getReduceStr() {
|
|
|
|
|
+ String str = StrUtil.EMPTY;
|
|
|
|
|
+ if (galaxyCoin != null) {
|
|
|
|
|
+ galaxyCoin = galaxyCoin.divide(BigDecimal.valueOf(100));
|
|
|
|
|
+ str += String.format("使用%s银河币,抵扣%s", galaxyCoin, galaxyCoin.divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (actuallyDeductMoney != null && actuallyDeductMoney.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ if (str.length() > 0) {
|
|
|
|
|
+ str += "\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ str += String.format("车票抵扣¥%s", actuallyDeductMoney.subtract(money).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
|
|
|
|
+ }
|
|
|
|
|
+ return str;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getOrderTypeStr() {
|
|
|
|
|
+ return this.orderType == 1 ? "普通" : "续费";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|