|
@@ -7256,3 +7256,335 @@ func initActComapny() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func initexcel() {
|
|
|
+ path := "./007.xlsx"
|
|
|
+ xlFile, err := xlsx.OpenFile(path)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var companyName string
|
|
|
+ var name string
|
|
|
+ var phone string
|
|
|
+ var phone2 string
|
|
|
+ var mobiles []string
|
|
|
+ for _, sheet := range xlFile.Sheets {
|
|
|
+ maxRow := sheet.MaxRow
|
|
|
+ for i := 0; i < maxRow; i++ {
|
|
|
+ if i >= 1 {
|
|
|
+ row := sheet.Row(i)
|
|
|
+ cells := row.Cells
|
|
|
+ for k, cell := range cells {
|
|
|
+ if k == 1 {
|
|
|
+ companyName = cell.String()
|
|
|
+ }
|
|
|
+ if k == 4 {
|
|
|
+ name = cell.String()
|
|
|
+ }
|
|
|
+ if k == 11 {
|
|
|
+ phone = cell.String()
|
|
|
+ }
|
|
|
+ if k == 13 {
|
|
|
+ phone2 = cell.String()
|
|
|
+ }
|
|
|
+ mobiles = append(mobiles, phone, phone2)
|
|
|
+ }
|
|
|
+ fmt.Println(fmt.Sprint("公司名称", companyName, "_姓名", name, "_手机号", phone, "_手机号2", phone2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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 = "到会信息"
|
|
|
+ sheetF, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheetF.AddRow()
|
|
|
+
|
|
|
+ cellMobile := rowTitle.AddCell()
|
|
|
+ cellMobile.Value = "手机号"
|
|
|
+
|
|
|
+ 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 = "首次入会时间"
|
|
|
+
|
|
|
+ cellComL := rowTitle.AddCell()
|
|
|
+ cellComL.Value = "最后退出时间"
|
|
|
+
|
|
|
+ cellComDu := rowTitle.AddCell()
|
|
|
+ cellComDu.Value = "参与时长"
|
|
|
+
|
|
|
+ listData, err := cygx.GetSignupDetailListinit(mobiles)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mobileItems := make(map[string][]*cygx.CygxActivitySignupDetailInit)
|
|
|
+
|
|
|
+ for _, v := range listData {
|
|
|
+ mobileItems[v.OutboundMobile] = append(mobileItems[v.OutboundMobile], v)
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, sheet := range xlFile.Sheets {
|
|
|
+ maxRow := sheet.MaxRow
|
|
|
+ for i := 0; i < maxRow; i++ {
|
|
|
+ if i >= 1 {
|
|
|
+ row := sheet.Row(i)
|
|
|
+ cells := row.Cells
|
|
|
+ for k, cell := range cells {
|
|
|
+ if k == 1 {
|
|
|
+ companyName = cell.String()
|
|
|
+ }
|
|
|
+ if k == 4 {
|
|
|
+ name = cell.String()
|
|
|
+ }
|
|
|
+ if k == 11 {
|
|
|
+ phone = cell.String()
|
|
|
+ }
|
|
|
+ if k == 13 {
|
|
|
+ phone2 = cell.String()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(mobileItems[phone]) == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ for _, vD := range mobileItems[phone] {
|
|
|
+
|
|
|
+ rowD := sheetF.AddRow()
|
|
|
+ cellActData := rowD.AddCell()
|
|
|
+ cellActData.Value = phone
|
|
|
+
|
|
|
+ cellNameData := rowD.AddCell()
|
|
|
+ cellNameData.Value = name
|
|
|
+
|
|
|
+ cellComNameData := rowD.AddCell()
|
|
|
+ cellComNameData.Value = companyName
|
|
|
+
|
|
|
+ cellActNameData := rowD.AddCell()
|
|
|
+ cellActNameData.Value = vD.ActivityName
|
|
|
+
|
|
|
+ cellActivityTypeNameData := rowD.AddCell()
|
|
|
+ cellActivityTypeNameData.Value = vD.ActivityTypeName
|
|
|
+
|
|
|
+ cellActivityTimeData := rowD.AddCell()
|
|
|
+ cellActivityTimeData.Value = vD.ActivityTime
|
|
|
+
|
|
|
+ cellActivityTimeFData := rowD.AddCell()
|
|
|
+ cellActivityTimeFData.Value = vD.FirstMeetingTime
|
|
|
+
|
|
|
+ cellActivityTimeLData := rowD.AddCell()
|
|
|
+ cellActivityTimeLData.Value = vD.LastMeetingTime
|
|
|
+
|
|
|
+ cellActivityTimeDuData := rowD.AddCell()
|
|
|
+ cellActivityTimeDuData.Value = vD.Duration
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, sheet := range xlFile.Sheets {
|
|
|
+ maxRow := sheet.MaxRow
|
|
|
+ for i := 0; i < maxRow; i++ {
|
|
|
+ if i >= 1 {
|
|
|
+ row := sheet.Row(i)
|
|
|
+ cells := row.Cells
|
|
|
+ for k, cell := range cells {
|
|
|
+ if k == 1 {
|
|
|
+ companyName = cell.String()
|
|
|
+ }
|
|
|
+ if k == 4 {
|
|
|
+ name = cell.String()
|
|
|
+ }
|
|
|
+ //if k == 11 {
|
|
|
+ // phone = cell.String()
|
|
|
+ //}
|
|
|
+ if k == 13 {
|
|
|
+ phone = cell.String()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(mobileItems[phone]) == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ for _, vD := range mobileItems[phone] {
|
|
|
+
|
|
|
+ rowD := sheetF.AddRow()
|
|
|
+ cellActData := rowD.AddCell()
|
|
|
+ cellActData.Value = phone
|
|
|
+
|
|
|
+ cellNameData := rowD.AddCell()
|
|
|
+ cellNameData.Value = name
|
|
|
+
|
|
|
+ cellComNameData := rowD.AddCell()
|
|
|
+ cellComNameData.Value = companyName
|
|
|
+
|
|
|
+ cellActNameData := rowD.AddCell()
|
|
|
+ cellActNameData.Value = vD.ActivityName
|
|
|
+
|
|
|
+ cellActivityTypeNameData := rowD.AddCell()
|
|
|
+ cellActivityTypeNameData.Value = vD.ActivityTypeName
|
|
|
+
|
|
|
+ cellActivityTimeData := rowD.AddCell()
|
|
|
+ cellActivityTimeData.Value = vD.ActivityTime
|
|
|
+
|
|
|
+ cellActivityTimeFData := rowD.AddCell()
|
|
|
+ cellActivityTimeFData.Value = vD.FirstMeetingTime
|
|
|
+
|
|
|
+ cellActivityTimeLData := rowD.AddCell()
|
|
|
+ cellActivityTimeLData.Value = vD.LastMeetingTime
|
|
|
+
|
|
|
+ cellActivityTimeDuData := rowD.AddCell()
|
|
|
+ cellActivityTimeDuData.Value = vD.Duration
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 固收类型互动记录
|
|
|
+func initgggg() {
|
|
|
+ listDataAct, err := cygx.GetSignupDetailListGushou()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ listDataArt, err := cygx.GetSignupDetailListGushouArt()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ companyids := make(map[int]bool)
|
|
|
+ for _, v := range listDataAct {
|
|
|
+ companyids[v.CompanyId] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listDataArt {
|
|
|
+ companyids[v.CompanyId] = true
|
|
|
+ }
|
|
|
+ fmt.Println(companyids)
|
|
|
+
|
|
|
+ listComapny, err := company.GetCompanyProductsByCompanyIds508()
|
|
|
+ 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 = "固收公司状态"
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
+ cellC.Value = "公司名称"
|
|
|
+
|
|
|
+ cellDCreatedTime := rowTitle.AddCell()
|
|
|
+ cellDCreatedTime.Value = "状态"
|
|
|
+
|
|
|
+ cellDCreatedTimeS := rowTitle.AddCell()
|
|
|
+ cellDCreatedTimeS.Value = "所属销售"
|
|
|
+
|
|
|
+ for _, v := range listComapny {
|
|
|
+ if !companyids[v.CompanyId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.CompanyName
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = v.Status
|
|
|
+
|
|
|
+ cellADataPds := row.AddCell()
|
|
|
+ cellADataPds.Value = v.SellerName
|
|
|
+ }
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|