From ac4f98f9d24552d1c43935f20a969a2fda0723f0 Mon Sep 17 00:00:00 2001
From: LR-20210131IOQH\Administrator <jackcold@163.com>
Date: 星期五, 25 六月 2021 10:40:03 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa

---
 zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs |  220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 220 insertions(+), 0 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs
new file mode 100644
index 0000000..14d8836
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs
@@ -0,0 +1,220 @@
+锘縰sing DTO;
+using IServices;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Transactions;
+using zhengcaioa.Models;
+
+namespace zhengcaioa.Controllers.HR
+{
+    public class SalaryCheckController : Controller
+    {
+        private readonly IHrDeptService _hrDeptService;
+        private readonly ILogger<SalaryCheckController> _logger;
+        private readonly IHrSalaryService _hrSalaryService;
+
+        public SalaryCheckController(ILogger<SalaryCheckController> logger, IHrSalaryService hrSalaryService, IHrDeptService hrDeptService)
+        {
+            _logger = logger;            
+            _hrDeptService = hrDeptService;
+            _hrSalaryService = hrSalaryService;
+        }
+
+        public IActionResult Index()
+        {
+            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 = "Edit";
+            actionEntity1.PageIco = "fa fa-plus";
+            actionEntity1.ActionName = "鏍稿噯";
+            actionlist.Add(actionEntity1);
+
+            ViewBag.editBtn = false;
+                        
+            ViewData["ActionInfo"] = actionlist;
+
+            ViewBag.dept = _hrDeptService.GetList().Select(x => new { code = x.Id, label = x.DeptName }).ToList();
+
+            return View();
+        }
+
+
+        /// <summary>
+        /// 鍒楄〃鍐呭
+        /// </summary>
+        /// <param name="search"></param>
+        /// <returns></returns>
+        public IActionResult GetList(HrSalaryDTOSearch search)
+        {
+            return new JsonResult(_hrSalaryService.SearchSalaryByPaging(search));
+        }
+
+        /// <summary>
+        /// 缂栬緫椤�
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public IActionResult Edit(string id)
+        {           
+            HrSalaryDTO dto = new HrSalaryDTO();
+            if (!string.IsNullOrEmpty(id))
+            {
+                dto = _hrSalaryService.Get(id);
+            }
+            ViewData.Model = dto;
+            return View();
+        }
+
+        /// <summary>
+        /// 淇濆瓨
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveCheck(HrSalaryDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                data.Modifier = curentuser.Id;
+                resultEntity = _hrSalaryService.SaveCheckSalary(data);
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
+
+        #region 宸ヨ祫鏍稿
+
+        public IActionResult Employee()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewBag.Employee = curentuser;
+            return View();
+        }
+
+        public JsonResult EmployeeSalary(string month)
+        {
+            ResultDataEntity<HrSalaryDTO> data = new ResultDataEntity<HrSalaryDTO>();
+            HrSalaryDTOSearch searchEntity = new HrSalaryDTOSearch();
+            searchEntity.page = 0;
+            searchEntity.rows = 10;
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            if (!string.IsNullOrEmpty(month))
+            {
+                var dtime = DateTime.Parse(month);
+                var md = _hrSalaryService.GetSalary(curentuser.Id, dtime.Year,dtime.Month);
+                if (searchEntity.totalrows == 0)
+                    searchEntity.totalrows =1;
+                data.LoadData(searchEntity, md );                         
+            }
+            
+            return Json(data);
+        }
+
+        [HttpPost]
+        public JsonResult SalaryCheckOk(string id)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            if(!string.IsNullOrEmpty(id))
+            {
+                using (TransactionScope scope = new TransactionScope())
+                {
+                    resultEntity = _hrSalaryService.CheckOk(id, curentuser.Id);
+                    scope.Complete();
+                }
+            }
+
+            return Json(resultEntity);
+        }
+
+
+        public IActionResult Appeal(string id)
+        {
+            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 = new HrSalaryAppeal();
+                    dto.salary_id = id;
+                }
+            }
+            ViewData.Model = dto;
+            return View();
+        }
+
+        /// <summary>
+        /// 淇濆瓨鐢宠瘔
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAppeal(HrSalaryAppeal 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);
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
+
+        #endregion
+
+        #region 宸ヨ祫鏌ヨ
+
+        public IActionResult SearchIndex()
+        {
+            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.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"); 
+
+            return View();
+        }
+
+        /// <summary>
+        /// 鍒楄〃鍐呭
+        /// </summary>
+        /// <param name="search"></param>
+        /// <returns></returns>
+        public IActionResult GetSearchList(HrSalaryDTOSearch search)
+        {
+            return new JsonResult(_hrSalaryService.SearchByPagingFinish(search));
+        }
+        
+        #endregion
+    }
+}

--
Gitblit v1.9.1