|
@@ -7588,3 +7588,148 @@ func initgggg() {
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//func init() {
|
|
|
|
+// initActComapnyIds()
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+// 固收类型互动记录
|
|
|
|
+func initActComapnyIds() {
|
|
|
|
+
|
|
|
|
+ var condition string
|
|
|
|
+ mapuserMapbil := make(map[int]*models.WxUserSller)
|
|
|
|
+
|
|
|
|
+ companyIdArr := []int{19130, 17227, 5349, 18764}
|
|
|
|
+ //companyIdArr = []int{17227}
|
|
|
|
+ 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 = "1月份活动互动量"
|
|
|
|
+
|
|
|
|
+ cellActime := rowTitle.AddCell()
|
|
|
|
+ cellActime.Value = "2月份活动互动量"
|
|
|
|
+
|
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
|
+ cellD.Value = "3月份活动互动量"
|
|
|
|
+
|
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
|
+ cellE.Value = "4月份活动互动量"
|
|
|
|
+
|
|
|
|
+ cellArt1 := rowTitle.AddCell()
|
|
|
|
+ cellArt1.Value = "1月份报告互动量"
|
|
|
|
+
|
|
|
|
+ cellArt2 := rowTitle.AddCell()
|
|
|
|
+ cellArt2.Value = "2月份报告互动量"
|
|
|
|
+
|
|
|
|
+ cellArt3 := rowTitle.AddCell()
|
|
|
|
+ cellArt3.Value = "3月份报告互动量"
|
|
|
|
+
|
|
|
|
+ cellArt4 := rowTitle.AddCell()
|
|
|
|
+ cellArt4.Value = "4月份报告互动量"
|
|
|
|
+
|
|
|
|
+ for _, v := range listCompany {
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+ cellComData := row.AddCell()
|
|
|
|
+ cellComData.Value = v.CompanyName
|
|
|
|
+ for i := 1; i < 5; i++ {
|
|
|
|
+ //var statrDate, endDate string
|
|
|
|
+ statrDate := fmt.Sprint("2025-", i, "-01")
|
|
|
|
+ endDate := fmt.Sprint("2025-", i, "-31")
|
|
|
|
+ condition = ` AND ( is_meeting = 1 OR duration != '' ) AND a.activity_time >= '` + statrDate + `' AND a.activity_time <='` + endDate + `' AND s.company_id = ` + strconv.Itoa(v.CompanyId)
|
|
|
|
+ listData, err := cygx.GetActivityMeetByUser(condition, 0, 99999)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ cellActData := row.AddCell()
|
|
|
|
+ cellActData.Value = strconv.Itoa(len((listData)))
|
|
|
|
+ //var conditionArt string
|
|
|
|
+ //var parsArt []interface{}
|
|
|
|
+ //conditionArt = ` AND s.create_time >= ? AND s.create_time <= ? AND s.company_id = ?`
|
|
|
|
+ //parsArt = append(parsArt, statrDate, endDate, v.CompanyId)
|
|
|
|
+ //listTotal, err := cygx.GetCygxCompanyUserListSplitArt(conditionArt, parsArt)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // fmt.Println(err)
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ //cellArtData := row.AddCell()
|
|
|
|
+ //cellArtData.Value = strconv.Itoa(listTotal)
|
|
|
|
+ fmt.Println(len(listData))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i := 1; i < 5; i++ {
|
|
|
|
+ //var statrDate, endDate string
|
|
|
|
+ statrDate := fmt.Sprint("2025-", i, "-01")
|
|
|
|
+ endDate := fmt.Sprint("2025-", i, "-31")
|
|
|
|
+
|
|
|
|
+ var conditionArt string
|
|
|
|
+ var parsArt []interface{}
|
|
|
|
+ conditionArt = ` AND r.source = 'article' AND r.create_time >= ? AND r.create_time <= ? AND r.company_id = ?`
|
|
|
|
+ parsArt = append(parsArt, statrDate, endDate, v.CompanyId)
|
|
|
|
+ listTotal, err := cygx.GetCygxArticleAndYanxuanRecordCount(conditionArt, parsArt)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ cellArtData := row.AddCell()
|
|
|
|
+ cellArtData.Value = strconv.Itoa(listTotal)
|
|
|
|
+ fmt.Println((listTotal))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("end")
|
|
|
|
+}
|