|
@@ -6009,3 +6009,134 @@ func initActZHouqi() {
|
|
|
}
|
|
|
fmt.Println("end")
|
|
|
}
|
|
|
+
|
|
|
+//func init() {
|
|
|
+// initPointBill()
|
|
|
+//}
|
|
|
+
|
|
|
+// 研选扣点明细,与专项调研明细
|
|
|
+func initPointBill() {
|
|
|
+ //行业
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ activitySpecialPermissionPointsList, e := cygx.GetCygxActivitySpecialPermissionPointsList(condition, pars)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ activityYxPermissionPointsList, e := cygx.GetCygxActivityPointsCompanyByCompanyList(condition, pars)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var companyIds []int
|
|
|
+ mapPointSpeial := make(map[int]float64)
|
|
|
+ mapPointYx := make(map[int]float64)
|
|
|
+ for _, v := range activitySpecialPermissionPointsList {
|
|
|
+ companyIds = append(companyIds, v.CompanyId)
|
|
|
+ mapPointSpeial[v.CompanyId] += v.Pointsf
|
|
|
+ }
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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 = "客户状态"
|
|
|
+
|
|
|
+ cellCompany := rowTitle.AddCell()
|
|
|
+ cellCompany.Value = "研选点数"
|
|
|
+
|
|
|
+ cellTime := rowTitle.AddCell()
|
|
|
+ cellTime.Value = "专项调研点数"
|
|
|
+
|
|
|
+ for _, v := range listCompanyProduct {
|
|
|
+ if mapPointSpeial[v.CompanyId] == 0 && mapPointYx[v.CompanyId] == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellADatatitle := row.AddCell()
|
|
|
+ cellADatatitle.Value = v.CompanyName
|
|
|
+
|
|
|
+ cellADataPd := row.AddCell()
|
|
|
+
|
|
|
+ cellADataPd.Value = v.SellerName
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = v.ShareSeller
|
|
|
+
|
|
|
+ cellUserData := row.AddCell()
|
|
|
+ cellUserData.Value = v.Status
|
|
|
+
|
|
|
+ cellCompanyData := row.AddCell()
|
|
|
+ cellCompanyData.Value = fmt.Sprint(mapPointYx[v.CompanyId])
|
|
|
+
|
|
|
+ cellTimeData := row.AddCell()
|
|
|
+ cellTimeData.Value = fmt.Sprint(mapPointSpeial[v.CompanyId])
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+}
|