修改配置
This commit is contained in:
parent
cfc57aecba
commit
675e1b1aba
@ -21,7 +21,7 @@ func main() {
|
|||||||
config.SetProviderService(&controller.ArtistInfoArtworkProvider{})
|
config.SetProviderService(&controller.ArtistInfoArtworkProvider{})
|
||||||
config.SetProviderService(&controller.ArtistInfoArtshowProvider{})
|
config.SetProviderService(&controller.ArtistInfoArtshowProvider{})
|
||||||
config.SetProviderService(&controller.ArtistInfoContractProvider{})
|
config.SetProviderService(&controller.ArtistInfoContractProvider{})
|
||||||
config.SetConsumerService(&controller.StatementServerProvider{})
|
// config.SetConsumerService(&controller.StatementServerProvider{})
|
||||||
db.Init(m.SERVER_CONFIG)
|
db.Init(m.SERVER_CONFIG)
|
||||||
cache.InitRedis(m.SERVER_CONFIG)
|
cache.InitRedis(m.SERVER_CONFIG)
|
||||||
if err := config.Load(); err != nil {
|
if err := config.Load(); err != nil {
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
// import (
|
||||||
"context"
|
// "context"
|
||||||
|
|
||||||
"github.com/fonchain/fonchain-artistinfo/cmd/internal/logic"
|
// "github.com/fonchain/fonchain-artistinfo/cmd/internal/logic"
|
||||||
"github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
// emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
)
|
// )
|
||||||
|
|
||||||
//go:generate mockgen -destination .\artistinfoStatement_triple.pb.go -package controller -source ..\..\..\pb\artistinfoStatement\artistinfoStatement_triple.pb.go StatementServer
|
// //go:generate mockgen -destination .\artistinfoStatement_triple.pb.go -package controller -source ..\..\..\pb\artistinfoStatement\artistinfoStatement_triple.pb.go StatementServer
|
||||||
|
|
||||||
type StatementServerProvider struct {
|
// type StatementServerProvider struct {
|
||||||
artistinfoStatement.UnimplementedStatementServer
|
// artistinfoStatement.UnimplementedStatementServer
|
||||||
logic logic.StatementServerLogic
|
// logic logic.StatementServerLogic
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) CreateStatementBatch(ctx context.Context, in *artistinfoStatement.StatementBatchRequest) (res *artistinfoStatement.CreateStatementBatchResponse, err error) {
|
// func (s *StatementServerProvider) CreateStatementBatch(ctx context.Context, in *artistinfoStatement.StatementBatchRequest) (res *artistinfoStatement.CreateStatementBatchResponse, err error) {
|
||||||
return s.logic.CreateStatementBatch(in)
|
// return s.logic.CreateStatementBatch(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) BatchCreateStatementBatch(ctx context.Context, in *artistinfoStatement.BatchCreateStatementBatchRequest) (*emptypb.Empty, error) {
|
// func (s *StatementServerProvider) BatchCreateStatementBatch(ctx context.Context, in *artistinfoStatement.BatchCreateStatementBatchRequest) (*emptypb.Empty, error) {
|
||||||
return s.logic.BatchCreateStatementBatch(in)
|
// return s.logic.BatchCreateStatementBatch(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) GetStatementBatchList(ctx context.Context, in *artistinfoStatement.GetStatementBatchListRequest) (*artistinfoStatement.GetStatementBatchListResponse, error) {
|
// func (s *StatementServerProvider) GetStatementBatchList(ctx context.Context, in *artistinfoStatement.GetStatementBatchListRequest) (*artistinfoStatement.GetStatementBatchListResponse, error) {
|
||||||
return s.logic.GetStatementBatchList(in)
|
// return s.logic.GetStatementBatchList(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) CreateStatementDetail(ctx context.Context, in *artistinfoStatement.StatementDetailRequest) (*artistinfoStatement.CreateStatementDetailResponse, error) {
|
// func (s *StatementServerProvider) CreateStatementDetail(ctx context.Context, in *artistinfoStatement.StatementDetailRequest) (*artistinfoStatement.CreateStatementDetailResponse, error) {
|
||||||
return s.logic.CreateStatementDetail(in)
|
// return s.logic.CreateStatementDetail(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) BatchCreateStatementDetail(ctx context.Context, in *artistinfoStatement.BatchCreateStatementDetailRequest) (*emptypb.Empty, error) {
|
// func (s *StatementServerProvider) BatchCreateStatementDetail(ctx context.Context, in *artistinfoStatement.BatchCreateStatementDetailRequest) (*emptypb.Empty, error) {
|
||||||
return s.logic.BatchCreateStatementDetail(in)
|
// return s.logic.BatchCreateStatementDetail(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) GetStatementDetailList(ctx context.Context, in *artistinfoStatement.GetStatementDetailListRequest) (*artistinfoStatement.GetStatementDetailListResponse, error) {
|
// func (s *StatementServerProvider) GetStatementDetailList(ctx context.Context, in *artistinfoStatement.GetStatementDetailListRequest) (*artistinfoStatement.GetStatementDetailListResponse, error) {
|
||||||
return s.logic.GetStatementDetailList(in)
|
// return s.logic.GetStatementDetailList(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerProvider) GetStatementBatchTimeMenus(ctx context.Context, in *artistinfoStatement.GetStatementBatchListRequest) (*artistinfoStatement.GetStatementBatchTimeMenusResponse, error) {
|
// func (s *StatementServerProvider) GetStatementBatchTimeMenus(ctx context.Context, in *artistinfoStatement.GetStatementBatchListRequest) (*artistinfoStatement.GetStatementBatchTimeMenusResponse, error) {
|
||||||
return s.logic.GetStatementBatchTimeMenus(in)
|
// return s.logic.GetStatementBatchTimeMenus(in)
|
||||||
}
|
// }
|
||||||
|
@ -1,162 +1,162 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
// import (
|
||||||
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
// "github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||||
"github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
||||||
db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
// db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
||||||
"gorm.io/gorm/clause"
|
// "gorm.io/gorm/clause"
|
||||||
)
|
// )
|
||||||
|
|
||||||
// =====================================
|
|
||||||
//
|
//
|
||||||
// 对账单批次
|
// // =====================================
|
||||||
func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) {
|
// //
|
||||||
res = model.StatementBatch{
|
// // 对账单批次
|
||||||
StType: in.StType,
|
// func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) {
|
||||||
ArtistUid: in.ArtistUid,
|
// res = model.StatementBatch{
|
||||||
ArtistRealName: in.ArtistRealName,
|
// StType: in.StType,
|
||||||
FlowStatus: in.FlowStatus,
|
// ArtistUid: in.ArtistUid,
|
||||||
BatchTime: in.BatchTime,
|
// ArtistRealName: in.ArtistRealName,
|
||||||
MinPrice: in.MinPrice,
|
// FlowStatus: in.FlowStatus,
|
||||||
GuaranteePrice: in.GuaranteePrice,
|
// BatchTime: in.BatchTime,
|
||||||
FileUrl: in.FileUrl,
|
// MinPrice: in.MinPrice,
|
||||||
}
|
// GuaranteePrice: in.GuaranteePrice,
|
||||||
err = db.DB.Clauses(clause.OnConflict{
|
// FileUrl: in.FileUrl,
|
||||||
Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
// }
|
||||||
UpdateAll: true,
|
// err = db.DB.Clauses(clause.OnConflict{
|
||||||
}).Create(&res).Error
|
// Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
||||||
return
|
// UpdateAll: true,
|
||||||
}
|
// }).Create(&res).Error
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
func BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) error {
|
// func BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) error {
|
||||||
var datas = []model.StatementBatch{}
|
// var datas = []model.StatementBatch{}
|
||||||
for _, in := range in.Data {
|
// for _, in := range in.Data {
|
||||||
datas = append(datas, model.StatementBatch{
|
// datas = append(datas, model.StatementBatch{
|
||||||
StType: in.StType,
|
// StType: in.StType,
|
||||||
ArtistUid: in.ArtistUid,
|
// ArtistUid: in.ArtistUid,
|
||||||
ArtistRealName: in.ArtistRealName,
|
// ArtistRealName: in.ArtistRealName,
|
||||||
FlowStatus: in.FlowStatus,
|
// FlowStatus: in.FlowStatus,
|
||||||
BatchTime: in.BatchTime,
|
// BatchTime: in.BatchTime,
|
||||||
MinPrice: in.MinPrice,
|
// MinPrice: in.MinPrice,
|
||||||
GuaranteePrice: in.GuaranteePrice,
|
// GuaranteePrice: in.GuaranteePrice,
|
||||||
FileUrl: in.FileUrl,
|
// FileUrl: in.FileUrl,
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
err := db.DB.Clauses(clause.OnConflict{
|
// err := db.DB.Clauses(clause.OnConflict{
|
||||||
Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
// Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
||||||
UpdateAll: true,
|
// UpdateAll: true,
|
||||||
}).Create(&datas).Error
|
// }).Create(&datas).Error
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
|
|
||||||
func GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res []model.StatementBatch, total int64, err error) {
|
// func GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res []model.StatementBatch, total int64, err error) {
|
||||||
res = []model.StatementBatch{}
|
// res = []model.StatementBatch{}
|
||||||
var orm = db.DB.Model(model.StatementBatch{}).Order("created_at desc").Preload("ArtworkList")
|
// var orm = db.DB.Model(model.StatementBatch{}).Order("created_at desc").Preload("ArtworkList")
|
||||||
if in.Condition.StType != 0 {
|
// if in.Condition.StType != 0 {
|
||||||
orm = orm.Where("st_type = ?", in.Condition.StType)
|
// orm = orm.Where("st_type = ?", in.Condition.StType)
|
||||||
}
|
// }
|
||||||
if in.Condition.ArtistUid != "" {
|
// if in.Condition.ArtistUid != "" {
|
||||||
orm = orm.Where("artist_uid = ?", in.Condition.ArtistUid)
|
// orm = orm.Where("artist_uid = ?", in.Condition.ArtistUid)
|
||||||
}
|
// }
|
||||||
if in.Condition.ArtistRealName != "" {
|
// if in.Condition.ArtistRealName != "" {
|
||||||
orm = orm.Where("artist_real_name = ?", in.Condition.ArtistRealName)
|
// orm = orm.Where("artist_real_name = ?", in.Condition.ArtistRealName)
|
||||||
}
|
// }
|
||||||
if in.Condition.FlowStatus != 0 {
|
// if in.Condition.FlowStatus != 0 {
|
||||||
orm = orm.Where("flow_status = ?", in.Condition.FlowStatus)
|
// orm = orm.Where("flow_status = ?", in.Condition.FlowStatus)
|
||||||
}
|
// }
|
||||||
if in.Condition.BatchTime != "" {
|
// if in.Condition.BatchTime != "" {
|
||||||
orm = orm.Where("batch_time = ?", in.Condition.BatchTime)
|
// orm = orm.Where("batch_time = ?", in.Condition.BatchTime)
|
||||||
}
|
// }
|
||||||
if in.Condition.MinPrice != 0 {
|
// if in.Condition.MinPrice != 0 {
|
||||||
orm = orm.Where("min_price = ?", in.Condition.MinPrice)
|
// orm = orm.Where("min_price = ?", in.Condition.MinPrice)
|
||||||
}
|
// }
|
||||||
if in.Condition.GuaranteePrice != 0 {
|
// if in.Condition.GuaranteePrice != 0 {
|
||||||
orm = orm.Where("guarantee_price = ?", in.Condition.GuaranteePrice)
|
// orm = orm.Where("guarantee_price = ?", in.Condition.GuaranteePrice)
|
||||||
}
|
// }
|
||||||
if in.Condition.Id != 0 {
|
// if in.Condition.Id != 0 {
|
||||||
orm = orm.Where("id = ?", in.Condition.Id)
|
// orm = orm.Where("id = ?", in.Condition.Id)
|
||||||
}
|
// }
|
||||||
if in.Condition.FileUrl != "" {
|
// if in.Condition.FileUrl != "" {
|
||||||
orm = orm.Where("file_url = ?", in.Condition.FileUrl)
|
// orm = orm.Where("file_url = ?", in.Condition.FileUrl)
|
||||||
}
|
// }
|
||||||
if len(in.Ids) > 0 {
|
// if len(in.Ids) > 0 {
|
||||||
orm = orm.Where("id in ?", in.Ids)
|
// orm = orm.Where("id in ?", in.Ids)
|
||||||
}
|
// }
|
||||||
if len(in.BatchTimeList) > 0 {
|
// if len(in.BatchTimeList) > 0 {
|
||||||
orm = orm.Where("batch_time in ?", in.BatchTimeList)
|
// orm = orm.Where("batch_time in ?", in.BatchTimeList)
|
||||||
}
|
// }
|
||||||
err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
// err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res []string, err error) {
|
// func GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res []string, err error) {
|
||||||
res = []string{}
|
// res = []string{}
|
||||||
err = db.DB.Model(model.StatementBatch{}).Pluck("batch_time", &res).Error
|
// err = db.DB.Model(model.StatementBatch{}).Pluck("batch_time", &res).Error
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
//=====================================
|
// //=====================================
|
||||||
// 对账单详情
|
// // 对账单详情
|
||||||
|
|
||||||
func CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res model.StatementDetail, err error) {
|
// func CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res model.StatementDetail, err error) {
|
||||||
res = model.StatementDetail{
|
// res = model.StatementDetail{
|
||||||
BatchId: in.BatchId,
|
// BatchId: in.BatchId,
|
||||||
TfNum: in.TfNum,
|
// TfNum: in.TfNum,
|
||||||
ArtworkName: in.ArtworkName,
|
// ArtworkName: in.ArtworkName,
|
||||||
Ruler: in.Ruler,
|
// Ruler: in.Ruler,
|
||||||
SaleNo: in.SaleNo,
|
// SaleNo: in.SaleNo,
|
||||||
CompleteDate: in.CompleteDate,
|
// CompleteDate: in.CompleteDate,
|
||||||
}
|
// }
|
||||||
err = db.DB.Clauses(clause.OnConflict{
|
// err = db.DB.Clauses(clause.OnConflict{
|
||||||
Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
// Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
||||||
UpdateAll: true,
|
// UpdateAll: true,
|
||||||
}).Create(&res).Error
|
// }).Create(&res).Error
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) error {
|
// func BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) error {
|
||||||
var datas = []model.StatementDetail{}
|
// var datas = []model.StatementDetail{}
|
||||||
for _, in := range in.Data {
|
// for _, in := range in.Data {
|
||||||
datas = append(datas, model.StatementDetail{
|
// datas = append(datas, model.StatementDetail{
|
||||||
BatchId: in.BatchId,
|
// BatchId: in.BatchId,
|
||||||
TfNum: in.TfNum,
|
// TfNum: in.TfNum,
|
||||||
ArtworkName: in.ArtworkName,
|
// ArtworkName: in.ArtworkName,
|
||||||
Ruler: in.Ruler,
|
// Ruler: in.Ruler,
|
||||||
SaleNo: in.SaleNo,
|
// SaleNo: in.SaleNo,
|
||||||
CompleteDate: in.CompleteDate,
|
// CompleteDate: in.CompleteDate,
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
err := db.DB.Clauses(clause.OnConflict{
|
// err := db.DB.Clauses(clause.OnConflict{
|
||||||
Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
// Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
||||||
UpdateAll: true,
|
// UpdateAll: true,
|
||||||
}).Create(&datas).Error
|
// }).Create(&datas).Error
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
|
|
||||||
func GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res []model.StatementDetail, total int64, err error) {
|
// func GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res []model.StatementDetail, total int64, err error) {
|
||||||
res = []model.StatementDetail{}
|
// res = []model.StatementDetail{}
|
||||||
var orm = db.DB.Model(model.StatementDetail{}).Order("created_at desc")
|
// var orm = db.DB.Model(model.StatementDetail{}).Order("created_at desc")
|
||||||
if in.Condition.BatchId != 0 {
|
// if in.Condition.BatchId != 0 {
|
||||||
orm = orm.Where("batch_id = ?", in.Condition.BatchId)
|
// orm = orm.Where("batch_id = ?", in.Condition.BatchId)
|
||||||
}
|
// }
|
||||||
if in.Condition.TfNum != "" {
|
// if in.Condition.TfNum != "" {
|
||||||
orm = orm.Where("tf_num = ?", in.Condition.TfNum)
|
// orm = orm.Where("tf_num = ?", in.Condition.TfNum)
|
||||||
}
|
// }
|
||||||
if in.Condition.ArtworkName != "" {
|
// if in.Condition.ArtworkName != "" {
|
||||||
orm = orm.Where("artwork_name like = ?", "%"+in.Condition.ArtworkName+"%")
|
// orm = orm.Where("artwork_name like = ?", "%"+in.Condition.ArtworkName+"%")
|
||||||
}
|
// }
|
||||||
if in.Condition.Ruler != "" {
|
// if in.Condition.Ruler != "" {
|
||||||
orm = orm.Where("ruler = ?", in.Condition.Ruler)
|
// orm = orm.Where("ruler = ?", in.Condition.Ruler)
|
||||||
}
|
// }
|
||||||
if in.Condition.SaleNo != "" {
|
// if in.Condition.SaleNo != "" {
|
||||||
orm = orm.Where("sale_no = ?", in.Condition.SaleNo)
|
// orm = orm.Where("sale_no = ?", in.Condition.SaleNo)
|
||||||
}
|
// }
|
||||||
if in.Condition.CompleteDate != "" {
|
// if in.Condition.CompleteDate != "" {
|
||||||
orm = orm.Where("complete_date = ?", in.Condition.CompleteDate)
|
// orm = orm.Where("complete_date = ?", in.Condition.CompleteDate)
|
||||||
}
|
// }
|
||||||
if in.Condition.Id != 0 {
|
// if in.Condition.Id != 0 {
|
||||||
orm = orm.Where("id = ?", in.Condition.Id)
|
// orm = orm.Where("id = ?", in.Condition.Id)
|
||||||
}
|
// }
|
||||||
err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
// err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
@ -1,95 +1,95 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
// import (
|
||||||
"github.com/fonchain/fonchain-artistinfo/cmd/internal/dao"
|
// "github.com/fonchain/fonchain-artistinfo/cmd/internal/dao"
|
||||||
"github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
||||||
"github.com/fonchain/fonchain-artistinfo/pkg/util/stime"
|
// "github.com/fonchain/fonchain-artistinfo/pkg/util/stime"
|
||||||
"google.golang.org/protobuf/types/known/emptypb"
|
// "google.golang.org/protobuf/types/known/emptypb"
|
||||||
)
|
// )
|
||||||
|
|
||||||
type StatementServerLogic struct{}
|
// type StatementServerLogic struct{}
|
||||||
|
|
||||||
func (s *StatementServerLogic) CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res *artistinfoStatement.CreateStatementBatchResponse, err error) {
|
// func (s *StatementServerLogic) CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res *artistinfoStatement.CreateStatementBatchResponse, err error) {
|
||||||
res = &artistinfoStatement.CreateStatementBatchResponse{}
|
// res = &artistinfoStatement.CreateStatementBatchResponse{}
|
||||||
data, err := dao.CreateStatementBatch(in)
|
// data, err := dao.CreateStatementBatch(in)
|
||||||
res.Id = data.ID
|
// res.Id = data.ID
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) (*emptypb.Empty, error) {
|
// func (s *StatementServerLogic) BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) (*emptypb.Empty, error) {
|
||||||
return nil, dao.BatchCreateStatementBatch(in)
|
// return nil, dao.BatchCreateStatementBatch(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchListResponse, err error) {
|
// func (s *StatementServerLogic) GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchListResponse, err error) {
|
||||||
datas, total, err := dao.GetStatementBatchList(in)
|
// datas, total, err := dao.GetStatementBatchList(in)
|
||||||
|
|
||||||
res = &artistinfoStatement.GetStatementBatchListResponse{
|
// res = &artistinfoStatement.GetStatementBatchListResponse{
|
||||||
Page: &artistinfoStatement.StatementPageInfo{
|
// Page: &artistinfoStatement.StatementPageInfo{
|
||||||
Page: in.Page,
|
// Page: in.Page,
|
||||||
PageSize: in.PageSize,
|
// PageSize: in.PageSize,
|
||||||
Total: total,
|
// Total: total,
|
||||||
},
|
// },
|
||||||
Data: []*artistinfoStatement.StatementBatchRequest{},
|
// Data: []*artistinfoStatement.StatementBatchRequest{},
|
||||||
}
|
// }
|
||||||
for _, v := range datas {
|
// for _, v := range datas {
|
||||||
res.Data = append(res.Data, &artistinfoStatement.StatementBatchRequest{
|
// res.Data = append(res.Data, &artistinfoStatement.StatementBatchRequest{
|
||||||
StType: v.StType,
|
// StType: v.StType,
|
||||||
ArtistUid: v.ArtistUid,
|
// ArtistUid: v.ArtistUid,
|
||||||
ArtistRealName: v.ArtistRealName,
|
// ArtistRealName: v.ArtistRealName,
|
||||||
FlowStatus: v.FlowStatus,
|
// FlowStatus: v.FlowStatus,
|
||||||
BatchTime: v.BatchTime,
|
// BatchTime: v.BatchTime,
|
||||||
MinPrice: v.MinPrice,
|
// MinPrice: v.MinPrice,
|
||||||
GuaranteePrice: v.GuaranteePrice,
|
// GuaranteePrice: v.GuaranteePrice,
|
||||||
Id: v.ID,
|
// Id: v.ID,
|
||||||
CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms),
|
// CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms),
|
||||||
UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms),
|
// UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms),
|
||||||
DeletedAt: int64(v.DeletedAt),
|
// DeletedAt: int64(v.DeletedAt),
|
||||||
FileUrl: v.FileUrl,
|
// FileUrl: v.FileUrl,
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res *artistinfoStatement.CreateStatementDetailResponse, err error) {
|
// func (s *StatementServerLogic) CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res *artistinfoStatement.CreateStatementDetailResponse, err error) {
|
||||||
res = &artistinfoStatement.CreateStatementDetailResponse{}
|
// res = &artistinfoStatement.CreateStatementDetailResponse{}
|
||||||
data, err := dao.CreateStatementDetail(in)
|
// data, err := dao.CreateStatementDetail(in)
|
||||||
res.Id = data.ID
|
// res.Id = data.ID
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) (*emptypb.Empty, error) {
|
// func (s *StatementServerLogic) BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) (*emptypb.Empty, error) {
|
||||||
return nil, dao.BatchCreateStatementDetail(in)
|
// return nil, dao.BatchCreateStatementDetail(in)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res *artistinfoStatement.GetStatementDetailListResponse, err error) {
|
// func (s *StatementServerLogic) GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res *artistinfoStatement.GetStatementDetailListResponse, err error) {
|
||||||
datas, total, err := dao.GetStatementDetailList(in)
|
// datas, total, err := dao.GetStatementDetailList(in)
|
||||||
res = &artistinfoStatement.GetStatementDetailListResponse{
|
// res = &artistinfoStatement.GetStatementDetailListResponse{
|
||||||
Data: []*artistinfoStatement.StatementDetailRequest{},
|
// Data: []*artistinfoStatement.StatementDetailRequest{},
|
||||||
Page: &artistinfoStatement.StatementPageInfo{
|
// Page: &artistinfoStatement.StatementPageInfo{
|
||||||
Page: in.Page,
|
// Page: in.Page,
|
||||||
PageSize: in.PageSize,
|
// PageSize: in.PageSize,
|
||||||
Total: total,
|
// Total: total,
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
for _, v := range datas {
|
// for _, v := range datas {
|
||||||
res.Data = append(res.Data, &artistinfoStatement.StatementDetailRequest{
|
// res.Data = append(res.Data, &artistinfoStatement.StatementDetailRequest{
|
||||||
BatchId: v.BatchId,
|
// BatchId: v.BatchId,
|
||||||
TfNum: v.TfNum,
|
// TfNum: v.TfNum,
|
||||||
ArtworkName: v.ArtworkName,
|
// ArtworkName: v.ArtworkName,
|
||||||
Ruler: v.Ruler,
|
// Ruler: v.Ruler,
|
||||||
SaleNo: v.SaleNo,
|
// SaleNo: v.SaleNo,
|
||||||
CompleteDate: v.CompleteDate,
|
// CompleteDate: v.CompleteDate,
|
||||||
Id: v.ID,
|
// Id: v.ID,
|
||||||
CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms),
|
// CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms),
|
||||||
UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms),
|
// UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms),
|
||||||
DeletedAt: int64(v.DeletedAt),
|
// DeletedAt: int64(v.DeletedAt),
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (s *StatementServerLogic) GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchTimeMenusResponse, err error) {
|
// func (s *StatementServerLogic) GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchTimeMenusResponse, err error) {
|
||||||
res = &artistinfoStatement.GetStatementBatchTimeMenusResponse{}
|
// res = &artistinfoStatement.GetStatementBatchTimeMenusResponse{}
|
||||||
res.Data, err = dao.GetStatementBatchTimeMenus(in)
|
// res.Data, err = dao.GetStatementBatchTimeMenus(in)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
38
pkg/common/filter/domain.go
Normal file
38
pkg/common/filter/domain.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package filter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/common/extension"
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/filter"
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
extension.SetFilter("fonDomainFilter", NewDomainFonFilter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDomainFonFilter() filter.Filter {
|
||||||
|
return &DomainFonFilter{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type DomainFonFilter struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *DomainFonFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
|
||||||
|
// if len(invocation.Arguments()) > 0 {
|
||||||
|
// req := invocation.Arguments()[0]
|
||||||
|
// pp := reflect.ValueOf(req)
|
||||||
|
// field := pp.Elem().FieldByName("Domain")
|
||||||
|
|
||||||
|
// if field.IsValid() && field.String() == "" {
|
||||||
|
// field.SetString(config.Domain)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return invoker.Invoke(ctx, invocation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *DomainFonFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, protocol protocol.Invocation) protocol.Result {
|
||||||
|
return result
|
||||||
|
}
|
51
pkg/common/filter/validate.go
Normal file
51
pkg/common/filter/validate.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package filter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/common/extension"
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/filter"
|
||||||
|
"dubbo.apache.org/dubbo-go/v3/protocol"
|
||||||
|
perrors "github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type validator interface {
|
||||||
|
Validate() error
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
extension.SetFilter("fonValidateFilter", NewClientFonValidateFilter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClientFonValidateFilter() filter.Filter {
|
||||||
|
return &ClientFonValidateFilter{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClientFonValidateFilter struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *ClientFonValidateFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
|
||||||
|
|
||||||
|
if len(invocation.Arguments()) > 0 {
|
||||||
|
if v, ok := invocation.Arguments()[0].(validator); ok {
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errMsg := err.Error()
|
||||||
|
re3, _ := regexp.Compile(`^invalid(.*): `)
|
||||||
|
rep := re3.ReplaceAllString(errMsg, "")
|
||||||
|
if errCode, err := strconv.ParseInt(rep, 10, 64); err == nil {
|
||||||
|
return &protocol.RPCResult{Err: perrors.Errorf("%v", int(errCode))}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &protocol.RPCResult{Err: perrors.Errorf("%v", rep)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return invoker.Invoke(ctx, invocation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *ClientFonValidateFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, protocol protocol.Invocation) protocol.Result {
|
||||||
|
return result
|
||||||
|
}
|
@ -124,7 +124,8 @@ func migration() {
|
|||||||
&model.ArtshowArtistSupplement{}, //画展-画家补充信息
|
&model.ArtshowArtistSupplement{}, //画展-画家补充信息
|
||||||
&model.Contract{}, //合同
|
&model.Contract{}, //合同
|
||||||
&model.StatementBatch{}, //对账单批次
|
&model.StatementBatch{}, //对账单批次
|
||||||
&model.StatementDetail{}, //对账单详情
|
&model.ArtworkEntrustDetail{}, //
|
||||||
|
&model.ArtworkSalesDetail{}, //
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("register table fail")
|
fmt.Println("register table fail")
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/fonchain/fonchain-artistinfo/pb/account"
|
"github.com/fonchain/fonchain-artistinfo/pb/account"
|
||||||
"github.com/fonchain/fonchain-artistinfo/pb/artist"
|
"github.com/fonchain/fonchain-artistinfo/pb/artist"
|
||||||
contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice"
|
contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice"
|
||||||
|
_ "github.com/fonchain/fonchain-artistinfo/pkg/common/filter"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user