Updata:更新公司治理接口

This commit is contained in:
jiaji.H 2026-01-06 16:23:07 +08:00
parent 560617806d
commit a81a85998b
6 changed files with 1240 additions and 290 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,20 +9,53 @@ service Governance{
rpc List(ListReq) returns (ListResp) {}
rpc Delete(DeleteReq) returns (DeleteResp) {}
rpc Edit(EditReq) returns (EditResp) {}
rpc UpdataStatus(UpdataStatusReq) returns (UpdataStatusResp) {}
rpc GetGovernanceInfo(GetGovernanceInfoReq) returns (GetGovernanceInfoResp) {}
rpc Create(CreateReq) returns (CreateResp) {}
rpc Display(DisplayReq) returns (DisplayResp) {}
}
message LangSetting {
string langType = 1;//
int32 isSetting = 2;//
}
message GovernanceLangData{
string title = 1;//
string attachment = 2;//
string attachmentName = 3;//
int32 isSetting = 4;//
}
message GovernanceLang{
string langType = 1;//
GovernanceLangData data = 2;//
}
message GovernanceInfo{
string uuid = 1;
repeated GovernanceLang dataByLang = 2;//
int32 sort = 3;//
int32 status = 4;//
}
message Item{
int32 id = 1;
string uuid = 1;
string title = 2;
string attachment = 3;
string attachmentName = 4;
int32 sort = 5;
int32 status = 6;
int64 updatedAt = 7;
string operator = 8;
int32 operatorId = 9;
repeated LangSetting langSetting = 5;//
int32 sort = 6;
int32 status = 7;
int64 updatedAt = 8;
string operator = 9;
int32 operatorId = 10;
}
message DisplayItem{
string title = 1;
string attachment = 2;
string attachmentName = 3;
}
message ListReq{
@ -38,34 +71,48 @@ message ListResp{
}
message DeleteReq{
int32 id = 1;
string uuid = 1;
}
message DeleteResp{
}
message EditReq{
uint32 id = 1;
string title = 2;
string attachment = 3;
string attachmentName = 4;
int32 sort = 5;
int32 status = 6;
string operator = 7;
int32 operatorId = 8;
string uuid = 1;
repeated GovernanceLang dataByLang = 2;
int32 sort = 3;
string operator = 4;
int32 operatorId = 5;
}
message EditResp{
}
message UpdataStatusReq{
string uuid = 1;
int32 status = 2;
string operator = 3;
int32 operatorId = 4;
}
message UpdataStatusResp{
string msg = 1;
}
message GetGovernanceInfoReq{
string uuid = 1;
}
message GetGovernanceInfoResp{
string msg = 1;
GovernanceInfo data = 2;
}
message CreateReq{
string title = 1;
uint32 sort = 2;
string attachment = 3;
string attachmentName = 4;
int32 status = 5;
string operator = 6;
int32 operatorId = 7;
string uuid = 1;
repeated GovernanceLang dataByLang = 2;
uint32 sort = 3;
int32 status = 4;
string operator = 5;
int32 operatorId = 6;
}
message CreateResp{
@ -73,9 +120,9 @@ message CreateResp{
}
message DisplayReq{
string langType = 1;//
}
message DisplayResp{
repeated Item data = 1;
repeated DisplayItem data = 1;
}

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: governance.proto
// source: api/governance/governance.proto
package governance
@ -15,7 +15,41 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *LangSetting) Validate() error {
return nil
}
func (this *GovernanceLangData) Validate() error {
return nil
}
func (this *GovernanceLang) Validate() error {
if this.Data != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
return nil
}
func (this *GovernanceInfo) Validate() error {
for _, item := range this.DataByLang {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("DataByLang", err)
}
}
}
return nil
}
func (this *Item) Validate() error {
for _, item := range this.LangSetting {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("LangSetting", err)
}
}
}
return nil
}
func (this *DisplayItem) Validate() error {
return nil
}
func (this *ListReq) Validate() error {
@ -38,12 +72,43 @@ func (this *DeleteResp) Validate() error {
return nil
}
func (this *EditReq) Validate() error {
for _, item := range this.DataByLang {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("DataByLang", err)
}
}
}
return nil
}
func (this *EditResp) Validate() error {
return nil
}
func (this *UpdataStatusReq) Validate() error {
return nil
}
func (this *UpdataStatusResp) Validate() error {
return nil
}
func (this *GetGovernanceInfoReq) Validate() error {
return nil
}
func (this *GetGovernanceInfoResp) Validate() error {
if this.Data != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
return nil
}
func (this *CreateReq) Validate() error {
for _, item := range this.DataByLang {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("DataByLang", err)
}
}
}
return nil
}
func (this *CreateResp) Validate() error {

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.20.3
// source: governance.proto
// - protoc-gen-go-triple v1.0.5
// - protoc v5.26.0
// source: api/governance/governance.proto
package governance
@ -31,6 +31,8 @@ type GovernanceClient interface {
List(ctx context.Context, in *ListReq, opts ...grpc_go.CallOption) (*ListResp, common.ErrorWithAttachment)
Delete(ctx context.Context, in *DeleteReq, opts ...grpc_go.CallOption) (*DeleteResp, common.ErrorWithAttachment)
Edit(ctx context.Context, in *EditReq, opts ...grpc_go.CallOption) (*EditResp, common.ErrorWithAttachment)
UpdataStatus(ctx context.Context, in *UpdataStatusReq, opts ...grpc_go.CallOption) (*UpdataStatusResp, common.ErrorWithAttachment)
GetGovernanceInfo(ctx context.Context, in *GetGovernanceInfoReq, opts ...grpc_go.CallOption) (*GetGovernanceInfoResp, common.ErrorWithAttachment)
Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment)
Display(ctx context.Context, in *DisplayReq, opts ...grpc_go.CallOption) (*DisplayResp, common.ErrorWithAttachment)
}
@ -40,11 +42,13 @@ type governanceClient struct {
}
type GovernanceClientImpl struct {
List func(ctx context.Context, in *ListReq) (*ListResp, error)
Delete func(ctx context.Context, in *DeleteReq) (*DeleteResp, error)
Edit func(ctx context.Context, in *EditReq) (*EditResp, error)
Create func(ctx context.Context, in *CreateReq) (*CreateResp, error)
Display func(ctx context.Context, in *DisplayReq) (*DisplayResp, error)
List func(ctx context.Context, in *ListReq) (*ListResp, error)
Delete func(ctx context.Context, in *DeleteReq) (*DeleteResp, error)
Edit func(ctx context.Context, in *EditReq) (*EditResp, error)
UpdataStatus func(ctx context.Context, in *UpdataStatusReq) (*UpdataStatusResp, error)
GetGovernanceInfo func(ctx context.Context, in *GetGovernanceInfoReq) (*GetGovernanceInfoResp, error)
Create func(ctx context.Context, in *CreateReq) (*CreateResp, error)
Display func(ctx context.Context, in *DisplayReq) (*DisplayResp, error)
}
func (c *GovernanceClientImpl) GetDubboStub(cc *triple.TripleConn) GovernanceClient {
@ -77,6 +81,18 @@ func (c *governanceClient) Edit(ctx context.Context, in *EditReq, opts ...grpc_g
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Edit", in, out)
}
func (c *governanceClient) UpdataStatus(ctx context.Context, in *UpdataStatusReq, opts ...grpc_go.CallOption) (*UpdataStatusResp, common.ErrorWithAttachment) {
out := new(UpdataStatusResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdataStatus", in, out)
}
func (c *governanceClient) GetGovernanceInfo(ctx context.Context, in *GetGovernanceInfoReq, opts ...grpc_go.CallOption) (*GetGovernanceInfoResp, common.ErrorWithAttachment) {
out := new(GetGovernanceInfoResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetGovernanceInfo", in, out)
}
func (c *governanceClient) Create(ctx context.Context, in *CreateReq, opts ...grpc_go.CallOption) (*CreateResp, common.ErrorWithAttachment) {
out := new(CreateResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -96,6 +112,8 @@ type GovernanceServer interface {
List(context.Context, *ListReq) (*ListResp, error)
Delete(context.Context, *DeleteReq) (*DeleteResp, error)
Edit(context.Context, *EditReq) (*EditResp, error)
UpdataStatus(context.Context, *UpdataStatusReq) (*UpdataStatusResp, error)
GetGovernanceInfo(context.Context, *GetGovernanceInfoReq) (*GetGovernanceInfoResp, error)
Create(context.Context, *CreateReq) (*CreateResp, error)
Display(context.Context, *DisplayReq) (*DisplayResp, error)
mustEmbedUnimplementedGovernanceServer()
@ -115,6 +133,12 @@ func (UnimplementedGovernanceServer) Delete(context.Context, *DeleteReq) (*Delet
func (UnimplementedGovernanceServer) Edit(context.Context, *EditReq) (*EditResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Edit not implemented")
}
func (UnimplementedGovernanceServer) UpdataStatus(context.Context, *UpdataStatusReq) (*UpdataStatusResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdataStatus not implemented")
}
func (UnimplementedGovernanceServer) GetGovernanceInfo(context.Context, *GetGovernanceInfoReq) (*GetGovernanceInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetGovernanceInfo not implemented")
}
func (UnimplementedGovernanceServer) Create(context.Context, *CreateReq) (*CreateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
@ -236,6 +260,64 @@ func _Governance_Edit_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler)
}
func _Governance_UpdataStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdataStatusReq)
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("UpdataStatus", 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 _Governance_GetGovernanceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGovernanceInfoReq)
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("GetGovernanceInfo", 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 _Governance_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
@ -313,6 +395,14 @@ var Governance_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "Edit",
Handler: _Governance_Edit_Handler,
},
{
MethodName: "UpdataStatus",
Handler: _Governance_UpdataStatus_Handler,
},
{
MethodName: "GetGovernanceInfo",
Handler: _Governance_GetGovernanceInfo_Handler,
},
{
MethodName: "Create",
Handler: _Governance_Create_Handler,
@ -323,5 +413,5 @@ var Governance_ServiceDesc = grpc_go.ServiceDesc{
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "governance.proto",
Metadata: "api/governance/governance.proto",
}

View File

@ -175,6 +175,8 @@ func NewRouter() *gin.Engine {
governanceRouteLogin.POST("", governance.Create)
governanceRouteLogin.POST("/edit", governance.Edit)
governanceRouteLogin.POST("/delete", governance.Delete)
governanceRouteLogin.POST("/updataStatus", governance.UpdataStatus)
governanceRouteLogin.POST("/getGovernanceInfo", governance.GetGovernanceInfo)
}
{

View File

@ -82,3 +82,34 @@ func Edit(ctx *gin.Context) {
}
service.Success(ctx, resp)
}
func UpdataStatus(ctx *gin.Context) {
var req governance.UpdataStatusReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
user := login.GetUserInfoFromC(ctx)
req.Operator = user.Name
req.OperatorId = int32(user.ID)
resp, err := service.GovernanceProvider.UpdataStatus(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}
func GetGovernanceInfo(ctx *gin.Context) {
var req governance.GetGovernanceInfoReq
if err := ctx.ShouldBindJSON(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err := service.GovernanceProvider.GetGovernanceInfo(ctx, &req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
}