|
@@ -177,7 +177,7 @@ func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{} |
|
@@ -177,7 +177,7 @@ func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{} |
177
|
}, nil
|
177
|
}, nil
|
178
|
}
|
178
|
}
|
179
|
|
179
|
|
180
|
-func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, error) {
|
180
|
+func (dao *TaskDao) CalculatePersonTask(uid int64, companyId int) (map[string]interface{}, error) {
|
181
|
var underwayAsAssignedPerson int64
|
181
|
var underwayAsAssignedPerson int64
|
182
|
var unAcceptanceAsAssignedPerson int64
|
182
|
var unAcceptanceAsAssignedPerson int64
|
183
|
var completedAsAssignedPerson int64
|
183
|
var completedAsAssignedPerson int64
|
|
@@ -199,6 +199,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -199,6 +199,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
199
|
if count, err := tx.Model(taskModel).
|
199
|
if count, err := tx.Model(taskModel).
|
200
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
200
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
201
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
201
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
202
|
+ Where("task.company_id = ?", companyId).
|
202
|
Count(); err != nil {
|
203
|
Count(); err != nil {
|
203
|
return nil, err
|
204
|
return nil, err
|
204
|
} else {
|
205
|
} else {
|
|
@@ -207,6 +208,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -207,6 +208,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
207
|
if count, err := tx.Model(taskModel).
|
208
|
if count, err := tx.Model(taskModel).
|
208
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
209
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
209
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
210
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
211
|
+ Where("task.company_id = ?", companyId).
|
210
|
Count(); err != nil {
|
212
|
Count(); err != nil {
|
211
|
return nil, err
|
213
|
return nil, err
|
212
|
} else {
|
214
|
} else {
|
|
@@ -215,6 +217,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -215,6 +217,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
215
|
if count, err := tx.Model(taskModel).
|
217
|
if count, err := tx.Model(taskModel).
|
216
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
218
|
Where(`task.assigned_person @> '{"uid":?}'`, uid).
|
217
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
219
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
220
|
+ Where("task.company_id = ?", companyId).
|
218
|
Count(); err != nil {
|
221
|
Count(); err != nil {
|
219
|
return nil, err
|
222
|
return nil, err
|
220
|
} else {
|
223
|
} else {
|
|
@@ -223,6 +226,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -223,6 +226,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
223
|
if count, err := tx.Model(taskModel).
|
226
|
if count, err := tx.Model(taskModel).
|
224
|
Where("task.receiver_uid = ?", uid).
|
227
|
Where("task.receiver_uid = ?", uid).
|
225
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
228
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
|
|
229
|
+ Where("task.company_id = ?", companyId).
|
226
|
Count(); err != nil {
|
230
|
Count(); err != nil {
|
227
|
return nil, err
|
231
|
return nil, err
|
228
|
} else {
|
232
|
} else {
|
|
@@ -231,6 +235,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -231,6 +235,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
231
|
if count, err := tx.Model(taskModel).
|
235
|
if count, err := tx.Model(taskModel).
|
232
|
Where("task.receiver_uid = ?", uid).
|
236
|
Where("task.receiver_uid = ?", uid).
|
233
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
237
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
238
|
+ Where("task.company_id = ?", companyId).
|
234
|
Count(); err != nil {
|
239
|
Count(); err != nil {
|
235
|
return nil, err
|
240
|
return nil, err
|
236
|
} else {
|
241
|
} else {
|
|
@@ -239,6 +244,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -239,6 +244,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
239
|
if count, err := tx.Model(taskModel).
|
244
|
if count, err := tx.Model(taskModel).
|
240
|
Where("task.receiver_uid = ?", uid).
|
245
|
Where("task.receiver_uid = ?", uid).
|
241
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
246
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
247
|
+ Where("task.company_id = ?", companyId).
|
242
|
Count(); err != nil {
|
248
|
Count(); err != nil {
|
243
|
return nil, err
|
249
|
return nil, err
|
244
|
} else {
|
250
|
} else {
|
|
@@ -247,6 +253,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -247,6 +253,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
247
|
if count, err := tx.Model(taskModel).
|
253
|
if count, err := tx.Model(taskModel).
|
248
|
Where("task.receiver_uid = ?", uid).
|
254
|
Where("task.receiver_uid = ?", uid).
|
249
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
255
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
256
|
+ Where("task.company_id = ?", companyId).
|
250
|
Count(); err != nil {
|
257
|
Count(); err != nil {
|
251
|
return nil, err
|
258
|
return nil, err
|
252
|
} else {
|
259
|
} else {
|
|
@@ -255,6 +262,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -255,6 +262,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
255
|
if count, err := tx.Model(taskModel).
|
262
|
if count, err := tx.Model(taskModel).
|
256
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
263
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
257
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNRELEASED).
|
264
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNRELEASED).
|
|
|
265
|
+ Where("task.company_id = ?", companyId).
|
258
|
Count(); err != nil {
|
266
|
Count(); err != nil {
|
259
|
return nil, err
|
267
|
return nil, err
|
260
|
} else {
|
268
|
} else {
|
|
@@ -263,6 +271,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -263,6 +271,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
263
|
if count, err := tx.Model(taskModel).
|
271
|
if count, err := tx.Model(taskModel).
|
264
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
272
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
265
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
273
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
|
|
274
|
+ Where("task.company_id = ?", companyId).
|
266
|
Count(); err != nil {
|
275
|
Count(); err != nil {
|
267
|
return nil, err
|
276
|
return nil, err
|
268
|
} else {
|
277
|
} else {
|
|
@@ -271,6 +280,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -271,6 +280,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
271
|
if count, err := tx.Model(taskModel).
|
280
|
if count, err := tx.Model(taskModel).
|
272
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
281
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
273
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
282
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCONFIRMED).
|
|
|
283
|
+ Where("task.company_id = ?", companyId).
|
274
|
Count(); err != nil {
|
284
|
Count(); err != nil {
|
275
|
return nil, err
|
285
|
return nil, err
|
276
|
} else {
|
286
|
} else {
|
|
@@ -279,6 +289,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -279,6 +289,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
279
|
if count, err := tx.Model(taskModel).
|
289
|
if count, err := tx.Model(taskModel).
|
280
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
290
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
281
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
291
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNDERWAY).
|
|
|
292
|
+ Where("task.company_id = ?", companyId).
|
282
|
Count(); err != nil {
|
293
|
Count(); err != nil {
|
283
|
return nil, err
|
294
|
return nil, err
|
284
|
} else {
|
295
|
} else {
|
|
@@ -287,6 +298,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -287,6 +298,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
287
|
if count, err := tx.Model(taskModel).
|
298
|
if count, err := tx.Model(taskModel).
|
288
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
299
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
289
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
300
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNACCEPTANCE).
|
|
|
301
|
+ Where("task.company_id = ?", companyId).
|
290
|
Count(); err != nil {
|
302
|
Count(); err != nil {
|
291
|
return nil, err
|
303
|
return nil, err
|
292
|
} else {
|
304
|
} else {
|
|
@@ -295,6 +307,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -295,6 +307,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
295
|
if count, err := tx.Model(taskModel).
|
307
|
if count, err := tx.Model(taskModel).
|
296
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
308
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
297
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
309
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
310
|
+ Where("task.company_id = ?", companyId).
|
298
|
Count(); err != nil {
|
311
|
Count(); err != nil {
|
299
|
return nil, err
|
312
|
return nil, err
|
300
|
} else {
|
313
|
} else {
|
|
@@ -303,6 +316,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -303,6 +316,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
303
|
if count, err := tx.Model(taskModel).Join("JOIN bidder_infos AS bidder_info ON bidder_info.task_id = task.id").
|
316
|
if count, err := tx.Model(taskModel).Join("JOIN bidder_infos AS bidder_info ON bidder_info.task_id = task.id").
|
304
|
Where(`bidder_info.bidder @> '{"uid":?}'`, uid).
|
317
|
Where(`bidder_info.bidder @> '{"uid":?}'`, uid).
|
305
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
318
|
Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
|
|
|
319
|
+ Where("task.company_id = ?", companyId).
|
306
|
Count(); err != nil {
|
320
|
Count(); err != nil {
|
307
|
return nil, err
|
321
|
return nil, err
|
308
|
} else {
|
322
|
} else {
|
|
@@ -311,6 +325,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -311,6 +325,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
311
|
if count, err := tx.Model(taskModel).
|
325
|
if count, err := tx.Model(taskModel).
|
312
|
Where(`task.participators @> '[{"uid":?}]'`, uid).
|
326
|
Where(`task.participators @> '[{"uid":?}]'`, uid).
|
313
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
327
|
Where("task.task_status = ? ", domain.TASK_STATUS_COMPLETED).
|
|
|
328
|
+ Where("task.company_id = ?", companyId).
|
314
|
Count(); err != nil {
|
329
|
Count(); err != nil {
|
315
|
return nil, err
|
330
|
return nil, err
|
316
|
} else {
|
331
|
} else {
|
|
@@ -333,6 +348,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
|
@@ -333,6 +348,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro |
333
|
if count, err := tx.Model(taskModel).
|
348
|
if count, err := tx.Model(taskModel).
|
334
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
349
|
Where(`task.sponsor @> '{"uid":?}'`, uid).
|
335
|
Where("task.task_status = ? ", domain.TASK_STATUS_EXPIRED).
|
350
|
Where("task.task_status = ? ", domain.TASK_STATUS_EXPIRED).
|
|
|
351
|
+ Where("task.company_id = ?", companyId).
|
336
|
Count(); err != nil {
|
352
|
Count(); err != nil {
|
337
|
return nil, err
|
353
|
return nil, err
|
338
|
} else {
|
354
|
} else {
|