|
@@ -4323,7 +4323,7 @@ func initQuanyi() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initUserCompanybill()
|
|
|
+// initQuanyiXiaoShou()
|
|
|
//}
|
|
|
|
|
|
func initBeizhu() {
|
|
@@ -4727,3 +4727,107 @@ func initUserCompanybill() {
|
|
|
fmt.Println("end")
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func initQuanyiXiaoShou() {
|
|
|
+
|
|
|
+ adminUserList, err := system.GetRaiAdminInitRai()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ adminMap := make(map[int]bool)
|
|
|
+ for _, vE := range adminUserList {
|
|
|
+ adminMap[vE.AdminId] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ //研选阅读明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+
|
|
|
+ //列表页数据
|
|
|
+ tmpList, err := models.GetIncrementalCompanyListByOperationRecordIniut(conditionBill, parsBill, 0, 9999)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapOperationadd := make(map[int]int)
|
|
|
+ mapOperationreceive := make(map[int]int)
|
|
|
+
|
|
|
+ for _, v := range tmpList {
|
|
|
+ if !adminMap[v.SellerId] {
|
|
|
+ fmt.Println("v.CompanyId", v.CompanyId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if v.Operation == "add" {
|
|
|
+ mapOperationadd[v.SellerId]++
|
|
|
+ } else {
|
|
|
+ mapOperationreceive[v.SellerId]++
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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 = "2023年2季度"
|
|
|
+ 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 = "新增"
|
|
|
+
|
|
|
+ cellB9 := rowTitle.AddCell()
|
|
|
+ cellB9.Value = "新建"
|
|
|
+
|
|
|
+ cellB10 := rowTitle.AddCell()
|
|
|
+ cellB10.Value = "领取"
|
|
|
+
|
|
|
+ for _, vE := range adminUserList {
|
|
|
+ //if mapOperationadd[vE.AdminId]+mapOperationreceive[vE.AdminId] == 0 {
|
|
|
+ // continue
|
|
|
+ //}
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = vE.RealName
|
|
|
+
|
|
|
+ cellBData8 := row.AddCell()
|
|
|
+ cellBData8.Value = fmt.Sprint(mapOperationadd[vE.AdminId] + mapOperationreceive[vE.AdminId])
|
|
|
+
|
|
|
+ cellBData9 := row.AddCell()
|
|
|
+ cellBData9.Value = fmt.Sprint(mapOperationadd[vE.AdminId])
|
|
|
+
|
|
|
+ cellBData10 := row.AddCell()
|
|
|
+ cellBData10.Value = fmt.Sprint(mapOperationreceive[vE.AdminId])
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+
|
|
|
+}
|