DailyFeePaymentRepository.cs 25 KB

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