|
@@ -6669,7 +6669,7 @@ func initCommpanyList() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initCommpanyNum()
|
|
|
+// initart121_326()
|
|
|
//}
|
|
|
|
|
|
// 公司研选剩余点数
|
|
@@ -6893,3 +6893,162 @@ func initCommpanyNum() {
|
|
|
}
|
|
|
fmt.Println("end")
|
|
|
}
|
|
|
+
|
|
|
+// 研选专栏阅读内容
|
|
|
+func initart121_326() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND a.id IN (632,633,634,637,638) ORDER BY publish_time DESC `
|
|
|
+ //报告匹配类型
|
|
|
+
|
|
|
+ condition += ` `
|
|
|
+ listart, err := cygx.GetYanxuanSpecialListBycondition(condition, pars, 0, 2000)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println("listart", len(listart))
|
|
|
+ //创建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 = "标题"
|
|
|
+
|
|
|
+ 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 k, v := range listart {
|
|
|
+ fmt.Println("kkkk", k)
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND yanxuan_special_id = ? AND stop_time > 0 AND mobile!= '' `
|
|
|
+ pars = append(pars, v.Id)
|
|
|
+ listPv, err := cygx.GetCygxYanxuanSpecialRecordList(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapStopTime := make(map[string]int)
|
|
|
+
|
|
|
+ for _, vP := range listPv {
|
|
|
+ mapStopTime[vP.Mobile] += vP.StopTime
|
|
|
+ }
|
|
|
+ haveMobile := make(map[string]bool)
|
|
|
+ //var listDate []*cygx.ArticleHistoryRep
|
|
|
+
|
|
|
+ var mobileArr []string
|
|
|
+ var companyIds []int
|
|
|
+ companyIdsMap := make(map[int]bool)
|
|
|
+ mapMobileUser := make(map[string]string)
|
|
|
+ for _, vuser := range listPv {
|
|
|
+ mobileArr = append(mobileArr, vuser.Mobile)
|
|
|
+ if companyIdsMap[vuser.CompanyId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ companyIds = append(companyIds, vuser.CompanyId)
|
|
|
+ companyIdsMap[vuser.CompanyId] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ listUser, err := models.GetWxUserListByUserMobileHaveCompany(mobileArr)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, vu := range listUser {
|
|
|
+ mapMobileUser[vu.Mobile] = vu.RealName
|
|
|
+ }
|
|
|
+
|
|
|
+ //合并合同所对应的权限
|
|
|
+ listCompany, err := company.GetCompanyProductsByCompanyIdsAndProductIdinit(companyIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapIndustryName := make(map[int]string)
|
|
|
+ for _, vC := range listCompany {
|
|
|
+ mapIndustryName[vC.CompanyId] = vC.IndustryName
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, item := range listPv {
|
|
|
+ if haveMobile[item.Mobile] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ haveMobile[item.Mobile] = true
|
|
|
+ row := sheet.AddRow()
|
|
|
+
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.Title
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = v.PublishTime.Format(utils.FormatDateTime)
|
|
|
+
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ if item.RealName == "" {
|
|
|
+ cellAData.Value = mapMobileUser[item.Mobile]
|
|
|
+ } else {
|
|
|
+ cellAData.Value = item.RealName
|
|
|
+ }
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = item.CompanyName
|
|
|
+
|
|
|
+ cellEData := row.AddCell()
|
|
|
+ cellEData.Value = item.CreateTime
|
|
|
+
|
|
|
+ cellFData := row.AddCell()
|
|
|
+ cellFData.Value = strconv.Itoa(mapStopTime[item.Mobile])
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|