Pārlūkot izejas kodu

后端: 年审一级供应商不交费

baichengfei 4 gadi atpakaļ
vecāks
revīzija
d77e27175b

+ 33 - 24
src/dashoo.cn/backend/api/controllers/oilsupplier/annualListener.go

@@ -130,6 +130,10 @@ func (this *OilAnnualListenerController) CheckNeedPay() {
 	var supplierCertEntity suppliercert.OilSupplierCert
 	certSvc.GetEntityById(annualEntity.CerId, &supplierCertEntity)
 
+	svcSupplier := supplier.GetOilSupplierService(utils.DBE)
+	var supplierEntity supplier.OilSupplier
+	svcSupplier.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
+
 	var isPayList []string
 	isPayList = append(isPayList, suppliercert.PINGSHEN)
 	isPayList = append(isPayList, suppliercert.WAIBUSHICHANG)
@@ -142,32 +146,37 @@ func (this *OilAnnualListenerController) CheckNeedPay() {
 	result := 0
 	isPay := "false"
 	unPay := "false"
-	for _, eachItem := range isPayList {
-		if eachItem == supplierCertEntity.InStyle {
-			// 需要付费
-			isPay = "true"
-			result = 1
-			break
+	// 2021年08月24日20:11:39 年审所有一级供应商不交费
+	if supplierEntity.Grade == "1" {
+		result = 2
+	} else {
+		for _, eachItem := range isPayList {
+			if eachItem == supplierCertEntity.InStyle {
+				// 需要付费
+				isPay = "true"
+				result = 1
+				break
+			}
 		}
-	}
-	for _, eachItem := range unPayList {
-		if eachItem == supplierCertEntity.InStyle {
-			// 不需要付费
-			unPay = "true"
-			result = 2
-			break
+		for _, eachItem := range unPayList {
+			if eachItem == supplierCertEntity.InStyle {
+				// 不需要付费
+				unPay = "true"
+				result = 2
+				break
+			}
+		}
+		if isPay == unPay {
+			// 准入类型是否付费有误!请联系管理员
+			result = 0
+		}
+		var paymentInfoEntity paymentinfo.OilPaymentInfo
+		s := paymentinfo.GetPaymentService(utils.DBE)
+		where := " isPay='2' and SrcId='" + annualId + "' and SupplierCertId='" + strconv.Itoa(annualEntity.CerId) + "'"
+		s.GetEntityByWhere("OilPaymentInfo", where, &paymentInfoEntity)
+		if paymentInfoEntity.Id > 0 {
+			result = 2 // 已交费, 不再需要交费
 		}
-	}
-	if isPay == unPay {
-		// 准入类型是否付费有误!请联系管理员
-		result = 0
-	}
-	var paymentInfoEntity paymentinfo.OilPaymentInfo
-	s := paymentinfo.GetPaymentService(utils.DBE)
-	where := " isPay='2' and SrcId='" + annualId + "' and SupplierCertId='" + strconv.Itoa(annualEntity.CerId) + "'"
-	s.GetEntityByWhere("OilPaymentInfo", where, &paymentInfoEntity)
-	if paymentInfoEntity.Id > 0 {
-		result = 2 // 已交费, 不再需要交费
 	}
 
 	this.Data["json"] = result