DelegationInfoRepository.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. using Newtonsoft.Json;
  2. using OASystem.Domain;
  3. using OASystem.Domain.Dtos;
  4. using OASystem.Domain.Dtos.Financial;
  5. using OASystem.Domain.Dtos.Groups;
  6. using OASystem.Domain.Dtos.UserDto;
  7. using OASystem.Domain.Entities.Groups;
  8. using OASystem.Domain.ViewModels.CRM;
  9. using OASystem.Domain.ViewModels.Financial;
  10. using OASystem.Domain.ViewModels.Groups;
  11. using OASystem.Infrastructure.Repositories.System;
  12. using Org.BouncyCastle.Asn1.Cms;
  13. using Org.BouncyCastle.Utilities.Collections;
  14. using Serilog;
  15. using SqlSugar;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. namespace OASystem.Infrastructure.Repositories.Groups
  22. {
  23. /// <summary>
  24. /// 接团信息
  25. /// </summary>
  26. public class DelegationInfoRepository : BaseRepository<Grp_DelegationInfo, DelegationInfoView>
  27. {
  28. private readonly SetDataRepository _setDataRepository;
  29. private readonly UsersRepository _usersRepository;
  30. private readonly TaskAssignmentRepository _taskAssignmentRep;
  31. //public readonly Logs _logs;
  32. public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository, TaskAssignmentRepository taskAssignmentRep)
  33. : base(sqlSugar)
  34. {
  35. _setDataRepository = setDataRepository;
  36. _usersRepository = usersRepository;
  37. _taskAssignmentRep = taskAssignmentRep;
  38. }
  39. #region 团组
  40. /// <summary>
  41. /// 获取接团信息 Page List
  42. /// </summary>
  43. /// <param name="dto"></param>
  44. /// <returns></returns>
  45. public async Task<Result> GetGroupPageList(GroupCommissionDto dto)
  46. {
  47. Result result = new Result() { Code = -2, Msg = "未知错误" };
  48. ListViewBase<DelegationPageListView> groupsInfoPageList = new ListViewBase<DelegationPageListView>()
  49. {
  50. ReceiveDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  51. };
  52. if (dto.PortType == 1 || dto.PortType == 2) //web
  53. {
  54. int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
  55. int endIndex = startIndex + dto.PageSize - 1;
  56. int taskUserId = -1;
  57. string taskGroupIds = string.Empty;
  58. #region 处理用户团组操作权限
  59. if (dto.UserId != -1)
  60. {
  61. }
  62. #endregion
  63. string sql = string.Format(@"Select * From(Select row_number() over (order by gdi.Id Desc) as RowNumber,
  64. gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,ssd1.Id TeamLevId,
  65. ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,VisitDate,VisitDays,VisitPNumber,
  66. su.CnName JietuanOperator,IsSure
  67. From Grp_DelegationInfo gdi
  68. Inner Join Sys_SetData ssd On gdi.TeamDid = ssd.Id
  69. Inner Join Sys_SetData ssd1 On gdi.TeamLevSId = ssd1.Id
  70. Left Join Sys_Users su On gdi.JietuanOperator = su.Id
  71. Where gdi.IsDel = 0
  72. )temp Where RowNumber Between {0} and {1}", startIndex, endIndex);
  73. string sqlCount = string.Format(@"Select Count(1) as Count From Grp_DelegationInfo gdi
  74. Inner Join Sys_SetData ssd On gdi.TeamDid = ssd.Id
  75. Inner Join Sys_SetData ssd1 On gdi.TeamLevSId = ssd1.Id
  76. Left Join Sys_Users su On gdi.JietuanOperator = su.Id
  77. Where gdi.IsDel = 0 ");
  78. List<DelegationPageListView> _DeleInfoList = await _sqlSugar.SqlQueryable<DelegationPageListView>(sql).ToListAsync();
  79. DelegationPageCountView _DeleCount = await _sqlSugar.SqlQueryable<DelegationPageCountView>(sqlCount).FirstAsync();
  80. int count = _DeleCount.Count;
  81. groupsInfoPageList = new ListViewBase<DelegationPageListView>
  82. {
  83. CurrPageIndex = dto.PageIndex,
  84. CurrPageSize = dto.PageSize,
  85. DataCount = count,
  86. DataList = _DeleInfoList
  87. };
  88. result.Code = 0;
  89. result.Msg = "成功!";
  90. result.Data = groupsInfoPageList;
  91. }
  92. return result;
  93. }
  94. /// <summary>
  95. /// 获取接团信息List
  96. /// </summary>
  97. /// <param name="dto"></param>
  98. /// <returns></returns>
  99. public async Task<Result> GetGroupList(GroupListDto dto)
  100. {
  101. Result result = new Result() { Code = -2, Msg = "未知错误" };
  102. if (dto.PortType == 1 || dto.PortType == 2) //web
  103. {
  104. string sql = string.Format(@"Select gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,ssd1.Id TeamLevId,ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,VisitDate,VisitDays,VisitPNumber,su.CnName JietuanOperator,IsSure
  105. From Grp_DelegationInfo gdi
  106. Inner Join Sys_SetData ssd On gdi.TeamDid = ssd.Id
  107. Inner Join Sys_SetData ssd1 On gdi.TeamLevSId = ssd1.Id
  108. Left Join Sys_Users su On gdi.JietuanOperator = su.Id
  109. Where gdi.IsDel = 0
  110. Order By gdi.CreateTime Desc");
  111. var _DelegationList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToListAsync();
  112. if (_DelegationList.Count > 0)
  113. {
  114. result.Code = 0;
  115. result.Msg = "成功!";
  116. result.Data = _DelegationList;
  117. }
  118. else
  119. {
  120. result.Msg = "暂无该团组信息";
  121. }
  122. }
  123. return result;
  124. }
  125. /// <summary>
  126. /// 获取接团信息Info
  127. /// </summary>
  128. /// <param name="dto"></param>
  129. /// <returns></returns>
  130. public async Task<Result> GetGroupInfo(GroupInfoDto dto)
  131. {
  132. Result result = new Result() { Code = -2, Msg = "未知错误" };
  133. if (dto.PortType == 1 || dto.PortType == 2) //Web Or Android
  134. {
  135. string sql = string.Format(@"Select Id,SalesQuoteNo,TourCode,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName,
  136. ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,
  137. PayDay,PaymentMoney,VisitPurpose,SpecialNeeds,OtherNeeds,CGRWSPBMMC,CGRWSPWH,
  138. ZZSCBMMC,ZZSCSPWH,Remark,TellPhone
  139. From Grp_DelegationInfo Where Id = {0} And IsDel = 0", dto.Id);
  140. var _DelegationInfo = await _sqlSugar.SqlQueryable<DelegationInfoWebView>(sql).FirstAsync();
  141. if (_DelegationInfo != null)
  142. {
  143. result.Code = 0;
  144. result.Msg = "成功!";
  145. result.Data = _DelegationInfo;
  146. }
  147. else result.Msg = "暂无该团组信息";
  148. }
  149. return result;
  150. }
  151. /// <summary>
  152. /// 获取接团信息 编辑
  153. /// 基础 数据源
  154. /// </summary>
  155. /// <param name="dto"></param>
  156. /// <returns></returns>
  157. public async Task<Result> GroupEditBasicSource(GroupListDto dto)
  158. {
  159. Result result = new Result() { Code = -2, Msg = "未知错误" };
  160. try
  161. {
  162. if (dto.PortType == 1 || dto.PortType == 2) //web
  163. {
  164. dynamic? teamTypeData1 = null;
  165. string teamTypeSql = string.Format(@"Select Id,Name From Sys_SetData Where STid = {0} And IsDel = {1}", 10, 0);
  166. var teamTypeData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamTypeSql).ToListAsync(); ; //团组分类 10
  167. if (teamTypeData.Count > 0)
  168. {
  169. teamTypeData1 = teamTypeData;
  170. }
  171. dynamic? teamLevData1 = null;
  172. string teamLevSql = string.Format(@"Select Id,Name From Sys_SetData Where STid = {0} And IsDel = {1}", 56, 0);
  173. var teamLevData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamLevSql).ToListAsync(); ; //团组等级 56
  174. if (teamLevData.Count > 0)
  175. {
  176. teamLevData1 = teamLevData;
  177. }
  178. dynamic? userData1 = null;
  179. string userSql = string.Format(@"Select Id,CnName From Sys_Users Where IsDel = {0}", 0);
  180. var userData = await _sqlSugar.SqlQueryable<UserNameView>(userSql).ToListAsync(); ;
  181. if (userData.Count > 0)
  182. {
  183. userData1 = userData;
  184. }
  185. result.Code = 0;
  186. result.Msg = "成功!";
  187. result.Data = new
  188. {
  189. teamTypeData = teamTypeData1,
  190. teamLevData = teamLevData1,
  191. userData = userData1
  192. };
  193. }
  194. }
  195. catch (Exception)
  196. {
  197. throw;
  198. }
  199. return result;
  200. }
  201. /// <summary>
  202. /// 团组信息操作
  203. /// </summary>
  204. /// <param name="dto"></param>
  205. /// <returns></returns>
  206. public async Task<Result> GroupOperation(GroupOperationDto dto)
  207. {
  208. Result result = new Result() { Code = -2, Msg = "未知错误" };
  209. if (dto.PortType == 1 || dto.PortType == 2) //web
  210. {
  211. if (dto.Status == 1) //添加
  212. {
  213. string selectSql = string.Format(@"Select * From Grp_DelegationInfo
  214. Where IsDel = 0
  215. And TeamName = '{0}'
  216. And ClientName = '{1}'
  217. And ClientUnit ='{2}'
  218. And VisitDate ='{3}'",dto.TeamName, dto.ClientName, dto.ClientUnit, dto.VisitDate);
  219. var selectGroupInfo = await _sqlSugar.SqlQueryable<Grp_DelegationInfo>(selectSql).FirstAsync();
  220. if (selectGroupInfo != null)
  221. {
  222. result.Msg = "数据已存在,请勿重复添加!";
  223. return result;
  224. }
  225. //string teamCodeSql = string.Format("Select SalesQuoteNo From Grp_DelegationInfo");
  226. //var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
  227. //string SalesQuoteNo = "";
  228. //while (true)
  229. //{
  230. // SalesQuoteNo = Tools.CommonFun.GetRandomStr(6);
  231. // if (!teamCodeItem.Equals(SalesQuoteNo))
  232. // {
  233. // break;
  234. // }
  235. //}
  236. Grp_DelegationInfo delegationInfo = new Grp_DelegationInfo()
  237. {
  238. SalesQuoteNo = dto.SalesQuoteNo,
  239. TeamLevSId = dto.TeamLevSId,
  240. ClientName = dto.ClientName,
  241. ClientUnit = dto.ClientUnit,
  242. TeamName = dto.TeamName,
  243. TeamDid = dto.TeamDid,
  244. VisitDate = Convert.ToDateTime(dto.VisitDate),
  245. VisitCountry = dto.VisitCountry,
  246. VisitPurpose = dto.VisitPurpose,
  247. VisitDays = dto.VisitDays,
  248. VisitPNumber = dto.VisitPNumber,
  249. SpecialNeeds = dto.SpecialNeeds,
  250. OtherNeeds = dto.OtherNeeds,
  251. Remark = dto.Remark,
  252. JietuanOperator = dto.UserId,
  253. TellPhone = dto.TellPhone,
  254. CGRWSPBMMC = dto.CGRWSPBMMC,
  255. CGRWSPWH = dto.CGRWSPWH,
  256. ZZSCBMMC = dto.ZZSCBMMC,
  257. ZZSCSPWH = dto.ZZSCSPWH,
  258. TontractTime = Convert.ToDateTime(dto.TontractTime),
  259. PaymentMoney = dto.PaymentMoney,
  260. PayDay = dto.PayDay,
  261. TourCode = "",
  262. SalesDate = DateTime.Now,
  263. IsState = 0, //默认团组未完成 0
  264. JietuanTime = DateTime.Now,
  265. IsDel = 0,
  266. BudgetCost = 0.00M,
  267. HotelComplain = 0,
  268. OPComplain = 0,
  269. OAComplain = 0,
  270. AirComplain = 0,
  271. VisaComplain = 0,
  272. CreateUserId = dto.UserId,
  273. CreateTime = DateTime.Now,
  274. DeleteUserId = null,
  275. DeleteTime = new DateTime(1990, 1, 1).ToString("yyyy-MM-dd HH:mm:ss")
  276. };
  277. Log.Information("添加:"+ JsonConvert.SerializeObject(delegationInfo));
  278. var addId = await _sqlSugar.Insertable(delegationInfo).ExecuteReturnIdentityAsync();
  279. if (addId > 0)
  280. {
  281. result.Code = 0;
  282. result.Msg = "添加成功!";
  283. }
  284. else
  285. {
  286. result.Msg = "添加失败!";
  287. }
  288. }
  289. else if (dto.Status == 2) //修改
  290. {
  291. var updateStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo
  292. {
  293. SalesQuoteNo = dto.SalesQuoteNo,
  294. TeamLevSId = dto.TeamLevSId,
  295. ClientName = dto.ClientName,
  296. ClientUnit = dto.ClientUnit,
  297. TeamName = dto.TeamName,
  298. TeamDid = dto.TeamDid,
  299. VisitDate = Convert.ToDateTime(dto.VisitDate),
  300. VisitCountry = dto.VisitCountry,
  301. VisitPurpose = dto.VisitPurpose,
  302. VisitDays = dto.VisitDays,
  303. VisitPNumber = dto.VisitPNumber,
  304. SpecialNeeds = dto.SpecialNeeds,
  305. OtherNeeds = dto.OtherNeeds,
  306. Remark = dto.Remark,
  307. JietuanOperator = dto.UserId,
  308. TellPhone = dto.TellPhone,
  309. CGRWSPBMMC = dto.CGRWSPBMMC,
  310. CGRWSPWH = dto.CGRWSPWH,
  311. ZZSCBMMC = dto.ZZSCBMMC,
  312. ZZSCSPWH = dto.ZZSCSPWH,
  313. TontractTime = Convert.ToDateTime(dto.TontractTime),
  314. PaymentMoney = dto.PaymentMoney,
  315. PayDay = dto.PayDay
  316. });
  317. if (updateStatus)
  318. {
  319. result.Code = 0;
  320. result.Msg = "修改成功!";
  321. }
  322. else
  323. {
  324. result.Msg = "修改失败!";
  325. }
  326. }
  327. else if (dto.Status == 3) //删除
  328. {
  329. var deleteStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo
  330. {
  331. DeleteUserId = dto.UserId,
  332. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
  333. IsDel = 1
  334. });
  335. if (deleteStatus)
  336. {
  337. result.Code = 0;
  338. result.Msg = "删除成功!";
  339. }
  340. else
  341. {
  342. result.Msg = "删除失败!";
  343. }
  344. }
  345. }
  346. return result;
  347. }
  348. /// <summary>
  349. /// 团组信息操作 - 删除
  350. /// </summary>
  351. /// <param name="dto"></param>
  352. /// <returns></returns>
  353. public async Task<Result> GroupDel(GroupDelDto dto)
  354. {
  355. Result result = new Result() { Code = -2, Msg = "未知错误" };
  356. if (dto.PortType == 1 || dto.PortType == 2) //web
  357. {
  358. var deleteStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo
  359. {
  360. DeleteUserId = dto.UserId,
  361. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
  362. IsDel = 1
  363. });
  364. if (deleteStatus)
  365. {
  366. result.Code = 0;
  367. result.Msg = "删除成功!";
  368. }
  369. else
  370. {
  371. result.Msg = "删除失败!";
  372. }
  373. }
  374. return result;
  375. }
  376. /// <summary>
  377. /// 获取销售报价号
  378. /// </summary>
  379. /// <returns></returns>
  380. public async Task<Result> GetGroupSalesQuoteNo()
  381. {
  382. Result result = new Result() { Code = -2, Msg = "未知错误" };
  383. string teamCodeSql = string.Format("Select SalesQuoteNo From Grp_DelegationInfo");
  384. var teamCodeItem = await _sqlSugar.SqlQueryable<SalesQuoteNoView>(teamCodeSql).ToListAsync();
  385. string teamCode = "";
  386. while (true)
  387. {
  388. teamCode = Tools.CommonFun.GetRandomAllStr(6);
  389. if (!teamCodeItem.Equals(teamCode))
  390. {
  391. break;
  392. }
  393. }
  394. result.Code = 0;
  395. result.Msg = "成功!";
  396. result.Data = teamCode;
  397. return result;
  398. }
  399. /// <summary>
  400. /// 团组删除
  401. /// </summary>
  402. /// <returns></returns>
  403. public async Task<Result> GroupDeleteById()
  404. {
  405. Result result = new Result() { Code = -2, Msg = "未知错误" };
  406. string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
  407. var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
  408. string teamCode = "";
  409. while (true)
  410. {
  411. teamCode = Tools.CommonFun.GetRandomAllStr(6);
  412. if (!teamCodeItem.Equals(teamCode))
  413. {
  414. break;
  415. }
  416. }
  417. result.Code = 0;
  418. result.Msg = "成功!";
  419. result.Data = teamCode;
  420. return result;
  421. }
  422. /// <summary>
  423. /// 团组确认出团
  424. /// </summary>
  425. /// <returns></returns>
  426. public async Task<Result> ConfirmationGroup(ConfirmationGroupDto dto)
  427. {
  428. Result result = new Result() { Code = -2, Msg = "未知错误" };
  429. string teamCode = "";
  430. if (dto.PortType == 1 || dto.PortType == 2) //web
  431. {
  432. string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
  433. var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
  434. while (true)
  435. {
  436. teamCode = Tools.CommonFun.GetRandomAllStr(6);
  437. if (!teamCodeItem.Equals(teamCode))
  438. {
  439. break;
  440. }
  441. }
  442. var deleteStatus = await UpdateAsync(a => a.Id == dto.GroupId, a => new Grp_DelegationInfo
  443. {
  444. TourCode = teamCode,
  445. GroupsOperator = dto.GroupsOperator,
  446. GroupsTime = DateTime.Now
  447. });
  448. if (deleteStatus)
  449. {
  450. result.Code = 0;
  451. result.Msg = "确认出团成功!";
  452. }
  453. else
  454. {
  455. result.Msg = "确认出团失败!";
  456. }
  457. }
  458. result.Code = 0;
  459. result.Msg = "成功!";
  460. result.Data = teamCode;
  461. return result;
  462. }
  463. /// <summary>
  464. /// 获取接团名称List
  465. /// </summary>
  466. /// <param name="dto"></param>
  467. /// <returns></returns>
  468. public async Task<Result> GetGroupNameList(GroupNameDto dto)
  469. {
  470. Result result = new Result() { Code = -2, Msg = "未知错误" };
  471. if (dto.PortType == 1 || dto.PortType == 2) //web
  472. {
  473. string sql = string.Format(@"Select Id,TeamName GroupName From Grp_DelegationInfo
  474. Where TeamName != '' And IsDel = 0
  475. Order By Id Desc");
  476. var _groupNameList = await _sqlSugar.SqlQueryable<GroupNameView>(sql).ToListAsync();
  477. if (_groupNameList.Count > 0)
  478. {
  479. result.Code = 0;
  480. result.Msg = "成功!";
  481. result.Data = _groupNameList;
  482. }
  483. else
  484. {
  485. result.Msg = "暂无团组信息";
  486. }
  487. }
  488. return result;
  489. }
  490. /// <summary>
  491. /// 获取接团名称List And 签证国别
  492. /// </summary>
  493. /// <param name="dto"></param>
  494. /// <returns></returns>
  495. public async Task<Result> GetGroupNameAndVisaNationality(GroupNameDto dto)
  496. {
  497. Result result = new Result() { Code = -2, Msg = "未知错误" };
  498. if (dto.PortType == 1 || dto.PortType == 2) //web
  499. {
  500. string sql = string.Format(@"Select Id,TeamName GroupName From Grp_DelegationInfo
  501. Where TeamName != '' And IsDel = 0
  502. Order By Id Desc");
  503. var _groupNameList = await _sqlSugar.SqlQueryable<GroupNameView>(sql).ToListAsync();
  504. string visaSql = string.Format(@"Select Id,Name From Sys_SetData Where STid = 41 And IsDel = 0");
  505. var _setDataList = await _sqlSugar.SqlQueryable<SetDataInfoView>(visaSql).ToListAsync();
  506. var data = new {
  507. groupNameData = _groupNameList,
  508. visaNationalityData = _setDataList
  509. };
  510. result.Data = data;
  511. result.Code = 0;
  512. }
  513. return result;
  514. }
  515. #endregion
  516. #region 团组&签证
  517. /// <summary>
  518. /// 根据团组Id查询客户
  519. /// </summary>
  520. /// <param name="dto"></param>
  521. /// <returns></returns>
  522. public async Task<Result> GetCrmByGroupId(ClientByGroupIdDto dto)
  523. {
  524. Result result = new Result() { Code = -2 };
  525. if (dto.PortType == 1 || dto.PortType == 2)
  526. {
  527. string sql = string.Format(@"Select gdjc.GrpDCId grpId,cdc.Id,cdc.LastName+cdc.FirstName clientName,cdc.Tel,ccc.CertNo CerdNo
  528. From Grp_DelegationJoinCustomer gdjc
  529. Inner join Crm_DeleClient cdc On gdjc.CrmDCId = cdc.Id
  530. Left Join Crm_CustomerCert ccc On ccc.SdId = 773 And cdc.Id = ccc.DcId
  531. Where gdjc.GrpDCId = {0}", dto.GroupId);
  532. var clientList = await _sqlSugar.SqlQueryable<CrmByGroupIdView>(sql).ToListAsync();
  533. if (clientList.Count > 0)
  534. {
  535. result.Code = 0;
  536. result.Msg = "成功!";
  537. result.Data = clientList;
  538. }
  539. else
  540. {
  541. result.Msg = "暂无数据!";
  542. }
  543. }
  544. return result;
  545. }
  546. #endregion
  547. }
  548. }