Compare commits

..

No commits in common. "main" and "feat-hjj-MetricsManager#260226" have entirely different histories.

16 changed files with 5647 additions and 7832 deletions

View File

@ -2,7 +2,6 @@ package controller
import (
"context"
"errors"
"micro-bundle/internal/logic"
"micro-bundle/pb/bundle"
)
@ -96,13 +95,3 @@ func (b *BundleProvider) GetBundleBalanceLayout(_ context.Context, req *bundle.G
func (b *BundleProvider) SetBundleBalanceLayout(_ context.Context, req *bundle.SetBundleBalanceLayoutReq) (*bundle.SetBundleBalanceLayoutResp, error) {
return logic.SetBundleBalanceLayout(req)
}
// 更新余量表数据
func (b *BundleProvider) UpdateBundleBalance(_ context.Context, req *bundle.UpdateBundleBalanceReq) (*bundle.UpdateBundleBalanceResp, error) {
var resp bundle.UpdateBundleBalanceResp
err := logic.UpdateBundleBalance()
if err != nil {
return nil, errors.New("更新余量表数据失败")
}
return &resp, nil
}

View File

@ -1,23 +0,0 @@
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)
}

View File

@ -692,9 +692,6 @@ func GetReconciliationList(req *bundle.GetReconciliationListReq) (*bundle.GetRec
if req.SerialNumber != "" {
modelObj = modelObj.Where("serial_number like ?", "%"+req.SerialNumber+"%")
}
if req.AntomNum != "" {
modelObj = modelObj.Where("antom_num like ?", "%"+req.AntomNum+"%")
}
if err := modelObj.Count(&res.Total).Error; err != nil {
return nil, fmt.Errorf("查询总数失败: %v", err)
}
@ -717,16 +714,9 @@ func CreateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonRes
if req.SerialNumber != "" {
var existing model.Reconciliation
err = app.ModuleClients.BundleDB.Where("serial_number = ?", req.SerialNumber).First(&existing).Error
switch {
case err == nil:
if err = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
Where("serial_number = ?", req.SerialNumber).
Update("antom_num", req.AntomNum).Error; err != nil {
return nil, fmt.Errorf("更新对账单失败: %v", err)
}
if err == nil {
// 说明这笔流水存在对账单
return &bundle.CommonResponse{Msg: "创建对账单成功"}, nil
case !errors.Is(err, gorm.ErrRecordNotFound):
return nil, fmt.Errorf("查询对账单失败: %v", err)
}
}
@ -745,13 +735,14 @@ func CreateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonRes
SerialNumber: req.SerialNumber,
CreationTime: time.Now().Format("2006-01-02 15:04:05"),
HandlingFee: req.HandlingFee,
AntomNum: req.AntomNum,
}
// 创建记录
if err := app.ModuleClients.BundleDB.Create(record).Error; err != nil {
return nil, fmt.Errorf("创建对账单失败: %v", err)
}
// 返回成功响应
return &bundle.CommonResponse{Msg: "创建对账单成功"}, nil
}
func UpdateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
@ -775,7 +766,6 @@ func UpdateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonRes
PayStatus: int(req.PayStatus),
SerialNumber: req.SerialNumber,
HandlingFee: req.HandlingFee,
AntomNum: req.AntomNum,
}
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
return nil, fmt.Errorf("更新对账单失败: %v", err)

View File

