maven
20 小时以前 89fc27ddebd84a2be3e60856d6a6b2318b10db4f
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -19,11 +19,15 @@
import com.ruoyi.project.system.domain.SysUser;
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.SalesQuotationMapper;
import com.ruoyi.sales.mapper.SalesQuotationProductMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
import com.ruoyi.sales.pojo.CommonFile;
import com.ruoyi.sales.pojo.SalesQuotation;
import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,7 +63,16 @@
    private DeviceRepairMapper deviceRepairMapper;
    @Autowired
    private PurchaseLedgerMapper purchaseLedgerMapper;
    @Autowired
    private SalesQuotationMapper salesQuotationMapper;
    @Autowired
    private ShippingInfoMapper shippingInfoMapper;
    @Autowired
    private CommonFileServiceImpl commonFileService;
@@ -163,6 +176,26 @@
            }
            deviceRepairMapper.updateById(deviceRepair);
        }
        //采购审核
        if(approveProcess.getApproveType().equals(5)){
            PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>()
                    .eq(PurchaseLedger::getPurchaseContractNumber, approveProcess.getApproveReason())
                    .last("limit 1"));
            if(purchaseLedger != null) {
                if (status.equals(2)) {
                    // 同意
                    purchaseLedger.setApprovalStatus(3);
                } else if (status.equals(3)) {
                    // 拒绝
                    purchaseLedger.setApprovalStatus(4);
                } else if (status.equals(1)) {
                    // 审核中
                    purchaseLedger.setApprovalStatus(2);
                }
                purchaseLedgerMapper.updateById(purchaseLedger);
            }
        }
        // 销售报价状态修改
        if(approveProcess.getApproveType().equals(6)){
            SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>()
@@ -176,8 +209,26 @@
            }else if(status.equals(1) && salesQuote != null){
                salesQuote.setStatus("审核中");
            }
            salesQuotationMapper.updateById(salesQuote);
        }
        // 出库审批修改
        if(approveProcess.getApproveType().equals(7)){
            String[] split = approveProcess.getApproveReason().split(":");
            ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
                    .eq(ShippingInfo::getShippingNo, split[1])
                    .orderByDesc(ShippingInfo::getCreateTime)
                    .last("limit 1"));
            if(shippingInfo != null){
                if(status.equals(2)){
                    shippingInfo.setStatus("审核通过");
                }else if(status.equals(3)){
                    shippingInfo.setType("审核拒绝");
                }else if(status.equals(1)){
                    shippingInfo.setStatus("审核中");
                }
                shippingInfoMapper.updateById(shippingInfo);
            }
        }
        // 绑定附件
        if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){
@@ -214,11 +265,17 @@
    }
    @Override
    public void delApproveNodeByApproveId(Long id) {
    public void delApproveNodeByApproveId(String id) {
        List<ApproveNode> approveNodes = approveNodeMapper.selectList(new LambdaQueryWrapper<ApproveNode>()
                .eq(ApproveNode::getApproveProcessId, id));
        UpdateWrapper<ApproveNode> queryWrapper = new UpdateWrapper<>();
        queryWrapper.lambda().set(ApproveNode::getDeleteFlag, 1)
                .eq(ApproveNode::getApproveProcessId, id);
        update(queryWrapper);
        // 删除附件
        for (ApproveNode approveNode : approveNodes) {
            commonFileService.deleteByBusinessId(approveNode.getId(), FileNameType.ApproveNode.getValue());
        }
    }
    //审批类型获取(与前端页面对应)