123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Mapping;
- using Bowin.Common.JSON;
- using EMIS.CommonLogic.ChargeManage.ChargeSituation;
- using EMIS.ViewModel.ChargeManage.ChargeSituation;
- using EMIS.CommonLogic.CalendarManage;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.ViewModel.WorkflowManage;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.ChargeManage.ChargeSituation
- {
- [Authorization]
- public class ChargeDelayController : Controller
- {
- public IChargeDelayServices ChargeDelayServices { get; set; }
-
- /// <summary>
- /// 缓交名单页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 缓交名单列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
- var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
- var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
- var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown");
- var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid");
- //在校状态
- var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
- //审批状态
- var chargeDelayStatus = pararms.getExtraInt("DictionaryChargeDelayStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChargeDelayStatus");
- return base.Json(ChargeDelayServices.GetChargeDelayList(configuretView, collegeID, yearID, standardID, educationID,
- learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, chargeDelayStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 查询应收名单中对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
- /// </summary>
- /// <param name="userID"></param>
- /// <param name="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ChargeDelayStandard(Guid? userID, int? chargeYearID, Guid? chargeProjectID)
- {
- try
- {
- var result = ChargeDelayServices.GetChargeDelayStandardView(userID, chargeYearID, chargeProjectID);
- return Json(new ReturnMessage<ChargeDelayView>()
- {
- IsSuccess = true,
- Data = result
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 编辑(申请、修改)
- /// </summary>
- /// <param name="chargeDelayID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? chargeDelayID)
- {
- ChargeDelayView chargeDelayView = new ChargeDelayView();
- if (chargeDelayID.HasValue && chargeDelayID != Guid.Empty)
- {
- chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID);
- }
- else
- {
- chargeDelayView.ChargeYear = BaseExtensions.GetCurrentYearID();
- }
- return View(chargeDelayView);
- }
- /// <summary>
- /// 编辑(申请、修改)
- /// </summary>
- /// <param name="chargeDelayView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ChargeDelayView chargeDelayView)
- {
- try
- {
- ChargeDelayServices.ChaegeDelayEdit(chargeDelayView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string chargeDelayIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < chargeDelayIDs.Split(',').Length; i++)
- {
- string id = chargeDelayIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid chargeDelayID = new Guid(id);
- list.Add(chargeDelayID);
- }
- }
- ChargeDelayServices.ChargeDelayDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "。");
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Submit(string chargeDelayIDs)
- {
- try
- {
- List<Guid> list = chargeDelayIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- string result = ChargeDelayServices.SubmitChargeDelay(list, user.UserID, "");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "提交成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "提交失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 审核页面(单个)
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Approve(Guid? chargeDelayID)
- {
- //查询对应的缓交信息View
- var chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID);
- if (chargeDelayView == null)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "操作失败,原因:数据有误。",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- //对已结束的流程状态进行判断(包括正常结束、非正常结束[BP]标识)
- var endStatusList = ChargeDelayServices.GetBackpointStatus();
- var correctEndStatusID = ChargeDelayServices.GetCorrectEndStatus();
- endStatusList.Add(correctEndStatusID);
- foreach (var endStatus in endStatusList)
- {
- if (chargeDelayView.RecordStatus == endStatus)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "无法对已结束的流程进行审核。",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- //根据当前环节ID、用户ID查询下一步审批动作信息List(ActionView)
- var actionViewList = ChargeDelayServices.GetActionView((Guid)chargeDelayID, user.UserID);
- if (actionViewList == null || actionViewList.Count() <= 0)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "对不起,您没权限操作。",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- var dropList = actionViewList.Select(x => new DropdownListItem { Text = x.ActionName, Value = x.ToJson() }).ToList();
- ViewBag.ListAction = dropList;
- var newChargeDelayView = new ChargeDelayView();
- chargeDelayView.DynamicCloneTo(newChargeDelayView);
- return View(newChargeDelayView);
- }
- /// <summary>
- /// 审核页面(单个)
- /// </summary>
- /// <param name="chargeDelayView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Approve(ChargeDelayView chargeDelayView)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- list.Add(chargeDelayView.ChargeDelayID);
- var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- string action = Request.Form["ddlAction"];
- if (string.IsNullOrEmpty(action))
- {
- throw new Exception("请选择处理动作");
- }
- var actionID = action.JsonToObject<ActionView>().ActionID;
- ChargeDelayServices.ApproveChargeDelay(list, user.UserID, actionID, chargeDelayView.Comment);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "审核成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "审核失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 审核确定(批量)
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BatchApprove(string chargeDelayIDs, Guid actionID, string comment)
- {
- try
- {
- List<Guid?> list = chargeDelayIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- ChargeDelayServices.ApproveChargeDelay(list, user.UserID, actionID, comment);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "审核成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "审核失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
- var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
- var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
- //在校状态
- var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- //审批状态
- var chargeDelayStatus = Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChargeDelayStatus"].ParseStrTo<int>();
- var dt = ChargeDelayServices.GetChargeDelayList(configuretView, collegeID, yearID, standardID, educationID,
- learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, chargeDelayStatus)
- .Select(x => new
- {
- x.StudentNo,
- x.UserName,
- x.SexName,
- x.ClassNo,
- x.ClassName,
- x.GradeMajorCode,
- x.GradeMajoyStr,
- x.CollegeCode,
- x.CollegeStr,
- x.ChargeYear,
- x.ChargeProjectStr,
- x.Amount,
- x.ChargeAmount,
- x.ActualAmount,
- x.ChargeTagName,
- x.PaidAmount,
- x.DelayAmount,
- x.GradeStr,
- x.StandardID,
- x.StandardCode,
- x.MajorStr,
- x.EducationName,
- x.LearningformName,
- x.LearnSystem,
- x.InSchoolStatusName,
- x.StudentStatusName,
- x.Reason,
- x.RecordStatusName
- }).ToTable();
- string[] liststring = { "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
- RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "缴费学年", "收费项目", "应收金额",
- "调整金额", "实收金额", "缴费标记", "已缴金额", "缓交金额", "年级", "专业ID(Value)",
- "专业代码", "专业名称", RSL.Get("EducationID"),
- "学习形式", "学制", "在校状态", "学籍状态", "缓交原因", "状态"
- };
- neh.Export(dt, liststring, "缓交名单信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|