|
@@ -6031,7 +6031,7 @@ func initActZHouqi() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initContract()
|
|
|
+// initRsCalendarCheck()
|
|
|
//}
|
|
|
|
|
|
// 研选扣点明细,与专项调研明细
|
|
@@ -6172,3 +6172,226 @@ func initPointBill() {
|
|
|
}
|
|
|
fmt.Println("end")
|
|
|
}
|
|
|
+
|
|
|
+// 公司最后一份合同期间内参加的路演
|
|
|
+func initRsCalendar() {
|
|
|
+ //行业
|
|
|
+ listcompany, e := company.GetOverseasCompanysByCompanyIdsInit()
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(e)
|
|
|
+ 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()
|
|
|
+
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "客户名称"
|
|
|
+
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
+ cellPd.Value = "最后一份合同开始时间"
|
|
|
+ //cellA := rowTitle.AddCell()
|
|
|
+ //cellA.Value = "系列"
|
|
|
+
|
|
|
+ cellAt := rowTitle.AddCell()
|
|
|
+ cellAt.Value = "最后一份合同结束时间"
|
|
|
+
|
|
|
+ cellUser := rowTitle.AddCell()
|
|
|
+ cellUser.Value = "路演次数"
|
|
|
+
|
|
|
+ //cellRsdate := rowTitle.AddCell()
|
|
|
+ //cellRsdate.Value = "路演时间"
|
|
|
+ //
|
|
|
+ //cellYjy := rowTitle.AddCell()
|
|
|
+ //cellYjy.Value = "路演研究员"
|
|
|
+
|
|
|
+ cellId := rowTitle.AddCell()
|
|
|
+ cellId.Value = "公司ID"
|
|
|
+
|
|
|
+ for _, v := range listcompany {
|
|
|
+ fmt.Println(v.CompanyId)
|
|
|
+
|
|
|
+ detail, err := company.GetCompanyContractDetailByCompanyContractIdInit(v.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err, v.CompanyId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ listRs, err := roadshow.GetRsCalendarResearcherListByCalendarResearcherIdInit(v.CompanyId, detail.StartDate, detail.EndDate)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err, "GetRsCalendarResearcherListByCalendarResearcherIdInit", v.CompanyId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.CompanyName
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = detail.StartDate
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = detail.EndDate
|
|
|
+
|
|
|
+ cellUserData := row.AddCell()
|
|
|
+ cellUserData.Value = fmt.Sprint(len(listRs))
|
|
|
+
|
|
|
+ //cellRsdateData := row.AddCell()
|
|
|
+ //cellRsdateData.Value = vs.StartDate
|
|
|
+ //
|
|
|
+ //cellYjyData := row.AddCell()
|
|
|
+ //cellYjyData.Value = vs.ResearcherName
|
|
|
+
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
+ cellCompanyData.Value = fmt.Sprint(v.CompanyId)
|
|
|
+
|
|
|
+ //for _, vs := range listRs {
|
|
|
+ //
|
|
|
+ //}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+}
|
|
|
+
|
|
|
+// 公司最后一份合同期间内参加的路演
|
|
|
+func initRsCalendarCheck() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ condition = " AND points > 0 GROUP BY company_id "
|
|
|
+ listcompany, e := cygx.GetCygxActivitySpecialPermissionPointsList(condition, pars)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(e)
|
|
|
+ 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()
|
|
|
+
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
+ cellB.Value = "客户名称"
|
|
|
+
|
|
|
+ cellPd := rowTitle.AddCell()
|
|
|
+ cellPd.Value = "剩余点数"
|
|
|
+
|
|
|
+ cellId := rowTitle.AddCell()
|
|
|
+ cellId.Value = "公司ID"
|
|
|
+
|
|
|
+ for _, v := range listcompany {
|
|
|
+ fmt.Println(v.CompanyId)
|
|
|
+ var conditionP string
|
|
|
+ var parsP []interface{}
|
|
|
+ detail, err := company.GetCompanyContractDetailByCompanyContractIdInit(v.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err, v.CompanyId)
|
|
|
+ continue
|
|
|
+ //return
|
|
|
+ }
|
|
|
+
|
|
|
+ conditionP = " AND company_id = ? AND product_id = 2 AND status = '正式' AND is_upgrade = 1 "
|
|
|
+ parsP = append(parsP, v.CompanyId)
|
|
|
+
|
|
|
+ //获取所有开通买方研选正式试用的客户列表
|
|
|
+ listCompanyPermission, e := company.GetCompanyReportPermissionList(conditionP, parsP, 0, 10)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(e, v.CompanyId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(listCompanyPermission) > 0 || detail.RaiPackageType > 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.CompanyName
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+ cellADataPd.Value = fmt.Sprint(v.Points)
|
|
|
+
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
+ cellCompanyData.Value = fmt.Sprint(v.CompanyId)
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+}
|