|
@@ -6395,3 +6395,259 @@ func initRsCalendarCheck() {
|
|
}
|
|
}
|
|
fmt.Println("end")
|
|
fmt.Println("end")
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//func init() {
|
|
|
|
+// initCommpanyList()
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+// 公司研选剩余点数
|
|
|
|
+func initYanxuanPoint() {
|
|
|
|
+ //行业
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition = " AND points != 0 "
|
|
|
|
+ activityYxPermissionPointsList, e := cygx.GetCygxActivityPointsCompanyByCompanyList(condition, pars)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var companyIds []int
|
|
|
|
+ mapPointYx := make(map[int]float64)
|
|
|
|
+
|
|
|
|
+ for _, v := range activityYxPermissionPointsList {
|
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
|
+ mapPointYx[v.CompanyId] += v.Points
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listCompanyProduct, err := company.GetCompanyProductsByCompanyIdsAndProductIdinit(companyIds)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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
|
|
|
|
+
|
|
|
|
+ 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 = "销售"
|
|
|
|
+
|
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
|
+ cellAt.Value = "服务销售"
|
|
|
|
+
|
|
|
|
+ cellCompany := rowTitle.AddCell()
|
|
|
|
+ cellCompany.Value = "研选点数"
|
|
|
|
+
|
|
|
|
+ for _, v := range listCompanyProduct {
|
|
|
|
+ if mapPointYx[v.CompanyId] == 0 {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
|
+ cellADatatitle.Value = mapCompamyName[v.CompanyId]
|
|
|
|
+
|
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
|
+ cellADataPd.Value = v.SellerName
|
|
|
|
+
|
|
|
|
+ cellBData := row.AddCell()
|
|
|
|
+ cellBData.Value = v.ShareSeller
|
|
|
|
+
|
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
|
+ cellCompanyData.Value = fmt.Sprint(mapPointYx[v.CompanyId])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("end")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 公司研选剩余点数
|
|
|
|
+func initCommpanyList() {
|
|
|
|
+ //行业
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition = " AND product_id = 2 AND status IN ('正式','试用') ORDER BY status DESC "
|
|
|
|
+ listCompanyProduct, e := company.GetCompanyProductList(condition, pars)
|
|
|
|
+ if e != nil {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var companyIds []int
|
|
|
|
+
|
|
|
|
+ for _, v := range listCompanyProduct {
|
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listCompany, err := company.GetOverseasCompanysByCompanyIds(companyIds)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var conditionc string
|
|
|
|
+ var parsc []interface{}
|
|
|
|
+
|
|
|
|
+ conditionc = " AND product_id = 2 AND end_date > '2025-03-04' "
|
|
|
|
+
|
|
|
|
+ var companyContractIds []int
|
|
|
|
+ companyContractList, e := company.GetCompanyContractList(conditionc, parsc)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, v := range companyContractList {
|
|
|
|
+ companyContractIds = append(companyContractIds, v.CompanyContractId)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //合并合同所对应的权限
|
|
|
|
+ mappermissionName, err := cygxService.GetCompanyContractPermissionNameMapById(companyContractIds)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapCompamyName := make(map[int]string)
|
|
|
|
+ mapInteractionNum := make(map[int]int)
|
|
|
|
+
|
|
|
|
+ for _, v := range listCompany {
|
|
|
|
+ mapCompamyName[v.CompanyId] = v.CompanyName
|
|
|
|
+ mapInteractionNum[v.CompanyId] = v.InteractionNum
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapCompamyPersion := make(map[int][]string)
|
|
|
|
+ for _, v := range companyContractList {
|
|
|
|
+ mapCompamyPersion[v.CompanyId] = append(mapCompamyPersion[v.CompanyId], mappermissionName[v.CompanyContractId])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //创建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 = "互动量 "
|
|
|
|
+
|
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
|
+ cellAt.Value = "当前状态"
|
|
|
|
+
|
|
|
|
+ cellCompany := rowTitle.AddCell()
|
|
|
|
+ cellCompany.Value = "合同期限/试用期限"
|
|
|
|
+
|
|
|
|
+ cellPerssion := rowTitle.AddCell()
|
|
|
|
+ cellPerssion.Value = "签约套餐"
|
|
|
|
+
|
|
|
|
+ for _, v := range listCompanyProduct {
|
|
|
|
+
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
|
+ cellADatatitle.Value = mapCompamyName[v.CompanyId]
|
|
|
|
+
|
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
|
+ cellADataPd.Value = fmt.Sprint(mapInteractionNum[v.CompanyId])
|
|
|
|
+
|
|
|
|
+ cellBData := row.AddCell()
|
|
|
|
+ cellBData.Value = v.Status
|
|
|
|
+
|
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
|
+ cellCompanyData.Value = fmt.Sprint(v.StartDate, " / ", v.EndDate)
|
|
|
|
+
|
|
|
|
+ cellPerssionData := row.AddCell()
|
|
|
|
+ cellPerssionData.Value = strings.Join(mapCompamyPersion[v.CompanyId], ",")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("end")
|
|
|
|
+}
|