添加导出功能, 财务确认功能
This commit is contained in:
parent
780a93a746
commit
6340289cf5
File diff suppressed because it is too large
Load Diff
@ -116,3 +116,6 @@ func (this *ValueAddBundleDetailResponse) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *FinancialConfirmationRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v3.21.8
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.10.1
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
@ -38,7 +38,8 @@ type BundleClient interface {
|
||||
UpdateOrderRecordByOrderNo(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
OrderRecordsList(ctx context.Context, in *OrderRecordsRequest, opts ...grpc_go.CallOption) (*OrderRecordsResponse, common.ErrorWithAttachment)
|
||||
OrderRecordsDetail(ctx context.Context, in *OrderRecordsDetailRequest, opts ...grpc_go.CallOption) (*OrderRecordsDetailResponse, common.ErrorWithAttachment)
|
||||
// 增值套餐
|
||||
UpdateFinancialConfirmationStatus(ctx context.Context, in *FinancialConfirmationRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
//增值套餐
|
||||
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
|
||||
@ -49,19 +50,20 @@ type bundleClient struct {
|
||||
}
|
||||
|
||||
type BundleClientImpl struct {
|
||||
CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
|
||||
UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
|
||||
DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error)
|
||||
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecordByOrderNo func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
|
||||
UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
|
||||
DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error)
|
||||
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecordByOrderNo func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||
UpdateFinancialConfirmationStatus func(ctx context.Context, in *FinancialConfirmationRequest) (*CommonResponse, error)
|
||||
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -136,6 +138,12 @@ func (c *bundleClient) OrderRecordsDetail(ctx context.Context, in *OrderRecordsD
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderRecordsDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdateFinancialConfirmationStatus(ctx context.Context, in *FinancialConfirmationRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateFinancialConfirmationStatus", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
||||
out := new(CreateValueAddBundleResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -168,7 +176,8 @@ type BundleServer interface {
|
||||
UpdateOrderRecordByOrderNo(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||
// 增值套餐
|
||||
UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error)
|
||||
//增值套餐
|
||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
@ -210,6 +219,9 @@ func (UnimplementedBundleServer) OrderRecordsList(context.Context, *OrderRecords
|
||||
func (UnimplementedBundleServer) OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OrderRecordsDetail not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdateFinancialConfirmationStatus(context.Context, *FinancialConfirmationRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateFinancialConfirmationStatus not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
||||
}
|
||||
@ -537,6 +549,35 @@ func _Bundle_OrderRecordsDetail_Handler(srv interface{}, ctx context.Context, de
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_UpdateFinancialConfirmationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FinancialConfirmationRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdateFinancialConfirmationStatus", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateValueAddBundleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -671,6 +712,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "OrderRecordsDetail",
|
||||
Handler: _Bundle_OrderRecordsDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateFinancialConfirmationStatus",
|
||||
Handler: _Bundle_UpdateFinancialConfirmationStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateValueAddBundle",
|
||||
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||
|
@ -22,4 +22,7 @@ RedisDBNAme = "1"
|
||||
[ai]
|
||||
Host = "https://erpapi.fontree.cn"
|
||||
TelNum = "18021272627"
|
||||
Password = "Gy.123456"
|
||||
Password = "Gy.123456"
|
||||
|
||||
[service]
|
||||
IsHTTPS = false
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
go.mod
7
go.mod
@ -17,8 +17,9 @@ go 1.18
|
||||
//github.com/fonchain_enterprise/utils/ipAddrQuery => ../utils/ipAddrQuery
|
||||
//github.com/fonchain_enterprise/utils/jwt => ../utils/jwt
|
||||
//github.com/fonchain_enterprise/utils/logger => ../utils/logger
|
||||
//replace github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
||||
replace github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
||||
replace github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
||||
|
||||
//replace github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
||||
|
||||
require (
|
||||
dubbo.apache.org/dubbo-go/v3 v3.0.2
|
||||
@ -123,6 +124,7 @@ require (
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 // indirect
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
||||
github.com/alibaba/sentinel-golang v1.0.4 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
|
||||
@ -160,6 +162,7 @@ require (
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/nxadm/tail v1.4.11 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
|
5
go.sum
5
go.sum
@ -37,6 +37,8 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.1/go.mod h1:t9wvfitlUjGXG2IXAZ
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
dubbo.apache.org/dubbo-go/v3 v3.0.2 h1:+WuMFN6RSjXHT41QS1Xi5tFfaPuczIVoeQuKq7pISYI=
|
||||
dubbo.apache.org/dubbo-go/v3 v3.0.2/go.mod h1:bODgByAf72kzG/5YIfZIODXx81pY3gaAdIQ8B4mN/Yk=
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 h1:l55mJb6rkkaUzOpSsgEeKYtS6/0gHwBYyfo5Jcjv/Ks=
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1/go.mod h1:vnax29X2usfl7HHkBrX5EvSCJcmH3dT9luvxzu8iGAE=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
||||
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
@ -608,6 +610,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
|
||||
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
|
||||
@ -813,6 +817,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
|
||||
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
|
@ -22,6 +22,12 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
||||
bundleOrderClientRoute.POST("bundle-order-list", bundle.OrderRecordsList)
|
||||
}
|
||||
|
||||
bundleOrderWebRoute := bundleOrderRoute.Group("web")
|
||||
{
|
||||
bundleOrderWebRoute.POST("financial-confirm", bundle.UpdateFinancialConfirmationStatus)
|
||||
bundleOrderWebRoute.POST("order-export", bundle.ExportOrderInfo)
|
||||
}
|
||||
|
||||
bundleOrderAppRoute := bundleOrderRoute.Group("app")
|
||||
{
|
||||
bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature)
|
||||
|
@ -3,9 +3,13 @@ package bundle
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/api/account"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/api/order"
|
||||
"fonchain-fiee/pkg/config"
|
||||
"fonchain-fiee/pkg/e"
|
||||
"fonchain-fiee/pkg/model"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
@ -13,6 +17,7 @@ import (
|
||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
@ -267,6 +272,7 @@ func OrderRecordsList(c *gin.Context) {
|
||||
orderRecord.CertificatePicture = userInfo.CertificatePicture
|
||||
orderRecord.PlaceOfResidence = userInfo.PlaceOfResidence
|
||||
orderRecord.GroupPhoto = userInfo.GroupPhoto
|
||||
orderRecord.TelNum = userInfo.TelNum
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,3 +302,112 @@ func OrderRecordsDetail(c *gin.Context) {
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
||||
// web
|
||||
func UpdateFinancialConfirmationStatus(c *gin.Context) {
|
||||
var req bundle.FinancialConfirmationRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.UpdateFinancialConfirmationStatus(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
||||
func ExportOrderInfo(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{}, len(res.OrderRecords))
|
||||
|
||||
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.AccountProvider.Info(context.Background(), &account.InfoRequest{
|
||||
Domain: "app",
|
||||
ID: userID,
|
||||
})
|
||||
if userInfo != nil {
|
||||
orderRecord.Sex = userInfo.Sex
|
||||
orderRecord.Nationality = userInfo.Nationality
|
||||
orderRecord.TelNum = userInfo.TelNum
|
||||
}
|
||||
}
|
||||
|
||||
status := ""
|
||||
if orderRecord.Status == 1 {
|
||||
status = "未支付"
|
||||
} else if orderRecord.Status == 2 {
|
||||
status = "已支付"
|
||||
}
|
||||
financialConfirmation := ""
|
||||
if orderRecord.FinancialConfirmation == 1 {
|
||||
financialConfirmation = "未确认"
|
||||
} else if orderRecord.FinancialConfirmation == 2 {
|
||||
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
|
||||
}
|
||||
|
||||
var httpType string
|
||||
if config.IsHttps {
|
||||
httpType = model.HttpsType
|
||||
} else {
|
||||
httpType = model.HttpType
|
||||
}
|
||||
|
||||
var exportUrl = strings.Replace(strings.Replace(filePath, ".", fmt.Sprintf("%s%s", httpType, c.Request.Host), 1), "runtime", "static", 1)
|
||||
//var exportUrl = fmt.Sprintf("%s%s/%s", httpType, c.Request.Host, dirPath + path)
|
||||
|
||||
service.Success(c, e.Ok, map[string]string{
|
||||
"ExportUrl": exportUrl,
|
||||
})
|
||||
}
|
||||
|
@ -21,6 +21,10 @@ const (
|
||||
InvalidValueAddBundleNum = "套餐数量无效"
|
||||
)
|
||||
|
||||
const (
|
||||
ErrorExportOrderInfo = "导出订单信息失败"
|
||||
)
|
||||
|
||||
// stripe
|
||||
const (
|
||||
ErrorQueryStripeInfo = "查询支付信息失败"
|
||||
|
44
pkg/service/bundle/logic/export.go
Normal file
44
pkg/service/bundle/logic/export.go
Normal file
@ -0,0 +1,44 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
"time"
|
||||
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
)
|
||||
|
||||
func WriteToExcel(dirPath string, orderInfos [][]interface{}) (string, error) {
|
||||
headRow := []interface{}{"订单编号", "用户编号", "姓名", "性别", "手机号", "国籍", "套餐名称", "签署时间", "套餐费用", "增值服务视频条数", "增值金额", "总额", "支付状态", "支付时间", "财务确认状态"}
|
||||
|
||||
xlsx := excelize.NewFile()
|
||||
index := "Sheet1"
|
||||
|
||||
xlsx.MergeCell("Sheet1", "A1", "H1")
|
||||
|
||||
style, _ := xlsx.NewStyle(`{"alignment":{
|
||||
"horizontal":"center"
|
||||
}}`)
|
||||
|
||||
xlsx.SetCellStyle(index, "A1", "A1", style)
|
||||
|
||||
xlsx.SetSheetRow(index, "A1", &[]interface{}{headRow})
|
||||
|
||||
rowIndex := 3
|
||||
for i := 0; i < len(orderInfos); i++ {
|
||||
xlsx.SetCellStyle(index, fmt.Sprintf("A%v", rowIndex), fmt.Sprintf("M%v", rowIndex), style)
|
||||
xlsx.SetSheetRow(index, fmt.Sprintf("A%v", rowIndex), &orderInfos[i])
|
||||
rowIndex++
|
||||
}
|
||||
|
||||
//path := dirPath + "/" + artShowInfo.ArtistName + "-" + artShowInfo.ShowSeq + "-price" + ".xlsx"
|
||||
path := dirPath + "/套餐订单信息" + time.Now().Format("20060102150405") + ".xlsx"
|
||||
err := xlsx.SaveAs(path)
|
||||
if err != nil {
|
||||
fmt.Println("save rows err :", err)
|
||||
return "", errors.New(common.ErrorExportOrderInfo)
|
||||
}
|
||||
|
||||
return path, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user