public with sharing class taskAlertController {
    public Integer myTaskNumber { get; set; }
    public Integer myAllTaskNumber { get; set; }
    public Integer subTaskNumber { get; set; }
    public Integer UnfinishedTaskNumber { get; set; } 
    public Integer opportunityTasksNumber {get; set;}
    public Integer opplostTasksNumber {get; set;}
    public Integer subOpportunityTasksNumber {get; set;}
    public Integer subopplostTasksNumber {get; set;}

    //2021-05-19 招投标项目--页面提醒  mzy  start
    public Integer myTBCNumber { get; set; }
    public Integer myTBRNumber { get; set; }
    public Integer myTBBNumber { get; set; }


    //lwt  20231212 DB202311717846 start
    // lwt  add 耗材协议所有人是助理的数量
    public Integer myMOANumber { get; set; }
    //lwt  20231212 DB202311717846 end

    //2021-05-19 招投标项目-- 页面提醒 mzy  end
    // 2023-10-16 zq 招投标项目--页面提醒  start
    public Integer myOBSATBCNumber { get; set; }
    public List<Integer> myOBSATSixList { get; set; }
    public Integer myOBSATSixListNumber { get; set; }
    // 2023-10-16 zq 招投标项目--页面提醒  end

    //2021-11-09 SWAG-C8KCZZ  mzy  start
    public Boolean isTwoSOne {get;set;}
    public Integer OppWithoutConformNumber {get;set;}
    //2021-11-09  SWAG-C8KCZZ mzy  end

    public Integer feedbackNumber{ get; set; } // 2021-11-04 yjk 待反馈
    public Integer OverFeedbackNumber{ get; set; } // 2021-11-17 mzy 反馈Over
    //2021-11-23 mzy 共通平台项目-首页修改  start
    public Boolean isShowInquiry {get;set;}
    public Integer InquiryNumber{ get; set; } 
    //2021-11-23 mzy 共通平台项目-首页修改  end

    //2022-4-19 yjk FSE共通平台项目 start
    public Integer InquiryNumberFSE{ get; set; } 
    //2022-4-19 yjk FSE共通平台项目 end

    //2022-5-13 yjk 助理待跟进咨询单 start
    public Integer InquiryNumberZhuli{ get; set; } 
    //2022-5-13 yjk 助理待跟进咨询单 end

    //2022-3-17 yjk 根据简档显示任务提醒
    public Boolean isShowTask{get;set;}
    public String proId{get;set;}

    
    public Boolean Is2M4{get;set;} // 20221213 ljh SWAG-CK28WT

    public taskAlertController() {
        Is2M4 = false;
    }
    public PageReference init() {
        //2022-3-17 yjk 根据简档显示任务提醒
        proId = UserInfo.getProfileId();
        if(UserInfo.getProfileId() == System.Label.ProfileId_OBA1zbjd ){
            isShowTask = false;
        }else{
            isShowTask = true;
        }
        // 20221013 ljh SWAG-CK28WT start
        String p_2M4 = System.Label.ProfileId_2M4;
        if(proId.substring(0,15) == p_2M4.substring(0,15)){
            Is2M4 = true;
        }
        // 20221013 ljh SWAG-CK28WT end
        Date today = Date.today();
        Date firstDate = Date.newInstance(today.year(), today.month(), 1);

        //2021-09-28  mzy  任务管理改善  start
        taskManageController.Task  allTask =
            taskManageController.getCurrentTask(null, null, '01 分配', null, null, null,null,
                                                null, null, null, '01 分配', null , null, null,null);
        system.debug('allTask：' + allTask.myTasks.size());
        //2021.9.18 pk statr
        taskManageController.Task  UnfinishedTasks =
            taskManageController.getCurrentTask(null, null, '02 接受', null, null, null,null,
                                                null, null, null, '02 接受', null , null, null,null);
        //2021-09-28  mzy  任务管理改善  end
        system.debug('UnfinishedTasks：' + UnfinishedTasks.myTasks.size());
        //2021.9.18 pk end

        //20220624 sx 询价跟进任务   失单报告任务  taskDifferent__c '被动任务'    taskStatus__c  '02 接受'
    taskManageController.Task opportunityTasks = 
    taskManageController.getCurrentTask(null,'中标结果确认', '02 接受' , null, null, null, null, 
                       null, '中标结果确认', null, '02 接受', null, null, null, null);

        taskManageController.Task opplostTasks = 
        taskManageController.getCurrentTask(null,'失单报告任务', '02 接受' , null, null, null, null, 
                                            null, '失单报告任务', null, '02 接受', null, null, null, null);


        system.debug('==========subTask=======' + opplostTasks.subTasks);
        system.debug('==========subTask=======' + opportunityTasks.subTasks);

        system.debug('====================opplostTasks:' + opplostTasks.myTasks.size());                 
        system.debug('opportunityTasks' + opportunityTasks.myTasks.size());
    //20220624 sx 询价跟进任务end

        myTaskNumber = allTask.myTasks == null ? 0 : allTask.myTasks.size();
        subTaskNumber = allTask.subTasks == null ? 0 : allTask.subTasks.size();

        //2021.9.18 增加未完成任务数量显示 pk statr
        unfinishedTaskNumber = UnfinishedTasks.myTasks == null ? 0 : UnfinishedTasks.myTasks.size();
        //2021.9.18 增加未完成任务数量显示 pk end

        //20220624 sx 询价跟进任务  taskDifferent__c '被动任务'    taskStatus__c  '02 接受'
        opportunityTasksNumber = opportunityTasks.myTasks == null ? 0 : opportunityTasks.myTasks.size();
        opplostTasksNumber = opplostTasks.myTasks == null ? 0 : opplostTasks.myTasks.size();
        subOpportunityTasksNumber = opportunityTasks.subTasks == null ? 0 : opportunityTasks.subTasks.size();
        subopplostTasksNumber = opplostTasks.subTasks == null ? 0 : opplostTasks.subTasks.size();
        //20220624 sx 询价跟进任务end

        // taskManageController.Task  myallTask =
        //     taskManageController.getMyTask(null, null,
        //                                    '01 分配', null,
        //                                    null, null);
        // myAllTaskNumber = myallTask.myTasks == null ? 0 : myallTask.myTasks.size();

        //2021-05-19 招投标项目--页面提醒  mzy  start
        TenderManageController.TenderInformation MyTender = 
            TenderManageController.getCurrentTenderInformation();

        //lwt  20231212 DB202311717846 start
        Integer MyMOANumberT = 
            TenderManageController.goModifyOwnerAgreementInfomation();
        //lwt  20231212 DB202311717846 end
        system.debug('MyTender--TBC:'+MyTender.MyTBCTender.size()); 
        system.debug('MyTender--TBC--zq--:'+MyTender.MyTBCTender); 
        system.debug('MyTender--TBR:'+MyTender.MyTBRTender.size()); 
        system.debug('MyTender--TBB:'+MyTender.MyTBBTender.size()); 
        //待确认的招投标项目
        myTBCNumber =  MyTender.MyTBCTender.size();
        //待关联询价的招投标项目
        myTBRNumber =  MyTender.MyTBRTender.size();
        //待应标的招投标项目
        myTBBNumber =  MyTender.MyTBBTender.size();


        //lwt  20231212 DB202311717846 start
        myMOANumber = MyMOANumberT;
        system.debug('MyMOANumberT--MyTDPTenderTransf:'+MyMOANumberT); 
        //lwt  20231212 DB202311717846 end

        //2021-05-19 招投标项目-- 页面提醒 mzy  end

        //OBSA 千里马六大区
        TenderManageController.TenderInformation OBSATender = 
            TenderManageController.getOBSATenderInformation();
        // 2023-10-16 待确认的招投标项目-全国 OBSA
        myOBSATBCNumber =  OBSATender.MyOBSATender.size();
        // 2023-10-18  OBSA 千里马 六大区
        myOBSATSixListNumber = OBSATender.MyOBSASixAreasTender.size();
        myOBSATSixList = OBSATender.MyOBSASixAreasTender;
        // myOBSATSixList = OBSATender.MyOBSASixAreasTender.size() > 0 ? OBSATender.MyOBSASixAreasTender : null;


        //2021-11-04 yjk 待反馈任务 start
                //2021-09-28  mzy  任务管理改善  start
        taskFeedbackController.Task  allFeedbackTask =
            taskFeedbackController.getFeedbackTask(null, null, null, null, null, null,null,
                                                null, null, null, null, null , null, null,null);
        feedbackNumber = allFeedbackTask.myTasks == null ? 0 : allFeedbackTask.myTasks.size();
        //2021-11-04 yjk 待反馈任务 end 

        //2021-11-17  mzy  任务管理改善  start
        //已反馈的任务
        List<Task__c> OverFeedbackTaskList = taskFeedbackController.getOverFeedbackTask();
        OverFeedbackNumber = OverFeedbackTaskList == null ? 0 : OverFeedbackTaskList.size();
        //2021-11-17  mzy  任务管理改善  end


        //2021-11-08 mzy  SWAG-C8KCZZ start
        AgencyOpportunityManageCotroller.AgencyOpportunityView AOView = 
            AgencyOpportunityManageCotroller.getCurrentAgencyOpportunity();
            if(AOView.isShow){
                this.isTwoSOne = AOView.isShow;
                this.OppWithoutConformNumber = AOView.AgencyOpportunityList.size();
            }else{
                this.isTwoSOne = false;
                this.OppWithoutConformNumber = 0;
            }
        //2021-11-08 mzy  SWAG-C8KCZZ  end
        //2021-11-23 mzy 共通平台项目-首页修改  start      

        //2022-4-19 yjk SWAG-CBUB2W start
        List<String> profileIdList = new List<String>();
        profileIdList.add(System.Label.ProfileId_2S1);
        profileIdList.add(System.Label.ProfileIdN_2S1);
        profileIdList.add(System.Label.ProfileId_2S4);
        profileIdList.add(System.Label.ProfileId_2S4_Chief);
        profileIdList.add(System.Label.ProfileId_2S5);
        profileIdList.add(System.Label.ProfileId_2S6);
        profileIdList.add(System.Label.ProfileId_2S8);
        profileIdList.add(System.Label.ProfileId_2S10);
        
        if( profileIdList.contains(UserInfo.getProfileId())){
            //2022-4-22 yjk 修改查询逻辑
            List<Inquiry_form__c> InquiryNumberFSEList = [select id from Inquiry_form__c where Service_Status__c = '01.未跟进' and     FSE_Owner__c =:UserInfo.getUserId()];
            InquiryNumberFSE = InquiryNumberFSEList.size();
        }
            
        //2022-5-13 yjk 助理待跟进咨询单 start 2022-5-30 yjk增加判断
        InquiryNumberZhuli = 0;
        if(System.Label.ProfileId_2S6.equals(UserInfo.getProfileId())){
            List<Inquiry_form__c> InquiryNumberZhuliList = [select id from Inquiry_form__c where IfGotoDepartment__c = false and (GI_assistant__c =:UserInfo.getUserId() or SP_assistant__c =:UserInfo.getUserId() )];
            InquiryNumberZhuli = InquiryNumberZhuliList.size();
        }
        //2022-5-13 yjk 助理待跟进咨询单 end
        LeadIntentionController LeadIntController = new LeadIntentionController();
        LeadIntController.init();
        Integer pclCount = LeadIntController.pclCount;
        system.debug('pclCount--------------------'+pclCount);
        if(pclCount>0){
            InquiryNumber = pclCount;
            isShowInquiry = true;
        }else{
            isShowInquiry = false;
            InquiryNumber = 0;
        }
        
        //2022-4-19 yjk SWAG-CBUB2W end
        //2021-11-23 mzy 共通平台项目-首页修改  end 
        
        return null;
    }
}