huminmin
2026-07-10 2ee9e158e3129070f6b1fd953da1540f05d4f2b0
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -31,6 +31,8 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.production.mapper.ProductionProductMainMapper;
import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysDeptMapper;
@@ -94,6 +96,7 @@
    private final EnterpriseNewsMapper enterpriseNewsMapper;
    private final EnterpriseNewsScopeDeptMapper enterpriseNewsScopeDeptMapper;
    private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper;
    private final ProductionProductMainMapper productionProductMainMapper;
    @Override
    public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) {
@@ -550,6 +553,10 @@
        }
        if (TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode().equals(businessType)) {
            handleNewsApprovalFinished(instance, status);
            return;
        }
        if (TypeEnums.PRODUCTION_REPORT_APPROVAL.getCode().equals(businessType)) {
            handleProductionReportApprovalFinished(instance, status);
        }
    }
@@ -691,6 +698,27 @@
        shippingInfoMapper.updateById(shippingInfo);
    }
    private void handleProductionReportApprovalFinished(ApprovalInstance instance, String status) {
        if (instance == null || instance.getBusinessId() == null) {
            return;
        }
        ProductionProductMain productionProductMain = productionProductMainMapper.selectById(instance.getBusinessId());
        if (productionProductMain == null) {
            return;
        }
        if ("APPROVED".equals(status)) {
            productionProductMain.setAuditStatus(1);
        } else if ("REJECTED".equals(status)) {
            productionProductMain.setAuditStatus(2);
        } else if ("PENDING".equals(status)) {
            productionProductMain.setAuditStatus(0);
        } else {
            return;
        }
        productionProductMainMapper.updateById(productionProductMain);
    }
    private List<ApprovalTask> createNodeAndTasks(ApprovalInstance instance, ApprovalTemplateNode templateNode) {
        List<ApprovalTemplateNodeApprover> approvers = approvalTemplateNodeApproverMapper.selectList(
                new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()