package service

import (
	"context"
	"dubbo.apache.org/dubbo-go/v3/common/constant"
	"fmt"
	artShow "github.com/fonchain_enterprise/fonchain-main/api/artShow"
	"github.com/fonchain_enterprise/fonchain-main/api/artist"
	"github.com/fonchain_enterprise/fonchain-main/api/artwork_query"
	"github.com/fonchain_enterprise/fonchain-main/api/workbench"
	"github.com/fonchain_enterprise/fonchain-main/pkg/common"
	projectConf "github.com/fonchain_enterprise/fonchain-main/pkg/config"
	"github.com/fonchain_enterprise/fonchain-main/pkg/e"
	"github.com/fonchain_enterprise/fonchain-main/pkg/logic"
	"github.com/fonchain_enterprise/fonchain-main/pkg/model"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

func IndexCount(c *gin.Context) {
	var req workbench.IndexCountRequest
	resp, err := GrpcWorkbenchImpl.IndexCount(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), resp.Data)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp.Data)
	return
}

func AddShelf(c *gin.Context) {
	var req workbench.AddShelfRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.AddShelf(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func DelShelf(c *gin.Context) {
	var req workbench.DelShelfRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.DelShelf(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func ShelfList(c *gin.Context) {
	var req workbench.ShelfListRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ShelfList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), resp.Data)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	if len(resp.Data) > 0 {
		for k, v := range resp.Data {
			if v.ColumnInfo == nil {
				resp.Data[k].ColumnInfo = []*workbench.ShelfListResponse_AAInfo{}
			}
		}
	}
	return
}

func ShelfDetail(c *gin.Context) {
	var req workbench.ShelfDetailRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ShelfDetail(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), resp.Data)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	if len(resp.Data) == 0 {
		resp.Data = []*workbench.ShelfDetailResponse_ArtistInfo{}
	}
	return
}

func ShelfAddArtwork(c *gin.Context) {
	var req workbench.ShelfAddArtworkRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ShelfAddArtwork(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func SimpleArtworkList(c *gin.Context) {
	var req workbench.ArtworkListRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ArtworkList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if len(resp.Data) == 0 {
		resp.Data = []*workbench.ArtworkListResponse_Info{}
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func ShelfDragArtwork(c *gin.Context) {
	var req workbench.ShelfDragArtworkRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ShelfDragArtwork(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func UpdateAwShelf(c *gin.Context) {
	var req workbench.UpdateAwShelfNoRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.UpdateAwShelfNo(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func ExportByShowId(c *gin.Context) {
	var req workbench.ExportByShowIdRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ExportByShowId(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if resp.Data == nil || len(resp.Data) == 0 {
		ResponseQuickMsg(c, e.Failed, e.GetMsg(e.NOTDATA), nil)
		return
	}
	var exportUrl string
	if exportUrl, err = logic.ProcessDriverExcel(c, resp.Data); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, map[string]string{
		"ExportUrl": exportUrl,
	})
	//ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func ArtShowDone(c *gin.Context) {
	var req workbench.ArtShowDoneRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	//判断是否审核通过

	/*
		var showReq artShow.ShowStatusReq
		showReq.ShowUID = []string{
			req.ArtShowId,
		}
		if config.GetConsumerService("ArtShowClientImpl") != nil {
			showResp, err := GrpcArtShowImpl.QueryShowStatus(context.Background(), &showReq)
			if err != nil {
				ResponseQuickMsg(c, e.Failed, err.Error(), nil)
				return
			}
			if len(showResp.Status) == 0 {
				ResponseQuickMsg(c, e.Failed, e.GetMsg(e.ErrorGetArtShow), nil)
				return
			}
			for _, v := range showResp.Status {
				if v.IsShow != model.ArtShowStatus {
					ResponseQuickMsg(c, e.Failed, e.GetMsg(e.ErrorPriceRunFailed), nil)
					return
				}
			}
		}*/
	// 查询所有的画展包的画作信息
	artshowIdsResp, _err := GrpcArtworkQueryImpl.ArtworkDataByShowId(context.Background(), &artwork_query.ArtworkDataByShowIdRequest{
		ArtworkShowIds: []string{req.ArtShowId},
	})
	if _err != nil {
		ResponseQuickMsg(c, e.Failed, _err.Error(), nil)
		return
	}
	var artworkData []*workbench.ArtShowDoneRequest_ArtworkInfo
	if artshowIdsResp != nil && artshowIdsResp.Data != nil {
		for _, v := range artshowIdsResp.Data {
			zap.L().Info("ArtworkPrice", zap.Any("artshowId", req.ArtShowId), zap.Any("ArtworkUuid", v.ArtworkUuid))
			artshowPriceResp, errS := GrpcArtShowImpl.ArtworkPrice(context.Background(), &artShow.ArtworkPriceReq{ArtworkUID: v.ArtworkUuid})
			zap.L().Info("ArtworkPrice", zap.Any("artshowPriceResp", artshowPriceResp))
			if errS != nil {
				ResponseQuickMsg(c, e.Failed, errS.Error(), nil)
				return
			}
			var temp workbench.ArtShowDoneRequest_ArtworkInfo
			if artshowPriceResp != nil && artshowPriceResp.Data != nil {
				temp.ArtworkUuid = v.ArtworkUuid
				temp.CompanyName = artshowPriceResp.Data.TalentAgency
				artworkData = append(artworkData, &temp)
			}
		}
	}

	req.ArtworkData = artworkData
	resp, err := GrpcWorkbenchImpl.ArtShowDone(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func ListShow(c *gin.Context) {
	var req workbench.ListShowReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ListShow(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp.Data)
	return
}

func AwsStorage(c *gin.Context) {
	var req workbench.UpdateAwsStorageRequest
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	// 如果是入库则查询画家信息 1 入库
	if req.Type == 1 {
		var artistInfoReq artist.ArtistInfoRequest
		artistInfoReq.Uid = req.ArtistUuid
		artistInfo, err := GrpcArtistImpl.ArtistInfo(context.Background(), &artistInfoReq)
		if err != nil {
			ResponseQuickMsg(c, e.Failed, err.Error(), nil)
			return
		}
		req.ArtistData = &workbench.UpdateAwsStorageRequest_ArtistInfo{}
		req.ArtistData.ArtistUuid = artistInfo.ProfileInfo.Uid
		req.ArtistData.Seqnum = artistInfo.ProfileInfo.Seqnum
		req.ArtistData.Tnum = artistInfo.ProfileInfo.Tnum
		req.ArtistData.Num = artistInfo.ProfileInfo.Num
	}
	resp, err := GrpcWorkbenchImpl.UpdateAwsStorage(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func ScheduleAdd(c *gin.Context) {
	var req workbench.AddScheduleReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if projectConf.Env != "dev" {
		if mLoginInfoAny, exists := c.Get("mLoginInfo"); exists {
			userInfo := mLoginInfoAny.(model.LoginInfo)
			req.UserId = int32(userInfo.ID)
			req.InitiatorNickname = userInfo.NickName
		}
	} else {
		req.UserId = 1
		req.InitiatorNickname = "test_nickname"
	}
	// 要把创建人加到参与人里
	var isIn bool = false
	if len(req.Participant) > 0 {
		for _, v := range req.Participant {
			if v.Value == req.UserId {
				isIn = true
				break
			}
		}
	}
	if !isIn {
		req.Participant = append(req.Participant, &workbench.ParticipantInfo{
			Value: req.UserId,
			Label: req.InitiatorNickname,
		})
	}
	//if err := req.Validate(); err != nil {
	//	err = common.SubstrError(err)
	//	ResponseQuickMsg(c, e.Failed, err.Error(), nil)
	//	return
	//}
	//
	atta := make(map[string]interface{}, 2)
	if len(req.Content) >= 8000000 {
		atta["content"] = req.Content
		req.Content = ""
	}
	reqContext := context.WithValue(context.Background(), constant.DubboCtxKey("attachment"), atta)
	//
	resp, err := GrpcWorkbenchImpl.AddSchedule(reqContext, &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func ScheduleInfo(c *gin.Context) {
	var req workbench.ScheduleInfoReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if projectConf.Env != "dev" {
		if mLoginInfoAny, exists := c.Get("mLoginInfo"); exists {
			userInfo := mLoginInfoAny.(model.LoginInfo)
			req.UserId = int32(userInfo.ID)
		}
	} else {
		req.UserId = 1
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ScheduleInfo(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func ScheduleList(c *gin.Context) {
	var req workbench.ScheduleListReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if projectConf.Env != "dev" {
		if mLoginInfoAny, exists := c.Get("mLoginInfo"); exists {
			userInfo := mLoginInfoAny.(model.LoginInfo)
			req.UserId = int32(userInfo.ID)
		}
	} else {
		req.UserId = 1
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ScheduleList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func ScheduleRead(c *gin.Context) {
	var req workbench.ScheduleReadReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.ScheduleRead(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
	return
}

func CommonSealList(c *gin.Context) {
	var req workbench.CommonSealListReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.CommonSealList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, resp.Data)
	return
}

func PostBatchArt(c *gin.Context) {
	var req workbench.PostBatchAddArtReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.PostBatchAddArt(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
	return
}

func RecheckArtistList(c *gin.Context) {
	var req workbench.RecheckArtistListReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	var idNameReq artist.ArtIdNameRequest
	if req.ArtistName != "" {
		idNameReq.Keyword = req.ArtistName
	}
	if req.ArtistTnum != "" {
		idNameReq.Tnum = req.ArtistTnum
	}
	// 如果筛选了画家信息则先查询画家的uuid
	idNameResp, _errS := GrpcArtistImpl.ArtistIdName(context.Background(), &idNameReq)
	if _errS != nil {
		ResponseQuickMsg(c, e.Failed, _errS.Error(), nil)
		return
	}
	if len(idNameResp.Items) > 0 {
		var reqArtistUuids []string
		for _, info := range idNameResp.Items {
			reqArtistUuids = append(reqArtistUuids, info.Uuid)
		}
		req.ArtistUuids = reqArtistUuids
	} else {
		req.ArtistUuids = []string{" "}
	}
	resp, err := GrpcWorkbenchImpl.RecheckArtistList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	for _, info := range resp.Data {
		if info.BlackListStatus == 2 {
			info.ArtistName = fmt.Sprintf("#%s", info.ArtistName)
		}
	}
	// 查询画家的信息
	if len(resp.Data) > 0 {
		var artistUuids []string
		for _, info := range resp.Data {
			artistUuids = append(artistUuids, info.ArtistUuid)
			info.ArtistShowCount = fmt.Sprintf("%s(0)", info.ArtistName)
		}
		artistData, _err := GrpcArtistImpl.ArtistData(context.Background(), &artist.ArtistDataRequest{Uids: artistUuids})
		if _err != nil {
			ResponseQuickMsg(c, e.Failed, _err.Error(), nil)
			return
		}
		for _, info := range resp.Data {
			for _, artistInfo := range artistData.Data {
				if info.ArtistUuid == artistInfo.ProfileInfo.Uid {
					info.ArtistName = artistInfo.ProfileInfo.Name
					info.ArtistTnum = artistInfo.ProfileInfo.Tnum
				}
			}
		}
		artshowResp, _err := GrpcArtShowImpl.ArtistExhibitionCount(context.Background(), &artShow.ArtistExhibitionCountReq{ArtistUid: artistUuids})
		if _err != nil {
			zap.L().Error("artist ArtistExhibitionCount err", zap.Error(_err))
		}
		if artshowResp != nil && len(artshowResp.ArtistShowCount) > 0 {
			for k, v := range resp.Data {
				for _, v1 := range artshowResp.ArtistShowCount {
					if v.ArtistUuid == v1.ArtistUid {
						resp.Data[k].ArtistShowCount = fmt.Sprintf("%s(%d)", v.ArtistName, v1.ShowCount)
						break
					}
				}
			}
		}

	}
	ResponseQuickMsg(c, e.Ok, e.GetMsg(e.Success), resp)
	return
}

func RecheckArtworkList(c *gin.Context) {
	var req workbench.RecheckArtworkListReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.RecheckArtworkList(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	for _, info := range resp.Data {
		if info.BlackListStatus == 2 {
			info.ArtistName = fmt.Sprintf("#%s", info.ArtistName)
		}
	}
	// 遍历组装画家UUID 查询画家的信息
	if len(resp.Data) > 0 {
		var artistUuids []string = make([]string, 0, len(resp.Data))
		for _, info := range resp.Data {
			artistUuids = append(artistUuids, info.ArtistUuid)
			info.ArtistShowCount = fmt.Sprintf("%s(0)", info.ArtistName)
		}
		artistData, _err := GrpcArtistImpl.ArtistData(context.Background(), &artist.ArtistDataRequest{Uids: artistUuids})
		if _err != nil {
			ResponseQuickMsg(c, e.Failed, _err.Error(), nil)
			return
		}
		for _, info := range resp.Data {
			for _, artistInfo := range artistData.Data {
				if info.ArtistUuid == artistInfo.ProfileInfo.Uid {
					info.ArtistTnum = artistInfo.ProfileInfo.Tnum
				}
			}
		}
		artshowResp, _err := GrpcArtShowImpl.ArtistExhibitionCount(context.Background(), &artShow.ArtistExhibitionCountReq{ArtistUid: artistUuids})
		if _err != nil {
			zap.L().Error("artist ArtistExhibitionCount err", zap.Error(_err))
		}
		if artshowResp != nil && len(artshowResp.ArtistShowCount) > 0 {
			for k, v := range resp.Data {
				for _, v1 := range artshowResp.ArtistShowCount {
					if v.ArtistUuid == v1.ArtistUid {
						resp.Data[k].ArtistShowCount = fmt.Sprintf("%s(%d)", v.ArtistName, v1.ShowCount)
						break
					}
				}
			}
		}
	}
	ResponseQuickMsg(c, e.Ok, e.GetMsg(e.Success), resp)
	return
}

func RecheckEdit(c *gin.Context) {
	var req workbench.RecheckEditReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	_, err := GrpcWorkbenchImpl.RecheckEdit(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, e.GetMsg(e.Success), nil)
	return
}

func RecheckSubmit(c *gin.Context) {
	var req workbench.RecheckSubmitReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	_, err := GrpcWorkbenchImpl.RecheckSubmit(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, e.GetMsg(e.Success), nil)
	return
}

func SubmitInfo(c *gin.Context) {
	var req workbench.SubmitInfoReq
	if err := c.ShouldBind(&req); err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	if err := req.Validate(); err != nil {
		err = common.SubstrError(err)
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	resp, err := GrpcWorkbenchImpl.SubmitInfo(context.Background(), &req)
	if err != nil {
		ResponseQuickMsg(c, e.Failed, err.Error(), nil)
		return
	}
	ResponseQuickMsg(c, e.Ok, e.GetMsg(e.Success), resp)
	return
}