高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
global without sharing class upagencyOppBusinessconfirmation {
    WebService static String Businessconfirmation(String agoppId) {
        if (!UserInfo.getProfileId().equals(System.label.ProfileId_2S1) && 
            !UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)) {
            return '您不是营业担当,无法确认。';
        }
        Agency_Opportunity__c ao = [select id,Business_confirmation__c 
        from Agency_Opportunity__c where id =:agoppId ];
        if (ao.Business_confirmation__c == true) {
            return '询价已经确认,不需要重复确认。';
        }else{
            ao.Business_confirmation__c = true;
            Savepoint sp = Database.setSavepoint();
            try{
                update ao;
                return '';
            }catch (Exception e) {
                Database.rollback(sp);
                throw e;
            }
        }
    }
}