解决冲突
This commit is contained in:
commit
6090cf92d6
File diff suppressed because it is too large
Load Diff
@ -486,3 +486,72 @@ func (this *UnfinishedInfo) Validate() error {
|
||||
func (this *SoftDeleteUnfinishedInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskQueryResponse) Validate() error {
|
||||
for _, item := range this.Tasks {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Tasks", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TaskManagementInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdatePendingCountRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecentAssignRecordsRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecentAssignRecordsResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *EmployeeTaskQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *EmployeeTaskQueryResponse) Validate() error {
|
||||
for _, item := range this.Records {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CompleteTaskManuallyRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateTaskProgressRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordsQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordsQueryResponse) Validate() error {
|
||||
for _, item := range this.Records {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ArtistBundleBalanceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ArtistBundleBalanceResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v5.26.0
|
||||
// - protoc v6.32.0
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
@ -83,6 +83,16 @@ type BundleClient interface {
|
||||
// 查出没处理的数据
|
||||
ListUnfinishedInfos(ctx context.Context, in *AutoCreateUserAndOrderRequest, opts ...grpc_go.CallOption) (*UnfinishedInfos, common.ErrorWithAttachment)
|
||||
SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
// 任务台
|
||||
GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment)
|
||||
AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment)
|
||||
GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment)
|
||||
CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment)
|
||||
GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -139,6 +149,15 @@ type BundleClientImpl struct {
|
||||
UpdateReconciliationStatusBySerialNumber func(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
|
||||
ListUnfinishedInfos func(ctx context.Context, in *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
|
||||
SoftDeleteUnfinishedInfo func(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
|
||||
GetPendingTaskList func(ctx context.Context, in *TaskQueryRequest) (*TaskQueryResponse, error)
|
||||
AssignTask func(ctx context.Context, in *TaskAssignRequest) (*CommonResponse, error)
|
||||
UpdatePendingCount func(ctx context.Context, in *UpdatePendingCountRequest) (*CommonResponse, error)
|
||||
GetRecentAssignRecords func(ctx context.Context, in *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
|
||||
GetEmployeeAssignedTasks func(ctx context.Context, in *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
|
||||
CompleteTaskManually func(ctx context.Context, in *CompleteTaskManuallyRequest) (*CommonResponse, error)
|
||||
UpdateTaskProgress func(ctx context.Context, in *UpdateTaskProgressRequest) (*CommonResponse, error)
|
||||
GetTaskAssignRecordsList func(ctx context.Context, in *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
|
||||
GetArtistBundleBalance func(ctx context.Context, in *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -447,6 +466,60 @@ func (c *bundleClient) SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDel
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SoftDeleteUnfinishedInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(TaskQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPendingTaskList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AssignTask", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdatePendingCount", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment) {
|
||||
out := new(RecentAssignRecordsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetRecentAssignRecords", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(EmployeeTaskQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetEmployeeAssignedTasks", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CompleteTaskManually", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateTaskProgress", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(TaskAssignRecordsQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetTaskAssignRecordsList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment) {
|
||||
out := new(ArtistBundleBalanceResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistBundleBalance", in, out)
|
||||
}
|
||||
|
||||
// BundleServer is the server API for Bundle service.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -506,6 +579,16 @@ type BundleServer interface {
|
||||
// 查出没处理的数据
|
||||
ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
|
||||
SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
|
||||
// 任务台
|
||||
GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error)
|
||||
AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error)
|
||||
UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error)
|
||||
GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
|
||||
GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
|
||||
CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error)
|
||||
UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error)
|
||||
GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
|
||||
GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -661,6 +744,33 @@ func (UnimplementedBundleServer) ListUnfinishedInfos(context.Context, *AutoCreat
|
||||
func (UnimplementedBundleServer) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SoftDeleteUnfinishedInfo not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPendingTaskList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AssignTask not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdatePendingCount not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRecentAssignRecords not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetEmployeeAssignedTasks not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CompleteTaskManually not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateTaskProgress not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetTaskAssignRecordsList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetArtistBundleBalance not implemented")
|
||||
}
|
||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -2110,6 +2220,267 @@ func _Bundle_SoftDeleteUnfinishedInfo_Handler(srv interface{}, ctx context.Conte
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetPendingTaskList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskQueryRequest)
|
||||
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("GetPendingTaskList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_AssignTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskAssignRequest)
|
||||
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("AssignTask", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_UpdatePendingCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdatePendingCountRequest)
|
||||
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("UpdatePendingCount", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetRecentAssignRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecentAssignRecordsRequest)
|
||||
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("GetRecentAssignRecords", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetEmployeeAssignedTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(EmployeeTaskQueryRequest)
|
||||
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("GetEmployeeAssignedTasks", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CompleteTaskManually_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CompleteTaskManuallyRequest)
|
||||
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("CompleteTaskManually", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_UpdateTaskProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateTaskProgressRequest)
|
||||
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("UpdateTaskProgress", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetTaskAssignRecordsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskAssignRecordsQueryRequest)
|
||||
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("GetTaskAssignRecordsList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetArtistBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ArtistBundleBalanceRequest)
|
||||
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("GetArtistBundleBalance", 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)
|
||||
}
|
||||
|
||||
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -2313,6 +2684,42 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "SoftDeleteUnfinishedInfo",
|
||||
Handler: _Bundle_SoftDeleteUnfinishedInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPendingTaskList",
|
||||
Handler: _Bundle_GetPendingTaskList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AssignTask",
|
||||
Handler: _Bundle_AssignTask_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdatePendingCount",
|
||||
Handler: _Bundle_UpdatePendingCount_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRecentAssignRecords",
|
||||
Handler: _Bundle_GetRecentAssignRecords_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEmployeeAssignedTasks",
|
||||
Handler: _Bundle_GetEmployeeAssignedTasks_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CompleteTaskManually",
|
||||
Handler: _Bundle_CompleteTaskManually_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateTaskProgress",
|
||||
Handler: _Bundle_UpdateTaskProgress_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetTaskAssignRecordsList",
|
||||
Handler: _Bundle_GetTaskAssignRecordsList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetArtistBundleBalance",
|
||||
Handler: _Bundle_GetArtistBundleBalance_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
@ -121,7 +121,7 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
||||
|
||||
if info.IsOffline == true {
|
||||
//如果是来自体制外的请求,过滤挤掉校验
|
||||
if !(ctx != nil && ctx.Request != nil && ctx.Request.Host == "erpapi-out.szjixun.cn") {
|
||||
if !(ctx != nil && (ctx.GetHeader("origin") == "https://erp-out.szjixun.cn")) {
|
||||
service.ErrorWeb(ctx, e.NotLogin, errors.New(logic.ConvertOfflineMsg(ctx, e.ErrOffline)))
|
||||
return
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
||||
bundleOrderAppRoute := bundleOrderRoute.Group("app")
|
||||
{
|
||||
bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature)
|
||||
bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature)
|
||||
//bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature)
|
||||
bundleOrderAppRoute.POST("order-del", bundle.DeleteBundleOrder)
|
||||
bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid)
|
||||
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)
|
||||
|
@ -193,161 +193,69 @@ func calculateExpirationDate(startDate time.Time, num int32, unit string) string
|
||||
}
|
||||
func CreateBundleOrderSignature(c *gin.Context) {
|
||||
var req bundle.OrderCreateRecord
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
if req.BundleUuid == "" {
|
||||
service.Error(c, errors.New(common.MissBundleUUID))
|
||||
// 参数校验
|
||||
if err := logic.ValidateRequest(c, &req); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
if req.Language == "" {
|
||||
req.Language = c.GetHeader("Accept-Language")
|
||||
if req.Language == "" {
|
||||
service.Error(c, errors.New(common.MissLanguageTypes))
|
||||
return
|
||||
}
|
||||
}
|
||||
// 不去校验 签名
|
||||
/*if req.Signature == "" {
|
||||
service.Error(c, errors.New(common.MissOrderSignature))
|
||||
return
|
||||
}*/
|
||||
statusMessages := map[int32]string{
|
||||
1: common.Unnamed,
|
||||
2: common.UnderReview,
|
||||
3: common.ReviewFailed,
|
||||
}
|
||||
// 获取 用户信息
|
||||
|
||||
// 获取用户信息并校验状态
|
||||
userInfo := login.GetUserInfoFromC(c)
|
||||
if userInfo.Status != 4 {
|
||||
if msg, exists := statusMessages[userInfo.Status]; exists {
|
||||
service.Error(c, errors.New(msg))
|
||||
if err := logic.ValidateUserStatus(userInfo); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
} else {
|
||||
service.Error(c, errors.New(common.UnknownStatus))
|
||||
return
|
||||
}
|
||||
}
|
||||
// 校验 当前用户只能买一次套餐
|
||||
orderRecordsListReq := bundle.OrderRecordsRequest{
|
||||
CustomerID: strconv.FormatUint(userInfo.ID, 10),
|
||||
}
|
||||
orderRecordsList, orderRecordsListErr := service.BundleProvider.OrderRecordsList(context.Background(), &orderRecordsListReq)
|
||||
if orderRecordsListErr != nil {
|
||||
service.Error(c, orderRecordsListErr)
|
||||
return
|
||||
}
|
||||
//有套餐并且套餐未过期
|
||||
if orderRecordsList.OrderRecords != nil {
|
||||
for _, orderInfo := range orderRecordsList.OrderRecords {
|
||||
if orderInfo.CustomerID == strconv.FormatUint(userInfo.ID, 10) && orderInfo.Status == 1 {
|
||||
service.Error(c, errors.New(common.ThereAreOutstandingOrders))
|
||||
return
|
||||
}
|
||||
if orderInfo.CustomerID == strconv.FormatUint(userInfo.ID, 10) && orderInfo.ExpirationTime > time.Now().Format("2006-01-02 15:04:05") {
|
||||
service.Error(c, errors.New(common.HadOrder))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取 最后一次的 合同编号
|
||||
lastOrderRecord, lastOrderRecordErr := service.BundleProvider.OrderRecordsList(context.Background(), &bundle.OrderRecordsRequest{
|
||||
PageSize: 1,
|
||||
Page: 1,
|
||||
})
|
||||
// 校验套餐是否已购买
|
||||
if err := logic.CheckUserOrder(userInfo.ID); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
if lastOrderRecordErr != nil {
|
||||
service.Error(c, lastOrderRecordErr)
|
||||
return
|
||||
}
|
||||
lastContractNo := ""
|
||||
if lastOrderRecord.OrderRecords != nil {
|
||||
for _, lastOrder := range lastOrderRecord.OrderRecords {
|
||||
lastContractNo = lastOrder.ContractNo
|
||||
}
|
||||
}
|
||||
// 获取 套餐信息
|
||||
bundleDetailReq := &bundle.BundleDetailRequest{
|
||||
Uuid: req.BundleUuid,
|
||||
Language: req.Language,
|
||||
}
|
||||
bundleDetail, detailErr := service.BundleProvider.BundleLangDetailV2(context.Background(), bundleDetailReq)
|
||||
if detailErr != nil {
|
||||
service.Error(c, detailErr)
|
||||
return
|
||||
}
|
||||
//获取过期时间和增值服务金额
|
||||
var addRecords []*bundle.OrderCreateAddRecord
|
||||
var addTotalPrice float32
|
||||
var expirationDay string
|
||||
for _, i := range req.AddRecords {
|
||||
price, err := service.BundleProvider.CalculatePrice(context.Background(), &bundle.CalculatePriceRequest{
|
||||
Uuid: i.ValueUid,
|
||||
Num: i.Num,
|
||||
Language: req.Language,
|
||||
})
|
||||
// 获取最后一次合同编号
|
||||
lastContractNo, err := logic.GetLastContractNo()
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
addTotalPrice += price.Price
|
||||
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(), &bundle.ValueAddServiceDetailRequest{
|
||||
Uuid: i.ValueUid,
|
||||
Language: req.Language,
|
||||
})
|
||||
|
||||
// 获取套餐详情
|
||||
bundleDetail, err := logic.GetBundleDetail(req.BundleUuid, req.Language)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
addRecords = append(addRecords, &bundle.OrderCreateAddRecord{
|
||||
ServiceType: addService.ServiceType,
|
||||
ValueUid: i.ValueUid,
|
||||
CurrencyType: addService.PriceType,
|
||||
Amount: price.Price,
|
||||
Num: i.Num,
|
||||
Unit: addService.Unit,
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
})
|
||||
//服务类型为时长 计算
|
||||
if addService.ServiceType == 5 {
|
||||
expirationDay = calculateExpirationDate(time.Now(), i.Num, addService.Unit)
|
||||
} else {
|
||||
expirationDay = time.Now().AddDate(0, 0, 7).Format("2006-01-02")
|
||||
}
|
||||
}
|
||||
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
|
||||
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Contract, bundleDetail.Price+addTotalPrice, expirationDay)
|
||||
if signContractErr != nil {
|
||||
service.Error(c, signContractErr)
|
||||
|
||||
// 组装服务内容(套餐权益 + 附加权益)
|
||||
addRecords, addTotalPrice, expirationDay, err := logic.BuildServiceRecords(&req, bundleDetail)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
req.CustomerNum = userInfo.SubNum
|
||||
req.CustomerName = userInfo.Name
|
||||
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
|
||||
req.BundleName = bundleDetail.Name
|
||||
req.Amount = bundleDetail.Price
|
||||
req.AmountType = bundleDetail.PriceType
|
||||
//req.BundleCommonUid = bundleDetail.BundleCommonUid
|
||||
req.TotalAmount = bundleDetail.Price + addTotalPrice
|
||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||
req.SignContract = signContract
|
||||
req.SignedTime = common.GetBeijingTime()
|
||||
req.Status = bundleModel.OrderSigned
|
||||
req.AddRecords = addRecords
|
||||
//req.ExpirationTime = expirationDay //过期日期取消 在完成支付是更新
|
||||
req.PayType = 1
|
||||
|
||||
// 签合同(金额 + 有效期)
|
||||
signContract, err := logic.SignContractV2(req.CustomerNum, bundleDetail.Contract, bundleDetail.Price+addTotalPrice, expirationDay)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 组装订单信息
|
||||
req = logic.BuildOrderRequest(&req, userInfo, bundleDetail, addRecords, addTotalPrice, lastContractNo, signContract)
|
||||
|
||||
// 创建订单
|
||||
res, err := service.BundleProvider.CreateOrderRecord(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateBundleOrderStatusPaid(c *gin.Context) {
|
||||
|
@ -50,6 +50,10 @@ const (
|
||||
ReviewFailed = "实名审核失败"
|
||||
UnknownStatus = "未知实名状态"
|
||||
)
|
||||
const (
|
||||
UnknownAddServiceUUID = "未知增值服务"
|
||||
BundleUnBindingAddService = "套餐未绑定增值服务"
|
||||
)
|
||||
|
||||
/*var EnMessages = map[string]string{
|
||||
"创建套餐信息失败": "Failed to create bundle information",
|
||||
|
211
pkg/service/bundle/logic/bundleOrder.go
Normal file
211
pkg/service/bundle/logic/bundleOrder.go
Normal file
@ -0,0 +1,211 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 校验参数
|
||||
func ValidateRequest(c *gin.Context, req *bundle.OrderCreateRecord) error {
|
||||
if req.BundleUuid == "" {
|
||||
return errors.New(common.MissBundleUUID)
|
||||
}
|
||||
if req.Language == "" {
|
||||
req.Language = c.GetHeader("Accept-Language")
|
||||
if req.Language == "" {
|
||||
return errors.New(common.MissLanguageTypes)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 校验用户状态
|
||||
func ValidateUserStatus(userInfo login.Info) error {
|
||||
statusMessages := map[int32]string{
|
||||
1: common.Unnamed,
|
||||
2: common.UnderReview,
|
||||
3: common.ReviewFailed,
|
||||
}
|
||||
if userInfo.Status != 4 {
|
||||
if msg, ok := statusMessages[userInfo.Status]; ok {
|
||||
return errors.New(msg)
|
||||
}
|
||||
return errors.New(common.UnknownStatus)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 校验用户是否已有套餐
|
||||
func CheckUserOrder(userID uint64) error {
|
||||
req := bundle.OrderRecordsRequest{CustomerID: strconv.FormatUint(userID, 10)}
|
||||
records, err := service.BundleProvider.OrderRecordsList(context.Background(), &req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, order := range records.OrderRecords {
|
||||
if order.CustomerID == strconv.FormatUint(userID, 10) && order.Status == 1 {
|
||||
return errors.New(common.ThereAreOutstandingOrders)
|
||||
}
|
||||
if order.CustomerID == strconv.FormatUint(userID, 10) && order.ExpirationTime > time.Now().Format("2006-01-02 15:04:05") {
|
||||
return errors.New(common.HadOrder)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取最后一次合同编号
|
||||
func GetLastContractNo() (string, error) {
|
||||
records, err := service.BundleProvider.OrderRecordsList(context.Background(), &bundle.OrderRecordsRequest{
|
||||
PageSize: 1,
|
||||
Page: 1,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(records.OrderRecords) > 0 {
|
||||
return records.OrderRecords[0].ContractNo, nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// 获取套餐详情
|
||||
func GetBundleDetail(uuid, lang string) (*bundle.BundleProfileLang, error) {
|
||||
return service.BundleProvider.BundleLangDetailV2(context.Background(), &bundle.BundleDetailRequest{
|
||||
Uuid: uuid,
|
||||
Language: lang,
|
||||
})
|
||||
}
|
||||
|
||||
// 组装服务内容(套餐权益和附加权益)
|
||||
func BuildServiceRecords(req *bundle.OrderCreateRecord, bundleDetail *bundle.BundleProfileLang) ([]*bundle.OrderCreateAddRecord, float32, string, error) {
|
||||
var (
|
||||
addRecords []*bundle.OrderCreateAddRecord
|
||||
addTotalPrice float32
|
||||
expirationDay string
|
||||
addUidService = make(map[string]bool)
|
||||
bundleUidService = make(map[string]bool)
|
||||
)
|
||||
|
||||
// 分类权益
|
||||
for _, i := range bundleDetail.ServiceLangInfo {
|
||||
switch i.BenefitsType {
|
||||
case 1:
|
||||
bundleUidService[i.ValueAddUuid] = true
|
||||
case 2:
|
||||
addUidService[i.ValueAddUuid] = true
|
||||
}
|
||||
}
|
||||
if len(bundleUidService) == 0 {
|
||||
return nil, 0, "", errors.New(common.BundleUnBindingAddService)
|
||||
}
|
||||
|
||||
// 附加权益
|
||||
for _, i := range req.AddRecords {
|
||||
if !addUidService[i.ValueUid] {
|
||||
return nil, 0, "", errors.New(common.UnknownAddServiceUUID)
|
||||
}
|
||||
price, err := service.BundleProvider.CalculatePrice(context.Background(), &bundle.CalculatePriceRequest{
|
||||
Uuid: i.ValueUid,
|
||||
Num: i.Num,
|
||||
Language: req.Language,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, 0, "", err
|
||||
}
|
||||
addTotalPrice += price.Price
|
||||
|
||||
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(),
|
||||
&bundle.ValueAddServiceDetailRequest{Uuid: i.ValueUid, Language: req.Language})
|
||||
if err != nil {
|
||||
return nil, 0, "", err
|
||||
}
|
||||
addRecords = append(addRecords, buildAddRecord(addService, i.ValueUid, price.Price, i.Num, 2))
|
||||
}
|
||||
|
||||
// 套餐权益
|
||||
for uid := range bundleUidService {
|
||||
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(),
|
||||
&bundle.ValueAddServiceDetailRequest{Uuid: uid, Language: req.Language})
|
||||
if err != nil {
|
||||
return nil, 0, "", err
|
||||
}
|
||||
var num int32
|
||||
for _, s := range addService.Options {
|
||||
if s.IsDefault {
|
||||
num = s.Num
|
||||
break
|
||||
}
|
||||
}
|
||||
addRecords = append(addRecords, buildAddRecord(addService, uid, 0, num, 1))
|
||||
|
||||
// 计算到期时间
|
||||
if addService.ServiceType == 5 {
|
||||
expirationDay = calculateExpirationDate(time.Now(), num, addService.Unit)
|
||||
} else {
|
||||
expirationDay = time.Now().AddDate(0, 0, 7).Format("2006-01-02")
|
||||
}
|
||||
}
|
||||
|
||||
return addRecords, addTotalPrice, expirationDay, nil
|
||||
}
|
||||
|
||||
// 构建单条服务记录
|
||||
func buildAddRecord(addService *bundle.ValueAddServiceLang, uid string, price float32, num int32, equityType int32) *bundle.OrderCreateAddRecord {
|
||||
return &bundle.OrderCreateAddRecord{
|
||||
ServiceType: addService.ServiceType,
|
||||
ValueUid: uid,
|
||||
CurrencyType: addService.PriceType,
|
||||
Amount: price,
|
||||
Num: num,
|
||||
Unit: addService.Unit,
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
EquityType: equityType,
|
||||
QuotaType: addService.QuotaType,
|
||||
QuotaValue: addService.QuotaValue,
|
||||
IsExpired: addService.IsExpired,
|
||||
}
|
||||
}
|
||||
|
||||
// 组装订单请求
|
||||
func BuildOrderRequest(req *bundle.OrderCreateRecord, userInfo login.Info,
|
||||
bundleDetail *bundle.BundleProfileLang, addRecords []*bundle.OrderCreateAddRecord,
|
||||
addTotalPrice float32, lastContractNo, signContract string) bundle.OrderCreateRecord {
|
||||
|
||||
req.CustomerNum = userInfo.SubNum
|
||||
req.CustomerName = userInfo.Name
|
||||
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
|
||||
req.BundleName = bundleDetail.Name
|
||||
req.Amount = bundleDetail.Price
|
||||
req.AmountType = bundleDetail.PriceType
|
||||
req.TotalAmount = bundleDetail.Price + addTotalPrice
|
||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||
req.SignContract = signContract
|
||||
req.SignedTime = common.GetBeijingTime()
|
||||
req.Status = bundleModel.OrderSigned
|
||||
req.AddRecords = addRecords
|
||||
req.PayType = 1
|
||||
return req
|
||||
}
|
||||
func calculateExpirationDate(startDate time.Time, num int32, unit string) string {
|
||||
//now := time.Now()
|
||||
switch unit {
|
||||
case "天":
|
||||
return startDate.AddDate(0, 0, int(num)).Format("2006-01-02")
|
||||
case "月":
|
||||
return startDate.AddDate(0, int(num), 0).Format("2006-01-02")
|
||||
case "年":
|
||||
return startDate.AddDate(int(num), 0, 0).Format("2006-01-02")
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
@ -1,17 +1,24 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/pkg/model"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||
"fonchain-fiee/pkg/service/upload"
|
||||
"github.com/signintech/gopdf"
|
||||
"go.uber.org/zap"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/signintech/gopdf"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func SignContractV2(customerNum, contract string, price float32, expirationDate string) (outputUrl string, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user