package com.huimv.receive.common.utils;

import com.huimv.receive.entity.*;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class FlowUtil {
    public Object getEntity(Integer nextFlowId, Integer vistitType, String destName, Integer destId, Integer userId,
                            String userName, String phone, LocalDateTime vistitDate, Integer locationId,
                            String locationName, Integer farmId, Integer processId, String departureName,
                            Integer departureId,Integer midId,String midName,String farmName) {
        if (nextFlowId == 1) {
            BillSampling billSampling = new BillSampling();
            billSampling.setVistitType(vistitType);
            billSampling.setDestName(destName);
            billSampling.setDestId(destId);
            billSampling.setAdmissionUserName(userName);
            billSampling.setAdmissionUserId(userId);
            billSampling.setVistitDate(vistitDate);
            billSampling.setSubDate(LocalDateTime.now());
            billSampling.setPhone(phone);
            billSampling.setTestLocation(locationName);
            billSampling.setTestLocationId(locationId);
            billSampling.setProcessId(processId);
            billSampling.setFarmId(String.valueOf(farmId));
            billSampling.setDepartureId(departureId);
            billSampling.setDepartureName(departureName);
            billSampling.setMidId(midId);
            billSampling.setMidName(midName);
            billSampling.setFarmName(farmName);
            return billSampling;
        } else if (nextFlowId == 2) {
            BillPcr billPcr = new BillPcr();
            billPcr.setVistitType(vistitType);
            billPcr.setDestName(destName);
            billPcr.setDestId(destId);
            billPcr.setAdmissionUserName(userName);
            billPcr.setAdmissionUserId(userId);
            billPcr.setVistitDate(vistitDate);
            billPcr.setSubDate(LocalDateTime.now());
            billPcr.setPhone(phone);
            billPcr.setTestLocation(locationName);
            billPcr.setTestLocationId(locationId);
            billPcr.setProcessId(processId);
            billPcr.setFarmId(farmId);
            billPcr.setDepartureId(departureId);
            billPcr.setDepartureName(departureName);
            billPcr.setMidId(midId);
            billPcr.setMidName(midName);
            billPcr.setFarmName(farmName);
            return billPcr;
        } else if (nextFlowId == 3) {
            BillClean billClean = new BillClean();
            billClean.setVistitType(vistitType);
            billClean.setDestName(destName);
            billClean.setDestId(destId);
            billClean.setAdmissionUserName(userName);
            billClean.setAdmissionUserId(userId);
            billClean.setVistitDate(vistitDate);
            billClean.setSubDate(LocalDateTime.now());
            billClean.setPhone(phone);
            billClean.setTestLocation(locationName);
            billClean.setTestLocationId(locationId);
            billClean.setProcessId(processId);
            billClean.setFarmId(farmId);
            billClean.setDepartureId(departureId);
            billClean.setDepartureName(departureName);
            billClean.setMidId(midId);
            billClean.setMidName(midName);
            billClean.setFarmName(farmName);
            return billClean;
        } else if (nextFlowId == 4) {
            BillIsolate billIsolate = new BillIsolate();
            billIsolate.setVistitType(vistitType);
            billIsolate.setDestName(destName);
            billIsolate.setDestId(destId);
            billIsolate.setAdmissionUserName(userName);
            billIsolate.setAdmissionUserId(userId);
            billIsolate.setVistitDate(vistitDate);
            billIsolate.setSubDate(LocalDateTime.now());
            billIsolate.setPhone(phone);
            billIsolate.setIsolateLocation(locationName);
            billIsolate.setIsolateLocationId(locationId);
            billIsolate.setProcessId(processId);
            billIsolate.setFarmId(farmId);
            billIsolate.setDepartureId(departureId);
            billIsolate.setDepartureName(departureName);
            billIsolate.setMidId(midId);
            billIsolate.setMidName(midName);
            billIsolate.setFarmName(farmName);
            return billIsolate;
        } else if (nextFlowId == 5) {
            BillDry billDry = new BillDry();
            billDry.setVistitType(vistitType);
            billDry.setDestName(destName);
            billDry.setDestId(destId);
            billDry.setAdmissionUserName(userName);
            billDry.setAdmissionUserId(userId);
            billDry.setVistitDate(vistitDate);
            billDry.setSubDate(LocalDateTime.now());
            billDry.setPhone(phone);
            billDry.setTestLocation(locationName);
            billDry.setTestLocationId(locationId);
            billDry.setProcessId(processId);
            billDry.setFarmId(farmId);
            billDry.setDepartureId(departureId);
            billDry.setDepartureName(departureName);
            billDry.setMidId(midId);
            billDry.setMidName(midName);
            billDry.setFarmName(farmName);
            return billDry;
        } else if (nextFlowId == 6) {
            BillCleanBefore billCleanBefore = new BillCleanBefore();
            billCleanBefore.setVistitType(vistitType);
            billCleanBefore.setDestName(destName);
            billCleanBefore.setDestId(destId);
            billCleanBefore.setAdmissionUserName(userName);
            billCleanBefore.setAdmissionUserId(userId);
            billCleanBefore.setVistitDate(vistitDate);
            billCleanBefore.setSubDate(LocalDateTime.now());
            billCleanBefore.setPhone(phone);
            billCleanBefore.setTestLocation(locationName);
            billCleanBefore.setTestLocationId(locationId);
            billCleanBefore.setProcessId(processId);
            billCleanBefore.setFarmId(String.valueOf(farmId));
            billCleanBefore.setDepartureId(departureId);
            billCleanBefore.setDepartureName(departureName);
            billCleanBefore.setMidId(midId);
            billCleanBefore.setMidName(midName);
            billCleanBefore.setFarmName(farmName);
            return billCleanBefore;
        } else{
            BillGoodsInventory billCleanBefore = new BillGoodsInventory();
            billCleanBefore.setVistitType(vistitType);
            billCleanBefore.setDestName(destName);
            billCleanBefore.setDestId(destId);
            billCleanBefore.setAdmissionUserName(userName);
            billCleanBefore.setAdmissionUserId(userId);
            billCleanBefore.setVistitDate(vistitDate);
            billCleanBefore.setSubDate(LocalDateTime.now());
            billCleanBefore.setPhone(phone);
            billCleanBefore.setTestLocation(locationName);
            billCleanBefore.setTestLocationId(locationId);
            billCleanBefore.setBillAdmission(processId);
            billCleanBefore.setFarmId(String.valueOf(farmId));
            billCleanBefore.setDepartureId(departureId);
            billCleanBefore.setDepartureName(departureName);
            billCleanBefore.setProcessId(processId);
            billCleanBefore.setMidId(midId);
            billCleanBefore.setMidName(midName);
            billCleanBefore.setFarmName(farmName);
            return billCleanBefore;
        }
    }
}
