Browse Source

no message

zhangchuanxing 2 days ago
parent
commit
055da76df2
2 changed files with 123 additions and 1 deletions
  1. 122 0
      controllers/cygx/report_article.go
  2. 1 1
      models/cygx/cygx_user.go

+ 122 - 0
controllers/cygx/report_article.go

@@ -7134,3 +7134,125 @@ func initart121_328() {
 	}
 	return
 }
+
+//func init() {
+//	initActComapny()
+//}
+
+func initActComapny() {
+
+	var condition string
+	mapuserMapbil := make(map[int]*models.WxUserSller)
+
+	companyIdArr := []int{19130, 16946, 18221, 15736, 18434}
+	fmt.Println(companyIdArr)
+	listCompany, err := models.GetWxUserRaiSllerListByUserComapnyId(companyIdArr)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	for _, v := range listCompany {
+		mapuserMapbil[v.CompanyId] = v
+	}
+
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+
+	redStyle := xlsx.NewStyle()
+	redStyle.Alignment = alignment
+	redStyle.ApplyAlignment = true
+	redStyle.Font.Color = "ff0000"
+	//定义底色需要标黄的 单元格颜色
+	redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
+	redStyle.Fill = redFill
+	//redStyle.Border = *border
+
+	var sheetName string
+	sheetName = "到会信息"
+	sheet, err := xlsxFile.AddSheet(sheetName)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+
+	cellAct := rowTitle.AddCell()
+	cellAct.Value = "活动名称"
+
+	cellB := rowTitle.AddCell()
+	cellB.Value = "活动类型(线上线下)"
+
+	cellActime := rowTitle.AddCell()
+	cellActime.Value = " 活动时间/发布时间"
+
+	cellD := rowTitle.AddCell()
+	cellD.Value = "参与人姓名"
+
+	cellE := rowTitle.AddCell()
+	cellE.Value = "手机号"
+
+	cellCom := rowTitle.AddCell()
+	cellCom.Value = "公司名称"
+
+	for _, v := range companyIdArr {
+		condition = "   AND  ( is_meeting  = 1  OR    duration != '' )  AND  a.activity_time >= '2024-01-01'  AND  a.activity_time <= '2024-12-31'  AND  s.company_id =  " + strconv.Itoa(v)
+		listData, err := cygx.GetActivityMeetByUser(condition, 0, 99999)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+		for _, item := range listData {
+			fmt.Println(item.ActivityTimeText)
+			row := sheet.AddRow()
+			cellActData := row.AddCell()
+			cellActData.Value = item.ActivityName
+
+			if item.ActivityType == 1 {
+				item.ActivityTypeName += "(线上)"
+			} else {
+				item.ActivityTypeName += "(线下)"
+			}
+			cellBData := row.AddCell()
+			cellBData.Value = item.ActivityTypeName
+
+			cellActimeData := row.AddCell()
+			cellActimeData.Value = item.ActivityTime
+
+			cellAData := row.AddCell()
+			cellAData.Value = item.RealName
+
+			cellMobileData := row.AddCell()
+			cellMobileData.Value = item.Mobile
+			cellCData := row.AddCell()
+			cellCData.Value = item.CompanyName
+
+			if mapuserMapbil[item.CompanyId] != nil {
+				cellCData.Value = mapuserMapbil[item.CompanyId].CompanyName
+			}
+		}
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+}

+ 1 - 1
models/cygx/cygx_user.go

@@ -1114,7 +1114,7 @@ func GetActivityMeetByUser(condition string, startSize, pageSize int) (item []*U
 			1 = 1 
 			AND s.do_fail_type = 0  ` + condition + `
 		GROUP BY
-			s.mobile
+			s.mobile ,s.activity_id
 		ORDER BY
 			a.activity_time DESC `
 	if startSize > 0 || pageSize > 0 {