| | |
| | | using DTO; |
| | | using Microsoft.AspNetCore.Http; |
| | | using zhengcaioa.IService; |
| | | using CommonToolsCore; |
| | | |
| | | namespace zhengcaioa.Controllers.AdmManagement |
| | | { |
| | |
| | | private readonly ILiaotianService _liaotianService; |
| | | private readonly IUserService _userService; |
| | | private readonly IHrDeptService _hrDeptService; |
| | | private readonly IPltPageService _pltPageService; |
| | | |
| | | [CheckLogin] |
| | | public DailyManagementController(ILogger<DailyManagementController> logger, IDailyManagementService DailyManageService, |
| | | ILiaotianService liaotianService, IUserService userService, IHrDeptService hrDeptService) |
| | | ILiaotianService liaotianService, IUserService userService, IHrDeptService hrDeptService |
| | | , IPltPageService pltPageService) |
| | | { |
| | | _logger = logger; |
| | | _DailyManageService = DailyManageService; |
| | | _liaotianService = liaotianService; |
| | | _userService = userService; |
| | | _hrDeptService = hrDeptService; |
| | | _pltPageService = pltPageService; |
| | | } |
| | | |
| | | #region 通话管理 |
| | | [CheckLogin] |
| | | public IActionResult HoldPhone() |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["curentuser"] = curentuser; |
| | | List<ActionEntity> actionlist = new List<ActionEntity>(); |
| | | ActionEntity actionEntity = new ActionEntity(); |
| | | actionEntity.OpenType = 0; |
| | | actionEntity.ActionUrl = ""; |
| | | actionEntity.ActionFun = "Search"; |
| | | actionEntity.PageIco = "fa fa-search"; |
| | | actionEntity.ActionName = "查询"; |
| | | actionlist.Add(actionEntity); |
| | | ActionEntity actionEntity1 = new ActionEntity(); |
| | | actionEntity1.OpenType = 0; |
| | | actionEntity1.ActionUrl = ""; |
| | | actionEntity1.ActionFun = "Add"; |
| | | actionEntity1.PageIco = "fa fa-plus"; |
| | | actionEntity1.ActionName = "新增"; |
| | | actionlist.Add(actionEntity1); |
| | | |
| | | //ActionEntity actionEntity1 = new ActionEntity(); |
| | | //actionEntity1.OpenType = 0; |
| | | //actionEntity1.ActionUrl = ""; |
| | | //actionEntity1.ActionFun = "Add"; |
| | | //actionEntity1.PageIco = "fa fa-plus"; |
| | | //actionEntity1.ActionName = "新增"; |
| | | //actionlist.Add(actionEntity1); |
| | | var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/DailyManagement/HoldPhone/"); |
| | | var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList(); |
| | | if(pageEntities1.Count(x=>x.PageShortcut == "Search") <= 0) |
| | | { |
| | | ActionEntity actionEntity = new ActionEntity(); |
| | | actionEntity.OpenType = 0; |
| | | actionEntity.ActionUrl = ""; |
| | | actionEntity.ActionFun = "Search"; |
| | | actionEntity.PageIco = "fa fa-search"; |
| | | actionEntity.ActionName = "查询"; |
| | | actionlist.Add(actionEntity); |
| | | |
| | | ViewData["Creater"] = curentuser.Id; |
| | | } |
| | | var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); |
| | | |
| | | foreach (var pageEntity in pageEntities1) |
| | | { |
| | | ActionEntity actionEntity1 = new ActionEntity(); |
| | | actionEntity1.OpenType = pageEntity.OpenType; |
| | | actionEntity1.ActionUrl = ""; |
| | | actionEntity1.ActionFun = pageEntity.PageShortcut; |
| | | actionEntity1.PageIco = pageEntity.PageIco; |
| | | actionEntity1.ActionName = pageEntity.PageName; |
| | | actionlist.Add(actionEntity1); |
| | | } |
| | | ViewData["ActionInfo"] = actionlist; |
| | | ViewData["ActionInfo2"] = pageEntities2; |
| | | ViewBag.LineType = _liaotianService.GetSYScode("ADM_HoldPhone", "LineType").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewBag.Intention = _liaotianService.GetSYScode("ADM_HoldPhone", "Intention").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | return View(); |
| | |
| | | public IActionResult EditMemoBook(string Rtype="1" , string id = "0") |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["users"] = _userService.GetList(); |
| | | ViewData["users"] = _userService.GetList().Where(x=>x.Id != curentuser.Id).ToList(); |
| | | AdmMemoBookDTO admMemoBookDTO = _DailyManageService.GetMemoBook(id); |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); |
| | | Rtype = string.IsNullOrEmpty(admMemoBookDTO.Rtype)? Rtype : admMemoBookDTO.Rtype; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | Rtype = string.IsNullOrEmpty(admMemoBookDTO.Rtype) ? Rtype : admMemoBookDTO.Rtype; |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | ViewBag.Rtype = Rtype; |
| | |
| | | [HttpPost] |
| | | public string SaveMemoBook(AdmMemoBookDTO memoBook) |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | memoBook.RecStatus = "A"; |
| | | if (String.IsNullOrEmpty(memoBook.Id)) |
| | | { |
| | |
| | | actionEntity.PageIco = "fa fa-search"; |
| | | actionEntity.ActionName = "查询"; |
| | | actionlist.Add(actionEntity); |
| | | ActionEntity actionEntity1 = new ActionEntity(); |
| | | actionEntity1.OpenType = 0; |
| | | actionEntity1.ActionUrl = ""; |
| | | actionEntity1.ActionFun = "Add"; |
| | | actionEntity1.PageIco = "fa fa-plus"; |
| | | actionEntity1.ActionName = "工作安排"; |
| | | actionlist.Add(actionEntity1); |
| | | //ActionEntity actionEntity1 = new ActionEntity(); |
| | | //actionEntity1.OpenType = 0; |
| | | //actionEntity1.ActionUrl = ""; |
| | | //actionEntity1.ActionFun = "Add"; |
| | | //actionEntity1.PageIco = "fa fa-plus"; |
| | | //actionEntity1.ActionName = "工作安排"; |
| | | //actionlist.Add(actionEntity1); |
| | | |
| | | var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/DailyManagement/MemoWorkAnPai"); |
| | | var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList(); |
| | | |
| | | var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); |
| | | |
| | | foreach (var pageEntity in pageEntities1) |
| | | { |
| | | ActionEntity actionEntity1 = new ActionEntity(); |
| | | actionEntity1.OpenType = pageEntity.OpenType; |
| | | actionEntity1.ActionUrl = ""; |
| | | actionEntity1.ActionFun = pageEntity.PageShortcut; |
| | | actionEntity1.PageIco = pageEntity.PageIco; |
| | | actionEntity1.ActionName = pageEntity.PageName; |
| | | actionlist.Add(actionEntity1); |
| | | } |
| | | ViewData["ActionInfo"] = actionlist; |
| | | ViewData["ActionInfo2"] = pageEntities2; |
| | | |
| | | |
| | | //ActionEntity actionEntity2 = new ActionEntity(); |
| | | //actionEntity2.OpenType = 0; |
| | |
| | | ViewBag.User = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList(); |
| | | |
| | | ViewBag.Wancheng = _liaotianService.GetSYScode("ADM_MemoBook", "HaveRead").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewData["ActionInfo"] = actionlist; |
| | | //ViewData["ActionInfo"] = actionlist; |
| | | return View(); |
| | | } |
| | | |
| | |
| | | public IActionResult EditWorkAnPai( string id = "") |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["users"] = _userService.GetList(); |
| | | ViewData["curentuser"] = curentuser; |
| | | ViewData["users"] = _userService.GetList().Where(x => x.Id != curentuser.Id).ToList(); |
| | | AdmMemoBookDTO admMemoBookDTO = new AdmMemoBookDTO(); |
| | | if (!string.IsNullOrEmpty(id)) |
| | | { |
| | |
| | | admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId; |
| | | } |
| | | |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | //admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = ""; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | ViewData["Dept"] = _hrDeptService.GetList(); |
| | |
| | | admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId; |
| | | } |
| | | |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | //admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = ""; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | ViewBag.KaoHe = _liaotianService.GetSYScode("ADM_MemoBook", "KaoHe"); |
| | |
| | | admMemoBookDTO = _DailyManageService.GetMemoBook(id); |
| | | } |
| | | |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | //admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = ""; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | ViewBag.Rtype = _liaotianService.GetSYScode("ADM_MemoBook", "Rtype").Where(x=>x.CodeSn=="2" || x.CodeSn == "4").ToList(); |
| | |
| | | admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId; |
| | | } |
| | | |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | //admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = ""; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | |
| | |
| | | admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId; |
| | | } |
| | | |
| | | if (admMemoBookDTO.Time.Equals(DateTime.MinValue)) |
| | | if (!admMemoBookDTO.Time.HasValue) |
| | | { |
| | | admMemoBookDTO.Time = DateTime.Now; |
| | | //admMemoBookDTO.Time = DateTime.Now; |
| | | admMemoBookDTO.TimeName = ""; |
| | | } |
| | | else |
| | | { |
| | | admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm"); |
| | | } |
| | | ViewData.Model = admMemoBookDTO; |
| | | |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | //发送验证码 |
| | | |
| | | |
| | | public IActionResult PushYanZhengMa(String Phone) |
| | | { |
| | | ReturnMsg<AdmPhoneMessageDTO> returnMsg = new ReturnMsg<AdmPhoneMessageDTO>(); |
| | | returnMsg.code = 2; |
| | | try |
| | | { |
| | | Random rd = new Random(); |
| | | int end = 999999; |
| | | |
| | | int begin = 100000; |
| | | |
| | | int xxxx = rd.Next(begin, end); |
| | | |
| | | string sss = SMSHelper.PushWToUserMESYanZhengMa(Phone, xxxx.ToString()); |
| | | if (int.Parse(sss) <= 0) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "短信发送失败"; |
| | | returnMsg.returnObj = null; |
| | | return new JsonResult(returnMsg); |
| | | } |
| | | |
| | | AdmPhoneMessageDTO admPhoneMessageDTO = new AdmPhoneMessageDTO(); |
| | | admPhoneMessageDTO.Phone = Phone; |
| | | admPhoneMessageDTO.Createtime = DateTime.Now; |
| | | admPhoneMessageDTO.Message = xxxx.ToString(); |
| | | ResultEntity rs = _DailyManageService.SavePhoneMessage(admPhoneMessageDTO); |
| | | if (!rs.Result) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "短信发送失败"; |
| | | returnMsg.returnObj = null; |
| | | return new JsonResult(returnMsg); |
| | | } |
| | | |
| | | returnMsg.code = 1; |
| | | returnMsg.count = 0; |
| | | returnMsg.returnObj = admPhoneMessageDTO; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "没有获取到token"; |
| | | returnMsg.count = 0; |
| | | |
| | | } |
| | | return new JsonResult(returnMsg); |
| | | |
| | | } |
| | | |
| | | |
| | | //保存通话记录 |
| | | |
| | | [HttpPost] |
| | | public IActionResult SaveHoldPhone([FromBody]AdmHoldPhoneDTO admHoldPhone) |
| | | { |
| | | ReturnMsg<AdmHoldPhoneDTO> returnMsg = new ReturnMsg<AdmHoldPhoneDTO>(); |
| | | returnMsg.code = 2; |
| | | try |
| | | { |
| | | |
| | | //判断验证码是否正确 |
| | | var phoneMessageDTO = _DailyManageService.GetPhoneMessageZuijin(admHoldPhone.Phone); |
| | | //double minu = (DateTime.Now - phoneMessageDTO.Createtime).TotalMinutes; |
| | | if (phoneMessageDTO==null|| string.IsNullOrEmpty(phoneMessageDTO.Message)) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "验证码错误"; |
| | | returnMsg.returnObj = null; |
| | | return new JsonResult(returnMsg); |
| | | } |
| | | else if (phoneMessageDTO.Message != admHoldPhone.Message) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "验证码错误"; |
| | | returnMsg.returnObj = null; |
| | | return new JsonResult(returnMsg); |
| | | }else if ((DateTime.Now - phoneMessageDTO.Createtime).TotalMinutes>5 ) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "验证码超过5分钟,验证码失效"; |
| | | returnMsg.returnObj = null; |
| | | return new JsonResult(returnMsg); |
| | | } |
| | | |
| | | |
| | | |
| | | admHoldPhone.RecStatus = "A"; |
| | | admHoldPhone.InTime = DateTime.Now; |
| | | admHoldPhone.LineType = "1"; |
| | | admHoldPhone.Intention = "3"; |
| | | admHoldPhone.Creater = "e4c93811-b9b1-4998-89f5-c416ebab0c07"; |
| | | admHoldPhone.Createtime = DateTime.Now; |
| | | admHoldPhone.Modifier = "e4c93811-b9b1-4998-89f5-c416ebab0c07"; |
| | | admHoldPhone.Modifytime = DateTime.Now; |
| | | admHoldPhone.UserId = "e4c93811-b9b1-4998-89f5-c416ebab0c07"; |
| | | admHoldPhone.Handling = null; |
| | | |
| | | admHoldPhone.Id = null; |
| | | ResultEntity resultEntity = _DailyManageService.SaveHoldPhone(admHoldPhone); |
| | | returnMsg.code = 1; |
| | | returnMsg.count = 0; |
| | | returnMsg.returnObj = admHoldPhone; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | returnMsg.code = 2; |
| | | returnMsg.error = "没有获取到token"; |
| | | returnMsg.count = 0; |
| | | |
| | | } |
| | | return new JsonResult(returnMsg); |
| | | |
| | | } |
| | | } |
| | | } |