Browse Source

feat:tidb

wangshan 2 years ago
parent
commit
5aadf39729

+ 15 - 15
jyBXCore/api/bxcore.api

@@ -59,14 +59,14 @@ type (
 	}
 	//参标项目
 	baseParam {
-		EntId        int64 `header:"entId,optional"`     // 企业id
-		EntUserId    int64 `header:"entUserId,optional"` // 企业下用户id
-		PositionType int64 `header:"positionType"`       // 职位类型 0个人 1企业
-		PositionId   int64 `header:"positionId"`
-		AccountId       string `header:"accountId,optional"`    //账户id
-		MgoUserId       string `header:"mgoUserId,optional"`    //原userId
-		AppId           string `header:"appId"`
-		UserId          string `header:"userId,optional"`
+		EntId        int64  `header:"entId,optional"`     // 企业id
+		EntUserId    int64  `header:"entUserId,optional"` // 企业下用户id
+		PositionType int64  `header:"positionType"`       // 职位类型 0个人 1企业
+		PositionId   int64  `header:"positionId"`
+		AccountId    string `header:"accountId,optional"` //账户id
+		MgoUserId    string `header:"mgoUserId,optional"` //原userId
+		AppId        string `header:"appId"`
+		UserId       string `header:"userId,optional"`
 	}
 	// 列表数据参标信息请求参数
 	participateShowReq {
@@ -114,17 +114,17 @@ type (
 	}
 	//消息提醒设置:
 	RemindRuleReq {
-		BidState  int `json:"bidState,optional"`  //投标规则类型;0:全部;1:直接投标;2:渠道投标
-		Remainder int `json:"remainder,optional"` //距离投标截止日期需要多久开始提醒 单位h
-		Node      int `json:"node,optional"`      //那个节点进行消息提醒;和投标项目阶段绑定
+		BidState  int64  `json:"bidState,optional"`  //投标规则类型;0:直接投标;1:渠道投标;
+		Remainder int64  `json:"remainder,optional"` //距离投标截止日期需要多久开始提醒 单位h
+		Node      string `json:"node,optional"`      //那个节点进行消息提醒;和投标项目阶段绑定
 	}
 	//参标设置信息接口
 	participateSetUpInfoReq {
 		baseParam
-		SetAction  string          `json:"setAction,optional"`  //默认空;U:更新
-		IsAllow    bool            `json:"isAllow,optional"`    //是否允许多人同时参标
-		BidType    []BidTypeReq    `json:"bidType,optional"`    //投标类型自定义内容
-		RemindRule []RemindRuleReq `json:"remindRule,optional"` //消息提醒
+		SetAction  string           `json:"setAction,optional"`  //默认空;U:更新
+		IsAllow    bool             `json:"isAllow,optional"`    //是否允许多人同时参标
+		BidType    []*BidTypeReq    `json:"bidType,optional"`    //投标类型自定义内容
+		RemindRule []*RemindRuleReq `json:"remindRule,optional"` //消息提醒
 	}
 	//用户参标、终止参标及划转接口开发
 	participateActionReq {

+ 44 - 3
jyBXCore/api/internal/logic/participateSetUpInfoLogic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"jyBXCore/rpc/type/bxcore"
 	"net/http"
 
 	"jyBXCore/api/internal/svc"
@@ -27,7 +28,47 @@ func NewParticipateSetUpInfoLogic(ctx context.Context, svcCtx *svc.ServiceContex
 }
 
 func (l *ParticipateSetUpInfoLogic) ParticipateSetUpInfo(req *types.ParticipateSetUpInfoReq) (resp *types.CommonResp, err error) {
-	logx.Info(req)
-
-	return
+	var (
+		bidType    []*bxcore.BidTypeReq
+		remindRule []*bxcore.RemindRuleReq
+	)
+	if len(req.BidType) > 0 {
+		for _, v := range req.BidType {
+			bidType = append(bidType, &bxcore.BidTypeReq{
+				Name:    v.Name,
+				Content: v.Content,
+			})
+		}
+	}
+	if len(req.RemindRule) > 0 {
+		for _, v := range req.RemindRule {
+			remindRule = append(remindRule, &bxcore.RemindRuleReq{
+				BidState:  v.BidState,
+				Remainder: v.Remainder,
+				Node:      v.Node,
+			})
+		}
+	}
+	res, err := l.svcCtx.BxCore.ParticipateSetUpInfo(l.ctx, &bxcore.ParticipateSetUpInfoReq{
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionId:   req.PositionId,
+		PositionType: req.PositionType,
+		SetAction:    req.SetAction,
+		IsAllow:      req.IsAllow,
+		BidType:      bidType,
+		RemindRule:   remindRule,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: res.ErrCode,
+			Err_msg:  res.ErrMsg,
+			Data:     false,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res.Data,
+	}, nil
 }

+ 15 - 11
jyBXCore/api/internal/types/types.go

@@ -52,10 +52,14 @@ type SearchLimitReq struct {
 }
 
 type BaseParam struct {
-	EntId        int64 `header:"entId,optional"`     // 企业id
-	EntUserId    int64 `header:"entUserId,optional"` // 企业下用户id
-	PositionType int64 `header:"positionType"`       // 职位类型 0个人 1企业
-	PositionId   int64 `header:"positionId"`
+	EntId        int64  `header:"entId,optional"`     // 企业id
+	EntUserId    int64  `header:"entUserId,optional"` // 企业下用户id
+	PositionType int64  `header:"positionType"`       // 职位类型 0个人 1企业
+	PositionId   int64  `header:"positionId"`
+	AccountId    string `header:"accountId,optional"` //账户id
+	MgoUserId    string `header:"mgoUserId,optional"` //原userId
+	AppId        string `header:"appId"`
+	UserId       string `header:"userId,optional"`
 }
 
 type ParticipateShowReq struct {
@@ -102,17 +106,17 @@ type BidTypeReq struct {
 }
 
 type RemindRuleReq struct {
-	BidState  int `json:"bidState,optional"`  //投标规则类型;0:全部;1:直接投标;2:渠道投标
-	Remainder int `json:"remainder,optional"` //距离投标截止日期需要多久开始提醒 单位h
-	Node      int `json:"node,optional"`      //那个节点进行消息提醒;和投标项目阶段绑定
+	BidState  int64  `json:"bidState,optional"`  //投标规则类型;0:直接投标;1:渠道投标;
+	Remainder int64  `json:"remainder,optional"` //距离投标截止日期需要多久开始提醒 单位h
+	Node      string `json:"node,optional"`      //那个节点进行消息提醒;和投标项目阶段绑定
 }
 
 type ParticipateSetUpInfoReq struct {
 	BaseParam
-	SetAction  string          `json:"setAction,optional"`  //默认空;U:更新
-	IsAllow    bool            `json:"isAllow,optional"`    //是否允许多人同时参标
-	BidType    []BidTypeReq    `json:"bidType,optional"`    //投标类型自定义内容
-	RemindRule []RemindRuleReq `json:"remindRule,optional"` //消息提醒
+	SetAction  string           `json:"setAction,optional"`  //默认空;U:更新
+	IsAllow    bool             `json:"isAllow,optional"`    //是否允许多人同时参标
+	BidType    []*BidTypeReq    `json:"bidType,optional"`    //投标类型自定义内容
+	RemindRule []*RemindRuleReq `json:"remindRule,optional"` //消息提醒
 }
 
 type ParticipateActionReq struct {

+ 1 - 0
jyBXCore/entity/db.go

@@ -22,6 +22,7 @@ type MongoStruct struct {
 //
 type Mysql struct {
 	Main *MysqlStruct `json:"main"`
+	Base *MysqlStruct `json:"base"`
 }
 
 //mysql

+ 2 - 2
jyBXCore/rpc/bxcore.proto

@@ -311,9 +311,9 @@ message  BidTypeReq{
 }
 //消息提醒设置:
 message  RemindRuleReq{
-  int64 bidState = 1; //投标规则类型;0:全部;1:直接投标;2:渠道投标
+  int64 bidState = 1; //投标规则类型;0:直接投标;1:渠道投标;
   int64 remainder = 2;//距离投标截止日期需要多久开始提醒 单位h
-  int64 node = 3;//那个节点进行消息提醒;和投标项目阶段绑定
+  string node = 3;//那个节点进行消息提醒;和投标项目阶段绑定
 }
 //设置信息内容
 message ParticipateSetUpInfo{

+ 101 - 8
jyBXCore/rpc/bxcore/bxcore.go

@@ -13,20 +13,65 @@ import (
 )
 
 type (
-	PInfo           = bxcore.PInfo
-	SearchData      = bxcore.SearchData
-	SearchLimitReq  = bxcore.SearchLimitReq
-	SearchLimitResp = bxcore.SearchLimitResp
-	SearchList      = bxcore.SearchList
-	SearchReq       = bxcore.SearchReq
-	SearchResp      = bxcore.SearchResp
-	WinnerInfo      = bxcore.WinnerInfo
+	BidTypeReq                 = bxcore.BidTypeReq
+	PInfo                      = bxcore.PInfo
+	ParticipateActionReq       = bxcore.ParticipateActionReq
+	ParticipateActionRes       = bxcore.ParticipateActionRes
+	ParticipateContentData     = bxcore.ParticipateContentData
+	ParticipateContentReq      = bxcore.ParticipateContentReq
+	ParticipateContentRes      = bxcore.ParticipateContentRes
+	ParticipateData            = bxcore.ParticipateData
+	ParticipateDetailInfo      = bxcore.ParticipateDetailInfo
+	ParticipateInfoReq         = bxcore.ParticipateInfoReq
+	ParticipateInfoRes         = bxcore.ParticipateInfoRes
+	ParticipateList            = bxcore.ParticipateList
+	ParticipateListReq         = bxcore.ParticipateListReq
+	ParticipateListRes         = bxcore.ParticipateListRes
+	ParticipatePerson          = bxcore.ParticipatePerson
+	ParticipatePersonsReq      = bxcore.ParticipatePersonsReq
+	ParticipatePersonsRes      = bxcore.ParticipatePersonsRes
+	ParticipateRecords         = bxcore.ParticipateRecords
+	ParticipateRecordsReq      = bxcore.ParticipateRecordsReq
+	ParticipateRecordsRes      = bxcore.ParticipateRecordsRes
+	ParticipateRecordsRes_Data = bxcore.ParticipateRecordsRes_Data
+	ParticipateSetUpInfo       = bxcore.ParticipateSetUpInfo
+	ParticipateSetUpInfoReq    = bxcore.ParticipateSetUpInfoReq
+	ParticipateSetUpInfoRes    = bxcore.ParticipateSetUpInfoRes
+	ParticipateShowReq         = bxcore.ParticipateShowReq
+	ParticipateShowRes         = bxcore.ParticipateShowRes
+	RemindRuleReq              = bxcore.RemindRuleReq
+	SearchData                 = bxcore.SearchData
+	SearchLimitReq             = bxcore.SearchLimitReq
+	SearchLimitResp            = bxcore.SearchLimitResp
+	SearchList                 = bxcore.SearchList
+	SearchReq                  = bxcore.SearchReq
+	SearchResp                 = bxcore.SearchResp
+	ShowInfo                   = bxcore.ShowInfo
+	UpdateBidStatusReq         = bxcore.UpdateBidStatusReq
+	UpdateBidStatusRes         = bxcore.UpdateBidStatusRes
+	WinnerInfo                 = bxcore.WinnerInfo
 
 	BxCore interface {
 		// 标讯搜索结果列表数据
 		GetSearchList(ctx context.Context, in *SearchReq, opts ...grpc.CallOption) (*SearchResp, error)
 		// 标讯搜索限制内容
 		SearchLimit(ctx context.Context, in *SearchLimitReq, opts ...grpc.CallOption) (*SearchLimitResp, error)
+		//  列表数据参标信息接口
+		ParticipateShow(ctx context.Context, in *ParticipateShowReq, opts ...grpc.CallOption) (*ParticipateShowRes, error)
+		//  详情页参标信息接口
+		ParticipateInfo(ctx context.Context, in *ParticipateInfoReq, opts ...grpc.CallOption) (*ParticipateInfoRes, error)
+		//   投标状态更新
+		UpdateBidStatus(ctx context.Context, in *UpdateBidStatusReq, opts ...grpc.CallOption) (*UpdateBidStatusRes, error)
+		//  获取投标状态信息
+		ParticipateContent(ctx context.Context, in *ParticipateContentReq, opts ...grpc.CallOption) (*ParticipateContentRes, error)
+		//  参标操作记录
+		ParticipateRecords(ctx context.Context, in *ParticipateRecordsReq, opts ...grpc.CallOption) (*ParticipateRecordsRes, error)
+		//  当前部门/企业下参标人员信息
+		ParticipatePersons(ctx context.Context, in *ParticipatePersonsReq, opts ...grpc.CallOption) (*ParticipatePersonsRes, error)
+		//  参标设置信息
+		ParticipateSetUpInfo(ctx context.Context, in *ParticipateSetUpInfoReq, opts ...grpc.CallOption) (*ParticipateSetUpInfoRes, error)
+		//  项目参标 终止参标 划转等动作
+		ParticipateAction(ctx context.Context, in *ParticipateActionReq, opts ...grpc.CallOption) (*ParticipateActionRes, error)
 	}
 
 	defaultBxCore struct {
@@ -51,3 +96,51 @@ func (m *defaultBxCore) SearchLimit(ctx context.Context, in *SearchLimitReq, opt
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.SearchLimit(ctx, in, opts...)
 }
+
+//  列表数据参标信息接口
+func (m *defaultBxCore) ParticipateShow(ctx context.Context, in *ParticipateShowReq, opts ...grpc.CallOption) (*ParticipateShowRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateShow(ctx, in, opts...)
+}
+
+//  详情页参标信息接口
+func (m *defaultBxCore) ParticipateInfo(ctx context.Context, in *ParticipateInfoReq, opts ...grpc.CallOption) (*ParticipateInfoRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateInfo(ctx, in, opts...)
+}
+
+//   投标状态更新
+func (m *defaultBxCore) UpdateBidStatus(ctx context.Context, in *UpdateBidStatusReq, opts ...grpc.CallOption) (*UpdateBidStatusRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.UpdateBidStatus(ctx, in, opts...)
+}
+
+//  获取投标状态信息
+func (m *defaultBxCore) ParticipateContent(ctx context.Context, in *ParticipateContentReq, opts ...grpc.CallOption) (*ParticipateContentRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateContent(ctx, in, opts...)
+}
+
+//  参标操作记录
+func (m *defaultBxCore) ParticipateRecords(ctx context.Context, in *ParticipateRecordsReq, opts ...grpc.CallOption) (*ParticipateRecordsRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateRecords(ctx, in, opts...)
+}
+
+//  当前部门/企业下参标人员信息
+func (m *defaultBxCore) ParticipatePersons(ctx context.Context, in *ParticipatePersonsReq, opts ...grpc.CallOption) (*ParticipatePersonsRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipatePersons(ctx, in, opts...)
+}
+
+//  参标设置信息
+func (m *defaultBxCore) ParticipateSetUpInfo(ctx context.Context, in *ParticipateSetUpInfoReq, opts ...grpc.CallOption) (*ParticipateSetUpInfoRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateSetUpInfo(ctx, in, opts...)
+}
+
+//  项目参标 终止参标 划转等动作
+func (m *defaultBxCore) ParticipateAction(ctx context.Context, in *ParticipateActionReq, opts ...grpc.CallOption) (*ParticipateActionRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ParticipateAction(ctx, in, opts...)
+}

+ 7 - 0
jyBXCore/rpc/etc/db.yaml

@@ -6,6 +6,13 @@ mysql:
         password: Topnet123
         maxOpenConns: 5
         maxIdleConns: 5
+    base:
+        dbName: base_service
+        address: 192.168.3.217:4000
+        userName: root
+        password: =PDT49#80Z!RVv52_z
+        maxOpenConns: 5
+        maxIdleConns: 5
 redis:
     addr:
         - other=192.168.3.149:1712

+ 14 - 0
jyBXCore/rpc/init/db.go

@@ -17,6 +17,7 @@ import (
 
 var (
 	MainMysql  *mysql.Mysql
+	BaseMysql  *mysql.Mysql
 	Mgo        mongodb.MongodbSim
 	MgoBidding mongodb.MongodbSim //标讯详情等(第一版没用)
 )
@@ -62,6 +63,19 @@ func MysqlInit(mm *entity.Mysql) {
 		}
 		MainMysql.Init()
 	}
+	//初始化 mysql-base
+	if mm.Base.Address != "" {
+		logx.Info("--初始化 tidb--")
+		BaseMysql = &mysql.Mysql{
+			Address:      mm.Base.Address,
+			UserName:     mm.Base.UserName,
+			PassWord:     mm.Base.Password,
+			DBName:       mm.Base.DbName,
+			MaxOpenConns: mm.Base.MaxOpenConns,
+			MaxIdleConns: mm.Base.MaxIdleConns,
+		}
+		BaseMysql.Init()
+	}
 }
 
 //

+ 2 - 3
jyBXCore/rpc/internal/logic/participatesetupinfologic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"jyBXCore/rpc/service"
 
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/type/bxcore"
@@ -25,7 +26,5 @@ func NewParticipateSetUpInfoLogic(ctx context.Context, svcCtx *svc.ServiceContex
 
 //  参标设置信息
 func (l *ParticipateSetUpInfoLogic) ParticipateSetUpInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfoRes, error) {
-	// todo: add your logic here and delete this line
-
-	return &bxcore.ParticipateSetUpInfoRes{}, nil
+	return service.GetParticipateSetInfo(in)
 }

+ 11 - 0
jyBXCore/rpc/model/tidb/tidb.go

@@ -0,0 +1,11 @@
+package tidb
+
+import (
+	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/type/bxcore"
+)
+
+//查询企业|个人参标设置信息
+func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) {
+	IC.Mgo.FindOne("participate", map[string]interface{}{})
+}

+ 17 - 0
jyBXCore/rpc/service/participate.go

@@ -0,0 +1,17 @@
+package service
+
+import (
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXCore/rpc/type/bxcore"
+)
+
+func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfoRes, error) {
+	logx.Info(in)
+	switch in.SetAction {
+	case "U": //update 更新设置信息
+	default: //默认查询对应设置信息
+		//查询对应用户设置信息
+		//未设置过 返回默认配置
+	}
+	return &bxcore.ParticipateSetUpInfoRes{}, nil
+}

+ 6 - 6
jyBXCore/rpc/type/bxcore/bxcore.pb.go

@@ -2823,9 +2823,9 @@ type RemindRuleReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	BidState  int64 `protobuf:"varint,1,opt,name=bidState,proto3" json:"bidState,omitempty"`   //投标规则类型;0:全部;1:直接投标;2:渠道投标
-	Remainder int64 `protobuf:"varint,2,opt,name=remainder,proto3" json:"remainder,omitempty"` //距离投标截止日期需要多久开始提醒 单位h
-	Node      int64 `protobuf:"varint,3,opt,name=node,proto3" json:"node,omitempty"`           //那个节点进行消息提醒;和投标项目阶段绑定
+	BidState  int64  `protobuf:"varint,1,opt,name=bidState,proto3" json:"bidState,omitempty"`   //投标规则类型;0:直接投标;1:渠道投标;
+	Remainder int64  `protobuf:"varint,2,opt,name=remainder,proto3" json:"remainder,omitempty"` //距离投标截止日期需要多久开始提醒 单位h
+	Node      string `protobuf:"bytes,3,opt,name=node,proto3" json:"node,omitempty"`            //那个节点进行消息提醒;和投标项目阶段绑定
 }
 
 func (x *RemindRuleReq) Reset() {
@@ -2874,11 +2874,11 @@ func (x *RemindRuleReq) GetRemainder() int64 {
 	return 0
 }
 
-func (x *RemindRuleReq) GetNode() int64 {
+func (x *RemindRuleReq) GetNode() string {
 	if x != nil {
 		return x.Node
 	}
-	return 0
+	return ""
 }
 
 //设置信息内容
@@ -4068,7 +4068,7 @@ var file_bxcore_proto_rawDesc = []byte{
 	0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x64,
 	0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e,
 	0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x74,
+	0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x74,
 	0x69, 0x63, 0x69, 0x70, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x55, 0x70, 0x49, 0x6e, 0x66, 0x6f,
 	0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28,
 	0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x12, 0x2c, 0x0a, 0x07, 0x62, 0x69,