WH01243 2 жил өмнө
parent
commit
5dcfde3dfd

+ 28 - 0
jyBXCore/api/internal/handler/projectStatisticsHandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"jyBXCore/api/internal/logic"
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+)
+
+func projectStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PtatisticsListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewProjectStatisticsLogic(r.Context(), svcCtx)
+		resp, err := l.ProjectStatistics(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 28 - 0
jyBXCore/api/internal/handler/pushStatisticsHandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"jyBXCore/api/internal/logic"
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+)
+
+func pushStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PtatisticsListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewPushStatisticsLogic(r.Context(), svcCtx)
+		resp, err := l.PushStatistics(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 48 - 0
jyBXCore/api/internal/logic/projectStatisticsLogic.go

@@ -0,0 +1,48 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"context"
+	"jyBXCore/rpc/type/bxcore"
+
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ProjectStatisticsLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewProjectStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProjectStatisticsLogic {
+	return &ProjectStatisticsLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ProjectStatisticsLogic) ProjectStatistics(req *types.PtatisticsListReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+	for k, v := range req.EntUserIdArr {
+		req.EntUserIdArr[k] = encrypt.SE.Decode4Hex(v)
+	}
+	res, err := l.svcCtx.BxCore.ProjectStatistics(l.ctx, &bxcore.StatisticsListReq{
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionId:   req.PositionId,
+		EntUserIdArr: req.EntUserIdArr,
+		DeptId:       req.DeptId,
+		StartTime:    req.StartTime,
+		EndTime:      req.EndTime,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonResp{
+		Data: res.Data,
+	}, nil
+}

+ 48 - 0
jyBXCore/api/internal/logic/pushStatisticsLogic.go

@@ -0,0 +1,48 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"context"
+	"jyBXCore/rpc/type/bxcore"
+
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type PushStatisticsLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewPushStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PushStatisticsLogic {
+	return &PushStatisticsLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *PushStatisticsLogic) PushStatistics(req *types.PtatisticsListReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+	for k, v := range req.EntUserIdArr {
+		req.EntUserIdArr[k] = encrypt.SE.Decode4Hex(v)
+	}
+	res, err := l.svcCtx.BxCore.PushStatistics(l.ctx, &bxcore.StatisticsListReq{
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionId:   req.PositionId,
+		EntUserIdArr: req.EntUserIdArr,
+		DeptId:       req.DeptId,
+		StartTime:    req.StartTime,
+		EndTime:      req.EndTime,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonResp{
+		Data: res.Data,
+	}, nil
+}

+ 43 - 0
jyBXCore/rpc/internal/logic/projectstatisticslogic.go

@@ -0,0 +1,43 @@
+package logic
+
+import (
+	"context"
+	"jyBXCore/rpc/service"
+
+	"jyBXCore/rpc/internal/svc"
+	"jyBXCore/rpc/type/bxcore"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ProjectStatisticsLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewProjectStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProjectStatisticsLogic {
+	return &ProjectStatisticsLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 参标项目统计
+func (l *ProjectStatisticsLogic) ProjectStatistics(in *bxcore.StatisticsListReq) (*bxcore.ProjectStatisticsDataRes, error) {
+	// todo: add your logic here and delete this line
+
+	participateService := service.ParticipateStatistics{
+		PositionId: in.PositionId,
+		EntId:      in.EntId,
+		DeptId:     in.EntId,
+		EntUserId:  in.EntUserId,
+	}
+	data := participateService.ProjectStatistics(in.EntUserIdArr, in.StartTime, in.EndTime)
+	return &bxcore.ProjectStatisticsDataRes{
+		ErrCode: 0,
+		ErrMsg:  "",
+		Data:    data,
+	}, nil
+}

+ 42 - 0
jyBXCore/rpc/internal/logic/pushstatisticslogic.go

@@ -0,0 +1,42 @@
+package logic
+
+import (
+	"context"
+	"jyBXCore/rpc/service"
+
+	"jyBXCore/rpc/internal/svc"
+	"jyBXCore/rpc/type/bxcore"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type PushStatisticsLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewPushStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PushStatisticsLogic {
+	return &PushStatisticsLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 推送参标统计
+func (l *PushStatisticsLogic) PushStatistics(in *bxcore.StatisticsListReq) (*bxcore.PushStatisticsDataRes, error) {
+	// todo: add your logic here and delete this line
+	participateService := service.ParticipateStatistics{
+		PositionId: in.PositionId,
+		EntId:      in.EntId,
+		DeptId:     in.EntId,
+		EntUserId:  in.EntUserId,
+	}
+	data := participateService.PushStatistics(in.EntUserIdArr, in.StartTime, in.EndTime)
+	return &bxcore.PushStatisticsDataRes{
+		ErrCode: 0,
+		ErrMsg:  "",
+		Data:    data,
+	}, nil
+}