瀏覽代碼

Merge branch 'fms_2.8' into debug

ziwen 1 年之前
父節點
當前提交
e7f8aaf751
共有 2 個文件被更改,包括 13 次插入10 次删除
  1. 5 5
      controller/census/invoice_payment.go
  2. 8 5
      controller/crm/company_seller.go

+ 5 - 5
controller/census/invoice_payment.go

@@ -1182,7 +1182,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 						totalMoneySlice = append(totalMoneySlice, accumulate)
 					} else if req.ListParam == "0" {
 						totalMoneySlice = append(totalMoneySlice, amountTotal)
-					} else if i > 0 {
+					} else if i > 0 || i == numMonth {
 						totalMoneySlice = append(totalMoneySlice, partAccumulate)
 						partAccumulate  = 0.0
 					}
@@ -1211,12 +1211,12 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 				accumulate += amountTotal
 				partAccumulate += amountTotal
 
-				if i == j {
+				if i == j || i == numMonth {
 					if req.ListParam == "4" {
 						totalMoneySlice = append(totalMoneySlice, accumulate)
 					} else if req.ListParam == "0" {
 						totalMoneySlice = append(totalMoneySlice, amountTotal)
-					} else if i > 0 {
+					} else if i > 0 || i == numMonth {
 						totalMoneySlice = append(totalMoneySlice, partAccumulate)
 						partAccumulate  = 0.0
 					}
@@ -1323,7 +1323,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					} else if req.ListParam == "0" {
 						prevTotalMoneySlice = append(prevTotalMoneySlice, partHistoryAccumulate)
 						partHistoryAccumulate = 0.0
-					} else if i > 0 {
+					} else if i > 0 || i == numMonth {
 						prevTotalMoneySlice = append(prevTotalMoneySlice, partHistoryAccumulate)
 						partHistoryAccumulate  = 0.0
 					}
@@ -1354,7 +1354,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					} else if req.ListParam == "0" {
 						prevTotalMoneySlice = append(prevTotalMoneySlice, partHistoryAccumulate)
 						partHistoryAccumulate = 0.0
-					} else if i > 0 {
+					} else if i > 0 || i == numMonth {
 						prevTotalMoneySlice = append(prevTotalMoneySlice, partHistoryAccumulate)
 						partHistoryAccumulate  = 0.0
 					}

+ 8 - 5
controller/crm/company_seller.go

@@ -110,13 +110,16 @@ func (rg *CompanySellerController) TeamList(c *gin.Context) {
 }
 
 func FIX() (err error) {
-	sellerList, e := crmService.GetSellerDepartmentListWithGroupAndTeam()
+	adminCond := ``
+	adminPars := make([]interface{}, 0)
+	adminOB := new(crm.Admin)
+	adminList, e := adminOB.List(adminCond, adminPars)
 	if e != nil {
 		return
 	}
-	sellerMap := make(map[string]*crm.SellerAdminWithGroupTeam)
-	for i := range sellerList {
-		sellerMap[sellerList[i].SellerName] = sellerList[i]
+	sellerMap := make(map[string]*crm.Admin)
+	for i := range adminList {
+		sellerMap[adminList[i].AdminName] = adminList[i]
 	}
 
 	list,err := fms.GetIncomeHistoryList()
@@ -126,7 +129,7 @@ func FIX() (err error) {
 	for _, v := range list {
 		fmt.Println("v:", v.IncomeId)
 		if seller, ok := sellerMap[v.SellerName]; ok{
-			v.SellerId = seller.SellerId
+			v.SellerId = seller.AdminId
 			if e = v.Update([]string{"seller_id"}); e != nil {
 				fmt.Println("更新销售失败, Err: " + e.Error())
 				return