Merge branch 'dev' of http://gitlab.fontree.cn/bugmaker/fonchain-artistinfo into dev
This commit is contained in:
commit
5616470c14
@ -5,17 +5,25 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/internal/logic"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
contract "github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
)
|
||||
|
||||
type ContractProvider struct {
|
||||
contract.UnimplementedContractServer
|
||||
contract.UnimplementedArtistContractServer
|
||||
contractLogic *logic.Contract
|
||||
}
|
||||
|
||||
func (c *ContractProvider) FinishContract(ctx context.Context, req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
|
||||
func (c *ContractProvider) CreateContract(ctx context.Context, req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.FinishContract(req); err != nil {
|
||||
if rep, err = c.contractLogic.CreateContract(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (c *ContractProvider) ContractListMgmt(ctx context.Context, req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.ContractListMgmt(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
@ -28,32 +36,64 @@ func (c *ContractProvider) ContractList(ctx context.Context, req *contract.Contr
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
func (c *ContractProvider) GetContract(ctx context.Context, req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
|
||||
|
||||
func (c *ContractProvider) SignContract(ctx context.Context, req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.GetContract(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
func (c *ContractProvider) ContractTxList(ctx context.Context, req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.ContractTxList(req); err != nil {
|
||||
if rep, err = c.contractLogic.SignContract(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (c *ContractProvider) UpdateContract(ctx context.Context, req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
|
||||
func (c *ContractProvider) FinishContract(ctx context.Context, req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.UpdateContract(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
func (c *ContractProvider) UpdateContractTx(ctx context.Context, req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
if rep, err = c.contractLogic.UpdateContractTx(req); err != nil {
|
||||
if rep, err = c.contractLogic.FinishContract(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
// func (c *ContractProvider) ContractTxList(ctx context.Context, req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.ContractTxList(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
|
||||
// func (c *ContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.ContractList(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
// func (c *ContractProvider) GetContract(ctx context.Context, req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.GetContract(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
// func (c *ContractProvider) ContractTxList(ctx context.Context, req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.ContractTxList(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
|
||||
// func (c *ContractProvider) UpdateContract(ctx context.Context, req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.UpdateContract(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
// func (c *ContractProvider) UpdateContractTx(ctx context.Context, req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
|
||||
// fmt.Println("第一处")
|
||||
// if rep, err = c.contractLogic.UpdateContractTx(req); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return rep, nil
|
||||
// }
|
||||
|
@ -2,196 +2,431 @@ package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/model/old"
|
||||
"time"
|
||||
"strings"
|
||||
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
contract "github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
||||
"github.com/fonchain/fonchain-artistinfo/pkg/m"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func FinishContract(id string) (err error) {
|
||||
var contracts old.Contract
|
||||
if err = db.DB.Where("transaction_id = ?", id).First(&contracts).Error; err != nil {
|
||||
func GetMgmtContractByArtistUid(artistUid string, contractType int32) (err error) {
|
||||
var contract model.Contract
|
||||
if err = db.DB.Where("artist_uid = ? AND type = ?", artistUid, contractType).First(&contract).Error; err != nil && err != gorm.ErrRecordNotFound {
|
||||
zap.L().Error("get contract info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
if err = db.DB.Model(&contracts).Update("state", 3).Error; err != nil {
|
||||
zap.L().Error("user contract failed", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
func CreateArtistContract(tx *gorm.DB, contract *model.Contract) (err error) {
|
||||
if err = tx.Create(contract).Error; err != nil {
|
||||
zap.L().Error("create contract err", zap.Error(err))
|
||||
err = errors.New(m.CREATE_ERROR)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetMgmtContractByArtworkUid(artworkUid string, artworkType int32) (err error) {
|
||||
//画作有合同类型是2,6的都是 点击过"著作权代理转让服务合同"的
|
||||
var contract model.Contract
|
||||
|
||||
if err = db.DB.Where("artwork_uid LiKE ? AND type = ?", "%"+artworkUid+"%", artworkType).First(&contract).Error; err != nil && err != gorm.ErrRecordNotFound {
|
||||
zap.L().Error("get contract info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
//err 为空则查询到,返回画作合同已存在的错误
|
||||
if err == nil {
|
||||
err = errors.New(m.ARTWORK_CONTRACT_EXISTS)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func CreateArtworkContract(tx *gorm.DB, artworkUid []string, artistUid string, contractType int32, latestLockTime string) (err error) {
|
||||
var uid uuid.UUID
|
||||
if uid, err = uuid.NewV4(); err != nil {
|
||||
err = errors.New(m.ERROR_UID)
|
||||
return
|
||||
}
|
||||
|
||||
//将画作切片转换成字符串格式便于保存
|
||||
ArtworkUid := strings.Join(artworkUid, ",")
|
||||
contract := &model.Contract{
|
||||
Uid: uid.String(),
|
||||
ArtistUid: artistUid,
|
||||
ArtworkUid: ArtworkUid,
|
||||
Type: contractType,
|
||||
State: 1,
|
||||
Status: 2,
|
||||
LockTime: latestLockTime,
|
||||
}
|
||||
if err = tx.Create(contract).Error; err != nil {
|
||||
zap.L().Error("create contract err", zap.Error(err))
|
||||
err = errors.New(m.CREATE_ERROR)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func GetArtistNoByUid(artistUid string) (err error) {
|
||||
var user model.User
|
||||
if err = db.DB.Where("mgmt_artist_uid = ?", artistUid).First(&user).Error; err != nil {
|
||||
zap.L().Error("get user info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetContractList(artistUid string, pageSize, offset int32) (contracts []*contract.Contracts, err error) {
|
||||
|
||||
var contractSlice []model.Contract
|
||||
if err = db.DB.Where("artist_uid = ?", artistUid).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
||||
zap.L().Error("create contracts info err", zap.Error(err))
|
||||
err = errors.New(m.CREATE_ERROR)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range contractSlice {
|
||||
contcontract := &contract.Contracts{
|
||||
ContractUid: v.Uid,
|
||||
ArtistUid: v.ArtistUid,
|
||||
ArtworkUid: v.ArtworkUid,
|
||||
ContractId: v.ContractId,
|
||||
TransactionId: v.TransactionId,
|
||||
Type: v.Type,
|
||||
ViewUrl: v.ViewUrl,
|
||||
DownloadUrl: v.DownloadUrl,
|
||||
State: v.State,
|
||||
Status: int32(v.Status),
|
||||
LockTime: v.LockTime,
|
||||
}
|
||||
|
||||
contracts = append(contracts, contcontract)
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func GetArtistInfoById(id int32) (user model.User, err error) {
|
||||
if err = db.DB.Where("mgmt_artist_id = ?", id).First(&user).Error; err != nil {
|
||||
zap.L().Error("get user info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ContractList(artist_uid string, state int32) (ContractData []*contract.Contracts, err error) {
|
||||
|
||||
if state != 0 {
|
||||
if state == 2 {
|
||||
state = 3
|
||||
}
|
||||
}
|
||||
|
||||
var contracts []model.Contract
|
||||
if err = db.DB.Where("artist_uid = ? AND type != 4 AND state = ?", artist_uid, state).Find(&contracts).Error; err != nil {
|
||||
zap.L().Error("get contracts info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range contracts {
|
||||
|
||||
Contract := &contract.Contracts{
|
||||
ContractUid: v.Uid,
|
||||
ArtistUid: v.ArtistUid,
|
||||
ArtworkUid: v.ArtworkUid,
|
||||
ContractId: v.ContractId,
|
||||
TransactionId: v.TransactionId,
|
||||
Type: v.Type,
|
||||
ViewUrl: v.ViewUrl,
|
||||
DownloadUrl: v.DownloadUrl,
|
||||
State: v.State,
|
||||
Status: int32(v.Status),
|
||||
LockTime: v.LockTime,
|
||||
SignTime: v.SignTime,
|
||||
}
|
||||
|
||||
ContractData = append(ContractData, Contract)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func GetContractInfo(ContractId int32) (contractInfo model.Contract, err error) {
|
||||
if err = db.DB.Where("id = ?", ContractId).First(&contractInfo).Error; err != nil {
|
||||
zap.L().Error("get contract info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateContract(tx *gorm.DB, artistUid, ViewPdfUrl, DownloadUrl, ContractNo string) (err error) {
|
||||
if err = tx.Model(&model.Contract{}).Where("artist_uid = ?", artistUid).Updates(model.Contract{ViewUrl: ViewPdfUrl, DownloadUrl: DownloadUrl, ContractId: ContractNo}).Error; err != nil {
|
||||
zap.L().Error("update contract info err", zap.Error(err))
|
||||
err = errors.New(m.UPDATE_FAILED)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateContractTx(tx *gorm.DB, contractUid, transactionId string) (err error) {
|
||||
if err = tx.Model(&model.Contract{}).Where("artist_uid = ?", contractUid).Updates(model.Contract{TransactionId: transactionId, State: 1}).Error; err != nil {
|
||||
zap.L().Error("update contract info err", zap.Error(err))
|
||||
err = errors.New(m.UPDATE_FAILED)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func FinishContract(tx *gorm.DB, id string) (contracts *contract.Contracts, err error) {
|
||||
|
||||
var modelContract model.Contract
|
||||
if err = tx.Where("transaction_id = ?", id).First(&modelContract).Error; err != nil {
|
||||
zap.L().Error("get contract info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
if err = db.DB.Model(&modelContract).Update("state", 3).Error; err != nil {
|
||||
zap.L().Error("update user contract failed", zap.Error(err))
|
||||
err = errors.New(m.UPDATE_FAILED)
|
||||
return
|
||||
}
|
||||
|
||||
contracts = &contract.Contracts{
|
||||
ArtistUid: modelContract.ArtistUid,
|
||||
ArtworkUid: modelContract.ArtworkUid,
|
||||
ContractUid: modelContract.ContractId,
|
||||
TransactionId: modelContract.TransactionId,
|
||||
Type: modelContract.Type,
|
||||
ViewUrl: modelContract.ViewUrl,
|
||||
DownloadUrl: modelContract.DownloadUrl,
|
||||
State: modelContract.State,
|
||||
Status: modelContract.Status,
|
||||
LockTime: modelContract.LockTime,
|
||||
SignTime: modelContract.SignTime,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||
rep = &contract.ContractListRespond{}
|
||||
var Data []*contract.ContractData
|
||||
|
||||
var user model.User
|
||||
if err = db.DB.Where("id = ? ", int32(req.ID)).First(&user).Error; err != nil {
|
||||
zap.L().Error("get user info err", zap.Error(err))
|
||||
func ContractTxList(uid string, state int32) (contracts []model.Contract, err error) {
|
||||
if err = db.DB.Where("artist_uid = ? AND (type = 4 or type = 7) ADN state = ?", uid, state).Find(&contracts).Error; err != nil {
|
||||
zap.L().Error("get contracts info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
// todo
|
||||
//var realName model.RealName
|
||||
//if err = db.DB.Where("id = ? ", user.RealNameID).First(&realName).Error; err != nil {
|
||||
// zap.L().Error("get realName info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
//}
|
||||
|
||||
var args []interface{}
|
||||
var sqlWhere = "user_id = ? and type !=4 "
|
||||
args = append(args, req.ID)
|
||||
|
||||
if req.State != 0 {
|
||||
sqlWhere += " and state = ? "
|
||||
if req.State == 2 {
|
||||
req.State = 3
|
||||
}
|
||||
args = append(args, req.State)
|
||||
}
|
||||
|
||||
var contractModel []old.Contract
|
||||
if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
|
||||
zap.L().Error("get contractModels info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range contractModel {
|
||||
contract := &contract.ContractData{}
|
||||
contract.ID = uint64(v.ID)
|
||||
contract.ContractId = v.ContractId
|
||||
contract.DownloadUrl = v.DownloadUrl
|
||||
contract.MgmtUserId = v.MgmtUserId
|
||||
contract.State = int64(v.State)
|
||||
contract.TransactionId = v.TransactionId
|
||||
contract.Type = int64(v.Type)
|
||||
contract.UserId = int64(v.UserId)
|
||||
contract.ViewUrl = v.ViewUrl
|
||||
contract.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
|
||||
contract.SignTime = v.UpdatedAt.Format("2006-01-02")
|
||||
Data = append(Data, contract)
|
||||
}
|
||||
|
||||
rep.Data = Data
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
rep = &contract.ContractTxListRespond{}
|
||||
var Data []*contract.ContractData
|
||||
// func UpdateArtworkState(tx *gorm.DB, id int32) (err error) { //无用
|
||||
// var artworkState model.ArtworkState
|
||||
// if err = tx.Where("artwork_id = ? and state = ? ", id, 7).First(&artworkState).Error; err != nil {
|
||||
// if err == gorm.ErrRecordNotFound {
|
||||
// artworkState.ArtworkId = id
|
||||
// artworkState.State = 7
|
||||
// if err = tx.Create(&artworkState).Error; err != nil {
|
||||
// zap.L().Error("create artworkState err", zap.Error(err))
|
||||
// err = errors.New(m.CREATE_ERROR)
|
||||
// return
|
||||
// }
|
||||
// } else {
|
||||
// zap.L().Error("find artworkState info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_DATA_NOT_EXISTS)
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
var user model.User
|
||||
if err = db.DB.Where("id = ? ", int32(req.ID)).First(&user).Error; err != nil {
|
||||
zap.L().Error("get user info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
// todo
|
||||
//var realName model.RealName
|
||||
//if err = db.DB.Where("id = ? ", user.RealNameID).First(&realName).Error; err != nil {
|
||||
// zap.L().Error("get realName info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//var args []interface{}
|
||||
//var sqlWhere = " card_id = ? and (type = 4 or type = 7) "
|
||||
//args = append(args, realName.IDNum)
|
||||
//if req.State != 0 {
|
||||
// sqlWhere += " and state = ? "
|
||||
// args = append(args, req.State)
|
||||
//}
|
||||
//
|
||||
//var contractModel []model.Contract
|
||||
//if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
|
||||
// zap.L().Error("get contractModels info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//for _, v := range contractModel {
|
||||
// contractTmp := &contract.ContractData{}
|
||||
// contractTmp.ID = uint64(v.ID)
|
||||
// contractTmp.ContractId = v.ContractId
|
||||
// contractTmp.DownloadUrl = v.DownloadUrl
|
||||
// contractTmp.MgmtUserId = v.MgmtUserId
|
||||
// contractTmp.State = int64(v.State)
|
||||
// contractTmp.TransactionId = v.TransactionId
|
||||
// contractTmp.Type = int64(v.Type)
|
||||
// var b string
|
||||
// if v.Type == 4 {
|
||||
// b = "物权"
|
||||
// }
|
||||
// if v.Type == 7 {
|
||||
// b = "版权"
|
||||
// }
|
||||
// contractTmp.BatchName = b + v.BatchName[0:4] + "年" + v.BatchName[4:6] + "月" + v.BatchName[6:11] + "年" + v.BatchName[11:13] + "月"
|
||||
// contractTmp.UserId = int64(v.UserId)
|
||||
// contractTmp.ViewUrl = v.ViewUrl
|
||||
// contractTmp.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
|
||||
// contractTmp.SignTime = v.UpdatedAt.Format("2006-01-02")
|
||||
// Data = append(Data, contractTmp)
|
||||
//}
|
||||
// if err = tx.Model(&model.Artwork{}).Where("id = ? ", id).Update("flow_state", 7).Error; err != nil {
|
||||
// zap.L().Error("Artwork Update Err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_DATA_NOT_EXISTS)
|
||||
// return
|
||||
// }
|
||||
|
||||
rep.Data = Data
|
||||
// return
|
||||
// }
|
||||
|
||||
return
|
||||
}
|
||||
// func ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||
// rep = &contract.ContractListRespond{}
|
||||
// var Data []*contract.ContractData
|
||||
|
||||
func GetContract(id int32) (rep *contract.ContractData, err error) {
|
||||
var con old.Contract
|
||||
if err = db.DB.Where("id = ? ", id).First(&con).Error; err != nil {
|
||||
zap.L().Error("get contract info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return
|
||||
}
|
||||
rep.ID = uint64(con.ID)
|
||||
rep.UserId = int64(con.UserId)
|
||||
rep.CardId = con.CardId
|
||||
rep.MgmtUserId = con.MgmtUserId
|
||||
rep.ArtworkId = con.ArtworkId
|
||||
rep.ContractId = con.ContractId
|
||||
rep.TransactionId = con.TransactionId
|
||||
rep.Type = int64(con.Type)
|
||||
rep.BatchName = con.BatchName
|
||||
rep.ViewUrl = con.ViewUrl
|
||||
rep.DownloadUrl = con.DownloadUrl
|
||||
rep.State = int64(con.State)
|
||||
// var user model.User
|
||||
// if err = db.DB.Where("id = ? ", req.ID).First(&user).Error; err != nil {
|
||||
// zap.L().Error("get user info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
// }
|
||||
|
||||
return
|
||||
}
|
||||
// var realName model.RealName
|
||||
// if err = db.DB.Where("id = ? ", user.RealNameId).First(&realName).Error; err != nil {
|
||||
// zap.L().Error("get realName info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
// }
|
||||
|
||||
// 更新交易id
|
||||
func UpdateContract(req *contract.UpdateContractRequest) error {
|
||||
//数据库操作异常
|
||||
var con old.Contract
|
||||
if err := db.DB.Model(&con).Updates(&old.Contract{ContractId: req.ContractId, ViewUrl: req.ViewUrl, DownloadUrl: req.DownloadUrl}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// var args []interface{}
|
||||
// var sqlWhere = "user_id = ? and type !=4 "
|
||||
// args = append(args, req.ID)
|
||||
|
||||
// 更新交易id
|
||||
func UpdateContractTx(txId string, contractId int32) (err error) {
|
||||
var con old.Contract
|
||||
con.ID = contractId
|
||||
if err = db.DB.Model(&con).Update("transaction_id", txId).Error; err != nil {
|
||||
return
|
||||
}
|
||||
if err = db.DB.Model(&con).Update("state", 1).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
// if req.State != 0 {
|
||||
// sqlWhere += " and state = ? "
|
||||
// if req.State == 2 {
|
||||
// req.State = 3
|
||||
// }
|
||||
// args = append(args, req.State)
|
||||
// }
|
||||
|
||||
// var contractModel []model.Contract
|
||||
// if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
|
||||
// zap.L().Error("get contractModels info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
// }
|
||||
|
||||
// for _, v := range contractModel {
|
||||
// contract := &contract.ContractData{}
|
||||
// contract.ID = uint64(v.ID)
|
||||
// contract.ContractId = v.ContractId
|
||||
// contract.DownloadUrl = v.DownloadUrl
|
||||
// contract.MgmtUserId = v.MgmtUserId
|
||||
// contract.State = int64(v.State)
|
||||
// contract.TransactionId = v.TransactionId
|
||||
// contract.Type = int64(v.Type)
|
||||
// contract.UserId = int64(v.UserId)
|
||||
// contract.ViewUrl = v.ViewUrl
|
||||
// contract.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
|
||||
// contract.SignTime = v.UpdatedAt.Format("2006-01-02")
|
||||
// Data = append(Data, contract)
|
||||
// }
|
||||
|
||||
// rep.Data = Data
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// func ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
// rep = &contract.ContractTxListRespond{}
|
||||
// var Data []*contract.ContractData
|
||||
|
||||
// var user model.User
|
||||
// if err = db.DB.Where("id = ? ", int32(req.ID)).First(&user).Error; err != nil {
|
||||
// zap.L().Error("get user info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
// }
|
||||
// // todo
|
||||
// //var realName model.RealName
|
||||
// //if err = db.DB.Where("id = ? ", user.RealNameID).First(&realName).Error; err != nil {
|
||||
// // zap.L().Error("get realName info err", zap.Error(err))
|
||||
// // err = errors.New(m.ERROR_SELECT)
|
||||
// // return
|
||||
// //}
|
||||
// //
|
||||
// //var args []interface{}
|
||||
// //var sqlWhere = " card_id = ? and (type = 4 or type = 7) "
|
||||
// //args = append(args, realName.IDNum)
|
||||
// //if req.State != 0 {
|
||||
// // sqlWhere += " and state = ? "
|
||||
// // args = append(args, req.State)
|
||||
// //}
|
||||
// //
|
||||
// //var contractModel []model.Contract
|
||||
// //if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
|
||||
// // zap.L().Error("get contractModels info err", zap.Error(err))
|
||||
// // err = errors.New(m.ERROR_SELECT)
|
||||
// // return
|
||||
// //}
|
||||
// //
|
||||
// //for _, v := range contractModel {
|
||||
// // contractTmp := &contract.ContractData{}
|
||||
// // contractTmp.ID = uint64(v.ID)
|
||||
// // contractTmp.ContractId = v.ContractId
|
||||
// // contractTmp.DownloadUrl = v.DownloadUrl
|
||||
// // contractTmp.MgmtUserId = v.MgmtUserId
|
||||
// // contractTmp.State = int64(v.State)
|
||||
// // contractTmp.TransactionId = v.TransactionId
|
||||
// // contractTmp.Type = int64(v.Type)
|
||||
// // var b string
|
||||
// // if v.Type == 4 {
|
||||
// // b = "物权"
|
||||
// // }
|
||||
// // if v.Type == 7 {
|
||||
// // b = "版权"
|
||||
// // }
|
||||
// // contractTmp.BatchName = b + v.BatchName[0:4] + "年" + v.BatchName[4:6] + "月" + v.BatchName[6:11] + "年" + v.BatchName[11:13] + "月"
|
||||
// // contractTmp.UserId = int64(v.UserId)
|
||||
// // contractTmp.ViewUrl = v.ViewUrl
|
||||
// // contractTmp.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
|
||||
// // contractTmp.SignTime = v.UpdatedAt.Format("2006-01-02")
|
||||
// // Data = append(Data, contractTmp)
|
||||
// //}
|
||||
|
||||
// rep.Data = Data
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// func GetContract(id int32) (rep *contract.ContractData, err error) {
|
||||
// var con model.Contract
|
||||
// if err = db.DB.Where("id = ? ", id).First(&con).Error; err != nil {
|
||||
// zap.L().Error("get contract info err", zap.Error(err))
|
||||
// err = errors.New(m.ERROR_SELECT)
|
||||
// return
|
||||
// }
|
||||
// rep.ID = uint64(con.ID)
|
||||
// rep.UserId = int64(con.UserId)
|
||||
// rep.CardId = con.CardId
|
||||
// rep.MgmtUserId = con.MgmtUserId
|
||||
// rep.ArtworkId = con.ArtworkId
|
||||
// rep.ContractId = con.ContractId
|
||||
// rep.TransactionId = con.TransactionId
|
||||
// rep.Type = int64(con.Type)
|
||||
// rep.BatchName = con.BatchName
|
||||
// rep.ViewUrl = con.ViewUrl
|
||||
// rep.DownloadUrl = con.DownloadUrl
|
||||
// rep.State = int64(con.State)
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// // 更新交易id
|
||||
// func UpdateContract(req *contract.UpdateContractRequest) error {
|
||||
// //数据库操作异常
|
||||
// var con model.Contract
|
||||
// if err := db.DB.Model(&con).Updates(&model.Contract{ContractId: req.ContractId, ViewUrl: req.ViewUrl, DownloadUrl: req.DownloadUrl}).Error; err != nil {
|
||||
// //在线和下载的链接
|
||||
// return err
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// // 更新交易id
|
||||
// func UpdateContractTx(txId string, contractId int32) (err error) {
|
||||
// var con model.Contract
|
||||
// con.ID = contractId
|
||||
// if err = db.DB.Model(&con).Update("transaction_id", txId).Error; err != nil { //改变交易id
|
||||
// return
|
||||
// }
|
||||
// if err = db.DB.Model(&con).Update("state", 1).Error; err != nil { //更新合约状态 // 1:待生成 2 待签署 3 签署完成
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
@ -91,6 +91,7 @@ func (a *ArtistInfoUser) GetUserMsg(req *artistInfoUser.GetUserMsgRequest) (rep
|
||||
func (a *ArtistInfoUser) FindUser(req *artistInfoUser.FindUserRequest) (rep *artistInfoUser.UserInfo, err error) {
|
||||
return dao.FindUser(req)
|
||||
}
|
||||
|
||||
func (a *ArtistInfoUser) FindUserList(req *artistInfoUser.FindUsersRequest) (rep *artistInfoUser.FindUsersResponse, err error) {
|
||||
res, total, err := dao.FindUserList(req)
|
||||
rep = &artistInfoUser.FindUsersResponse{Data: res, Page: &artistInfoUser.UserCommonPageInfo{
|
||||
|
@ -1,17 +1,39 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/internal/dao"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/artist"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/artistInfoUser"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/artwork"
|
||||
contract "github.com/fonchain/fonchain-artistinfo/pb/contract"
|
||||
contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice"
|
||||
db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
||||
"github.com/fonchain/fonchain-artistinfo/pkg/m"
|
||||
"github.com/fonchain/fonchain-artistinfo/pkg/service"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type IContract interface {
|
||||
FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error)
|
||||
CreateContract(req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error)
|
||||
ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error)
|
||||
ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error)
|
||||
ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error)
|
||||
UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error)
|
||||
UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error)
|
||||
GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error)
|
||||
SignContract(req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error)
|
||||
FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error)
|
||||
// ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error)
|
||||
|
||||
// ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error)
|
||||
// UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error)
|
||||
// UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error)
|
||||
// GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error)
|
||||
}
|
||||
|
||||
func NewContract() IContract {
|
||||
@ -21,47 +43,693 @@ func NewContract() IContract {
|
||||
type Contract struct {
|
||||
}
|
||||
|
||||
func (a *Contract) FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
|
||||
rep = &contract.FinishContractRespond{}
|
||||
func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error) {
|
||||
rep = &contract.CreateContractRespond{}
|
||||
|
||||
//遇到错误数据库回滚
|
||||
tx := db.DB.Begin()
|
||||
|
||||
userInfo, err := NewArtistInfo().FindUser(&artistInfoUser.FindUserRequest{
|
||||
MgmtArtistUid: req.ArtistUid,
|
||||
IsArtist: true,
|
||||
})
|
||||
|
||||
err = dao.FinishContract(req.TransactionId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return
|
||||
}
|
||||
if userInfo.Id == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
switch req.Type {
|
||||
//1 画家合同(不涉及画家的画作)
|
||||
case 1:
|
||||
|
||||
//查看画家合同是否已经存在,不存在继续
|
||||
if err = dao.GetMgmtContractByArtistUid(req.ArtistUid, req.Type); err == gorm.ErrRecordNotFound {
|
||||
var uid uuid.UUID
|
||||
if uid, err = uuid.NewV4(); err != nil {
|
||||
err = errors.New(m.ERROR_UID)
|
||||
return
|
||||
}
|
||||
|
||||
//创建画家合同
|
||||
contract := &model.Contract{
|
||||
Uid: uid.String(),
|
||||
ArtistUid: req.ArtistUid,
|
||||
Type: 1,
|
||||
State: 1,
|
||||
Status: 2,
|
||||
LockTime: userInfo.LatestLockTime,
|
||||
}
|
||||
|
||||
if err = dao.CreateArtistContract(tx, contract); err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
case 2:
|
||||
for _, v := range req.ArtworkUid {
|
||||
//查看画作合同是否已经存在,不存在继续,类型2、6
|
||||
if err = dao.GetMgmtContractByArtworkUid(v, 2); err == gorm.ErrRecordNotFound {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
if err = dao.GetMgmtContractByArtworkUid(v, 6); err == gorm.ErrRecordNotFound {
|
||||
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//创建画家画作合同,类型2,如果批次选择多个画作的话,那么多个画在一个合同中
|
||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 2, userInfo.LatestLockTime); err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
//创建画家画作合同,类型6
|
||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 6, userInfo.LatestLockTime); err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
case 3:
|
||||
for _, v := range req.ArtworkUid {
|
||||
//查看画作合同是否已经存在,不存在继续,类型3
|
||||
if err = dao.GetMgmtContractByArtworkUid(v, 3); err == gorm.ErrRecordNotFound {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
//创建画家画作合同,类型3
|
||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 3, userInfo.LatestLockTime); err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 5:
|
||||
for _, v := range req.ArtworkUid {
|
||||
//查看画作合同是否已经存在,不存在继续,类型5
|
||||
if err = dao.GetMgmtContractByArtworkUid(v, 5); err == gorm.ErrRecordNotFound {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
//创建画家画作合同,类型3
|
||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 5, userInfo.LatestLockTime); err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
err = errors.New("type值出错!")
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Contract) ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error) {
|
||||
rep = &contract.ContractListMgmtRespond{}
|
||||
//查看是否有该画家
|
||||
if err = dao.GetArtistNoByUid(req.ArtistUid); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
//合同分页查询操作
|
||||
if req.Page < 1 {
|
||||
req.Page = 1
|
||||
}
|
||||
if req.Num < 1 {
|
||||
req.Num = 15
|
||||
}
|
||||
offset := (req.Page - 1) * req.Num
|
||||
|
||||
//获取该用户的所有合同
|
||||
contracts, err := dao.GetContractList(req.ArtistUid, req.Num, offset)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rep.Data = contracts
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Contract) ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||
|
||||
rep, err = dao.ContractList(req)
|
||||
//查看是否有该画家
|
||||
user, err := dao.GetArtistInfoById(req.ID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
ContractData, err := dao.ContractList(user.MgmtArtistUid, req.State)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
rep = &contract.ContractListRespond{
|
||||
Data: ContractData,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Contract) GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
|
||||
func (a *Contract) SignContract(req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error) {
|
||||
rep = &contract.SignContractRespond{}
|
||||
|
||||
rep, err = dao.GetContract(int32(req.Id))
|
||||
//遇到错误数据库回滚
|
||||
tx := db.DB.Begin()
|
||||
|
||||
//根据合同id获取具体合同信息
|
||||
contractInfo, err := dao.GetContractInfo(req.ContractId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
//根据画家id获取画家具体信息
|
||||
artistDetailResponse, customerId, err := GetArtistInfoById(req.ID)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
if contractInfo.Type != 4 && contractInfo.Type != 7 {
|
||||
|
||||
switch contractInfo.Type {
|
||||
case 1:
|
||||
var ContractNo = fmt.Sprintf("TF_%d", time.Now().UnixNano())
|
||||
endTime := time.Now().AddDate(1, 0, -1)
|
||||
parameterMap := make((map[string]string), 0)
|
||||
|
||||
// 一、 模板填充
|
||||
parameterMap["PartyAName"] = artistDetailResponse.ProfileInfo.Name
|
||||
parameterMap["PartyAAddress"] = artistDetailResponse.ProfileInfo.Address
|
||||
parameterMap["PartyAIdentityCard"] = artistDetailResponse.ProfileInfo.CardId
|
||||
parameterMap["PartyATelNum"] = artistDetailResponse.ProfileInfo.Phone
|
||||
parameterMap["PartyBRule"] = "240"
|
||||
parameterMap["SettleNum"] = "2"
|
||||
parameterMap["SettleSec"] = "100"
|
||||
parameterMap["ActivityNum"] = "2"
|
||||
parameterMap["SettlerTypeFour"] = "2"
|
||||
parameterMap["PowerDay"] = "5"
|
||||
parameterMap["EffectStartYear"] = fmt.Sprintf("%d", time.Now().Year())
|
||||
parameterMap["EffectStartMonth"] = fmt.Sprintf("%d", time.Now().Month())
|
||||
parameterMap["EffectStartDay"] = fmt.Sprintf("%d", time.Now().Day())
|
||||
parameterMap["EffectEndYear"] = fmt.Sprintf("%d", endTime.Year())
|
||||
parameterMap["EffectEndMonth"] = fmt.Sprintf("%d", endTime.Month())
|
||||
parameterMap["EffectEndDay"] = fmt.Sprintf("%d", endTime.Day())
|
||||
parameterMap["PartyBLegal"] = "胡婷"
|
||||
|
||||
//将map转换为string类型
|
||||
parameterMapType, err := json.Marshal(parameterMap)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
generateContractRequest := &contractMicroservice.GenerateContractRequest{
|
||||
TemplateId: "一手画市场18",
|
||||
ContractId: ContractNo,
|
||||
ParameterMap: string(parameterMapType),
|
||||
}
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//二、 自动签署
|
||||
extSignAutoRequest := &contractMicroservice.ExtSignAutoRequest{
|
||||
TransactionId: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()),
|
||||
ContractId: ContractNo,
|
||||
CustomerId: "1A958BFD01E6551D06381DA6C0B19259",
|
||||
DocTitle: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()),
|
||||
SignKeyword: "受托方(乙方)",
|
||||
SignatureId: "1668589742383450",
|
||||
KeyX: "120",
|
||||
KeyY: "0",
|
||||
}
|
||||
|
||||
_, err = service.ContractImpl.ExtSignAuto(context.Background(), extSignAutoRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//更新合同表,将合同的下载、在线、id保存
|
||||
err = dao.UpdateContract(tx, contractInfo.Uid, generateContractResponse.ViewPdfUrl, generateContractResponse.DownloadUrl, ContractNo)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
case 2:
|
||||
|
||||
var ContractNo = fmt.Sprintf("TF_%d", time.Now().UnixNano())
|
||||
var parameterMap = make(map[string]string)
|
||||
endTime := time.Now().AddDate(1, 0, -1)
|
||||
parameterMap["ContractNo"] = ContractNo
|
||||
parameterMap["PartyAName"] = artistDetailResponse.ProfileInfo.Name
|
||||
parameterMap["PartyAAddress"] = artistDetailResponse.ProfileInfo.Address
|
||||
parameterMap["PartyAIdentityCard"] = artistDetailResponse.ProfileInfo.CardId
|
||||
parameterMap["PartyATelNum"] = artistDetailResponse.ProfileInfo.Phone
|
||||
parameterMap["SettleNum"] = "2"
|
||||
parameterMap["SettleSecOne"] = "0"
|
||||
parameterMap["SettleSecTwo"] = "100"
|
||||
parameterMap["ActivityNum"] = "2"
|
||||
parameterMap["SettlerTypeFour"] = "2"
|
||||
parameterMap["PowerDay"] = "5"
|
||||
parameterMap["EffectStartYear"] = fmt.Sprintf("%d", time.Now().Year())
|
||||
parameterMap["EffectStartMonth"] = fmt.Sprintf("%d", time.Now().Month())
|
||||
parameterMap["EffectStartDay"] = fmt.Sprintf("%d", time.Now().Day())
|
||||
parameterMap["EffectEndYear"] = fmt.Sprintf("%d", endTime.Year())
|
||||
parameterMap["EffectEndMonth"] = fmt.Sprintf("%d", endTime.Month())
|
||||
parameterMap["EffectEndDay"] = fmt.Sprintf("%d", endTime.Day())
|
||||
parameterMap["PartyBLegal"] = "邬侨华"
|
||||
|
||||
//将map转换为string类型
|
||||
parameterMapType, err := json.Marshal(parameterMap)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
generateContractRequest := &contractMicroservice.GenerateContractRequest{
|
||||
TemplateId: "著作权代理转让服务合同20",
|
||||
ContractId: ContractNo,
|
||||
ParameterMap: string(parameterMapType),
|
||||
}
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//二、 自动签署
|
||||
extSignAutoRequest := &contractMicroservice.ExtSignAutoRequest{
|
||||
TransactionId: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()),
|
||||
ContractId: ContractNo,
|
||||
CustomerId: "F49C748A0C06431BC620354F4491BD37",
|
||||
DocTitle: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()),
|
||||
SignKeyword: "受托方(乙方)",
|
||||
SignatureId: "1668589763366246",
|
||||
KeyX: "120",
|
||||
KeyY: "0",
|
||||
}
|
||||
|
||||
_, err = service.ContractImpl.ExtSignAuto(context.Background(), extSignAutoRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//更新合同表,将合同的下载、在线、id保存
|
||||
err = dao.UpdateContract(tx, contractInfo.Uid, generateContractResponse.ViewPdfUrl, generateContractResponse.DownloadUrl, ContractNo)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
case 3:
|
||||
var ContractNo = fmt.Sprintf("TF_%d", time.Now().UnixNano())
|
||||
|
||||
//获取画作信息
|
||||
artworkDetailResponse, err := GetArtworkProfileByArtworkUid(contractInfo.ArtworkUid)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
var parameterMap = make(map[string]string)
|
||||
parameterMap["PartyAName"] = artistDetailResponse.ProfileInfo.Name
|
||||
parameterMap["PartyAIdCard"] = artistDetailResponse.ProfileInfo.CardId
|
||||
parameterMap["ArtworkName"] = artworkDetailResponse.ProfileInfo.ArtworkName
|
||||
parameterMap["Year"] = fmt.Sprintf("%d", time.Now().Year())
|
||||
parameterMap["Month"] = fmt.Sprintf("%d", time.Now().Month())
|
||||
parameterMap["Day"] = fmt.Sprintf("%d", time.Now().Day())
|
||||
|
||||
//将map转换为string类型
|
||||
parameterMapType, err := json.Marshal(parameterMap)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
generateContractRequest := &contractMicroservice.GenerateContractRequest{
|
||||
TemplateId: "登记授权委托书18",
|
||||
ContractId: ContractNo,
|
||||
ParameterMap: string(parameterMapType),
|
||||
}
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//更新合同表,将合同的下载、在线、id保存
|
||||
err = dao.UpdateContract(tx, contractInfo.Uid, generateContractResponse.ViewPdfUrl, generateContractResponse.DownloadUrl, ContractNo)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
case 5:
|
||||
|
||||
//获取画作信息
|
||||
artworkDetailResponse, err := GetArtworkProfileByArtworkUid(contractInfo.ArtworkUid)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
var ContractNo = fmt.Sprintf("TF_%d", time.Now().UnixNano())
|
||||
|
||||
var parameterMap = make(map[string]string)
|
||||
parameterMap["ArtworkName"] = artworkDetailResponse.ProfileInfo.ArtworkName
|
||||
parameterMap["Year"] = fmt.Sprintf("%d", time.Now().Year())
|
||||
parameterMap["Month"] = fmt.Sprintf("%d", time.Now().Month())
|
||||
parameterMap["Day"] = fmt.Sprintf("%d", time.Now().Day())
|
||||
|
||||
//将map转换为string类型
|
||||
parameterMapType, err := json.Marshal(parameterMap)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
generateContractRequest := &contractMicroservice.GenerateContractRequest{
|
||||
TemplateId: "作品登记承诺书16",
|
||||
ContractId: ContractNo,
|
||||
ParameterMap: string(parameterMapType),
|
||||
}
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//更新合同表,将合同的下载、在线、id保存
|
||||
err = dao.UpdateContract(tx, contractInfo.Uid, generateContractResponse.ViewPdfUrl, generateContractResponse.DownloadUrl, ContractNo)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
case 6:
|
||||
ArtistUids := strings.Split(contractInfo.ArtistUid, ",")
|
||||
|
||||
type dynamic struct {
|
||||
InsertWay int `json:"insertWay"`
|
||||
Keyword string `json:"keyword"`
|
||||
CellHeight float64 `json:"cellHeight"`
|
||||
ColWidthPercent []int `json:"colWidthPercent"`
|
||||
TheFirstHeader string `json:"theFirstHeader"`
|
||||
CellHorizontalAlignment int `json:"cellHorizontalAlignment"`
|
||||
CellVerticalAlignment int `json:"cellVerticalAlignment"`
|
||||
Headers []string `json:"headers"`
|
||||
Datas [][]string `json:"datas"`
|
||||
}
|
||||
var dynamicList []dynamic
|
||||
var dynamicOne dynamic
|
||||
|
||||
dynamicOne.InsertWay = 1
|
||||
dynamicOne.Keyword = "附表 1"
|
||||
dynamicOne.CellHeight = 16.0
|
||||
dynamicOne.ColWidthPercent = []int{6, 6, 20, 10, 10}
|
||||
// dynamicOne.TheFirstHeader =
|
||||
dynamicOne.CellHorizontalAlignment = 1
|
||||
dynamicOne.CellVerticalAlignment = 5
|
||||
dynamicOne.Headers = []string{"序号", "作品名称", "哈希值", "著作权取得方式(原始/继受)", "继受取得的证明文件"}
|
||||
|
||||
for k, v := range ArtistUids {
|
||||
//获取画作信息
|
||||
artworkDetailResponse, err := GetArtworkProfileByArtworkUid(v)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
var tmps []string
|
||||
tmps = append(tmps, fmt.Sprintf("%d", k+1))
|
||||
tmps = append(tmps, artworkDetailResponse.ProfileInfo.ArtistName) //获取画作名字
|
||||
tmps = append(tmps, artworkDetailResponse.DigiInfo.CopyrightHash) //获取版权hash
|
||||
tmps = append(tmps, "原始")
|
||||
tmps = append(tmps, "")
|
||||
dynamicOne.Datas = append(dynamicOne.Datas, tmps)
|
||||
}
|
||||
|
||||
dynamicList = append(dynamicList, dynamicOne)
|
||||
|
||||
dyByte, err := json.Marshal(dynamicList)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
ContractNo := fmt.Sprintf("TF_%d", time.Now().UnixNano()+1000)
|
||||
|
||||
//一、 模板填充
|
||||
var parameterMap = make(map[string]string)
|
||||
parameterMap["PartyBLegal"] = artistDetailResponse.ProfileInfo.Name
|
||||
|
||||
//将map转换为string类型
|
||||
parameterMapType, err := json.Marshal(parameterMap)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
var viewPdfUrl string
|
||||
var downloadUrl string
|
||||
|
||||
generateContractRequest := &contractMicroservice.GenerateContractRequest{
|
||||
ContractId: ContractNo,
|
||||
ParameterMap: string(parameterMapType),
|
||||
DynamicTables: string(dyByte),
|
||||
}
|
||||
|
||||
if len(ArtistUids) > 30 {
|
||||
|
||||
return rep, errors.New("选择画作条数过多")
|
||||
|
||||
} else if len(ArtistUids) <= 15 {
|
||||
generateContractRequest.TemplateId = "著作权代理转让服务合同——附表152"
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
viewPdfUrl = generateContractResponse.ViewPdfUrl
|
||||
downloadUrl = generateContractResponse.DownloadUrl
|
||||
|
||||
} else {
|
||||
generateContractRequest.TemplateId = "著作权代理转让服务合同——附表302"
|
||||
generateContractResponse, err := service.ContractImpl.GenerateContract(context.Background(), generateContractRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
viewPdfUrl = generateContractResponse.ViewPdfUrl
|
||||
downloadUrl = generateContractResponse.DownloadUrl
|
||||
}
|
||||
|
||||
//二、 自动签署
|
||||
extSignAutoRequest := &contractMicroservice.ExtSignAutoRequest{
|
||||
TransactionId: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()+1000),
|
||||
ContractId: ContractNo,
|
||||
CustomerId: "F49C748A0C06431BC620354F4491BD37",
|
||||
DocTitle: fmt.Sprintf("TFAU_%d", time.Now().UnixNano()),
|
||||
SignKeyword: "受托方(乙方)",
|
||||
SignatureId: "1668589763366246",
|
||||
KeyX: "120",
|
||||
KeyY: "0",
|
||||
}
|
||||
|
||||
_, err = service.ContractImpl.ExtSignAuto(context.Background(), extSignAutoRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//更新合同表,将合同的下载、在线、id保存
|
||||
err = dao.UpdateContract(tx, contractInfo.Uid, viewPdfUrl, downloadUrl, ContractNo)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return rep, err
|
||||
}
|
||||
default:
|
||||
return rep, errors.New("type出错")
|
||||
}
|
||||
}
|
||||
|
||||
//上面数据库没有错误就执行,上面修改的值下面会使用到
|
||||
tx.Commit()
|
||||
|
||||
transactionId := fmt.Sprintf("TFTX_%d", time.Now().UnixNano())
|
||||
|
||||
var signKeyword string
|
||||
|
||||
//从新根据合同id获取具体合同信息
|
||||
contractInfo, err = dao.GetContractInfo(req.ContractId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if contractInfo.Type == 1 || contractInfo.Type == 2 || contractInfo.Type == 6 {
|
||||
|
||||
signKeyword = "委托方(甲方)"
|
||||
}
|
||||
if contractInfo.Type == 3 {
|
||||
signKeyword = "委托人签字:"
|
||||
}
|
||||
if contractInfo.Type == 4 {
|
||||
signKeyword = "画家签字:"
|
||||
}
|
||||
if contractInfo.Type == 5 {
|
||||
signKeyword = "申请人(签章):"
|
||||
}
|
||||
signShowTime := "1"
|
||||
if contractInfo.Type == 5 || contractInfo.Type == 3 || contractInfo.Type == 6 {
|
||||
signShowTime = "2"
|
||||
}
|
||||
|
||||
// 手动签署
|
||||
extSignRequest := &contractMicroservice.ExtSignRequest{
|
||||
TransactionId: transactionId,
|
||||
ContractId: contractInfo.ContractId,
|
||||
CustomerId: customerId,
|
||||
ReturnUrl: fmt.Sprintf("%v/contractwrite?htmltype=%s&envtype=%s&token= %s", "192.168.10.7", req.HtmlType, req.EnvType, req.Token),
|
||||
DocTitle: contractInfo.ContractId,
|
||||
OpenEnvironment: "0",
|
||||
MobileSignType: "2",
|
||||
SignKeyword: signKeyword,
|
||||
Keyx: "100",
|
||||
Keyy: "-5",
|
||||
SignatureShowTime: signShowTime,
|
||||
PcHandSignature: "2",
|
||||
}
|
||||
|
||||
jumpCommonResponse, err := service.ContractImpl.ExtSign(context.Background(), extSignRequest)
|
||||
if err != nil {
|
||||
return rep, err
|
||||
}
|
||||
|
||||
err = dao.UpdateContractTx(tx, contractInfo.Uid, transactionId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rep.JumpUrl = jumpCommonResponse.JumpUrl
|
||||
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *Contract) FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
|
||||
rep = &contract.FinishContractRespond{}
|
||||
|
||||
tx := db.DB.Begin()
|
||||
//更新合同状态并获取合同信息
|
||||
contract, err := dao.FinishContract(tx, req.TransactionId)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rep.Contract = contract
|
||||
|
||||
tx.Commit()
|
||||
return
|
||||
}
|
||||
func (a *Contract) ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
|
||||
rep, err = dao.ContractTxList(req)
|
||||
// func (a *Contract) ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
|
||||
// rep = &contract.ContractTxListRespond{}
|
||||
// var datas []*contract.Contracts
|
||||
|
||||
// artistDetailResponse, _, err := GetArtistInfoById(req.ID)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
// contracts, err := dao.ContractTxList(artistDetailResponse.ProfileInfo.Uid, req.State)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
// data := &contract.Contracts{}
|
||||
// for _, v := range contracts {
|
||||
// data.ArtistUid = v.ArtistUid
|
||||
// data.ArtworkUid = v.ArtworkUid
|
||||
// data.ContractId = v.ContractId
|
||||
// data.TransactionId = v.TransactionId
|
||||
// data.Type = v.Type
|
||||
// data.ViewUrl = v.ViewUrl
|
||||
// data.DownloadUrl = v.DownloadUrl
|
||||
// //时间戳转时间
|
||||
// data.ExpirationTime = time.Unix(int64(v.CreatedAt), 0).Format("2006/01/02 15:04:05")
|
||||
// data.SignTime = v.SignTime
|
||||
// datas = append(datas, data)
|
||||
|
||||
// }
|
||||
|
||||
// rep.Data = datas
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// 根据画作uid获取画作信息
|
||||
func GetArtworkProfileByArtworkUid(artworkUid string) (artworkProfileInfo *artwork.ArtworkDetailResponse, err error) {
|
||||
artworkProfileInfo = &artwork.ArtworkDetailResponse{}
|
||||
|
||||
artworkDetailRequest := &artwork.ArtworkDetailRequest{
|
||||
ArtworkUuid: artworkUid,
|
||||
Type: "1",
|
||||
}
|
||||
artworkDetailResponse, err := service.ArtworkImpl.ArtworkDetail(context.Background(), artworkDetailRequest)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return artworkDetailResponse, nil
|
||||
}
|
||||
|
||||
// 根据画家id获取画家具体信息
|
||||
func GetArtistInfoById(id int32) (artistDetailResponse *artist.DetailResponse, customerId string, err error) {
|
||||
artistDetailResponse = &artist.DetailResponse{}
|
||||
|
||||
artistInfo, err := dao.GetArtistInfoById(id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
detailRequest := &artist.DetailRequest{
|
||||
Uid: artistInfo.MgmtArtistUid,
|
||||
}
|
||||
artistDetailResponse, err = service.GrpcArtistImpl.ArtistDetail(context.Background(), detailRequest)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
customerId = artistInfo.CustomerId
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Contract) UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
|
||||
rep = &contract.UpdateContractRespond{}
|
||||
err = dao.UpdateContract(req)
|
||||
// func (a *Contract) ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||
|
||||
return
|
||||
}
|
||||
// rep, err = dao.ContractList(req)
|
||||
|
||||
func (a *Contract) UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
|
||||
rep = &contract.UpdateContractTxRespond{}
|
||||
err = dao.UpdateContractTx(req.TransactionId, int32(req.ID))
|
||||
// return
|
||||
// }
|
||||
|
||||
return
|
||||
}
|
||||
// func (a *Contract) GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
|
||||
|
||||
// rep, err = dao.GetContract(int32(req.Id))
|
||||
|
||||
// return
|
||||
// }
|
||||
// func (a *Contract) ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
|
||||
|
||||
// rep, err = dao.ContractTxList(req)
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// func (a *Contract) UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
|
||||
// rep = &contract.UpdateContractRespond{}
|
||||
// err = dao.UpdateContract(req)
|
||||
|
||||
// return
|
||||
// }
|
||||
|
||||
// func (a *Contract) UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
|
||||
// rep = &contract.UpdateContractTxRespond{}
|
||||
// err = dao.UpdateContractTx(req.TransactionId, int32(req.ID))
|
||||
|
||||
// return
|
||||
// }
|
||||
|
25
cmd/model/contract.go
Normal file
25
cmd/model/contract.go
Normal file
@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/plugin/soft_delete"
|
||||
|
||||
// Contract 用户模型
|
||||
type Contract struct {
|
||||
ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||
Uid string `gorm:"column:uid;type:varchar(100);comment:合同表的唯一表示;NOT NULL" json:"uid"`
|
||||
ArtistUid string `gorm:"column:artist_uid;type:varchar(100);comment:画家uid;NOT NULL" json:"artist_uid"`
|
||||
ArtworkUid string `gorm:"column:artwork_uid;type:varchar(100);comment:画作uid" json:"artwork_uid"`
|
||||
ContractId string `gorm:"column:contract_id;type:varchar(100);comment:合同id" json:"contract_id"`
|
||||
TransactionId string `gorm:"column:transaction_id;type:varchar(100);comment:交易id" json:"transaction_id"`
|
||||
Type int32 `gorm:"column:type;type:int(1);comment:合同类型;NOT NULL" json:"type"`
|
||||
ViewUrl string `gorm:"column:view_url;type:varchar(500);comment:在线查看合同链接" json:"view_url"`
|
||||
DownloadUrl string `gorm:"column:download_url;type:varchar(500);comment:合同下载链接" json:"download_url"`
|
||||
State int32 `gorm:"column:state;type:int(1);comment:合同状态;NOT NULL" json:"state"`
|
||||
Status int32 `gorm:"column:status;default:2;comment:2=锁定 3=解锁" json:"status" ` //跟随用户的锁定和解锁状态,用于控制数据的展示
|
||||
LockTime string `gorm:"column:lock_time;comment:锁定时间" json:"lockTime"`
|
||||
SignTime string `gorm:"column:sign_time;comment:签署时间" json:"sign_time"`
|
||||
BatchId int32 `gorm:"column:batch_id;comment:批次ID" json:"batch_id"`
|
||||
BatchName string `gorm:"column:batch_name;comment:批次名" json:"batch_name"`
|
||||
CreatedAt int32 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
}
|
@ -1,100 +1,20 @@
|
||||
package old
|
||||
|
||||
import "github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||
import "gorm.io/plugin/soft_delete"
|
||||
|
||||
// Contract 用户模型
|
||||
type Contract struct {
|
||||
model.Model
|
||||
ID int32 `gorm:"not null"`
|
||||
UserId int32 `gorm:"not null"`
|
||||
CardId string `gorm:"type:varchar(256) default ''"`
|
||||
MgmtUserId string `gorm:"not null"`
|
||||
ArtworkId string `gorm:"type:varchar(256) default ''"`
|
||||
ContractId string `gorm:"type:varchar(256) default ''"`
|
||||
TransactionId string `gorm:"type:varchar(256) default '' "`
|
||||
Type int32 `gorm:"not null"`
|
||||
BatchId int32 `gorm:"not null"`
|
||||
BatchName string `gorm:"type:varchar(256) default '' "`
|
||||
ViewUrl string `gorm:"type:varchar(256) default ''"`
|
||||
DownloadUrl string `gorm:"type:varchar(256) default ''"`
|
||||
State int32 `gorm:"not null"`
|
||||
}
|
||||
|
||||
type Reply struct {
|
||||
Code int `json:"state"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type ArtistInfoRes struct {
|
||||
Uid string `json:"uid"`
|
||||
Seqnum int64 `json:"seqnum"` // 序列号
|
||||
Tnum string `json:"tnum"` //ex.T240
|
||||
Num int `json:"num"` // 编号
|
||||
Name string `json:"name"`
|
||||
CardId string `json:"cardId"`
|
||||
PhoneNum string `json:"phone"`
|
||||
Gender string `json:"gender"` // 性别
|
||||
Belong int `json:"belong"` // 画家归属,1-泰丰,2-丰链
|
||||
RecentPhoto string `json:"recentPhoto"` // 画家近照url
|
||||
AccountBank string `json:"bank"` // 开户银行
|
||||
Account string `json:"account"` // 开户账号
|
||||
Video []string `json:"artistVideo"` // 视频资料
|
||||
ArtshowTimes int64 `json:"artshowTimes"` // 参加画展次数
|
||||
Age int64 `json:"age"`
|
||||
Address string `json:"address"`
|
||||
Resume string `json:"resume"`
|
||||
CardPicFace string `json:"cardPicFace"`
|
||||
CardPicBack string `json:"cardPicBack"`
|
||||
CertificatePic string `json:"certificatePic"`
|
||||
CertificateNum string `json:"certificateNum"`
|
||||
// Priority int64 `json:"priority"`
|
||||
Agent string `json:"agent"`
|
||||
PenName string `json:"penName"` // 笔名
|
||||
Comment string `json:"comment"`
|
||||
WtchainHash string `json:"wtchainHash"`
|
||||
BaiduchainHash string `json:"baiduchanHash"`
|
||||
ChengchainHash string `json:"chengchainHash"`
|
||||
ChengChainCertUrl string `json:"chengChainCertUrl"`
|
||||
BaiduChainCertUrl string `json:"baiduChainCertUrl"`
|
||||
ChengChainCertOssUrl string `json:"chengChainCertOssUrl"`
|
||||
Baiduchaincertossurl string `json:"baiduchaincertossurl"`
|
||||
IsArtshow bool `json:"isArtshow"` // 是否参加过画展,1参加过,2未参加过
|
||||
CurrentPosition string `json:"currentPosition"` //现任职务
|
||||
Email string `json:"email"`
|
||||
TeaRela string `json:"teaRela"` //师
|
||||
StuRela string `json:"stuRela"` //徒
|
||||
GradSchoolStudyTour string `json:"gradSchoolStudyTour"` //毕业院校及游学经历
|
||||
NaTittle string `json:"naTittle"` //国家级头衔
|
||||
ProTittle string `json:"proTittle"` //省级头衔
|
||||
MunTittle string `json:"munTittle"` //市级头衔
|
||||
CouTittle string `json:"couTittle"` //区县级头衔
|
||||
OtherTittle string `json:"otherTittle"` //其他头衔
|
||||
PastCooForms string `json:"pastCooForms"` //过往合作平台
|
||||
ExhibiInfo string `json:"exhibiInfo"` //参展信息
|
||||
KeyAchi string `json:"keyAchi"` //主要成就
|
||||
Works string `json:"works"` //作品集
|
||||
PicAlbum string `json:"picAlbum"` //画册
|
||||
|
||||
// AwardInfo []AwardInfo `json:"awardInfo"` //获奖信息
|
||||
// Publish []Publish `json:"publish"` //出版
|
||||
// AcadePub []AcadePub `json:"acadePub"` //学术发表
|
||||
// ThirdComment []ThirdComment `json:"thirdComment"` //第三方或策展人评论
|
||||
CreaDirect string `json:"creaDirect"` //创作方向(科目)
|
||||
ArtStyle string `json:"artStyle"` //艺术风格
|
||||
PenInkSkill string `json:"penInkSkill"` //笔墨技法
|
||||
DrawThink string `json:"drawThink"` //绘画思想
|
||||
AcadeValue string `json:"acadeValue"` //学术价值
|
||||
|
||||
ArtName string `json:"artName"` // 艺名
|
||||
JoinClubTime string `json:"joinClubTime"` // 入会时间
|
||||
ArtistStamp string `json:"artistStamp"` // 画家印章
|
||||
}
|
||||
|
||||
type CreateContractRes struct {
|
||||
Code string `json:"code"`
|
||||
Download_url string `json:"download_url"`
|
||||
Msg string `json:"msg"`
|
||||
Result string `json:"result"`
|
||||
Viewpdf_url string `json:"viewpdf_url"`
|
||||
ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||
Uid string `gorm:"column:uid;type:varchar(100);comment:合同表的唯一表示;NOT NULL" json:"uid"`
|
||||
ArtistUid string `gorm:"column:artist_uid;type:varchar(100);comment:画家uid;NOT NULL" json:"artist_uid"`
|
||||
ArtworkUid string `gorm:"column:artwork_uid;type:varchar(100);comment:画作uid" json:"artwork_uid"`
|
||||
ContractId string `gorm:"column:contract_id;type:varchar(100);comment:合同id" json:"contract_id"`
|
||||
TransactionId string `gorm:"column:transaction_id;type:varchar(100);comment:交易id" json:"transaction_id"`
|
||||
Type int32 `gorm:"column:type;type:int(1);comment:合同类型;NOT NULL" json:"type"`
|
||||
ViewUrl string `gorm:"column:view_url;type:varchar(500);comment:在线查看合同链接" json:"view_url"`
|
||||
DownloadUrl string `gorm:"column:download_url;type:varchar(500);comment:合同下载链接" json:"download_url"`
|
||||
State int32 `gorm:"column:state;type:int(1);comment:合同状态;NOT NULL" json:"state"`
|
||||
CreatedAt int32 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -28,6 +28,7 @@ require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/mwitkow/go-proto-validators v0.3.2
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
|
||||
go.uber.org/zap v1.21.0
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
|
||||
google.golang.org/protobuf v1.28.1
|
||||
@ -122,7 +123,6 @@ require (
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
|
||||
github.com/shirou/gopsutil v3.20.11+incompatible // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,79 +1,104 @@
|
||||
syntax = "proto3";
|
||||
package Contract;
|
||||
option go_package = "./;contract";
|
||||
package artistContract;
|
||||
option go_package = "./;artistContract";
|
||||
//$ protoc --proto_path=. --go_out=./api/contract --go-triple_out=./api/contract ./api/contract/contract.proto
|
||||
service Contract {
|
||||
rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
|
||||
service ArtistContract {
|
||||
rpc CreateContract (CreateContractRequest) returns (CreateContractRespond) {}
|
||||
rpc ContractListMgmt (ContractListMgmtRequest) returns (ContractListMgmtRespond) {}
|
||||
rpc ContractList (ContractListRequest) returns (ContractListRespond) {}
|
||||
rpc GetContract (GetContractRequest) returns (ContractData) {}
|
||||
rpc ContractTxList (ContractTxListRequest) returns (ContractTxListRespond) {}
|
||||
rpc SignContract (SignContractRequest) returns (SignContractRespond) {}
|
||||
rpc UpdateContract(UpdateContractRequest) returns (UpdateContractRespond) {}
|
||||
rpc UpdateContractTx(UpdateContractTxRequest) returns (UpdateContractTxRespond) {}
|
||||
rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
|
||||
rpc ContractTxList (ContractTxListRequest) returns (ContractTxListRespond) {}
|
||||
|
||||
// rpc GetContract (GetContractRequest) returns (ContractData) {}
|
||||
|
||||
// rpc UpdateContract(UpdateContractRequest) returns (UpdateContractRespond) {}
|
||||
// rpc UpdateContractTx(UpdateContractTxRequest) returns (UpdateContractTxRespond) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
message FinishContractRequest {
|
||||
string TransactionId = 1 [json_name="transactionId"];
|
||||
|
||||
message Contracts{
|
||||
string ContractUid = 1 [json_name = "contract_uid"];
|
||||
string ArtistUid = 2 [json_name = "artist_uid"];
|
||||
string ArtworkUid = 3 [json_name = "artwork_uid"];
|
||||
string ContractId = 4 [json_name = "contract_id"];
|
||||
string TransactionId = 5 [json_name = "transaction_id"];
|
||||
int32 Type = 6 [json_name = "type"];
|
||||
string ViewUrl = 7 [json_name = "view_url"];
|
||||
string DownloadUrl = 8 [json_name = "download_url"];
|
||||
int32 State = 9 [json_name = "state"];
|
||||
int32 Status = 10 [json_name = "status"];
|
||||
string ExpirationTime = 11 [json_name = "expiration_time"];
|
||||
string LockTime = 12 [json_name = "lock_time"];
|
||||
string SignTime = 13 [json_name = "sign_time"];
|
||||
}
|
||||
|
||||
message FinishContractRespond {
|
||||
message CreateContractRequest {
|
||||
string ArtistUid = 1 [json_name="artist_uid"];
|
||||
repeated string ArtworkUid = 2 [json_name="artwork_uid"];
|
||||
int32 Type = 3 [json_name="type"];
|
||||
}
|
||||
|
||||
message CreateContractRespond{
|
||||
string Msg = 1 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message ContractListMgmtRequest{
|
||||
string ArtistUid = 1 [json_name = "artist_uid"];
|
||||
int32 Page = 2 [json_name = "page"];
|
||||
int32 Num = 3 [json_name = "num"];
|
||||
}
|
||||
|
||||
message ContractListMgmtRespond{
|
||||
repeated Contracts Data = 1 [json_name = "data"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message ContractListRequest {
|
||||
int32 ID = 1 [json_name = "id"];
|
||||
int32 PageSize = 2 [json_name="pageSize"];
|
||||
int32 Page = 3 [json_name="page"];
|
||||
int32 State = 4 [json_name="state"];
|
||||
|
||||
}
|
||||
|
||||
|
||||
message ContractListRequest {
|
||||
int64 PageSize = 1 [json_name="pageSize"];
|
||||
int64 Page = 2 [json_name="page"];
|
||||
int64 State = 3 [json_name="state"];
|
||||
int64 ID =4 [json_name = "id"];
|
||||
}
|
||||
|
||||
message ContractListRespond {
|
||||
repeated ContractData Data =1;
|
||||
repeated Contracts Data = 1 [json_name = "data"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message ContractData{
|
||||
uint64 ID = 1[json_name="id"];
|
||||
int64 UserId = 2[json_name="userId"];
|
||||
string CardId = 3[json_name="cardId"];
|
||||
string MgmtUserId = 4[json_name="mgmtUserId"];
|
||||
string ArtworkId = 5[json_name="artworkId"];
|
||||
string ContractId = 6[json_name="contractId"];
|
||||
string TransactionId = 7[json_name="transactionId"];
|
||||
int64 Type = 8[json_name="type"];
|
||||
int64 BatchId = 9[json_name="batchId"];
|
||||
string BatchName = 10[json_name="batchName"];
|
||||
string ViewUrl = 11[json_name="viewUrl"];
|
||||
string DownloadUrl = 12[json_name="downloadUrl"];
|
||||
int64 State = 13[json_name="state"];
|
||||
string UpdateTime = 14 [json_name="updateTime"];
|
||||
string CreateTime = 15[json_name="createTime"];
|
||||
string ExpirationTime = 16 [json_name="expirationTime"];
|
||||
string SignTime = 17 [json_name="signTime"];
|
||||
message SignContractRequest {
|
||||
int32 ID = 1 [json_name = "id"];
|
||||
int32 ContractId = 2 [json_name="contractId"];
|
||||
string Token = 3 [json_name="token"];
|
||||
string HtmlType = 4 [json_name="htmlType"];
|
||||
string EnvType = 5 [json_name= "envType"];
|
||||
}
|
||||
|
||||
message SignContractRespond {
|
||||
string JumpUrl = 1 [json_name = "jump_url"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message FinishContractRequest {
|
||||
string TransactionId = 1 [json_name="transactionId"];
|
||||
}
|
||||
|
||||
message FinishContractRespond {
|
||||
Contracts Contract = 1 [json_name = "msg"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
|
||||
message ContractTxListRequest {
|
||||
int64 PageSize = 1 [json_name="pageSize"];
|
||||
int64 Page = 2 [json_name="page"];
|
||||
int64 State = 3 [json_name="state"];
|
||||
int64 ID =4 [json_name = "id"];
|
||||
int32 ID = 1 [json_name = "id"];
|
||||
int32 PageSize = 2 [json_name="pageSize"];
|
||||
int32 Page = 3 [json_name="page"];
|
||||
int32 State = 4 [json_name="state"];
|
||||
}
|
||||
|
||||
message ContractTxListRespond {
|
||||
repeated ContractData Data =1;
|
||||
}
|
||||
message SignContractRequest {
|
||||
int64 ContractId = 1 [json_name="contractId"];
|
||||
string HtmlType = 2 [json_name="htmlType"];
|
||||
string EnvType = 3 [json_name= "envType"];
|
||||
}
|
||||
|
||||
message SignContractRespond {
|
||||
|
||||
repeated Contracts Data =1;
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message GetContractRequest {
|
||||
|
97
pb/contract/contract.validator.pb.go
Normal file
97
pb/contract/contract.validator.pb.go
Normal file
@ -0,0 +1,97 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: contract.proto
|
||||
|
||||
package artistContract
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *Contracts) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CreateContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CreateContractRespond) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ContractListMgmtRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ContractListMgmtRespond) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ContractListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ContractListRespond) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SignContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SignContractRespond) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FinishContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FinishContractRespond) Validate() error {
|
||||
if this.Contract != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Contract); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Contract", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ContractTxListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ContractTxListRespond) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateContractRespond) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateContractTxRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateContractTxRespond) Validate() error {
|
||||
return nil
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v3.9.0
|
||||
// source: api/contract/contract.proto
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.8
|
||||
// source: contract.proto
|
||||
|
||||
package contract
|
||||
package artistContract
|
||||
|
||||
import (
|
||||
context "context"
|
||||
@ -24,157 +24,145 @@ import (
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc_go.SupportPackageIsVersion7
|
||||
|
||||
// ContractClient is the client API for Contract service.
|
||||
// ArtistContractClient is the client API for ArtistContract service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ContractClient interface {
|
||||
FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment)
|
||||
type ArtistContractClient interface {
|
||||
CreateContract(ctx context.Context, in *CreateContractRequest, opts ...grpc_go.CallOption) (*CreateContractRespond, common.ErrorWithAttachment)
|
||||
ContractListMgmt(ctx context.Context, in *ContractListMgmtRequest, opts ...grpc_go.CallOption) (*ContractListMgmtRespond, common.ErrorWithAttachment)
|
||||
ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment)
|
||||
GetContract(ctx context.Context, in *GetContractRequest, opts ...grpc_go.CallOption) (*ContractData, common.ErrorWithAttachment)
|
||||
ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment)
|
||||
SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment)
|
||||
UpdateContract(ctx context.Context, in *UpdateContractRequest, opts ...grpc_go.CallOption) (*UpdateContractRespond, common.ErrorWithAttachment)
|
||||
UpdateContractTx(ctx context.Context, in *UpdateContractTxRequest, opts ...grpc_go.CallOption) (*UpdateContractTxRespond, common.ErrorWithAttachment)
|
||||
FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment)
|
||||
ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type contractClient struct {
|
||||
type artistContractClient struct {
|
||||
cc *triple.TripleConn
|
||||
}
|
||||
|
||||
type ContractClientImpl struct {
|
||||
FinishContract func(ctx context.Context, in *FinishContractRequest) (*FinishContractRespond, error)
|
||||
type ArtistContractClientImpl struct {
|
||||
CreateContract func(ctx context.Context, in *CreateContractRequest) (*CreateContractRespond, error)
|
||||
ContractListMgmt func(ctx context.Context, in *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
||||
ContractList func(ctx context.Context, in *ContractListRequest) (*ContractListRespond, error)
|
||||
GetContract func(ctx context.Context, in *GetContractRequest) (*ContractData, error)
|
||||
ContractTxList func(ctx context.Context, in *ContractTxListRequest) (*ContractTxListRespond, error)
|
||||
SignContract func(ctx context.Context, in *SignContractRequest) (*SignContractRespond, error)
|
||||
UpdateContract func(ctx context.Context, in *UpdateContractRequest) (*UpdateContractRespond, error)
|
||||
UpdateContractTx func(ctx context.Context, in *UpdateContractTxRequest) (*UpdateContractTxRespond, error)
|
||||
FinishContract func(ctx context.Context, in *FinishContractRequest) (*FinishContractRespond, error)
|
||||
ContractTxList func(ctx context.Context, in *ContractTxListRequest) (*ContractTxListRespond, error)
|
||||
}
|
||||
|
||||
func (c *ContractClientImpl) GetDubboStub(cc *triple.TripleConn) ContractClient {
|
||||
return NewContractClient(cc)
|
||||
func (c *ArtistContractClientImpl) GetDubboStub(cc *triple.TripleConn) ArtistContractClient {
|
||||
return NewArtistContractClient(cc)
|
||||
}
|
||||
|
||||
func (c *ContractClientImpl) XXX_InterfaceName() string {
|
||||
return "Contract.Contract"
|
||||
func (c *ArtistContractClientImpl) XXX_InterfaceName() string {
|
||||
return "artistContract.ArtistContract"
|
||||
}
|
||||
|
||||
func NewContractClient(cc *triple.TripleConn) ContractClient {
|
||||
return &contractClient{cc}
|
||||
func NewArtistContractClient(cc *triple.TripleConn) ArtistContractClient {
|
||||
return &artistContractClient{cc}
|
||||
}
|
||||
|
||||
func (c *contractClient) FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment) {
|
||||
out := new(FinishContractRespond)
|
||||
func (c *artistContractClient) CreateContract(ctx context.Context, in *CreateContractRequest, opts ...grpc_go.CallOption) (*CreateContractRespond, common.ErrorWithAttachment) {
|
||||
out := new(CreateContractRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/FinishContract", in, out)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateContract", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment) {
|
||||
func (c *artistContractClient) ContractListMgmt(ctx context.Context, in *ContractListMgmtRequest, opts ...grpc_go.CallOption) (*ContractListMgmtRespond, common.ErrorWithAttachment) {
|
||||
out := new(ContractListMgmtRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractListMgmt", in, out)
|
||||
}
|
||||
|
||||
func (c *artistContractClient) ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment) {
|
||||
out := new(ContractListRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractList", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) GetContract(ctx context.Context, in *GetContractRequest, opts ...grpc_go.CallOption) (*ContractData, common.ErrorWithAttachment) {
|
||||
out := new(ContractData)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetContract", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment) {
|
||||
out := new(ContractTxListRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractTxList", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment) {
|
||||
func (c *artistContractClient) SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment) {
|
||||
out := new(SignContractRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SignContract", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) UpdateContract(ctx context.Context, in *UpdateContractRequest, opts ...grpc_go.CallOption) (*UpdateContractRespond, common.ErrorWithAttachment) {
|
||||
out := new(UpdateContractRespond)
|
||||
func (c *artistContractClient) FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment) {
|
||||
out := new(FinishContractRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateContract", in, out)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/FinishContract", in, out)
|
||||
}
|
||||
|
||||
func (c *contractClient) UpdateContractTx(ctx context.Context, in *UpdateContractTxRequest, opts ...grpc_go.CallOption) (*UpdateContractTxRespond, common.ErrorWithAttachment) {
|
||||
out := new(UpdateContractTxRespond)
|
||||
func (c *artistContractClient) ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment) {
|
||||
out := new(ContractTxListRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateContractTx", in, out)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractTxList", in, out)
|
||||
}
|
||||
|
||||
// ContractServer is the server API for Contract service.
|
||||
// All implementations must embed UnimplementedContractServer
|
||||
// ArtistContractServer is the server API for ArtistContract service.
|
||||
// All implementations must embed UnimplementedArtistContractServer
|
||||
// for forward compatibility
|
||||
type ContractServer interface {
|
||||
FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error)
|
||||
type ArtistContractServer interface {
|
||||
CreateContract(context.Context, *CreateContractRequest) (*CreateContractRespond, error)
|
||||
ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
||||
ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error)
|
||||
GetContract(context.Context, *GetContractRequest) (*ContractData, error)
|
||||
ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error)
|
||||
SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error)
|
||||
UpdateContract(context.Context, *UpdateContractRequest) (*UpdateContractRespond, error)
|
||||
UpdateContractTx(context.Context, *UpdateContractTxRequest) (*UpdateContractTxRespond, error)
|
||||
mustEmbedUnimplementedContractServer()
|
||||
FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error)
|
||||
ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error)
|
||||
mustEmbedUnimplementedArtistContractServer()
|
||||
}
|
||||
|
||||
// UnimplementedContractServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedContractServer struct {
|
||||
// UnimplementedArtistContractServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedArtistContractServer struct {
|
||||
proxyImpl protocol.Invoker
|
||||
}
|
||||
|
||||
func (UnimplementedContractServer) FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FinishContract not implemented")
|
||||
func (UnimplementedArtistContractServer) CreateContract(context.Context, *CreateContractRequest) (*CreateContractRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateContract not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error) {
|
||||
func (UnimplementedArtistContractServer) ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractListMgmt not implemented")
|
||||
}
|
||||
func (UnimplementedArtistContractServer) ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractList not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) GetContract(context.Context, *GetContractRequest) (*ContractData, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetContract not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractTxList not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error) {
|
||||
func (UnimplementedArtistContractServer) SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignContract not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) UpdateContract(context.Context, *UpdateContractRequest) (*UpdateContractRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateContract not implemented")
|
||||
func (UnimplementedArtistContractServer) FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FinishContract not implemented")
|
||||
}
|
||||
func (UnimplementedContractServer) UpdateContractTx(context.Context, *UpdateContractTxRequest) (*UpdateContractTxRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateContractTx not implemented")
|
||||
func (UnimplementedArtistContractServer) ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractTxList not implemented")
|
||||
}
|
||||
func (s *UnimplementedContractServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
func (s *UnimplementedArtistContractServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
|
||||
func (s *UnimplementedContractServer) XXX_GetProxyImpl() protocol.Invoker {
|
||||
func (s *UnimplementedArtistContractServer) XXX_GetProxyImpl() protocol.Invoker {
|
||||
return s.proxyImpl
|
||||
}
|
||||
|
||||
func (s *UnimplementedContractServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
|
||||
return &Contract_ServiceDesc
|
||||
func (s *UnimplementedArtistContractServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
|
||||
return &ArtistContract_ServiceDesc
|
||||
}
|
||||
func (s *UnimplementedContractServer) XXX_InterfaceName() string {
|
||||
return "Contract.Contract"
|
||||
func (s *UnimplementedArtistContractServer) XXX_InterfaceName() string {
|
||||
return "artistContract.ArtistContract"
|
||||
}
|
||||
|
||||
func (UnimplementedContractServer) mustEmbedUnimplementedContractServer() {}
|
||||
func (UnimplementedArtistContractServer) mustEmbedUnimplementedArtistContractServer() {}
|
||||
|
||||
// UnsafeContractServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ContractServer will
|
||||
// UnsafeArtistContractServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ArtistContractServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeContractServer interface {
|
||||
mustEmbedUnimplementedContractServer()
|
||||
type UnsafeArtistContractServer interface {
|
||||
mustEmbedUnimplementedArtistContractServer()
|
||||
}
|
||||
|
||||
func RegisterContractServer(s grpc_go.ServiceRegistrar, srv ContractServer) {
|
||||
s.RegisterService(&Contract_ServiceDesc, srv)
|
||||
func RegisterArtistContractServer(s grpc_go.ServiceRegistrar, srv ArtistContractServer) {
|
||||
s.RegisterService(&ArtistContract_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Contract_FinishContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FinishContractRequest)
|
||||
func _ArtistContract_CreateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateContractRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -186,7 +174,7 @@ func _Contract_FinishContract_Handler(srv interface{}, ctx context.Context, dec
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("FinishContract", args, invAttachment)
|
||||
invo := invocation.NewRPCInvocation("CreateContract", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
@ -202,7 +190,36 @@ func _Contract_FinishContract_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Contract_ContractList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _ArtistContract_ContractListMgmt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ContractListMgmtRequest)
|
||||
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("ContractListMgmt", 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 _ArtistContract_ContractList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ContractListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@ -231,65 +248,7 @@ func _Contract_ContractList_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Contract_GetContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetContractRequest)
|
||||
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("GetContract", 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 _Contract_ContractTxList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ContractTxListRequest)
|
||||
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("ContractTxList", 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 _Contract_SignContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _ArtistContract_SignContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignContractRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@ -318,8 +277,8 @@ func _Contract_SignContract_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Contract_UpdateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateContractRequest)
|
||||
func _ArtistContract_FinishContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FinishContractRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -331,7 +290,7 @@ func _Contract_UpdateContract_Handler(srv interface{}, ctx context.Context, dec
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdateContract", args, invAttachment)
|
||||
invo := invocation.NewRPCInvocation("FinishContract", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
@ -347,8 +306,8 @@ func _Contract_UpdateContract_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Contract_UpdateContractTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateContractTxRequest)
|
||||
func _ArtistContract_ContractTxList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ContractTxListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -360,7 +319,7 @@ func _Contract_UpdateContractTx_Handler(srv interface{}, ctx context.Context, de
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdateContractTx", args, invAttachment)
|
||||
invo := invocation.NewRPCInvocation("ContractTxList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
@ -376,42 +335,38 @@ func _Contract_UpdateContractTx_Handler(srv interface{}, ctx context.Context, de
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Contract_ServiceDesc is the grpc_go.ServiceDesc for Contract service.
|
||||
// ArtistContract_ServiceDesc is the grpc_go.ServiceDesc for ArtistContract service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Contract_ServiceDesc = grpc_go.ServiceDesc{
|
||||
ServiceName: "Contract.Contract",
|
||||
HandlerType: (*ContractServer)(nil),
|
||||
var ArtistContract_ServiceDesc = grpc_go.ServiceDesc{
|
||||
ServiceName: "artistContract.ArtistContract",
|
||||
HandlerType: (*ArtistContractServer)(nil),
|
||||
Methods: []grpc_go.MethodDesc{
|
||||
{
|
||||
MethodName: "FinishContract",
|
||||
Handler: _Contract_FinishContract_Handler,
|
||||
MethodName: "CreateContract",
|
||||
Handler: _ArtistContract_CreateContract_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ContractListMgmt",
|
||||
Handler: _ArtistContract_ContractListMgmt_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ContractList",
|
||||
Handler: _Contract_ContractList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetContract",
|
||||
Handler: _Contract_GetContract_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ContractTxList",
|
||||
Handler: _Contract_ContractTxList_Handler,
|
||||
Handler: _ArtistContract_ContractList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SignContract",
|
||||
Handler: _Contract_SignContract_Handler,
|
||||
Handler: _ArtistContract_SignContract_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateContract",
|
||||
Handler: _Contract_UpdateContract_Handler,
|
||||
MethodName: "FinishContract",
|
||||
Handler: _ArtistContract_FinishContract_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateContractTx",
|
||||
Handler: _Contract_UpdateContractTx_Handler,
|
||||
MethodName: "ContractTxList",
|
||||
Handler: _ArtistContract_ContractTxList_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "api/contract/contract.proto",
|
||||
Metadata: "contract.proto",
|
||||
}
|
||||
|
3450
pb/contract_microservice/contract.pb.go
Normal file
3450
pb/contract_microservice/contract.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
298
pb/contract_microservice/contract.proto
Normal file
298
pb/contract_microservice/contract.proto
Normal file
@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
package contract;
|
||||
//import "github.com/mwitkow/go-proto-validators/validator.proto";
|
||||
|
||||
option go_package = "./;contract";
|
||||
|
||||
service Contract {
|
||||
rpc RegisterPerson (RegisterPersonRequest) returns (RegisterResponse) {} //个人注册
|
||||
rpc PersonVerify (PersonVerifyRequest) returns (PersonVerifyResponse) {} //个人身份校验
|
||||
|
||||
rpc RegisterOrg (RegisterOrgRequest) returns (RegisterResponse) {} //主体注册
|
||||
rpc CompanyVerify (CompanyVerifyRequest) returns (PersonVerifyResponse) {} //主体身份校验
|
||||
|
||||
rpc FindPersonCertInfo (FindCertInfo) returns (PersonCertInfoResponse) {} //主体身份校验
|
||||
rpc FindCompanyCertInfo (FindCertInfo) returns (CompanyCertInfoResponse) {} //主体身份校验
|
||||
|
||||
rpc ApplyCert (ApplyCertRequest) returns (CommonResponse) {} //颁发证书
|
||||
|
||||
rpc AddSignature (AddSignRequest) returns (AddSignResponse) {} //实名证书申请
|
||||
rpc CustomSign (CustomSignRequest) returns (CustomSignResponse) {} //自定义印章
|
||||
rpc UploadTemplate (UploadTemplateRequest) returns (CommonResponse) {} //上传文本
|
||||
rpc UploadDocs (UploadDocsRequest) returns (CommonResponse) {} //上传文本
|
||||
rpc GenerateContract (GenerateContractRequest) returns (ViewCommonResponse) {} //模板填充
|
||||
rpc ExtSignAuto (ExtSignAutoRequest) returns (ViewCommonResponse) {} //自动签章
|
||||
rpc BeforeAuthSign (BeforeAuthSignRequest) returns (JumpCommonResponse) {} //自动签章 授权
|
||||
rpc ExtSign (ExtSignRequest) returns (JumpCommonResponse) {} //授权
|
||||
rpc ViewContract (ContractRequest) returns (JumpCommonResponse) {} //查看合同
|
||||
rpc DownLoadContract (ContractRequest) returns (JumpCommonResponse) {} //查看合同
|
||||
rpc ContractFiling (ContractRequest) returns (CommonResponse) {} //合同归档
|
||||
rpc GetPdfTemplateKeys (PdfTemplateKeysRequest) returns (PdfTemplateKeysResponse) {} //获取合同模板的key值
|
||||
|
||||
rpc AuthStatus (CustomerIdRequest) returns (AuthStatusResponse) {} //获取合同模板的key值
|
||||
rpc CancelExtSignAuto (CancelExtSignAutoRequest) returns (JumpCommonResponse) {} //取消授权签协议接口
|
||||
}
|
||||
|
||||
message CancelExtSignAutoRequest {
|
||||
string CustomerId = 1;
|
||||
string NotifyUrl = 2;
|
||||
string returnUrl = 3;
|
||||
}
|
||||
|
||||
message Person {
|
||||
string AreaCode = 1;
|
||||
string AuditFailReason = 2;
|
||||
string AuditorTime = 3;
|
||||
string BackgroundIdCardPath = 4;
|
||||
string BankCardNo = 5;
|
||||
string Birthday = 6;
|
||||
string CertType = 7;
|
||||
string ExpiresDate = 8;
|
||||
string Fork = 9;
|
||||
string GesturesPhotoPath = 10;
|
||||
string HeadPhotoPath = 11;
|
||||
string IdCard = 12;
|
||||
string IsLongTerm = 13;
|
||||
double IsPassFourElement = 14;
|
||||
double IsPassThreeElement = 15;
|
||||
string IssueAuthority = 16;
|
||||
string Mobile = 17;
|
||||
string PersonName = 18;
|
||||
string PhotoUuid = 19;
|
||||
string Sex = 20;
|
||||
string StartDate = 21;
|
||||
string Status = 22;
|
||||
string Type = 23;
|
||||
string VerifyType = 24;
|
||||
string Address = 25;
|
||||
}
|
||||
|
||||
message PersonCertInfoResponse {
|
||||
Person Person = 1 [json_name = "person"];
|
||||
string AuthenticationSubmitTime = 2 [json_name = "authenticationSubmitTime"];
|
||||
string PassTime = 3 [json_name = "passTime"];
|
||||
string TransactionNo = 4 [json_name = "transactionNo"];
|
||||
string Type = 5 [json_name = "type"];
|
||||
}
|
||||
|
||||
message FindCertInfo {
|
||||
string VerifiedSerialno = 2 [json_name = "verifiedSerialno"];
|
||||
}
|
||||
message Company{
|
||||
string AuditFailReason = 1;
|
||||
string AuditorTime = 2;
|
||||
string CertificatesType = 3;
|
||||
string CompanyEmail = 4;
|
||||
string CompanyName = 5;
|
||||
string Hasagent = 6;
|
||||
string Legal = 7;
|
||||
string LegalMobile = 8;
|
||||
string LegalName = 9;
|
||||
string Organization = 10;
|
||||
string OrganizationPath = 11;
|
||||
string OrganizationType = 12;
|
||||
string RegFormPath = 13;
|
||||
string RelatedTransactionNo = 14;
|
||||
string Status = 15;
|
||||
string VerifyType = 16;
|
||||
}
|
||||
|
||||
message Manager {
|
||||
string AreaCode = 1;
|
||||
string AuditFailReason = 2;
|
||||
string AuditorTime = 3;
|
||||
string BackgroundIdCardPath = 4;
|
||||
string Birthday = 5;
|
||||
string ExpiresDate = 6;
|
||||
string Fork = 7;
|
||||
string HeadPhotoPath = 8;
|
||||
string IdCard = 9;
|
||||
string IsLongTerm = 10;
|
||||
string IssueAuthority = 11;
|
||||
string Mobile = 12;
|
||||
string PersonName = 13;
|
||||
string PhotoUuid = 14;
|
||||
string Sex = 15;
|
||||
string StartDate = 16;
|
||||
string Status = 17;
|
||||
string Type = 18;
|
||||
string VerifyType = 19;
|
||||
string Address = 20;
|
||||
}
|
||||
|
||||
message CompanyCertInfoResponse {
|
||||
Company Company = 1 [json_name = "Company"];
|
||||
Manager Manager = 2 [json_name = "manager"];
|
||||
string AuthenticationSubmitTime = 3 [json_name = "authenticationSubmitTime"];
|
||||
string PassTime = 4 [json_name = "passTime"];
|
||||
string TransactionNo = 5 [json_name = "transactionNo"];
|
||||
string Type = 6 [json_name = "type"];
|
||||
}
|
||||
|
||||
message AuthStatusResponse {
|
||||
uint64 AuthType = 1 [json_name = "authType"];
|
||||
string ContractId = 2 [json_name = "contractId"];
|
||||
uint64 Status = 3 [json_name = "status"];
|
||||
string TransactionId = 4 [json_name = "transactionId"];
|
||||
}
|
||||
|
||||
message ApplyCertRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
string VerifiedSerialno = 2 [json_name = "verifiedSerialno"];
|
||||
}
|
||||
|
||||
message ViewCommonResponse {
|
||||
string DownloadUrl = 1 [json_name = "downloadUrl"];
|
||||
string ViewPdfUrl = 2 [json_name = "viewPdfUrl"];
|
||||
}
|
||||
|
||||
|
||||
message PdfTemplateKeysRequest {
|
||||
string TemplateId = 1 [json_name = "templateId"];
|
||||
}
|
||||
|
||||
message PdfTemplateKeysResponse {
|
||||
repeated string Keys = 1 [json_name = "Keys"];
|
||||
}
|
||||
|
||||
message JumpCommonResponse {
|
||||
string JumpUrl = 1 [json_name = "jumpUrl"];
|
||||
}
|
||||
|
||||
message ContractRequest {
|
||||
string ContractId = 1 [json_name = "contractId"];
|
||||
}
|
||||
|
||||
message ExtSignRequest {
|
||||
string TransactionId = 1 [json_name = "transactionId"];
|
||||
string ContractId = 2 [json_name = "contractId"];
|
||||
string CustomerId = 3 [json_name = "customerId"];
|
||||
string ReturnUrl = 4 [json_name = "returnUrl"];
|
||||
string DocTitle = 5 [json_name = "docTitle"];
|
||||
string OpenEnvironment = 6 [json_name = "openEnvironment"];
|
||||
string MobileSignType = 7 [json_name = "mobileSignType"];
|
||||
string SignKeyword = 8 [json_name = "signKeyword"];
|
||||
string Keyx = 9 [json_name = "keyx"];
|
||||
string Keyy = 10 [json_name = "keyy"];
|
||||
string SignatureShowTime = 11 [json_name = "signatureShowTime"];
|
||||
string PcHandSignature = 12 [json_name = "PcHandSignature"];
|
||||
}
|
||||
|
||||
message BeforeAuthSignRequest {
|
||||
string TransactionId = 1 [json_name = "transactionId"];
|
||||
string ContractId = 2 [json_name = "contractId"];
|
||||
string CustomerId = 3 [json_name = "customerId"];
|
||||
string ReturnUrl = 4 [json_name = "returnUrl"];
|
||||
string NotifyUrl = 5 [json_name = "notifyUrl"];
|
||||
}
|
||||
|
||||
|
||||
message UploadDocsRequest {
|
||||
string ContractId = 1 [json_name = "customerId"];
|
||||
string DocTitle = 2 [json_name = "docTitle"];
|
||||
string DocUrl = 3 [json_name = "docUrl"];
|
||||
string File = 4 [json_name = "file"];
|
||||
//string doc_type = 1 [json_name = "customerId"];
|
||||
}
|
||||
|
||||
message CompanyVerifyRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
}
|
||||
|
||||
message UploadTemplateResponse {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
}
|
||||
|
||||
message PersonVerifyRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
string VerifiedWay = 2 [json_name = "verifiedWay"];
|
||||
string CustomerName = 3 [json_name = "customerName"];
|
||||
string CustomerIdentNo = 4 [json_name = "customerIdentNo"];
|
||||
string Mobile = 5 [json_name = "mobile"];
|
||||
string ReturnUrl = 6 [json_name = "returnUrl"];
|
||||
}
|
||||
|
||||
message PersonVerifyResponse {
|
||||
string TransactionNo =1;
|
||||
string Url =2;
|
||||
}
|
||||
|
||||
message RegisterResponse {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
}
|
||||
|
||||
message CustomerIdRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
}
|
||||
|
||||
message CommonResponse {
|
||||
}
|
||||
|
||||
message RegisterOrgRequest {
|
||||
string OpenId = 1 [json_name = "openId"];
|
||||
}
|
||||
|
||||
message RegisterPersonRequest {
|
||||
string OpenId = 1 [json_name = "openId"];
|
||||
}
|
||||
|
||||
message AddSignRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
bytes ReadImgByte = 2 [json_name = "readImgByte"];
|
||||
}
|
||||
|
||||
message AddSignResponse {
|
||||
string SignatureId = 1 [json_name = "signatureId"];
|
||||
}
|
||||
|
||||
message CustomSignRequest {
|
||||
string CustomerId = 1 [json_name = "customerId"];
|
||||
string Content = 2 [json_name = "content"];
|
||||
}
|
||||
|
||||
message CustomSignResponse {
|
||||
string SignatureImgBase64 = 1 [json_name = "signatureImgBase64"];
|
||||
}
|
||||
|
||||
|
||||
message UploadTemplateRequest {
|
||||
string TemplateId = 1 [json_name = "templateId"];
|
||||
string DocUrl = 2 [json_name = "docUrl"];
|
||||
}
|
||||
|
||||
message ExtSignAutoRequest {
|
||||
string TransactionId = 1 [json_name = "transactionId"];
|
||||
string ContractId = 2 [json_name = "contractId"];
|
||||
string CustomerId = 3 [json_name = "customerId"];
|
||||
string ClientRole = 4 [json_name = "clientRole"];
|
||||
string DocTitle = 5 [json_name = "docTitle"];
|
||||
string SignKeyword = 6 [json_name = "signKeyword"];
|
||||
string SignatureId = 7 [json_name = "signatureId"];
|
||||
string KeyX = 9 [json_name = "keyX"];
|
||||
string KeyY = 10 [json_name = "keyY"];
|
||||
}
|
||||
|
||||
message GenerateContractRequest {
|
||||
string TemplateId = 1 [json_name="templateId"];
|
||||
string ContractId = 2 [json_name="templateId"];
|
||||
string ParameterMap = 3 [json_name="ParameterMap"];
|
||||
string DynamicTables = 4 [json_name="dynamicTables"];
|
||||
}
|
||||
|
131
pb/contract_microservice/contract.validator.pb.go
Normal file
131
pb/contract_microservice/contract.validator.pb.go
Normal file
@ -0,0 +1,131 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: api/contract/contract.proto
|
||||
|
||||
package contract
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *CancelExtSignAutoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *Person) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PersonCertInfoResponse) Validate() error {
|
||||
if this.Person != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Person); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Person", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *FindCertInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *Company) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *Manager) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CompanyCertInfoResponse) Validate() error {
|
||||
if this.Company != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Company); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Company", err)
|
||||
}
|
||||
}
|
||||
if this.Manager != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Manager); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Manager", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *AuthStatusResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ApplyCertRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ViewCommonResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PdfTemplateKeysRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PdfTemplateKeysResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *JumpCommonResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExtSignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BeforeAuthSignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UploadDocsRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CompanyVerifyRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UploadTemplateResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PersonVerifyRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PersonVerifyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RegisterResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CustomerIdRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CommonResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RegisterOrgRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RegisterPersonRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *AddSignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *AddSignResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CustomSignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CustomSignResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UploadTemplateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExtSignAutoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GenerateContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
1047
pb/contract_microservice/contract_triple.pb.go
Normal file
1047
pb/contract_microservice/contract_triple.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ message UpdateMsgRespond {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
message ListInterfaceRespond {
|
||||
int64 Total = 1 [json_name = "total"];
|
||||
|
@ -59,6 +59,7 @@ const (
|
||||
ARTIST_NOT_EXISTS = "画家不存在"
|
||||
ERROR_DATA_NOT_EXISTS = "数据不存在"
|
||||
ERROR_UPDATE_ARTIST = "数据不存在"
|
||||
ARTWORK_CONTRACT_EXISTS = "存在画作合同已经存在"
|
||||
ERROR_INVALID_CARDID = "身份证号不合法"
|
||||
INVITE_CODE_INVALID = "邀请码无效"
|
||||
ERROR_ISLOCK = "用户已被锁定"
|
||||
|
@ -8,14 +8,15 @@ import (
|
||||
//_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/account"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/artist"
|
||||
contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice"
|
||||
)
|
||||
|
||||
var (
|
||||
GrpcArtistImpl = new(artist.ArtistClientImpl)
|
||||
|
||||
GrpcArtistImpl = new(artist.ArtistClientImpl)
|
||||
AccountProvider = new(account.AccountClientImpl)
|
||||
ArtworkImpl = new(artwork.ArtworkClientImpl)
|
||||
ArtworkQueryImpl = new(artwork_query.ArtworkQueryClientImpl)
|
||||
ContractImpl = new(contractMicroservice.ContractClientImpl)
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -23,6 +24,7 @@ func init() {
|
||||
config.SetConsumerService(AccountProvider)
|
||||
config.SetConsumerService(ArtworkImpl)
|
||||
config.SetConsumerService(ArtworkQueryImpl)
|
||||
config.SetConsumerService(ContractImpl)
|
||||
//if os.Args[len(os.Args)-1] == "unit-test" {
|
||||
// _ = os.Setenv(constant.ConfigFileEnvKey, "../../conf/dubbogo.yaml")
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user