LegalCaseController.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Data.Entity;
  2. using System.Linq.Dynamic.Core;
  3. using System.Threading.Tasks;
  4. using System.Web.Mvc;
  5. using Abp.Web.Mvc.Authorization;
  6. using Abp.Runtime.Caching;
  7. using Abp.UI;
  8. using ContractService.BaseSystem.Query;
  9. using ContractService.Configuration;
  10. using ContractService.LegalContract;
  11. using IwbZero.Runtime.Session;
  12. using IwbZero.ToolCommon.StringModel;
  13. namespace ContractService.Controllers
  14. {
  15. [AbpMvcAuthorize]
  16. public class LegalCaseController : IwbControllerBase
  17. {
  18. public LegalCaseController( ICacheManager cacheManager, QueryAppService queryApp, LegalManager legalManager)
  19. {
  20. QueryApp = queryApp;
  21. LegalManager = legalManager;
  22. CacheManager = cacheManager;
  23. }
  24. public QueryAppService QueryApp { get; }
  25. public LegalManager LegalManager { get; }
  26. [AbpMvcAuthorize]
  27. public async Task<ActionResult> Case()
  28. {
  29. if (AbpSession.AccountType != AccountTypeDefinition.System && AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType).Empty())
  30. {
  31. throw new UserFriendlyException("当前账号未绑定律师(或企业员工),不能访问!");
  32. }
  33. if (AbpSession.AccountType == AccountTypeDefinition.Client)
  34. {
  35. var companyNo = AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType);
  36. ViewBag.CompanyNo = companyNo;
  37. }
  38. ViewBag.IsCompanyMaster = await LegalManager.IsCompanyMaster();
  39. ViewBag.Level = await QueryApp.GetCaseLevelSelectStr();
  40. ViewBag.State = await QueryApp.GetCaseStateSelectStr();
  41. ViewBag.ServiceType = await QueryApp.GetServiceTypeSelectStr("");
  42. return View();
  43. }
  44. [AbpMvcAuthorize]
  45. public async Task<ActionResult> CaseDetail(string id)
  46. {
  47. if (AbpSession.AccountType != AccountTypeDefinition.System && AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType).Empty())
  48. {
  49. throw new UserFriendlyException("当前账号未绑定律师(或企业员工),不能访问!");
  50. }
  51. if (id.Empty())
  52. {
  53. CheckErrors("项目不存在,请检查后再试!");
  54. }
  55. ViewBag.CaseNo = id;
  56. ViewBag.IsLawFirmMaster = LegalManager.IsLawFirmMaster(AbpSession.AccountNo);
  57. ViewBag.IsCaseMaster = await LegalManager.IsClientCaseMaster(id);
  58. ViewBag.CaseState = await QueryApp.GetCaseStateSelectStr();
  59. ViewBag.ContractState = await QueryApp.GetContractStateSelectStr();
  60. return View();
  61. }
  62. [AbpMvcAuthorize]
  63. public async Task<ActionResult> ContractDetail(string id)
  64. {
  65. if (AbpSession.AccountType != AccountTypeDefinition.System && AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType).Empty())
  66. {
  67. throw new UserFriendlyException("当前账号未绑定律师(或企业员工),不能访问!");
  68. }
  69. if (id.Empty())
  70. {
  71. CheckErrors("合同不存在,请检查后再试!");
  72. }
  73. ViewBag.ContractNo = id;
  74. ViewBag.IsCompanyMaster = await LegalManager.IsCompanyMaster();
  75. ViewBag.IsContractMaster = await LegalManager.IsClientContractMaster(id);
  76. ViewBag.MasterLawyer = (await LegalManager.QueryMasterLawyerByContract(id).FirstOrDefaultAsync())?.Name ?? "";
  77. ViewBag.MasterStaff = (await LegalManager.QueryMasterStaffByContract(id).FirstOrDefaultAsync())?.Name ?? "";
  78. ViewBag.ContractState = await QueryApp.GetContractStateSelectStr();
  79. ViewBag.KeyPointState = await QueryApp.GetKeyPointStateSelectStr();
  80. ViewBag.KeyPointLevel = await QueryApp.GetKeyPointLevelSelectStr();
  81. return View();
  82. }
  83. [AbpMvcAuthorize]
  84. public async Task<ActionResult> Contract()
  85. {
  86. if (AbpSession.AccountType != AccountTypeDefinition.System && AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType).Empty())
  87. {
  88. throw new UserFriendlyException("当前账号未绑定律师(或企业员工),不能访问!");
  89. }
  90. ViewBag.State = await QueryApp.GetContractStateSelectStr();
  91. ViewBag.IsCompanyMaster = LegalManager.IsCompanyMaster(AbpSession.AccountNo);
  92. ViewBag.IsLawFirmMaster = LegalManager.IsLawFirmMaster(AbpSession.AccountNo);
  93. return View();
  94. }
  95. }
  96. }