| | |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | //@RequiredArgsConstructor |
| | | public class ApproveProcessServiceImpl extends ServiceImpl<ApproveProcessMapper, ApproveProcess> implements IApproveProcessService { |
| | | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | private final DailyRedisCounter dailyRedisCounter; |
| | | |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final IApproveNodeService approveNodeService; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final TempFileServiceImpl tempFileService; |
| | | private final CommonFileMapper commonFileMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ISysNoticeService sysNoticeService; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | @Autowired |
| | | private DailyRedisCounter dailyRedisCounter; |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Autowired |
| | | private IApproveNodeService approveNodeService; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | |
| | | @Override |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | |
| | | return sysDeptList; |
| | | } |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | @Autowired |
| | | private ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | @Override |
| | | public IPage<ApproveProcess> listAll(Page page, ApproveProcess approveProcess) { |
| | | IPage<ApproveProcess> approveProcessIPage = approveProcessMapper.listPage(page, approveProcess); |
| | | List<ApproveProcess> records = approveProcessIPage.getRecords(); |
| | | |
| | | for (ApproveProcess record : records) { |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, record.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue())); |
| | | record.setCommonFileList(commonFiles); |
| | | List<CommonFile> allFiles = new ArrayList<>(); |
| | | |
| | | // 采购审批查询 |
| | | if (record.getApproveType() == 5) { |
| | | String contractNo = record.getApproveReason(); |
| | | PurchaseLedger ledger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, contractNo) |
| | | .last("limit 1")); |
| | | |
| | | if (ledger != null) { |
| | | allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, ledger.getId()) |
| | | .eq(CommonFile::getType, FileNameType.PURCHASE.getValue())); |
| | | } |
| | | } |
| | | |
| | | // 发货审批查询 |
| | | else if (record.getApproveType() == 7) { |
| | | String reason = record.getApproveReason(); // 格式为 "xx:...-..." |
| | | if (StringUtils.hasText(reason) && reason.contains(":")) { |
| | | // 提取冒号后面的发货单号 |
| | | String shippingNo = reason.split(":")[1]; |
| | | // 根据发货单号查询发货台账记录 |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, shippingNo) |
| | | .last("limit 1")); |
| | | if (shippingInfo != null) { |
| | | // 使用发货台账的 销售台账ID 去查附件 |
| | | allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, shippingInfo.getSalesLedgerId()) |
| | | .eq(CommonFile::getType, FileNameType.SALE.getValue())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 查询审批单自身的附件 |
| | | else { |
| | | allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, record.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue())); |
| | | } |
| | | |
| | | record.setCommonFileList(allFiles); |
| | | } |
| | | return approveProcessIPage; |
| | | } |
| | |
| | | return one; |
| | | } |
| | | |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | @Autowired |
| | | private ApproveNodeMapper approveNodeMapper; |
| | | |
| | | // 报价审批编辑审核人 |
| | | public void updateApproveUser(ApproveGetAndUpdateVo approveGetAndUpdateVo) { |