|
@@ -4321,3 +4321,409 @@ func initQuanyi() {
|
|
|
fmt.Println("end")
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+//func init() {
|
|
|
+// initUserCompanybill()
|
|
|
+//}
|
|
|
+
|
|
|
+func initBeizhu() {
|
|
|
+
|
|
|
+ productList, err := company.GetCompanyHistoryRemarkListInit()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var companyids []int
|
|
|
+ for _, v := range productList {
|
|
|
+ companyids = append(companyids, v.CompanyId)
|
|
|
+ }
|
|
|
+
|
|
|
+ listCompany, err := company.GetOverseasCompanysByCompanyIds(companyids)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapCompamyName := make(map[int]string)
|
|
|
+
|
|
|
+ for _, v := range listCompany {
|
|
|
+ mapCompamyName[v.CompanyId] = v.CompanyName
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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
|
|
|
+
|
|
|
+ var sheetName string
|
|
|
+ sheetName = "备注"
|
|
|
+ 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 = "类型"
|
|
|
+ cellCSeller := rowTitle.AddCell()
|
|
|
+ cellCSeller.Value = "创建人"
|
|
|
+ cellTime := rowTitle.AddCell()
|
|
|
+ cellTime.Value = "创建时间"
|
|
|
+
|
|
|
+ for _, vE := range productList {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = mapCompamyName[vE.CompanyId]
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = vE.Content
|
|
|
+
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ switch vE.TableName {
|
|
|
+ case "company_service_record":
|
|
|
+ cellCData.Value = "沟通记录"
|
|
|
+ case "company_product_remark":
|
|
|
+ cellCData.Value = "备注"
|
|
|
+ case "company_no_renewed_note":
|
|
|
+ cellCData.Value = "未续约备注"
|
|
|
+ case "company_renewal_reason":
|
|
|
+ cellCData.Value = "未续约说明"
|
|
|
+ case "cygx_user_feedback":
|
|
|
+ cellCData.Value = "交流反馈(" + vE.RealName + ")"
|
|
|
+ default:
|
|
|
+ cellCData.Value = "备注"
|
|
|
+ }
|
|
|
+
|
|
|
+ cellNameData := row.AddCell()
|
|
|
+ cellNameData.Value = vE.SysAdminName
|
|
|
+
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = vE.ShowTime.Format(utils.FormatDateTime)
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func initUserbill() {
|
|
|
+
|
|
|
+ //研选阅读明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ monthArr := []string{"08", "09", "10", "11", "12"}
|
|
|
+ conditionBill = " AND view_time > '2024-07-01' AND view_time < '2025-01-01' "
|
|
|
+
|
|
|
+ listBill, e := cygx.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapCompanyIds := make(map[int]bool)
|
|
|
+ mapSellerServerCountTotal := make(map[int]float64)
|
|
|
+ mapSellerServerCount := make(map[string]float64)
|
|
|
+ var companyids []int
|
|
|
+ for _, v := range listBill {
|
|
|
+ if mapCompanyIds[v.CompanyId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ companyids = append(companyids, v.CompanyId)
|
|
|
+ mapCompanyIds[v.CompanyId] = true
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //listCompany, err := company.GetOverseasCompanysByCompanyIds(companyids)
|
|
|
+ //if err != nil {
|
|
|
+ // fmt.Println(err)
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+
|
|
|
+ //mapCompamyName := make(map[int]string)
|
|
|
+ //
|
|
|
+ //for _, v := range listCompany {
|
|
|
+ // mapCompamyName[v.CompanyId] = v.CompanyName
|
|
|
+ //}
|
|
|
+
|
|
|
+ companyProductItems, err := company.GetCompanyProductByCompanyIdSAndProductId(companyids, 2)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapCompamySeller := make(map[int]int)
|
|
|
+ for _, v := range companyProductItems {
|
|
|
+ mapCompamySeller[v.CompanyId] = v.ShareSellerId
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listBill {
|
|
|
+ for _, m := range monthArr {
|
|
|
+ vM := v.ViewTime[5:7]
|
|
|
+ if m != vM {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //fmt.Println(vM)
|
|
|
+ mapSellerServerCount[fmt.Sprint(mapCompamySeller[v.CompanyId], "_", m)] += v.ServeCount
|
|
|
+ }
|
|
|
+ mapSellerServerCountTotal[(mapCompamySeller[v.CompanyId])] += v.ServeCount
|
|
|
+ }
|
|
|
+
|
|
|
+ adminUserList, err := system.GetRaiAdminInit()
|
|
|
+ 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
|
|
|
+
|
|
|
+ var sheetName string
|
|
|
+ sheetName = "备注"
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "服务销售名称"
|
|
|
+ cellB8 := rowTitle.AddCell()
|
|
|
+ cellB8.Value = "8月份服务量"
|
|
|
+
|
|
|
+ cellB9 := rowTitle.AddCell()
|
|
|
+ cellB9.Value = "9月份服务量"
|
|
|
+
|
|
|
+ cellB10 := rowTitle.AddCell()
|
|
|
+ cellB10.Value = "10月份服务量"
|
|
|
+
|
|
|
+ cellB11 := rowTitle.AddCell()
|
|
|
+ cellB11.Value = "11月份服务量"
|
|
|
+
|
|
|
+ cellB12 := rowTitle.AddCell()
|
|
|
+ cellB12.Value = "12月份服务量"
|
|
|
+
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "总服务量"
|
|
|
+
|
|
|
+ for _, vE := range adminUserList {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = vE.RealName
|
|
|
+
|
|
|
+ cellBData8 := row.AddCell()
|
|
|
+ cellBData8.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.AdminId, "_08")])
|
|
|
+
|
|
|
+ cellBData9 := row.AddCell()
|
|
|
+ cellBData9.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.AdminId, "_09")])
|
|
|
+
|
|
|
+ cellBData10 := row.AddCell()
|
|
|
+ cellBData10.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.AdminId, "_10")])
|
|
|
+
|
|
|
+ cellBData11 := row.AddCell()
|
|
|
+ cellBData11.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.AdminId, "_11")])
|
|
|
+
|
|
|
+ cellBData12 := row.AddCell()
|
|
|
+ cellBData12.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.AdminId, "_12")])
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = fmt.Sprint(mapSellerServerCountTotal[vE.AdminId])
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func initUserCompanybill() {
|
|
|
+
|
|
|
+ //研选阅读明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND view_time > '2024-07-01' AND view_time < '2025-01-01' AND company_id IN (98, 1444, 1585, 5332, 6351, 8354, 8683, 9310, 13500) "
|
|
|
+
|
|
|
+ companyIdsArr := []int{98, 1444, 1585, 5332, 6351, 8354, 8683, 9310, 13500}
|
|
|
+
|
|
|
+ listBill, e := cygx.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapCompanyIds := make(map[int]bool)
|
|
|
+ mapSellerServerCountTotal := make(map[int]float64)
|
|
|
+ mapSellerServerCount := make(map[string]float64)
|
|
|
+ var companyids []int
|
|
|
+ for _, v := range listBill {
|
|
|
+ if mapCompanyIds[v.CompanyId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ companyids = append(companyids, v.CompanyId)
|
|
|
+ mapCompanyIds[v.CompanyId] = true
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ listCompany, err := company.GetOverseasCompanysByCompanyIds(companyIdsArr)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapCompamyName := make(map[int]string)
|
|
|
+
|
|
|
+ for _, v := range listCompany {
|
|
|
+ mapCompamyName[v.CompanyId] = v.CompanyName
|
|
|
+ }
|
|
|
+ monthArr := []string{"08", "09", "10", "11", "12"}
|
|
|
+ companyProductItems, err := company.GetCompanyProductByCompanyIdSAndProductId(companyids, 2)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapCompamySeller := make(map[int]int)
|
|
|
+ for _, v := range companyProductItems {
|
|
|
+ mapCompamySeller[v.CompanyId] = v.ShareSellerId
|
|
|
+ }
|
|
|
+
|
|
|
+ //for _, v := range listBill {
|
|
|
+ // mapSellerServerCount[v.CompanyId] += v.ServeCount
|
|
|
+ //}
|
|
|
+
|
|
|
+ for _, v := range listBill {
|
|
|
+ for _, m := range monthArr {
|
|
|
+ vM := v.ViewTime[5:7]
|
|
|
+ if m != vM {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //fmt.Println(vM)
|
|
|
+ mapSellerServerCount[fmt.Sprint(v.CompanyId, "_", m)] += v.ServeCount
|
|
|
+ }
|
|
|
+ mapSellerServerCountTotal[v.CompanyId] += v.ServeCount
|
|
|
+ }
|
|
|
+ fmt.Println(mapSellerServerCount)
|
|
|
+ //
|
|
|
+ ////ficc 研究员
|
|
|
+ //adminUserList, err := system.GetRaiAdminInit()
|
|
|
+ //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
|
|
|
+
|
|
|
+ var sheetName string
|
|
|
+ sheetName = "公司互动统计"
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //标头
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
+ cellA.Value = "服务销售名称"
|
|
|
+ cellB8 := rowTitle.AddCell()
|
|
|
+ cellB8.Value = "8月份服务量"
|
|
|
+
|
|
|
+ cellB9 := rowTitle.AddCell()
|
|
|
+ cellB9.Value = "9月份服务量"
|
|
|
+
|
|
|
+ cellB10 := rowTitle.AddCell()
|
|
|
+ cellB10.Value = "10月份服务量"
|
|
|
+
|
|
|
+ cellB11 := rowTitle.AddCell()
|
|
|
+ cellB11.Value = "11月份服务量"
|
|
|
+
|
|
|
+ cellB12 := rowTitle.AddCell()
|
|
|
+ cellB12.Value = "12月份服务量"
|
|
|
+
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "总服务量"
|
|
|
+
|
|
|
+ for _, vE := range listCompany {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = vE.CompanyName
|
|
|
+
|
|
|
+ cellBData8 := row.AddCell()
|
|
|
+ cellBData8.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.CompanyId, "_08")])
|
|
|
+
|
|
|
+ cellBData9 := row.AddCell()
|
|
|
+ cellBData9.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.CompanyId, "_09")])
|
|
|
+
|
|
|
+ cellBData10 := row.AddCell()
|
|
|
+ cellBData10.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.CompanyId, "_10")])
|
|
|
+
|
|
|
+ cellBData11 := row.AddCell()
|
|
|
+ cellBData11.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.CompanyId, "_11")])
|
|
|
+
|
|
|
+ cellBData12 := row.AddCell()
|
|
|
+ cellBData12.Value = fmt.Sprint(mapSellerServerCount[fmt.Sprint(vE.CompanyId, "_12")])
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = fmt.Sprint(mapSellerServerCountTotal[vE.CompanyId])
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+
|
|
|
+}
|