Browse Source

支持“AccountFundInfoReq”业务接口

zhou.xiaoning 3 years ago
parent
commit
c3bc737175
7 changed files with 307 additions and 11 deletions
  1. 3 3
      config.yaml
  2. 3 0
      global/funcode.go
  3. 3 0
      global/topic.go
  4. 20 0
      initialize/rabbitmq.go
  5. 18 0
      model/mq/request/mq.go
  6. 240 8
      res/pb/mtp2.pb.go
  7. 20 0
      res/pb/mtp2.proto

+ 3 - 3
config.yaml

@@ -20,7 +20,7 @@ jwt:
 # redis configuration
 redis:
   db: 0
-  addr: '192.168.31.167:5007'
+  addr: '192.168.31.201:5007'
   password: ''
 
 # system configuration
@@ -39,14 +39,14 @@ oracle:
   address: '192.168.31.88'
   name: 'orcl'
   port: '1521'
-  user: 'mtp2_test167'
+  user: 'mtp2_test201'
   pwd: 'muchinfo'
   max-idle-conns: 10
   max-open-conns: 100
 
 # rabbitmq configuration
 rabbitmq:
-  url: 'amqp://guest:guest@192.168.31.167:5020/test'
+  url: 'amqp://guest:guest@192.168.31.201:5020/test'
   exchange: 'entry'
 
 # 跨域配置

+ 3 - 0
global/funcode.go

