|
@@ -5246,7 +5246,7 @@ func initart121_1() {
|
|
}
|
|
}
|
|
|
|
|
|
//func init() {
|
|
//func init() {
|
|
-// initUserKw()
|
|
|
|
|
|
+// initActZHouqi()
|
|
//}
|
|
//}
|
|
|
|
|
|
func initAct33() {
|
|
func initAct33() {
|
|
@@ -5684,3 +5684,328 @@ func initContract() {
|
|
fmt.Println("end")
|
|
fmt.Println("end")
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func initartZhouqi() {
|
|
|
|
+ //行业
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition += ` AND re.chart_permission_id = 62 AND art.publish_date > '2025-01-01' `
|
|
|
|
+ //报告匹配类型
|
|
|
|
+ //9.5 13:52
|
|
|
|
+ condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC `
|
|
|
|
+ listart, err := cygx.GetReportArticleList(condition, pars, 0, 2000, 1)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //创建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 = "PV"
|
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //标头
|
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
|
+ cellAt.Value = "报告名称"
|
|
|
|
+
|
|
|
|
+ cellTp := rowTitle.AddCell()
|
|
|
|
+ cellTp.Value = "报告类型"
|
|
|
|
+
|
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
|
+ cellPd.Value = "发布时间"
|
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
|
+ cellA.Value = "姓名"
|
|
|
|
+
|
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
|
+ cellC.Value = "公司名称"
|
|
|
|
+
|
|
|
|
+ cellDCreatedTime := rowTitle.AddCell()
|
|
|
|
+ cellDCreatedTime.Value = "阅读时间(最后一次)"
|
|
|
|
+
|
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
|
+ cellE.Value = "停留时长(多次合计))"
|
|
|
|
+
|
|
|
|
+ for _, v := range listart {
|
|
|
|
+ hasmobile := make(map[string]bool)
|
|
|
|
+ fmt.Println(v.ArticleId)
|
|
|
|
+ articleId := v.ArticleId
|
|
|
|
+ condition = ` AND h.create_time < '2025-02-25' AND h.company_id != ` + strconv.Itoa(utils.HZ_COMPANY_ID) // 过滤弘则
|
|
|
|
+ condition += ` ORDER BY create_time DESC `
|
|
|
|
+ //上一次的阅读记录
|
|
|
|
+ list, err := cygx.GetArticleHistoryList_ZHouqi(articleId, condition)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapArticle_H := make(map[string]bool)
|
|
|
|
+
|
|
|
|
+ var listDate []*cygx.ArticleHistoryRep
|
|
|
|
+ var mobiles []string
|
|
|
|
+
|
|
|
|
+ var mapMobileCy = make(map[string]bool)
|
|
|
|
+ mapstopTime := make(map[string]int)
|
|
|
|
+ if len(list) > 0 {
|
|
|
|
+ for _, vPv := range list {
|
|
|
|
+ if !utils.ValidateMobileFormatat(vPv.Mobile) {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ mobiles = append(mobiles, vPv.Mobile)
|
|
|
|
+ mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] = true
|
|
|
|
+ //listDate = append(listDate, vPv)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, vPv := range list {
|
|
|
|
+ stopTime, _ := strconv.Atoi(vPv.StopTime)
|
|
|
|
+ mapstopTime[vPv.Mobile] += stopTime
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listUser, err := models.GetWxUserRaiSllerListByUserMobile(mobiles)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listUserFicc, err := models.GetWxUserRaiSllerListByUserMobileFiic(mobiles)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapuserMapbil := make(map[string]*models.WxUserSller)
|
|
|
|
+ var companyIds []int
|
|
|
|
+ for _, vuser := range listUser {
|
|
|
|
+ //mapuserMapbil[vuser.Mobile] = vuser
|
|
|
|
+ companyIds = append(companyIds, vuser.CompanyId)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //fmt.Println(mappermissionName)
|
|
|
|
+ for _, vuser := range listUser {
|
|
|
|
+ mapuserMapbil[vuser.Mobile] = vuser
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, vuser := range listUserFicc {
|
|
|
|
+ vuser.Status = ""
|
|
|
|
+ vuser.SellerName = ""
|
|
|
|
+ if mapuserMapbil[vuser.Mobile] == nil {
|
|
|
|
+ mapuserMapbil[vuser.Mobile] = vuser
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("list", list)
|
|
|
|
+ if len(list) > 0 {
|
|
|
|
+ for _, vPv := range list {
|
|
|
|
+ if !utils.ValidateMobileFormatat(vPv.Mobile) {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if hasmobile[vPv.Mobile] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ hasmobile[vPv.Mobile] = true
|
|
|
|
+ mapMobileCy[vPv.Mobile] = true
|
|
|
|
+
|
|
|
|
+ listDate = append(listDate, vPv)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("listDate", listDate)
|
|
|
|
+
|
|
|
|
+ for _, item := range listDate {
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+
|
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
|
+ cellADatatitle.Value = v.Title
|
|
|
|
+
|
|
|
|
+ cellADataTy := row.AddCell()
|
|
|
|
+ cellADataTy.Value = v.FieldName
|
|
|
|
+
|
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
|
+ cellADataPd.Value = v.PublishDate
|
|
|
|
+
|
|
|
|
+ cellAData := row.AddCell()
|
|
|
|
+ cellAData.Value = item.RealName
|
|
|
|
+
|
|
|
|
+ //cellBData := row.AddCell()
|
|
|
|
+ //cellBData.Value = item.Mobile
|
|
|
|
+
|
|
|
|
+ cellCData := row.AddCell()
|
|
|
|
+ //cellCData.Value = item.CompanyName
|
|
|
|
+
|
|
|
|
+ if mapuserMapbil[item.Mobile] != nil {
|
|
|
|
+ cellCData.Value = mapuserMapbil[item.Mobile].CompanyName
|
|
|
|
+ if mapuserMapbil[item.Mobile].RealName != "" {
|
|
|
|
+ cellAData.Value = mapuserMapbil[item.Mobile].RealName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cellEData := row.AddCell()
|
|
|
|
+ cellEData.Value = item.CreateTime
|
|
|
|
+
|
|
|
|
+ cellStopData := row.AddCell()
|
|
|
|
+ cellStopData.Value = strconv.Itoa(mapstopTime[item.Mobile])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func initActZHouqi() {
|
|
|
|
+ //行业
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition += ` AND chart_permission_id = 62 AND activity_time > '2025-01-01' AND publish_status = 1 AND active_state = 3 OR activity_id IN (6477,6449) ORDER BY activity_time DESC `
|
|
|
|
+ list, err := cygx.GetActivityListAll(condition, pars, 0, 9999)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var activityIds []int
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ activityIds = append(activityIds, v.ActivityId)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ condition = ""
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+
|
|
|
|
+ fmt.Println("list", len(list))
|
|
|
|
+
|
|
|
|
+ //创建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()
|
|
|
|
+
|
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
|
+ cellB.Value = "活动名称"
|
|
|
|
+
|
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
|
+ cellPd.Value = "活动类型"
|
|
|
|
+ //cellA := rowTitle.AddCell()
|
|
|
|
+ //cellA.Value = "系列"
|
|
|
|
+
|
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
|
+ cellAt.Value = "活动时间"
|
|
|
|
+
|
|
|
|
+ cellUser := rowTitle.AddCell()
|
|
|
|
+ cellUser.Value = "参会人姓名"
|
|
|
|
+
|
|
|
|
+ cellCompany := rowTitle.AddCell()
|
|
|
|
+ cellCompany.Value = "公司名"
|
|
|
|
+
|
|
|
|
+ cellTime := rowTitle.AddCell()
|
|
|
|
+ cellTime.Value = "参会时长(线上会议)"
|
|
|
|
+
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+ condition = ` AND activity_id = ? AND ( is_meeting = 1 OR duration != "" ) `
|
|
|
|
+ pars = append(pars, v.ActivityId)
|
|
|
|
+
|
|
|
|
+ signUpDetailList, err := cygx.GetSignupDetailList(condition, pars)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, vs := range signUpDetailList {
|
|
|
|
+ if vs.CompanyName == "弘则研究" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+
|
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
|
+ cellADatatitle.Value = v.ActivityName
|
|
|
|
+
|
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
|
+
|
|
|
|
+ cellADataPd.Value = v.ActivityTypeName
|
|
|
|
+
|
|
|
|
+ cellBData := row.AddCell()
|
|
|
|
+ cellBData.Value = v.ActivityTime
|
|
|
|
+
|
|
|
|
+ cellUserData := row.AddCell()
|
|
|
|
+ cellUserData.Value = vs.RealName
|
|
|
|
+
|
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
|
+ cellCompanyData.Value = vs.CompanyName
|
|
|
|
+
|
|
|
|
+ cellTimeData := row.AddCell()
|
|
|
|
+ cellTimeData.Value = vs.Duration
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("end")
|
|
|
|
+}
|