Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
c250930722 | |||
ed7b95d707 | |||
5bbf97eaf2 | |||
c1978c9ee7 | |||
73f269f847 | |||
60caecc1b9 | |||
a23504c746 | |||
d0cf3bb208 | |||
8d43eaf18d | |||
8e30f6c984 | |||
2d0a24100e | |||
ef50c8626a | |||
db0a50ed33 | |||
b4c173df5f | |||
a6919e8396 | |||
2779dcc5bd | |||
8562d64dd5 | |||
2de0d9dc9b | |||
a357389fac |
1
go.mod
1
go.mod
@ -5,6 +5,7 @@ go 1.18
|
|||||||
replace (
|
replace (
|
||||||
github.com/fonchain_enterprise/utils/aes => ../utils/aes
|
github.com/fonchain_enterprise/utils/aes => ../utils/aes
|
||||||
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
||||||
|
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -32,7 +32,7 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
|||||||
//bundleOrderWebRoute := bundleOrderRoute.Group("web")
|
//bundleOrderWebRoute := bundleOrderRoute.Group("web")
|
||||||
{
|
{
|
||||||
bundleOrderWebRoute.POST("financial-confirm", bundle.UpdateFinancialConfirmationStatus)
|
bundleOrderWebRoute.POST("financial-confirm", bundle.UpdateFinancialConfirmationStatus)
|
||||||
bundleOrderWebRoute.POST("order-export", bundle.ExportOrderInfo)
|
bundleOrderWebRoute.POST("order-export", bundle.ExportOrderInfoOss)
|
||||||
}
|
}
|
||||||
|
|
||||||
bundleOrderAppRoute := bundleOrderRoute.Group("app")
|
bundleOrderAppRoute := bundleOrderRoute.Group("app")
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/common"
|
"fonchain-fiee/pkg/service/bundle/common"
|
||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
|
"fonchain-fiee/pkg/service/upload"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -426,8 +427,93 @@ func ExportOrderInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var exportUrl = strings.Replace(strings.Replace(filePath, ".", fmt.Sprintf("%s://%s", httpType, c.Request.Host), 1), "runtime", "api/static", 1)
|
var exportUrl = strings.Replace(strings.Replace(filePath, ".", fmt.Sprintf("%s://%s", httpType, c.Request.Host), 1), "runtime", "api/fiee/static", 1)
|
||||||
//var exportUrl = fmt.Sprintf("%s%s/%s", httpType, c.Request.Host, dirPath + path)
|
//var exportUrl = fmt.Sprintf("%s%s/%s", httpType, c.Request.Host, dirPath + path)
|
||||||
fmt.Println("exportUrl : ", exportUrl)
|
fmt.Println("exportUrl : ", exportUrl)
|
||||||
service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl})
|
service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExportOrderInfoOss(c *gin.Context) {
|
||||||
|
var req bundle.OrderRecordsRequest
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := service.BundleProvider.OrderRecordsList(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rows := make([][]interface{}, 0)
|
||||||
|
|
||||||
|
for _, orderRecord := range res.OrderRecords {
|
||||||
|
if orderRecord.CustomerID != "" {
|
||||||
|
var userID uint64
|
||||||
|
userID, err = strconv.ParseUint(orderRecord.CustomerID, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
userInfo, _ := service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
|
||||||
|
Domain: "app",
|
||||||
|
ID: userID,
|
||||||
|
})
|
||||||
|
if userInfo != nil {
|
||||||
|
orderRecord.Sex = userInfo.Sex
|
||||||
|
orderRecord.Nationality = userInfo.Nationality
|
||||||
|
orderRecord.TelNum = userInfo.TelNum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status := ""
|
||||||
|
if orderRecord.Status == bundleModel.OrderSigned {
|
||||||
|
status = "未支付"
|
||||||
|
} else if orderRecord.Status == bundleModel.OrderPaid {
|
||||||
|
status = "已支付"
|
||||||
|
}
|
||||||
|
financialConfirmation := ""
|
||||||
|
if orderRecord.FinancialConfirmation == bundleModel.UnConfirm {
|
||||||
|
financialConfirmation = "未确认"
|
||||||
|
} else if orderRecord.FinancialConfirmation == bundleModel.Confirmed {
|
||||||
|
financialConfirmation = "已确认"
|
||||||
|
}
|
||||||
|
|
||||||
|
rows = append(rows, []interface{}{
|
||||||
|
orderRecord.OrderNo,
|
||||||
|
orderRecord.CustomerNum,
|
||||||
|
orderRecord.CustomerName,
|
||||||
|
orderRecord.Sex,
|
||||||
|
orderRecord.TelNum,
|
||||||
|
orderRecord.Nationality,
|
||||||
|
orderRecord.BundleName,
|
||||||
|
orderRecord.SignedTime,
|
||||||
|
orderRecord.Amount,
|
||||||
|
orderRecord.Num,
|
||||||
|
orderRecord.ValueAddBundleAmount,
|
||||||
|
orderRecord.TotalAmount,
|
||||||
|
status,
|
||||||
|
orderRecord.PayTime,
|
||||||
|
financialConfirmation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
dirPath := "./runtime"
|
||||||
|
|
||||||
|
filePath, err := logic.WriteToExcel(dirPath, rows)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
exportUrl, err := upload.PutBos(filePath, "excel", true)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
service.Success(c, &bundleModel.ExportResponse{ExportUrl: exportUrl})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user