|
|
@ -20,13 +20,15 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
public class pricetasklogBusiness : BaseBusiness<pricetasklog>, IpricetasklogBusiness, ITransientDependency |
|
|
|
{ |
|
|
|
IuserBusiness _iuserBusiness; |
|
|
|
IteamitemsBusiness _iteamitemsBusiness; |
|
|
|
readonly IOperator _operator; |
|
|
|
public pricetasklogBusiness(IDbAccessor db, IuserBusiness iuserBusiness, |
|
|
|
public pricetasklogBusiness(IDbAccessor db, IuserBusiness iuserBusiness, IteamitemsBusiness iteamitemsBusiness, |
|
|
|
IOperator @operator) |
|
|
|
: base(db) |
|
|
|
{ |
|
|
|
_operator = @operator; |
|
|
|
_iuserBusiness = iuserBusiness; |
|
|
|
_iteamitemsBusiness = iteamitemsBusiness; |
|
|
|
} |
|
|
|
|
|
|
|
#region 外部接口
|
|
|
@ -133,6 +135,9 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
|
|
|
|
public AjaxResult DayTaskSet() |
|
|
|
{ |
|
|
|
|
|
|
|
CheckIsTimeOut(); |
|
|
|
|
|
|
|
var users = _iuserBusiness.GetPriceTaskUserList().ToList(); |
|
|
|
|
|
|
|
Expression<Func<user, pricetasklog, PricetaskUser>> select = (a, b) => new PricetaskUser() |
|
|
@ -212,6 +217,26 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
return Success("任务分配成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AjaxResult CheckIsTimeOut() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var needUpdates = Db.GetIQueryable<pricetasklog>().Where(c => c.State == PriceTaskState.已比价 && c.WorkDate != null && (DateTime.Now - c.WorkDate.Value).TotalHours >= 48).ToList(); |
|
|
|
|
|
|
|
if (needUpdates.Count > 0) |
|
|
|
{ |
|
|
|
_iteamitemsBusiness.UpdateTaskSuccess(needUpdates); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Success(); |
|
|
|
} |
|
|
|
|
|
|
|
public AjaxResult CanelTask(string teamItemId) |
|
|
|
{ |
|
|
|
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId && c.TeamId == _operator.TeamId); |
|
|
@ -355,6 +380,7 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
} |
|
|
|
|
|
|
|
var taskState = (PriceTaskState)state; |
|
|
|
|
|
|
|
if (taskState == PriceTaskState.已比价) |
|
|
|
{ |
|
|
|
var result = Db.RunTransaction(() => |
|
|
@ -362,6 +388,7 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
int row = Db.Update<pricetasklog>(c => c.Id == task.Id, item => |
|
|
|
{ |
|
|
|
item.State = taskState; |
|
|
|
item.WorkDate = DateTime.Now; |
|
|
|
}); |
|
|
|
|
|
|
|
if (row <= 0) |
|
|
|