作者 陈志颖

fix:修复搜索功能

... ... @@ -11,16 +11,20 @@ type SearchTaskCommand struct {
CompanyId int64 `json:"companyId" valid:"Required"`
// 任务发起者UID
Sponsor int64 `json:"sponsor,omitempty"`
// 任务内容匹配
// 任务内容匹配(我发布的),返回所有任务类型的任务
TaskContentMatch string `json:"taskContentMatch,omitempty"`
// 任务名称匹配
// 任务名称匹配(赚素币),返回任务类型为竞标任务和抢单任务
TaskNameMatch string `json:"taskNameMatch,omitempty"`
//// 任务名称匹配(进行中和已完成),返回任务状态为进行中和已完成的任务
//TaskStatusMatch string `json:"taskStatusMatch,omitempty"`
// 任务类型
TaskType int `json:"taskType,omitempty"`
// 任务类型ID列表
TaskTypes []int `json:"taskTypes,omitempty"`
// 任务状态
TaskStatus int `json:"taskStatus,omitempty"`
// 任务状态ID列表
TaskStates []int `json:"taskStates,omitempty"`
// 项目归属
ProjectBelongs []int `json:"projectBelongs,omitempty"`
// 客户价值
... ...
... ... @@ -117,6 +117,14 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int
if taskStatus, ok := queryOptions["taskStatus"]; ok && (taskStatus != 0) {
query = query.Where(`task.task_status = ?`, taskStatus)
}
if taskStates, ok := queryOptions["taskStates"]; ok && len(taskStates.([]int)) != 0 {
query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
for _, value := range taskStates.([]int) {
q = q.WhereOr("task.task_status = ?", value)
}
return q, nil
})
}
if taskType, ok := queryOptions["taskType"]; ok && (taskType != 0) {
query = query.Where(`task.task_type = ?`, taskType)
}
... ... @@ -155,10 +163,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int
if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") {
query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskContentMatch.(string)))
}
if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") {
// 任务名称匹配(赚素币)
if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") { //
query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskNameMatch.(string)))
query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2}))
//query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2}))
}
//// 任务名称匹配(进行中和已完成),返回任务状态为进行中和已完成的任务
//if taskStatusMatch, ok := queryOptions["taskStatusMatch"]; ok && (taskStatusMatch != "") {
// query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskStatusMatch.(string)))
// query = query.Where("task.task_status IN (?)", pg.In([]int{3, 5}))
//}
if isRewardTake, ok := queryOptions["isRewardTake"]; ok && (isRewardTake != false) {
query = query.Where(`task.is_reward_take = ?`, isRewardTake)
}
... ...
... ... @@ -100,9 +100,4 @@ func (controller *EmployeeController) ListEmployee() {
}
controller.Data["json"] = response
controller.ServeJSON()
}
// TODO 导出员工素币情况列表,选择导出(ids),增加导出失败信息
func (controller *EmployeeController) ExportSuMoney() {
}
\ No newline at end of file
... ...
... ... @@ -399,6 +399,22 @@ func (controller *SuMoneyController) ListDeadline() {
controller.ServeJSON()
}
// 返回兑换素币清单排行榜
func (controller *SuMoneyController) ExchangeCashListRanking() {
cashPoolService := service.NewCashPoolService(nil)
exchangeListRankingQuery := &query.ExchangeListRankingQuery{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)
data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
// 导出素币兑换清单,选择导出(ids),增加导出失败信息
func (controller *SuMoneyController) ExportExchangeList() {
cashPoolService := service.NewCashPoolService(nil)
... ... @@ -482,18 +498,8 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() {
}
// 返回兑换素币清单排行榜
func (controller *SuMoneyController) ExchangeCashListRanking() {
cashPoolService := service.NewCashPoolService(nil)
exchangeListRankingQuery := &query.ExchangeListRankingQuery{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeListRankingQuery)
data, err := cashPoolService.ExchangeListRanking(exchangeListRankingQuery)
var response utils.JsonResponse
if err != nil {
response = utils.ResponseError(controller.Ctx, err)
} else {
response = utils.ResponseData(controller.Ctx, data)
}
controller.Data["json"] = response
controller.ServeJSON()
}
\ No newline at end of file
// TODO 导出员工素币情况列表,选择导出(ids),增加导出失败信息
func (controller *SuMoneyController) ExportSuMoney() {
}
... ...
... ... @@ -11,5 +11,5 @@ func init() {
beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Get:GetEmployee")
beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Delete:RemoveEmployee")
beego.Router("/employees/", &controllers.EmployeeController{}, "Get:ListEmployee")
beego.Router("/employees/export", &controllers.EmployeeController{}, "Post:ExportSuMoney") // 导出员工素币情况列表
//beego.Router("/employees/export", &controllers.EmployeeController{}, "Post:ExportSuMoney") // 导出员工素币情况列表
}
... ...
... ... @@ -12,7 +12,8 @@ func init() {
beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") // 兑换素币
beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") // 搜索素币事务记录
beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计
beego.Router("/su-money/su-money-transaction-records/export", &controllers.SuMoneyController{}, "Post:ExportSuMoneyTransactionRecord") // 导出素币事务记录
beego.Router("/su-money/su-money-transaction-records/export-records", &controllers.SuMoneyController{}, "Post:ExportSuMoneyTransactionRecord") // 导出素币事务记录(流水)
beego.Router("/su-money/su-money-transaction-records/export-su-money", &controllers.SuMoneyController{}, "Post:ExportSuMoney") // 导出员工素币
/**********************************************现金池*******************************************/
beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入
... ...