From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/AdvanceOpportunityController.cls |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/classes/AdvanceOpportunityController.cls b/force-app/main/default/classes/AdvanceOpportunityController.cls
index 2f7b003..8096e4e 100644
--- a/force-app/main/default/classes/AdvanceOpportunityController.cls
+++ b/force-app/main/default/classes/AdvanceOpportunityController.cls
@@ -1,22 +1,35 @@
+// 娴嬭瘯绫� AdvanceOpportunityTest
 public with sharing class AdvanceOpportunityController {
     public AdvanceOpportunityController(ApexPages.StandardController stdController) {
         AdOpportunity = new Advance_Opportunity__c();
     }
     public Advance_Opportunity__c AdOpportunity{get; set;}
+    public Boolean hasError { get; private set; }
+    public String aoId {get; set;}
     public void init(){
-    	String aoId = ApexPages.currentPage().getParameters().get('id');
-    	List<Advance_Opportunity__c> aoList = [SELECT Id,MarketAdvance__c,AddOpportunity__c,BigContract__c,GradePro__c,AddPrice__c,Opportunity__c FROM Advance_Opportunity__c WHERE Opportunity__c = :aoId];
-    	if (aoList.size() == 0) {
-    	    
-    	} else{
-    		AdOpportunity = aoList[0];
-    	}
+        aoId = ApexPages.currentPage().getParameters().get('id');
+        // 20220620 ljh  update SWAG-CFK9YX  start
+        // List<Advance_Opportunity__c> aoList = [SELECT Id,MarketAdvance__c,AddOpportunity__c,BigContract__c,GradePro__c,AddPrice__c,Opportunity__c FROM Advance_Opportunity__c WHERE Opportunity__c = :aoId];
+        List<Advance_Opportunity__c> aoList = [SELECT Id,MarketAdvance__c,KeepPushing__c,BigContract__c,GradePro__c,AddPrice__c,Opportunity__c FROM Advance_Opportunity__c WHERE Opportunity__c = :aoId];
+        // 20220620 ljh  update SWAG-CFK9YX  edn
+        if (aoList.size() == 0) {
+            
+        } else{
+            AdOpportunity = aoList[0];
+        }
     }
     public void save(){
-    	if (String.isBlank(AdOpportunity.Opportunity__c)) {
-    		AdOpportunity.Opportunity__c = ApexPages.currentPage().getParameters().get('id');
-    	}
-    	// AdOpportunity.Name = 'ceshi';
-    	upsert AdOpportunity;
+        hasError = true;
+        try {
+            if (String.isBlank(AdOpportunity.Opportunity__c)) {
+                AdOpportunity.Opportunity__c = aoId;
+            }
+            // AdOpportunity.Name = 'ceshi';
+            upsert AdOpportunity;
+            hasError=false;
+        } catch (Exception ex) {
+            system.debug('=====' + ex.getMessage());
+            ApexPages.addMessages(ex);
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1