| | |
| | | using zhengcaioa.IService; |
| | | using System.IO; |
| | | using Microsoft.Extensions.Configuration; |
| | | using System.Transactions; |
| | | using CommonToolsCore; |
| | | using System.Text; |
| | | |
| | | namespace zhengcaioa.Controllers.Expert |
| | | { |
| | |
| | | private readonly ILiaotianService _liaotianService; |
| | | private readonly IProjectService _projectService; |
| | | private readonly IUserService _userService; |
| | | public ExpertController(ILogger<ExpertController> logger, IExpertService expertService, IProjectService projectService, ILiaotianService liaotianService, IUserService userService) |
| | | private readonly IFiSubjectService _ifiSubjectService; |
| | | private readonly ICooperOrderService _cooperOrderService; |
| | | private readonly IFiAccountService _fiAccountService; |
| | | private readonly IFiAccountRecordService _iFiAccountRecordService; |
| | | private readonly IAreaService _iAreaService; |
| | | public ExpertController(ILogger<ExpertController> logger, IExpertService expertService, IProjectService projectService, ILiaotianService liaotianService, IUserService userService |
| | | , IFiSubjectService ifiSubjectService, ICooperOrderService cooperOrderService, IFiAccountService fiAccountService, IFiAccountRecordService iFiAccountRecordService |
| | | , IAreaService iAreaService) |
| | | { |
| | | _logger = logger; |
| | | _expertService = expertService; |
| | | _projectService = projectService; |
| | | _liaotianService = liaotianService; |
| | | _userService = userService; |
| | | _ifiSubjectService = ifiSubjectService; |
| | | _cooperOrderService = cooperOrderService; |
| | | _fiAccountService = fiAccountService; |
| | | _iFiAccountRecordService = iFiAccountRecordService; |
| | | _iAreaService = iAreaService; |
| | | } |
| | | [CheckLogin] |
| | | public IActionResult Index() |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | [CheckLogin] |
| | | public IActionResult Indexziliao() |
| | | { |
| | | 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 actionEntity4 = new ActionEntity(); |
| | | actionEntity4.OpenType = 0; |
| | | actionEntity4.ActionUrl = ""; |
| | | actionEntity4.ActionFun = "Duanxin"; |
| | | actionEntity4.PageIco = ""; |
| | | actionEntity4.ActionName = "群发短信"; |
| | | actionlist.Add(actionEntity4); |
| | | ViewData["ActionInfo"] = actionlist; |
| | | |
| | | ViewBag.expertType = _liaotianService.GetSYScode("experts", "expertType").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewBag.level = _liaotianService.GetSYScode("experts", "level").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewBag.Province = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList(); |
| | | // ViewBag.City = _projectService.Getshi( ).Select(x => new { code = x.CodeId, label = x.Name }).ToList(); |
| | | ViewBag.ReviewItem = _liaotianService.GetSYScode("experts", "ReviewItem").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | |
| | | |
| | | ViewBag.users = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList(); |
| | | ViewBag.YearJiou = _liaotianService.GetSYScode("experts", "year_jiou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | return View(); |
| | | } |
| | | |
| | | |
| | | #region 编辑 |
| | | [CheckLogin] |
| | | public ActionResult Edit(string id = null) |
| | | public ActionResult Edit(string id = null, string Province = null, string City = null) |
| | | { |
| | | |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | |
| | | } |
| | | else |
| | | { |
| | | expertDTO.Province = "510000"; |
| | | expertDTO.City = "510100"; |
| | | if (string.IsNullOrEmpty(Province)) |
| | | { |
| | | expertDTO.Province = "510000"; |
| | | } |
| | | else |
| | | { |
| | | expertDTO.Province = Province; |
| | | } |
| | | if (string.IsNullOrEmpty(City)) |
| | | { |
| | | expertDTO.City = "510100"; |
| | | } |
| | | else |
| | | { |
| | | expertDTO.City = City; |
| | | } |
| | | expertDTO.ExpertType = "4"; |
| | | expertDTO.Level = "1"; |
| | | expertDTO.CertiNumber = "SC"; |
| | | expertDTO.InfoSource = "01"; |
| | | expertDTO.Sex = "1"; |
| | | expertDTO.YearJiou = "1"; |
| | | } |
| | | // var sheng = _projectService.Getsheng(); |
| | | |
| | |
| | | |
| | | ViewBag.Province = _projectService.Getsheng();//.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); |
| | | ViewBag.City = _projectService.Getshi(expertDTO.Province);//.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); |
| | | ViewBag.YearJiou = _liaotianService.GetSYScode("experts", "year_jiou");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewData.Model = expertDTO; |
| | | return View(); |
| | | } |
| | |
| | | ViewBag.HuifangStatus = _liaotianService.GetSYScode("CooperOrder", "huifang_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | |
| | | ViewBag.PingjiaStatus = _liaotianService.GetSYScode("CooperOrder", "pingjia_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | |
| | | ViewBag.Expert = _expertService.GetList().Select(x => new { code = x.Id, label = x.Name }).ToList(); |
| | | return View(); |
| | | } |
| | | [CheckLogin] |
| | |
| | | { |
| | | data.Creater = curentuser.Id; |
| | | data.Createtime = DateTime.Now; |
| | | data.sort = "D"; |
| | | } |
| | | data.Modifier = curentuser.Id; |
| | | data.Modifytime = DateTime.Now; |
| | |
| | | |
| | | |
| | | |
| | | #region 专家费用结算 |
| | | [CheckLogin] |
| | | public IActionResult ExpertFeiyong() |
| | | { |
| | | 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 = "Jiesuan"; |
| | | actionEntity1.PageIco = "fa fa-plus-square"; |
| | | actionEntity1.ActionName = "结算"; |
| | | actionlist.Add(actionEntity1); |
| | | |
| | | |
| | | ViewData["ActionInfo"] = actionlist; |
| | | |
| | | |
| | | ViewBag.Expert = _expertService.GetList().Select(x => new { code = x.Id, label = x.Name }).ToList(); |
| | | ViewBag.shifou = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | return View(); |
| | | } |
| | | |
| | | [CheckLogin] |
| | | public string GetJiesuanList(ExpertOrderDipatchDTOSearch search) |
| | | { |
| | | return JsonConvert.SerializeObject(_expertService.SearchJiesuan(search)); |
| | | } |
| | | |
| | | |
| | | public IActionResult EditJiesuan(string id) |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["curentuser"] = curentuser; |
| | | decimal Money = 0; |
| | | FiOrderrecievemoneyDTO dto = new FiOrderrecievemoneyDTO(); |
| | | if (!String.IsNullOrEmpty(id)) |
| | | { |
| | | string[] ids = id.Split(','); |
| | | foreach(var iddd in ids) |
| | | { |
| | | var expertOrderDipatchDTO = _expertService.GetDispatch(iddd); |
| | | if(expertOrderDipatchDTO.sort != "A") |
| | | { |
| | | Money += expertOrderDipatchDTO.Money.Value; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | dto.PayTime = DateTime.Now; |
| | | dto.Id = id; |
| | | |
| | | dto.Money = Money; |
| | | |
| | | |
| | | ViewData.Model = dto; |
| | | |
| | | ViewBag.PayType = _liaotianService.GetSYScode("fi_account", "accounttype"); |
| | | ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype"); |
| | | ViewBag.FiSubject = _ifiSubjectService.GetList().Where(x => x.Subjecttype == "02").ToList(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | ViewData.Model = dto; |
| | | return View(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存 |
| | | /// </summary> |
| | | /// <param name="data">岗位实体类对象</param> |
| | | /// <returns></returns> |
| | | /// |
| | | [HttpPost] |
| | | public IActionResult SaveJiesuan(FiOrderrecievemoneyDTO data) |
| | | { |
| | | ResultEntity resultEntity = new ResultEntity(); |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["curentuser"] = curentuser; |
| | | using (TransactionScope scope = new TransactionScope()) |
| | | { |
| | | string[] ids = data.Id.Split(','); |
| | | foreach (var iddd in ids) |
| | | { |
| | | var expertOrderDipatchDTO = _expertService.GetDispatch(iddd); |
| | | if(expertOrderDipatchDTO.sort == "A") |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "存在已经结算的订单"; |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | expertOrderDipatchDTO.sort = "A"; |
| | | expertOrderDipatchDTO.Modifier = curentuser.Id; |
| | | expertOrderDipatchDTO.Modifytime = DateTime.Now; |
| | | resultEntity = _expertService.SaveDispatch(expertOrderDipatchDTO); |
| | | if (!resultEntity.Result) |
| | | { |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | var expertDTO = _expertService.Get(expertOrderDipatchDTO.ExpertId); |
| | | var orderDTO = _cooperOrderService.Get(expertOrderDipatchDTO.OrderId); |
| | | //插入支出记录 |
| | | FiAccountRecordDTO data1 = new FiAccountRecordDTO(); |
| | | data1.RecStatus = "A"; |
| | | data1.Creater = curentuser.Id; |
| | | data1.Createtime = data.PayTime; |
| | | data1.Modifier = curentuser.Id; |
| | | data1.Modifytime = data.PayTime; |
| | | data1.SubjectId = data.SubjectId; |
| | | data1.AccountId = data.AccountId; |
| | | data1.Money = expertOrderDipatchDTO.Money; |
| | | data1.PaymentUnit = expertDTO.Name; |
| | | data1.OperationalMatters = expertDTO.Name +" " +orderDTO.OrderNo+ "结算费用" ; |
| | | |
| | | |
| | | |
| | | FiAccountDTO firmAccount = _fiAccountService.Get(data1.AccountId); |
| | | |
| | | |
| | | data1.RecordTypeId = "2";//收入 |
| | | data1.Department = ""; |
| | | |
| | | |
| | | firmAccount.AllExpenses = (firmAccount.AllExpenses ?? 0) + data1.Money; |
| | | firmAccount.Balance = (firmAccount.Balance ?? 0) - data1.Money; |
| | | |
| | | |
| | | |
| | | data1.AccountMoney = firmAccount.Balance; |
| | | resultEntity = _iFiAccountRecordService.save(data1); |
| | | if (!resultEntity.Result) |
| | | { |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | |
| | | resultEntity = _fiAccountService.save(firmAccount); |
| | | if (!resultEntity.Result) |
| | | { |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | } |
| | | scope.Complete(); |
| | | } |
| | | |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | public IActionResult Duanxin(string id = null) |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["curentuser"] = curentuser; |
| | | ViewData["baifangid"] = id; |
| | | |
| | | |
| | | |
| | | return View(); |
| | | } |
| | | |
| | | |
| | | |
| | | public IActionResult Fasong(string neirong, string baifangid) |
| | | { |
| | | ResultEntity resultEntity = new ResultEntity(); |
| | | resultEntity.Result = true; |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ViewData["curentuser"] = curentuser; |
| | | List<ExpertDTO> result = new List<ExpertDTO>(); |
| | | |
| | | if (baifangid != null) |
| | | { |
| | | result = _expertService.GetList(baifangid.Split(",")); |
| | | } |
| | | else |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "无联系人号码"; |
| | | } |
| | | string customename = ""; |
| | | StringBuilder number = new StringBuilder(); ; |
| | | if (result != null && result.Count > 0) |
| | | { |
| | | for (int i = 0; i < result.Count; i++) |
| | | { |
| | | number.Append(string.IsNullOrEmpty(result[i].Phone1) ? result[i].Phone2 : result[i].Phone1); |
| | | customename += result[i].Name + ","; |
| | | if (i != result.Count - 1) |
| | | { |
| | | number.Append(","); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "无联系电话"; |
| | | } |
| | | |
| | | string sss = SMSHelper.PushWToUserMES(number.ToString(), "您好,专家. 详情见:" + neirong); |
| | | if (int.Parse(sss) <= 0) |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "短信发送失败"; |
| | | |
| | | } |
| | | |
| | | _logger.LogInformation(curentuser.UserName + "发送短信给专家" + customename); |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 判断身份证是否重复 |
| | | /// </summary> |
| | | /// <param name="shengid">省id</param> |
| | | /// <returns></returns> |
| | | /// |
| | | [CheckLogin] |
| | | public string IdCardChongfu(string IdCard = "",string Id = "") |
| | | { |
| | | ResultEntity resultEntity = _expertService.IdCardChongfu(IdCard, Id); |
| | | |
| | | return JsonConvert.SerializeObject(resultEntity); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 判断专家证是否重复 |
| | | /// </summary> |
| | | /// <param name="shengid">省id</param> |
| | | /// <returns></returns> |
| | | /// |
| | | [CheckLogin] |
| | | public string CertiNumberChongfu(string CertiNumber = "", string Id = "") |
| | | { |
| | | ResultEntity resultEntity = _expertService.CertiNumberChongfu(CertiNumber, Id); |
| | | if (resultEntity.Result) |
| | | { |
| | | //拆解专家证号 |
| | | |
| | | var CertiNumber11 = CertiNumber.Replace("SC", ""); |
| | | var sysCodeDtls = _liaotianService.GetSYScode("experts", "City"); |
| | | |
| | | var chengshis = sysCodeDtls.Where(x => CertiNumber11.StartsWith(x.CodeSn)).ToList(); |
| | | if (chengshis.Count > 0) |
| | | { |
| | | var areaDTOs = _iAreaService.GetList(); |
| | | |
| | | var chengshi = areaDTOs.Where(x => x.Name == chengshis[0].Comments).FirstOrDefault(); |
| | | if (chengshi != null) |
| | | { |
| | | resultEntity.Message = chengshi.CodeId; |
| | | resultEntity.Remark = chengshi.ParentId; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return JsonConvert.SerializeObject(resultEntity); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 判断电话是否重复 |
| | | /// </summary> |
| | | /// <param name="shengid">省id</param> |
| | | /// <returns></returns> |
| | | /// |
| | | [CheckLogin] |
| | | public string Phone1Chongfu(string Phone1 = "", string Id = "") |
| | | { |
| | | ResultEntity resultEntity = _expertService.Phone1Chongfu(Phone1, Id); |
| | | |
| | | return JsonConvert.SerializeObject(resultEntity); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |