|
@@ -67,12 +67,13 @@ FROM
|
|
) b ON a.order_code = b.order_code
|
|
) b ON a.order_code = b.order_code
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
SELECT
|
|
SELECT
|
|
- order_code,
|
|
|
|
- money
|
|
|
|
- FROM
|
|
|
|
- order_deposi
|
|
|
|
- WHERE
|
|
|
|
- state =0 and is_del= 0 and (pay_money = 0 or pay_money is null)
|
|
|
|
|
|
+ de.order_code,
|
|
|
|
+ de.money,
|
|
|
|
+ odp.order_code as payment_order_code
|
|
|
|
+FROM
|
|
|
|
+ order_deposit de
|
|
|
|
+ LEFT JOIN order_deposit_payment odp ON odp.is_del=0 and de.order_code = odp.order_code
|
|
|
|
+WHERE odp.order_code IS NULL
|
|
) c ON a.order_code = c.order_code
|
|
) c ON a.order_code = c.order_code
|
|
WHERE
|
|
WHERE
|
|
( a.return_status = 0 OR a.return_status = 2 )
|
|
( a.return_status = 0 OR a.return_status = 2 )
|
|
@@ -125,18 +126,19 @@ WHERE
|
|
if status := PaymentPlanMatching(money, gconv.Int(o["deposit_money"]), returnMoney, paymentUser, companyName, remark, remarks, orderCode, filterMap[orderCode].PaybackNum, filterMap[orderCode].paybackListArr, returnOrderMap); status > 0 {
|
|
if status := PaymentPlanMatching(money, gconv.Int(o["deposit_money"]), returnMoney, paymentUser, companyName, remark, remarks, orderCode, filterMap[orderCode].PaybackNum, filterMap[orderCode].paybackListArr, returnOrderMap); status > 0 {
|
|
if status == 1 || status == 2 { //定金 但定金不是合同金额
|
|
if status == 1 || status == 2 { //定金 但定金不是合同金额
|
|
// 插入定金表
|
|
// 插入定金表
|
|
- _, err := g.DB().Update(ctx, "order_deposi", map[string]interface{}{
|
|
|
|
|
|
+ _, err := g.DB().Insert(ctx, "order_deposit_payment", map[string]interface{}{
|
|
|
|
+ "order_code": orderCode,
|
|
"pay_time": returnTime,
|
|
"pay_time": returnTime,
|
|
- "mold": 3,
|
|
|
|
|
|
+ "pay_way": 3,
|
|
"operate_time": time.Now().Format("2006-01-02 15:04:05"),
|
|
"operate_time": time.Now().Format("2006-01-02 15:04:05"),
|
|
"flow_money": returnMoney,
|
|
"flow_money": returnMoney,
|
|
"pay_money": returnMoney,
|
|
"pay_money": returnMoney,
|
|
|
|
+ "remark": "自动关联保证金流水",
|
|
|
|
+ "transaction_id": id,
|
|
"bank_name": BNKNAM,
|
|
"bank_name": BNKNAM,
|
|
"bank_flow": BNKFLW,
|
|
"bank_flow": BNKFLW,
|
|
"operate_type": 2,
|
|
"operate_type": 2,
|
|
"pay_account_name": paymentUser,
|
|
"pay_account_name": paymentUser,
|
|
- }, map[string]interface{}{
|
|
|
|
- "order_code": orderCode,
|
|
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Println("定金信息插入失败", id, orderCode, err)
|
|
log.Println("定金信息插入失败", id, orderCode, err)
|