feat: 完善小组绩效与有效端统计并修复审查问题

This commit is contained in:
Yvan
2026-11-05 01:10:03 +08:00
parent ca9ce99b66
commit dc97690eb1
75 changed files with 5033 additions and 296 deletions
+139
View File
@@ -0,0 +1,139 @@
package handler
import (
"github.com/gin-gonic/gin"
"github.com/go-kratos/kratos/v3/errors"
"kra/internal/service/business"
"kra/internal/service/dto"
)
type BusinessPerformance struct {
service *business.BusinessPerformanceService
}
func (h *BusinessPerformance) Overview(c *gin.Context) {
var req dto.DashboardQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "首页查询参数不正确")
return
}
v, err := h.service.Overview(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) MyGoal(c *gin.Context) {
v, err := h.service.MyGoal(c.Request.Context())
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func NewBusinessPerformance(service *business.BusinessPerformanceService) *BusinessPerformance {
return &BusinessPerformance{service: service}
}
func (h *BusinessPerformance) Teams(c *gin.Context) {
v, err := h.service.Teams(c.Request.Context())
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) SaveTeams(c *gin.Context) {
var req dto.GroupSaveRequest
if c.ShouldBindJSON(&req) != nil {
Fail(c, "小组参数不正确")
return
}
v, err := h.service.SaveTeams(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) Profile(c *gin.Context) {
var req dto.MemberProfileRequest
if c.ShouldBindJSON(&req) != nil {
Fail(c, "商务档案参数不正确")
return
}
if err := h.service.UpdateProfile(c.Request.Context(), &req); err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OK(c)
}
func (h *BusinessPerformance) Query(c *gin.Context) { h.query(c, false) }
func (h *BusinessPerformance) Management(c *gin.Context) { h.query(c, true) }
func (h *BusinessPerformance) query(c *gin.Context, management bool) {
var req dto.PerformanceQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "绩效查询参数不正确")
return
}
v, err := h.service.Query(c.Request.Context(), &req, management)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) Details(c *gin.Context) {
var req dto.PerformanceDetailQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "明细查询参数不正确")
return
}
v, err := h.service.Details(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) Goals(c *gin.Context) {
var req dto.GoalQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "目标查询参数不正确")
return
}
v, err := h.service.GoalHistory(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, v)
}
func (h *BusinessPerformance) SaveGoal(c *gin.Context) {
var req dto.GoalRequest
if c.ShouldBindJSON(&req) != nil {
Fail(c, "目标须为整数或留空")
return
}
if err := h.service.SaveGoal(c.Request.Context(), &req); err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OK(c)
}
func (h *BusinessPerformance) Export(c *gin.Context) {
var req dto.PerformanceQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "导出参数不正确")
return
}
data, err := h.service.Export(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
c.Header("Content-Disposition", "attachment; filename=business-performance.xlsx")
c.Header("success", "true")
c.Data(200, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", data)
}
+1
View File
@@ -5,6 +5,7 @@ import "github.com/google/wire"
// ProviderSet wires the system HTTP handlers. Set itself is filled field by
// field so adding a handler only means adding its constructor here.
var ProviderSet = wire.NewSet(
NewBusinessPerformance,
NewOtherSettings,
NewBusiness,
NewBusinessPassword,
+39 -38
View File
@@ -1,42 +1,43 @@
package handler
type Set struct {
OtherSettings *OtherSettings
Ranking *Ranking
Workbench *Workbench
ServerAnalysis *ServerAnalysis
Analytics *Analytics
Ledger *Ledger
ChannelPortrait *ChannelPortrait
BusinessPortrait *BusinessPortrait
Channel *Channel
Activation *Activation
AlertRecord *AlertRecord
AlertRule *AlertRule
BusinessPromote *BusinessPromote
Business *Business
BusinessPassword *BusinessPassword
SMS *SMS
Authority *Authority
Menu *Menu
API *API
Permission *Permission
Organization *Organization
Announcement *Announcement
Email *Email
Payment *Payment
Task *Task
Media *Media
Audit *Audit
Export *Export
Version *Version
Dictionary *Dictionary
Parameter *Parameter
APIToken *APIToken
SystemConfig *SystemConfig
Public *Public
User *User
Navigation *Navigation
Session *Session
IntegrationConfig *IntegrationConfig
BusinessPerformance *BusinessPerformance
OtherSettings *OtherSettings
Ranking *Ranking
Workbench *Workbench
ServerAnalysis *ServerAnalysis
Analytics *Analytics
Ledger *Ledger
ChannelPortrait *ChannelPortrait
BusinessPortrait *BusinessPortrait
Channel *Channel
Activation *Activation
AlertRecord *AlertRecord
AlertRule *AlertRule
BusinessPromote *BusinessPromote
Business *Business
BusinessPassword *BusinessPassword
SMS *SMS
Authority *Authority
Menu *Menu
API *API
Permission *Permission
Organization *Organization
Announcement *Announcement
Email *Email
Payment *Payment
Task *Task
Media *Media
Audit *Audit
Export *Export
Version *Version
Dictionary *Dictionary
Parameter *Parameter
APIToken *APIToken
SystemConfig *SystemConfig
Public *Public
User *User
Navigation *Navigation
Session *Session
IntegrationConfig *IntegrationConfig
}