fix 修改审批中画展包的逻辑
This commit is contained in:
parent
4375d669d2
commit
aec05feaea
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,9 @@ option go_package = "./;approval";
|
||||
service Approval {
|
||||
|
||||
rpc Create(CreateRequest) returns (ApprovalResponse) {};
|
||||
rpc UsedNumByUser(UsedNumByUserRequest) returns (UsedNumByUserResponse) {};//获取此用户能创建多少个画展包
|
||||
rpc UpdateExhibitionApplyID(UpdateEhApplyIDRequest) returns (UpdateEhApplyIDResponse) {};//同步画展包的ID
|
||||
|
||||
rpc Detail(DetailRequest) returns (CreateRequest) {};
|
||||
rpc Update(CreateRequest) returns (ApprovalResponse) {};
|
||||
rpc Remove(RemoveRequest) returns (RemoveResponse) {};
|
||||
@ -28,6 +31,24 @@ service Approval {
|
||||
|
||||
}
|
||||
|
||||
message UpdateEhApplyIDRequest {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 ApprovalID = 2 [json_name = "approvalID"];
|
||||
uint64 ApplyId = 3 [json_name = "applyId"];
|
||||
}
|
||||
|
||||
message UpdateEhApplyIDResponse {
|
||||
}
|
||||
|
||||
message UsedNumByUserRequest {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 SubmitterID = 2 [json_name = "submitterID"];
|
||||
}
|
||||
|
||||
message UsedNumByUserResponse {
|
||||
uint64 total = 1 [json_name = "total"];
|
||||
}
|
||||
|
||||
message NowLevelByInfoRequest {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 ApprovalID = 2 [json_name = "ApprovalID"];
|
||||
@ -157,6 +178,7 @@ message ApprovalExhibition {
|
||||
uint64 PackageID =5 [json_name = "packageID"];
|
||||
uint64 PackageSize =6 [json_name = "packageSize"];
|
||||
string PackageNumber =7 [json_name = "packageNumber"];
|
||||
string Address =8 [json_name = "address"];
|
||||
}
|
||||
|
||||
message Exhibition {
|
||||
@ -165,6 +187,8 @@ message Exhibition {
|
||||
string Address =3 [json_name = "address"];
|
||||
uint64 PidApprovalID =4 [json_name = "pidApprovalID"];
|
||||
repeated ApprovalExhibition ApprovalExhibitions = 5 [json_name = "approvalExhibitions"];
|
||||
uint64 Num = 6 [json_name = "num"];
|
||||
uint64 ApplyID = 7 [json_name = "applyID"];
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
|
@ -16,6 +16,18 @@ var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *UpdateEhApplyIDRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateEhApplyIDResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UsedNumByUserRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UsedNumByUserResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *NowLevelByInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ const _ = grpc_go.SupportPackageIsVersion7
|
||||
// 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 ApprovalClient interface {
|
||||
Create(ctx context.Context, in *CreateRequest, opts ...grpc_go.CallOption) (*ApprovalResponse, common.ErrorWithAttachment)
|
||||
UsedNumByUser(ctx context.Context, in *UsedNumByUserRequest, opts ...grpc_go.CallOption) (*UsedNumByUserResponse, common.ErrorWithAttachment)
|
||||
UpdateExhibitionApplyID(ctx context.Context, in *UpdateEhApplyIDRequest, opts ...grpc_go.CallOption) (*UpdateEhApplyIDResponse, common.ErrorWithAttachment)
|
||||
Detail(ctx context.Context, in *DetailRequest, opts ...grpc_go.CallOption) (*CreateRequest, common.ErrorWithAttachment)
|
||||
Update(ctx context.Context, in *CreateRequest, opts ...grpc_go.CallOption) (*ApprovalResponse, common.ErrorWithAttachment)
|
||||
Remove(ctx context.Context, in *RemoveRequest, opts ...grpc_go.CallOption) (*RemoveResponse, common.ErrorWithAttachment)
|
||||
@ -52,23 +54,25 @@ type approvalClient struct {
|
||||
}
|
||||
|
||||
type ApprovalClientImpl struct {
|
||||
Create func(ctx context.Context, in *CreateRequest) (*ApprovalResponse, error)
|
||||
Detail func(ctx context.Context, in *DetailRequest) (*CreateRequest, error)
|
||||
Update func(ctx context.Context, in *CreateRequest) (*ApprovalResponse, error)
|
||||
Remove func(ctx context.Context, in *RemoveRequest) (*RemoveResponse, error)
|
||||
MyWork func(ctx context.Context, in *ListRequest) (*ListResponse, error)
|
||||
MySubmit func(ctx context.Context, in *ListRequest) (*ListResponse, error)
|
||||
NowLevelByInfo func(ctx context.Context, in *NowLevelByInfoRequest) (*WorkFlowResponse, error)
|
||||
Information func(ctx context.Context, in *InformationRequest) (*InformationResponse, error)
|
||||
Viewed func(ctx context.Context, in *ViewedRequest) (*ApprovalResponse, error)
|
||||
SetStatus func(ctx context.Context, in *StatusRequest) (*StatusResponse, error)
|
||||
DetailSetting func(ctx context.Context, in *DetailSettingRequest) (*SettingRequest, error)
|
||||
UpdateSetting func(ctx context.Context, in *SettingRequest) (*SettingResponse, error)
|
||||
CreateType func(ctx context.Context, in *CreateTypeRequest) (*TypeResponse, error)
|
||||
DetailType func(ctx context.Context, in *TypeResponse) (*CreateTypeRequest, error)
|
||||
UpdateType func(ctx context.Context, in *CreateTypeRequest) (*TypeResponse, error)
|
||||
AllType func(ctx context.Context, in *CommonRequest) (*AllTypeResponse, error)
|
||||
RemoveType func(ctx context.Context, in *RemoveRequest) (*StatusResponse, error)
|
||||
Create func(ctx context.Context, in *CreateRequest) (*ApprovalResponse, error)
|
||||
UsedNumByUser func(ctx context.Context, in *UsedNumByUserRequest) (*UsedNumByUserResponse, error)
|
||||
UpdateExhibitionApplyID func(ctx context.Context, in *UpdateEhApplyIDRequest) (*UpdateEhApplyIDResponse, error)
|
||||
Detail func(ctx context.Context, in *DetailRequest) (*CreateRequest, error)
|
||||
Update func(ctx context.Context, in *CreateRequest) (*ApprovalResponse, error)
|
||||
Remove func(ctx context.Context, in *RemoveRequest) (*RemoveResponse, error)
|
||||
MyWork func(ctx context.Context, in *ListRequest) (*ListResponse, error)
|
||||
MySubmit func(ctx context.Context, in *ListRequest) (*ListResponse, error)
|
||||
NowLevelByInfo func(ctx context.Context, in *NowLevelByInfoRequest) (*WorkFlowResponse, error)
|
||||
Information func(ctx context.Context, in *InformationRequest) (*InformationResponse, error)
|
||||
Viewed func(ctx context.Context, in *ViewedRequest) (*ApprovalResponse, error)
|
||||
SetStatus func(ctx context.Context, in *StatusRequest) (*StatusResponse, error)
|
||||
DetailSetting func(ctx context.Context, in *DetailSettingRequest) (*SettingRequest, error)
|
||||
UpdateSetting func(ctx context.Context, in *SettingRequest) (*SettingResponse, error)
|
||||
CreateType func(ctx context.Context, in *CreateTypeRequest) (*TypeResponse, error)
|
||||
DetailType func(ctx context.Context, in *TypeResponse) (*CreateTypeRequest, error)
|
||||
UpdateType func(ctx context.Context, in *CreateTypeRequest) (*TypeResponse, error)
|
||||
AllType func(ctx context.Context, in *CommonRequest) (*AllTypeResponse, error)
|
||||
RemoveType func(ctx context.Context, in *RemoveRequest) (*StatusResponse, error)
|
||||
}
|
||||
|
||||
func (c *ApprovalClientImpl) GetDubboStub(cc *triple.TripleConn) ApprovalClient {
|
||||
@ -89,6 +93,18 @@ func (c *approvalClient) Create(ctx context.Context, in *CreateRequest, opts ...
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Create", in, out)
|
||||
}
|
||||
|
||||
func (c *approvalClient) UsedNumByUser(ctx context.Context, in *UsedNumByUserRequest, opts ...grpc_go.CallOption) (*UsedNumByUserResponse, common.ErrorWithAttachment) {
|
||||
out := new(UsedNumByUserResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UsedNumByUser", in, out)
|
||||
}
|
||||
|
||||
func (c *approvalClient) UpdateExhibitionApplyID(ctx context.Context, in *UpdateEhApplyIDRequest, opts ...grpc_go.CallOption) (*UpdateEhApplyIDResponse, common.ErrorWithAttachment) {
|
||||
out := new(UpdateEhApplyIDResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateExhibitionApplyID", in, out)
|
||||
}
|
||||
|
||||
func (c *approvalClient) Detail(ctx context.Context, in *DetailRequest, opts ...grpc_go.CallOption) (*CreateRequest, common.ErrorWithAttachment) {
|
||||
out := new(CreateRequest)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -190,6 +206,8 @@ func (c *approvalClient) RemoveType(ctx context.Context, in *RemoveRequest, opts
|
||||
// for forward compatibility
|
||||
type ApprovalServer interface {
|
||||
Create(context.Context, *CreateRequest) (*ApprovalResponse, error)
|
||||
UsedNumByUser(context.Context, *UsedNumByUserRequest) (*UsedNumByUserResponse, error)
|
||||
UpdateExhibitionApplyID(context.Context, *UpdateEhApplyIDRequest) (*UpdateEhApplyIDResponse, error)
|
||||
Detail(context.Context, *DetailRequest) (*CreateRequest, error)
|
||||
Update(context.Context, *CreateRequest) (*ApprovalResponse, error)
|
||||
Remove(context.Context, *RemoveRequest) (*RemoveResponse, error)
|
||||
@ -217,6 +235,12 @@ type UnimplementedApprovalServer struct {
|
||||
func (UnimplementedApprovalServer) Create(context.Context, *CreateRequest) (*ApprovalResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedApprovalServer) UsedNumByUser(context.Context, *UsedNumByUserRequest) (*UsedNumByUserResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UsedNumByUser not implemented")
|
||||
}
|
||||
func (UnimplementedApprovalServer) UpdateExhibitionApplyID(context.Context, *UpdateEhApplyIDRequest) (*UpdateEhApplyIDResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateExhibitionApplyID not implemented")
|
||||
}
|
||||
func (UnimplementedApprovalServer) Detail(context.Context, *DetailRequest) (*CreateRequest, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Detail not implemented")
|
||||
}
|
||||
@ -322,6 +346,64 @@ func _Approval_Create_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Approval_UsedNumByUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UsedNumByUserRequest)
|
||||
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("UsedNumByUser", 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 _Approval_UpdateExhibitionApplyID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateEhApplyIDRequest)
|
||||
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("UpdateExhibitionApplyID", 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 _Approval_Detail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DetailRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -797,6 +879,14 @@ var Approval_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "Create",
|
||||
Handler: _Approval_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UsedNumByUser",
|
||||
Handler: _Approval_UsedNumByUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateExhibitionApplyID",
|
||||
Handler: _Approval_UpdateExhibitionApplyID_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Detail",
|
||||
Handler: _Approval_Detail_Handler,
|
||||
|
@ -11,7 +11,7 @@ const (
|
||||
|
||||
const (
|
||||
ERRORCONFIG = "配置文件读取错误,请检查文件路径:"
|
||||
ErrorApprovalType = "类型不支持"
|
||||
ErrorApprovalType = "类型数量不支持"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -2,6 +2,7 @@ package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/fonchain_enterprise/fonchain-approval/api/approval"
|
||||
"github.com/fonchain_enterprise/fonchain-approval/pkg/common/page"
|
||||
msg "github.com/fonchain_enterprise/fonchain-approval/pkg/m"
|
||||
@ -66,6 +67,27 @@ func (m *Approval) TableName() string {
|
||||
return "approval"
|
||||
}
|
||||
|
||||
func preValidateExhibition(in *approval.CreateRequest) error {
|
||||
|
||||
if in.Type != TypeExhibition {
|
||||
return nil
|
||||
}
|
||||
total := GetExhibitionNumByUser(in.Domain, in.SubmitterID)
|
||||
|
||||
if total <= 0 {
|
||||
return errors.New("您现在可选数量为0,请先申请画展包数量")
|
||||
}
|
||||
|
||||
if len(in.Exhibition.ApprovalExhibitions) > int(total) {
|
||||
errStr := fmt.Sprintf("您现在可选数量为%d,申请画展包数量为 %d", len(in.Exhibition.ApprovalExhibitions), total)
|
||||
return errors.New(errStr)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
func preValidateExhibition(in *approval.CreateRequest) error {
|
||||
var entity *Bundle
|
||||
|
||||
@ -88,6 +110,28 @@ func preValidateExhibition(in *approval.CreateRequest) error {
|
||||
return nil
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
// GetExhibitionNumByUser 获取用户可以使用的画展包数量
|
||||
func GetExhibitionNumByUser(domain string, submitterID uint64) int64 {
|
||||
var total, usedNum int64
|
||||
|
||||
//已经使用的
|
||||
str := `SELECT SUM(exhibition.num) AS total FROM exhibition
|
||||
left join approval ON approval.id = exhibition.approval_id WHERE approval.STATUS != ?
|
||||
AND approval.domain = ? AND approval.submitter_id = ? AND approval.type = ?`
|
||||
DB.Raw(str, StatusFail, domain, submitterID, TypeExhibition).Scan(&usedNum)
|
||||
fmt.Println("已经使用", usedNum)
|
||||
|
||||
//所有的
|
||||
str1 := `SELECT SUM(bundle.applications_num) AS total FROM bundle
|
||||
left join approval ON approval.id = bundle.approval_id WHERE approval.STATUS = ?
|
||||
AND approval.domain = ? AND approval.submitter_id = ? AND approval.type = ?`
|
||||
DB.Raw(str1, StatusOk, domain, submitterID, TypeBundle).Scan(&total)
|
||||
fmt.Println("所有申请的", total)
|
||||
|
||||
return total - usedNum
|
||||
}
|
||||
|
||||
func StoreApproval(in *approval.CreateRequest) (*Approval, error) {
|
||||
var entity *Approval
|
||||
|
@ -17,6 +17,7 @@ type ApprovalExhibition struct {
|
||||
PackageID uint64 `gorm:"column:package_id" json:"packageID"` // 作品类型id
|
||||
PackageSize uint64 `gorm:"column:package_size" json:"PackageSize"` // 平尺数
|
||||
PackageNumber string `gorm:"column:package_number" json:"packageNumber"` // 序号
|
||||
Address string `gorm:"column:address" json:"Address"` // 地点
|
||||
}
|
||||
|
||||
// TableName get sql table name.获取数据库表名
|
||||
|
@ -19,6 +19,8 @@ type Exhibition struct {
|
||||
ReceivedAt string `gorm:"column:received_at" json:"receivedAt"` // 领取时间
|
||||
Address string `gorm:"column:address" json:"Address"` // 地点
|
||||
ApprovalID uint64 `gorm:"column:approval_id" json:"approvalId"` // 关联申请的ID
|
||||
ApplyID uint64 `gorm:"column:apply_id" json:"applyID"` // 画展包的id
|
||||
Num uint64 `gorm:"column:num" json:"num"` // 关联申请的ID
|
||||
ApprovalExhibitions []*ApprovalExhibition `gorm:"foreignKey:ExhibitionID" json:"ApprovalExhibitions"` //关联包
|
||||
}
|
||||
|
||||
@ -32,7 +34,8 @@ func (m *Exhibition) SaveApprovalContent(in *approval.CreateRequest, a *Approval
|
||||
//主体保存
|
||||
m.ApprovalID = a.ID
|
||||
m.ReceivedAt = in.Exhibition.ReceivedAt
|
||||
m.Address = in.Exhibition.Address
|
||||
//m.Address = in.Exhibition.Address
|
||||
m.Num = uint64(len(in.Exhibition.ApprovalExhibitions))
|
||||
|
||||
err := DB.Create(m).Error
|
||||
if err != nil {
|
||||
@ -44,12 +47,13 @@ func (m *Exhibition) SaveApprovalContent(in *approval.CreateRequest, a *Approval
|
||||
for _, approvalExhibition := range in.Exhibition.ApprovalExhibitions {
|
||||
temp := ApprovalExhibition{
|
||||
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: approvalExhibition.PackageName,
|
||||
PackageID: approvalExhibition.PackageID,
|
||||
PackageSize: approvalExhibition.PackageSize,
|
||||
PackageNumber: approvalExhibition.PackageNumber,
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: approvalExhibition.PackageName,
|
||||
PackageID: approvalExhibition.PackageID,
|
||||
//PackageSize: approvalExhibition.PackageSize,
|
||||
//PackageNumber: approvalExhibition.PackageNumber,
|
||||
Address: approvalExhibition.Address,
|
||||
}
|
||||
|
||||
approvalExhibitions = append(approvalExhibitions, temp)
|
||||
@ -74,7 +78,8 @@ func (m *Exhibition) UpdateApprovalContent(in *approval.CreateRequest, a *Approv
|
||||
//主体保存
|
||||
//m.ApprovalID = a.ID
|
||||
m.ReceivedAt = in.Exhibition.ReceivedAt
|
||||
m.Address = in.Exhibition.Address
|
||||
//m.Address = in.Exhibition.Address
|
||||
m.Num = uint64(len(in.Exhibition.ApprovalExhibitions))
|
||||
m.ID = entity.ID
|
||||
|
||||
if err = DB.Where(&Exhibition{ApprovalID: a.ID}).Updates(&m).Error; err != nil {
|
||||
@ -119,12 +124,13 @@ func (m *Exhibition) UpdateContent(in *approval.CreateRequest, a *Approval) erro
|
||||
var approvalWorks []ApprovalExhibition
|
||||
for _, tempId := range needAdd {
|
||||
temp := ApprovalExhibition{
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: inApprovalExhibitionMap[tempId].PackageName,
|
||||
PackageID: inApprovalExhibitionMap[tempId].PackageID,
|
||||
PackageSize: inApprovalExhibitionMap[tempId].PackageSize,
|
||||
PackageNumber: inApprovalExhibitionMap[tempId].PackageNumber,
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: inApprovalExhibitionMap[tempId].PackageName,
|
||||
PackageID: inApprovalExhibitionMap[tempId].PackageID,
|
||||
//PackageSize: inApprovalExhibitionMap[tempId].PackageSize,
|
||||
//PackageNumber: inApprovalExhibitionMap[tempId].PackageNumber,
|
||||
Address: inApprovalExhibitionMap[tempId].Address,
|
||||
}
|
||||
|
||||
approvalWorks = append(approvalWorks, temp)
|
||||
@ -147,12 +153,13 @@ func (m *Exhibition) UpdateContent(in *approval.CreateRequest, a *Approval) erro
|
||||
}
|
||||
|
||||
temp := ApprovalExhibition{
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: inApprovalExhibitionMap[tempId].PackageName,
|
||||
PackageID: inApprovalExhibitionMap[tempId].PackageID,
|
||||
PackageSize: inApprovalExhibitionMap[tempId].PackageSize,
|
||||
PackageNumber: inApprovalExhibitionMap[tempId].PackageNumber,
|
||||
ApprovalID: a.ID,
|
||||
ExhibitionID: m.ID,
|
||||
PackageName: inApprovalExhibitionMap[tempId].PackageName,
|
||||
PackageID: inApprovalExhibitionMap[tempId].PackageID,
|
||||
// PackageSize: inApprovalExhibitionMap[tempId].PackageSize,
|
||||
// PackageNumber: inApprovalExhibitionMap[tempId].PackageNumber,
|
||||
Address: inApprovalExhibitionMap[tempId].Address,
|
||||
}
|
||||
|
||||
DB.Model(&ApprovalExhibition{}).
|
||||
@ -174,13 +181,14 @@ func (m *Exhibition) BuildResContent(a *Approval, request *approval.CreateReques
|
||||
for _, one := range a.Exhibition.ApprovalExhibitions {
|
||||
temp := &approval.ApprovalExhibition{
|
||||
|
||||
ID: one.ID,
|
||||
ApprovalID: one.ApprovalID,
|
||||
ExhibitionID: one.ExhibitionID,
|
||||
PackageID: one.PackageID,
|
||||
PackageName: one.PackageName,
|
||||
PackageSize: one.PackageSize,
|
||||
PackageNumber: one.PackageNumber,
|
||||
ID: one.ID,
|
||||
ApprovalID: one.ApprovalID,
|
||||
ExhibitionID: one.ExhibitionID,
|
||||
PackageID: one.PackageID,
|
||||
PackageName: one.PackageName,
|
||||
//PackageSize: one.PackageSize,
|
||||
//PackageNumber: one.PackageNumber,
|
||||
Address: one.Address,
|
||||
}
|
||||
approvalExhibitions = append(approvalExhibitions, temp)
|
||||
|
||||
@ -189,8 +197,9 @@ func (m *Exhibition) BuildResContent(a *Approval, request *approval.CreateReques
|
||||
request.Exhibition = &approval.Exhibition{
|
||||
ID: a.Exhibition.ID,
|
||||
ReceivedAt: a.Exhibition.ReceivedAt,
|
||||
Address: a.Exhibition.Address,
|
||||
|
||||
ApplyID: a.Exhibition.ApplyID,
|
||||
//Address: a.Exhibition.Address,
|
||||
Num: a.Exhibition.Num,
|
||||
ApprovalExhibitions: approvalExhibitions,
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,29 @@ func (a *ApprovalProvider) Create(ctx context.Context, in *approval.CreateReques
|
||||
return response, err
|
||||
}
|
||||
|
||||
func (a *ApprovalProvider) UpdateExhibitionApplyID(ctx context.Context, in *approval.UpdateEhApplyIDRequest) (*approval.UpdateEhApplyIDResponse, error) {
|
||||
|
||||
response := &approval.UpdateEhApplyIDResponse{}
|
||||
model.DB.Model(&model.Exhibition{}).Where(&model.Exhibition{ApprovalID: in.ApprovalID}).Update("apply_id", in.ApplyId)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *ApprovalProvider) UsedNumByUser(ctx context.Context, in *approval.UsedNumByUserRequest) (*approval.UsedNumByUserResponse, error) {
|
||||
|
||||
response := &approval.UsedNumByUserResponse{}
|
||||
|
||||
total := model.GetExhibitionNumByUser(in.Domain, in.SubmitterID)
|
||||
|
||||
response.Total = 0
|
||||
if total > 0 {
|
||||
response.Total = uint64(total)
|
||||
}
|
||||
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *ApprovalProvider) Update(ctx context.Context, in *approval.CreateRequest) (*approval.ApprovalResponse, error) {
|
||||
|
||||
response := &approval.ApprovalResponse{}
|
||||
|
Loading…
Reference in New Issue
Block a user