FinancialController.cs 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. using Microsoft.AspNetCore.Http;
  2. using Microsoft.AspNetCore.Mvc;
  3. using OASystem.API.OAMethodLib;
  4. using OASystem.API.OAMethodLib.File;
  5. using OASystem.Domain;
  6. using OASystem.Domain.Dtos.Financial;
  7. using OASystem.Domain.Entities.Groups;
  8. using OASystem.Domain.ViewModels.Financial;
  9. using OASystem.Domain.ViewModels.Groups;
  10. using OASystem.Infrastructure.Repositories.Financial;
  11. using OASystem.Infrastructure.Repositories.Groups;
  12. using System.Data;
  13. namespace OASystem.API.Controllers
  14. {
  15. /// <summary>
  16. /// 财务模块
  17. /// </summary>
  18. [Route("api/[controller]/[action]")]
  19. [ApiController]
  20. public class FinancialController : ControllerBase
  21. {
  22. private readonly IMapper _mapper;
  23. private readonly IConfiguration _config;
  24. private readonly SqlSugarClient _sqlSugar;
  25. private readonly SetDataTypeRepository _setDataTypeRep;
  26. private readonly DailyFeePaymentRepository _daiRep; //日付申请仓库
  27. private readonly TeamRateRepository _teamRateRep; //团组汇率仓库
  28. private readonly ForeignReceivablesRepository _ForForeignReceivablesRep; //对外收款账单仓库
  29. private readonly ProceedsReceivedRepository _proceedsReceivedRep; //已收款项仓库
  30. private readonly PaymentRefundAndOtherMoneyRepository _paymentRefundAndOtherMoneyRep; //收款退还与其他款项 仓库
  31. /// <summary>
  32. /// 初始化
  33. /// </summary>
  34. public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep,
  35. TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep, ProceedsReceivedRepository proceedsReceivedRep,
  36. PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep)
  37. {
  38. _mapper = mapper;
  39. _config = configuration;
  40. _daiRep = daiRep;
  41. _sqlSugar = sqlSugar;
  42. _setDataTypeRep = setDataTypeRep;
  43. _teamRateRep = teamRateRep;
  44. _ForForeignReceivablesRep = ForForeignReceivablesRep;
  45. _proceedsReceivedRep = proceedsReceivedRep;
  46. _paymentRefundAndOtherMoneyRep = paymentRefundAndOtherMoneyRep;
  47. }
  48. #region 日付申请
  49. /// <summary>
  50. /// 获取日付申请 基础数据源
  51. /// </summary>
  52. /// <param name="dto"> 日付申请 分页 dto</param>
  53. /// <returns></returns>
  54. [HttpPost]
  55. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  56. public async Task<IActionResult> PostPageSearchDailyPaymentPriceTypeData(PortDtoBase dto)
  57. {
  58. var result = await _daiRep.GetPagePriceTypeData(dto);
  59. if (result == null || result.Code != 0)
  60. {
  61. return Ok(JsonView(false, result.Msg));
  62. }
  63. var data = result.Data;
  64. return Ok(JsonView(data));
  65. }
  66. /// <summary>
  67. /// 获取日付申请 基础数据源 - 转账表识
  68. /// </summary>
  69. /// <param name="dto"> 日付申请 分页 dto</param>
  70. /// <returns></returns>
  71. [HttpPost]
  72. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  73. public async Task<IActionResult> GetSearchDailyPaymentPriceTypeAddData(PortDtoBase dto)
  74. {
  75. var result = await _daiRep.GetPriceTypeAddData(dto);
  76. if (result == null || result.Code != 0)
  77. {
  78. return Ok(JsonView(false, result.Msg));
  79. }
  80. var data = result.Data;
  81. return Ok(JsonView(data));
  82. }
  83. /// <summary>
  84. /// 日付申请 Page Search
  85. /// </summary>
  86. /// <param name="dto"> 日付申请 分页 dto</param>
  87. /// <returns></returns>
  88. [HttpPost]
  89. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  90. public async Task<IActionResult> PostPageSearchDailyPaymentList(PageDailyFeePaymentDto dto)
  91. {
  92. var result = await _daiRep.GetPageSearchAll(dto);
  93. if (result == null || result.Code != 0)
  94. {
  95. return Ok(JsonView(false, result.Msg));
  96. }
  97. var data = result.Data;
  98. if (data == null)
  99. {
  100. return Ok(JsonView(false, result.Msg));
  101. }
  102. return Ok(JsonView(data));
  103. }
  104. /// <summary>
  105. /// 日付申请 Single Search By Id
  106. /// </summary>
  107. /// <param name="dto"></param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  111. public async Task<IActionResult> PostSearchDailyPaymentInfo(SearchDailyFeePaymentDto dto)
  112. {
  113. var result = await _daiRep.GetSearchById(dto);
  114. if (result == null || result.Code != 0)
  115. {
  116. return Ok(JsonView(false, result.Msg));
  117. }
  118. return Ok(JsonView(result.Data));
  119. }
  120. /// <summary>
  121. /// 日付申请 添加
  122. /// </summary>
  123. /// <param name="dto"> 日付申请 添加 dto</param>
  124. /// <returns></returns>
  125. [HttpPost]
  126. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  127. public async Task<IActionResult> PostAddDailyPayment(AddDailyFeePaymentDto dto)
  128. {
  129. var result = await _daiRep.Add(dto);
  130. if (result == null || result.Code != 0)
  131. {
  132. return Ok(JsonView(false, result.Msg));
  133. }
  134. return Ok(JsonView(true));
  135. }
  136. /// <summary>
  137. /// 日付申请 Update
  138. /// </summary>
  139. /// <param name="dto"> 日付申请 修改 dto</param>
  140. /// <returns></returns>
  141. [HttpPost]
  142. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  143. public async Task<IActionResult> PostEditDailyPayment(EditDailyFeePaymentDto dto)
  144. {
  145. var result = await _daiRep.Edit(dto);
  146. if (result == null || result.Code != 0)
  147. {
  148. return Ok(JsonView(false, result.Msg));
  149. }
  150. return Ok(JsonView(true));
  151. }
  152. /// <summary>
  153. /// 日付申请 Del
  154. /// </summary>
  155. /// <param name="dto"> 日付申请 删除 dto</param>
  156. /// <returns></returns>
  157. [HttpPost]
  158. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  159. public async Task<IActionResult> PostDelDailyPayment(DelDailyFeePaymentDto dto)
  160. {
  161. var result = await _daiRep.Del(dto);
  162. if (result == null || result.Code != 0)
  163. {
  164. return Ok(JsonView(false, result.Msg));
  165. }
  166. return Ok(JsonView(true));
  167. }
  168. /// <summary>
  169. /// 日付申请 财务审核
  170. /// </summary>
  171. /// <param name="dto"> dto </param>
  172. /// <returns></returns>
  173. [HttpPost]
  174. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  175. public async Task<IActionResult> PostDelDailyPaymentAudit(DP_AuditStatusDto dto)
  176. {
  177. var result = await _daiRep.DelDailyPaymentAudit(dto);
  178. if (result == null || result.Code != 0)
  179. {
  180. return Ok(JsonView(false, result.Msg));
  181. }
  182. return Ok(JsonView(true));
  183. }
  184. /// <summary>
  185. /// 日付申请 Single Excel Download
  186. /// </summary>
  187. /// <param name="dto"> dto </param>
  188. /// <returns></returns>
  189. [HttpPost]
  190. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  191. public async Task<IActionResult> PostExcelDailyPaymentDownload(SearchDailyFeePaymentDto dto)
  192. {
  193. if (dto.PortType == 1 || dto.PortType == 2)
  194. {
  195. Fin_DailyFeePaymentInfolView feeData = new Fin_DailyFeePaymentInfolView();
  196. string feeSql = string.Format(@"Select * From Fin_DailyFeePayment
  197. Where IsDel=0 And Id = {0} ", dto.Id);
  198. feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfolView>(feeSql).FirstAsync();
  199. if (feeData == null)
  200. {
  201. return Ok(JsonView(false, "暂无数据!"));
  202. }
  203. string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent
  204. Where IsDel=0 And DFPId = {0} ", dto.Id);
  205. feeData.FeeContents = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToListAsync();
  206. if (feeData != null)
  207. {
  208. string userName = string.Empty;
  209. string userSql = string.Format("Select * From Sys_Users Where Id={0} And Isdel = {1}", feeData.CreateUserId, 0);
  210. Sys_Users user = await _sqlSugar.SqlQueryable<Sys_Users>(userSql).FirstAsync();
  211. if (user != null) { userName = user.CnName; }
  212. var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
  213. //48人员费用 49办公费用 50 销售费用 51 其他费用 55 大运会
  214. var priceSubTypeData = setData.Where(s => s.STid == 55).ToList();
  215. Dictionary<string, object> pairs = new Dictionary<string, object>();
  216. List<DataTable> datas = new List<DataTable>();
  217. //if (priceSubTypeData.Where(s => s.Id == feeData.PriceTypeId).ToList().Count() > 0)//大运会专属模板
  218. //{
  219. // //AsposeHelper.ExpertExcelToModel("日常费用付款申请模板-大运会数据.xls", "DailyPayment", "大运会所有日常费用付款申请.xls",
  220. // // pairs, datas);
  221. //}
  222. //else //日付常规模板
  223. //{
  224. pairs.Clear();
  225. pairs.Add("Opertor", userName);
  226. pairs.Add("DateTime", feeData.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  227. pairs.Add("FAuditStatus", feeData.FAuditDesc);
  228. pairs.Add("MAuditStatus", feeData.MAuditDesc);
  229. pairs.Add("SumPrice", feeData.SumPrice);
  230. DataTable data = AsposeHelper.ListToDataTable("DailyFeePayment", feeData.FeeContents);
  231. datas.Clear();
  232. datas.Add(data);
  233. string fileName = string.Format("{0}-日常费用付款申请.xlsx", feeData.Instructions);
  234. string msg = AsposeHelper.ExpertExcelToModel("日常费用付款申请模板.xlsx", "DailyPayment", fileName, pairs, datas);
  235. return Ok(JsonView(true, msg));
  236. //}
  237. }
  238. else
  239. {
  240. return Ok(JsonView(false, "暂无数据!"));
  241. }
  242. }
  243. return Ok(JsonView(true));
  244. }
  245. #endregion
  246. #region 团组提成
  247. /// <summary>
  248. /// 提成 Page Search
  249. /// </summary>
  250. /// <param name="dto"> 提成 分页 dto</param>
  251. /// <returns></returns>
  252. [HttpPost]
  253. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  254. public async Task<IActionResult> PostPageSearchCommissionList(GroupCommissionDto dto)
  255. {
  256. var data = await GroupCommission.GetCommissionPageList(dto);
  257. return Ok(JsonView(data.Data));
  258. }
  259. #endregion
  260. #region 团组汇率
  261. /// <summary>
  262. /// 团组汇率 Select数据源(团组列,汇率列)
  263. /// </summary>
  264. /// <param name="dto"></param>
  265. /// <returns></returns>
  266. [HttpPost]
  267. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  268. public async Task<IActionResult> GetGroupRateDataSources(TeamRateDto dto)
  269. {
  270. try
  271. {
  272. Result teamRateData = await _teamRateRep.GetGroupRateDataSource(dto);
  273. if (teamRateData.Code != 0)
  274. {
  275. return Ok(JsonView(false, teamRateData.Msg));
  276. }
  277. return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
  278. }
  279. catch (Exception ex)
  280. {
  281. return Ok(JsonView(false, ex.Message));
  282. throw;
  283. }
  284. }
  285. ///// <summary>
  286. ///// 团组汇率 changge
  287. ///// </summary>
  288. ///// <returns></returns>
  289. //[HttpPost]
  290. //[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  291. //public async Task<IActionResult> ChangeGroupRateInfo()
  292. //{
  293. // try
  294. // {
  295. // Result teamRateData = await _teamRateRep.GetGroupRateChangeData();
  296. // if (teamRateData.Code != 0)
  297. // {
  298. // return Ok(JsonView(false, teamRateData.Msg));
  299. // }
  300. // return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
  301. // }
  302. // catch (Exception ex)
  303. // {
  304. // return Ok(JsonView(false, ex.Message));
  305. // throw;
  306. // }
  307. //}
  308. /// <summary>
  309. /// 团组汇率 Select汇率详情
  310. /// </summary>
  311. /// <param name="dto"></param>
  312. /// <returns></returns>
  313. [HttpPost]
  314. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  315. public async Task<IActionResult> GetGroupRateInfo(TeamRateInfoDto dto)
  316. {
  317. try
  318. {
  319. Result teamRateData = await _teamRateRep.GetGroupRateInfoByDiid(dto);
  320. if (teamRateData.Code != 0)
  321. {
  322. return Ok(JsonView(false, teamRateData.Msg));
  323. }
  324. return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
  325. }
  326. catch (Exception ex)
  327. {
  328. return Ok(JsonView(false, ex.Message));
  329. throw;
  330. }
  331. }
  332. /// <summary>
  333. /// 团组汇率 添加 or 更新
  334. /// </summary>
  335. /// <param name="dto"></param>
  336. /// <returns></returns>
  337. [HttpPost]
  338. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  339. public async Task<IActionResult> PostGroupRateUpdate(TeamRateUpdateDto dto)
  340. {
  341. try
  342. {
  343. Result teamRateData = await _teamRateRep.PostGroupRateUpdate(dto);
  344. if (teamRateData.Code != 0)
  345. {
  346. return Ok(JsonView(false, teamRateData.Msg));
  347. }
  348. return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
  349. }
  350. catch (Exception ex)
  351. {
  352. return Ok(JsonView(false, ex.Message));
  353. throw;
  354. }
  355. }
  356. #endregion
  357. #region 对外收款账单 关联已收款项
  358. /// <summary>
  359. /// 对外收款账单 Select数据源(团组名,币种,汇款方式)
  360. /// 关联已收款项
  361. /// </summary>
  362. /// <param name="dto"></param>
  363. /// <returns></returns>
  364. [HttpPost]
  365. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  366. public async Task<IActionResult> GetForeignReceivablesDataSources()
  367. {
  368. try
  369. {
  370. Result ffrData = await _ForForeignReceivablesRep.GetDataSource();
  371. if (ffrData.Code != 0)
  372. {
  373. return Ok(JsonView(false, ffrData.Msg));
  374. }
  375. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  376. }
  377. catch (Exception ex)
  378. {
  379. return Ok(JsonView(false, ex.Message));
  380. throw;
  381. }
  382. }
  383. /// <summary>
  384. /// 对外收款账单
  385. /// 账单详情
  386. /// 关联已收款项
  387. /// </summary>
  388. /// <param name="dto"></param>
  389. /// <returns></returns>
  390. [HttpPost]
  391. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  392. public async Task<IActionResult> GetGroupReceivablesInfoByDiId(ForForeignReceivablesInfoDto dto)
  393. {
  394. try
  395. {
  396. Result ffrData = await _ForForeignReceivablesRep.GetGroupReceivablesInfoByDiId(dto);
  397. if (ffrData.Code != 0)
  398. {
  399. return Ok(JsonView(false, ffrData.Msg));
  400. }
  401. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  402. }
  403. catch (Exception ex)
  404. {
  405. return Ok(JsonView(false, ex.Message));
  406. throw;
  407. }
  408. }
  409. /// <summary>
  410. /// 对外收款账单
  411. /// 账单 删除
  412. /// 关联已收款项
  413. /// </summary>
  414. /// <param name="dto"></param>
  415. /// <returns></returns>
  416. [HttpPost]
  417. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  418. public async Task<IActionResult> PostGroupReceivablesDel(DelForForeignReceivablesInfoDto dto)
  419. {
  420. try
  421. {
  422. Result ffrData = await _ForForeignReceivablesRep._Del(dto);
  423. if (ffrData.Code != 0)
  424. {
  425. return Ok(JsonView(false, ffrData.Msg));
  426. }
  427. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  428. }
  429. catch (Exception ex)
  430. {
  431. return Ok(JsonView(false, ex.Message));
  432. throw;
  433. }
  434. }
  435. /// <summary>
  436. /// 对外收款账单
  437. /// 添加 And 更新
  438. /// 关联已收款项
  439. /// </summary>
  440. /// <param name="dto"></param>
  441. /// <returns></returns>
  442. [HttpPost]
  443. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  444. public async Task<IActionResult> PostReceivablesOperate(ForeignReceivablesAddAndUpdateDto dto)
  445. {
  446. try
  447. {
  448. Result ffrData = await _ForForeignReceivablesRep.PostReceivablesOperate(dto);
  449. if (ffrData.Code != 0)
  450. {
  451. return Ok(JsonView(false, ffrData.Msg));
  452. }
  453. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  454. }
  455. catch (Exception ex)
  456. {
  457. return Ok(JsonView(false, ex.Message));
  458. throw;
  459. }
  460. }
  461. /// <summary>
  462. /// 已收款项
  463. /// 账单 删除
  464. /// 关联已收款项
  465. /// </summary>
  466. /// <param name="dto"></param>
  467. /// <returns></returns>
  468. [HttpPost]
  469. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  470. public async Task<IActionResult> PostAmountReceivedDel(ProceedsReceivedDelDto dto)
  471. {
  472. try
  473. {
  474. Result ffrData = await _proceedsReceivedRep._Del(dto);
  475. if (ffrData.Code != 0)
  476. {
  477. return Ok(JsonView(false, ffrData.Msg));
  478. }
  479. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  480. }
  481. catch (Exception ex)
  482. {
  483. return Ok(JsonView(false, ex.Message));
  484. throw;
  485. }
  486. }
  487. /// <summary>
  488. /// 已收款项
  489. /// 添加 And 更新
  490. /// 关联已收款项
  491. /// </summary>
  492. /// <param name="dto"></param>
  493. /// <returns></returns>
  494. [HttpPost]
  495. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  496. public async Task<IActionResult> PostAmountReceivedOperate(ProceedsReceivedDto dto)
  497. {
  498. try
  499. {
  500. Result ffrData = await _proceedsReceivedRep.PostAmountReceivedOperate(dto);
  501. if (ffrData.Code != 0)
  502. {
  503. return Ok(JsonView(false, ffrData.Msg));
  504. }
  505. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  506. }
  507. catch (Exception ex)
  508. {
  509. return Ok(JsonView(false, ex.Message));
  510. throw;
  511. }
  512. }
  513. /// <summary>
  514. /// 财务 已收款项
  515. /// 分配已收款项至 应收项下
  516. /// 关联已收款项
  517. /// </summary>
  518. /// <param name="dto"></param>
  519. /// <returns></returns>
  520. [HttpPost]
  521. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  522. public async Task<IActionResult> PostAllocateAmountReceived(AllocateAmountReceivedDto dto)
  523. {
  524. try
  525. {
  526. Result ffrData = await _proceedsReceivedRep.PostAllocateAmountReceived(dto);
  527. if (ffrData.Code != 0)
  528. {
  529. return Ok(JsonView(false, ffrData.Msg));
  530. }
  531. return Ok(JsonView(true));
  532. }
  533. catch (Exception ex)
  534. {
  535. return Ok(JsonView(false, ex.Message));
  536. throw;
  537. }
  538. }
  539. ///// <summary>
  540. ///// 财务 收款账单
  541. ///// 导出Word(北京,四川)
  542. ///// </summary>
  543. ///// <param name="dto"></param>
  544. ///// <returns></returns>
  545. //[HttpPost]
  546. //[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  547. //public async Task<IActionResult> PostAccountReceivableWordExport(AccountReceivableWordExportDto dto)
  548. //{
  549. // try
  550. // {
  551. // //模板处理
  552. // string typeName = string.Empty;
  553. // if (dto.TemplateType == 1) //四川
  554. // {
  555. // typeName = "四川";
  556. // }
  557. // else if (dto.TemplateType == 2) //北京
  558. // {
  559. // typeName = "北京";
  560. // }
  561. // else return Ok(JsonView(false,"请选择正确的模板类型!"));
  562. // string wordTempName = string.Format("收款账单({0})模板.doc", typeName);
  563. // }
  564. // catch (Exception ex)
  565. // {
  566. // return Ok(JsonView(false, ex.Message));
  567. // }
  568. //}
  569. #endregion
  570. #region 对外收款账单
  571. /// <summary>
  572. /// 对外收款账单
  573. /// 数据源
  574. /// </summary>
  575. /// <param name="dto"></param>
  576. /// <returns></returns>
  577. [HttpPost]
  578. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  579. public async Task<IActionResult> PostGroupReceivablesDataSource()
  580. {
  581. try
  582. {
  583. Result ffrData = await _ForForeignReceivablesRep.PostDataSource();
  584. if (ffrData.Code != 0)
  585. {
  586. return Ok(JsonView(false, ffrData.Msg));
  587. }
  588. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  589. }
  590. catch (Exception ex)
  591. {
  592. return Ok(JsonView(false, ex.Message));
  593. throw;
  594. }
  595. }
  596. /// <summary>
  597. /// 对外收款账单
  598. /// 账单详情
  599. /// </summary>
  600. /// <param name="dto"></param>
  601. /// <returns></returns>
  602. [HttpPost]
  603. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  604. public async Task<IActionResult> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
  605. {
  606. try
  607. {
  608. Result ffrData = await _ForForeignReceivablesRep.PostGroupReceivablesInfoByDiId(dto);
  609. if (ffrData.Code != 0)
  610. {
  611. return Ok(JsonView(false, ffrData.Msg));
  612. }
  613. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  614. }
  615. catch (Exception ex)
  616. {
  617. return Ok(JsonView(false, ex.Message));
  618. throw;
  619. }
  620. }
  621. /// <summary>
  622. /// 对外收款账单
  623. /// 添加 And 更新
  624. /// </summary>
  625. /// <param name="dto"></param>
  626. /// <returns></returns>
  627. [HttpPost]
  628. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  629. public async Task<IActionResult> PostReceivablesSave(ForeignReceivablesSaveDto dto)
  630. {
  631. try
  632. {
  633. Result ffrData = await _ForForeignReceivablesRep.PostReceivablesSave(dto);
  634. if (ffrData.Code != 0)
  635. {
  636. return Ok(JsonView(false, ffrData.Msg));
  637. }
  638. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  639. }
  640. catch (Exception ex)
  641. {
  642. return Ok(JsonView(false, ex.Message));
  643. throw;
  644. }
  645. }
  646. /// <summary>
  647. /// 已收账单
  648. /// 删除
  649. /// </summary>
  650. /// <param name="dto"></param>
  651. /// <returns></returns>
  652. [HttpPost]
  653. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  654. public async Task<IActionResult> PostReceivablesDel(ForeignReceivablesDelDto dto)
  655. {
  656. try
  657. {
  658. Result ffrData = await _ForForeignReceivablesRep.PostReceivablesDel(dto);
  659. if (ffrData.Code != 0)
  660. {
  661. return Ok(JsonView(false, ffrData.Msg));
  662. }
  663. return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
  664. }
  665. catch (Exception ex)
  666. {
  667. return Ok(JsonView(false, ex.Message));
  668. throw;
  669. }
  670. }
  671. #endregion
  672. #region 已收款项
  673. /// <summary>
  674. /// 已收款项
  675. /// 查询
  676. /// </summary>
  677. /// <param name="dto"></param>
  678. /// <returns></returns>
  679. [HttpPost]
  680. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  681. public async Task<IActionResult> PostAmountReceived(AmountReceivedDto dto)
  682. {
  683. try
  684. {
  685. if (dto == null)
  686. {
  687. return Ok(JsonView(false, "参数不能为空!"));
  688. }
  689. Result ffrData = await _proceedsReceivedRep.PostAmountReceived(dto.DiId );
  690. dynamic data = null;
  691. if (dto.PortType == 1)
  692. {
  693. if (ffrData.Code != 0)
  694. {
  695. return Ok(JsonView(false, ffrData.Msg));
  696. }
  697. data= ffrData.Data;
  698. }
  699. else if(dto.PortType == 2)
  700. {
  701. if (ffrData.Code != 0)
  702. {
  703. return Ok(JsonView(false, ffrData.Msg));
  704. }
  705. data = ffrData.Data;
  706. }
  707. else if (dto.PortType == 2)
  708. {
  709. if (ffrData.Code != 0)
  710. {
  711. return Ok(JsonView(false, ffrData.Msg));
  712. }
  713. data = ffrData.Data;
  714. }
  715. else
  716. {
  717. return Ok(JsonView(false, "请选择正确的端口号!"));
  718. }
  719. return Ok(JsonView(true,"操作成功!", data));
  720. }
  721. catch (Exception ex)
  722. {
  723. return Ok(JsonView(false, ex.Message));
  724. }
  725. }
  726. /// <summary>
  727. /// 已收款项
  728. /// Add Or Edit
  729. /// </summary>
  730. /// <param name="dto"></param>
  731. /// <returns></returns>
  732. [HttpPost]
  733. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  734. public async Task<IActionResult> PostAmountReceivedAddOrEdit(AmountReceivedAddOrEditDto dto)
  735. {
  736. try
  737. {
  738. if (dto == null)
  739. {
  740. return Ok(JsonView(false, "参数不能为空!"));
  741. }
  742. Result ffrData = await _proceedsReceivedRep.PostAmountReceivedAddOrEditDto(dto);
  743. if (dto.PortType == 1)
  744. {
  745. if (ffrData.Code != 0)
  746. {
  747. return Ok(JsonView(false, ffrData.Msg));
  748. }
  749. }
  750. else if (dto.PortType == 2)
  751. {
  752. if (ffrData.Code != 0)
  753. {
  754. return Ok(JsonView(false, ffrData.Msg));
  755. }
  756. }
  757. else if (dto.PortType == 2)
  758. {
  759. if (ffrData.Code != 0)
  760. {
  761. return Ok(JsonView(false, ffrData.Msg));
  762. }
  763. }
  764. else
  765. {
  766. return Ok(JsonView(false, "请选择正确的端口号!"));
  767. }
  768. return Ok(JsonView(true, "操作成功!"));
  769. }
  770. catch (Exception ex)
  771. {
  772. return Ok(JsonView(false, ex.Message));
  773. }
  774. }
  775. /// <summary>
  776. /// 已收款项
  777. /// Del
  778. /// </summary>
  779. /// <param name="dto"></param>
  780. /// <returns></returns>
  781. [HttpPost]
  782. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  783. public async Task<IActionResult> PostAmountReceived_Del(AmountReceivedDelDto dto)
  784. {
  785. try
  786. {
  787. if (dto == null)
  788. {
  789. return Ok(JsonView(false, "参数不能为空!"));
  790. }
  791. Result ffrData = await _proceedsReceivedRep.PostAmountReceivedDel(dto);
  792. if (ffrData.Code != 0)
  793. {
  794. return Ok(JsonView(false, ffrData.Msg));
  795. }
  796. return Ok(JsonView(true, "操作成功!"));
  797. }
  798. catch (Exception ex)
  799. {
  800. return Ok(JsonView(false, ex.Message));
  801. }
  802. }
  803. #endregion
  804. #region 收款退还与其他款项
  805. /// <summary>
  806. /// 收款退还与其他款项
  807. /// 查询 根据团组Id
  808. /// </summary>
  809. /// <param name="dto"></param>
  810. /// <returns></returns>
  811. [HttpPost]
  812. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  813. public async Task<IActionResult> PostPaymentRefundAndOtherMoneyItemByDiId(PaymentRefundAndOtherMoneyItemByDiIdDto dto)
  814. {
  815. try
  816. {
  817. if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
  818. if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
  819. if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
  820. #region 页面功能权限处理
  821. PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
  822. pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
  823. if (pageFunAuth.CheckAuth == 0)
  824. {
  825. return Ok(JsonView(false, "您没有当前页面查询权限!"));
  826. }
  827. #endregion
  828. Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
  829. if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //1 Web 2 Android 3 Ios
  830. {
  831. if (_result.Code != 0)
  832. {
  833. return Ok(JsonView(false, _result.Msg));
  834. }
  835. var data = new
  836. {
  837. PageFuncAuth = pageFunAuth,
  838. Data = _result.Data
  839. };
  840. return Ok(JsonView(true, "操作成功!", data));
  841. }
  842. else
  843. {
  844. return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
  845. }
  846. }
  847. catch (Exception ex)
  848. {
  849. return Ok(JsonView(false, ex.Message));
  850. }
  851. }
  852. /// <summary>
  853. /// 收款退还与其他款项
  854. /// 删除
  855. /// </summary>
  856. /// <param name="dto"></param>
  857. /// <returns></returns>
  858. [HttpPost]
  859. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  860. public async Task<IActionResult> PostPaymentRefundAndOtherMoneyDel(PaymentRefundAndOtherMoneyDelDto dto)
  861. {
  862. try
  863. {
  864. if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
  865. if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
  866. if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
  867. PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
  868. #region 页面功能权限处理
  869. pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
  870. #endregion
  871. if (pageFunAuth.DeleteAuth == 0)
  872. {
  873. return Ok(JsonView(false, "您没有当前页面删除权限!"));
  874. }
  875. Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
  876. if (_result.Code != 0)
  877. {
  878. return Ok(JsonView(false, _result.Msg));
  879. }
  880. return Ok(JsonView(true, "操作成功!"));
  881. }
  882. catch (Exception ex)
  883. {
  884. return Ok(JsonView(false, ex.Message));
  885. }
  886. }
  887. /// <summary>
  888. /// 收款退还与其他款项
  889. /// Info Data Source
  890. /// </summary>
  891. /// <param name="dto"></param>
  892. /// <returns></returns>
  893. [HttpPost]
  894. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  895. public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfoDataSource(PortDtoBase dto)
  896. {
  897. try
  898. {
  899. Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
  900. if (_result.Code != 0)
  901. {
  902. return Ok(JsonView(false, _result.Msg));
  903. }
  904. return Ok(JsonView(true, "查询成功!", _result.Data));
  905. }
  906. catch (Exception ex)
  907. {
  908. return Ok(JsonView(false, ex.Message));
  909. }
  910. }
  911. /// <summary>
  912. /// 收款退还与其他款项
  913. /// Info
  914. /// </summary>
  915. /// <param name="dto"></param>
  916. /// <returns></returns>
  917. [HttpPost]
  918. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  919. public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfo(PaymentRefundAndOtherMoneyInfoDto dto)
  920. {
  921. try
  922. {
  923. if (dto == null)
  924. {
  925. return Ok(JsonView(false, "参数不能为空!"));
  926. }
  927. Result _result = await _paymentRefundAndOtherMoneyRep._Info(dto);
  928. if (_result.Code != 0)
  929. {
  930. return Ok(JsonView(false, _result.Msg));
  931. }
  932. return Ok(JsonView(true, "查询成功!", _result.Data));
  933. }
  934. catch (Exception ex)
  935. {
  936. return Ok(JsonView(false, ex.Message));
  937. }
  938. }
  939. /// <summary>
  940. /// 收款退还与其他款项
  941. /// 操作(Add Or Edit)
  942. /// </summary>
  943. /// <param name="dto"></param>
  944. /// <returns></returns>
  945. [HttpPost]
  946. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  947. public async Task<IActionResult> PostPaymentRefundAndOtherMoneyAddOrEdit(PaymentRefundAndOtherMoneyAddOrEditDto dto)
  948. {
  949. try
  950. {
  951. if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
  952. if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
  953. if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
  954. #region 页面功能权限处理
  955. PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
  956. pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
  957. #endregion
  958. if (dto.Status == 1) //add
  959. {
  960. if (pageFunAuth.AddAuth == 0)
  961. {
  962. return Ok(JsonView(false, "您没有当前页面添加权限!"));
  963. }
  964. }
  965. else if (dto.Status == 2) //edit
  966. {
  967. if (pageFunAuth.EditAuth == 0)
  968. {
  969. return Ok(JsonView(false, "您没有当前页面编辑权限!"));
  970. }
  971. }
  972. else
  973. {
  974. return Ok(JsonView(false, "请输入正确的操作状态! 1 添加 2 修改!"));
  975. }
  976. Result _result = await _paymentRefundAndOtherMoneyRep._AddOrEdit(dto);
  977. if (_result.Code != 0)
  978. {
  979. return Ok(JsonView(false, _result.Msg));
  980. }
  981. return Ok(JsonView(true, "操作成功!"));
  982. }
  983. catch (Exception ex)
  984. {
  985. return Ok(JsonView(false, ex.Message));
  986. }
  987. }
  988. #endregion
  989. }
  990. }