|
@@ -51,7 +51,7 @@ func (a *ExportReq) AllProjectExport() {
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
pathArr := export("customer_data_ttzl_project", tableColumn, exportKey, timeStr)
|
|
pathArr := export("customer_data_ttzl_project", tableColumn, exportKey, timeStr)
|
|
if len(pathArr) > 0 {
|
|
if len(pathArr) > 0 {
|
|
- pathstr := compressFiles(pathArr, timeStr)
|
|
|
|
|
|
+ pathstr := compressFiles(pathArr, ExportUrl, timeStr)
|
|
state := sendMail("项目", a.Mail, pathstr)
|
|
state := sendMail("项目", a.Mail, pathstr)
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
"positionId": a.PositionId,
|
|
"positionId": a.PositionId,
|
|
@@ -79,7 +79,7 @@ func (a *ExportReq) AllInfoExport() {
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
pathArr := export("customer_data_ttzl", tableColumn, exportKey, timeStr)
|
|
pathArr := export("customer_data_ttzl", tableColumn, exportKey, timeStr)
|
|
if len(pathArr) > 0 {
|
|
if len(pathArr) > 0 {
|
|
- pathstr := compressFiles(pathArr, timeStr)
|
|
|
|
|
|
+ pathstr := compressFiles(pathArr, ExportUrl, timeStr)
|
|
state := sendMail("标讯", a.Mail, pathstr)
|
|
state := sendMail("标讯", a.Mail, pathstr)
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
"positionId": a.PositionId,
|
|
"positionId": a.PositionId,
|
|
@@ -135,7 +135,7 @@ func dataHandle(writer *excelize.StreamWriter, l *[]map[string]interface{}, a in
|
|
func Warehousing(writer *excelize.StreamWriter, file *excelize.File, fileCounter int, key []interface{}, timeStr string) (*excelize.StreamWriter, *excelize.File, string) {
|
|
func Warehousing(writer *excelize.StreamWriter, file *excelize.File, fileCounter int, key []interface{}, timeStr string) (*excelize.StreamWriter, *excelize.File, string) {
|
|
log.Println(fmt.Sprintf("开始第%d数据", fileCounter))
|
|
log.Println(fmt.Sprintf("开始第%d数据", fileCounter))
|
|
writer.Flush()
|
|
writer.Flush()
|
|
- folderPath := fmt.Sprintf("%s/%s", ExportDirectory, timeStr)
|
|
|
|
|
|
+ folderPath := fmt.Sprintf("%s/%s", ComFileDir, timeStr)
|
|
_, err := os.Stat(folderPath)
|
|
_, err := os.Stat(folderPath)
|
|
if os.IsNotExist(err) {
|
|
if os.IsNotExist(err) {
|
|
//创建文件夹
|
|
//创建文件夹
|
|
@@ -188,8 +188,8 @@ func sendMail(title, target_mail string, path string) bool {
|
|
}
|
|
}
|
|
|
|
|
|
// 文件压缩
|
|
// 文件压缩
|
|
-func compressFiles(filePattern []string, timeStr string) string {
|
|
|
|
- folderPath := fmt.Sprintf("%s/%s", ExportDirectory, timeStr)
|
|
|
|
|
|
+func compressFiles(filePattern []string, url, timeStr string) string {
|
|
|
|
+ folderPath := fmt.Sprintf("%s/%s", ComFileDir, timeStr)
|
|
_, err := os.Stat(folderPath)
|
|
_, err := os.Stat(folderPath)
|
|
if os.IsNotExist(err) {
|
|
if os.IsNotExist(err) {
|
|
//创建文件夹
|
|
//创建文件夹
|
|
@@ -244,7 +244,7 @@ func compressFiles(filePattern []string, timeStr string) string {
|
|
log.Fatal(err)
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
log.Printf("Files compressed to: %s", absPath)
|
|
log.Printf("Files compressed to: %s", absPath)
|
|
- return fmt.Sprintf("%s/%s/%s.zip", ExportUrl, timeStr, timeStr)
|
|
|
|
|
|
+ return fmt.Sprintf("%s/%s/%s.zip", url, timeStr, timeStr)
|
|
}
|
|
}
|
|
|
|
|
|
// 数据导出(通用)
|
|
// 数据导出(通用)
|
|
@@ -255,14 +255,15 @@ func (e *ExportByDbReq) ExportDataByDb() []byte {
|
|
rand.Seed(time.Now().UnixNano())
|
|
rand.Seed(time.Now().UnixNano())
|
|
randomInt := rand.Intn(10000) // 生成0到9999之间的随机整数
|
|
randomInt := rand.Intn(10000) // 生成0到9999之间的随机整数
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
|
|
- pathArr := exportA(e.Query, timeStr, key)
|
|
|
|
|
|
+ stype := e.Stype
|
|
|
|
+ if stype == "" {
|
|
|
|
+ stype = "public"
|
|
|
|
+ }
|
|
|
|
+ pathArr := exportA(e.Query, stype, key)
|
|
if len(pathArr) > 0 {
|
|
if len(pathArr) > 0 {
|
|
- pathstr := compressFiles(pathArr, timeStr)
|
|
|
|
|
|
+ pathstr := compressFiles(pathArr, ComFileUrl, stype)
|
|
state := sendMailA(e.Title, e.Mails, e.Content, pathstr)
|
|
state := sendMailA(e.Title, e.Mails, e.Content, pathstr)
|
|
- stype := e.Stype
|
|
|
|
- if stype == "" {
|
|
|
|
- stype = "public"
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
BiService.Insert("export_record", map[string]interface{}{
|
|
"positionId": "0",
|
|
"positionId": "0",
|
|
"type": stype,
|
|
"type": stype,
|