package com.zt.plat.module.qms.business.bus.liteflow.slot;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCCoefficientDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCCoefficientParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementSampleParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustUnStandardProjectDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleAssessmentDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.bus.liteflow.param.AssignAssayUser;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class SampleTaskAssignContext {
    
    /** 租户id **/
    private Long tenantId;
    
    /** 当前时间 **/
    private LocalDateTime currentDateTime = LocalDateTime.now();

    /** 当前登录用户 **/
    private LoginUser loginUser;
    
    /** 当前登录人 **/
    private String loginRealname;
    
    /** 指派类型 **/
    private SampleTaskAssignTypeEnum SampleTaskAssignType;
	
	/** 分析方法id **/
	private Long assignConfigAssayMethodId;
	
	/** 分析类型 **/
	private String assayType;
	
	/** 分析任务数 **/
	private Integer assayTaskCount;
	
	/** 接受分配任务的人员 **/
	private List<AssignAssayUser> assignAssayUserList;
	
	/** 分析人员 **/
	private AssignAssayUser assignAssayUser;
	
	/** 待分析的样品id **/
	private List<Long> assignSampleIdList;
    
    /** 分析方法配置 **/
    private List<ConfigAssayMethodDO> configAssayMethodList;
    
    /** 检测任务id列表 **/
    private List<Long> assayTaskDataIdList;
    
    /** 检测任务项目id列表 **/
    private List<Long> assayProjectDataIdList;
    
    /** 样品委托无标准的检测项目id列表 **/
    private List<Long> sampleEntrustUnStandardProjectIdList;
    
    public ConfigAssayMethodDO getConfigAssayMethodById(Long id) {
    	ConfigAssayMethodDO configAssayMethod = null;
    	if (CollUtil.isNotEmpty(this.configAssayMethodList)) {
			configAssayMethod = this.configAssayMethodList.stream().filter(f -> f.getId().equals(id)).findFirst().orElse(null);
		}
    	return configAssayMethod;
    }
    
    private List<BusinessSubSampleDO> businessSubSampleList;
    
    public BusinessSubSampleDO getBusinessSubSampleById(Long id) {
    	BusinessSubSampleDO businessSubSample = null;
    	if (CollUtil.isNotEmpty(this.businessSubSampleList)) {
			businessSubSample = this.businessSubSampleList.stream().filter(f -> f.getId().equals(id)).findFirst().orElse(null);
		}
    	
    	return businessSubSample;
	}
    
    /** 保存分样判定 **/
    private List<BusinessSubParentSampleAssessmentDO> saveBusinessSubParentSampleAssessmentList;
    
    /** 保存子样判定 **/
    private List<BusinessSubSampleAssessmentDO> saveBusinessSubSampleAssessmentList;
    
    /** 保存子样检测任务 **/
    private List<BusinessAssayTaskDataDO> saveBusinessAssayTaskDataList;
    
    /** 更新子样检测任务 **/
    private List<BusinessAssayTaskDataDO> businessAssayTaskDataList;
    
    /** 保存子样检测任务参数 **/
    private List<BusinessAssayTaskParameterDataDO> saveBusinessAssayTaskParameterDataList;
    
    /** 保存子样检测任务项目 **/
    private List<BusinessAssayProjectDataDO> saveBusinessAssayProjectDataList;
    
    /** 保存子样检测任务项目参数 **/
    private List<BusinessAssayParameterDataDO> saveBusinessAssayParameterDataList;
    
    /** 保存非标检测项目 **/
    private List<BusinessSampleEntrustUnStandardProjectDO> saveBusinessSampleEntrustUnStandardProjectList;
    
    /** 更新非标检测项目 **/
    private List<BusinessSampleEntrustUnStandardProjectDO> updateBusinessSampleEntrustUnStandardProjectList;
    
    /** 保存任务指派单列表 **/
    private List<BusinessAssayTaskDO> saveBusinessAssayTaskList;
    
    /** 更新任务指派单列表 **/
    private List<BusinessAssayTaskDO> updateBusinessAssayTaskList;
    
    /** 任务指派的明细列表 **/
    private List<BusinessAssayTaskDetailDO> businessAssayTaskDetailList;
    
    /** 质控样-(空白、标准) **/
    private List<BusinessQCCoefficientDataDO> businessQCCoefficientDataList;
    
    /** 质控样-(空白、标准)检测参数数据 **/
    private List<BusinessQCCoefficientParameterDataDO> businessQCCoefficientParameterDataList;
    
    /** 质控样-（质控空白） **/
    private List<BusinessQCManagementDataDO> businessQCManagementDataDOList;
    
    /** 质控样-（质控空白）参数 **/
    private List<BusinessQCManagementSampleParameterDataDO> businessQCManagementSampleParameterDataDOList;
    
    /** 质控样-（质控空白）检测项目 **/
    private List<BusinessQCManagementProjectDataDO> businessQCManagementProjectDataDOList;

    /** 质控样-（质控空白）检测项目参数 **/
    private List<BusinessQCManagementParameterDataDO> businessQCManagementParameterDataDOList;


    /** 需要删除的分析任务 **/
    private List<Long> removeAssayTaskDataIdList;
    
	/** 需要删除的分析任务参数 **/
    private List<Long> removeAssayTaskParameterDataIdList;
    
	/** 需要删除的分析任务检测项目 **/
    private List<Long> removeAssayProjectIdList;
    
	/** 需要删除的分析任务检测项目参数 **/
    private List<Long> removeAssayParameterIdList;
    
    /** 需要删除的子样判定 **/
    private List<Long> removeSubSampleAssessmentIdList;
    
	/** 需要删除的分样判定 **/
    private List<Long> removeSubParentSampleAssessmentIdList;
}
