|
@@ -15,9 +15,11 @@ import (
|
|
|
"hongze/hongze_mobile_admin/models/tables/contract_approval"
|
|
|
"hongze/hongze_mobile_admin/models/tables/contract_approval_record"
|
|
|
"hongze/hongze_mobile_admin/models/tables/contract_operation_record"
|
|
|
+ "hongze/hongze_mobile_admin/models/tables/contract_relation"
|
|
|
"hongze/hongze_mobile_admin/services"
|
|
|
"hongze/hongze_mobile_admin/services/flow"
|
|
|
"hongze/hongze_mobile_admin/utils"
|
|
|
+ "math"
|
|
|
"os"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -797,6 +799,11 @@ func AfterApproved(contractId int) (err error) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ //修改业务合同的已支付金额
|
|
|
+ if contractDetail.ContractBusinessType == "代付合同" {
|
|
|
+ go updateContractPaidPriceByPaymentOnBehalfContractId(contractDetail.ContractId, contractDetail.Price)
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -874,3 +881,24 @@ func FixPdf(contractId int) (err error) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// updateContractPaidPriceByPaymentOnBehalfContractId 根据代付合同id来修改业务合同的支付金额
|
|
|
+func updateContractPaidPriceByPaymentOnBehalfContractId(contractId int, price float64) (err error) {
|
|
|
+ tmpList, tmpErr := contract_relation.GetContractRelationListByPaymentOnBehalfContractId(contractId)
|
|
|
+ if tmpErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(tmpList) < 0 {
|
|
|
+ err = errors.New("未关联业务合同")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ updatePriceStr := ``
|
|
|
+ if price > 0 {
|
|
|
+ updatePriceStr = `+` + fmt.Sprint(price)
|
|
|
+ } else {
|
|
|
+ updatePriceStr = `-` + fmt.Sprint(math.Abs(price))
|
|
|
+ }
|
|
|
+ err = contract.UpdateBusinessContractPaidPrice(tmpList[0].ContractId, updatePriceStr)
|
|
|
+ return
|
|
|
+}
|