123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Linq.Expressions;
- using Bowin.Common.Data;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using Bowin.Common.JSON;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Web.Controls;
- using EMIS.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.ChargeManage.ChargeSituation;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.CommonLogic.UniversityManage.SpecialtyClassManage;
- using EMIS.CommonLogic.ChargeManage.ChargeSituation;
- using EMIS.CommonLogic.UniversityManage.AdministrativeOrgan;
- namespace EMIS.Web.Controllers.ChargeManage.ChargeSituation
- {
- [Authorization]
- public class ChargeStandardController : Controller
- {
- public IChargeStandardServices ChargeStandardServices { get; set; }
- public ICollegeServices collegeServices { get; set; }
- public ISchoolYearServices SchoolYearServices { get; set; }
- public IGrademajorServices iGrademajorServices { get; set; }
-
- /// <summary>
- /// 收费标准页面
- /// </summary>
- /// <returns></returns>
- 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");
-
- return base.Json(ChargeStandardServices.GetChargeStandardViewGrid(configuretView, collegeID, yearID, chargeYearID,
- standardID, educationID, learningFormID, chargeProjectID, LearnSystem, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
- }
-
- /// <summary>
- /// 编辑
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? chargeStandardID)
- {
- ChargeStandardView chargeStandardView = new ChargeStandardView();
- if (chargeStandardID != null && chargeStandardID.HasValue)
- {
- chargeStandardView = ChargeStandardServices.GetChargeStandardView(chargeStandardID);
- }
- return View(chargeStandardView);
- }
- /// <summary>
- /// 编辑页面
- /// </summary>
- /// <param name="facultymajorView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ChargeStandardView chargeStandardView)
- {
- try
- {
- ChargeStandardServices.ChargeStandardEdit(chargeStandardView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
-
- /// <summary>
- /// 删除(当选择删除的信息中存在对应的应收名单时,无法删除)
- /// </summary>
- /// <param name="facultymajorView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string chargeStandardIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < chargeStandardIDs.Split(',').Length; i++)
- {
- string id = chargeStandardIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid chargeStandardID = new Guid(id);
- list.Add(chargeStandardID);
- }
- }
- ChargeStandardServices.ChargeStandardDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- mge = "请先删除与其关联的数据,如:应收名单等";
- }
- return base.Json("删除失败,原因:" + mge + "。");
- }
- }
-
- /// <summary>
- /// 刷新名单(生成对应的收费标准应收名单)
- /// </summary>
- /// <param name="chargeStandardIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CreatChargeList(string chargeStandardIDs, int? inschoolStatus)
- {
- try
- {
- List<Guid?> chargeStandardIDList = new List<Guid?>();
- for (int i = 0; i < chargeStandardIDs.Split(',').Length; i++)
- {
- string id = chargeStandardIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid chargeStandardID = new Guid(id);
- chargeStandardIDList.Add(chargeStandardID);
- }
- }
- string result = ChargeStandardServices.CreatStudentChargeList(chargeStandardIDList, inschoolStatus);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "刷新成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "刷新失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 收费标准年级专业新增
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Addlist()
- {
- ChargeStandardView chargeStandardView = new ChargeStandardView();
- chargeStandardView.InSchoolStatus = (int)CF_INOrOutSchoolStatus.Yes;
- chargeStandardView.ChargeYear = BaseExtensions.GetCurrentYearID();
- return View(chargeStandardView);
- }
- /// <summary>
- /// 收费标准年级专业新增
- /// </summary>
- /// <param name="amount"></param>
- /// <param name="chargeProjectID"></param>
- /// <param name="gradeMajorID"></param>
- /// <param name="chargeYear"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Addlist(ChargeStandardView chargeStandardView)
- {
- try
- {
- var gradeMajorIDs = Request["gradeMajorIDs"].JsonToObject<List<Guid?>>();
- string result = ChargeStandardServices.ChargeStandardAdd(gradeMajorIDs, chargeStandardView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 收费标准新增年级专业列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GradeMajorList(QueryParamsModel pararms)
- {
- //注:List页面取ID,Excel取Name
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var yearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
- var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
- 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 gradeMajorID = pararms.getExtraGuid("GradeMajorComboGrid"); //暂时不做年级专业下拉查询
- var inschoolstatus = pararms.getExtraInt("InSchoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("InSchoolStatus");
- var chargeYearID = pararms.getExtraInt("ChargeYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYear");
- //注:收费项目取Value值
- var chargeProjectID = pararms.getExtraGuid("ChargeProjectID");
- return base.Json(ChargeStandardServices.GetGradeMajorViewGrid(configuretView, gradeMajorID, collegeID, yearID, standardID,
- educationID, learningFormID, LearnSystem, inschoolstatus, chargeYearID, chargeProjectID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 查询年级专业下各班级学生名单
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult StudentList()
- {
- return View();
- }
- /// <summary>
- /// 查询年级专业下各班级学生名单
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
- int? inschoolStatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
-
- return Json(ChargeStandardServices.GetGradeMajorStudentViewGrid(grademajorID, inschoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 应收名单列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult StudentChargeList()
- {
- return View();
- }
- /// <summary>
- /// 应收名单查询列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentChargeList(QueryParamsModel pararms)
- {
- var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
- int? chargeYearID = Request["chargeYearID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["chargeYearID"].ParseStrTo<int>();
- var chargeProjectID = Request["chargeProjectID"].ParseStrTo<Guid>();
- //在校状态暂时无效
- int? inschoolStatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
- return Json(ChargeStandardServices.GetGradeMajorStudentChargeViewGrid(grademajorID, chargeYearID, chargeProjectID, inschoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 验证(业务主键:年级专业ID、缴费学年、收费项目ID)
- /// </summary>
- /// <param name="chargeStandardID"></param>
- /// <param name="grademajorID"></param>
- /// <param name="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Verification(Guid? chargeStandardID, Guid? grademajorID, int? chargeYearID, Guid? chargeProjectID)
- {
- return Json(ChargeStandardServices.GetVerification(chargeStandardID, grademajorID, chargeYearID, chargeProjectID));
- }
- /// <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 inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
- var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
- var dt = ChargeStandardServices.GetChargeStandardList(configuretView, collegeID, yearID, standardID, learningFormID,
- chargeYearID, chargeProjectID, LearnSystem, educationID, inSchoolStatus).Select(x => new
- {
- x.GradeMajorCode,
- x.GrademajorStr,
- x.GradeStr,
- x.StandardID,
- x.StandardCode,
- x.MajorStr,
- x.EducationName,
- x.LearningformStr,
- x.LearnSystem,
- x.CollegeCode,
- x.CollegeStr,
- x.ChargeYear,
- x.ChargeProjectStr,
- x.Amount,
- x.StudentCount,
- x.StudentChargeCount
- }).ToTable();
- string[] liststring = { "年级专业代码", "年级专业名称", "年级", "专业ID(Value)",
- "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
- "学制", RSL.Get("CollegeCode"), RSL.Get("CollegeName"),
- "缴费学年", "收费项目", "应收金额(¥)", "学生人数", "生成人数"
- };
- neh.Export(dt, liststring, "收费标准信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- /// <summary>
- /// 学生信息明细Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GrademajorStudentExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
- int? inschoolstatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
- var dt = ChargeStandardServices.GetGradeMajorStudentViewGrid(grademajorID, inschoolstatus).Select(x => new
- {
- x.LoginID,
- x.UserName,
- x.SexName,
- x.ClassMajorName,
- x.InSchoolStatusName,
- x.StudentStatusName
- }).ToTable();
- string[] liststring = { "学号", "姓名", "性别", "班级名称 ", "在校状态", "学籍状态" };
- neh.Export(dt, liststring, "学生信息明细" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- /// <summary>
- /// 应收名单明细Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GrademajorStudentChargeExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
- int? chargeYearID = Request["chargeYearID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["chargeYearID"].ParseStrTo<int>();
- var chargeProjectID = Request["chargeProjectID"].ParseStrTo<Guid>();
- //在校状态暂时无效
- int? inschoolStatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
- var dt = ChargeStandardServices.GetGradeMajorStudentChargeViewGrid(grademajorID, chargeYearID, chargeProjectID, inschoolStatus).Select(x => new
- {
- x.StudentNo,
- x.UserName,
- x.SexName,
- x.ClassName,
- x.ChargeYear,
- x.ChargeProjectStr,
- x.Amount,
- x.InSchoolStatusName,
- x.Remark
- }).ToTable();
- string[] liststring = { "学号", "姓名", "性别", "班级名称 ", "缴费学年 ",
- "收费项目", "应收金额", "在校状态", "备注" };
- neh.Export(dt, liststring, "应收名单明细" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|