AuditProecessServiceImpl.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package com.blade.check.service.impl;
  18. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  19. import com.blade.check.dto.AuditProecessDTO;
  20. import com.blade.check.entity.AuditPathsActs;
  21. import com.blade.check.entity.AuditPathsLevels;
  22. import com.blade.check.entity.AuditProecess;
  23. import com.blade.check.mapper.AuditPathsActsMapper;
  24. import com.blade.check.vo.AuditProecessVO;
  25. import com.blade.check.mapper.AuditProecessMapper;
  26. import com.blade.check.service.IAuditProecessService;
  27. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  28. import io.seata.spring.annotation.GlobalTransactional;
  29. import org.springblade.core.secure.utils.AuthUtil;
  30. import org.springframework.beans.factory.annotation.Autowired;
  31. import org.springframework.stereotype.Service;
  32. import com.baomidou.mybatisplus.core.metadata.IPage;
  33. import org.springframework.transaction.annotation.Transactional;
  34. import java.util.Date;
  35. import java.util.List;
  36. /**
  37. * 审批流记录 服务实现类
  38. *
  39. * @author BladeX
  40. * @since 2021-12-08
  41. */
  42. @Service
  43. public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, AuditProecess> implements IAuditProecessService
  44. {
  45. private AuditPathsActsMapper auditPathsActsMapper;
  46. @Override
  47. public IPage<AuditProecessVO> selectAuditProecessPage(IPage<AuditProecessVO> page, AuditProecessVO auditProecess) {
  48. return page.setRecords(baseMapper.selectAuditProecessPage(page, auditProecess));
  49. }
  50. @Override
  51. @Transactional
  52. public void createFinanceProcess(AuditProecessDTO auditProecessDTO)
  53. {
  54. List<AuditPathsLevels> pathsLevelsList = auditProecessDTO.getPathsLevelsList();
  55. //根据审批级次 生成 有多少调就生成多条审批流
  56. pathsLevelsList.forEach(e->{
  57. AuditProecess auditProecess=new AuditProecess();
  58. auditProecess.setActId(auditProecessDTO.getActId());
  59. //绑定业务主表id
  60. auditProecess.setBillId(auditProecessDTO.getBillId());
  61. //绑定业务主办编号
  62. auditProecess.setBillNo(auditProecessDTO.getBillNo());
  63. auditProecess.setPathId(e.getPathId());
  64. auditProecess.setLevelId(e.getLevelId());
  65. auditProecess.setSendUserId(auditProecessDTO.getSendUserId());
  66. auditProecess.setSendName(auditProecessDTO.getSendName());
  67. auditProecess.setSendTime(auditProecessDTO.getSendTime());
  68. auditProecess.setSendMsg(auditProecessDTO.getSendMsg());
  69. auditProecess.setAuditUserId(e.getAuditUserId());
  70. //除了第一级是待审,其他都N
  71. if(e.getLevelId()==1)
  72. {
  73. auditProecess.setAuditStatus("Q");
  74. }
  75. else
  76. {
  77. auditProecess.setAuditStatus("N");
  78. }
  79. //根据pathId和ActId查询保存字段
  80. LambdaQueryWrapper<AuditPathsActs> actsLambdaQueryWrapper=new LambdaQueryWrapper<>();
  81. actsLambdaQueryWrapper
  82. .eq(AuditPathsActs::getPathId,e.getPathId())
  83. .eq(AuditPathsActs::getTenantId, AuthUtil.getTenantId())
  84. .eq(AuditPathsActs::getActId,auditProecessDTO.getActId());
  85. AuditPathsActs auditPathsActs = auditPathsActsMapper.selectOne(actsLambdaQueryWrapper);
  86. if(auditPathsActs!=null)
  87. {
  88. auditProecess.setFidStatus(auditPathsActs.getFidStatus());
  89. }
  90. auditProecess.setTenantId(AuthUtil.getTenantId());
  91. baseMapper.insert(auditProecess);
  92. });
  93. }
  94. @Override
  95. @Transactional
  96. @GlobalTransactional
  97. public void operationFinanceProcess(AuditProecess auditProecess)
  98. {
  99. //更新当前审批记录
  100. //更改下一个审批人的审批状态
  101. //更改原财务逻辑(通过 or 拒绝)
  102. }
  103. }