|
@@ -3,6 +3,8 @@ package biapprove
|
|
|
import (
|
|
|
"eta_gn/eta_api/controllers"
|
|
|
"eta_gn/eta_api/models"
|
|
|
+ "eta_gn/eta_api/utils"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
type BIApproveController struct {
|
|
@@ -15,9 +17,7 @@ type BIApproveController struct {
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码"
|
|
|
// @Param ListType query int true "列表类型:1-待处理;2-已处理;3-我发起的"
|
|
|
-// @Param ReportType query int false "报告类型:1-中文研报;2-英文研报;3-智能研报"
|
|
|
-// @Param ClassifyIdFirst query int false "一级分类ID"
|
|
|
-// @Param ClassifyIdSecond query int false "二级分类ID"
|
|
|
+// @Param ClassifyId query int false "分类ID"
|
|
|
// @Param Keyword query string false "搜索关键词"
|
|
|
// @Param ApproveState query int false "审批状态:1-待审批;2-已审批;3-已驳回;4-已撤回"
|
|
|
// @Param TimeType query int false "时间类型:1-提交时间;2-处理时间;3-审批时间"
|
|
@@ -37,4 +37,77 @@ func (this *BIApproveController) List() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ listType, _ := this.GetInt("ListType")
|
|
|
+ approveState, _ := this.GetInt("ApproveState")
|
|
|
+ timeType, _ := this.GetInt("TimeType")
|
|
|
+ startTime := this.GetString("StartTime")
|
|
|
+ endTime := this.GetString("EndTime")
|
|
|
+ // sortField, _ := this.GetInt("SortField")
|
|
|
+ // sortRule, _ := this.GetInt("SortRule")
|
|
|
+ classifyId, _ := this.GetInt("ClassifyId")
|
|
|
+ keyword := this.GetString("Keyword")
|
|
|
+
|
|
|
+ var pars []interface{}
|
|
|
+ var condition string
|
|
|
+
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize10
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ if classifyId > 0 {
|
|
|
+ condition += ` AND classify_id = ? `
|
|
|
+ pars = append(pars, classifyId)
|
|
|
+ }
|
|
|
+ if keyword != "" {
|
|
|
+ condition += ` AND bi_title LIKE ? `
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, keyword, 1)
|
|
|
+ }
|
|
|
+ if approveState > 0 {
|
|
|
+ condition += ` AND a.state = ? `
|
|
|
+ pars = append(pars, approveState)
|
|
|
+ }
|
|
|
+ if startTime != "" && endTime != "" {
|
|
|
+ _, err := time.Parse(utils.FormatDate, startTime)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "开始时间格式错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ endTime, err := time.Parse(utils.FormatDate, endTime)
|
|
|
+ endTime = endTime.AddDate(0, 0, 1)
|
|
|
+ switch timeType {
|
|
|
+ case 1:
|
|
|
+ condition += ` AND create_time BETWEEN ? AND ? `
|
|
|
+ pars = append(pars, startTime, endTime)
|
|
|
+ case 2:
|
|
|
+ condition += ` AND approve_time BETWEEN ? AND ? `
|
|
|
+ pars = append(pars, startTime, endTime)
|
|
|
+ case 3:
|
|
|
+ condition += ` AND approve_time BETWEEN ? AND ? `
|
|
|
+ pars = append(pars, startTime, endTime)
|
|
|
+ default:
|
|
|
+ br.Msg = "时间类型错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ switch listType {
|
|
|
+ case 1:
|
|
|
+ condition += ` AND a.state = 1 AND a.approve_user_id = ?`
|
|
|
+ pars = append(pars, this.SysUser.AdminId)
|
|
|
+ case 2:
|
|
|
+ condition += ` AND a.state IN (2,3) AND a.approve_user_id = ?`
|
|
|
+ pars = append(pars, this.SysUser.AdminId)
|
|
|
+ case 3:
|
|
|
+ condition += ` AND a.state = ? `
|
|
|
+ pars = append(pars, this.GetSession("username"))
|
|
|
+ default:
|
|
|
+ br.Msg = "列表类型错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
}
|