zhou.xiaoning 3 年 前
コミット
a6e2373c19
1 ファイル変更7 行追加6 行削除
  1. 7 6
      service/thjNtf.go

+ 7 - 6
service/thjNtf.go

@@ -171,18 +171,18 @@ func onTHJPurchaseTradeNtf(bytes *[]byte) {
 		os.Mkdir("./.tmp", os.ModePerm)
 	}
 	uid, _ := uuid.NewV4()
-	docFilename := fmt.Sprintf("%v_%v.docx", strconv.Itoa(int(thjpurchasetradedetail.WRTRADEDETAILID)), uid.String())
-	pdfFilename := strings.Replace(docFilename, "docx", "pdf", -1)
-	docx1.WriteToFile("./.tmp/" + docFilename)
+	docxFilename := fmt.Sprintf("%v_%v.docx", strconv.Itoa(int(thjpurchasetradedetail.WRTRADEDETAILID)), uid.String())
+	pdfFilename := strings.Replace(docxFilename, "docx", "pdf", -1)
+	docx1.WriteToFile("./.tmp/" + docxFilename)
 	r.Close()
 
 	// 导出pdf到目标目录
-	folderPath := "/Purchase_Contract/" + time.Now().Format("20060102")
-	savePath := global.M2A_CONFIG.System.StorePath + folderPath
+	folderPath := "Purchase_Contract/" + time.Now().Format("20060102")
+	savePath := global.M2A_CONFIG.System.StorePath + "/" + folderPath
 	if exist, _ := utils.PathExists(savePath); !exist {
 		os.MkdirAll(savePath, os.ModePerm)
 	}
-	success := utils.ConvertToPDF("./.tmp/"+docFilename, savePath)
+	success := utils.ConvertToPDF("./.tmp/"+docxFilename, savePath)
 	if !success {
 		// 转换失败
 		global.M2A_LOG.Error("[onTHJPurchaseTradeNtf] docx转换pdf失败", zap.Error(err))
@@ -190,6 +190,7 @@ func onTHJPurchaseTradeNtf(bytes *[]byte) {
 	}
 
 	// 更新数据库
+	// pdfFilename = docxFilename // 临时代码
 	thjpurchasetradedetail.CONTRACTADDRBUY = fmt.Sprintf("./uploadFile/%v/%v", folderPath, pdfFilename)
 	if err = thjpurchasetradedetail.UpdateContractAddrBuy(); err != nil {
 		global.M2A_LOG.Error("[onTHJPurchaseTradeNtf] 更新数据库失败", zap.Error(err))