Updata:解决冲突
This commit is contained in:
commit
5ec92819ea
23
internal/controller/questionnaire_survey.go
Normal file
23
internal/controller/questionnaire_survey.go
Normal file
@ -0,0 +1,23 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"micro-bundle/internal/logic"
|
||||
"micro-bundle/pb/bundle"
|
||||
)
|
||||
|
||||
func (b *BundleProvider) SendQuestionnaireSurvey(_ context.Context, req *bundle.SendQuestionnaireSurveyRequest) (*bundle.SendQuestionnaireSurveyResponse, error) {
|
||||
return logic.SendQuestionnaireSurvey(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) GetQuestionnaireSurveyInfo(_ context.Context, req *bundle.GetQuestionnaireSurveyInfoRequest) (*bundle.GetQuestionnaireSurveyInfoResponse, error) {
|
||||
return logic.GetQuestionnaireSurveyInfo(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) CreateQuestionnaireSurveyAnswer(_ context.Context, req *bundle.CreateQuestionnaireSurveyAnswerRequest) (*bundle.CreateQuestionnaireSurveyAnswerResponse, error) {
|
||||
return logic.CreateQuestionnaireSurveyAnswer(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) GetQuestionnaireSurveyList(_ context.Context, req *bundle.GetQuestionnaireSurveyListRequest) (*bundle.GetQuestionnaireSurveyListResponse, error) {
|
||||
return logic.GetQuestionnaireSurveyList(req)
|
||||
}
|
||||
167
internal/dao/questionnaire_survey.go
Normal file
167
internal/dao/questionnaire_survey.go
Normal file
@ -0,0 +1,167 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/msg"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp *bundle.SendQuestionnaireSurveyResponse, err error) {
|
||||
resp = new(bundle.SendQuestionnaireSurveyResponse)
|
||||
userInfo := &model.UserInfo{}
|
||||
err = app.ModuleClients.BundleDB.Raw(`
|
||||
SELECT
|
||||
mau.id as user_id,
|
||||
mau.user_num as user_num,
|
||||
mau.tel_num as user_tel,
|
||||
marn.name as user_name
|
||||
from micro-account.user as mau
|
||||
left join micro-account.real_name as marn on marn.id = mau.real_name_id and marn.deleted_at is null
|
||||
where mau.deleted_at is null and mau.tel_num = ?
|
||||
`, req.UserTel).Scan(&userInfo).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
if userInfo.UserId == 0 {
|
||||
resp.Status = 1
|
||||
return resp, nil
|
||||
}
|
||||
questionnaireInfo := &model.QuestionnaireSurvey{}
|
||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
||||
Where("user_tel = ? and deleted_at is null", req.UserTel).
|
||||
First(&questionnaireInfo).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
if questionnaireInfo.UserId != 0 {
|
||||
resp.Status = 2
|
||||
return resp, nil
|
||||
}
|
||||
orderRecord := &model.BundleOrderRecords{}
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
|
||||
Where("customer_num = ? and deleted_at is null", userInfo.UserNum).
|
||||
Order("created_at desc").
|
||||
First(&orderRecord).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
bundleBalance := &model.BundleBalance{}
|
||||
month := timeParse(req.EndTime + " 23:59:59").Format("2006-01")
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).
|
||||
Where("order_uuid = ? and deleted_at is null", orderRecord.UUID).
|
||||
Where("month = ?", month).
|
||||
First(&bundleBalance).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
bundleInfo := &model.BundleInfo{
|
||||
BundleName: orderRecord.BundleName,
|
||||
StartAt: bundleBalance.StartAt,
|
||||
ExpiredAt: bundleBalance.ExpiredAt,
|
||||
BundleAccountNumber: 3,
|
||||
BundleVideoNumber: bundleBalance.BundleLimitVideoConsumptionNumber,
|
||||
IncreaseVideoNumber: bundleBalance.IncreaseLimitVideoConsumptionNumber,
|
||||
BundleImageNumber: bundleBalance.BundleLimitImageConsumptionNumber,
|
||||
BundleDataNumber: bundleBalance.BundleLimitDataAnalysisConsumptionNumber,
|
||||
BundleCompetitiveNumber: bundleBalance.BundleLimitCompetitiveConsumptionNumber,
|
||||
}
|
||||
bundleInfoJSON, err := json.Marshal(bundleInfo)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
data := &model.QuestionnaireSurvey{
|
||||
SurveyUUID: uuid.New().String(),
|
||||
UserId: userInfo.UserId,
|
||||
UserNum: userInfo.UserNum,
|
||||
UserName: userInfo.UserName,
|
||||
UserTel: userInfo.UserTel,
|
||||
OrderUUID: orderRecord.UUID,
|
||||
SendTime: timeParse(time.Now().Format("2006-01-02 15:04:05")),
|
||||
SurveyStatus: msg.QuestionnaireSent,
|
||||
BundleInfo: string(bundleInfoJSON),
|
||||
SurveyTitle: req.SurveyTitle,
|
||||
}
|
||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).Create(data).Error
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
resp.Status = 0
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetQuestionnaireSurveyInfo(req *bundle.GetQuestionnaireSurveyInfoRequest) (data *model.QuestionnaireSurvey, err error) {
|
||||
questionnaireInfo := &model.QuestionnaireSurvey{}
|
||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
||||
Where("user_tel = ? and deleted_at is null", req.UserTel).
|
||||
Order("created_at desc").
|
||||
First(&questionnaireInfo).Error
|
||||
if err != nil {
|
||||
return data, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func CreateQuestionnaireSurveyAnswer(req *bundle.CreateQuestionnaireSurveyAnswerRequest) (err error) {
|
||||
surveyAnswer := &model.SurveyAnswer{
|
||||
BundleAccountScore: req.SurveyAnswer.BundleAccountScore,
|
||||
BundleVideoScore: req.SurveyAnswer.BundleVideoScore,
|
||||
IncreaseVideoScore: req.SurveyAnswer.IncreaseVideoScore,
|
||||
BundleImageScore: req.SurveyAnswer.BundleImageScore,
|
||||
BundleDataScore: req.SurveyAnswer.BundleDataScore,
|
||||
BundleCompetitiveScore: req.SurveyAnswer.BundleCompetitiveScore,
|
||||
ServiceResponseSpeed: req.SurveyAnswer.ServiceResponseSpeed,
|
||||
ServiceStaffProfessionalism: req.SurveyAnswer.ServiceStaffProfessionalism,
|
||||
}
|
||||
surveyAnswerJSON, err := json.Marshal(surveyAnswer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
||||
Where("user_tel = ? and deleted_at is null", req.UserTel).
|
||||
Updates(map[string]interface{}{
|
||||
"survey_answer": string(surveyAnswerJSON),
|
||||
"merits_review": req.SurveyFeedback.MeritsReview,
|
||||
"suggestionsor_improvements": req.SurveyFeedback.SuggestionsorImprovements,
|
||||
"additional_comments": req.SurveyFeedback.AdditionalComments,
|
||||
"submit_time": timeParse(time.Now().Format("2006-01-02 15:04:05")),
|
||||
"survey_status": msg.QuestionnaireSubmitted,
|
||||
"survey_url": req.SurveyUrl,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetQuestionnaireSurveyList(req *bundle.GetQuestionnaireSurveyListRequest) (data []*model.QuestionnaireSurvey, total int64, err error) {
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 10
|
||||
}
|
||||
query := app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{})
|
||||
if req.UserName != "" {
|
||||
query = query.Where("user_name = ?", req.UserName)
|
||||
}
|
||||
if req.SurveyTitle != "" {
|
||||
query = query.Where("survey_title = ?", req.SurveyTitle)
|
||||
}
|
||||
if req.SurveyStatus != 0 {
|
||||
query = query.Where("survey_status = ?", req.SurveyStatus)
|
||||
}
|
||||
query = query.Order("created_at desc")
|
||||
query.Count(&total)
|
||||
query = query.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
|
||||
err = query.Find(&data).Error
|
||||
if err != nil {
|
||||
return data, total, err
|
||||
}
|
||||
return data, total, nil
|
||||
}
|
||||
72
internal/logic/questionnaire_survey.go
Normal file
72
internal/logic/questionnaire_survey.go
Normal file
@ -0,0 +1,72 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (*bundle.SendQuestionnaireSurveyResponse, error) {
|
||||
resp, err := dao.SendQuestionnaireSurvey(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetQuestionnaireSurveyInfo(req *bundle.GetQuestionnaireSurveyInfoRequest) (*bundle.GetQuestionnaireSurveyInfoResponse, error) {
|
||||
resp := new(bundle.GetQuestionnaireSurveyInfoResponse)
|
||||
data, err := dao.GetQuestionnaireSurveyInfo(req)
|
||||
if err != nil {
|
||||
return nil, errors.New("获取问卷信息失败")
|
||||
}
|
||||
bundleInfo := &bundle.SurveyBundleInfo{}
|
||||
err = json.Unmarshal([]byte(data.BundleInfo), bundleInfo)
|
||||
if err != nil {
|
||||
return nil, errors.New("反序列化失败")
|
||||
}
|
||||
resp.UserName = data.UserName
|
||||
resp.BundleInfo.BundleName = bundleInfo.BundleName
|
||||
resp.BundleInfo.StartAt = bundleInfo.StartAt
|
||||
resp.BundleInfo.ExpiredAt = bundleInfo.ExpiredAt
|
||||
resp.BundleInfo.BundleAccountNumber = bundleInfo.BundleAccountNumber
|
||||
resp.BundleInfo.BundleVideoNumber = bundleInfo.BundleVideoNumber
|
||||
resp.BundleInfo.IncreaseVideoNumber = bundleInfo.IncreaseVideoNumber
|
||||
resp.BundleInfo.BundleImageNumber = bundleInfo.BundleImageNumber
|
||||
resp.BundleInfo.BundleDataNumber = bundleInfo.BundleDataNumber
|
||||
resp.BundleInfo.BundleCompetitiveNumber = bundleInfo.BundleCompetitiveNumber
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func CreateQuestionnaireSurveyAnswer(req *bundle.CreateQuestionnaireSurveyAnswerRequest) (*bundle.CreateQuestionnaireSurveyAnswerResponse, error) {
|
||||
resp := new(bundle.CreateQuestionnaireSurveyAnswerResponse)
|
||||
err := dao.CreateQuestionnaireSurveyAnswer(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetQuestionnaireSurveyList(req *bundle.GetQuestionnaireSurveyListRequest) (resp *bundle.GetQuestionnaireSurveyListResponse, err error) {
|
||||
data, total, err := dao.GetQuestionnaireSurveyList(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Total = int32(total)
|
||||
resp.Page = req.Page
|
||||
resp.Size = req.PageSize
|
||||
resp.SurveyList = lo.Map(data, func(m *model.QuestionnaireSurvey, _ int) *bundle.SurveyListInfo {
|
||||
return &bundle.SurveyListInfo{
|
||||
UserName: m.UserName,
|
||||
UserTel: m.UserTel,
|
||||
SurveyTitle: m.SurveyTitle,
|
||||
SurveyStatus: int32(m.SurveyStatus),
|
||||
SurveyUrl: m.SurveyUrl,
|
||||
}
|
||||
})
|
||||
return resp, nil
|
||||
}
|
||||
61
internal/model/questionnaire_survey.go
Normal file
61
internal/model/questionnaire_survey.go
Normal file
@ -0,0 +1,61 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type QuestionnaireSurvey struct {
|
||||
gorm.Model
|
||||
SurveyUUID string `gorm:"column:survey_uuid;not null;comment:问卷UUID" json:"survey_uuid"`
|
||||
UserId int `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"`
|
||||
UserNum string `gorm:"column:user_num;not null;comment:用户编号" json:"user_num"`
|
||||
UserName string `gorm:"column:user_name;not null;comment:用户姓名" json:"user_name"`
|
||||
UserTel string `gorm:"column:user_tel;not null;comment:用户电话" json:"user_tel"`
|
||||
OrderUUID string `gorm:"column:order_uuid;not null;comment:订单UUID" json:"order_uuid"`
|
||||
SendTime time.Time `gorm:"column:send_time;not null;comment:发送时间" json:"send_time"`
|
||||
SubmitTime time.Time `gorm:"column:submit_time;not null;comment:提交时间" json:"submit_time"`
|
||||
SurveyTitle string `gorm:"column:survey_title;not null;comment:问卷标题" json:"survey_title"`
|
||||
SurveyStatus int `gorm:"column:survey_status;not null;comment:问卷状态 1:已发送 2:已提交" json:"survey_status"`
|
||||
BundleInfo string `gorm:"column:bundle_info;not null;comment:套餐信息" json:"bundle_info"`
|
||||
SurveyAnswer string `gorm:"column:survey_answer;not null;comment:问卷答案" json:"survey_answer"`
|
||||
MeritsReview string `gorm:"column:merits_review;not null;comment:优点评价" json:"merits_review"`
|
||||
SuggestionsorImprovements string `gorm:"column:suggestionsor_improvements;not null;comment:改进建议" json:"suggestionsor_improvements"`
|
||||
AdditionalComments string `gorm:"column:additional_comments;not null;comment:补充意见" json:"additional_comments"`
|
||||
SurveyUrl string `gorm:"column:survey_url;not null;comment:问卷URL" json:"survey_url"`
|
||||
}
|
||||
|
||||
func (QuestionnaireSurvey) TableName() string {
|
||||
return "questionnaire_survey"
|
||||
}
|
||||
|
||||
type BundleInfo struct {
|
||||
BundleName string `gorm:"column:bundle_name;not null;comment:套餐名称" json:"bundle_name"`
|
||||
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:套餐开始时间"`
|
||||
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:套餐过期时间"`
|
||||
BundleAccountNumber int `gorm:"column:bundle_account_number;not null;comment:套餐账号数量" json:"bundle_account_number"`
|
||||
BundleVideoNumber int `gorm:"column:bundle_video_number;not null;comment:套餐视频数量" json:"bundle_video_number"`
|
||||
IncreaseVideoNumber int `gorm:"column:increase_video_number;not null;comment:增值视频数量" json:"increase_video_number"`
|
||||
BundleImageNumber int `gorm:"column:bundle_image_number;not null;comment:套餐图片数量" json:"bundle_image_number"`
|
||||
BundleDataNumber int `gorm:"column:bundle_data_number;not null;comment:套餐数据数量" json:"bundle_data_number"`
|
||||
BundleCompetitiveNumber int `gorm:"column:bundle_competitive_number;not null;comment:套餐竞品数量" json:"bundle_competitive_number"`
|
||||
}
|
||||
|
||||
type SurveyAnswer struct {
|
||||
BundleAccountScore int32 `gorm:"column:bundle_account_score;not null;comment:套餐账号评分" json:"bundle_account_score"`
|
||||
BundleVideoScore int32 `gorm:"column:bundle_video_score;not null;comment:套餐视频评分" json:"bundle_video_score"`
|
||||
IncreaseVideoScore int32 `gorm:"column:increase_video_score;not null;comment:增值视频评分" json:"increase_video_score"`
|
||||
BundleImageScore int32 `gorm:"column:bundle_image_score;not null;comment:套餐图片评分" json:"bundle_image_score"`
|
||||
BundleDataScore int32 `gorm:"column:bundle_data_score;not null;comment:套餐数据评分" json:"bundle_data_score"`
|
||||
BundleCompetitiveScore int32 `gorm:"column:bundle_competitive_score;not null;comment:套餐竞品评分" json:"bundle_competitive_score"`
|
||||
ServiceResponseSpeed int32 `gorm:"column:service_response_speed;not null;comment:服务响应速度评分" json:"service_response_speed"`
|
||||
ServiceStaffProfessionalism int32 `gorm:"column:service_staff_professionalism;not null;comment:服务人员专业性评分" json:"service_staff_professionalism"`
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
UserId int `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"`
|
||||
UserNum string `gorm:"column:user_num;not null;comment:用户编号" json:"user_num"`
|
||||
UserName string `gorm:"column:user_name;not null;comment:用户姓名" json:"user_name"`
|
||||
UserTel string `gorm:"column:user_tel;not null;comment:用户电话" json:"user_tel"`
|
||||
}
|
||||
@ -148,6 +148,13 @@ service Bundle {
|
||||
|
||||
rpc UpdateOrderRecordByOrderUuid(OrderRecord) returns (CommonResponse) {}
|
||||
rpc OrderListByOrderUuid(OrderInfoByOrderUuidRequest) returns (OrderInfoByOrderNoResp) {}
|
||||
|
||||
// 问卷调查
|
||||
rpc SendQuestionnaireSurvey(SendQuestionnaireSurveyRequest) returns (SendQuestionnaireSurveyResponse) {}
|
||||
rpc GetQuestionnaireSurveyInfo(GetQuestionnaireSurveyInfoRequest) returns (GetQuestionnaireSurveyInfoResponse) {}
|
||||
rpc CreateQuestionnaireSurveyAnswer(CreateQuestionnaireSurveyAnswerRequest) returns (CreateQuestionnaireSurveyAnswerResponse) {}
|
||||
rpc GetQuestionnaireSurveyList(GetQuestionnaireSurveyListRequest) returns (GetQuestionnaireSurveyListResponse) {}
|
||||
|
||||
}
|
||||
message GetInEffectOrderRecordRequest{
|
||||
uint64 userID = 1;
|
||||
@ -2383,4 +2390,84 @@ message UpdataInvoiceInfoReq{
|
||||
}
|
||||
|
||||
message UpdataInvoiceInfoResp{
|
||||
}
|
||||
|
||||
message SendQuestionnaireSurveyRequest{
|
||||
string endTime = 1;
|
||||
string userTel = 2;
|
||||
string surveyTitle = 3;
|
||||
}
|
||||
|
||||
message SendQuestionnaireSurveyResponse{
|
||||
int32 status = 1;//0 查询到用户信息 1 未查询到对应用户 2该用户已发送过问卷
|
||||
}
|
||||
|
||||
message GetQuestionnaireSurveyInfoRequest{
|
||||
string userTel = 1;
|
||||
}
|
||||
message SurveyBundleInfo{
|
||||
string bundleName = 1;
|
||||
string startAt = 2;
|
||||
string expiredAt = 3;
|
||||
int32 bundleAccountNumber = 4;
|
||||
int32 bundleVideoNumber = 5;
|
||||
int32 increaseVideoNumber = 6;
|
||||
int32 bundleImageNumber = 7;
|
||||
int32 bundleDataNumber = 8;
|
||||
int32 bundleCompetitiveNumber = 9;
|
||||
}
|
||||
|
||||
message GetQuestionnaireSurveyInfoResponse{
|
||||
string userName = 1;
|
||||
SurveyBundleInfo bundleInfo = 2;
|
||||
}
|
||||
|
||||
message SurveyAnswer {
|
||||
int32 BundleAccountScore = 1;
|
||||
int32 BundleVideoScore = 2;
|
||||
int32 IncreaseVideoScore = 3;
|
||||
int32 BundleImageScore = 4;
|
||||
int32 BundleDataScore = 5;
|
||||
int32 BundleCompetitiveScore = 6;
|
||||
int32 ServiceResponseSpeed = 7;
|
||||
int32 ServiceStaffProfessionalism = 8;
|
||||
}
|
||||
|
||||
message SurveyFeedback {
|
||||
string MeritsReview = 1;
|
||||
string SuggestionsorImprovements = 2;
|
||||
string AdditionalComments = 3;
|
||||
}
|
||||
|
||||
message CreateQuestionnaireSurveyAnswerRequest{
|
||||
string userTel = 1;
|
||||
SurveyAnswer surveyAnswer = 2;
|
||||
SurveyFeedback surveyFeedback = 3;
|
||||
string surveyUrl = 4;
|
||||
}
|
||||
|
||||
message CreateQuestionnaireSurveyAnswerResponse{
|
||||
}
|
||||
|
||||
message GetQuestionnaireSurveyListRequest{
|
||||
int32 page = 1;
|
||||
int32 pageSize = 2;
|
||||
string userName = 3;
|
||||
string surveyTitle = 4;
|
||||
int32 surveyStatus = 5;
|
||||
}
|
||||
|
||||
message SurveyListInfo{
|
||||
string userName = 1;
|
||||
string userTel = 2;
|
||||
string surveyTitle = 3;
|
||||
int32 surveyStatus = 4;
|
||||
string surveyUrl = 5;
|
||||
}
|
||||
|
||||
message GetQuestionnaireSurveyListResponse{
|
||||
repeated SurveyListInfo surveyList = 1;
|
||||
int32 total = 2;
|
||||
int32 page = 3;
|
||||
int32 size = 4;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1102,3 +1102,61 @@ func (this *UpdataInvoiceInfoReq) Validate() error {
|
||||
func (this *UpdataInvoiceInfoResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SendQuestionnaireSurveyRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SendQuestionnaireSurveyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetQuestionnaireSurveyInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SurveyBundleInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetQuestionnaireSurveyInfoResponse) Validate() error {
|
||||
if this.BundleInfo != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.BundleInfo); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("BundleInfo", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SurveyAnswer) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SurveyFeedback) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CreateQuestionnaireSurveyAnswerRequest) Validate() error {
|
||||
if this.SurveyAnswer != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SurveyAnswer); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyAnswer", err)
|
||||
}
|
||||
}
|
||||
if this.SurveyFeedback != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SurveyFeedback); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyFeedback", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *CreateQuestionnaireSurveyAnswerResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetQuestionnaireSurveyListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SurveyListInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetQuestionnaireSurveyListResponse) Validate() error {
|
||||
for _, item := range this.SurveyList {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyList", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -148,6 +148,11 @@ type BundleClient interface {
|
||||
GetPaymentCyclesByContractUUID(ctx context.Context, in *GetPaymentCyclesByContractUUIDRequest, opts ...grpc_go.CallOption) (*GetPaymentCyclesByContractUUIDResponse, common.ErrorWithAttachment)
|
||||
UpdateOrderRecordByOrderUuid(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
OrderListByOrderUuid(ctx context.Context, in *OrderInfoByOrderUuidRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
|
||||
// 问卷调查
|
||||
SendQuestionnaireSurvey(ctx context.Context, in *SendQuestionnaireSurveyRequest, opts ...grpc_go.CallOption) (*SendQuestionnaireSurveyResponse, common.ErrorWithAttachment)
|
||||
GetQuestionnaireSurveyInfo(ctx context.Context, in *GetQuestionnaireSurveyInfoRequest, opts ...grpc_go.CallOption) (*GetQuestionnaireSurveyInfoResponse, common.ErrorWithAttachment)
|
||||
CreateQuestionnaireSurveyAnswer(ctx context.Context, in *CreateQuestionnaireSurveyAnswerRequest, opts ...grpc_go.CallOption) (*CreateQuestionnaireSurveyAnswerResponse, common.ErrorWithAttachment)
|
||||
GetQuestionnaireSurveyList(ctx context.Context, in *GetQuestionnaireSurveyListRequest, opts ...grpc_go.CallOption) (*GetQuestionnaireSurveyListResponse, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -263,6 +268,10 @@ type BundleClientImpl struct {
|
||||
GetPaymentCyclesByContractUUID func(ctx context.Context, in *GetPaymentCyclesByContractUUIDRequest) (*GetPaymentCyclesByContractUUIDResponse, error)
|
||||
UpdateOrderRecordByOrderUuid func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
OrderListByOrderUuid func(ctx context.Context, in *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error)
|
||||
SendQuestionnaireSurvey func(ctx context.Context, in *SendQuestionnaireSurveyRequest) (*SendQuestionnaireSurveyResponse, error)
|
||||
GetQuestionnaireSurveyInfo func(ctx context.Context, in *GetQuestionnaireSurveyInfoRequest) (*GetQuestionnaireSurveyInfoResponse, error)
|
||||
CreateQuestionnaireSurveyAnswer func(ctx context.Context, in *CreateQuestionnaireSurveyAnswerRequest) (*CreateQuestionnaireSurveyAnswerResponse, error)
|
||||
GetQuestionnaireSurveyList func(ctx context.Context, in *GetQuestionnaireSurveyListRequest) (*GetQuestionnaireSurveyListResponse, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -925,6 +934,30 @@ func (c *bundleClient) OrderListByOrderUuid(ctx context.Context, in *OrderInfoBy
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderListByOrderUuid", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) SendQuestionnaireSurvey(ctx context.Context, in *SendQuestionnaireSurveyRequest, opts ...grpc_go.CallOption) (*SendQuestionnaireSurveyResponse, common.ErrorWithAttachment) {
|
||||
out := new(SendQuestionnaireSurveyResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendQuestionnaireSurvey", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetQuestionnaireSurveyInfo(ctx context.Context, in *GetQuestionnaireSurveyInfoRequest, opts ...grpc_go.CallOption) (*GetQuestionnaireSurveyInfoResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetQuestionnaireSurveyInfoResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetQuestionnaireSurveyInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateQuestionnaireSurveyAnswer(ctx context.Context, in *CreateQuestionnaireSurveyAnswerRequest, opts ...grpc_go.CallOption) (*CreateQuestionnaireSurveyAnswerResponse, common.ErrorWithAttachment) {
|
||||
out := new(CreateQuestionnaireSurveyAnswerResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateQuestionnaireSurveyAnswer", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetQuestionnaireSurveyList(ctx context.Context, in *GetQuestionnaireSurveyListRequest, opts ...grpc_go.CallOption) (*GetQuestionnaireSurveyListResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetQuestionnaireSurveyListResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetQuestionnaireSurveyList", in, out)
|
||||
}
|
||||
|
||||
// BundleServer is the server API for Bundle service.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -1049,6 +1082,11 @@ type BundleServer interface {
|
||||
GetPaymentCyclesByContractUUID(context.Context, *GetPaymentCyclesByContractUUIDRequest) (*GetPaymentCyclesByContractUUIDResponse, error)
|
||||
UpdateOrderRecordByOrderUuid(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
OrderListByOrderUuid(context.Context, *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error)
|
||||
// 问卷调查
|
||||
SendQuestionnaireSurvey(context.Context, *SendQuestionnaireSurveyRequest) (*SendQuestionnaireSurveyResponse, error)
|
||||
GetQuestionnaireSurveyInfo(context.Context, *GetQuestionnaireSurveyInfoRequest) (*GetQuestionnaireSurveyInfoResponse, error)
|
||||
CreateQuestionnaireSurveyAnswer(context.Context, *CreateQuestionnaireSurveyAnswerRequest) (*CreateQuestionnaireSurveyAnswerResponse, error)
|
||||
GetQuestionnaireSurveyList(context.Context, *GetQuestionnaireSurveyListRequest) (*GetQuestionnaireSurveyListResponse, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -1381,6 +1419,18 @@ func (UnimplementedBundleServer) UpdateOrderRecordByOrderUuid(context.Context, *
|
||||
func (UnimplementedBundleServer) OrderListByOrderUuid(context.Context, *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OrderListByOrderUuid not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) SendQuestionnaireSurvey(context.Context, *SendQuestionnaireSurveyRequest) (*SendQuestionnaireSurveyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendQuestionnaireSurvey not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetQuestionnaireSurveyInfo(context.Context, *GetQuestionnaireSurveyInfoRequest) (*GetQuestionnaireSurveyInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionnaireSurveyInfo not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateQuestionnaireSurveyAnswer(context.Context, *CreateQuestionnaireSurveyAnswerRequest) (*CreateQuestionnaireSurveyAnswerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateQuestionnaireSurveyAnswer not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetQuestionnaireSurveyList(context.Context, *GetQuestionnaireSurveyListRequest) (*GetQuestionnaireSurveyListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionnaireSurveyList not implemented")
|
||||
}
|
||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -4541,6 +4591,122 @@ func _Bundle_OrderListByOrderUuid_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_SendQuestionnaireSurvey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SendQuestionnaireSurveyRequest)
|
||||
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("SendQuestionnaireSurvey", 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 _Bundle_GetQuestionnaireSurveyInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetQuestionnaireSurveyInfoRequest)
|
||||
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("GetQuestionnaireSurveyInfo", 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 _Bundle_CreateQuestionnaireSurveyAnswer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateQuestionnaireSurveyAnswerRequest)
|
||||
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("CreateQuestionnaireSurveyAnswer", 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 _Bundle_GetQuestionnaireSurveyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetQuestionnaireSurveyListRequest)
|
||||
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("GetQuestionnaireSurveyList", 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)
|
||||
}
|
||||
|
||||
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -4980,6 +5146,22 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "OrderListByOrderUuid",
|
||||
Handler: _Bundle_OrderListByOrderUuid_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendQuestionnaireSurvey",
|
||||
Handler: _Bundle_SendQuestionnaireSurvey_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuestionnaireSurveyInfo",
|
||||
Handler: _Bundle_GetQuestionnaireSurveyInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateQuestionnaireSurveyAnswer",
|
||||
Handler: _Bundle_CreateQuestionnaireSurveyAnswer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuestionnaireSurveyList",
|
||||
Handler: _Bundle_GetQuestionnaireSurveyList_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
||||
@ -68,6 +68,7 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
&model.Customer{},
|
||||
&model.Invoice{},
|
||||
&model.PaperInvoiceAddress{},
|
||||
&model.QuestionnaireSurvey{},
|
||||
)
|
||||
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "platform_ids") == false {
|
||||
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "platform_ids"); err != nil {
|
||||
|
||||
@ -126,3 +126,11 @@ const (
|
||||
IsExpired = 1 //已过期
|
||||
NotExpired = 0 //未过期
|
||||
)
|
||||
|
||||
// 问卷状态
|
||||
const (
|
||||
//已发送
|
||||
QuestionnaireSent = 1
|
||||
//已提交
|
||||
QuestionnaireSubmitted = 2
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user