--- /dev/null
+package com.supwisdom.dlpay.consume;
+
+import com.supwisdom.dlpay.consume.domain.TAccount;
+import com.supwisdom.dlpay.consume.domain.TPerson;
+import com.supwisdom.dlpay.framework.service.PersonPayService;
+import com.supwisdom.dlpay.framework.util.TradeDict;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PayDtlBuilder {
+ public static class PayDetail {
+ private String accNo;
+ private String accName;
+ private Double amount;
+ private String direction;
+ private String summary;
+ }
+
+ private TPerson person;
+ private TAccount account;
+ private String direction;
+
+ private Double payAmount;
+
+ private String summary;
+
+ private List<PayDetail> detail;
+
+ public static PayDtlBuilder newBuilder() {
+ return new PayDtlBuilder();
+ }
+
+ private PayDtlBuilder() {
+ this.detail = new ArrayList<>();
+ }
+
+ public PayDtlBuilder person(TPerson per, TAccount acc, String direction) {
+ this.person = per;
+ this.account = acc;
+ this.direction = direction;
+ return this;
+ }
+
+ public PayDtlBuilder setSummary(String s) {
+ this.summary = s;
+ return this;
+ }
+
+ public PayDtlBuilder setTransDatetime(String transDate ,String transTime) {
+
+ return this;
+ }
+
+ public Boolean done(PersonPayService service) {
+ if (this.detail.size() == 0) {
+ return false;
+ }
+ this.payAmount = 0.0;
+
+ for (PayDetail d : detail) {
+ this.payAmount += d.amount;
+ }
+ if (this.payAmount > this.account.getBalance()) {
+ return false;
+ }
+ service.process(this);
+ return true;
+ }
+
+
+ public PayDtlBuilder addSubDtl(String accNo, Double amount, String summary) {
+ PayDetail dtl = new PayDetail();
+ dtl.accNo = accNo;
+ dtl.accName = "";
+ dtl.amount = amount;
+ if (this.direction.equals(TradeDict.TRANS_DIRECTION_CREDIT)) {
+ dtl.direction = TradeDict.TRANS_DIRECTION_DEBIT;
+ } else {
+ dtl.direction = TradeDict.TRANS_DIRECTION_CREDIT;
+ }
+ dtl.summary = summary;
+ this.detail.add(dtl);
+ return this;
+ }
+}
--- /dev/null
+package com.supwisdom.dlpay.consume.domain;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "t_paycreditdtl")
+public class TPayCreditDtl {
+ private String refno;
+ private Integer rowno;
+ /**
+ * 贷方账号
+ */
+ private String accNo;
+ private String accSubjNo;
+
+ private String otherAccNo;
+
+ /**
+ * 发生金额
+ */
+ private Double amount;
+
+ /**
+ * 交易方向 credit, debit
+ */
+ private String direction;
+
+ /**
+ * 交易摘要
+ */
+ private String summary;
+}
--- /dev/null
+package com.supwisdom.dlpay.consume.domain;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "t_paydtl")
+public class TPaydtl {
+ private String refno;
+ /**
+ * 交易关联个人信息
+ */
+ private String userid;
+ private String name;
+ /**
+ * 记账日期
+ */
+ private String accDate;
+ /**
+ * 交易发生日期
+ */
+ private String transDate;
+ private String transTime;
+
+ /**
+ * 交易代码
+ */
+ private Integer transCode;
+ private String transName;
+ /**
+ * 可选值 init, wip, success, failed
+ */
+ private String status;
+ /**
+ * 交易总金额
+ */
+ private Double amount;
+ /**
+ * 交易前个人账户余额
+ */
+ private Double befBalance;
+ /**
+ * 借方账号
+ */
+ private String accNo;
+ private String accName;
+ /**
+ * 借方科目号
+ */
+ private String accSubjNo;
+
+ /**
+ * 交易方向 credit, debit
+ */
+ private String direction;
+ /**
+ * 结算标志 none, ok
+ */
+ private String settleStatus;
+ /**
+ * 结算日期
+ */
+ private String settleDate;
+ /**
+ * 可选值 none, cancel, reversed
+ */
+ private String reverseFlag;
+ /**
+ * 当有撤销交易时,撤销金额填写
+ */
+ private Double reverseAmount;
+
+ /**
+ * 交易说明
+ */
+ private String describe;
+
+ /**
+ * 交易字表
+ */
+ private String detailType;
+
+}