wangshan 2 gadi atpakaļ
vecāks
revīzija
fc2d673fe7

+ 25 - 3
jyBXCore/api/internal/logic/participateContentLogic.go

@@ -2,6 +2,7 @@ package logic
 
 
 import (
 import (
 	"context"
 	"context"
+	"jyBXCore/rpc/type/bxcore"
 	"net/http"
 	"net/http"
 
 
 	"jyBXCore/api/internal/svc"
 	"jyBXCore/api/internal/svc"
@@ -27,7 +28,28 @@ func NewParticipateContentLogic(ctx context.Context, svcCtx *svc.ServiceContext,
 }
 }
 
 
 func (l *ParticipateContentLogic) ParticipateContent(req *types.ParticipateContentReq) (resp *types.CommonResp, err error) {
 func (l *ParticipateContentLogic) ParticipateContent(req *types.ParticipateContentReq) (resp *types.CommonResp, err error) {
-	// todo: add your logic here and delete this line
-
-	return
+	res, err := l.svcCtx.BxCore.ParticipateContent(l.ctx, &bxcore.ParticipateContentReq{
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionId:   req.PositionId,
+		PositionType: req.PositionType,
+		AppId:        req.AppId,
+		MgoUserId:    req.MgoUserId,
+		AccountId:    req.AccountId,
+		UserId:       req.UserId,
+		NewUserId:    req.NewUserId,
+		Sid:          req.Sid,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: -1,
+			Err_msg:  "查询失败",
+			Data:     map[string]interface{}{},
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res.Data,
+	}, nil
 }
 }

+ 3 - 3
jyBXCore/api/internal/logic/participateInfoLogic.go

@@ -42,9 +42,9 @@ func (l *ParticipateInfoLogic) ParticipateInfo(req *types.ParticipateInfoReq) (r
 	})
 	})
 	if err != nil {
 	if err != nil {
 		return &types.CommonResp{
 		return &types.CommonResp{
-			Err_code: res.ErrCode,
-			Err_msg:  res.ErrMsg,
-			Data:     false,
+			Err_code: -1,
+			Err_msg:  "查询失败",
+			Data:     map[string]interface{}{},
 		}, nil
 		}, nil
 	}
 	}
 	return &types.CommonResp{
 	return &types.CommonResp{

+ 30 - 3
jyBXCore/api/internal/logic/participateRecordsLogic.go

@@ -2,6 +2,7 @@ package logic
 
 
 import (
 import (
 	"context"
 	"context"
+	"jyBXCore/rpc/type/bxcore"
 	"net/http"
 	"net/http"
 
 
 	"jyBXCore/api/internal/svc"
 	"jyBXCore/api/internal/svc"
@@ -27,7 +28,33 @@ func NewParticipateRecordsLogic(ctx context.Context, svcCtx *svc.ServiceContext,
 }
 }
 
 
 func (l *ParticipateRecordsLogic) ParticipateRecords(req *types.ParticipateRecordsReq) (resp *types.CommonResp, err error) {
 func (l *ParticipateRecordsLogic) ParticipateRecords(req *types.ParticipateRecordsReq) (resp *types.CommonResp, err error) {
-	// todo: add your logic here and delete this line
-
-	return
+	res, err := l.svcCtx.BxCore.ParticipateRecords(l.ctx, &bxcore.ParticipateRecordsReq{
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionId:   req.PositionId,
+		PositionType: req.PositionType,
+		AppId:        req.AppId,
+		MgoUserId:    req.MgoUserId,
+		AccountId:    req.AccountId,
+		UserId:       req.UserId,
+		NewUserId:    req.NewUserId,
+		Sid:          req.Sid,
+		PageSize:     req.PageSize,
+		Page:         req.Page,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: -1,
+			Err_msg:  "查询失败",
+			Data: map[string]interface{}{
+				"list":  []map[string]interface{}{},
+				"total": 0,
+			},
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res.Data,
+	}, nil
 }
 }

+ 3 - 3
jyBXCore/api/internal/logic/participateShowLogic.go

@@ -42,9 +42,9 @@ func (l *ParticipateShowLogic) ParticipateShow(req *types.ParticipateShowReq) (r
 	})
 	})
 	if err != nil {
 	if err != nil {
 		return &types.CommonResp{
 		return &types.CommonResp{
-			Err_code: res.ErrCode,
-			Err_msg:  res.ErrMsg,
-			Data:     false,
+			Err_code: -1,
+			Err_msg:  "查询失败",
+			Data:     []map[string]interface{}{},
 		}, nil
 		}, nil
 	}
 	}
 	return &types.CommonResp{
 	return &types.CommonResp{

+ 32 - 3
jyBXCore/api/internal/logic/updateBidStatusLogic.go

@@ -2,6 +2,7 @@ package logic
 
 
 import (
 import (
 	"context"
 	"context"
+	"jyBXCore/rpc/type/bxcore"
 	"net/http"
 	"net/http"
 
 
 	"jyBXCore/api/internal/svc"
 	"jyBXCore/api/internal/svc"
@@ -27,7 +28,35 @@ func NewUpdateBidStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext, r
 }
 }
 
 
 func (l *UpdateBidStatusLogic) UpdateBidStatus(req *types.UpdateBidStatusReq) (resp *types.CommonResp, err error) {
 func (l *UpdateBidStatusLogic) UpdateBidStatus(req *types.UpdateBidStatusReq) (resp *types.CommonResp, err error) {
-	// todo: add your logic here and delete this line
-
-	return
+	res, err := l.svcCtx.BxCore.UpdateBidStatus(l.ctx, &bxcore.UpdateBidStatusReq{
+		EntId:         req.EntId,
+		EntUserId:     req.EntUserId,
+		PositionId:    req.PositionId,
+		PositionType:  req.PositionType,
+		AppId:         req.AppId,
+		MgoUserId:     req.MgoUserId,
+		AccountId:     req.AccountId,
+		UserId:        req.UserId,
+		NewUserId:     req.NewUserId,
+		BidType:       req.BidType,
+		BidStage:      req.BidStage,
+		ChannelName:   req.ChannelName,
+		ChannelPerson: req.ChannelPerson,
+		ChannelPhone:  req.ChannelPhone,
+		IsWin:         req.IsWin,
+		Winner:        req.Winner,
+		Sid:           req.Sid,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: -1,
+			Err_msg:  "更新失败",
+			Data:     false,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res.Data,
+	}, nil
 }
 }

+ 2 - 10
jyBXCore/go.mod

@@ -6,8 +6,8 @@ require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
 	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
 	app.yhyue.com/moapp/jypkg v0.0.0-20230313120532-c305dbfd6a62
 	app.yhyue.com/moapp/jypkg v0.0.0-20230313120532-c305dbfd6a62
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/go-sql-driver/mysql v1.7.0
+	github.com/gogf/gf/v2 v2.0.6
 	github.com/zeromicro/go-zero v1.4.4
 	github.com/zeromicro/go-zero v1.4.4
 	google.golang.org/grpc v1.53.0
 	google.golang.org/grpc v1.53.0
 	google.golang.org/protobuf v1.28.1
 	google.golang.org/protobuf v1.28.1
@@ -16,8 +16,8 @@ require (
 require (
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 // indirect
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 // indirect
-	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
 	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
 	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447 // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13 // indirect
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
@@ -48,19 +48,15 @@ require (
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
-	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/compress v1.13.6 // indirect
 	github.com/klauspost/compress v1.13.6 // indirect
-	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mattn/go-colorable v0.1.9 // indirect
 	github.com/mattn/go-colorable v0.1.9 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
-	github.com/nsqio/go-nsq v1.1.0 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
-	github.com/olivere/elastic/v7 v7.0.22 // indirect
 	github.com/openzipkin/zipkin-go v0.4.0 // indirect
 	github.com/openzipkin/zipkin-go v0.4.0 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
@@ -69,13 +65,10 @@ require (
 	github.com/prometheus/common v0.37.0 // indirect
 	github.com/prometheus/common v0.37.0 // indirect
 	github.com/prometheus/procfs v0.8.0 // indirect
 	github.com/prometheus/procfs v0.8.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
-	github.com/tealeg/xlsx v1.0.5 // indirect
-	github.com/thinxer/go-word2vec v0.0.0-20150917053916-5c19ec7379ed // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
@@ -104,7 +97,6 @@ require (
 	golang.org/x/time v0.3.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
 	google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
-	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect

+ 10 - 8
jyBXCore/rpc/bxcore.proto

@@ -174,6 +174,7 @@ message ParticipateDetailInfo{
   bool showStopParticipate = 2;//
   bool showStopParticipate = 2;//
   bool showTransfer = 3;// 转给同事按钮是否展示:true-展示 false-不展示
   bool showTransfer = 3;// 转给同事按钮是否展示:true-展示 false-不展示
   string userName = 4;//参标人姓名 逗号分割
   string userName = 4;//参标人姓名 逗号分割
+  string projectId = 5;// 项目id
 
 
 }
 }
 message ParticipateInfoRes{
 message ParticipateInfoRes{
@@ -232,6 +233,7 @@ message ParticipateContentData{
   string channelName = 4; // 渠道名称
   string channelName = 4; // 渠道名称
   string channelPerson = 5; // 联系人
   string channelPerson = 5; // 联系人
   string channelPhone = 6; //联系电话
   string channelPhone = 6; //联系电话
+  string winner = 7;// 中标单位
 }
 }
 
 
 message ParticipateContentRes{
 message ParticipateContentRes{
@@ -257,18 +259,18 @@ message ParticipateRecordsReq{
 }
 }
 // 参标操作记录返回
 // 参标操作记录返回
 message ParticipateRecords{
 message ParticipateRecords{
-  string recordsData = 1;
-  string updateDate = 2;
-  string updatePerson = 3;
+  string recordsData = 1; // 操作记录
+  string updateDate = 2;  // 更新时间
+  string updatePerson = 3; // 更新人
+}
+message ParticipateRecordsData {
+  repeated ParticipateRecords list = 1; // 操作记录
+  int64 total = 2 ;
 }
 }
-
 message ParticipateRecordsRes{
 message ParticipateRecordsRes{
   int64 err_code = 1;
   int64 err_code = 1;
   string err_msg = 2;
   string err_msg = 2;
-  message Data {
-    repeated ParticipateRecords list = 1; // 操作记录
-    int64 total = 2 ;
-  }
+  ParticipateRecordsData data = 3;
 }
 }
 // 当前部门/企业下参标人员信息
 // 当前部门/企业下参标人员信息
 message ParticipatePersonsReq{
 message ParticipatePersonsReq{

+ 37 - 37
jyBXCore/rpc/bxcore/bxcore.go

@@ -13,43 +13,43 @@ import (
 )
 )
 
 
 type (
 type (
-	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
+	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
+	ParticipateRecordsData  = bxcore.ParticipateRecordsData
+	ParticipateRecordsReq   = bxcore.ParticipateRecordsReq
+	ParticipateRecordsRes   = bxcore.ParticipateRecordsRes
+	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 {
 	BxCore interface {
 		// 标讯搜索结果列表数据
 		// 标讯搜索结果列表数据

+ 36 - 3
jyBXCore/rpc/internal/logic/participatecontentlogic.go

@@ -1,7 +1,12 @@
 package logic
 package logic
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"context"
 	"context"
+	"fmt"
+	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/model/es"
+	"jyBXCore/rpc/service"
 
 
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
@@ -25,7 +30,35 @@ func NewParticipateContentLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 
 
 //  获取投标状态信息
 //  获取投标状态信息
 func (l *ParticipateContentLogic) ParticipateContent(in *bxcore.ParticipateContentReq) (*bxcore.ParticipateContentRes, error) {
 func (l *ParticipateContentLogic) ParticipateContent(in *bxcore.ParticipateContentReq) (*bxcore.ParticipateContentRes, error) {
-	// todo: add your logic here and delete this line
-
-	return &bxcore.ParticipateContentRes{}, nil
+	// 验证权限
+	result := &bxcore.ParticipateContentRes{}
+	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回不展示
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	// 不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		return result, fmt.Errorf("没权限")
+	}
+	participateService := service.NewParticipateBid(in.EntId, in.EntUserId, in.PositionType, in.PositionId)
+	participateService.EntRoleId = userInfo.Ent.EntRoleId
+	// 信息id解密
+	infoList, _ := service.DecodeId(in.Sid)
+	if len(infoList) == 0 {
+		return result, fmt.Errorf("信息id无效")
+	}
+	// 根据标讯id 查询项目信息
+	projectInfos := es.GetProjectByInfoId(infoList)
+	if projectInfos == nil || len(*projectInfos) == 0 {
+		return result, fmt.Errorf("无效的信息id")
+	}
+	// 验证身份
+	projectId := common.ObjToString((*projectInfos)[0]["_id"])
+	if !participateService.CheckBidPower(projectId, false) {
+		return result, fmt.Errorf("没有权限")
+	}
+	//  查询
+	data := participateService.GetLastBidStatus(projectId)
+	formatData := participateService.ParticipateContentFormat(data)
+	return &bxcore.ParticipateContentRes{
+		Data: &formatData,
+	}, nil
 }
 }

+ 6 - 6
jyBXCore/rpc/internal/logic/participateinfologic.go

@@ -57,25 +57,25 @@ func (l *ParticipateInfoLogic) ParticipateInfo(in *bxcore.ParticipateInfoReq) (*
 		return &result, nil
 		return &result, nil
 	}
 	}
 	// 判断是否已经过了开标时间
 	// 判断是否已经过了开标时间
-	var isVaild bool
+	var isValid bool
 	bidopentime := common.Int64All((*projectInfos)[0]["bidopentime"])
 	bidopentime := common.Int64All((*projectInfos)[0]["bidopentime"])
 	if time.Now().Unix() >= bidopentime || bidopentime == 0 {
 	if time.Now().Unix() >= bidopentime || bidopentime == 0 {
-		isVaild = true
+		isValid = true
 	}
 	}
 	//   获取项目id
 	//   获取项目id
 	_, projectIds := service.HandlerProjectId(*projectInfos, infoSet)
 	_, projectIds := service.HandlerProjectId(*projectInfos, infoSet)
 	//区分个人和企业
 	//区分个人和企业
-	var formatList *bxcore.ParticipateDetailInfo
+	var formatData *bxcore.ParticipateDetailInfo
 	switch int(in.PositionType) {
 	switch int(in.PositionType) {
 	case service.PositionTypePersonal:
 	case service.PositionTypePersonal:
 		existList := participateService.PersonalExistProject(projectIds)
 		existList := participateService.PersonalExistProject(projectIds)
-		formatList = participateService.DetailPersonalFormat(existList, isVaild)
+		formatData = participateService.DetailPersonalFormat(existList, isValid)
 	case service.PositionTypeEnt:
 	case service.PositionTypeEnt:
 		isAllow := util.IsALLow(in.EntId)
 		isAllow := util.IsALLow(in.EntId)
 		existList := participateService.EntExistProject(projectIds)                  // 查询出已经存在的
 		existList := participateService.EntExistProject(projectIds)                  // 查询出已经存在的
-		formatList = participateService.DetailEntFormat(existList, isVaild, isAllow) // 格式化数据
+		formatData = participateService.DetailEntFormat(existList, isValid, isAllow) // 格式化数据
 	}
 	}
-	result.Data = formatList
+	result.Data = formatData
 	return &result, nil
 	return &result, nil
 
 
 }
 }

+ 35 - 4
jyBXCore/rpc/internal/logic/participaterecordslogic.go

@@ -1,9 +1,13 @@
 package logic
 package logic
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"context"
 	"context"
-
+	"fmt"
+	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/internal/svc"
+	"jyBXCore/rpc/model/es"
+	"jyBXCore/rpc/service"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
 
 
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
@@ -25,7 +29,34 @@ func NewParticipateRecordsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 
 
 //  参标操作记录
 //  参标操作记录
 func (l *ParticipateRecordsLogic) ParticipateRecords(in *bxcore.ParticipateRecordsReq) (*bxcore.ParticipateRecordsRes, error) {
 func (l *ParticipateRecordsLogic) ParticipateRecords(in *bxcore.ParticipateRecordsReq) (*bxcore.ParticipateRecordsRes, error) {
-	// todo: add your logic here and delete this line
-
-	return &bxcore.ParticipateRecordsRes{}, nil
+	// 验证权限
+	result := &bxcore.ParticipateRecordsRes{}
+	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回不展示
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	// 不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		return result, fmt.Errorf("没权限")
+	}
+	participateService := service.NewParticipateBid(in.EntId, in.EntUserId, in.PositionType, in.PositionId)
+	participateService.EntRoleId = userInfo.Ent.EntRoleId
+	// 信息id解密
+	infoList, _ := service.DecodeId(in.Sid)
+	if len(infoList) == 0 {
+		return result, fmt.Errorf("信息id无效")
+	}
+	// 根据标讯id 查询项目信息
+	projectInfos := es.GetProjectByInfoId(infoList)
+	if projectInfos == nil || len(*projectInfos) == 0 {
+		return result, fmt.Errorf("无效的信息id")
+	}
+	// 验证身份
+	projectId := common.ObjToString((*projectInfos)[0]["_id"])
+	if !participateService.CheckBidPower(projectId, false) {
+		return result, fmt.Errorf("没有权限")
+	}
+	//  查询
+	data := participateService.GetBidRecords(projectId, in.Page, in.PageSize)
+	return &bxcore.ParticipateRecordsRes{
+		Data: data,
+	}, nil
 }
 }

+ 47 - 3
jyBXCore/rpc/internal/logic/updatebidstatuslogic.go

@@ -1,7 +1,13 @@
 package logic
 package logic
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"context"
 	"context"
+	"fmt"
+	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/model/es"
+	"jyBXCore/rpc/service"
+	"time"
 
 
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
@@ -25,7 +31,45 @@ func NewUpdateBidStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U
 
 
 //   投标状态更新
 //   投标状态更新
 func (l *UpdateBidStatusLogic) UpdateBidStatus(in *bxcore.UpdateBidStatusReq) (*bxcore.UpdateBidStatusRes, error) {
 func (l *UpdateBidStatusLogic) UpdateBidStatus(in *bxcore.UpdateBidStatusReq) (*bxcore.UpdateBidStatusRes, error) {
-	// todo: add your logic here and delete this line
-
-	return &bxcore.UpdateBidStatusRes{}, nil
+	result := &bxcore.UpdateBidStatusRes{}
+	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回不展示
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	// 不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		return result, fmt.Errorf("没权限")
+	}
+	participateService := service.NewParticipateBid(in.EntId, in.EntUserId, in.PositionType, in.PositionId)
+	participateService.EntRoleId = userInfo.Ent.EntRoleId
+	// 信息id解密
+	infoList, _ := service.DecodeId(in.Sid)
+	if len(infoList) == 0 {
+		return result, fmt.Errorf("信息id无效")
+	}
+	// 根据标讯id 查询项目信息
+	projectInfos := es.GetProjectByInfoId(infoList)
+	if projectInfos == nil || len(*projectInfos) == 0 {
+		return result, fmt.Errorf("无效的信息id")
+	}
+	// 判断是否已经过了开标时间
+	var isValid bool
+	bidopentime := common.Int64All((*projectInfos)[0]["bidopentime"])
+	projectId := common.ObjToString((*projectInfos)[0]["_id"])
+	if time.Now().Unix() >= bidopentime || bidopentime == 0 {
+		isValid = true
+	}
+	if !isValid {
+		return result, fmt.Errorf("已经过开标时间,无法更新")
+	}
+	// 验证身份
+	if !participateService.CheckBidPower(projectId, true) {
+		return result, fmt.Errorf("没有权限")
+	}
+	// 2. 更新
+	flag := participateService.UpdateBidStatus(in, projectId)
+	var err error
+	if !flag {
+		err = fmt.Errorf("更新失败")
+	}
+	result.Data = flag
+	return result, err
 }
 }

+ 330 - 45
jyBXCore/rpc/service/participateBid.go

@@ -2,24 +2,37 @@ package service
 
 
 import (
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"encoding/json"
 	"fmt"
 	"fmt"
+	"github.com/gogf/gf/v2/container/gset"
+	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXCore/rpc/init"
 	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/model/mysql"
 	"jyBXCore/rpc/type/bxcore"
 	"jyBXCore/rpc/type/bxcore"
+	"jyBXCore/rpc/util"
 	"strings"
 	"strings"
 )
 )
 
 
 const (
 const (
-	TableEntnicheUser       = "entniche_user"    // 企业用户表
-	TableParticipateUser    = "participate_user" // 参标用户表
-	PositionTypeEnt         = 1                  // 职位类型企业
-	PositionTypePersonal    = 0                  // 职位类型个人
-	ButtonValueParticipate  = 0                  // 参标按钮 显示值 0-参标
-	ButtonValueParticipated = 1                  // 按钮显示值 列表页面 1-已参标
-	RoleEntManager          = 1                  //  企业管理员角色
-	RoleDepartManager       = 2                  //  部门管理员角色
-	BidTypeDirect           = 1                  //  直接投标
-	BidTypeChanel           = 2                  //  渠道投标
+	TableEntnicheUser    = "entniche_user"    // 企业用户表
+	TableParticipateUser = "participate_user" // 参标用户表
+
+	PositionTypeEnt      = 1 // 职位类型企业
+	PositionTypePersonal = 0 // 职位类型个人
+
+	ButtonValueParticipate  = 0 // 参标按钮 显示值 0-参标
+	ButtonValueParticipated = 1 // 按钮显示值 列表页面 1-已参标
+
+	RoleEntManager    = 1 //  企业管理员角色
+	RoleDepartManager = 2 //  部门管理员角色
+
+	BidTypeDirect = 1 //  直接投标
+	BidTypeChanel = 2 //  渠道投标
+
+	RecordTypeBidStatus = 1 //  存储类型 1:投标状态更新
+
 )
 )
 
 
 type ParticipateBid struct {
 type ParticipateBid struct {
@@ -50,7 +63,7 @@ func (p *ParticipateBid) PersonalExistProject(projectId []string) map[string]str
 		value = append(value, projectId[i])
 		value = append(value, projectId[i])
 	}
 	}
 	argStr := strings.Join(arg, ",")
 	argStr := strings.Join(arg, ",")
-	query := "select project_id from " + TableParticipateUser + " where position_id = ? and project_id in (%s)  and state>=0"
+	query := "select project_id from " + TableParticipateUser + " where position_id = ? and project_id in (%s)  and state=0"
 	rs := IC.BaseMysql.SelectBySql(fmt.Sprintf(query, argStr), value...)
 	rs := IC.BaseMysql.SelectBySql(fmt.Sprintf(query, argStr), value...)
 	existProjectSet := map[string]struct{}{}
 	existProjectSet := map[string]struct{}{}
 	if rs != nil && len(*rs) > 0 { // 如果查到了  说明已经参标 这部分应该显示已参标
 	if rs != nil && len(*rs) > 0 { // 如果查到了  说明已经参标 这部分应该显示已参标
@@ -90,7 +103,7 @@ func (p *ParticipateBid) EntExistProject(projectId []string) map[string]string {
 		value = append(value, projectId[i])
 		value = append(value, projectId[i])
 	}
 	}
 	argStr := strings.Join(arg, ",")
 	argStr := strings.Join(arg, ",")
-	query := "select GROUP_CONCAT(ent_user_id) as personIds ,project_id from " + TableParticipateUser + " where ent_id=? and  project_id in (%s) and state>=0  group by project_id "
+	query := "select GROUP_CONCAT(ent_user_id) as personIds ,project_id from " + TableParticipateUser + " where ent_id=? and  project_id in (%s) and state=0  group by project_id "
 	rs := IC.BaseMysql.SelectBySql(fmt.Sprintf(query, argStr), value...)
 	rs := IC.BaseMysql.SelectBySql(fmt.Sprintf(query, argStr), value...)
 	existProjectMap := map[string]string{}
 	existProjectMap := map[string]string{}
 	if rs != nil && len(*rs) > 0 { // 如果查到了  说明这个项目公司里面已经参标 处理一下信息用于后边判断是否是自己参标
 	if rs != nil && len(*rs) > 0 { // 如果查到了  说明这个项目公司里面已经参标 处理一下信息用于后边判断是否是自己参标
@@ -141,7 +154,9 @@ func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isVa
 		return
 		return
 	}
 	}
 	persons := ""
 	persons := ""
-	for _, v := range existProjectMap { // 这是为了取参标人id信息 列表页是多条数据 详情页这里 map里面只会有一条数据
+	projectId := ""
+	for k, v := range existProjectMap { // 这是为了取参标人id信息 列表页是多条数据 详情页这里 map里面只会有一条数据
+		projectId = k
 		persons = v
 		persons = v
 		break
 		break
 	}
 	}
@@ -155,6 +170,7 @@ func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isVa
 	}
 	}
 	// 如果是管理员 显示 终止参标按钮、转给同事按钮
 	// 如果是管理员 显示 终止参标按钮、转给同事按钮
 	if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
 	if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
+		formatData.ProjectId = encrypt.EncodeArticleId2ByCheck(projectId)
 		formatData.ShowStopParticipate = true
 		formatData.ShowStopParticipate = true
 		formatData.ShowTransfer = true
 		formatData.ShowTransfer = true
 	}
 	}
@@ -243,45 +259,314 @@ func ContainId(ids string, objId string) bool {
 //  返回: "张三,李四,王五..."
 //  返回: "张三,李四,王五..."
 func GetNameByUserIds(ids string) *[]map[string]interface{} {
 func GetNameByUserIds(ids string) *[]map[string]interface{} {
 	query := "select  group_concat(name) as name  from " + TableEntnicheUser + " where id in (" + ids + ") "
 	query := "select  group_concat(name) as name  from " + TableEntnicheUser + " where id in (" + ids + ") "
-	fmt.Println(query)
 	rs := IC.MainMysql.SelectBySql(query)
 	rs := IC.MainMysql.SelectBySql(query)
 	return rs
 	return rs
 }
 }
 
 
-/*
-投标状态更新
-1. 验证参标人
-2. 更新 存操作记录
-*/
-// 更新投标状态
-func (p *ParticipateBid) updateBidStatus() {
+// CheckBidPower 投标状态更新/查看记录 验证权限(参标人或者是该企业下的管理员)
+func (p *ParticipateBid) CheckBidPower(projectId string, valid bool) (b bool) {
+
+	switch p.PositionType {
+	case PositionTypePersonal:
+		// 查个人id
+		b = mysql.CheckParticipatePersonal(projectId, p.PositionId, valid)
+	case PositionTypeEnt:
+		// 查企业
+		if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
+			b = mysql.CheckParticipateManager(projectId, p.EntId, valid)
+		} else {
+			// 查参标人
+			b = mysql.CheckParticipateEntUser(projectId, p.PositionId, valid)
+		}
+	}
+	return
+}
+
+// UpdateBidStatus 更新投标状态
+func (p *ParticipateBid) UpdateBidStatus(in *bxcore.UpdateBidStatusReq, projectId string) (flag bool) {
+	if p.PositionType == PositionTypeEnt {
+		pLock := util.GetParticipateLock(fmt.Sprintf("%d_%s", p.EntId, projectId))
+		pLock.Lock()
+		defer pLock.Unlock()
+	}
+	// 如果查出来旧的 那么就需要做新旧对比
+	oldMap := p.GetLastBidStatus(projectId) // 查询出最新的招标状态信息
+	// 新的
+	if in.BidStage == nil {
+		in.BidStage = []string{}
+	}
+	newMap := map[string]interface{}{
+		"bidType":       in.BidType,
+		"bidStage":      in.BidStage,
+		"isWin":         in.IsWin,
+		"channelName":   in.ChannelName,
+		"channelPerson": in.ChannelPerson,
+		"channelPhone":  in.ChannelPhone,
+		"winner":        in.Winner,
+	}
+	// 新旧对比 处理成要保存的字段
+	recordContent, err := processRecordStr(oldMap, newMap)
+	if err != nil {
+		return false
+	}
+	// 保存
+	recordData := map[string]interface{}{
+		"ent_id":         p.EntId,
+		"ent_user_id":    p.EntUserId,
+		"position_id":    p.PositionId,
+		"project_id":     projectId,
+		"record_content": recordContent,
+		"record_type":    RecordTypeBidStatus,
+		"create_date":    date.NowFormat(date.Date_Full_Layout),
+	}
+	flag = mysql.InsertBidContent(recordData)
+	return
+
+}
+
+// GetLastBidStatus 获取投标状态信息
+func (p *ParticipateBid) GetLastBidStatus(projectId string) map[string]interface{} {
+	rs := map[string]interface{}{}
+	// 查询项目投标信息 区分企业和个人
+	var result *[]map[string]interface{}
+	switch p.PositionType {
+	case PositionTypeEnt:
+		result = mysql.GetBidContentEnt(projectId, p.EntId)
+	case PositionTypePersonal:
+		result = mysql.GetBidContentPersonal(projectId, p.PositionId)
+	}
+	if rs != nil && len(*result) > 0 {
+		content := common.ObjToMap((*result)[0]["record_content"])
+		if content != nil {
+			bidStatus := common.ObjToMap((*content)["after"])
+			if bidStatus != nil {
+				rs = *bidStatus
+			}
+		}
+	}
+	return rs
+
+}
+func (p ParticipateBid) ParticipateContentFormat(data map[string]interface{}) (rs bxcore.ParticipateContentData) {
+	if data == nil {
+		return
+	}
+	rs.BidType = common.Int64All(data["bidType"])
+	rs.ChannelPhone = common.ObjToString(data["channelPhone"])
+	rs.ChannelPerson = common.ObjToString(data["channelPerson"])
+	rs.ChannelName = common.ObjToString(data["channelName"])
+	rs.IsWin = common.Int64All(data["isWin"])
+	rs.Winner = common.ObjToString(data["winner"])
+	tmp := data["bidStage"].([]interface{})
+	rs.BidStage = common.ObjArrToStringArr(tmp)
+
+	return rs
+}
+
+// GetBidRecords 获取操作记录
+func (p *ParticipateBid) GetBidRecords(projectId string, page, pageSize int64) *bxcore.ParticipateRecordsData {
+	data := bxcore.ParticipateRecordsData{}
+	var rs *[]map[string]interface{}
+	var total int64
+	if page < 1 {
+		page = 1
+	}
+	if pageSize == 0 {
+		pageSize = 500
+	}
+	switch p.PositionType {
+	case PositionTypeEnt:
+		// 1. 查询出操作记录
+		rs, total = mysql.GetBidRecordsEnt(projectId, p.EntId, page, pageSize)
+	case PositionTypePersonal:
+		//  个人版不展示姓名
+		rs, total = mysql.GetBidRecordsPersonal(projectId, p.PositionId, page, pageSize)
+
+	}
+	if rs == nil || len(*rs) == 0 {
+		return &data
+	}
+	data.Total = total
+	data.List = p.BidRecordsFormat(*rs)
+	return &data
+}
+
+// BidRecordsFormat 获取操作记录格式化
+func (p ParticipateBid) BidRecordsFormat(data []map[string]interface{}) []*bxcore.ParticipateRecords {
+	records := []*bxcore.ParticipateRecords{}
+	switch p.PositionType {
+
+	case PositionTypeEnt:
+		// 用户id
+		// 拿到所有的用户id
+		userIdArr := []string{}
+		userIdMap := map[int64]string{}
+		for i := 0; i < len(data); i++ {
+			userId := common.Int64All(data[i]["ent_user_id"])
+			if _, ok := userIdMap[userId]; !ok {
+				userIdMap[userId] = ""
+				userIdArr = append(userIdArr, fmt.Sprint(userId))
+			}
+		}
+
+		// 根据id查询出姓名{id:name}
+		userIdMap = getUserIdName(userIdArr)
+		// 遍历数据  换成姓名
+		for i := 0; i < len(data); i++ {
+			id := common.Int64All(data[i]["ent_user_id"])
+			person := ""
+			if name, ok := userIdMap[id]; ok {
+				person = name
+			}
+			tmp := bxcore.ParticipateRecords{
+				RecordsData:  common.ObjToString(data[i]["record_content"]),
+				UpdateDate:   common.ObjToString(data[i]["create_date"]),
+				UpdatePerson: person,
+			}
+			records = append(records, &tmp)
 
 
-	// 更新
+		}
+	case PositionTypePersonal:
+		// 遍历数据  换成姓名
+		for i := 0; i < len(data); i++ {
+			tmp := bxcore.ParticipateRecords{
+				RecordsData: common.ObjToString(data[i]["record_content"]),
+				UpdateDate:  common.ObjToString(data[i]["create_date"]),
+			}
+			records = append(records, &tmp)
 
 
-	// 存操作记录
+		}
+	}
+	return records
+}
 
 
+// 获取id和姓名的对应关系
+func getUserIdName(userIdArr []string) map[int64]string {
+	rs := map[int64]string{}
+	if len(userIdArr) > 0 {
+		userIdStr := strings.Join(userIdArr, ",")
+		userRs := mysql.GetUserMap(userIdStr)
+		if userRs == nil || len(*userRs) == 0 {
+			return rs
+		}
+		for i := 0; i < len(*userRs); i++ {
+			user := (*userRs)[i]
+			id := common.Int64All(user["id"])
+			name := common.ObjToString(user["name"])
+			rs[id] = name
+		}
+	}
+	return rs
 }
 }
 
 
+// 处理操作动作
+var (
+	ParticipateBidContentKey = map[string]string{
+		"bidType":       "投标类型",
+		"bidStage":      "投标项目阶段",
+		"isWin":         "是否中标",
+		"channelName":   "渠道名称",
+		"channelPerson": "联系人",
+		"channelPhone":  "联系电话",
+		"winner":        "中标单位",
+	}
+	BidTypeMap = map[int]interface{}{
+		BidTypeDirect: "直接投标",
+		BidTypeChanel: "渠道投标",
+	}
+	WinMap = map[int]interface{}{
+		1: "是",
+		2: "否",
+		0: "未选择",
+	}
+)
+
 // 处理操作记录
 // 处理操作记录
-//var (
-//	BidTypeKey = map[string]interface{}{
-//
-//	}
-//	ParticipateBidContentKey = map[string]interface{}{
-//		"bidType":map[string]interface{}{
-//			"name":"投标类型",
-//			"updateAction":"调整",
-//			"valueType":2,
-//			"valueMap":map[int]interface{}{
-//				BidTypeDirect:"直接投标",
-//				BidTypeChanel:"渠道投标",
-//			},
-//		},
-//		"isWin":map[string]interface{}{
-//			"name":map[int]string{
-//				1:
-//			},
-//
-//		},
-//	}
-//)
+func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent string, err error) {
+	actonStr := "%s%s%s"
+	changeField := []string{}
+	result := []string{}
+	for k, fieldName := range ParticipateBidContentKey {
+		changeStr := ""
+		switch k {
+		case "bidType":
+			oldv := common.IntAll(oldMap[k])
+			newv := common.IntAll(newMap[k])
+			if oldv == newv { // 没有改变
+				continue
+			}
+			newBidType := BidTypeMap[newv]
+			if newBidType == nil {
+				newBidType = "未选择"
+			}
+			if oldv == 0 && newv != 0 { // 说明是新增
+				changeStr = fmt.Sprintf(actonStr, fieldName, ": (新增)", newBidType)
+			} else { // 调整
+				changeStr = fmt.Sprintf(actonStr, fieldName, "(调整):", newBidType)
+
+			}
+		case "isWin":
+			oldV := common.IntAll(oldMap[k])
+			newV := common.IntAll(newMap[k])
+			if oldV == newV { // 没有改变
+				continue
+			}
+			fieldName := fieldName
+			if common.IntAll(newMap["bidType"]) == BidTypeChanel {
+				fieldName = fmt.Sprintf("%s%s", "渠道", fieldName)
+			}
+			changeStr = fmt.Sprintf(actonStr, fieldName, "(调整) 为", WinMap[newV])
+		case "bidStage":
+			bidAction := "%s%s"
+			bidChangeArr := []string{}
+			oldSet := gset.NewFrom(oldMap[k])
+			newSet := gset.NewFrom(newMap[k])
+			// 判断相等
+			if oldSet.Equal(newSet) {
+				continue
+			}
+			// 差集计算
+			// 取消勾选的
+			cancleSet := oldSet.Diff(newSet)
+			cancleSet.Iterator(func(v interface{}) bool {
+				bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(取消勾选)", v))
+				return true
+			})
+			// 新增的
+			addSet := newSet.Diff(oldSet)
+			addSet.Iterator(func(v interface{}) bool {
+				bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(新增)", v))
+				fmt.Println(v)
+				return true
+			})
+			tmpStr := strings.Join(bidChangeArr, " ")
+			changeStr = fmt.Sprintf(actonStr, fieldName, " :", tmpStr)
+		default:
+			oldV := common.ObjToString(oldMap[k])
+			newV := common.ObjToString(newMap[k])
+			if oldV == newV { // 没有变化
+				continue
+			}
+			changeStr = fmt.Sprintf(actonStr, fieldName, "(调整)为", fmt.Sprintf("\"%s\"", newV))
+		}
+		result = append(result, changeStr)
+		changeField = append(changeField, k)
+	}
+	recordMap := map[string]interface{}{
+		"content":     strings.Join(result, ";"), // 变更内容 文字描述
+		"before":      oldMap,                    // 变更前
+		"after":       newMap,                    // 变更后
+		"changeField": changeField,               // 涉及变更的字段
+	}
+
+	tmp, err := json.Marshal(recordMap)
+	if err != nil {
+		logx.Error("序列化操作记录失败:", err)
+		return "", err
+	}
+	if len(result) == 0 {
+		logx.Error("没有更新的内容:", recordContent)
+		err = fmt.Errorf("没有变更的内容,不用更新")
+	}
+	return string(tmp), err
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 491 - 459
jyBXCore/rpc/type/bxcore/bxcore.pb.go


+ 28 - 1
jyBXCore/rpc/util/participate.go

@@ -1,6 +1,13 @@
 package util
 package util
 
 
-import "jyBXCore/rpc/model/mysql"
+import (
+	"jyBXCore/rpc/model/mysql"
+	"sync"
+)
+
+var (
+	PLock *ParticipateLock
+)
 
 
 //是否允许多人参标
 //是否允许多人参标
 func IsALLow(entId int64) bool {
 func IsALLow(entId int64) bool {
@@ -8,3 +15,23 @@ func IsALLow(entId int64) bool {
 		"i_entid": entId,
 		"i_entid": entId,
 	})
 	})
 }
 }
+
+type ParticipateLock struct {
+	sync.Mutex
+	UserLock map[string]*sync.Mutex
+}
+
+func NewParticipateLock() *ParticipateLock {
+	return &ParticipateLock{
+		UserLock: make(map[string]*sync.Mutex),
+	}
+}
+
+func GetParticipateLock(str string) *sync.Mutex {
+	PLock.Lock()
+	if PLock.UserLock[str] == nil {
+		PLock.UserLock[str] = &sync.Mutex{}
+	}
+	PLock.Unlock()
+	return PLock.UserLock[str]
+}

+ 5 - 0
jyBXCore/rpc/util/util.go

@@ -0,0 +1,5 @@
+package util
+
+func init() {
+	PLock = NewParticipateLock()
+}

+ 231 - 0
jyBXCore/test.http

@@ -0,0 +1,231 @@
+// p300 投标项目管理接口测试
+### rpc接口测试
+###  列表页 个人
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateShow
+
+{
+  "ids":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D,ABCY2FddT1YLy8vNGN6c2I%2FIzNfCSd3cXhyKA4ZLTogUX5wHDNUCkw%3D",
+  "entId": 0,
+  "entUserId": 0,
+  "positionId": 1204781659,
+  "positionType": 0,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "641aa7bcac1c8e639bc15cdb",
+  "newUserId": 486050,
+  "accountId": 360058
+}
+
+###  列表页 企业
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateShow
+
+{
+  "ids":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D,ABCY2FddT1YLy8vNGN6c2I%2FIzNfCSd3cXhyKA4ZLTogUX5wHDNUCkw%3D",
+  "entId": 25922,
+  "entUserId": 6116,
+  "positionId": 1205051263,
+  "positionType": 1,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "1205051263",
+  "newUserId": 486050,
+  "accountId": 360157
+}
+
+
+### 详情页参标信息 -正常
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateInfo
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "entId": 25922,
+  "entUserId": 6116,
+  "positionId": 1205051263,
+  "positionType": 1,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "1205051263",
+  "newUserId": 486050,
+  "accountId": 360157
+}
+### 详情页参标信息-无权限
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateInfo
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "entId": 25922,
+  "entUserId": 6117,
+  "positionId": 1205051265,
+  "positionType": 1,
+  "mgoUserId": "644a493516f19b49b8451716",
+  "appId": 10000,
+  "userId": "1205051265",
+  "newUserId": 725515,
+  "accountId": 360158
+}
+
+
+
+
+### 更新投标状态
+GRPC 127.0.0.1:8003/bxcore.BxCore/UpdateBidStatus
+
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "entId": 25922,
+  "entUserId": 6116,
+  "positionId": 1205051263,
+  "positionType": 1,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "1205051263",
+  "newUserId": 486050,
+  "accountId": 360157,
+  "bidType": 1,
+  "bidStage": [],
+  "isWin": 1,
+  "channelName": "阿勒泰",
+  "channelPerson": "若羌",
+  "channelPhone": "",
+  "winner": ""
+
+}
+
+
+### 获取最新的投标状态内容
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateContent
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "entId": 25922,
+  "entUserId": 6116,
+  "positionId": 1205051263,
+  "positionType": 1,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "1205051263",
+  "newUserId": 486050,
+  "accountId": 360157
+
+
+}
+
+
+### 获取操作记录  页面不传默认 500
+GRPC 127.0.0.1:8003/bxcore.BxCore/ParticipateRecords
+
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "entId": 25922,
+  "entUserId": 6116,
+  "positionId": 1205051263,
+  "positionType": 1,
+  "mgoUserId": "641aa7bcac1c8e639bc15cdb",
+  "appId": 10000,
+  "userId": "1205051263",
+  "newUserId": 486050,
+  "accountId": 360157,
+  "page": 1,
+  "pageSize": 10
+
+
+}
+
+### api接口测试
+### 列表页参标信息接口
+POST http://127.0.0.1:8004/jybx/core/participate/show
+Content-Type: application/json
+entId: 25922
+entUserId: 6116
+positionId: 1205051263
+positionType: 1
+mgoUserId: 641aa7bcac1c8e639bc15cdb
+appId: 10000
+userId: 1205051263
+newUserId: 486050
+accountId: 360157
+
+{
+  "ids":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D,ABCY2EAdi4vKygvM3xhcHUJJzACHj1mZnB%2FPDgZKSEwc3xzeVJUCg4%3D"
+}
+
+###  详情页参标信息接口
+POST http://127.0.0.1:8004/jybx/core/participate/info
+Content-Type: application/json
+entId: 25922
+entUserId: 6116
+positionId: 1205051263
+positionType: 1
+mgoUserId: 641aa7bcac1c8e639bc15cdb
+appId: 10000
+userId: 1205051263
+newUserId: 486050
+accountId: 360157
+
+{
+"sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D"
+}
+
+
+
+###  更新参标状态
+POST http://127.0.0.1:8004/jybx/core/participate/updateBidStatus
+Content-Type: application/json
+entId: 25922
+entUserId: 6116
+positionId: 1205051263
+positionType: 1
+mgoUserId: 641aa7bcac1c8e639bc15cdb
+appId: 10000
+userId: 1205051263
+newUserId: 486050
+accountId: 360157
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "bidType": 2,
+  "bidStage": [],
+  "isWin": 2,
+  "channelName": "霍尔果斯",
+  "channelPerson": "若羌",
+  "channelPhone": "",
+  "winner": ""
+}
+
+###  参标操作记录 页码不传时 默认500
+POST http://127.0.0.1:8004/jybx/core/participate/records
+Content-Type: application/json
+entId: 25922
+entUserId: 6116
+positionId: 1205051263
+positionType: 1
+mgoUserId: 641aa7bcac1c8e639bc15cdb
+appId: 10000
+userId: 1205051263
+newUserId: 486050
+accountId: 360157
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D",
+  "page": 1,
+  "pageSize": 5
+}
+
+###  获取最新的投标状态信息
+POST http://127.0.0.1:8004/jybx/core/participate/content
+Content-Type: application/json
+entId: 25922
+entUserId: 6116
+positionId: 1205051263
+positionType: 1
+mgoUserId: 641aa7bcac1c8e639bc15cdb
+appId: 10000
+userId: 1205051263
+newUserId: 486050
+accountId: 360157
+
+{
+  "sid":"ABCY2FddTxYLyo4And1c08ODCcoGjF0XGB%2BKDggPSFFYFJwGC9UCa0%3D"
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels