BusinessController.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. using Microsoft.AspNetCore.Mvc;
  2. using NPOI.SS.Formula.Functions;
  3. using OASystem.API.OAMethodLib.ALiYun;
  4. using OASystem.API.OAMethodLib.ExcelOutput;
  5. using OASystem.Domain.Common;
  6. using OASystem.Domain.Dtos.Business;
  7. using OASystem.Domain.Dtos.Financial;
  8. using OASystem.Domain.Dtos.Groups;
  9. using OASystem.Domain.Entities.Business;
  10. using OASystem.Domain.Entities.Financial;
  11. using OASystem.Domain.Entities.Groups;
  12. using OASystem.Domain.Entities.Resource;
  13. using OASystem.Domain.ViewModels.Business;
  14. using OASystem.Domain.ViewModels.Financial;
  15. using OASystem.Domain.ViewModels.Groups;
  16. using OASystem.Infrastructure.Repositories.Business;
  17. using OASystem.Infrastructure.Repositories.Groups;
  18. using OASystem.Infrastructure.Repositories.System;
  19. using Org.BouncyCastle.Asn1.Mozilla;
  20. using StackExchange.Redis;
  21. namespace OASystem.API.Controllers
  22. {
  23. /// <summary>
  24. /// 通用业务操作
  25. /// </summary>
  26. [Route("api/[controller]/[action]")]
  27. public class BusinessController : ControllerBase
  28. {
  29. private readonly IMapper _mapper;
  30. private readonly CommonBusRepository _busRep;
  31. private readonly SetDataRepository _setDataRep;
  32. private readonly DelegationInfoRepository _groupRep;
  33. private readonly TeamRateRepository _teamRateRep;
  34. public BusinessController( IMapper mapper, CommonBusRepository busRep, SetDataRepository setDataRep, DelegationInfoRepository groupRep, TeamRateRepository teamRateRep)
  35. {
  36. _mapper = mapper;
  37. _busRep = busRep;
  38. _setDataRep = setDataRep;
  39. _groupRep = groupRep;
  40. _teamRateRep = teamRateRep;
  41. }
  42. #region 团组信息
  43. /// <summary>
  44. /// 团组信息
  45. /// 团组简略详情
  46. /// </summary>
  47. /// <param name="dto">团组info请求dto</param>
  48. /// <returns></returns>
  49. [HttpPost]
  50. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  51. public async Task<IActionResult> PostShareGroupInfo(ShareGroupInfoDto dto)
  52. {
  53. try
  54. {
  55. var groupData = await _groupRep.PostShareGroupInfo(dto);
  56. if (groupData.Code != 0)
  57. {
  58. return Ok(JsonView(false, groupData.Msg));
  59. }
  60. return Ok(JsonView(groupData.Data));
  61. }
  62. catch (Exception ex)
  63. {
  64. return Ok(JsonView(false, ex.Message));
  65. }
  66. }
  67. /// <summary>
  68. /// 团组信息 团组名称 List
  69. /// </summary>
  70. /// <param name="dto"></param>
  71. /// <returns></returns>
  72. [HttpPost]
  73. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  74. public async Task<IActionResult> GetGroupNameList(GroupNameDto dto)
  75. {
  76. var groupData = await _groupRep.GetGroupNameList(dto);
  77. if (groupData.Code != 0)
  78. {
  79. return Ok(JsonView(false, groupData.Msg));
  80. }
  81. return Ok(JsonView(groupData.Data, groupData.Data.Count));
  82. }
  83. /// <summary>
  84. /// 获取团组指向分类
  85. /// </summary>
  86. /// <param name="_dto">参数Json字符串</param>
  87. /// <returns></returns>
  88. [HttpPost]
  89. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  90. public async Task<IActionResult> PostGroupDirectionalClassificationInit()
  91. {
  92. Result result = new Result();
  93. result = await _setDataRep.GetSetDataBySTId(_setDataRep, 16); //团组指向分类
  94. if (result.Code != 0)
  95. {
  96. return Ok(JsonView(false, "获取失败!"));
  97. }
  98. List<SetDataInfoView> _view1 = JsonConvert.DeserializeObject<List<SetDataInfoView>>(JsonConvert.SerializeObject(result.Data));
  99. SetDataInfoView xc_view = new SetDataInfoView();//77 行程 //移除行程
  100. xc_view = _view1.Where(it => it.Id == 77).FirstOrDefault();
  101. if (xc_view != null) { _view1.Remove(xc_view); };
  102. List<SetDataInfoView> _view = new List<SetDataInfoView>();
  103. //_view.Insert(0, new SetDataInfoView { Id = -1, Name = "所有模块" });
  104. SetDataInfoView qz_view = new SetDataInfoView();//80 签证
  105. qz_view = _view1.Where(it => it.Id == 80).FirstOrDefault();
  106. if (qz_view != null) { _view.Insert(0, qz_view); _view1.Remove(qz_view); };
  107. SetDataInfoView jpyd_view = new SetDataInfoView();//85 机票预订
  108. jpyd_view = _view1.Where(it => it.Id == 85).FirstOrDefault();
  109. if (jpyd_view != null) { _view.Insert(1, jpyd_view); _view1.Remove(jpyd_view); };
  110. SetDataInfoView jdyd_view = new SetDataInfoView();//76 酒店预订
  111. jdyd_view = _view1.Where(it => it.Id == 76).FirstOrDefault();
  112. if (jdyd_view != null) { _view.Insert(2, jdyd_view); _view1.Remove(jdyd_view); };
  113. SetDataInfoView jdzc_view = new SetDataInfoView();//751 酒店早餐
  114. jdzc_view = _view1.Where(it => it.Id == 751).FirstOrDefault();
  115. if (jdzc_view != null) { _view.Insert(3, jdzc_view); _view1.Remove(jdzc_view); };
  116. SetDataInfoView cdy_view = new SetDataInfoView();//79 车/导游地接
  117. cdy_view = _view1.Where(it => it.Id == 79).FirstOrDefault();
  118. if (cdy_view != null) { _view.Insert(4, cdy_view); _view1.Remove(cdy_view); };
  119. SetDataInfoView yqgw_view = new SetDataInfoView();//81 邀请/公务活动
  120. yqgw_view = _view1.Where(it => it.Id == 81).FirstOrDefault();
  121. if (yqgw_view != null) { _view.Insert(5, yqgw_view); _view1.Remove(yqgw_view); };
  122. SetDataInfoView bx_view = new SetDataInfoView();//82 团组客户保险
  123. bx_view = _view1.Where(it => it.Id == 82).FirstOrDefault();
  124. if (bx_view != null) { _view.Insert(6, bx_view); _view1.Remove(bx_view); };
  125. SetDataInfoView qtkx_view = new SetDataInfoView();//98 其他款项
  126. qtkx_view = _view1.Where(it => it.Id == 98).FirstOrDefault();
  127. if (qtkx_view != null) { _view.Insert(7, qtkx_view); _view1.Remove(qtkx_view); };
  128. SetDataInfoView skth_view = new SetDataInfoView();//285 收款退还与其他款项
  129. skth_view = _view1.Where(it => it.Id == 285).FirstOrDefault();
  130. if (skth_view != null) { _view.Insert(8, skth_view); _view1.Remove(skth_view); };
  131. if (_view1.Count > 0)
  132. {
  133. _view.AddRange(_view1);
  134. }
  135. return Ok(JsonView(_view));
  136. }
  137. /// <summary>
  138. /// 查询团组简略详情列表
  139. /// Page 根据Ctable And User 返回可操作的团
  140. /// </summary>
  141. /// <param name="dto"></param>
  142. /// <returns></returns>
  143. [HttpPost]
  144. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  145. public async Task<IActionResult> PostGroupListByCTableAndUserId(GroupListByCTableAndUserIdDto dto)
  146. {
  147. if (dto.CTable < 1) Ok(JsonView(false, @"请输入正确的员工给Id!"));
  148. if (dto.CTable < 1)
  149. return Ok(JsonView(false, @"请输入正确的CTable Id !76 酒店预订 77 行程 79 车/导游地接<br/>80 签证 81 邀请/公务活动 82 团组客户保险<br\>85 机票预订 98 其他款项 751 酒店早餐"));
  150. if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)
  151. {
  152. string sql = string.Format(@"Select row_number() over(order by di.VisitStartDate Desc) as Row_Number,
  153. di.Id,di.TeamName,di.TourCode,di.ClientName,di.VisitCountry,di.VisitStartDate,
  154. di.VisitEndDate,di.VisitDays,di.VisitPNumber
  155. From Grp_GroupsTaskAssignment gta
  156. Inner Join Grp_DelegationInfo di On gta.DIId = di.Id
  157. Where gta.IsDel = 0 And di.IsDel = 0 And gta.IsEnable = 1
  158. And gta.CTId = {0} And gta.UId = {1}", dto.CTable, dto.UserId);
  159. RefAsync<int> total = 0;//REF和OUT不支持异步,想要真的异步这是最优解
  160. var data = await _groupRep._sqlSugar.SqlQueryable<GroupListByCTableAndUserIdView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, total); //ToPageAsync
  161. foreach (var item in data)
  162. {
  163. item.VisitStartDate = item.VisitStartDate == "" ? "" : Convert.ToDateTime(item.VisitStartDate).ToString("yyyy-MM-dd");
  164. item.VisitEndDate = item.VisitEndDate == "" ? "" : Convert.ToDateTime(item.VisitEndDate).ToString("yyyy-MM-dd");
  165. }
  166. return Ok(JsonView(true, "操作成功!", data, total));
  167. }
  168. else
  169. {
  170. return Ok(JsonView(false, @"请输入正确的PortType 1 Web 2 Android 3 IOS "));
  171. }
  172. }
  173. #endregion
  174. #region 币种 List
  175. /// <summary>
  176. /// 币种 List
  177. /// </summary>
  178. /// <returns></returns>
  179. [HttpGet,HttpPost]
  180. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  181. public async Task<IActionResult> PostCurrencyList()
  182. {
  183. try
  184. {
  185. Result setData = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); //币种类型
  186. if (setData.Code == 0)
  187. {
  188. return Ok(JsonView(true, "查询成功", setData.Data));
  189. }
  190. else
  191. {
  192. return Ok(JsonView(false, setData.Msg));
  193. }
  194. }
  195. catch (Exception)
  196. {
  197. return Ok(JsonView(false, "程序错误!"));
  198. throw;
  199. }
  200. }
  201. /// <summary>
  202. /// 团组汇率 币种 Item (来源:团组汇率)
  203. /// 根据 团组Id And 业务类型(CTable)Id
  204. /// api处理CTable = 285,默认返回CNY
  205. /// </summary>
  206. /// <param name="dto"> 请求参数Dto </param>
  207. /// <returns></returns>
  208. [HttpPost]
  209. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  210. public async Task<IActionResult> PostGroupTeamRateByDiIdAndCTableId(GeneralTeamRateInfoDto dto)
  211. {
  212. try
  213. {
  214. if (dto == null)
  215. {
  216. return Ok(JsonView(false, "请输入参数!"));
  217. }
  218. if (dto.DiId == 0)
  219. {
  220. return Ok(JsonView(false, "请输入正确的团组Id!"));
  221. }
  222. if (dto.CTable == 0)
  223. {
  224. return Ok(JsonView(false, "请输入正确的业务类型(CTable)Id!"));
  225. }
  226. if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3 )
  227. {
  228. string teamRateInfoSql = string.Format(@"Select sd.Name,tr.* From Grp_TeamRate tr
  229. Left Join Sys_SetData sd On sd.IsDel=0 And sd.STid=16 And tr.CTable = sd.Id
  230. Where tr.IsDel = 0 And tr.DiId = {0} And tr.CTable = {1}", dto.DiId,dto.CTable);
  231. var teamRateInfo = await _teamRateRep._sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
  232. #region 团组汇率
  233. TeamRateModelGeneralView teamRateModels = new TeamRateModelGeneralView();
  234. #region 单独处理Ctable 币种汇率 默认 为CNY
  235. if (dto.CTable == 285)
  236. {
  237. teamRateModels = new TeamRateModelGeneralView()
  238. {
  239. Id = 0,
  240. CTableId = 285,
  241. CTableName = "其他款项与收款退还",
  242. TeamRates = new List<TeamRateDescAddCurrencyIdView>() {
  243. new TeamRateDescAddCurrencyIdView()
  244. {
  245. CurrencyId = 836,
  246. CurrencyCode = "CNY",
  247. CurrencyName = "人民币",
  248. Rate = 1.0000M,
  249. }
  250. }
  251. };
  252. return Ok(JsonView(true, "操作成功!", teamRateModels));
  253. }
  254. #endregion
  255. List<SetDataInfoView> currencyDatas = new List<SetDataInfoView>();
  256. #region 获取所有币种
  257. string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0", 66);
  258. var DBdata = await _setDataRep.GetListBySqlWithNolockAsync(sql);
  259. if (DBdata == null || DBdata.Count == 0)
  260. {
  261. return Ok(JsonView(false, "所有币种获取失败!"));
  262. }
  263. currencyDatas = DBdata.Select(x => new SetDataInfoView
  264. {
  265. Name = x.Name,
  266. Id = x.Id,
  267. Remark = x.Remark,
  268. }).ToList();
  269. #endregion
  270. foreach (TeamRateInfoView item in teamRateInfo)
  271. {
  272. TeamRateModelGeneralView teamRateModelInfo = new TeamRateModelGeneralView();
  273. teamRateModelInfo.Id = item.Id;
  274. teamRateModelInfo.CTableId = item.CTable;
  275. teamRateModelInfo.CTableName = item.Name;
  276. List<TeamRateDescAddCurrencyIdView> teamRateDescViews = new List<TeamRateDescAddCurrencyIdView>();
  277. #region 拆分remark里的汇率
  278. if (item.Remark.Contains("|"))
  279. {
  280. string[] currencyArr = item.Remark.Split("|");
  281. foreach (string currency in currencyArr)
  282. {
  283. string[] currency1 = currency.Split(":");
  284. string[] currency2 = currency1[0].Split("(");
  285. string currencyCode = currency2[1].Replace(")", "").TrimEnd();
  286. SetDataInfoView dataInfoView = new SetDataInfoView();
  287. dataInfoView = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault();
  288. int currencyId = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault().Id;
  289. TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
  290. {
  291. CurrencyId = dataInfoView.Id,
  292. CurrencyCode = currencyCode,
  293. CurrencyName = currency2[0],
  294. Rate = decimal.Parse(currency1[1]),
  295. };
  296. teamRateDescViews.Add(rateDescView);
  297. }
  298. }
  299. #endregion
  300. if (teamRateDescViews.Count > 0)
  301. {
  302. teamRateDescViews = teamRateDescViews.OrderBy(it => it.CurrencyId).ToList();
  303. }
  304. teamRateModelInfo.TeamRates = teamRateDescViews;
  305. teamRateModels = teamRateModelInfo;
  306. }
  307. #endregion
  308. return Ok(JsonView(true, "操作成功!", teamRateModels));
  309. }
  310. else
  311. {
  312. return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
  313. }
  314. }
  315. catch (Exception ex)
  316. {
  317. return Ok(JsonView(false, ex.Message));
  318. }
  319. }
  320. /// <summary>
  321. /// 根据团组Id币种Id及类型Id查询团组汇率
  322. /// </summary>
  323. /// <param name="dto"></param>
  324. /// <returns></returns>
  325. [HttpGet, HttpPost]
  326. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  327. public async Task<IActionResult> PostCurrencyByDiid(int DiId,int CId,int CurrencyId)
  328. {
  329. try
  330. {
  331. Result setData = await _setDataRep.PostCurrencyByDiid( DiId, CId, CurrencyId); //币种类型
  332. if (setData.Code == 0)
  333. {
  334. return Ok(JsonView(true, "查询成功", setData.Data));
  335. }
  336. else
  337. {
  338. return Ok(JsonView(false, setData.Msg));
  339. }
  340. }
  341. catch (Exception)
  342. {
  343. return Ok(JsonView(false, "程序错误!"));
  344. throw;
  345. }
  346. }
  347. #endregion
  348. #region 查询页面关联Ctable
  349. /// <summary>
  350. /// 页面关联Ctable
  351. /// 根据PageId 返回 CTable Id
  352. /// </summary>
  353. /// <param name="dto"></param>
  354. /// <returns></returns>
  355. [HttpPost]
  356. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  357. public async Task<IActionResult> PostPageLinkCTable(PageLinkCTableDto dto)
  358. {
  359. try
  360. {
  361. if (dto == null)
  362. {
  363. return Ok(JsonView(false, "请求参数不能为空!"));
  364. }
  365. if (dto.PageId == 0)
  366. {
  367. return Ok(JsonView(false, "页面Id不能为0!"));
  368. }
  369. List<CTableCorrelationPageDatas> data = AppSettingsHelper.Get<CTableCorrelationPageDatas>("CTableCorrelationPageDatas");
  370. CTableCorrelationPageDatas correlationPageDatas = new CTableCorrelationPageDatas();
  371. foreach (var item in data)
  372. {
  373. if (item.PageIdDatas != null)
  374. {
  375. var pageId = item.PageIdDatas.Where(it => it == dto.PageId).FirstOrDefault();
  376. if (pageId != 0)
  377. {
  378. correlationPageDatas = item;
  379. break;
  380. }
  381. }
  382. }
  383. if (correlationPageDatas.CTableId == 0)
  384. {
  385. return Ok(JsonView(false, "您查询的页面Id,未配置AppSettings,请前往配置!"));
  386. }
  387. return Ok(JsonView(true, "操作成功",new { CTable = correlationPageDatas.CTableId }));
  388. }
  389. catch (Exception ex)
  390. {
  391. return Ok(JsonView(false, ex.Message));
  392. }
  393. }
  394. #endregion
  395. #region 会务物料单
  396. /// <summary>
  397. /// 获取会务活动列表
  398. /// </summary>
  399. /// <param name="paras"></param>
  400. /// <returns></returns>
  401. [HttpPost]
  402. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  403. public async Task<IActionResult> PostConferenceList()
  404. {
  405. List<Grp_DelegationInfo> listSource = _busRep.Query<Grp_DelegationInfo>(s => s.TeamDid == 691 && s.IsDel == 0).ToList();
  406. List<GroupNameView> viewList = new List<GroupNameView>();
  407. foreach (var group in listSource)
  408. {
  409. GroupNameView _view = new GroupNameView();
  410. _view.Id = group.Id;
  411. _view.GroupName = group.TeamName;
  412. }
  413. return Ok(JsonView(viewList));
  414. }
  415. /// <summary>
  416. /// 获取会务的采购物品计划清单
  417. /// </summary>
  418. /// <param name="ConfId">会务活动Id</param>
  419. /// <returns></returns>
  420. [HttpPost]
  421. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  422. public async Task<IActionResult> PostConfItemList(int ConfId)
  423. {
  424. Bus_ConfItemListView view = new Bus_ConfItemListView();
  425. Bus_ConfItemListInfo _confListInfo = await _busRep.Query<Bus_ConfItemListInfo>(s => s.Diid == ConfId).FirstAsync();
  426. if (_confListInfo != null)
  427. {
  428. view.TotalCost = _confListInfo.TotalCost;
  429. string sqlItem = string.Format(@" Select c.Id,c.ItemId,d.ItemName,c.[Count],c.CurrCost,c.OpRemark
  430. From Bus_ConfItem as c With(Nolock)
  431. Inner Join Res_ItemDetail as d with(Nolock) On c.ItemId=d.Id
  432. Where c.ConfListId = {0}", ConfId);
  433. List<Bus_ConfItemView> confItemList = await _busRep._sqlSugar.SqlQueryable<Bus_ConfItemView>(sqlItem).ToListAsync();
  434. view.ItemList = new List<Bus_ConfItemView>(confItemList);
  435. }
  436. else
  437. {
  438. view.ItemList = new List<Bus_ConfItemView>();
  439. view.TotalCost = 0;
  440. }
  441. return Ok(JsonView(view));
  442. }
  443. /// <summary>
  444. /// 获取会务可采购的物料集合
  445. /// </summary>
  446. /// <returns></returns>
  447. [HttpPost]
  448. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  449. public async Task<IActionResult> PostOptionalItemList()
  450. {
  451. List<OptionalBusRangeView> result = await _busRep.GetViewList_OptionalItem();
  452. return Ok(JsonView(result));
  453. }
  454. /// <summary>
  455. /// 编辑物料采购清单
  456. /// </summary>
  457. /// <returns></returns>
  458. [HttpPost]
  459. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  460. public async Task<IActionResult> PostEditOptionalItemList(JsonDtoBase jsonDto)
  461. {
  462. if (string.IsNullOrEmpty(jsonDto.Paras))
  463. {
  464. return Ok(JsonView(false, "参数为空"));
  465. }
  466. Edit_OptionalItemListDto _dto = JsonConvert.DeserializeObject<Edit_OptionalItemListDto>(jsonDto.Paras);
  467. //Edit_OptionalItemListDto _dto = System.Text.Json.JsonSerializer.Deserialize<Edit_OptionalItemListDto>(jsonDto.Paras);
  468. if (_dto.DiId < 1)
  469. {
  470. return Ok(JsonView(false, "团组Id为空"));
  471. }
  472. if (_dto.ConfItemListId < 1)
  473. {
  474. //新增
  475. int rstInsert = await _busRep.Insert_ConfItemList(_dto);
  476. return Ok(JsonView(rstInsert == 0));
  477. }
  478. else
  479. {
  480. //修改
  481. int rstUpdate = await _busRep.Edit_ConfItemList(_dto);
  482. return Ok(JsonView(rstUpdate == 0));
  483. }
  484. return Ok(JsonView(false));
  485. }
  486. /// <summary>
  487. /// 获取会务采购物料清单Excel
  488. /// </summary>
  489. /// <returns></returns>
  490. [HttpPost]
  491. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  492. public async Task<IActionResult> Excel_ConfItemList(JsonDtoBase jsonDto)
  493. {
  494. if (string.IsNullOrEmpty(jsonDto.Paras))
  495. {
  496. return Ok(JsonView(false, "参数为空"));
  497. }
  498. dynamic confList = JsonConvert.DeserializeObject<dynamic>(jsonDto.Paras);
  499. int confListId = confList.ConfListId;
  500. Bus_ConfItemListInfo _entityConfList = await _busRep.Query<Bus_ConfItemListInfo>(s => s.Id == confListId).FirstAsync();
  501. if (_entityConfList != null)
  502. {
  503. string result = new Excel_BusConfItemList().Excel(_entityConfList);
  504. }
  505. else
  506. {
  507. return Ok(JsonView(false, "请先保存数据"));
  508. }
  509. return Ok(JsonView(false));
  510. }
  511. #endregion
  512. #region 阿里云短信测试
  513. /// <summary>
  514. /// 编辑物料采购清单
  515. /// </summary>
  516. /// <returns></returns>
  517. [HttpPost]
  518. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  519. public async Task<IActionResult> AliMessageTest(string mobile)
  520. {
  521. string add2dayZH = DateTime.Now.AddDays(2).ToString("yyyy年MM月dd日");
  522. string templateParam = JsonConvert.SerializeObject(new { teams = "测试团组", date = add2dayZH });
  523. AliMessagePost.PostMessage(mobile, "泛美国际团组", "SMS_461575447", templateParam);
  524. return Ok(JsonView(true));
  525. }
  526. #endregion
  527. }
  528. }