BusinessController.cs 24 KB

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