animeic 1 year ago
parent
commit
504aa84fe4
3 changed files with 0 additions and 114 deletions
  1. 0 89
      baishuihu/api/report.go
  2. 0 4
      baishuihu/api/router.go
  3. 0 21
      baishuihu/db/model/report.go

+ 0 - 89
baishuihu/api/report.go

@@ -1,89 +0,0 @@
-package api
-
-import (
-	"baishuihu/db/model"
-	"baishuihu/db/repo"
-	"baishuihu/log"
-	"errors"
-	"time"
-
-	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-func Report(r *GinRouter) {
-	r.POST("/report/create", CreateReport)
-	r.POST("/report/delete/:id", DeleteReport)
-	r.GET("/report/list", ReportList)
-	r.GET("/report/detail/:id", ReportDetail)
-	r.POST("/report/update", UpdateReport)
-
-}
-
-func CreateReport(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var report model.Report
-	err := c.ShouldBindJSON(&report)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	report.CreateTime = time.Now()
-	report.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionReport, &report)
-}
-
-func DeleteReport(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionReport, _id)
-}
-
-func ReportList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	page, size, query := UtilQueryPageSize(c)
-	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionReport,
-		Page:        page,
-		Size:        size,
-		Query:       query,
-		Sort:        bson.M{"createTime": -1},
-	})
-}
-
-func ReportDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	cate := &model.Report{}
-	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionReport,
-		Query:       repo.Map{"_id": id},
-	}, cate)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-
-	if !found {
-		return nil, errors.New("未找到该数据")
-	}
-	return cate, nil
-}
-
-func UpdateReport(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var cate model.Report
-	err := c.ShouldBindJSON(&cate)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	if cate.Id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionReport, cate.Id.Hex(), &cate)
-}

+ 0 - 4
baishuihu/api/router.go

@@ -17,11 +17,7 @@ func RegRouters(svc *Service) {
 	Banner(root)
 	Upload(root)
 	// 临时展示接口
-	Report(root)
 	root.GET("/printr", Printr)
-	root.GET("/sync", SyncType)
-	// 同步上传文件地址
-	root.GET("/syncStatic", SyncStaticAddr)
 
 }
 

+ 0 - 21
baishuihu/db/model/report.go

@@ -1,21 +0,0 @@
-package model
-
-import (
-	"time"
-
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-type Report struct {
-	Id          primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	ProjectName string             `bson:"projectName,omitempty" json:"projectName"` // 项目名称
-	CompanyName string             `bson:"companyName,omitempty" json:"companyName"` // 策划单位
-	Type        string             `bson:"type,omitempty" json:"type"`               // 投资类别 社会投资
-	Amount      float64            `bson:"amount,omitempty" json:"amount"`           // 金额
-	//  进度, 0:无 1:项目评审 2:预算到位 3:项目招标 4:协议签订 5:清单发布 6:项目建设 7:项目验收 8:项目考评
-	Stage      *int      `bson:"stage,omitempty" json:"stage"`
-	Status     *int      `bson:"status,omitempty" json:"status"` // 0:未启动 1:已启动 -1:存在问题
-	Reason     string    `bson:"reason,omitempty" json:"reason"` // 问题原因
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
-}