@ -1,228 +0,0 @@
package dao
import (
"encoding/json"
"errors"
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"micro-bundle/pkg/app"
"micro-bundle/pkg/msg"
"time"
"github.com/google/uuid"
"github.com/samber/lo"
"gorm.io/gorm"
)
// 电话号码映射表:原始号码 -> 目标号码
var phoneMapping = map[string]string{
"15863272183": "15624971336", //毕德瑞
"15039229900": "18803928946", //陈春芳
"13832480736": "17746107444", //程宝江
"19290778586": "13196080727", //董跃亭
"18710227028": "13954838868", //方民
"17801586080": "15233398990", //韩玉玲
}
// 使用示例:仅当号码在白名单中时才返回映射结果,否则返回原号码
func MapPhoneIfInList(phone string) string {
if phoneMapping[phone] != "" {
return phoneMapping[phone]
}
return phone
}
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp *bundle.SendQuestionnaireSurveyResponse, err error) {
resp = new(bundle.SendQuestionnaireSurveyResponse)
phone := MapPhoneIfInList(req.UserTel)
userInfo := &model.UserInfo{}
err = app.ModuleClients.BundleDB.Raw(`
SELECT
mau.id as user_id,
mau.sub_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 = 0
where mau.deleted_at = 0 and mau.tel_num = ?
`, phone).Scan(&userInfo).Error
if err != nil {
return resp, err
}
if userInfo.UserId == 0 {
resp.Status = 1
return resp, nil
}
//判断是否在指定id列表中
userIds := []int{76, 77, 80, 82, 83, 98, 110, 119, 121, 137, 138, 140, 149, 152, 155, 156, 157, 163, 171, 178, 179, 183, 184, 187, 189, 195, 210, 212, 221, 223, 224, 225, 227, 229, 232, 233, 249, 279, 311, 274, 268, 314, 327, 291, 326, 320, 273, 319, 278, 264, 313, 296, 393, 395, 387, 371, 391, 366, 398, 400, 410, 411, 412, 419, 421, 430, 432, 540, 592, 630, 1015}
if lo.Contains(userIds, userInfo.UserId) {
resp.Status = 0
} else {
resp.Status = 1
return resp, nil
}
questionnaireInfo := &model.QuestionnaireSurvey{}
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
Where("user_tel = ? and deleted_at is null", phone).
Order("created_at desc").
First(&questionnaireInfo).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
resp.Status = 0
} else {
return resp, err
}
}
if questionnaireInfo.UserId != 0 {
if questionnaireInfo.SurveyStatus == msg.QuestionnaireSent {
resp.Status = 0
return resp, nil
}
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 {
if errors.Is(err, gorm.ErrRecordNotFound) {
resp.Status = 1
return resp, 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 {
if errors.Is(err, gorm.ErrRecordNotFound) {
resp.Status = 1
return resp, nil
}
return resp, err
}
if bundleBalance.ID == 0 {
resp.Status = 1
return resp, nil
}
bundleInfo := &model.BundleInfo{
BundleName: orderRecord.BundleName,
StartAt: bundleBalance.StartAt,
ExpiredAt: bundleBalance.ExpiredAt,
BundleAccountNumber: 3,
BundleVideoNumber: bundleBalance.BundleLimitVideoConsumptionNumber,
IncreaseVideoNumber: bundleBalance.IncreaseVideoConsumptionNumber,
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")),
SubmitTime: 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) {
data = &model.QuestionnaireSurvey{}
phone := MapPhoneIfInList(req.UserTel)
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
Where("user_tel = ? and deleted_at is null", phone).
Order("created_at desc").
First(&data).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errors.New("问卷信息不存在")
}
return data, err
}
return data, nil
}
func CreateQuestionnaireSurveyAnswer(req *bundle.CreateQuestionnaireSurveyAnswerRequest) (err error) {
phone := MapPhoneIfInList(req.UserTel)
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", phone).
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,
"submit_by": req.SubmitBy,
}).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
}

View File

