From 3d862d3a9c3a18e4f82c98c9de3be370cd1c38ae Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 25 八月 2021 14:51:09 +0800
Subject: [PATCH] 辞职申请

---
 zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs |  179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 178 insertions(+), 1 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
index 3b23945..6818275 100644
--- a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
@@ -29,6 +29,7 @@
         private readonly IAdmBreakPrecedentService _aAdmBreakPrecedentService;
         private readonly ICooperatecustomCustomerService _cooperatecustomCustomerService;
         private readonly IIntentionCustomerService _intentionCustomerService;
+        private readonly IHrPositionService _hrPositionService;
 
         public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
             , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
@@ -37,7 +38,8 @@
             , IUserService userService
             , IAdmBreakPrecedentService aAdmBreakPrecedentService
             , ICooperatecustomCustomerService cooperatecustomCustomerService
-            , IIntentionCustomerService intentionCustomerService)
+            , IIntentionCustomerService intentionCustomerService
+            , IHrPositionService hrPositionService)
         {
             _logger = logger;
             _hrDeptService = hrDeptService;
@@ -51,6 +53,7 @@
             _aAdmBreakPrecedentService = aAdmBreakPrecedentService;
             _cooperatecustomCustomerService = cooperatecustomCustomerService;
             _intentionCustomerService = intentionCustomerService;
+            _hrPositionService = hrPositionService;
         }
 
         public IActionResult Askcost(string id = "")
@@ -1321,5 +1324,179 @@
             }
             return new JsonResult(resultEntity);
         }
+
+        public IActionResult AskCiZhi(string id = "")
+        {
+            AdmAskCiZhiDTO dto = new AdmAskCiZhiDTO();
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+
+
+            //娴佺▼鐩稿叧
+            string shifoubiaoji = "A";
+            string sifoudangqian = "A";
+            string dangqianbuzhou = "鎻愪氦";
+            var lishiyijian = new List<WfHistoryDTO>();
+
+            if (string.IsNullOrEmpty(id))
+            {
+                dto.CreaterName = curentuser.UserName;
+                dto.Tittle = "杈炶亴鐢宠锛�" + curentuser.UserName + "锛�";
+                dto.RuzhitimeName = curentuser.Indate.HasValue? curentuser.Indate.Value.ToString("yyyy-MM-dd"):"";
+                dto.CreatetimeName = DateTime.Now.ToString("yyyy-MM-dd");
+                var deptDTO = _hrDeptService.Get(curentuser.DeptId);
+                if (deptDTO != null)
+                {
+                    dto.DeptName = deptDTO.DeptName;
+                }
+               var positionDTO =  _hrPositionService.Get(curentuser.HrPosition);
+
+                if (positionDTO != null)
+                {
+                    dto.PostName = positionDTO.PostName;
+                }
+            }
+            else if (dto != null)
+            {
+                dto = _askService.GetAskCiZhi(id);
+                dto.OuttimeName = dto.Outtime.HasValue ? dto.Outtime.Value.ToString("yyyy-MM-dd"):"";
+                //dto.JineName = dto.Jine.Value.ToString("F2");
+
+                var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "21").FirstOrDefault();
+                if (wfRunProcessDTO == null)
+                {
+                    shifoubiaoji = "D";
+                    sifoudangqian = "D";
+                }
+                else
+                {
+                    dangqianbuzhou = wfRunProcessDTO.Step;
+                    //鏌ヨ瀹℃壒杩涘害
+                    lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
+                    if (wfRunProcessDTO.Step != "鎻愪氦")
+                    {
+                        shifoubiaoji = "D";
+                    }
+
+                    //鏌ヨ寰呭姙
+                    var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
+                    if (chaxundaiban != null && chaxundaiban.Count > 0)
+                    {
+                        sifoudangqian = "A";
+                    }
+                    else
+                    {
+                        sifoudangqian = "D";
+                    }
+
+                }
+            }
+
+            ViewBag.shifoubiaoji = shifoubiaoji;
+            ViewBag.sifoudangqian = sifoudangqian;
+            ViewBag.lishiyijian = lishiyijian;
+            ViewBag.dangqianbuzhou = dangqianbuzhou;
+
+            var userDTOs = _userService.GetList();
+            ViewData["UserIds"] = userDTOs;
+
+            string[] Userids = null;
+            if (!string.IsNullOrEmpty(dto.JiaojieUser) )
+            {
+                Userids = dto.JiaojieUser.Split(','); ;
+
+            }
+            else
+            {
+                Userids = new string[0];
+            }
+
+            ViewBag.Userid = Userids;
+
+            var userDTOsList  = userDTOs.Where(x => Userids.Contains(x.Id)).ToList();
+           if(userDTOsList!=null && userDTOsList.Count > 0)
+            {
+                dto.JiaojieUserName = "";
+                foreach (var userDTO in userDTOsList)
+                {
+                    dto.JiaojieUserName += userDTO.UserName + ",";
+                }
+            }
+
+            
+
+            //ViewBag.jtype = _liaotianService.GetSYScode("CooperVisit", "jtype");
+            //ViewBag.visType = _liaotianService.GetSYScode("CooperVisit", "visType");
+            //var cooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetList();
+            //var intentionCustomerDTOs = _intentionCustomerService.GetList();
+
+            //ViewBag.CooperatecustomCustomerDTOs = 
+
+            ViewData.Model = dto;
+            return View();
+        }
+
+
+        /// <summary>
+        /// 杈炶亴鐢宠
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAskCiZhi(AdmAskCiZhiDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                if (data.Step == "鎻愪氦")
+                {
+
+                    data.ShenpiStatus = "D";
+                    data.RecStatus = "A";
+                    data.Creater = curentuser.Id;
+                    data.Createtime = DateTime.Now;
+                    data.Modifier = data.Creater;
+                    data.Modifytime = data.Createtime;
+
+                    resultEntity = _askService.SaveAskCiZhi(data);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+                else
+                {
+
+                   var askCiZhiDTO  = _askService.GetAskCiZhi(data.Id);
+                    askCiZhiDTO.Outtime = data.Outtime;
+                    askCiZhiDTO.JiaojieUser = data.JiaojieUser;
+                    askCiZhiDTO.Modifier = curentuser.Id;
+                    askCiZhiDTO.Modifytime = DateTime.Now;
+
+                    resultEntity = _askService.SaveAskCiZhi(askCiZhiDTO);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+
+                if (data.Step == "鎬荤粡鐞嗗鎵�")
+                {
+                    //鎬荤粡鐞嗗鎵瑰悓鎰忎箣鍚庯紝鎻掑叆宸ヤ綔浜ゆ帴
+                }
+
+
+
+                //鍙戣捣娴佺▼鐩稿叧
+
+                resultEntity = _wfRunProcessService.WfAskCiZhi(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
+                if (!resultEntity.Result)
+                {
+                    return new JsonResult(resultEntity);
+                }
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
     }
 }

--
Gitblit v1.9.1