作者 陈志颖

fix:修复搜索功能

@@ -11,16 +11,20 @@ type SearchTaskCommand struct { @@ -11,16 +11,20 @@ type SearchTaskCommand struct {
11 CompanyId int64 `json:"companyId" valid:"Required"` 11 CompanyId int64 `json:"companyId" valid:"Required"`
12 // 任务发起者UID 12 // 任务发起者UID
13 Sponsor int64 `json:"sponsor,omitempty"` 13 Sponsor int64 `json:"sponsor,omitempty"`
14 - // 任务内容匹配 14 + // 任务内容匹配(我发布的),返回所有任务类型的任务
15 TaskContentMatch string `json:"taskContentMatch,omitempty"` 15 TaskContentMatch string `json:"taskContentMatch,omitempty"`
16 - // 任务名称匹配 16 + // 任务名称匹配(赚素币),返回任务类型为竞标任务和抢单任务
17 TaskNameMatch string `json:"taskNameMatch,omitempty"` 17 TaskNameMatch string `json:"taskNameMatch,omitempty"`
  18 + //// 任务名称匹配(进行中和已完成),返回任务状态为进行中和已完成的任务
  19 + //TaskStatusMatch string `json:"taskStatusMatch,omitempty"`
18 // 任务类型 20 // 任务类型
19 TaskType int `json:"taskType,omitempty"` 21 TaskType int `json:"taskType,omitempty"`
20 // 任务类型ID列表 22 // 任务类型ID列表
21 TaskTypes []int `json:"taskTypes,omitempty"` 23 TaskTypes []int `json:"taskTypes,omitempty"`
22 // 任务状态 24 // 任务状态
23 TaskStatus int `json:"taskStatus,omitempty"` 25 TaskStatus int `json:"taskStatus,omitempty"`
  26 + // 任务状态ID列表
  27 + TaskStates []int `json:"taskStates,omitempty"`
24 // 项目归属 28 // 项目归属
25 ProjectBelongs []int `json:"projectBelongs,omitempty"` 29 ProjectBelongs []int `json:"projectBelongs,omitempty"`
26 // 客户价值 30 // 客户价值
@@ -117,6 +117,14 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int @@ -117,6 +117,14 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int
117 if taskStatus, ok := queryOptions["taskStatus"]; ok && (taskStatus != 0) { 117 if taskStatus, ok := queryOptions["taskStatus"]; ok && (taskStatus != 0) {
118 query = query.Where(`task.task_status = ?`, taskStatus) 118 query = query.Where(`task.task_status = ?`, taskStatus)
119 } 119 }
  120 + if taskStates, ok := queryOptions["taskStates"]; ok && len(taskStates.([]int)) != 0 {
  121 + query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
  122 + for _, value := range taskStates.([]int) {
  123 + q = q.WhereOr("task.task_status = ?", value)
  124 + }
  125 + return q, nil
  126 + })
  127 + }
120 if taskType, ok := queryOptions["taskType"]; ok && (taskType != 0) { 128 if taskType, ok := queryOptions["taskType"]; ok && (taskType != 0) {
121 query = query.Where(`task.task_type = ?`, taskType) 129 query = query.Where(`task.task_type = ?`, taskType)
122 } 130 }
@@ -155,10 +163,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int @@ -155,10 +163,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int
155 if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") { 163 if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") {
156 query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskContentMatch.(string))) 164 query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskContentMatch.(string)))
157 } 165 }
158 - if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") { 166 + // 任务名称匹配(赚素币)
  167 + if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") { //
159 query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskNameMatch.(string))) 168 query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskNameMatch.(string)))
160 - query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2})) 169 + //query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2}))
161 } 170 }
  171 + //// 任务名称匹配(进行中和已完成),返回任务状态为进行中和已完成的任务
  172 + //if taskStatusMatch, ok := queryOptions["taskStatusMatch"]; ok && (taskStatusMatch != "") {
  173 + // query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskStatusMatch.(string)))
  174 + // query = query.Where("task.task_status IN (?)", pg.In([]int{3, 5}))
  175 + //}
162 if isRewardTake, ok := queryOptions["isRewardTake"]; ok && (isRewardTake != false) { 176 if isRewardTake, ok := queryOptions["isRewardTake"]; ok && (isRewardTake != false) {
163 query = query.Where(`task.is_reward_take = ?`, isRewardTake) 177 query = query.Where(`task.is_reward_take = ?`, isRewardTake)
164 } 178 }
@@ -100,9 +100,4 @@ func (controller *EmployeeController) ListEmployee() { @@ -100,9 +100,4 @@ func (controller *EmployeeController) ListEmployee() {
100 } 100 }
101 controller.Data["json"] = response 101 controller.Data["json"] = response
102 controller.ServeJSON() 102 controller.ServeJSON()
103 -}  
104 -  
105 -// TODO 导出员工素币情况列表,选择导出(ids),增加导出失败信息  
106 -func (controller *EmployeeController) ExportSuMoney() {  
107 -  
108 } 103 }
@@ -399,6 +399,22 @@ func (controller *SuMoneyController) ListDeadline() { @@ -399,6 +399,22 @@ func (controller *SuMoneyController) ListDeadline() {
399 controller.ServeJSON() 399 controller.ServeJSON()
400 } 400 }
401 401
  402 +// 返回兑换素币清单排行榜
  403 +func (controller *SuMoneyController) ExchangeCashListRanking() {
  404 + cashPoolService := service.NewCashPoolService(nil)
  405 + exchangeListRankingQuery := &query.ExchangeListRankingQuery{}
  406 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)
  407 + data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)
  408 + var response utils.JsonResponse
  409 + if err != nil {
  410 + response = utils.ResponseError(controller.Ctx, err)
  411 + } else {
  412 + response = utils.ResponseData(controller.Ctx, data)
  413 + }
  414 + controller.Data["json"] = response
  415 + controller.ServeJSON()
  416 +}
  417 +
402 // 导出素币兑换清单,选择导出(ids),增加导出失败信息 418 // 导出素币兑换清单,选择导出(ids),增加导出失败信息
403 func (controller *SuMoneyController) ExportExchangeList() { 419 func (controller *SuMoneyController) ExportExchangeList() {
404 cashPoolService := service.NewCashPoolService(nil) 420 cashPoolService := service.NewCashPoolService(nil)
@@ -482,18 +498,8 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { @@ -482,18 +498,8 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() {
482 498
483 } 499 }
484 500
485 -// 返回兑换素币清单排行榜  
486 -func (controller *SuMoneyController) ExchangeCashListRanking() {  
487 - cashPoolService := service.NewCashPoolService(nil)  
488 - exchangeListRankingQuery := &query.ExchangeListRankingQuery{}  
489 - json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)  
490 - data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)  
491 - var response utils.JsonResponse  
492 - if err != nil {  
493 - response = utils.ResponseError(controller.Ctx, err)  
494 - } else {  
495 - response = utils.ResponseData(controller.Ctx, data)  
496 - }  
497 - controller.Data["json"] = response  
498 - controller.ServeJSON()  
499 -}  
  501 +// TODO 导出员工素币情况列表,选择导出(ids),增加导出失败信息
  502 +func (controller *SuMoneyController) ExportSuMoney() {
  503 +
  504 +}
  505 +
@@ -11,5 +11,5 @@ func init() { @@ -11,5 +11,5 @@ func init() {
11 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Get:GetEmployee") 11 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Get:GetEmployee")
12 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Delete:RemoveEmployee") 12 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Delete:RemoveEmployee")
13 beego.Router("/employees/", &controllers.EmployeeController{}, "Get:ListEmployee") 13 beego.Router("/employees/", &controllers.EmployeeController{}, "Get:ListEmployee")
14 - beego.Router("/employees/export", &controllers.EmployeeController{}, "Post:ExportSuMoney") // 导出员工素币情况列表 14 + //beego.Router("/employees/export", &controllers.EmployeeController{}, "Post:ExportSuMoney") // 导出员工素币情况列表
15 } 15 }
@@ -12,7 +12,8 @@ func init() { @@ -12,7 +12,8 @@ func init() {
12 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") // 兑换素币 12 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") // 兑换素币
13 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") // 搜索素币事务记录 13 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") // 搜索素币事务记录
14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计 14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计
15 - beego.Router("/su-money/su-money-transaction-records/export", &controllers.SuMoneyController{}, "Post:ExportSuMoneyTransactionRecord") // 导出素币事务记录 15 + beego.Router("/su-money/su-money-transaction-records/export-records", &controllers.SuMoneyController{}, "Post:ExportSuMoneyTransactionRecord") // 导出素币事务记录(流水)
  16 + beego.Router("/su-money/su-money-transaction-records/export-su-money", &controllers.SuMoneyController{}, "Post:ExportSuMoney") // 导出员工素币
16 17
17 /**********************************************现金池*******************************************/ 18 /**********************************************现金池*******************************************/
18 beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入 19 beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入