@ -89,9 +89,9 @@ newest_month AS (
active_windows AS (
SELECT
u.id AS user_id,
u.tel_num COLLATE utf8mb4_0900_ai_ci AS phone,
u.tel_num AS phone,
bor.uuid AS order_uuid,
bor.customer_num COLLATE utf8mb4_0900_ai_ci AS customer_num,
bor.customer_num,
bb.start_at,
bb.expired_at,
bb.bundle_video_number, bb.bundle_limit_video_number, bb.bundle_limit_video_expired_number,
@ -106,7 +106,7 @@ active_windows AS (
bb.bundle_competitive_number, bb.bundle_limit_competitive_number, bb.bundle_limit_competitive_expired_number,
bb.increase_competitive_number, bb.increase_limit_competitive_number, bb.increase_limit_competitive_expired_number,
bb.manual_competitive_number, bb.manual_competitive_consumption_number,
rn.name COLLATE utf8mb4_0900_ai_ci AS user_name
rn.name AS user_name
FROM ` + "`micro-account`.`user`" + ` u
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL AND rn.deleted_at = 0
INNER JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2
@ -188,7 +188,7 @@ cw_agg AS (
COUNT(CASE WHEN cw.work_category = 2 AND cw.cost = 1 AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS released_video_consumed,
COUNT(CASE WHEN cw.work_category = 1 AND cw.cost = 1 AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS released_post_consumed
FROM active_windows aw
LEFT JOIN cast_work cw ON cw.artist_phone = aw.phone
LEFT JOIN cast_work cw ON cw.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -196,10 +196,10 @@ cw_agg AS (
cwa_agg AS (
SELECT
aw.user_id,
COUNT(CASE WHEN cwa.deleted_at = 0 AND cwa.work_analysis_status != 1 AND cwa.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_data_count,
COUNT(CASE WHEN cwa.cost = 1 AND cwa.deleted_at = 0 AND cwa.work_analysis_status != 1 AND cwa.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS released_data_consumed
COUNT(CASE WHEN cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(aw.start_at) AND UNIX_TIMESTAMP(aw.expired_at) THEN 1 END) AS uploaded_data_count,
COUNT(CASE WHEN cwa.cost = 1 AND cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(aw.start_at) AND UNIX_TIMESTAMP(aw.expired_at) THEN 1 END) AS released_data_consumed
FROM active_windows aw
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone = aw.phone
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -210,7 +210,7 @@ ccr_agg AS (
COUNT(CASE WHEN ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_report_count,
COUNT(CASE WHEN ccr.cost = 1 AND ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS released_report_consumed
FROM active_windows aw
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone = aw.phone
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -220,7 +220,7 @@ cvs_agg AS (
aw.user_id,
COUNT(cvs.artist_uuid) AS uploaded_video_script_count
FROM active_windows aw
LEFT JOIN cast_video_script cvs ON CAST(aw.user_id AS CHAR) = cvs.artist_uuid
LEFT JOIN cast_video_script cvs ON CAST(aw.user_id AS CHAR) COLLATE utf8mb4_general_ci = cvs.artist_uuid COLLATE utf8mb4_general_ci
AND cvs.deleted_at = 0
AND cvs.created_at BETWEEN UNIX_TIMESTAMP(CONVERT_TZ(aw.start_at, '+00:00', '+00:00'))
AND UNIX_TIMESTAMP(CONVERT_TZ(aw.expired_at, '+00:00', '+00:00'))
@ -234,7 +234,7 @@ tar_agg AS (
COUNT(CASE WHEN tar.status = 1 AND tar.deleted_at = 0 AND tar.created_at BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS progress_task_count,
COUNT(CASE WHEN tar.status = 2 AND tar.deleted_at = 0 AND tar.created_at BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS complete_task_count
FROM active_windows aw
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num = aw.customer_num
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -273,7 +273,7 @@ assigned_pending_agg AS (
END
), 0) AS assigned_report_count
FROM active_windows aw
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num = aw.customer_num
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
AND tar.actual_status IN (1, 3)
AND tar.deleted_at = 0
AND tar.created_at BETWEEN aw.start_at AND aw.expired_at
@ -325,16 +325,9 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
whereClause = " WHERE " + strings.Join(whereParts, " AND ")
}
// 使用事务固定同一连接,仅对本次查询的 session 设置 collation不影响其他接口
tx := app.ModuleClients.BundleDB.Begin()
defer tx.Rollback()
if err := tx.Exec("SET NAMES utf8mb4 COLLATE utf8mb4_0900_ai_ci").Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "设置字符集失败", "设置字符集失败: ")
}
countSQL := cte + " SELECT COUNT(DISTINCT aw.customer_num) " + fromClause + whereClause
var total int64
if err := tx.Raw(countSQL, args...).Scan(&total).Error; err != nil {
if err := app.ModuleClients.BundleDB.Raw(countSQL, args...).Scan(&total).Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "查询总数失败", "查询艺人上传统计总数失败: ")
}
@ -433,7 +426,7 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
}
items := make([]dto.ArtistUploadStatsItem, 0)
if err := tx.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
if err := app.ModuleClients.BundleDB.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "查询艺人余额与上传数据失败", "查询艺人余额与上传数据失败: ")
}
@ -481,20 +474,20 @@ newest_month AS (
active_windows AS (
SELECT
u.id AS user_id,
u.tel_num COLLATE utf8mb4_0900_ai_ci AS phone,
u.tel_num AS phone,
bor.uuid AS order_uuid,
bor.customer_num COLLATE utf8mb4_0900_ai_ci AS customer_num,
bor.customer_num,
bb.start_at,
bb.expired_at,
bb.manual_video_number, bb.manual_video_consumption_number,
bb.manual_image_number, bb.manual_image_consumption_number,
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
bb.manual_competitive_number, bb.manual_competitive_consumption_number,
rn.name COLLATE utf8mb4_0900_ai_ci AS user_name
rn.name AS user_name
FROM ` + "`micro-account`.`user`" + ` u
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL AND rn.deleted_at = 0
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL
INNER JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2
INNER JOIN latest_bor bor ON bor.customer_id = u.id AND u.deleted_at = 0
INNER JOIN latest_bor bor ON bor.customer_id = u.id
INNER JOIN newest_month nm ON nm.user_id = u.id
INNER JOIN bundle_balance bb ON bb.user_id = u.id AND bb.order_uuid = bor.uuid AND bb.month = nm.month AND bb.deleted_at IS NULL
WHERE u.deleted_at = 0
@ -563,14 +556,14 @@ balance_sum AS (
GROUP BY bb2.user_id
),
-- 6. 作品统计只统计 origin_uuid 为空的作品
-- 6. 作品统计
cw_agg AS (
SELECT
aw.user_id,
COUNT(CASE WHEN cw.work_category = 2 AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_video_count,
COUNT(CASE WHEN cw.work_category = 1 AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_post_count
COUNT(CASE WHEN cw.work_category = 2 AND cw.deleted_at = 0 AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_video_count,
COUNT(CASE WHEN cw.work_category = 1 AND cw.deleted_at = 0 AND cw.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_post_count
FROM active_windows aw
LEFT JOIN cast_work cw ON cw.artist_phone = aw.phone
LEFT JOIN cast_work cw ON cw.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -578,9 +571,9 @@ cw_agg AS (
cwa_agg AS (
SELECT
aw.user_id,
COUNT(CASE WHEN cwa.deleted_at = 0 AND cwa.work_analysis_status != 1 AND cwa.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_data_count
COUNT(CASE WHEN cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(aw.start_at) AND UNIX_TIMESTAMP(aw.expired_at) THEN 1 END) AS uploaded_data_count
FROM active_windows aw
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone = aw.phone
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -590,7 +583,7 @@ ccr_agg AS (
aw.user_id,
COUNT(CASE WHEN ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_report_count
FROM active_windows aw
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone = aw.phone
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
GROUP BY aw.user_id
),
@ -600,7 +593,7 @@ cvs_agg AS (
aw.user_id,
COUNT(cvs.artist_uuid) AS uploaded_video_script_count
FROM active_windows aw
LEFT JOIN cast_video_script cvs ON CAST(aw.user_id AS CHAR) = cvs.artist_uuid
LEFT JOIN cast_video_script cvs ON CAST(aw.user_id AS CHAR) COLLATE utf8mb4_general_ci = cvs.artist_uuid COLLATE utf8mb4_general_ci
AND cvs.deleted_at = 0
AND cvs.created_at BETWEEN UNIX_TIMESTAMP(CONVERT_TZ(aw.start_at, '+00:00', '+00:00'))
AND UNIX_TIMESTAMP(CONVERT_TZ(aw.expired_at, '+00:00', '+00:00'))
@ -642,7 +635,7 @@ assigned_pending_agg AS (
END
), 0) AS assigned_report_count
FROM active_windows aw
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num = aw.customer_num
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
AND tar.actual_status IN (1, 3)
AND tar.deleted_at = 0
AND tar.created_at BETWEEN aw.start_at AND aw.expired_at
@ -661,16 +654,9 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
args = append(args, subNums)
args = append(args, nowMonth)
// 使用事务固定同一连接,仅对本次查询的 session 设置 collation不影响其他接口
tx2 := app.ModuleClients.BundleDB.Begin()
defer tx2.Rollback()
if err := tx2.Exec("SET NAMES utf8mb4 COLLATE utf8mb4_0900_ai_ci").Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "设置字符集失败", "设置字符集失败: ")
}
countSQL := cte + " SELECT COUNT(DISTINCT aw.customer_num) " + fromClause
var total int64
if err := tx2.Raw(countSQL, args...).Scan(&total).Error; err != nil {
if err := app.ModuleClients.BundleDB.Raw(countSQL, args...).Scan(&total).Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "查询可指派数量总数失败", "查询可指派数量总数失败: ")
}
@ -694,7 +680,7 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
}
items := make([]dto.ArtistPendingAssignItem, 0)
if err := tx2.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
if err := app.ModuleClients.BundleDB.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
return nil, 0, commonErr.ReturnError(err, "查询可指派数量失败", "查询可指派数量失败: ")
}

View File

@ -632,12 +632,8 @@ func BundleActivate(req *bundle.BundleActivateReq) error {
return dao.BundleActivate(req.Ids)
}
func UpdateBundleBalance() error {
err := dao.UpdateBundleBalance()
if err != nil {
return err
}
return nil
func UpdateBundleBalance() {
dao.UpdateBundleBalance()
}
func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBalanceExportResp, error) {

View File

@ -1,77 +0,0 @@
package logic
import (
"encoding/json"
"errors"
"fmt"
"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 := &model.BundleInfo{}
err = json.Unmarshal([]byte(data.BundleInfo), bundleInfo)
if err != nil {
return nil, errors.New("反序列化失败")
}
fmt.Println("获取套餐名称:", bundleInfo.BundleName)
resp.UserName = data.UserName
resp.BundleInfo = &bundle.SurveyBundleInfo{}
resp.BundleInfo.BundleName = bundleInfo.BundleName
resp.BundleInfo.StartAt = bundleInfo.StartAt.Format("2006-01-02 15:04:05")
resp.BundleInfo.ExpiredAt = bundleInfo.ExpiredAt.Format("2006-01-02 15:04:05")
resp.BundleInfo.BundleAccountNumber = int32(bundleInfo.BundleAccountNumber)
resp.BundleInfo.BundleVideoNumber = int32(bundleInfo.BundleVideoNumber)
resp.BundleInfo.IncreaseVideoNumber = int32(bundleInfo.IncreaseVideoNumber)
resp.BundleInfo.BundleImageNumber = int32(bundleInfo.BundleImageNumber)
resp.BundleInfo.BundleDataNumber = int32(bundleInfo.BundleDataNumber)
resp.BundleInfo.BundleCompetitiveNumber = int32(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) {
resp = &bundle.GetQuestionnaireSurveyListResponse{}
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,
UserNum: m.UserNum,
SurveyTitle: m.SurveyTitle,
SurveyStatus: int32(m.SurveyStatus),
SurveyUrl: m.SurveyUrl,
}
})
return resp, nil
}

View File

@ -1,75 +0,0 @@
package model
import (
"time"
"gorm.io/gorm"
)
type QuestionnaireSurvey struct {
gorm.Model
SurveyUUID string `gorm:"column:survey_uuid;comment:问卷UUID" json:"survey_uuid"`
UserId int `gorm:"column:user_id;comment:用户ID" json:"user_id"`
UserNum string `gorm:"column:user_num;comment:用户编号" json:"user_num"`
UserName string `gorm:"column:user_name;comment:用户姓名" json:"user_name"`
UserTel string `gorm:"column:user_tel;comment:用户电话" json:"user_tel"`
OrderUUID string `gorm:"column:order_uuid;comment:订单UUID" json:"order_uuid"`
SendTime time.Time `gorm:"column:send_time;comment:发送时间" json:"send_time"`
SubmitTime time.Time `gorm:"column:submit_time;comment:提交时间" json:"submit_time"`
SurveyTitle string `gorm:"column:survey_title;comment:问卷标题" json:"survey_title"`
SurveyStatus int `gorm:"column:survey_status;comment:问卷状态 1:已发送 2:已提交" json:"survey_status"`
BundleInfo string `gorm:"column:bundle_info;type:varchar(1024);comment:套餐信息" json:"bundle_info"`
SurveyAnswer string `gorm:"column:survey_answer;type:varchar(512);comment:问卷答案" json:"survey_answer"`
MeritsReview string `gorm:"column:merits_review;type:varchar(512);comment:优点评价" json:"merits_review"`
SuggestionsorImprovements string `gorm:"column:suggestionsor_improvements;type:varchar(512);comment:改进建议" json:"suggestionsor_improvements"`
AdditionalComments string `gorm:"column:additional_comments;type:varchar(512);comment:补充意见" json:"additional_comments"`
SurveyUrl string `gorm:"column:survey_url;comment:问卷URL" json:"survey_url"`
SubmitBy string `gorm:"column:submit_by;comment:提交人" json:"submit_by"`
}
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"`
}
type DbBundleInfo struct {
UserName string `json:"user_name"`
BundleName string `json:"bundle_name"`
StartAt time.Time `json:"start_at"`
ExpiredAt time.Time `json:"expired_at"`
BundleAccountNumber int32 `json:"bundle_account_number"`
BundleVideoNumber int32 `json:"bundle_video_number"`
IncreaseVideoNumber int32 `json:"increase_video_number"`
BundleImageNumber int32 `json:"bundle_image_number"`
BundleDataNumber int32 `json:"bundle_data_number"`
BundleCompetitiveNumber int32 `json:"bundle_competitive_number"`
}

View File

@ -18,5 +18,4 @@ type Reconciliation struct {
SerialNumber string `gorm:"column:serial_number;comment:流水号" json:"serialNumber"`
CreationTime string `gorm:"column:creation_time;comment:创建时间" json:"creationTime"`
HandlingFee string `gorm:"column:handling_fee;comment:手续费" json:"handlingFee"`
AntomNum string `gorm:"column:antom_num;comment:安通流水号" json:"antomNum"`
}

View File

@ -52,7 +52,6 @@ service Bundle {
//
rpc UpdateBundleBalance(UpdateBundleBalanceReq) returns (UpdateBundleBalanceResp) {} // ()
rpc BundleExtend(BundleExtendRequest) returns (BundleExtendResponse) {} //
rpc BundleExtendRecordsList(BundleExtendRecordsListRequest) returns (BundleExtendRecordsListResponse) {} //
rpc GetBundleBalanceList(GetBundleBalanceListReq) returns (GetBundleBalanceListResp) {} //
@ -147,13 +146,6 @@ 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;
@ -195,7 +187,6 @@ message GetReconciliationListReq{
int32 pageSize = 12;
repeated uint64 userIDS = 13;
string bundleAddOrderOn = 14;
string antomNum = 15;
}
message GetReconciliationListResp{
repeated ReconciliationInfo list = 1;
@ -220,7 +211,6 @@ message ReconciliationInfo{
uint64 userID = 14;
string handlingFee = 15;
string subNum = 16;
string antomNum = 17;
}
message OrderInfoByOrderNoRequest{
string orderNo = 1;
@ -722,12 +712,6 @@ message BatchGetValueAddServiceLangResponse{
}
//*********************************-over******************************************
message UpdateBundleBalanceReq{
}
message UpdateBundleBalanceResp{
}
message BundleExtendRequest{
int64 userId = 1;
uint32 accountAdditional = 2;
@ -2390,90 +2374,4 @@ 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;
string submitTime = 5;
string submitBy = 6;
string longitude = 7;
string latitude = 8;
string address = 9;
}
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 userNum = 3;
string surveyTitle = 4;
int32 surveyStatus = 5;
string surveyUrl = 6;
}
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

View File

@ -368,12 +368,6 @@ func (this *BatchGetValueAddServiceLangResponse) Validate() error {
}
return nil
}
func (this *UpdateBundleBalanceReq) Validate() error {
return nil
}
func (this *UpdateBundleBalanceResp) Validate() error {
return nil
}
func (this *BundleExtendRequest) Validate() error {
return nil
}
@ -1102,61 +1096,3 @@ 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
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v5.26.0
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.1
// source: pb/bundle.proto
package bundle
@ -65,7 +65,6 @@ type BundleClient interface {
BatchGetValueAddServiceLang(ctx context.Context, in *BatchGetValueAddServiceLangRequest, opts ...grpc_go.CallOption) (*BatchGetValueAddServiceLangResponse, common.ErrorWithAttachment)
DeleteValueAddService(ctx context.Context, in *DeleteValueAddServiceRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
// 余量管理
UpdateBundleBalance(ctx context.Context, in *UpdateBundleBalanceReq, opts ...grpc_go.CallOption) (*UpdateBundleBalanceResp, common.ErrorWithAttachment)
BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment)
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
GetBundleBalanceList(ctx context.Context, in *GetBundleBalanceListReq, opts ...grpc_go.CallOption) (*GetBundleBalanceListResp, common.ErrorWithAttachment)
@ -148,11 +147,6 @@ 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 {
@ -194,7 +188,6 @@ type BundleClientImpl struct {
CalculatePrice func(ctx context.Context, in *CalculatePriceRequest) (*CalculatePriceResponse, error)
BatchGetValueAddServiceLang func(ctx context.Context, in *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
DeleteValueAddService func(ctx context.Context, in *DeleteValueAddServiceRequest) (*CommonResponse, error)
UpdateBundleBalance func(ctx context.Context, in *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error)
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
@ -268,10 +261,6 @@ 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 {
@ -490,12 +479,6 @@ func (c *bundleClient) DeleteValueAddService(ctx context.Context, in *DeleteValu
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteValueAddService", in, out)
}
func (c *bundleClient) UpdateBundleBalance(ctx context.Context, in *UpdateBundleBalanceReq, opts ...grpc_go.CallOption) (*UpdateBundleBalanceResp, common.ErrorWithAttachment) {
out := new(UpdateBundleBalanceResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateBundleBalance", in, out)
}
func (c *bundleClient) BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment) {
out := new(BundleExtendResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -934,30 +917,6 @@ 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
@ -999,7 +958,6 @@ type BundleServer interface {
BatchGetValueAddServiceLang(context.Context, *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
DeleteValueAddService(context.Context, *DeleteValueAddServiceRequest) (*CommonResponse, error)
// 余量管理
UpdateBundleBalance(context.Context, *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error)
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
@ -1082,11 +1040,6 @@ 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()
}
@ -1197,9 +1150,6 @@ func (UnimplementedBundleServer) BatchGetValueAddServiceLang(context.Context, *B
func (UnimplementedBundleServer) DeleteValueAddService(context.Context, *DeleteValueAddServiceRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteValueAddService not implemented")
}
func (UnimplementedBundleServer) UpdateBundleBalance(context.Context, *UpdateBundleBalanceReq) (*UpdateBundleBalanceResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBundleBalance not implemented")
}
func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleExtend not implemented")
}
@ -1419,18 +1369,6 @@ 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
}
@ -2445,35 +2383,6 @@ func _Bundle_DeleteValueAddService_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Bundle_UpdateBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBundleBalanceReq)
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("UpdateBundleBalance", 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_BundleExtend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BundleExtendRequest)
if err := dec(in); err != nil {
@ -4591,122 +4500,6 @@ 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)
@ -4850,10 +4643,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "DeleteValueAddService",
Handler: _Bundle_DeleteValueAddService_Handler,
},
{
MethodName: "UpdateBundleBalance",
Handler: _Bundle_UpdateBundleBalance_Handler,
},
{
MethodName: "BundleExtend",
Handler: _Bundle_BundleExtend_Handler,
@ -5146,22 +4935,6 @@ 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",

View File

@ -1,10 +1,25 @@
package cron
import (
"log"
"micro-bundle/internal/logic"
"github.com/robfig/cron/v3"
)
func InitCronJob() {
c := cron.New(cron.WithSeconds())
spec := "0 0 0 1 * *"
_, err := c.AddFunc(spec, func() {
log.Printf("执行余量每月数据更新")
logic.UpdateBundleBalance()
})
if err != nil {
panic(err)
}
c.Start()
}

View File

@ -68,7 +68,6 @@ 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 {
@ -90,11 +89,6 @@ func loadMysqlConn(conn string) *gorm.DB {
fmt.Println(err)
}
}
if db.Migrator().HasColumn(&model.Reconciliation{}, "antom_num") == false {
if err := db.Migrator().AddColumn(&model.Reconciliation{}, "antom_num"); err != nil {
fmt.Println(err)
}
}
if err != nil {
// return nil
panic(err)

View File

@ -126,11 +126,3 @@ const (
IsExpired = 1 //已过期
NotExpired = 0 //未过期
)
// 问卷状态
const (
//已发送
QuestionnaireSent = 1
//已提交
QuestionnaireSubmitted = 2
)