From 67a0042c5f29e4bb0e0b82f6190f2bc51480b45c Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期二, 28 二月 2023 13:25:09 +0800 Subject: [PATCH] 工资绩效改版 --- zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 213 insertions(+), 26 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs index ebd980b..858095c 100644 --- a/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs @@ -18,16 +18,28 @@ private readonly IHrDeptService _hrDeptService; private readonly ILogger<SalaryCheckController> _logger; private readonly IHrSalaryService _hrSalaryService; + private readonly IWfRunProcessService _wfRunProcessService; + private readonly IWfHistoryService _wfHistoryService; + private readonly IWfNeeddeelService _wfNeeddeelService; + private readonly IPltPageService _pltPageService; - public SalaryCheckController(ILogger<SalaryCheckController> logger, IHrSalaryService hrSalaryService, IHrDeptService hrDeptService) + public SalaryCheckController(ILogger<SalaryCheckController> logger, IHrSalaryService hrSalaryService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService + , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService + , IPltPageService pltPageService) { _logger = logger; _hrDeptService = hrDeptService; _hrSalaryService = hrSalaryService; + _wfRunProcessService = wfRunProcessService; + _wfHistoryService = wfHistoryService; + _wfNeeddeelService = wfNeeddeelService; + _pltPageService = pltPageService; } public IActionResult Index() { + 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; @@ -37,14 +49,25 @@ actionEntity.ActionName = "鏌ヨ"; actionlist.Add(actionEntity); - ActionEntity actionEntity1 = new ActionEntity(); - actionEntity1.OpenType = 0; - actionEntity1.ActionUrl = ""; - actionEntity1.ActionFun = "Edit"; - actionEntity1.PageIco = "fa fa-plus"; - actionEntity1.ActionName = "鏍稿噯"; - actionlist.Add(actionEntity1); - + //ActionEntity actionEntity1 = new ActionEntity(); + //actionEntity1.OpenType = 0; + //actionEntity1.ActionUrl = ""; + //actionEntity1.ActionFun = "Edit"; + //actionEntity1.PageIco = "fa fa-plus"; + //actionEntity1.ActionName = "鏍稿噯"; + //actionlist.Add(actionEntity1); + var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/SalaryCheck/Index"); + var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").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); + } ViewBag.editBtn = false; ViewData["ActionInfo"] = actionlist; @@ -62,7 +85,11 @@ /// <returns></returns> public IActionResult GetList(HrSalaryDTOSearch search) { - _hrSalaryService.AutoCheck(); + //_hrSalaryService.AutoCheck(); + if (!string.IsNullOrEmpty(search.YearMonth222)) + { + search.YearMonth = search.YearMonth222; + } return new JsonResult(_hrSalaryService.SearchSalaryByPaging(search)); } @@ -73,12 +100,38 @@ /// <param name="id"></param> /// <returns></returns> public IActionResult Edit(string id) - { + { + + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/SalaryCheck/Index"); + var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); + ViewData["ActionInfo2"] = pageEntities2; HrSalaryDTO dto = new HrSalaryDTO(); if (!string.IsNullOrEmpty(id)) { dto = _hrSalaryService.Get(id); } + if(!dto.Jiangjin.HasValue) + { + dto.Jiangjin = 0; + } + if (!dto.Bufagongzi.HasValue) + { + dto.Bufagongzi = 0; + } + if (!dto.Peichang.HasValue) + { + dto.Peichang = 0; + } + if (!dto.Jiucuo.HasValue || dto.Jiucuo.Value == 0) + { + dto.Jiucuo = 0; + } + //if (!dto.Yufagongziheji.HasValue) + //{ + // dto.Yufagongziheji = 0; + //} ViewData.Model = dto; return View(); } @@ -89,7 +142,7 @@ /// <param name="data"></param> /// <returns></returns> [HttpPost] - public IActionResult SaveCheck(HrSalaryDTO data) + public IActionResult SaveCheck(HrSalaryUpDTO data) { var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ResultEntity resultEntity = new ResultEntity(); @@ -148,19 +201,69 @@ } - public IActionResult Appeal(string id) + public IActionResult Appeal(string id="",string salaryId = "") { HrSalaryAppeal dto = new HrSalaryAppeal(); var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); - if (!string.IsNullOrEmpty(id)) - { - dto = _hrSalaryService.GetAppeal(id, curentuser.Id); - if(dto==null) + dto = _hrSalaryService.GetAppeal(id, curentuser.Id, salaryId); + + //娴佺▼鐩稿叧 + string shifoubiaoji = "A"; + string sifoudangqian = "A"; + string dangqianbuzhou = "鎻愪氦"; + var lishiyijian = new List<WfHistoryDTO>(); + + if (dto==null) { + var salaryDTO = _hrSalaryService.Get(salaryId); dto = new HrSalaryAppeal(); - dto.salary_id = id; - } + dto.salary_id = salaryId; + dto.year = salaryDTO.Year; + dto.month = salaryDTO.Month; + dto.createrName = curentuser.UserName; + dto.tittle = "宸ヨ祫鐢宠瘔锛�" + curentuser.UserName + "锛�"; } + else if (dto != null) + { + var wfRunProcessDTO = _wfRunProcessService.GetList(dto.id, "03").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; + ViewData.Model = dto; return View(); } @@ -171,14 +274,32 @@ /// <param name="data"></param> /// <returns></returns> [HttpPost] - public IActionResult SaveAppeal(HrSalaryAppeal data) + public IActionResult SaveAppeal(HrSalaryAppealDTO data) { var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ResultEntity resultEntity = new ResultEntity(); using (TransactionScope scope = new TransactionScope()) { - data.sub_user = curentuser.Id; - resultEntity = _hrSalaryService.CheckAppea(data); + if (data.Step == "鎻愪氦") + { + data.sub_user = curentuser.Id; + data.shenpi_status = "D"; + data.status = "A"; + resultEntity = _hrSalaryService.CheckAppea(data); + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } + } + + + //鍙戣捣娴佺▼鐩稿叧 + + resultEntity = _wfRunProcessService.WfSalaryAppeal(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); @@ -201,8 +322,8 @@ ViewData["ActionInfo"] = actionlist; ViewBag.dept = _hrDeptService.GetList().Select(x => new { code = x.Id, label = x.DeptName }).ToList(); - ViewBag.stime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM-dd"); - ViewBag.etime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd"); + ViewBag.stime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM"); + ViewBag.etime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM"); return View(); } @@ -215,11 +336,77 @@ public IActionResult GetSearchList(HrSalaryDTOSearch search) { //鑷姩纭 - _hrSalaryService.AutoCheck(); + //_hrSalaryService.AutoCheck(); + if (!string.IsNullOrEmpty(search.searchDatestart222)) + { + search.searchDatestart = search.searchDatestart222; + } + if (!string.IsNullOrEmpty(search.searchDateend222)) + { + search.searchDateend = search.searchDateend222; + } return new JsonResult(_hrSalaryService.SearchByPagingFinish(search)); } - + + #endregion + + + + #region 宸ヨ祫鏌ヨ + + public IActionResult SearchIndexRenshi(string UserId) + { + 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); + ViewData["ActionInfo"] = actionlist; + + //ViewBag.dept = _hrDeptService.GetList().Select(x => new { code = x.Id, label = x.DeptName }).ToList(); + ViewBag.stime =DateTime.Now.AddMonths(-1).ToString("yyyy-MM"); + ViewBag.etime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM"); + + ViewBag.UserId = UserId; + + return View(); + } + + /// <summary> + /// 鍒楄〃鍐呭 + /// </summary> + /// <param name="search"></param> + /// <returns></returns> + public IActionResult GetSearchListRenshi(HrSalaryDTOSearch search) + { + if (!string.IsNullOrEmpty(search.searchDatestart222)) + { + search.searchDatestart = search.searchDatestart222; + } + if (!string.IsNullOrEmpty(search.searchDateend222)) + { + search.searchDateend = search.searchDateend222; + } + + //鑷姩纭 + //_hrSalaryService.AutoCheck(); + + if (!string.IsNullOrEmpty(search.searchDatestart)) + { + search.searchDatestart = DateTime.Now.ToString("yyyy-MM"); + } + if (!string.IsNullOrEmpty(search.searchDateend)) + { + search.searchDate = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM"); + } + + return new JsonResult(_hrSalaryService.SearchByPagingFinish(search)); + } + #endregion } } -- Gitblit v1.9.1