|
@@ -7,6 +7,7 @@ import org.apache.ibatis.type.Alias;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
public class Contract {
|
|
public class Contract {
|
|
@@ -192,62 +193,129 @@ public class Contract {
|
|
*/
|
|
*/
|
|
private Integer isRescind;
|
|
private Integer isRescind;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private BigDecimal paidAmount;
|
|
|
|
+
|
|
|
|
+ private BigDecimal unpaidAmount;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 删除标识 1正常 0删除
|
|
* 删除标识 1正常 0删除
|
|
*/
|
|
*/
|
|
private Integer delFlag;
|
|
private Integer delFlag;
|
|
|
|
|
|
|
|
+ private Date createTime;
|
|
|
|
+
|
|
//是否逾期
|
|
//是否逾期
|
|
private Integer isOverdue;
|
|
private Integer isOverdue;
|
|
|
|
|
|
//交存状态 0 待缴存 1首期已交存 2交存完成或不需要交存
|
|
//交存状态 0 待缴存 1首期已交存 2交存完成或不需要交存
|
|
private Integer paymentStatus;
|
|
private Integer paymentStatus;
|
|
|
|
|
|
- public Contract(HtInfo htInfo, BuildingAccount buildingAccount, Org org, P_lpb_fw fw, ProjectAccount projectAccount, List<BhtTrade> bhtTrades) {
|
|
|
|
|
|
+ public Date getCreateTime() {
|
|
|
|
+ return createTime;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCreateTime(Date createTime) {
|
|
|
|
+ this.createTime = createTime;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public BigDecimal getPaidAmount() {
|
|
|
|
+ return paidAmount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setPaidAmount(BigDecimal paidAmount) {
|
|
|
|
+ this.paidAmount = paidAmount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public BigDecimal getUnpaidAmount() {
|
|
|
|
+ return unpaidAmount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setUnpaidAmount(BigDecimal unpaidAmount) {
|
|
|
|
+ this.unpaidAmount = unpaidAmount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Contract() {}
|
|
|
|
+
|
|
|
|
+ public void initValueConfig(HtInfo htInfo, P_lpb_fw fw, List<BhtTrade> bhtTrades) {
|
|
this.contractNumber = htInfo.getHTBH();
|
|
this.contractNumber = htInfo.getHTBH();
|
|
- this.orgId = org.getId();
|
|
|
|
- this.orgName = org.getOrgName();
|
|
|
|
- this.projectId = projectAccount.getProjectId();
|
|
|
|
- this.projectAccountId = projectAccount.getId();
|
|
|
|
- this.projectName = projectAccount.getProjectName();
|
|
|
|
- this.projectNumber = projectAccount.getProjectNumber();
|
|
|
|
- this.buildingId = buildingAccount.getBuildingId();
|
|
|
|
- this.buildingAccountId = buildingAccount.getId();
|
|
|
|
- this.buildingNumber = buildingAccount.getBuildingNumber();
|
|
|
|
- this.buildingName = buildingAccount.getBuildingName();
|
|
|
|
- if (null != fw) {
|
|
|
|
- this.houseAddress = fw.getXxdz();
|
|
|
|
- this.houseArea = fw.getJzmj();
|
|
|
|
- this.houseUse = fw.getYt();
|
|
|
|
- this.houseId = fw.getId();
|
|
|
|
- }
|
|
|
|
this.buyer = htInfo.getBUYERNAME();
|
|
this.buyer = htInfo.getBUYERNAME();
|
|
this.idCard = htInfo.getBUYERCODE();
|
|
this.idCard = htInfo.getBUYERCODE();
|
|
this.payWay = getPayWat(htInfo.getPAYMODEL());
|
|
this.payWay = getPayWat(htInfo.getPAYMODEL());
|
|
this.contractPrice = htInfo.getHTZJ();
|
|
this.contractPrice = htInfo.getHTZJ();
|
|
this.signTime = null != htInfo.getHTDATE() ? DateUtil.dateToStr(htInfo.getHTDATE(), "yyyy-MM-dd HH:mm:ss") : null;
|
|
this.signTime = null != htInfo.getHTDATE() ? DateUtil.dateToStr(htInfo.getHTDATE(), "yyyy-MM-dd HH:mm:ss") : null;
|
|
- this.accountType = StringUtils.isEmpty(htInfo.getJGLX()) ? null : Integer.valueOf(htInfo.getJGLX());
|
|
|
|
- this.accountId = null;
|
|
|
|
- this.bankCode = null;
|
|
|
|
- this.collectionOpenAddress = null;
|
|
|
|
- this.collectionAccount = null;
|
|
|
|
- this.collectionName = null;
|
|
|
|
- this.collectionBank = null;
|
|
|
|
|
|
+ this.createTime = htInfo.getHTDATE();
|
|
|
|
+ this.accountType = Integer.parseInt(htInfo.getJGLX()) == 1 ? 1 : 2;
|
|
|
|
+ // 如果为空,这未抵押,如果是1则抵押
|
|
this.isMortgage = (!StringUtils.isEmpty(htInfo.getSGSTATE()) && "1".equals(htInfo.getSGSTATE())) ? 1 : 0;
|
|
this.isMortgage = (!StringUtils.isEmpty(htInfo.getSGSTATE()) && "1".equals(htInfo.getSGSTATE())) ? 1 : 0;
|
|
- this.isRefund = (!StringUtils.isEmpty(htInfo.getTKSTATE()) && "1".equals(htInfo.getTKSTATE())) ? 1 : 0;
|
|
|
|
|
|
+ // 如果为0,这未退款 如果是1 则已退款
|
|
|
|
+ this.isRefund = "1".equals(htInfo.getTKSTATE()) ? 1 : 0;
|
|
|
|
+ //
|
|
this.isEarnest = null != htInfo.getHTDJ() ? 1 : 0;
|
|
this.isEarnest = null != htInfo.getHTDJ() ? 1 : 0;
|
|
- this.isRescind = (!StringUtils.isEmpty(htInfo.getCXSTATE()) && "1".equals(htInfo.getCXSTATE())) ? 1 : 0;
|
|
|
|
|
|
+ // 如果为0 这未撤销,如果是1 则已撤销
|
|
|
|
+ this.isRescind = "1".equals(htInfo.getCXSTATE()) ? 1 : 0;
|
|
this.delFlag = 1;
|
|
this.delFlag = 1;
|
|
- this.isOverdue = (!StringUtils.isEmpty(htInfo.getYQFLAG()) && "1".equals(htInfo.getYQFLAG())) ? 1 : 0;
|
|
|
|
|
|
+ // 如果为0 这未逾期,如果是1 已逾期
|
|
|
|
+ this.isOverdue = "1".equals(htInfo.getYQFLAG()) ? 1 : 0;
|
|
|
|
+
|
|
|
|
+ if (null != fw) {
|
|
|
|
+ this.houseAddress = fw.getXxdz();
|
|
|
|
+ this.houseArea = fw.getJzmj(); // 预测面积
|
|
|
|
+ this.houseUse = fw.getYt();
|
|
|
|
+ this.houseId = fw.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if (null != bhtTrades && !bhtTrades.isEmpty()) {
|
|
if (null != bhtTrades && !bhtTrades.isEmpty()) {
|
|
//交易总金额
|
|
//交易总金额
|
|
|
|
+ // 首期款
|
|
|
|
+ BigDecimal oneAmount = BigDecimal.ZERO;
|
|
|
|
+ // 分期款、商贷
|
|
|
|
+ BigDecimal twoAmount = BigDecimal.ZERO;
|
|
|
|
+ // 公积金
|
|
|
|
+ BigDecimal threeAmount = BigDecimal.ZERO;
|
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
|
-/* BhtTrade sfkTrade = bhtTrades.stream().filter(t -> null != t.getPayType() && t.getPayType().equals(1)).findFirst().orElse(null);
|
|
|
|
- BigDecimal sfk = null != sfkTrade ? sfkTrade.getJkje() : BigDecimal.ZERO;*/
|
|
|
|
for (BhtTrade trade : bhtTrades) {
|
|
for (BhtTrade trade : bhtTrades) {
|
|
if (null != trade.getTradeId() && null != trade.getTradeAmount()) {
|
|
if (null != trade.getTradeId() && null != trade.getTradeAmount()) {
|
|
totalAmount = totalAmount.add(trade.getTradeAmount());
|
|
totalAmount = totalAmount.add(trade.getTradeAmount());
|
|
}
|
|
}
|
|
|
|
+ if (trade.getPayType().equals(1)) {
|
|
|
|
+ oneAmount = oneAmount.add(trade.getJkje());
|
|
|
|
+ } else if (trade.getPayType().equals(3)) {
|
|
|
|
+ threeAmount = threeAmount.add(trade.getJkje());
|
|
|
|
+ } else {
|
|
|
|
+ twoAmount = twoAmount.add(trade.getJkje());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.paidAmount = totalAmount;
|
|
|
|
+ this.unpaidAmount = htInfo.getHTZJ().subtract(totalAmount);
|
|
|
|
+ // 一次性付款
|
|
|
|
+ if (this.payWay.equals(1)) {
|
|
|
|
+ paymentAmount1 = htInfo.getHTZJ();
|
|
|
|
+ }
|
|
|
|
+ // 分期
|
|
|
|
+ if (this.payWay.equals(2)) {
|
|
|
|
+ paymentAmount1 = oneAmount;
|
|
|
|
+ paymentAmount2 = twoAmount;
|
|
|
|
+ }
|
|
|
|
+ // 商贷
|
|
|
|
+ if (this.payWay.equals(3)) {
|
|
|
|
+ paymentAmount1 = oneAmount;
|
|
|
|
+ paymentAmount3 = twoAmount;
|
|
|
|
+ }
|
|
|
|
+ // 公积金贷款
|
|
|
|
+ if (this.payWay.equals(4)) {
|
|
|
|
+ paymentAmount1 = oneAmount;
|
|
|
|
+ paymentAmount4 = threeAmount;
|
|
|
|
+ }
|
|
|
|
+ // 组合贷款
|
|
|
|
+ if (this.payWay.equals(5)) {
|
|
|
|
+ paymentAmount1 = oneAmount;
|
|
|
|
+ paymentAmount3 = twoAmount;
|
|
|
|
+ paymentAmount4 = threeAmount;
|
|
}
|
|
}
|
|
//交易明细的总金额 大于等于 合同的总金额 则
|
|
//交易明细的总金额 大于等于 合同的总金额 则
|
|
if (totalAmount.compareTo(htInfo.getHTZJ()) > -1) {
|
|
if (totalAmount.compareTo(htInfo.getHTZJ()) > -1) {
|
|
@@ -262,20 +330,49 @@ public class Contract {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 努力向前:
|
|
|
|
+ * 收到,兄弟
|
|
|
|
+ *
|
|
|
|
+ * 努力向前:
|
|
|
|
+ * paymodelMap.put("商业贷款", "01");
|
|
|
|
+ * paymodelMap.put("公积金贷款", "02");
|
|
|
|
+ * //paymodelMap.put("部队公积金", "06");
|
|
|
|
+ * paymodelMap.put("一次性付款", "03");
|
|
|
|
+ * paymodelMap.put("商贷+公积金贷款", "04");
|
|
|
|
+ * //paymodelMap.put("商贷+部队公积金", "07");
|
|
|
|
+ * paymodelMap.put("其他", "05");
|
|
|
|
+ * paymodelMap.put("分2期付款", "12");
|
|
|
|
+ * paymodelMap.put("分3期付款", "13");
|
|
|
|
+ * paymodelMap.put("分4期付款", "14");
|
|
|
|
+ * paymodelMap.put("分5期付款", "15");
|
|
|
|
+ * 1一次性付款 2分期付款 3商业贷款 4公积金贷款 5组合贷款
|
|
|
|
+ *
|
|
|
|
+ * @param paymodel
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
private Integer getPayWat(String paymodel) {
|
|
private Integer getPayWat(String paymodel) {
|
|
switch (paymodel) {
|
|
switch (paymodel) {
|
|
- case "1"://商业贷款
|
|
|
|
|
|
+ case "03": // 一次性付款
|
|
|
|
+ return 1;
|
|
|
|
+ case "12": //分期
|
|
|
|
+ return 2;
|
|
|
|
+ case "13": //分期
|
|
|
|
+ return 2;
|
|
|
|
+ case "14": //分期
|
|
|
|
+ return 2;
|
|
|
|
+ case "15": //分期
|
|
|
|
+ return 2;
|
|
|
|
+ case "01": // 商业贷款
|
|
return 3;
|
|
return 3;
|
|
- case "2"://公积金贷款
|
|
|
|
|
|
+ case "2": // 商业贷款
|
|
|
|
+ return 3;
|
|
|
|
+ case "02": // 公积金贷款
|
|
return 4;
|
|
return 4;
|
|
- case "3"://一次性付款
|
|
|
|
- return 1;
|
|
|
|
- case "4"://组合贷
|
|
|
|
|
|
+ case "04": // 组合贷
|
|
return 5;
|
|
return 5;
|
|
- case "5"://其他
|
|
|
|
- return 6;
|
|
|
|
- default://分期
|
|
|
|
- return 2;
|
|
|
|
|
|
+ default:
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|