@@ -1,6 +1,9 @@
 package global
 
 var (
+	AccountFundInfoReq = 262150 // 账户资金信息请求
+	AccountFundInfoRsp = 262151 // 账户资金信息响应
+
 	ModifyPwdReq            = 65543   // 修改账户密码请求
 	ModifyPwdRsp            = 65544   // 修改账户密码应答
 	UserReceiveInfoReq      = 1900545 // 新增修改收货地址请求

+ 3 - 0
global/topic.go

@@ -10,6 +10,9 @@ var (
 	TOPIC_REQ_BANK = "bank_req" // 银行请求
 	TOPIC_RSP_BANK = "bank_rsp" // 银行回应
 
+	TOPIC_REQ_MONEY = "money_req" // 资金请求
+	TOPIC_RSP_MONEY = "money_rsp" // 资金应答
+
 	TOPIC_PERFORMANCE_REQ = "performance_req" // 履约请求
 	TOPIC_PERFORMANCE_RSP = "performance_rsp" // 履约回应
 

+ 20 - 0
initialize/rabbitmq.go

@@ -421,6 +421,19 @@ func (t *MQProc) getRspProtobuf(msg *[]byte) (funcode uint32, sessionId uint32,
 			bytes = &bs
 			serialNumber = p.GetHeader().GetRequestID()
 		}
+	case global.AccountFundInfoRsp: // 账户资金信息响应
+		var p pb.AccountFundInfoRsp
+		if err = proto.Unmarshal(b, &p); err != nil {
+			global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
+			return
+		}
+		if bs, e := protojson.Marshal(&p); e != nil {
+			global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
+			return
+		} else {
+			bytes = &bs
+			serialNumber = p.GetHeader().GetRequestID()
+		}
 	}
 
 	return
@@ -441,6 +454,10 @@ func RabbitMQSubscribeTopic() (err error) {
 		global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
 		return
 	}
+	if err = global.SubscribeTopic(global.TOPIC_RSP_MONEY); err != nil {
+		global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
+		return
+	}
 	if err = global.SubscribeTopic(global.TOPIC_PERFORMANCE_RSP); err != nil {
 		global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
 		return
@@ -511,6 +528,9 @@ func InitFuncodeTopic() {
 		global.T2bBankWithdrawReq,
 		global.T2bBankDepositReq,
 	}
+	global.M2A_FuncodeTopic[global.TOPIC_REQ_MONEY] = []int{
+		global.AccountFundInfoReq,
+	}
 	global.M2A_FuncodeTopic[global.TOPIC_PERFORMANCE_REQ] = []int{
 		global.PerformanceContractedApplyReq,
 		global.PerformanceDelayApplyReq,

+ 18 - 0
model/mq/request/mq.go

@@ -550,6 +550,24 @@ func (r *MQBodyReq) GetProtoBytes(serialNumber *uint32) (bytes *[]byte, err erro
 		} else {
 			bytes = &b
 		}
+	case global.AccountFundInfoReq:
+		m := pb.AccountFundInfoReq{}
+		if err = r.reflect(data, &m); err != nil {
+			return
+		}
+		if m.Header != nil {
+			m.Header.RequestID = serialNumber
+		} else {
+			err = errors.New("请求信息序列化失败")
+			return
+		}
+		if b, e := proto.Marshal(&m); e != nil {
+			global.M2A_LOG.Error(e.Error(), zap.Error(e))
+			err = errors.New("请求信息序列化失败")
+			return
+		} else {
+			bytes = &b
+		}
 	}
 
 	return

+ 240 - 8
res/pb/mtp2.pb.go

@@ -7417,6 +7417,182 @@ func (x *BSFWMemberOperateRsp) GetClientSerialNo() string {
 	return ""
 }
 
+// 账户资金信息请求
+type AccountFundInfoReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Header       *MessageHead `protobuf:"bytes,1,opt,name=Header" json:"Header,omitempty"`
+	OrderId      *uint64      `protobuf:"varint,2,opt,name=OrderId" json:"OrderId,omitempty"`           // 查询委托单号
+	AccountId    *uint64      `protobuf:"varint,3,opt,name=AccountId" json:"AccountId,omitempty"`       // 查询资金账号
+	QueryBitMask *uint32      `protobuf:"varint,4,opt,name=QueryBitMask" json:"QueryBitMask,omitempty"` // 查询位掩码
+}
+
+func (x *AccountFundInfoReq) Reset() {
+	*x = AccountFundInfoReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[66]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *AccountFundInfoReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AccountFundInfoReq) ProtoMessage() {}
+
+func (x *AccountFundInfoReq) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[66]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use AccountFundInfoReq.ProtoReflect.Descriptor instead.
+func (*AccountFundInfoReq) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{66}
+}
+
+func (x *AccountFundInfoReq) GetHeader() *MessageHead {
+	if x != nil {
+		return x.Header
+	}
+	return nil
+}
+
+func (x *AccountFundInfoReq) GetOrderId() uint64 {
+	if x != nil && x.OrderId != nil {
+		return *x.OrderId
+	}
+	return 0
+}
+
+func (x *AccountFundInfoReq) GetAccountId() uint64 {
+	if x != nil && x.AccountId != nil {
+		return *x.AccountId
+	}
+	return 0
+}
+
+func (x *AccountFundInfoReq) GetQueryBitMask() uint32 {
+	if x != nil && x.QueryBitMask != nil {
+		return *x.QueryBitMask
+	}
+	return 0
+}
+
+// 账户资金信息响应
+type AccountFundInfoRsp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Header            *MessageHead `protobuf:"bytes,1,opt,name=Header" json:"Header,omitempty"`                         // 消息头
+	RetCode           *int32       `protobuf:"varint,2,opt,name=RetCode" json:"RetCode,omitempty"`                      // 返回码
+	RetDesc           *string      `protobuf:"bytes,3,opt,name=RetDesc" json:"RetDesc,omitempty"`                       // 描述信息
+	OrderId           *uint64      `protobuf:"varint,4,opt,name=OrderId" json:"OrderId,omitempty"`                      // 查询委托单号
+	AccountId         *uint64      `protobuf:"varint,5,opt,name=AccountId" json:"AccountId,omitempty"`                  // 查询资金账号
+	AvailableMargin   *float64     `protobuf:"fixed64,6,opt,name=AvailableMargin" json:"AvailableMargin,omitempty"`     // 可用保证金,查询位掩码:1
+	AvailableOutMoney *float64     `protobuf:"fixed64,7,opt,name=AvailableOutMoney" json:"AvailableOutMoney,omitempty"` // 可出资金,查询位掩码:2
+	IsCleanAccount    *int32       `protobuf:"varint,8,opt,name=IsCleanAccount" json:"IsCleanAccount,omitempty"`        // 是否是干净账户,查询位掩码:4
+}
+
+func (x *AccountFundInfoRsp) Reset() {
+	*x = AccountFundInfoRsp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[67]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *AccountFundInfoRsp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AccountFundInfoRsp) ProtoMessage() {}
+
+func (x *AccountFundInfoRsp) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[67]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use AccountFundInfoRsp.ProtoReflect.Descriptor instead.
+func (*AccountFundInfoRsp) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{67}
+}
+
+func (x *AccountFundInfoRsp) GetHeader() *MessageHead {
+	if x != nil {
+		return x.Header
+	}
+	return nil
+}
+
+func (x *AccountFundInfoRsp) GetRetCode() int32 {
+	if x != nil && x.RetCode != nil {
+		return *x.RetCode
+	}
+	return 0
+}
+
+func (x *AccountFundInfoRsp) GetRetDesc() string {
+	if x != nil && x.RetDesc != nil {
+		return *x.RetDesc
+	}
+	return ""
+}
+
+func (x *AccountFundInfoRsp) GetOrderId() uint64 {
+	if x != nil && x.OrderId != nil {
+		return *x.OrderId
+	}
+	return 0
+}
+
+func (x *AccountFundInfoRsp) GetAccountId() uint64 {
+	if x != nil && x.AccountId != nil {
+		return *x.AccountId
+	}
+	return 0
+}
+
+func (x *AccountFundInfoRsp) GetAvailableMargin() float64 {
+	if x != nil && x.AvailableMargin != nil {
+		return *x.AvailableMargin
+	}
+	return 0
+}
+
+func (x *AccountFundInfoRsp) GetAvailableOutMoney() float64 {
+	if x != nil && x.AvailableOutMoney != nil {
+		return *x.AvailableOutMoney
+	}
+	return 0
+}
+
+func (x *AccountFundInfoRsp) GetIsCleanAccount() int32 {
+	if x != nil && x.IsCleanAccount != nil {
+		return *x.IsCleanAccount
+	}
+	return 0
+}
+
 var File_mtp2_proto protoreflect.FileDescriptor
 
 var file_mtp2_proto_rawDesc = []byte{
@@ -8775,7 +8951,35 @@ var file_mtp2_proto_rawDesc = []byte{
 	0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44,
 	0x12, 0x26, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c,
 	0x4e, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
-	0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x6f,
+	0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x12, 0x41, 0x63, 0x63,
+	0x6f, 0x75, 0x6e, 0x74, 0x46, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12,
+	0x27, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+	0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x65, 0x61, 0x64,
+	0x52, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65,
+	0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72,
+	0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64,
+	0x12, 0x22, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74, 0x4d, 0x61, 0x73, 0x6b,
+	0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74,
+	0x4d, 0x61, 0x73, 0x6b, 0x22, 0xa9, 0x02, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
+	0x46, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x06, 0x48,
+	0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62,
+	0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x65, 0x61, 0x64, 0x52, 0x06, 0x48, 0x65,
+	0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18,
+	0x0a, 0x07, 0x52, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x07, 0x52, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65,
+	0x72, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72,
+	0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18,
+	0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64,
+	0x12, 0x28, 0x0a, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x72,
+	0x67, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c,
+	0x61, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x41, 0x76,
+	0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x75, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x18,
+	0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65,
+	0x4f, 0x75, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x49, 0x73, 0x43, 0x6c,
+	0x65, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05,
+	0x52, 0x0e, 0x49, 0x73, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
 }
 
 var (
@@ -8790,7 +8994,7 @@ func file_mtp2_proto_rawDescGZIP() []byte {
 	return file_mtp2_proto_rawDescData
 }
 
-var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 66)
+var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 68)
 var file_mtp2_proto_goTypes = []interface{}{
 	(*MessageHead)(nil),                         // 0: pb.MessageHead
 	(*NotifyHead)(nil),                          // 1: pb.NotifyHead
@@ -8858,6 +9062,8 @@ var file_mtp2_proto_goTypes = []interface{}{
 	(*CJJCMemberOperateRsp)(nil),                // 63: pb.CJJCMemberOperateRsp
 	(*BSFWMemberOperateReq)(nil),                // 64: pb.BSFWMemberOperateReq
 	(*BSFWMemberOperateRsp)(nil),                // 65: pb.BSFWMemberOperateRsp
+	(*AccountFundInfoReq)(nil),                  // 66: pb.AccountFundInfoReq
+	(*AccountFundInfoRsp)(nil),                  // 67: pb.AccountFundInfoRsp
 }
 var file_mtp2_proto_depIdxs = []int32{
 	0,  // 0: pb.ModifyPwdReq.Header:type_name -> pb.MessageHead
@@ -8926,11 +9132,13 @@ var file_mtp2_proto_depIdxs = []int32{
 	0,  // 63: pb.BSFWMemberOperateReq.Header:type_name -> pb.MessageHead
 	2,  // 64: pb.BSFWMemberOperateReq.FileDetails:type_name -> pb.FileDetail
 	0,  // 65: pb.BSFWMemberOperateRsp.Header:type_name -> pb.MessageHead
-	66, // [66:66] is the sub-list for method output_type
-	66, // [66:66] is the sub-list for method input_type
-	66, // [66:66] is the sub-list for extension type_name
-	66, // [66:66] is the sub-list for extension extendee
-	0,  // [0:66] is the sub-list for field type_name
+	0,  // 66: pb.AccountFundInfoReq.Header:type_name -> pb.MessageHead
+	0,  // 67: pb.AccountFundInfoRsp.Header:type_name -> pb.MessageHead
+	68, // [68:68] is the sub-list for method output_type
+	68, // [68:68] is the sub-list for method input_type
+	68, // [68:68] is the sub-list for extension type_name
+	68, // [68:68] is the sub-list for extension extendee
+	0,  // [0:68] is the sub-list for field type_name
 }
 
 func init() { file_mtp2_proto_init() }
@@ -9731,6 +9939,30 @@ func file_mtp2_proto_init() {
 				return nil
 			}
 		}
+		file_mtp2_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*AccountFundInfoReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_mtp2_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*AccountFundInfoRsp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -9738,7 +9970,7 @@ func file_mtp2_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_mtp2_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   66,
+			NumMessages:   68,
 			NumExtensions: 0,
 			NumServices:   0,
 		},

+ 20 - 0
res/pb/mtp2.proto

@@ -857,4 +857,24 @@ message BSFWMemberOperateRsp {
 			optional uint32 UserID = 4; // 用户ID
 			optional uint64 AccountID = 5; // 资金账号
 			optional string ClientSerialNo = 6; // 客户端流水号
+}
+
+// 账户资金信息请求
+message AccountFundInfoReq {
+	optional MessageHead Header = 1;
+		optional uint64 OrderId = 2; // 查询委托单号
+		optional uint64 AccountId = 3; // 查询资金账号
+		optional uint32 QueryBitMask = 4; // 查询位掩码
+}
+
+// 账户资金信息响应
+message AccountFundInfoRsp {
+	optional MessageHead Header = 1; // 消息头
+	optional int32 RetCode = 2; // 返回码
+	optional string RetDesc = 3; // 描述信息
+		optional uint64 OrderId = 4; // 查询委托单号
+		optional uint64 AccountId = 5; // 查询资金账号
+		optional double AvailableMargin = 6; // 可用保证金,查询位掩码:1
+		optional double AvailableOutMoney = 7; // 可出资金,查询位掩码:2
+		optional int32 IsCleanAccount = 8; // 是否是干净账户,查询位掩码:4
 }