DailyFeePaymentRepository.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. using AutoMapper;
  2. using NPOI.SS.Formula.Functions;
  3. using OASystem.Domain;
  4. using OASystem.Domain.Dtos;
  5. using OASystem.Domain.Dtos.Financial;
  6. using OASystem.Domain.Entities.Financial;
  7. using OASystem.Domain.Entities.Groups;
  8. using OASystem.Domain.ViewModels.Financial;
  9. using OASystem.Infrastructure.Repositories.System;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.ComponentModel.Design;
  13. using System.Linq;
  14. using System.Runtime.Intrinsics.Arm;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. namespace OASystem.Infrastructure.Repositories.Financial
  18. {
  19. /// <summary>
  20. /// 财务 - 日付申请
  21. /// </summary>
  22. public class DailyFeePaymentRepository : BaseRepository<Fin_DailyFeePayment, Fin_DailyFeePaymentView>
  23. {
  24. private readonly IMapper _mapper;
  25. private readonly System.SetDataTypeRepository _setDataTypeRep;
  26. private readonly System.UsersRepository _UsersRep;
  27. private readonly System.CompanyRepository _CompanyRep;
  28. /// <summary>
  29. ///
  30. /// </summary>
  31. /// <param name="sqlSugar"></param>
  32. /// <param name="mapper"></param>
  33. /// <param name="setDataTypeRep"></param>
  34. /// <param name="usersRep"></param>
  35. /// <param name="companyRep"></param>
  36. public DailyFeePaymentRepository(SqlSugarClient sqlSugar,
  37. IMapper mapper,
  38. System.SetDataTypeRepository setDataTypeRep,
  39. UsersRepository usersRep,
  40. CompanyRepository companyRep)
  41. : base(sqlSugar)
  42. {
  43. this._mapper = mapper;
  44. this._setDataTypeRep = setDataTypeRep;
  45. this._UsersRep = usersRep;
  46. this._CompanyRep = companyRep;
  47. }
  48. /// <summary>
  49. /// 日付申请查询 使用的数据源
  50. /// </summary>
  51. /// <param name="dto"></param>
  52. /// <returns></returns>
  53. public async Task<Result> GetPagePriceTypeData(PortDtoBase dto, int currUserId = 0)
  54. {
  55. Result result = new Result() { Code = -2 };
  56. dynamic? DailyFeePaymentList = null;
  57. var setTypeData = _setDataTypeRep.QueryDto<Sys_SetDataType, Fin_DailyFeePaymentPagePriceTypeView>().ToList();
  58. var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
  59. //48人员费用 49办公费用 50 销售费用 51 其他费用 55 大运会
  60. var typeIds = new List<int>() {
  61. 48, //人员费用
  62. 49, //办公费用
  63. 50, //销售费用
  64. 51, //其他费用
  65. 55, //大运会
  66. 90, //各部门基础固定费用明细
  67. 104, //团组费用
  68. 116, //物资采购
  69. };
  70. var priceTypeData = setTypeData.Where(s => typeIds.Contains(s.Id)).ToList();
  71. var priceSubTypeData = setData.Where(s => typeIds.Contains(s.STid)).ToList();
  72. //var isEnable = false;
  73. //员工姓名列表
  74. var userData = _sqlSugar.Queryable<Sys_Users>()
  75. .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
  76. .LeftJoin<Sys_JobPost>((u, d, jp) => u.JobPostId == jp.Id)
  77. .Where((u, d, jp) => u.IsDel == 0)
  78. .Select((u, d, jp) => new
  79. {
  80. u.Id,
  81. u.CnName,
  82. u.DepId,
  83. d.DepName,
  84. u.JobPostId,
  85. jp.JobName
  86. })
  87. .ToList();
  88. //1 经理职位 查看该部门下所有人员
  89. if (currUserId > 0)
  90. {
  91. //42
  92. var auditUserIds = _sqlSugar.Queryable<Sys_UserAuthority>().Where(x => x.IsDel == 0 && x.SmId == 42 && x.FId == 12).Select(x => x.UId).ToList();
  93. if (!auditUserIds.Contains(currUserId))
  94. {
  95. var screenWheres = new List<string>() { "经理", "主管" };
  96. var userInfo = userData.Find(x => x.Id == currUserId && screenWheres.Contains(x.JobName));
  97. if (userInfo != null)
  98. {
  99. userData = userData.Where(x => x.DepName.Equals(userInfo.DepName)).ToList();
  100. }
  101. else
  102. {
  103. userData = userData.Where(x => x.Id == currUserId).ToList();
  104. }
  105. }
  106. else
  107. {
  108. userData.Insert(0, new { Id = -1, CnName = "全部", DepId = 0, DepName = "", JobPostId = 0, JobName = "" });
  109. }
  110. }
  111. var userData1 = userData.Select(x => new { x.Id, x.CnName }).ToList();
  112. //62 公转 63 私转
  113. var feeMarkTypeData = setTypeData.Where(s => s.Id == 62 || s.Id == 63).ToList();
  114. var feeMarkSubTypeData = setData.Where(s => s.STid == 62 || s.STid == 63).ToList();
  115. var companyNameData = await _CompanyRep.GetCompanyNameData();
  116. //审核状态
  117. var auditStatusData = new List<dynamic>()
  118. {
  119. new { Id = -1, Name = "全部" },
  120. new { Id = 0, Name = "未审核" },
  121. new { Id = 1, Name = "已审核" },
  122. new { Id = 2, Name = "审核未通过" },
  123. new { Id = 3, Name = "自动审核" }
  124. };
  125. if (dto.PortType == 1) //web
  126. {
  127. DailyFeePaymentList = new
  128. {
  129. FeeTypeData = priceTypeData,
  130. FeeSubTypeData = priceSubTypeData,
  131. UserNameData = userData1,
  132. FeeMarkTypeData = feeMarkTypeData,
  133. FeeMarkSubTypeData = feeMarkSubTypeData,
  134. CompanyNameData = companyNameData.Data,
  135. AuditStatusData = auditStatusData
  136. };
  137. }
  138. else if (dto.PortType == 2) //安卓
  139. {
  140. DailyFeePaymentList = new
  141. {
  142. UserNameData = userData1,
  143. FeeTypeData = priceTypeData,
  144. FeeTypeSubData = priceSubTypeData
  145. };
  146. }
  147. result.Code = 0;
  148. result.Msg = "查询成功!";
  149. result.Data = DailyFeePaymentList;
  150. return result;
  151. }
  152. /// <summary>
  153. /// 总经理自动审核通过类型
  154. /// 90 Parent 各部门基础固定费用明细
  155. /// 104 Parent 团组费用
  156. /// 672 Sub 办公费用-信息部申请费用
  157. /// </summary>
  158. /// <param name="typeId"></param>
  159. /// <returns></returns>
  160. public async Task<bool> GMAutoApprovalType(int typeId)
  161. {
  162. if (typeId < 1) return false;
  163. var parentIds = new List<int>()
  164. {
  165. 90, // 各部门基础固定费用明细
  166. 104, // 团组费用
  167. };
  168. var subIds = new List<int>()
  169. {
  170. 672, //办公费用-信息部申请费用
  171. };
  172. var parentTypeDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && parentIds.Contains(x.STid)).ToListAsync();
  173. var subTypeDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && subIds.Contains(x.Id)).ToListAsync();
  174. var typeDatas = new List<Sys_SetData>();
  175. if (parentTypeDatas.Any()) typeDatas.AddRange(parentTypeDatas);
  176. if (subTypeDatas.Any()) typeDatas.AddRange(subTypeDatas);
  177. if (typeDatas.Any(x => x.Id == typeId)) return true;
  178. return false;
  179. }
  180. /// <summary>
  181. /// 日付申请查询 使用的数据源
  182. /// </summary>
  183. /// <param name="dto"></param>
  184. /// <returns></returns>
  185. public async Task<Result> GetPriceTypeAddData(PortDtoBase dto)
  186. {
  187. Result result = new Result() { Code = -2 };
  188. dynamic? DailyFeePaymentList = null;
  189. var setTypeData = _setDataTypeRep.QueryDto<Sys_SetDataType, Fin_DailyFeePaymentPagePriceTypeView>().ToList();
  190. var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
  191. //48人员费用 49办公费用 50 销售费用 51 其他费用 55 大运会
  192. var priceTypeData = setTypeData.Where(s => s.Id == 48 || s.Id == 49 || s.Id == 50 || s.Id == 51 || s.Id == 55).ToList();
  193. var priceSubTypeData = setData.Where(s => s.STid == 48 || s.STid == 49 || s.STid == 50 || s.STid == 51 || s.STid == 55).ToList();
  194. //员工姓名列表
  195. var userNameData = await _UsersRep.GetUserNameList(dto.PortType);
  196. //62 公转 63 私转
  197. var feeMarkTypeData = setTypeData.Where(s => s.Id == 62 || s.Id == 63).ToList();
  198. var feeMarkSubTypeData = setData.Where(s => s.STid == 62 || s.STid == 63).ToList();
  199. var companyNameData = await _CompanyRep.GetCompanyNameData();
  200. if (dto.PortType == 1) //web
  201. {
  202. DailyFeePaymentList = new Fin_DailyFeePaymentPagePriceTypeDataView
  203. {
  204. FeeTypeData = priceTypeData,
  205. FeeSubTypeData = priceSubTypeData,
  206. UserNameData = userNameData.Data,
  207. FeeMarkTypeData = feeMarkTypeData,
  208. FeeMarkSubTypeData = feeMarkSubTypeData,
  209. CompanyNameData = companyNameData.Data
  210. };
  211. }
  212. else if (dto.PortType == 2) //安卓
  213. {
  214. DailyFeePaymentList = new
  215. {
  216. CompanyNameData = companyNameData.Data,
  217. FeeTypeData = feeMarkTypeData,
  218. FeeTypeSubData = feeMarkSubTypeData
  219. };
  220. }
  221. result.Code = 0;
  222. result.Msg = "查询成功!";
  223. result.Data = DailyFeePaymentList;
  224. return result;
  225. }
  226. /// <summary>
  227. /// 日付申请 page 查询
  228. /// </summary>
  229. /// <param name="dto"></param>
  230. /// <returns></returns>
  231. public async Task<Result> GetPageSearchAll(PageDailyFeePaymentDto dto)
  232. {
  233. Result result = new Result() { Code = -2 };
  234. ListViewBase<Fin_DailyFeePaymentPageListView> dailyFeePaymentPageList = new ListViewBase<Fin_DailyFeePaymentPageListView>()
  235. {
  236. ReceiveDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  237. };
  238. #region sql条件处理
  239. string sqlWhere = "";
  240. if (dto.CompanyId != -1) //公司
  241. sqlWhere += string.Format(" And dfp.CompanyId = {0}", dto.CompanyId);
  242. if (dto.FinancialAuditStatus != -1) //财务审核
  243. sqlWhere += string.Format(" And dfp.FAudit = {0}", dto.FinancialAuditStatus);
  244. if (dto.ManagerAuditStatus != -1) //总经理审核
  245. sqlWhere += string.Format(" And dfp.MAudit = {0}", dto.ManagerAuditStatus);
  246. if (dto.IsPaySign != -1) //付款状态
  247. {
  248. sqlWhere += string.Format(" And dfp.IsPay = {0}", dto.IsPaySign);
  249. }
  250. if (dto.FeeTypeId != -1) //费用类型
  251. {
  252. if (dto.FeeSubTypeId != -1) //子类处理
  253. {
  254. sqlWhere += string.Format(" And dfp.PriceTypeId = {0}", dto.FeeSubTypeId);
  255. }
  256. else
  257. {
  258. var setData = _setDataTypeRep.QueryDto<Sys_SetData, SetDataView>(s => s.STid == dto.FeeTypeId).ToList();
  259. if (setData.Count > 0)
  260. {
  261. string setDataIds = string.Join(",", setData.Select(x => x.Id).ToList());
  262. sqlWhere += string.Format(" And dfp.PriceTypeId In ({0})", setDataIds);
  263. }
  264. }
  265. }
  266. if (!string.IsNullOrEmpty(dto.FeeDesc))
  267. sqlWhere += string.Format(" And dfp.Instructions Like '%{0}%'", dto.FeeDesc);
  268. if (dto.CreateUserId != -1)
  269. sqlWhere += string.Format(" And dfp.CreateUserId = {0}", dto.CreateUserId);
  270. int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
  271. int endIndex = startIndex + dto.PageSize - 1;
  272. string sqlPage = string.Format(@"Select * From (
  273. Select row_number() over (order by dfp.Id Desc) as RowNumber,
  274. dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
  275. dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
  276. dfp.PriceTypeId,dfp.IsPay
  277. From Fin_DailyFeePayment dfp
  278. Inner Join Sys_Company c On dfp.CompanyId = c.Id
  279. Left Join Sys_Users u On dfp.CreateUserId = u.Id
  280. Where dfp.IsDel=0 {0}
  281. ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
  282. string sqlCount = string.Format(@"Select COUNT(1) as Count From (
  283. Select dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
  284. dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
  285. dfp.PriceTypeId
  286. From Fin_DailyFeePayment dfp
  287. Inner Join Sys_Company c On dfp.CompanyId = c.Id
  288. Left Join Sys_Users u On dfp.CreateUserId = u.Id
  289. Where dfp.IsDel=0 {0}
  290. ) temp ", sqlWhere);
  291. #endregion
  292. if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
  293. {
  294. //Fin_DailyFeePaymentPageCount
  295. var dailyFeePaymentCount = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentPageCount>(sqlCount).FirstAsync();
  296. var DailyFeePaymentData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentPageListView>(sqlPage).ToListAsync();
  297. int totalCount = dailyFeePaymentCount.Count;
  298. dailyFeePaymentPageList = new ListViewBase<Fin_DailyFeePaymentPageListView>
  299. {
  300. CurrPageIndex = dto.PageIndex,
  301. CurrPageSize = dto.PageSize,
  302. DataCount = totalCount,
  303. DataList = DailyFeePaymentData
  304. };
  305. }
  306. result.Code = 0;
  307. result.Msg = "查询成功!";
  308. result.Data = dailyFeePaymentPageList;
  309. return result;
  310. }
  311. /// <summary>
  312. /// 日付申请 single 查询 By Id
  313. /// </summary>
  314. /// <param name="dto"></param>
  315. /// <returns></returns>
  316. public async Task<Result> GetSearchById(SearchDailyFeePaymentDto dto)
  317. {
  318. Result result = new Result() { Code = -2 };
  319. if (dto.PortType == 1) //web
  320. {
  321. Fin_DailyFeePaymentInfolView feeData = new Fin_DailyFeePaymentInfolView();
  322. string feeSql = string.Format(@"Select * From Fin_DailyFeePayment
  323. Where IsDel=0 And Id = {0} ", dto.Id);
  324. feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfolView>(feeSql).FirstAsync();
  325. string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent
  326. Where IsDel=0 And DFPId = {0} ", dto.Id);
  327. feeData.FeeContents = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToListAsync();
  328. result.Code = 0;
  329. result.Msg = "查询成功!";
  330. result.Data = feeData;
  331. }
  332. else if (dto.PortType == 2 || dto.PortType == 3) //android And ios
  333. {
  334. Fin_DailyFeePaymentInfoAndroidlView feeData = new Fin_DailyFeePaymentInfoAndroidlView();
  335. string feeSql = string.Format(@"Select * From Fin_DailyFeePayment
  336. Where IsDel=0 And Id = {0} ", dto.Id);
  337. feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfoAndroidlView>(feeSql).FirstAsync();
  338. //feeData.TransferTypeId = feeData.TransferTypeId == 0 ? 62 : feeData.TransferTypeId == 1 ? 63 : 0;
  339. string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent
  340. Where IsDel=0 And DFPId = {0} ", dto.Id);
  341. feeData.FeeContents = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToListAsync();
  342. result.Code = 0;
  343. result.Msg = "查询成功!";
  344. result.Data = feeData;
  345. }
  346. return result;
  347. }
  348. /// <summary>
  349. /// 日付申请 添加
  350. /// </summary>
  351. /// <param name="dto"></param>
  352. /// <returns></returns>
  353. public async Task<Result> Add(AddDailyFeePaymentDto dto)
  354. {
  355. Result result = new Result() { Code = -2 };
  356. _sqlSugar.BeginTran();
  357. var _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
  358. _fee.CreateUserId = dto.UserId;
  359. _fee.GroupId = dto.GroupId;
  360. //自动审核验证
  361. var auditPer = await GMAutoApprovalType(dto.PriceTypeId);
  362. var priceTypeInfo = await _sqlSugar.Queryable<Sys_SetData>().FirstAsync(x => x.IsDel == 0 && x.Id == dto.PriceTypeId);
  363. if (auditPer)
  364. {
  365. _fee.MAudit = 3;
  366. _fee.MAuditDate = DateTime.Now;
  367. }
  368. int? feeId = await _sqlSugar.Insertable(_fee).ExecuteReturnIdentityAsync();
  369. if (dto.FeeContents.Any())
  370. {
  371. var _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
  372. foreach (var item in _feeContents)
  373. {
  374. item.DFPId = feeId == null ? -1 : Convert.ToInt32(feeId);
  375. item.CreateUserId = dto.UserId;
  376. }
  377. await _sqlSugar.Insertable(_feeContents).ExecuteCommandAsync();
  378. }
  379. _sqlSugar.CommitTran();
  380. result.Code = 0;
  381. var data = new { dailyId = feeId, sign = 1 };
  382. result.Data = data;
  383. return result;
  384. }
  385. /// <summary>
  386. /// 日付申请 编辑
  387. /// </summary>
  388. /// <param name="dto"></param>
  389. /// <returns></returns>
  390. public async Task<Result> Edit(EditDailyFeePaymentDto dto)
  391. {
  392. Result result = new Result() { Code = -2 };
  393. //自动审核验证
  394. var auditPer = await GMAutoApprovalType(dto.PriceTypeId);
  395. #region 已审核的数据不可编辑
  396. var dailyFeeInfo = await _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(it => it.Id == dto.Id && it.IsDel == 0).FirstAsync();
  397. if (dailyFeeInfo != null)
  398. {
  399. var auditIds = new List<int>() { 1, 3 };
  400. if (auditIds.Contains(dailyFeeInfo.FAudit) || auditIds.Contains(dailyFeeInfo.MAudit))
  401. {
  402. if (auditPer)
  403. {
  404. if (dailyFeeInfo.IsPay == 1)
  405. {
  406. result.Msg = "该笔费用已付款,不可修改!";
  407. return result;
  408. }
  409. }
  410. else
  411. {
  412. result.Msg = "审核已通过,不可修改!";
  413. return result;
  414. }
  415. }
  416. }
  417. #endregion
  418. _sqlSugar.BeginTran();
  419. try
  420. {
  421. Fin_DailyFeePayment _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
  422. _fee.CreateUserId = dto.UserId;
  423. int? editFeeStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
  424. .SetColumns(a => new Fin_DailyFeePayment
  425. {
  426. Instructions = dto.Instructions,
  427. SumPrice = dto.SumPrice,
  428. TransferTypeId = dto.TransferTypeId,
  429. PriceTypeId = dto.PriceTypeId,
  430. CompanyId = dto.CompanyId,
  431. GroupId = dto.GroupId,
  432. })
  433. .SetColumnsIF(auditPer, a => a.MAudit == 3)
  434. .SetColumnsIF(auditPer, a => a.MAuditDate == DateTime.Now)
  435. .Where(a => a.Id == dto.Id)
  436. .ExecuteCommandAsync();
  437. var _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
  438. await _sqlSugar.Updateable<Fin_DailyFeePaymentContent>()
  439. .Where(a => a.DFPId == _fee.Id)
  440. .SetColumns(a => new Fin_DailyFeePaymentContent
  441. {
  442. IsDel = 1,
  443. DeleteUserId = _fee.CreateUserId,
  444. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
  445. })
  446. .ExecuteCommandAsync();
  447. if (_feeContents.Any())
  448. {
  449. foreach (var item in _feeContents)
  450. {
  451. item.DFPId = _fee.Id;
  452. item.CreateUserId = dto.UserId;
  453. }
  454. await _sqlSugar.Insertable(_feeContents).ExecuteCommandAsync();
  455. }
  456. _sqlSugar.CommitTran();
  457. result.Code = 0;
  458. var data = new { dailyId = dto.Id, sign = 2 };
  459. result.Data = data;
  460. }
  461. catch (Exception ex)
  462. {
  463. _sqlSugar.RollbackTran();
  464. result.Msg = ex.Message;
  465. }
  466. return result;
  467. }
  468. /// <summary>
  469. /// 日付申请 删除
  470. /// </summary>
  471. /// <param name="dto"></param>
  472. /// <returns></returns>
  473. public async Task<Result> Del(DelDailyFeePaymentDto dto)
  474. {
  475. Result result = new Result() { Code = -2 };
  476. int? delFeeStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
  477. .Where(a => a.Id == dto.Id)
  478. .SetColumns(a => new Fin_DailyFeePayment
  479. {
  480. IsDel = 1,
  481. DeleteUserId = dto.Id,
  482. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
  483. }).ExecuteCommandAsync();
  484. result.Code = 0;
  485. return result;
  486. }
  487. /// <summary>
  488. /// 日付申请 审核
  489. /// </summary>
  490. /// <param name="dto"></param>
  491. /// <returns></returns>
  492. public async Task<Result> DailyPaymentAudit(DP_AuditStatusDto dto)
  493. {
  494. Result result = new Result() { Code = -2 };
  495. if (dto.AuditType == 1) //财务审核
  496. {
  497. int? auditStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
  498. .Where(a => a.Id == dto.Id)
  499. .SetColumns(a => new Fin_DailyFeePayment
  500. {
  501. FAudit = dto.AuditStatus,
  502. FAuditDate = DateTime.Now,
  503. }).ExecuteCommandAsync();
  504. if (auditStatus != null && auditStatus > 0)
  505. result.Code = 0;
  506. else
  507. result.Msg = "财务审核操作失败";
  508. }
  509. else if (dto.AuditType == 2) //总经理
  510. {
  511. int? auditStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
  512. .Where(a => a.Id == dto.Id)
  513. .SetColumns(a => new Fin_DailyFeePayment
  514. {
  515. MAudit = dto.AuditStatus,
  516. MAuditDate = DateTime.Now,
  517. }).ExecuteCommandAsync();
  518. if (auditStatus != null && auditStatus > 0)
  519. result.Code = 0;
  520. else
  521. result.Msg = "总经理审核操作失败";
  522. }
  523. return result;
  524. }
  525. }
  526. }