...
|
...
|
@@ -177,7 +177,7 @@ func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{} |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, error) {
|
|
|
func (dao *TaskDao) CalculatePersonTask(uid int64, companyId int) (map[string]interface{}, error) {
|
|
|
var underwayAsAssignedPerson int64
|
|
|
var unAcceptanceAsAssignedPerson int64
|
|
|
var completedAsAssignedPerson int64
|
...
|
...
|
@@ -199,6 +199,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -207,6 +208,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -215,6 +217,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -223,6 +226,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where("task.receiver_uid = ?", uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -231,6 +235,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where("task.receiver_uid = ?", uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -239,6 +244,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where("task.receiver_uid = ?", uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -247,6 +253,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where("task.receiver_uid = ?", uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -255,6 +262,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNRELEASED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -263,6 +271,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -271,6 +280,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -279,6 +289,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -287,6 +298,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -295,6 +307,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -303,6 +316,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).Join("JOIN bidder_infos AS bidder_info ON bidder_info.task_id = task.id").
|
|
|
Where(`bidder_info.bidder @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -311,6 +325,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.participators @> '[{"uid":?}]'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
@@ -333,6 +348,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
|
if count, err := tx.Model(taskModel).
|
|
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
|
|
Where("task.task_status = ? ", domain.TASK_STATUS_EXPIRED).
|
|
|
Where("task.company_id = ?", companyId).
|
|
|
Count(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
...
|
...
|
|