ziwen 1 年之前
父節點
當前提交
7e8eb1c78c
共有 1 個文件被更改,包括 40 次插入13 次删除
  1. 40 13
      controller/census/invoice_payment.go

+ 40 - 13
controller/census/invoice_payment.go

@@ -1863,20 +1863,28 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						if v.ServiceProductId == 1 {
 							v.SellerGroupId = sellerMap[v.SellerId].GroupId
 							v.SellerGroupName = sellerMap[v.SellerId].GroupName
-							v.SellerType = sellerTypeMap[sellerMap[v.SellerId].DepartmentId]
+							if seller, ok := sellerMap[v.SellerId]; ok{
+								v.SellerType = sellerTypeMap[seller.DepartmentId]
+							}
 						} else {
 							v.RaiSellerGroupId = sellerMap[v.RaiSellerId].GroupId
 							v.RaiSellerGroupName = sellerMap[v.RaiSellerId].GroupName
-							v.SellerType = sellerTypeMap[sellerMap[v.RaiSellerId].DepartmentId]
+							if seller, ok := sellerMap[v.RaiSellerId]; ok{
+								v.SellerType = sellerTypeMap[seller.DepartmentId]
+							}
 						}
 					} else if v.SellerId > 0 && v.RaiSellerId == 0 {
 						v.SellerGroupId = sellerMap[v.SellerId].GroupId
 						v.SellerGroupName = sellerMap[v.SellerId].GroupName
-						v.SellerType = sellerTypeMap[sellerMap[v.SellerId].DepartmentId]
+						if seller, ok := sellerMap[v.SellerId]; ok{
+							v.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 					} else if v.SellerId == 0 && v.RaiSellerId > 0 {
 						v.RaiSellerGroupId = sellerMap[v.RaiSellerId].GroupId
 						v.RaiSellerGroupName = sellerMap[v.RaiSellerId].GroupName
-						v.SellerType = sellerTypeMap[sellerMap[v.RaiSellerId].DepartmentId]
+						if seller, ok := sellerMap[v.RaiSellerId]; ok{
+							v.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 					}
 				}
 			}
@@ -2265,7 +2273,10 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				v.SellerName = summaryList[i].SellerName
 				v.SellerGroupId = summaryList[i].SellerGroupId
 				v.SellerGroupName = summaryList[i].SellerGroupName
-				v.SellerType = sellerTypeMap[sellerMap[summaryList[i].SellerId].DepartmentId]
+				if seller, ok := sellerMap[summaryList[i].SellerId]; ok{
+					v.SellerType = sellerTypeMap[seller.DepartmentId]
+				}
+
 				v.PaymentId = summaryList[i].PaymentId
 				v.PaymentDate = utils.TimeTransferString(utils.FormatDate, summaryList[i].PaymentDate)
 				v.PaymentAmount = summaryList[i].PaymentAmount
@@ -2556,26 +2567,34 @@ func ExportNotInvoiceCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 				if item.SellerId > 0 && item.RaiSellerId > 0 {
 					if item.ServiceProductId == 1 {
 						item.SellerGroupName = sellerMap[item.SellerId].GroupName
-						item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+						if seller, ok := sellerMap[item.SellerId]; ok{
+							item.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 						dataRow2.AddCell().SetString(item.SellerName)      // 销售
 						dataRow2.AddCell().SetString(item.SellerGroupName) // 销售组别
 						dataRow2.AddCell().SetString(item.SellerType)      // 销售类型
 					} else {
 						item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
-						item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+						if seller, ok := sellerMap[item.RaiSellerId]; ok{
+							item.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 						dataRow2.AddCell().SetString(item.RaiSellerName)      // 销售
 						dataRow2.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
 						dataRow2.AddCell().SetString(item.SellerType)         // 销售类型
 					}
 				} else if item.SellerId > 0 && item.RaiSellerId == 0 {
 					item.SellerGroupName = sellerMap[item.SellerId].GroupName
-					item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+					if seller, ok := sellerMap[item.SellerId]; ok{
+						item.SellerType = sellerTypeMap[seller.DepartmentId]
+					}
 					dataRow2.AddCell().SetString(item.SellerName)      // 销售
 					dataRow2.AddCell().SetString(item.SellerGroupName) // 销售组别
 					dataRow2.AddCell().SetString(item.SellerType)      // 销售类型
 				} else if item.SellerId == 0 && item.RaiSellerId > 0 {
 					item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
-					item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+					if seller, ok := sellerMap[item.RaiSellerId]; ok{
+						item.SellerType = sellerTypeMap[seller.DepartmentId]
+					}
 					dataRow2.AddCell().SetString(item.RaiSellerName)      // 销售
 					dataRow2.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
 					dataRow2.AddCell().SetString(item.SellerType)         // 销售类型
@@ -2591,26 +2610,34 @@ func ExportNotInvoiceCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 				if item.SellerId > 0 && item.RaiSellerId > 0 {
 					if item.ServiceProductId == 1 {
 						item.SellerGroupName = sellerMap[item.SellerId].GroupName
-						item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+						if seller, ok := sellerMap[item.SellerId]; ok{
+							item.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 						dataRow.AddCell().SetString(item.SellerName)      // 销售
 						dataRow.AddCell().SetString(item.SellerGroupName) // 销售组别
 						dataRow.AddCell().SetString(item.SellerType)      // 销售类型
 					} else {
 						item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
-						item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+						if seller, ok := sellerMap[item.RaiSellerId]; ok{
+							item.SellerType = sellerTypeMap[seller.DepartmentId]
+						}
 						dataRow.AddCell().SetString(item.RaiSellerName)      // 销售
 						dataRow.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
 						dataRow.AddCell().SetString(item.SellerType)         // 销售类型
 					}
 				} else if item.SellerId > 0 && item.RaiSellerId == 0 {
 					item.SellerGroupName = sellerMap[item.SellerId].GroupName
-					item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+					if seller, ok := sellerMap[item.SellerId]; ok{
+						item.SellerType = sellerTypeMap[seller.DepartmentId]
+					}
 					dataRow.AddCell().SetString(item.SellerName)      // 销售
 					dataRow.AddCell().SetString(item.SellerGroupName) // 销售组别
 					dataRow.AddCell().SetString(item.SellerType)      // 销售类型
 				} else if item.SellerId == 0 && item.RaiSellerId > 0 {
 					item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
-					item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+					if seller, ok := sellerMap[item.RaiSellerId]; ok{
+						item.SellerType = sellerTypeMap[seller.DepartmentId]
+					}
 					dataRow.AddCell().SetString(item.RaiSellerName)      // 销售
 					dataRow.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
 					dataRow.AddCell().SetString(item.SellerType)         // 销售类型