public class BidAnnouncementController {
    @AuraEnabled
    public static InitData BidAnnouncementController (String recordId){
        InitData res = new initData();
        try{
            Bid_Announcement__c report = [SELECT 	Id FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    //中标通知书 申请
    @AuraEnabled
    public static String ApplyFor(String recordId) {
        String messageText = '';
        try {
        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Request_flag__c,Request_user__c,Request_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
        Bid_Announcement.Id = Bid_Announcement.Id;
        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_ApplyFor;
        Bid_Announcement.Request_flag__c = true;
        Bid_Announcement.Request_user__c = Userinfo.getUserId();
        Bid_Announcement.Request_date__c = Datetime.now();
        update Bid_Announcement;
        messageText = '1';
        return messageText;
        } catch (Exception ex) {
        System.debug(LoggingLevel.INFO, '*** ApplyForXu: ' + ex);
        messageText = ex.getMessage();
        return messageText;
        }
    }
    //中标通知书 同意
    @AuraEnabled
    public static String ConSent(String recordId) {
        String messageText = '';
        try {
        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Complete__c,Agree_user__c,Complete_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
        Bid_Announcement.Id = Bid_Announcement.Id;
        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_Consent;
        Bid_Announcement.Complete__c = true;
        Bid_Announcement.Agree_user__c = Userinfo.getUserId();
        Bid_Announcement.Complete_date__c = Datetime.now();
        update Bid_Announcement;
        messageText = '1';
        return messageText;
        } catch (Exception ex) {
        System.debug(LoggingLevel.INFO, '*** ConsentXu: ' + ex);
        messageText = ex.getMessage();
        return messageText;
        }
    }
    //中标通知书 驳回
    @AuraEnabled
    public static String Reject(String recordId) {
        String messageText = '';
        try {
        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Complete__c,Agree_user__c,Complete_date__c,Request_flag__c,Request_user__c,Request_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
        Bid_Announcement.Id = Bid_Announcement.Id;
        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_Reject;
        Bid_Announcement.Complete__c = false;
        Bid_Announcement.Agree_user__c = null;
        Bid_Announcement.Complete_date__c = null;
        Bid_Announcement.Request_flag__c = false;
        Bid_Announcement.Request_user__c = null;
        Bid_Announcement.Request_date__c = null;
        update Bid_Announcement;
        messageText = '1';
        return messageText;
        } catch (Exception ex) {
        System.debug(LoggingLevel.INFO, '*** Reject: ' + ex);
        messageText = ex.getMessage();
        return messageText;
        }
    }
    //获取当前登录人的 id
    @AuraEnabled
    public static UserResult UserInfo_Owner() {
        UserResult result = new UserResult();
        ID myUserID = UserInfo.getUserId();
        try { 
            User tempUser = [select id,BidCancel__c from user where id = : myUserID ];
            result.id = tempUser.id;
            result.BidCancel = tempUser.BidCancel__c;
        } catch (exception e) {
            result.result = e.getMessage();
        }
        return result;
    }
    public class InitData{
        @AuraEnabled
        public String Id;
    }
    public class UserResult {
        @AuraEnabled
        public string result;
        public UserResult( ) {
            result = 'Success';
        }
        @AuraEnabled
        public string id;
        @AuraEnabled
        public Boolean BidCancel;
    }
}