/*lexSelectAssetEstimateVMController 方法权限*/
public without sharing class lexSelectAssetEstimateUtil {

    public static void NextMaintenanceContract(List<lexSelectAssetEstimateVMController.AssetInfo> checkedAssets,Maintenance_Contract__c contract) {
        // 20220810 询价2期开发
        List<String> asslocalList = new List<String>();
        List<String> mcalocalList = new List<String>();
        Map<Id, Maintenance_Contract__c> map3 = new Map<Id, Maintenance_Contract__c>();
        
        List<Maintenance_Contract_Asset__c> mcaupdateList = new List<Maintenance_Contract_Asset__c>();
        for (lexSelectAssetEstimateVMController.AssetInfo ass : checkedAssets) {
            if (!ass.isManual) {
                asslocalList.add(ass.rec.Id);
                map3.put(ass.rec.Id,contract);
            }
        }
         List<Maintenance_Contract_Asset__c> mcalist1 = [SELECT id,Asset__c,Next_Maintenance_Contract__c,Maintenance_Contract__c
                                             FROM Maintenance_Contract_Asset__c
                                            WHERE id IN (SELECT CurrentContract_F_asset__c
                                                                FROM asset
                                                                WHERE id IN :asslocalList AND CurrentContract_F_asset__c!=null)];
        for (Maintenance_Contract_Asset__c mca : mcalist1) {
            Maintenance_Contract_Asset__c mca3 = new Maintenance_Contract_Asset__c();
            if (map3.containsKey(mca.Asset__c)) {
                mca3.id = mca.id;
                mca3.Next_Maintenance_Contract__c = map3.get(mca.Asset__c).id;
                if (mca3.id!=null&&!mcaupdateList.contains(mca3)) {
                    mcaupdateList.add(mca3);
                }
            }
        }
        System.debug('mcaupdateList====%%%' +mcaupdateList);
        if (mcaupdateList!=null&&!mcaupdateList.isEmpty()) {
            update mcaupdateList;
        }    
    }

}