Browse Source

no message

xingzai 5 months ago
parent
commit
5f12f0b985
2 changed files with 117 additions and 2 deletions
  1. 106 2
      controllers/cygx/report_article.go
  2. 11 0
      models/cygx/activity.go

+ 106 - 2
controllers/cygx/report_article.go

@@ -1979,7 +1979,7 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
 }
 
 //func init() {
-//	initart()
+//	initOrder()
 //}
 
 func initart() {
@@ -2719,6 +2719,66 @@ func initOrder() {
 		return
 	}
 	//标头
+	//rowTitle := sheet.AddRow()
+	//cellA := rowTitle.AddCell()
+	//cellA.Value = "姓名"
+	//cellB := rowTitle.AddCell()
+	//cellB.Value = "手机号"
+	//cellC := rowTitle.AddCell()
+	//cellC.Value = "公司名称"
+	//
+	//cellMoney := rowTitle.AddCell()
+	//cellMoney.Value = "金额"
+	//
+	//cellname := rowTitle.AddCell()
+	//cellname.Value = "活动名称"
+	//
+	//cellTime := rowTitle.AddCell()
+	//cellTime.Value = "支付时间"
+	//
+	//for _, item := range list {
+	//
+	//	row := sheet.AddRow()
+	//	cellAData := row.AddCell()
+	//	cellAData.Value = item.RealName
+	//
+	//	cellBData := row.AddCell()
+	//	cellBData.Value = item.Mobile
+	//	cellCData := row.AddCell()
+	//	cellCData.Value = item.CompanyName
+	//
+	//	cellCMoneyData := row.AddCell()
+	//	cellCMoneyData.Value = fmt.Sprint(item.PayMoney)
+	//
+	//	cellCnameData := row.AddCell()
+	//	cellCnameData.Value = item.SourceTitle
+	//
+	//	cellTimeata := row.AddCell()
+	//	cellTimeata.Value = item.PayTime.Format(utils.FormatDateTime)
+	//}
+
+	var mobiles []string
+	var activityIds []int
+	for _, v := range list {
+		mobiles = append(mobiles, v.Mobile)
+		activityIds = append(activityIds, v.SourceId)
+	}
+	pars = make([]interface{}, 0)
+	inviteNameMap := cygxService.GetCygxUserBusinessCardMap(mobiles) // 根据手机号获取邀请人
+	condition = ` AND  activity_id IN  (` + utils.GetOrmInReplace(len(activityIds)) + `) `
+	pars = append(pars, activityIds)
+
+	listActivity, errList := cygx.GetActivityListAllInit(condition, pars)
+	if errList != nil {
+		fmt.Println(errList)
+		return
+	}
+
+	mapHost := make(map[int]string)
+	for _, v := range listActivity {
+		mapHost[v.ActivityId] = v.Host
+	}
+
 	rowTitle := sheet.AddRow()
 	cellA := rowTitle.AddCell()
 	cellA.Value = "姓名"
@@ -2727,11 +2787,20 @@ func initOrder() {
 	cellC := rowTitle.AddCell()
 	cellC.Value = "公司名称"
 
+	cellSeller := rowTitle.AddCell()
+	cellSeller.Value = "所属销售"
+
+	cellInviteName := rowTitle.AddCell()
+	cellInviteName.Value = "推荐人"
+
 	cellMoney := rowTitle.AddCell()
 	cellMoney.Value = "金额"
 
 	cellname := rowTitle.AddCell()
-	cellname.Value = "活动名称"
+	cellname.Value = "报告标题"
+
+	cellNickename := rowTitle.AddCell()
+	cellNickename.Value = "作者"
 
 	cellTime := rowTitle.AddCell()
 	cellTime.Value = "支付时间"
@@ -2747,12 +2816,25 @@ func initOrder() {
 		cellCData := row.AddCell()
 		cellCData.Value = item.CompanyName
 
+		cellSellerData := row.AddCell()
+		cellSellerData.Value = item.SellerName
+
+		cellInviteNameData := row.AddCell()
+		if item.ShareName != "" {
+			cellInviteNameData.Value = item.ShareName
+		} else {
+			cellInviteNameData.Value = inviteNameMap[item.Mobile]
+		}
+
 		cellCMoneyData := row.AddCell()
 		cellCMoneyData.Value = fmt.Sprint(item.PayMoney)
 
 		cellCnameData := row.AddCell()
 		cellCnameData.Value = item.SourceTitle
 
+		cellNickenameData := row.AddCell()
+		cellNickenameData.Value = mapHost[item.SourceId]
+
 		cellTimeata := row.AddCell()
 		cellTimeata.Value = item.PayTime.Format(utils.FormatDateTime)
 	}
@@ -2815,6 +2897,12 @@ func initOrderArticle() {
 		mapArtcileNickNameYx[v.Id] = v.NickName
 	}
 
+	var mobiles []string
+	for _, v := range list {
+		mobiles = append(mobiles, v.Mobile)
+	}
+	inviteNameMap := cygxService.GetCygxUserBusinessCardMap(mobiles) // 根据手机号获取邀请人
+
 	//创建excel
 	dir, err := os.Executable()
 	exPath := filepath.Dir(dir)
@@ -2858,6 +2946,12 @@ func initOrderArticle() {
 	cellC := rowTitle.AddCell()
 	cellC.Value = "公司名称"
 
+	cellSeller := rowTitle.AddCell()
+	cellSeller.Value = "所属销售"
+
+	cellInviteName := rowTitle.AddCell()
+	cellInviteName.Value = "推荐人"
+
 	cellMoney := rowTitle.AddCell()
 	cellMoney.Value = "金额"
 
@@ -2881,6 +2975,16 @@ func initOrderArticle() {
 		cellCData := row.AddCell()
 		cellCData.Value = item.CompanyName
 
+		cellSellerData := row.AddCell()
+		cellSellerData.Value = item.SellerName
+
+		cellInviteNameData := row.AddCell()
+		if item.ShareName != "" {
+			cellInviteNameData.Value = item.ShareName
+		} else {
+			cellInviteNameData.Value = inviteNameMap[item.Mobile]
+		}
+
 		cellCMoneyData := row.AddCell()
 		cellCMoneyData.Value = fmt.Sprint(item.PayMoney)
 

+ 11 - 0
models/cygx/activity.go

@@ -598,6 +598,17 @@ func GetActivityListAll(condition string, pars []interface{}, startSize, pageSiz
 	return
 }
 
+// 列表
+func GetActivityListAllInit(condition string, pars []interface{}) (items []*CygxActivity, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_activity as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
 // 获取数量
 func GetActivityCount(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_activity as art WHERE 1= 1  `