|
@@ -1978,7 +1978,7 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initart()
|
|
|
+// initAct()
|
|
|
//}
|
|
|
|
|
|
func initart() {
|
|
@@ -2219,3 +2219,133 @@ func initart() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func initAct() {
|
|
|
+ var condition string
|
|
|
+ condition = " AND s.activity_id = 5734 AND is_meeting = 1 "
|
|
|
+ list, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var companyIds []int
|
|
|
+ for _, vuser := range list {
|
|
|
+ //mapuserMapbil[vuser.Mobile] = vuser
|
|
|
+ companyIds = append(companyIds, vuser.CompanyId)
|
|
|
+ }
|
|
|
+ mapuserMapbil := make(map[int]*models.WxUserSller)
|
|
|
+ listCompany, err := models.GetWxUserRaiSllerListByUserComapnyId(companyIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //合并合同所对应的权限
|
|
|
+ mappermissionName, err := cygxService.GetCompanyContractPermissionNameMapByIds(companyIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listCompany {
|
|
|
+ v.ChartPermissionName = mappermissionName[v.CompanyId]
|
|
|
+ mapuserMapbil[v.CompanyId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+ listCompanyFicc, err := models.GetWxUserRaiSllerListByUserComapnyIdFicc(companyIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listCompanyFicc {
|
|
|
+ if mapuserMapbil[v.CompanyId] != nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ v.Status = ""
|
|
|
+ v.SellerName = ""
|
|
|
+ mapuserMapbil[v.CompanyId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建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 = "PV"
|
|
|
+ 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 = "公司名称"
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
+ cellD.Value = "所属销售"
|
|
|
+
|
|
|
+ cellStatus := rowTitle.AddCell()
|
|
|
+ cellStatus.Value = "客户状态"
|
|
|
+
|
|
|
+ cellTc := rowTitle.AddCell()
|
|
|
+ cellTc.Value = "签约套餐"
|
|
|
+
|
|
|
+ for _, item := range list {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = item.RealName
|
|
|
+ //if item.Ly == "1" {
|
|
|
+ // cellAData.SetStyle(redStyle)
|
|
|
+ //}
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = item.Mobile
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ //cellCData.Value = item.CompanyName
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ //cellDData.Value = item.SellerName
|
|
|
+
|
|
|
+ cellStatusData := row.AddCell()
|
|
|
+ cellermissionNameData := row.AddCell()
|
|
|
+ if mapuserMapbil[item.CompanyId] != nil {
|
|
|
+ cellCData.Value = mapuserMapbil[item.CompanyId].CompanyName
|
|
|
+ cellDData.Value = mapuserMapbil[item.CompanyId].SellerName
|
|
|
+ cellStatusData.Value = mapuserMapbil[item.CompanyId].Status
|
|
|
+ cellermissionNameData.Value = mapuserMapbil[item.CompanyId].ChartPermissionName
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|