Explorar o código

fix:合同金额修改

duxin hai 1 mes
pai
achega
8645ba586b

+ 1 - 1
internal/logic/order/openInvoiceInfo.go

@@ -11,7 +11,7 @@ import (
 
 func OpenInvoiceInfo(ctx context.Context, param model.OrderOpenInvoiceInfoParams) (map[string]interface{}, error) {
 	//订单信息查询
-	orderData, _ := g.DB().GetOne(ctx, fmt.Sprintf("select  pay_money,applybill_status,signing_subject from  dataexport_order  where  order_code ='%s'", param.OrderCode))
+	orderData, _ := g.DB().GetOne(ctx, fmt.Sprintf("select  (IFNULL(CASE WHEN is_backstage_order = 1 THEN pay_money ELSE order_money END, 0)) as pay_money ,applybill_status,signing_subject from  dataexport_order  where  order_code ='%s'", param.OrderCode))
 	if !orderData.IsEmpty() {
 		return nil, errors.New("订单编号不存在")
 	}

+ 1 - 1
internal/logic/order/redPunch.go

@@ -21,7 +21,7 @@ import (
 
 // OperateOrderRedPunch 红冲
 func OperateOrderRedPunch(ctx context.Context, params model.OrderRedPunchParams) error {
-	orderData, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT user_phone,buy_subject,company_name,signing_subject,procedures_money,order_money,commission+(select IFNULL(sum(commission),0) as return_money from moneyCorrection where orderCode= '%s') as commission,pay_money+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection where orderCode='%s') as pay_money FROM dataexport_order  WHERE order_code = '%s'`, params.OrderCode, params.OrderCode, params.OrderCode))
+	orderData, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT user_phone,buy_subject,company_name,signing_subject,procedures_money,order_money,commission+(select IFNULL(sum(commission),0) as return_money from moneyCorrection where orderCode= '%s') as commission,(IFNULL(CASE WHEN is_backstage_order = 1 THEN pay_money ELSE order_money END, 0)) as pay_money+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection where orderCode='%s') as pay_money FROM dataexport_order  WHERE order_code = '%s'`, params.OrderCode, params.OrderCode, params.OrderCode))
 	if err != nil || orderData.IsEmpty() {
 		return errors.New("未找到订单")
 	}

+ 1 - 2
internal/logic/timedTask/automaticPayment.go

@@ -135,9 +135,8 @@ WHERE
 							returnId, _ := returnReq.LastInsertId()
 							//计算已回款金额
 							if returned_money == 0 {
-								if err := order.CommonChange(ctx, orderCode, returnTime, order.ReturnMoney); err != nil {
+								if err = order.CommonChange(ctx, orderCode, returnTime, order.ReturnMoney); err != nil {
 									log.Printf("%s 回款销售业绩生效异常 %v", orderCode, err)
-									continue
 								}
 							}
 							updateData := map[string]interface{}{"return_status": 2, "order_status": 1}