ziwen 2 years ago
parent
commit
a67b340118
2 changed files with 16 additions and 0 deletions
  1. 2 0
      controller/census/invoice_payment.go
  2. 14 0
      services/fms/invoice_payment.go

+ 2 - 0
controller/census/invoice_payment.go

@@ -662,6 +662,7 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 		queryRegisterIds = append(queryRegisterIds, registerList[i].ContractRegisterId)
 	}
 
+	fmt.Println("queryRegisterIds:",queryRegisterIds)
 	results := new(fms.InvoicePaymentCensusResp)
 	if len(queryRegisterIds) > 0 {
 		// 获取汇总数据IDs, 用于查询合计数据
@@ -673,6 +674,7 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 			return
 		}
 
+		fmt.Println("summaryIds:",summaryIds)
 		var listErr, totalErr, totalGroupErr error
 		wg := sync.WaitGroup{}
 

+ 14 - 0
services/fms/invoice_payment.go

@@ -182,6 +182,7 @@ func SummaryInvoicePaymentByContractRegisterId(registerId int) {
 	ficcPaymentIds := make([]int, 0)
 	raiInvoiceIds := make([]int, 0)
 	raiPaymentIds := make([]int, 0)
+	noProductPaymentIds := make([]int, 0)
 	for i := range list {
 		if list[i].InvoiceType == fms.ContractInvoiceTypeMake {
 			if list[i].ServiceProductId == crm.CompanyProductFicc {
@@ -212,6 +213,8 @@ func SummaryInvoicePaymentByContractRegisterId(registerId int) {
 				ficcPaymentIds = append(ficcPaymentIds, list[i].ContractInvoiceId)
 			} else if list[i].ServiceProductId == crm.CompanyProductRai {
 				raiPaymentIds = append(raiPaymentIds, list[i].ContractInvoiceId)
+			} else {
+				noProductPaymentIds = append(noProductPaymentIds, list[i].ContractInvoiceId)
 			}
 			continue
 		}
@@ -220,6 +223,7 @@ func SummaryInvoicePaymentByContractRegisterId(registerId int) {
 	raiInvoiceLen := len(raiInvoiceIds)
 	ficcPaymentLen := len(ficcPaymentIds)
 	raiPaymentLen := len(raiPaymentIds)
+	noProductPaymentLen := len(noProductPaymentIds)
 
 	// 汇总数据
 	nowTime := time.Now().Local()
@@ -287,6 +291,16 @@ func SummaryInvoicePaymentByContractRegisterId(registerId int) {
 			summaryList = append(summaryList, v)
 		}
 	}
+	if noProductPaymentLen > 0 {
+		for i := range noProductPaymentIds {
+			v := new(fms.InvoicePaymentSummary)
+			v.RegisterId = registerId
+			v.PaymentId = noProductPaymentIds[i]
+			v.CreateTime = nowTime
+			v.ModifyTime = nowTime
+			summaryList = append(summaryList, v)
+		}
+	}
 
 	// 删除并新增汇总数据
 	summaryOB := new(fms.InvoicePaymentSummary)