package com.fjhx.service.flow;

import com.fjhx.params.JumpVo;
import com.fjhx.utils.ExampleAbstract;
import com.fjhx.utils.FlowConstructor;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Objects;

/**
 * 免检
 */
@Service
public class InspectionExemptionFlowService {

    private final FlowConstructor flowConstructor = FlowConstructor.init(new ExampleAbstract() {

        @Override
        public String getCode() {
            return "js_inspectionExemption";
        }

        @Override
        public void end() {
        }

    });

    @Transactional(rollbackFor = Exception.class)
    public void create(Long qualityTestingId, String remark) {
        String title = Objects.requireNonNull(AuthUtil.getUser()).getUserName() + "的免检申请";
        flowConstructor.create(qualityTestingId, title, remark, qualityTestingId);
    }

    @Transactional(rollbackFor = Exception.class)
    public void jump(JumpVo jumpVo) {
        flowConstructor.jump(jumpVo);
    }

}
