|
@@ -1978,7 +1978,7 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initAct()
|
|
|
+// initarta()
|
|
|
//}
|
|
|
|
|
|
func initart() {
|
|
@@ -2349,3 +2349,133 @@ func initAct() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func initarta() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND share_seller_id In (702,703,704,707) `
|
|
|
+ listProduct, err := company.GetCompanyProductList(condition, pars)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var companyIds []int
|
|
|
+ mapSeller := make(map[int]string)
|
|
|
+ for _, v := range listProduct {
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
+ mapSeller[v.CompanyId] = v.ShareSeller
|
|
|
+ }
|
|
|
+ //报告匹配类型
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND re.chart_permission_id IN (23,53) `
|
|
|
+ listart, err := cygx.GetReportArticleList(condition, pars, 0, 4000, 1)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapArticleTitle := make(map[int]string)
|
|
|
+ mapchart_permission_name := make(map[int]string)
|
|
|
+ var articleIds []int
|
|
|
+ for _, v := range listart {
|
|
|
+ mapArticleTitle[v.ArticleId] = v.Title
|
|
|
+ mapchart_permission_name[v.ArticleId] = v.ChartPermissionName
|
|
|
+ articleIds = append(articleIds, v.ArticleId)
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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()
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "姓名"
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "手机号"
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "公司名称"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "服务销售"
|
|
|
+
|
|
|
+ cellDCreatedTime := rowTitle.AddCell()
|
|
|
+ cellDCreatedTime.Value = "最近阅读时间"
|
|
|
+
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
+ cellE.Value = "行业"
|
|
|
+
|
|
|
+ cellF := rowTitle.AddCell()
|
|
|
+ cellF.Value = "报告标题"
|
|
|
+
|
|
|
+ //articleId := v.ArticleId
|
|
|
+ //condition = ` AND h.company_id != ` + strconv.Itoa(utils.HZ_COMPANY_ID) // 过滤弘则
|
|
|
+ list, err := cygx.GetArticleHistoryListInit(articleIds, companyIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapMobile := make(map[string]bool)
|
|
|
+ for _, item := range list {
|
|
|
+ if mapMobile[item.Mobile] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = item.RealName
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = item.Mobile
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ cellCData.Value = item.CompanyName
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = mapSeller[item.CompanyId]
|
|
|
+ cellEData := row.AddCell()
|
|
|
+ cellEData.Value = item.CreateTime
|
|
|
+
|
|
|
+ cellEcData := row.AddCell()
|
|
|
+ cellEcData.Value = mapchart_permission_name[item.ArticleId]
|
|
|
+
|
|
|
+ cellFData := row.AddCell()
|
|
|
+ cellFData.Value = mapArticleTitle[item.ArticleId]
|
|
|
+ mapMobile[item.Mobile] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|