using CallCenterApi.Model; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CallCenter.QuartzService { public class SatisfactionClose : QuartzJob { public SatisfactionClose() { CronExpression = "0 0 0 * * ? *"; DoWork += MyWork_DoWork; } private readonly CallCenterApi.BLL.T_Bus_WorkOrder workorder = new CallCenterApi.BLL.T_Bus_WorkOrder(); private void MyWork_DoWork(object sender, EventArgs e) { string sql = "and F_WorkState = 6 and F_IsSms = 1 and F_IsDelete = 0 and(datediff(dd, (select top 1 RecvTime from T_SMS_RecvSMS where Content = '您反映的诉求已办理完成,请前往安阳政务服务官网(https://zwfw.anyang.gov.cn),登录后查看办结结果并对办理情况进行评价,谢谢' and CallerNum = b.F_CusPhone and F_Name = b.F_WorkOrderId order by RecvTime desc), GETDATE()) >= 15) and F_DealTime is not null"; DataTable dt = new DataTable(); int recordCount = 0; dt = CallCenterApi.BLL.PagerBLL.GetListPager( "T_Bus_WorkOrder b WITH(NOLOCK)", "F_WorkOrderId", "*", sql, "ORDER BY F_CreateTime DESC", 1000, 1, true, out recordCount); var now = DateTime.Now; // var modellist = workorder.GetModelList("F_WorkState =6 and F_IsSms =1 and F_IsDelete =0 and (datediff(hh,F_DealTime ,GETDATE() )>=15) and F_DealTime is not null"); if (dt != null && dt.Rows .Count >0) { foreach (DataRow dr in dt.Rows) { CallCenterApi.Model.T_Bus_WorkOrder it = new CallCenterApi.Model.T_Bus_WorkOrder(); it = workorder.GetModel(dr["F_WorkOrderId"].ToString()); if (it !=null ) { it.F_WorkState = 9; it.F_IsSatisfie = 1; it.F_IsClosed = 1; it.F_CloseUser = ""; it.F_CloseTime = DateTime.Now; it.F_FinalOpinion = "15天自动满意"; it.F_IsStandard = 1; it.F_StandardIDS = ""; it.F_ToBereply = 0; workorder.Update(it); CallCenterApi.Model.T_Bus_Operation oper = new CallCenterApi.Model.T_Bus_Operation(); oper.F_WorkOrderId = it.F_WorkOrderId; oper.F_State = it.F_WorkState; oper.F_Message = " 15天未评价自动结案了工单,结果:满意"; oper.F_CreateUser = "8000"; oper.F_CreateTime = DateTime.Now; oper.F_IsDelete = 0; new CallCenterApi.BLL.T_Bus_Operation().Add(oper); } } } } } }