ソースを参照

feature(项目):添加过滤条件,钉钉项目降级审批流修改

ZZH-wl 2 年 前
コミット
cfd5afb33f

+ 9 - 5
opms_parent/app/model/proj/proj_business.go

@@ -16,10 +16,14 @@ type ProjBusiness internal.ProjBusiness
 // Fill with you ideas below.
 
 type ProjBusinessSearchReq struct {
-	NboName  string `json:"nboName"`  // 项目名称
-	CustName string `json:"custName"` // 客户名称
-	SaleName string `json:"saleName"` // 销售姓名
-	NboType  string `json:"nboType"`  // 项目类别(A类B类C类)
+	NboName         string `json:"nboName"`         // 项目名称
+	CustName        string `json:"custName"`        // 客户名称
+	SaleName        string `json:"saleName"`        // 销售姓名
+	NboType         string `json:"nboType"`         // 项目类别(A类B类C类)
+	ProductLine     string `json:"productLine"`     // 产品线
+	NboSource       string `json:"nboSource"`       // 项目来源
+	DistributorName string `json:"distributorName"` // 经销商/代理商名称
+	//FilingTime      *gtime.Time `json:"filingTime"`      // 项目备案时间
 	request.PageReq
 }
 
@@ -48,7 +52,7 @@ type AddProjBusinessReq struct {
 	DistributorId    int    `json:"distributorId"        v:"required-unless:salesModel,10#经销商/代理商不能为空"`     // 经销商/代理商ID
 	DistributorName  string `json:"distributorName"        v:"required-unless:salesModel,10#经销商/代理商名称不能为空"` // 经销商/代理商名称
 
-	ProductLine string `json:"ProductLine"        v:"required#产品线不能为空"` // 产品线
+	ProductLine string `json:"productLine"        v:"required#产品线不能为空"` // 产品线
 	IsBig       string `json:"isBig"        v:"required#是否大项目不能为空"`     // 是否大项目
 
 	NboBudget        float64     `json:"nboBudget"`        // 项目预算

+ 33 - 13
opms_parent/app/service/proj/business.go

@@ -51,11 +51,20 @@ func (p *businessService) GetList(req *model.ProjBusinessSearchReq) (total int,
 	if req.NboType != "" {
 		db = db.Where("proj."+p.Dao.C.NboType, req.NboType)
 	}
+	if req.ProductLine != "" {
+		db = db.Where("proj."+p.Dao.C.ProductLine, req.ProductLine)
+	}
+	if req.NboSource != "" {
+		db = db.Where("proj."+p.Dao.C.NboSource, req.NboSource)
+	}
+	if req.DistributorName != "" {
+		db = db.Where("proj."+p.Dao.C.DistributorName, "%"+req.DistributorName+"%")
+	}
 	if req.BeginTime != "" {
-		db = db.WhereGTE("proj."+p.Dao.C.CreatedTime, req.BeginTime)
+		db = db.WhereGTE("proj."+p.Dao.C.FilingTime, req.BeginTime)
 	}
 	if req.EndTime != "" {
-		db = db.WhereLTE("proj."+p.Dao.C.CreatedTime, req.EndTime)
+		db = db.WhereLTE("proj."+p.Dao.C.FilingTime, req.EndTime)
 	}
 	total, err = db.Count()
 	if err != nil {
@@ -732,26 +741,37 @@ func (p *businessService) BusinessUpgradeNotify(flow *workflowModel.PlatWorkflow
 	return nil
 }
 
-// BusinessDowngrade 项目降级
-func (p *businessService) BusinessDowngrade(req *model.BusinessDowngradeReq) error {
-	business, err := p.BusinessGradation(req.Id, req.NboType, "down")
-	if err != nil {
-		return err
-	}
+// 获取项目的钉钉审批的降级类型
+func (p *businessService) getBusDingDowngradeType(dbNboType, reqNboType string) string {
 	var downgradeType string
 	switch true {
-	case business.NboType == StatusB && req.NboType == StatusC:
+	case dbNboType == StatusB && reqNboType == StatusC:
 		downgradeType = "option_0"
-	case business.NboType == StatusA && req.NboType == StatusB:
+	case dbNboType == StatusA && reqNboType == StatusB:
 		downgradeType = "option_1"
-	case business.NboType == StatusA && req.NboType == StatusC:
+	case dbNboType == StatusA && reqNboType == StatusC:
 		downgradeType = "option_2"
-	case business.NboType == StatusA && req.NboType == StatusReserve:
+	case dbNboType == StatusA && reqNboType == StatusReserve:
 		downgradeType = "option_YZMFJYQQK6O0"
+	case dbNboType == StatusB && reqNboType == StatusReserve:
+		downgradeType = "option_232GR5NMFCSG0"
+	case dbNboType == StatusC && reqNboType == StatusReserve:
+		downgradeType = "option_1ZV2GJLDKQOW0"
 	default:
-		return myerrors.TipsError("错误的降级类型")
 	}
+	return downgradeType
+}
 
+// BusinessDowngrade 项目降级
+func (p *businessService) BusinessDowngrade(req *model.BusinessDowngradeReq) error {
+	business, err := p.BusinessGradation(req.Id, req.NboType, "down")
+	if err != nil {
+		return err
+	}
+	downgradeType := p.getBusDingDowngradeType(business.NboType, req.NboType)
+	if downgradeType == "" {
+		return myerrors.TipsError("错误的降级类型")
+	}
 	businessMap := g.Map{
 		p.Dao.C.ApproStatus: ApprovalWaiting,
 	}