123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.ChargeManage.ChargeSituation;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Common.JSON;
- using EMIS.ViewModel.ChargeManage.ChargeSituation;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.ChargeManage.ChargeSituation
- {
- [Authorization]
- public class StudentChargeController : Controller
- {
- public IStudentChargeServices StudentChargeServices { 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 chargeTagID = pararms.getExtraInt("DictionaryChargeTag") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChargeTag");
- //在校状态
- var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
- //是否圆梦计划
- var isDream = pararms.getExtraInt("IsDreamDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsDreamDropDown");
- return base.Json(StudentChargeServices.GetStudentChargeViewGrid(configuretView, collegeID, yearID, standardID, educationID,
- learningformID, learnSystem, chargeYearID, chargeProjectID, chargeTagID, inSchoolStatus,
- isDream, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="studentChargeID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? studentChargeID)
- {
- StudentChargeView studentChargeView = new StudentChargeView();
- if (studentChargeID.HasValue && studentChargeID != Guid.Empty)
- {
- studentChargeView = StudentChargeServices.GetStudentChargeView(studentChargeID);
- }
- else
- {
- studentChargeView.ChargeYear = BaseExtensions.GetCurrentYearID();
- studentChargeView.ChargeTag = (int)EC_ChargeTag.Normal;
- }
- return View(studentChargeView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// 存在对应的收费标准时,才可新增
- /// 业务主键不可修改(业务主键:用户ID、缴费学年、收费项目ID)
- /// </summary>
- /// <param name="sudentChargeView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(StudentChargeView sudentChargeView)
- {
- try
- {
- StudentChargeServices.StudentChaegeEdit(sudentChargeView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 查询对应的收费标准应收金额
- /// </summary>
- /// <param name="userID"></param>
- /// <param name="chargeYear"></param>
- /// <param name="chargeProjectID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentChargeStandard(Guid? userID, int? chargeYearID, Guid? chargeProjectID)
- {
- try
- {
- var result = "";
- var chargeStandardView = StudentChargeServices.StudentChargeChargeStandard(userID, chargeYearID, chargeProjectID);
- if (chargeStandardView != null)
- {
- result = chargeStandardView.Amount.ToString();
- }
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = result
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "数据有误,请核查,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 删除(当选择删除的信息中存在对应的学生缴费信息时,无法删除)
- /// </summary>
- /// <param name="chargeStandardIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string studentChargeIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < studentChargeIDs.Split(',').Length; i++)
- {
- string id = studentChargeIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid chargeStandardID = new Guid(id);
- list.Add(chargeStandardID);
- }
- }
- StudentChargeServices.StudentChargedDelete(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>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ChangeActualAmount()
- {
- return View();
- }
- /// <summary>
- /// 费用调整
- /// </summary>
- /// <param name="changeJsonStr"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ChangeActualAmount(string changeJsonStr)
- {
- try
- {
- changeJsonStr = Request.Form["hid_JsonStr"];
- string actualAmount = Request.Form["ActualAmount"];
- string chargeTag = Request.Form["ChargeTag"];
- string remark = Request.Form["Remark"];
- var sutdentChargeViewlist = changeJsonStr.JsonToObject<List<StudentChargeView>>();
- StudentChargeServices.UpdateActualAmount(sutdentChargeViewlist, Convert.ToDecimal(actualAmount),
- Convert.ToInt32(chargeTag), remark);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 缓交申请(同时对相应的缓交信息进行验证)
- /// </summary>
- /// <param name="studentChargeID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ChargeDelay(Guid? studentChargeID)
- {
- ChargeDelayView chargeDelayView = new ChargeDelayView();
- if (studentChargeID.HasValue && studentChargeID != Guid.Empty)
- {
- chargeDelayView = StudentChargeServices.GetStudentChargeChargeDelayView(studentChargeID);
- }
- return View(chargeDelayView);
- }
- /// <summary>
- /// 缓交申请
- /// </summary>
- /// <param name="studentChargeID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ChargeDelay(ChargeDelayView chargeDelayView)
- {
- try
- {
- StudentChargeServices.ChargeDelay(chargeDelayView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "申请成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "申请失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 验证
- /// </summary>
- /// <param name="studentChargeID"></param>
- /// <param name="chargeProjectID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Verification(Guid? studentChargeID, Guid? userID, int? chargeYearID, Guid? chargeProjectID)
- {
- return Json(StudentChargeServices.GetVerification(studentChargeID, userID, 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 chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
- var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
- var chargeTagID = Request.Form["DictionaryChargeTag"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChargeTag"].ParseStrTo<int>();
- //在校状态
- var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- //是否圆梦计划
- var isDream = Request.Form["IsDreamDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsDreamDropDown"].ParseStrTo<int>();
- var dt = StudentChargeServices.GetStudentChargeViewGrid(configuretView, collegeID, yearID, standardID, educationID,
- learningFormID, learnSystem, chargeYearID, chargeProjectID, chargeTagID, inSchoolStatus, isDream)
- .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.GradeStr,
- x.StandardID,
- x.StandardCode,
- x.MajorStr,
- x.EducationName,
- x.LearningformName,
- x.LearnSystem,
- x.IsDreamProject,
- x.InSchoolStatusName,
- x.StudentStatusName,
- x.Remark
- }).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 = "导出成功。"
- });
- }
- }
- }
|