|
|
@@ -0,0 +1,386 @@
|
|
|
+package com.zhongshu.card.server.core.model.payment;
|
|
|
+
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
+import com.github.microservice.models.type.DeviceType;
|
|
|
+import com.github.microservice.models.type.OrderFromType;
|
|
|
+import com.github.microservice.pay.client.model.ledger.TransactionLogModel;
|
|
|
+import com.github.microservice.types.OrderModeType;
|
|
|
+import com.github.microservice.types.OrderState;
|
|
|
+import com.github.microservice.types.payment.ChargeableType;
|
|
|
+import com.github.microservice.types.payment.PaymentDeviceType;
|
|
|
+import com.github.microservice.types.payment.PaymentType;
|
|
|
+import com.zhongshu.card.client.model.school.AreaSimpleModel;
|
|
|
+import com.zhongshu.card.client.type.RefundState;
|
|
|
+import com.zhongshu.card.client.type.payAccount.RechargeOrderStatus;
|
|
|
+import com.zhongshu.card.client.type.payment.OrderType;
|
|
|
+import com.zhongshu.card.client.type.payment.SettlementState;
|
|
|
+import com.zhongshu.card.client.utils.DateUtils;
|
|
|
+import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
+import com.zhongshu.card.server.core.domain.payment.RefundRecord;
|
|
|
+import com.zhongshu.card.server.core.domain.school.CardInfo;
|
|
|
+import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
+import lombok.Data;
|
|
|
+import org.springframework.data.mongodb.core.index.Indexed;
|
|
|
+import org.springframework.data.mongodb.core.mapping.DBRef;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Data
|
|
|
+public class ExpenseFlowUnionWithModel {
|
|
|
+
|
|
|
+ private String id;
|
|
|
+
|
|
|
+ private OrderType type;
|
|
|
+
|
|
|
+ private Long createTime;
|
|
|
+
|
|
|
+ private Long updateTime;
|
|
|
+
|
|
|
+ @Schema(description = "所属机构ID")
|
|
|
+ private String oid;
|
|
|
+
|
|
|
+ @Schema(description = "所属项目oid")
|
|
|
+ private String projectOid;
|
|
|
+
|
|
|
+ @Schema(description = "数据主题的oid")
|
|
|
+ private String aboutOid;
|
|
|
+
|
|
|
+ @Schema(description = "数据主题管理的oid机构类型")
|
|
|
+ private AuthType aboutAuthType;
|
|
|
+
|
|
|
+ @Schema(description = "排序")
|
|
|
+ private Long sort = 1l;
|
|
|
+
|
|
|
+ @Schema(description = "备注")
|
|
|
+ private String remark;
|
|
|
+
|
|
|
+ @Schema(description = "是否删除")
|
|
|
+ private Boolean isDelete = Boolean.FALSE;
|
|
|
+
|
|
|
+ @Schema(description = "创建用户ID")
|
|
|
+ private String createUserId;
|
|
|
+
|
|
|
+ @Schema(description = "添加用户名称")
|
|
|
+ private String createUserName;
|
|
|
+
|
|
|
+ @Schema(description = "添加用户电话", hidden = true)
|
|
|
+ private String createPhone;
|
|
|
+
|
|
|
+ @Schema(description = "创建用户ID")
|
|
|
+ private String updateUserId;
|
|
|
+
|
|
|
+ @Schema(description = "添加用户名称")
|
|
|
+ private String updateUserName;
|
|
|
+
|
|
|
+ @Schema(description = "添加用户电话", hidden = true)
|
|
|
+ private String updatePhone;
|
|
|
+
|
|
|
+ //-----------------------------订单信息 start---------------------
|
|
|
+ @Indexed(unique = true, sparse = true)
|
|
|
+ @Schema(description = "mqtt推送生成的业务数据ID")
|
|
|
+ private String mqttDataId;
|
|
|
+
|
|
|
+ @Schema(description = "")
|
|
|
+ private String token;
|
|
|
+
|
|
|
+ @Schema(description = "订单的总体状态")
|
|
|
+ private OrderState orderState;
|
|
|
+
|
|
|
+ @Schema(description = "订单创建类型, 是消费还是查询余额")
|
|
|
+ private OrderModeType orderModeType;
|
|
|
+
|
|
|
+ @Schema(description = "消费类型,如:餐饮消费、水费、电费 等等")
|
|
|
+ private String payType;
|
|
|
+
|
|
|
+ @Schema(description = "订单计费方式")
|
|
|
+ private ChargeableType chargeableType = ChargeableType.Specified;
|
|
|
+
|
|
|
+ @Schema(description = "是否指定支付渠道")
|
|
|
+ private Boolean appointPaymentType = Boolean.FALSE;
|
|
|
+
|
|
|
+ @Schema(description = "支付方式")
|
|
|
+ private PaymentType paymentType;
|
|
|
+
|
|
|
+ @Schema(description = "支付来源:刷卡 二维码 刷脸")
|
|
|
+ private OrderFromType orderFromType;
|
|
|
+
|
|
|
+ @Schema(description = "订单生效时间")
|
|
|
+ private Long startTime;
|
|
|
+
|
|
|
+ @Schema(description = "订单支付失效时间, (不会为空,有默认值)")
|
|
|
+ private Long expirationTime;
|
|
|
+
|
|
|
+ @Schema(description = "消费金额(单位:分)")
|
|
|
+ private BigDecimal payAmount;
|
|
|
+
|
|
|
+ @Schema(description = "服务id、商品id")
|
|
|
+ private String productProvideId;
|
|
|
+
|
|
|
+ @Schema(description = "是否允许匿名下单")
|
|
|
+ private Boolean isAnonymous = Boolean.FALSE;
|
|
|
+
|
|
|
+ //----------------------------消费关联的用户信息 start ----------------------
|
|
|
+ @Schema(description = "消费的用户userId")
|
|
|
+ private String userId;
|
|
|
+
|
|
|
+ @Schema(description = "用户名称")
|
|
|
+ private String userName;
|
|
|
+
|
|
|
+ @Schema(description = "用户信息")
|
|
|
+ private UserAccount userAccount;
|
|
|
+
|
|
|
+ //-----------------------修复关联的设备信息 start--------------------
|
|
|
+
|
|
|
+ @Schema(description = "是否是设备订单")
|
|
|
+ private Boolean isDeviceOrder = Boolean.TRUE;
|
|
|
+
|
|
|
+ @Schema(description = "消费机设备ID")
|
|
|
+ private String deviceId;
|
|
|
+
|
|
|
+ @Schema(description = "设备类型")
|
|
|
+ private DeviceType deviceType;
|
|
|
+
|
|
|
+ @Schema(description = "设备所属区域信息")
|
|
|
+ private AreaSimpleModel area;
|
|
|
+
|
|
|
+ @Schema(description = "所属项目的code")
|
|
|
+ private String projectCode;
|
|
|
+
|
|
|
+ @Schema(description = "订单所属的商户")
|
|
|
+ private String shopOid;
|
|
|
+
|
|
|
+ //------------------------------消费关联的卡片信息 ---------------------
|
|
|
+
|
|
|
+ @Schema(description = "支付设备和方式")
|
|
|
+ private PaymentDeviceType paymentDeviceType;
|
|
|
+
|
|
|
+ @Schema(description = "卡片的编号,也是终端刷卡的 卡号")
|
|
|
+ private String cardNo = "";
|
|
|
+
|
|
|
+ @Schema(description = "卡片信息")
|
|
|
+ private CardInfo cardInfo;
|
|
|
+
|
|
|
+ @Schema(description = "消费订单号")
|
|
|
+ private String orderNo;
|
|
|
+
|
|
|
+ @Indexed
|
|
|
+ @Schema(description = "支付订单号")
|
|
|
+ private String paymentNo;
|
|
|
+
|
|
|
+ @Schema(description = "付款码内容")
|
|
|
+ private String qr;
|
|
|
+
|
|
|
+ @Schema(description = "关联信息")
|
|
|
+ @Indexed
|
|
|
+ private Object param;
|
|
|
+
|
|
|
+ //-----------------------订单创建-支付信息 start----------------------
|
|
|
+
|
|
|
+ @Schema(description = "订单是否创建成功")
|
|
|
+ private Boolean isCreateSuccess = Boolean.TRUE;
|
|
|
+
|
|
|
+ @Schema(description = "验证参数是否符合要求,可以发起支付")
|
|
|
+ private Boolean verifyParamIsSuccess = Boolean.TRUE;
|
|
|
+
|
|
|
+ @Schema(description = "验证参数的提示")
|
|
|
+ private String verifyParamMsg;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置参数验证错误
|
|
|
+ *
|
|
|
+ * @param error
|
|
|
+ */
|
|
|
+ public void setVerifyError(String error) {
|
|
|
+ verifyParamIsSuccess = Boolean.FALSE;
|
|
|
+ verifyParamMsg = error;
|
|
|
+ orderState = OrderState.PARAM_ERROR;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Schema(description = "是否必须支付,当是离线的时候,是先在边缘计算,再后面付款,则这个订单用户必须支付")
|
|
|
+ private Boolean isMustPay = Boolean.FALSE;
|
|
|
+
|
|
|
+ //------------------支付结果 start-------------------------
|
|
|
+
|
|
|
+ @Schema(description = "失败时的重复次数")
|
|
|
+ private Integer repeatTime = 0;
|
|
|
+
|
|
|
+ @Schema(description = "支付订单状态")
|
|
|
+ private String paymentStatus;
|
|
|
+
|
|
|
+ @Schema(description = "支付是否成功,为空就是未支付过")
|
|
|
+ private Boolean isPaySuccess;
|
|
|
+
|
|
|
+ @Schema(description = "调用支付的 支付结果,保存支付结果返回的以后要使用的参数")
|
|
|
+ private JSONObject payResult = new JSONObject();
|
|
|
+
|
|
|
+ @Schema(description = "是否已支付")
|
|
|
+ private Boolean isPaid = Boolean.FALSE;
|
|
|
+
|
|
|
+ @Schema(description = "支付结果备注,返回给设备展示")
|
|
|
+ private String payRemark;
|
|
|
+
|
|
|
+ @Schema(description = "支付开始时间")
|
|
|
+ private Long payStartTime;
|
|
|
+
|
|
|
+ @Schema(description = "支付结束时间")
|
|
|
+ private Long payEndTime;
|
|
|
+
|
|
|
+ @Schema(description = "支付耗用的时间")
|
|
|
+ private Long payMillis = 0L;
|
|
|
+
|
|
|
+ @Schema(description = "支付账单流水ID集合")
|
|
|
+ private List<TransactionLogModel> transactionIds = new ArrayList<TransactionLogModel>();
|
|
|
+
|
|
|
+ //-----------------------退款 start--------------------------
|
|
|
+
|
|
|
+ @Schema(description = "是否退款")
|
|
|
+ private Boolean isRefund;
|
|
|
+
|
|
|
+ @Schema(description = "退款申请人")
|
|
|
+ private String applicant;
|
|
|
+
|
|
|
+ @Schema(description = "操作退款用户userId")
|
|
|
+ private String refundUserId;
|
|
|
+
|
|
|
+ @Schema(description = "退款金额")
|
|
|
+ private BigDecimal refundAMount;
|
|
|
+
|
|
|
+ @Schema(description = "退款状态")
|
|
|
+ private RefundState refundState;
|
|
|
+
|
|
|
+ @Schema(description = "申请退款时间")
|
|
|
+ private Long refundTime;
|
|
|
+
|
|
|
+ @Schema(description = "申请退款备注")
|
|
|
+ private String refundRemark;
|
|
|
+
|
|
|
+ @Schema(description = "退款处理备注")
|
|
|
+ private String refuseRemark;
|
|
|
+
|
|
|
+ @Schema(description = "退款订单号")
|
|
|
+ private String refundNo;
|
|
|
+
|
|
|
+ @Schema(description = "退款后调用账单是否成功")
|
|
|
+ private Boolean refundTransactionIsSuccess = Boolean.FALSE;
|
|
|
+
|
|
|
+ @Schema(description = "退款账单流量")
|
|
|
+ private List<TransactionLogModel> refundTransactionIds = new ArrayList<TransactionLogModel>();
|
|
|
+
|
|
|
+ @Schema(description = "最新关联的退款数据")
|
|
|
+ @DBRef(lazy = true)
|
|
|
+ private RefundRecord refundRecord;
|
|
|
+
|
|
|
+
|
|
|
+ //-------------------------结算信息 start ----------------
|
|
|
+
|
|
|
+ @Schema(description = "结算状态")
|
|
|
+ private SettlementState settlementState = SettlementState.Unsettled;
|
|
|
+
|
|
|
+ @Schema(description = "结算时间")
|
|
|
+ private Long settlementTime;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置支付失败
|
|
|
+ *
|
|
|
+ * @param msg
|
|
|
+ */
|
|
|
+ public void setPayFailed(String msg) {
|
|
|
+ this.paymentStatus = "支付失败";
|
|
|
+ this.isPaySuccess = Boolean.FALSE;
|
|
|
+ this.payRemark = msg;
|
|
|
+ this.orderState = OrderState.PAID_ERROR;
|
|
|
+ this.isPaid = Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ //------------------------------时间信息 start--------------------
|
|
|
+ @Schema(description = "年份,如:2024")
|
|
|
+ private Integer year;
|
|
|
+
|
|
|
+ @Schema(description = "月份,如:6")
|
|
|
+ private Integer month;
|
|
|
+
|
|
|
+ @Schema(description = "当前月的第几天")
|
|
|
+ private Integer dayOfMonth;
|
|
|
+
|
|
|
+ @Schema(description = "今年第几周,如:32")
|
|
|
+ private Integer week;
|
|
|
+
|
|
|
+ @Schema(description = "当前年的第几天")
|
|
|
+ private Integer dayOfYear;
|
|
|
+
|
|
|
+ @Schema(description = "当前的第几小时")
|
|
|
+ private Integer hourOfDay;
|
|
|
+
|
|
|
+ @Schema(description = "消费创建时间 yyyy-MM-dd HH:mm:ss SSS")
|
|
|
+ private String paymentTime;
|
|
|
+
|
|
|
+ public void setTimes() {
|
|
|
+ this.year = DateUtils.getCurrentYear();
|
|
|
+ this.month = DateUtils.getCurrentMonthInYear();
|
|
|
+ this.dayOfMonth = DateUtils.getCurrentDayInMonth();
|
|
|
+ this.hourOfDay = DateUtils.getCurrentHourOfDay();
|
|
|
+
|
|
|
+ this.dayOfYear = DateUtils.getCurrentDayInYear();
|
|
|
+ this.week = DateUtils.getCurrentWeekInYear();
|
|
|
+ this.paymentTime = DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS);
|
|
|
+ }
|
|
|
+ //------------------------------时间信息 end----------------------
|
|
|
+
|
|
|
+ @Schema(description = "扩展字段")
|
|
|
+ private Map<String, Object> metaInfo = new HashMap<>();
|
|
|
+
|
|
|
+ public void addMetaInfo(String key, Object value) {
|
|
|
+ if (metaInfo == null) {
|
|
|
+ metaInfo = new HashMap<>();
|
|
|
+ }
|
|
|
+ metaInfo.put(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object getMetaInfo(String key) {
|
|
|
+ if (metaInfo != null && metaInfo.containsKey(key)) {
|
|
|
+ return metaInfo.get(key);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //*****************************************充值订单字段**************************************************//
|
|
|
+
|
|
|
+// @Schema(description = "项目oid")
|
|
|
+// private String projectOid;
|
|
|
+//
|
|
|
+// @Schema(description = "机构oid")
|
|
|
+// private String oid;
|
|
|
+//
|
|
|
+// @Schema(description = "用户id")
|
|
|
+// private String userId;
|
|
|
+//
|
|
|
+// @Schema(description = "支付方式")
|
|
|
+// private PaymentType paymentType;
|
|
|
+
|
|
|
+ @Schema(description = "支付账户")
|
|
|
+ private String payAccount;
|
|
|
+
|
|
|
+ @Schema(description = "订单状态")
|
|
|
+ private RechargeOrderStatus status;
|
|
|
+
|
|
|
+ @Schema(description = "状态说明")
|
|
|
+ private String statusDesc;
|
|
|
+
|
|
|
+ @Schema(description = "金额")
|
|
|
+ private BigDecimal total = BigDecimal.ZERO;
|
|
|
+
|
|
|
+// @Schema(description = "订单号")
|
|
|
+// private String orderNo;
|
|
|
+
|
|
|
+ @Schema(description = "描述")
|
|
|
+ private String description;
|
|
|
+
|
|
|
+ /********************************渠道所属参数*********************************/
|
|
|
+ @Schema(description = "预支付单号(用于前端调起支付的参数)")
|
|
|
+ private Object prepay;
|
|
|
+}
|