/* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package com.blade.check.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.blade.check.dto.AuditProecessDTO; import com.blade.check.entity.AuditPathsActs; import com.blade.check.entity.AuditPathsLevels; import com.blade.check.entity.AuditProecess; import com.blade.check.mapper.AuditPathsActsMapper; import com.blade.check.vo.AuditProecessVO; import com.blade.check.mapper.AuditProecessMapper; import com.blade.check.service.IAuditProecessService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import io.seata.spring.annotation.GlobalTransactional; import org.springblade.core.secure.utils.AuthUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; /** * 审批流记录 服务实现类 * * @author BladeX * @since 2021-12-08 */ @Service public class AuditProecessServiceImpl extends ServiceImpl implements IAuditProecessService { private AuditPathsActsMapper auditPathsActsMapper; @Override public IPage selectAuditProecessPage(IPage page, AuditProecessVO auditProecess) { return page.setRecords(baseMapper.selectAuditProecessPage(page, auditProecess)); } @Override @Transactional public void createFinanceProcess(AuditProecessDTO auditProecessDTO) { List pathsLevelsList = auditProecessDTO.getPathsLevelsList(); //根据审批级次 生成 有多少调就生成多条审批流 pathsLevelsList.forEach(e->{ AuditProecess auditProecess=new AuditProecess(); auditProecess.setActId(auditProecessDTO.getActId()); //绑定业务主表id auditProecess.setBillId(auditProecessDTO.getBillId()); //绑定业务主办编号 auditProecess.setBillNo(auditProecessDTO.getBillNo()); auditProecess.setPathId(e.getPathId()); auditProecess.setLevelId(e.getLevelId()); auditProecess.setSendUserId(auditProecessDTO.getSendUserId()); auditProecess.setSendName(auditProecessDTO.getSendName()); auditProecess.setSendTime(auditProecessDTO.getSendTime()); auditProecess.setSendMsg(auditProecessDTO.getSendMsg()); auditProecess.setAuditUserId(e.getAuditUserId()); //除了第一级是待审,其他都N if(e.getLevelId()==1) { auditProecess.setAuditStatus("Q"); } else { auditProecess.setAuditStatus("N"); } //根据pathId和ActId查询保存字段 LambdaQueryWrapper actsLambdaQueryWrapper=new LambdaQueryWrapper<>(); actsLambdaQueryWrapper .eq(AuditPathsActs::getPathId,e.getPathId()) .eq(AuditPathsActs::getTenantId, AuthUtil.getTenantId()) .eq(AuditPathsActs::getActId,auditProecessDTO.getActId()); AuditPathsActs auditPathsActs = auditPathsActsMapper.selectOne(actsLambdaQueryWrapper); if(auditPathsActs!=null) { auditProecess.setFidStatus(auditPathsActs.getFidStatus()); } auditProecess.setTenantId(AuthUtil.getTenantId()); baseMapper.insert(auditProecess); }); } @Override @Transactional @GlobalTransactional public void operationFinanceProcess(AuditProecess auditProecess) { //更新当前审批记录 //更改下一个审批人的审批状态 //更改原财务逻辑(通过 or 拒绝) } }