|
@@ -4067,7 +4067,7 @@ func initAct22() {
|
|
|
}
|
|
|
|
|
|
//func init() {
|
|
|
-// initLuyan()
|
|
|
+// initQuanyi()
|
|
|
//}
|
|
|
|
|
|
func initLuyan() {
|
|
@@ -4234,3 +4234,90 @@ func initLuyan() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func initQuanyi() {
|
|
|
+
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition = ` AND product_id = 2 AND industry_id > 0 GROUP BY industry_id `
|
|
|
+ productList, err := company.GetCompanyProductList(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ condition = ` AND product_id = 2 AND industry_id > 0 `
|
|
|
+ productListData, err := company.GetCompanyProductList(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //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
|
|
|
+
|
|
|
+ for _, v := range productList {
|
|
|
+ var sheetName string
|
|
|
+
|
|
|
+ sheetName = v.IndustryName
|
|
|
+ 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 = "状态"
|
|
|
+ cellCSeller := rowTitle.AddCell()
|
|
|
+ cellCSeller.Value = "销售"
|
|
|
+
|
|
|
+ for _, vE := range productListData {
|
|
|
+ if vE.IndustryId != v.IndustryId {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellAData := row.AddCell()
|
|
|
+ cellAData.Value = vE.CompanyName
|
|
|
+
|
|
|
+ cellBData := row.AddCell()
|
|
|
+ cellBData.Value = vE.IndustryName
|
|
|
+
|
|
|
+ cellCData := row.AddCell()
|
|
|
+ cellCData.Value = vE.Status
|
|
|
+
|
|
|
+ cellDData := row.AddCell()
|
|
|
+ cellDData.Value = vE.SellerName
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+
|
|
|
+}
|