From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 15:10:02 +0800
Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte

---
 force-app/main/default/classes/DealerInquiryModifyStateController.cls |  125 +++++++++++++++++++++++++----------------
 1 files changed, 77 insertions(+), 48 deletions(-)

diff --git a/force-app/main/default/classes/DealerInquiryModifyStateController.cls b/force-app/main/default/classes/DealerInquiryModifyStateController.cls
index f65c671..d46bcca 100644
--- a/force-app/main/default/classes/DealerInquiryModifyStateController.cls
+++ b/force-app/main/default/classes/DealerInquiryModifyStateController.cls
@@ -1,23 +1,23 @@
 public with sharing class DealerInquiryModifyStateController {
     public List<OpportunityInfo> oppRecords { get; set; }
     // 銉氥兗銈搞儸銈ゃ偄銈︺儓銇儏鍫便倰鍙栧緱
-    private Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>();
+    private Map<String, Map<String, String>> editLayoutItemRWMap = new Map<String, Map<String, String>>();
     // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null;
     public List<OpportunityInfo> OPPORTList { get; set; }
     /*****************妞滅储鐢�******************/
 
     /*******************妫�绱㈠睘鎬у��*******************/
 
-    public String accSearch { get; set; }//缁忛攢鍟嗗尰闄�
-    public String aooSearch { get; set; }//鎷呭綋浜�
+    public String accSearch { get; set; } //缁忛攢鍟嗗尰闄�
+    public String aooSearch { get; set; } //鎷呭綋浜�
     public String numtext1 { get; set; } //鏁版嵁瀛楁01
-    public String numtext { get; set; }//鏁版嵁瀛楁03
+    public String numtext { get; set; } //鏁版嵁瀛楁03
     public String numtext2 { get; set; } //鏁版嵁瀛楁02
     public String timetext1 { get; set; } //鏃ユ湡01
     public String timetext2 { get; set; } //鏃ユ湡02
     public Agency_Opportunity__c tmpAO { get; set; } //妫�绱㈡棩鏈熺敤
     public Agency_Opportunity__c tmpBO { get; set; } //妫�绱㈡棩鏈熺敤
-    public String limits { get; set; }//鏃ユ湡03
+    public String limits { get; set; } //鏃ユ湡03
 
     public List<SelectOption> dateOpts { get; private set; }
     public List<SelectOption> textOpts { get; private set; }
@@ -34,24 +34,28 @@
     public String preSortKey { get; set; }
     public Boolean sortOrderAsc { get; set; }
     public String[] sortOrder { get; set; }
-    public String[] columus = new String[] {'Id'};
+    public String[] columus = new List<String>{ 'Id' };
     public String[] selColumus = null;
-    public Set<String> columusSet = new Set<String> {'Id'};
+    public Set<String> columusSet = new Set<String>{ 'Id' };
 
     // 椤圭洰set 瀛楁鏍囩
     public List<String> titleLeft { get; private set; }
     public List<String> titleRight { get; private set; }
     // 椤圭洰set 瀛楁鍚�
-    public List<List<String>> columnsLeftApi { get; private set; }         // 鍙傜収闋呯洰鐢�
-    public List<List<String>> columnsRightApi { get; private set; }        // 鍙傜収闋呯洰鐢�
-    public List<String> columnLeftCss { get; private set; }               // css 鐢�
-    public List<String> columnRightCss { get; private set; }              // css 鐢�
-    public Map<String, String> columnLeftRW { get; private set; }              // r,w,wm鐢�
-    public Map<String, String> columnRightRW { get; private set; }             // r,w,wm鐢�
+    public List<List<String>> columnsLeftApi { get; private set; } // 鍙傜収闋呯洰鐢�
+    public List<List<String>> columnsRightApi { get; private set; } // 鍙傜収闋呯洰鐢�
+    public List<String> columnLeftCss { get; private set; } // css 鐢�
+    public List<String> columnRightCss { get; private set; } // css 鐢�
+    public Map<String, String> columnLeftRW { get; private set; } // r,w,wm鐢�
+    public Map<String, String> columnRightRW { get; private set; } // r,w,wm鐢�
     private String strColumus;
     private String strRtColumus;
 
-    @TestVisible private String accTypeForSort = null;
+    //add by Link 2023-6-2
+    public String remindMsg { get; set; }
+
+    @TestVisible
+    private String accTypeForSort = null;
     private static Integer oppLimit = 500;
 
     public DealerInquiryModifyStateController() {
@@ -79,7 +83,7 @@
         textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly璇环闃舵'));
         //绮剧悽绉戞妧   zxk    2021-08-25   end
         textOpts.add(new SelectOption('Hospital_City_Master__c', '甯�'));
-        
+
         // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '閿�鍞湰閮�'));
         // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '鐪�'));
         // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '甯�'));
@@ -124,6 +128,7 @@
     }
 
     public PageReference init() {
+        remindMsg = '';
         PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap();
         soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element();
         soap.SessionHeader.sessionId = UserInfo.getSessionId();
@@ -155,7 +160,7 @@
             layoutItem.layoutComponents.add(layoutComponent);
             // return dlr;
         } else {
-            dlr  = soap.describeLayout('Agency_Opportunity__c', null, null);
+            dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
             // dlr  = soap.describeLayout('asdas', null, null);
         }
 
@@ -173,8 +178,11 @@
             for (PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections) {
                 for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) {
                     for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) {
-                        if (item.layoutComponents != null && item.layoutComponents.size() > 0
-                                && String.isBlank(item.layoutComponents[0].value) == false) {
+                        if (
+                            item.layoutComponents != null &&
+                            item.layoutComponents.size() > 0 &&
+                            String.isBlank(item.layoutComponents[0].value) == false
+                        ) {
                             rtnInner.put(item.layoutComponents[0].value, 'r');
                             if (item.editableForUpdate) {
                                 rtnInner.put(item.layoutComponents[0].value, 'w');
@@ -195,9 +203,10 @@
         return null;
     }
     //鐢ㄤ簬鑾峰彇缁忛攢鍟嗚浠峰瓧娈甸泦鍜岃浠峰瓧娈甸泦浠ュ強鐩稿簲鐨勮鍐欐潈闄�
-    @TestVisible private void setLayoutRWInfo() {
+    @TestVisible
+    private void setLayoutRWInfo() {
         if (this.sortOrder == null) {
-            selColumus = new String[] {};
+            selColumus = new List<String>{};
             strColumus = '';
             ID accRecordTypeId = accTypeForSort;
 
@@ -276,14 +285,14 @@
                     strRtColumus = strRtColumus + ',' + s;
                 }
                 columnRightCss.add(s.replace('.', '_'));
-
             }
             strColumus = String.join(columus, ',');
             System.debug('======-======-======strColumus' + strColumus);
             System.debug('======-======-======strRtColumus' + strRtColumus);
             this.sortOrderAsc = true;
-            this.sortOrder = new String[selColumus.size()];
-            for (Integer i = 0; i < selColumus.size(); i++) this.sortOrder[i] = '銆�';
+            this.sortOrder = new List<String>(selColumus.size());
+            for (Integer i = 0; i < selColumus.size(); i++)
+                this.sortOrder[i] = '銆�';
         }
     }
     //鐢ㄤ簬鎷兼帴SOQL璇彞 鏍规嵁涓嶅悓妫�绱㈡潯浠舵嫾鎺ヤ笉鍚孲OQL璇彞銆�
@@ -305,14 +314,17 @@
         // System.debug('pppqqq333'+querySoql);
         // AND Ownerid in ( '+querySoql+')'
 
-        String soql = 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' +
-                      strColumus + ',' + strRtColumus +
-                      ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' ';
+        String soql =
+            'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' +
+            strColumus +
+            ',' +
+            strRtColumus +
+            ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' ';
         //鏁版嵁瀛楁锛氱粡閿�鍟嗗尰闄�  +SOQL
         if (!String.isBlank(accSearch)) {
             accSearch = accSearch.trim();
             // soql += 'AND Agency__r.Name  '   + '  LIKE  \'%' + accSearch + '%\' ';
-            soql += 'AND Agency_Hospital__r.Name  '   + '  LIKE  \'%' + accSearch + '%\' ';
+            soql += 'AND Agency_Hospital__r.Name  ' + '  LIKE  \'%' + accSearch + '%\' ';
         }
         //鏁版嵁瀛楁锛氭媴褰撲汉  +SOQL
         if (!String.isBlank(aooSearch)) {
@@ -323,7 +335,7 @@
         //鏁版嵁瀛楁锛�03 鎵嬪姩濉啓椤� 鍑嗗璋冪敤makeTextSql锛�
         if (!String.isBlank(numtext)) {
             String newNumtext = numtext.trim();
-            String str = makeTextSql(numtext1,  numtext2,  newNumtext);
+            String str = makeTextSql(numtext1, numtext2, newNumtext);
             soql += str;
             System.debug('+++++++++++++=============++++++++++++++++++' + soql);
         }
@@ -333,9 +345,21 @@
             soql += ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits);
         } else {
             if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) {
-                soql += ' order by ' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+                soql +=
+                    ' order by ' +
+                    this.selColumus[Integer.valueOf(this.sortKey)] +
+                    ' ' +
+                    (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') +
+                    ' limit ' +
+                    Integer.valueOf(limits);
             } else {
-                soql += ' order by Change_To_Opportunity__r.' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+                soql +=
+                    ' order by Change_To_Opportunity__r.' +
+                    this.selColumus[Integer.valueOf(this.sortKey)] +
+                    ' ' +
+                    (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') +
+                    ' limit ' +
+                    Integer.valueOf(limits);
             }
         }
         system.debug(soql);
@@ -343,7 +367,7 @@
         // System.debug('pppqqq111'+userlist1);
 
         List<Agency_Opportunity__c> InfoList = Database.query(soql);
-        System.debug('+++++++-------------------'+InfoList);
+        System.debug('+++++++-------------------' + InfoList);
 
         // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql);
         // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c);
@@ -359,7 +383,6 @@
                     str = '\'' + agc.Change_To_Opportunity__r.Id + '\'';
                 } else if (agc.Change_To_Opportunity__r.Id != null) {
                     str += ',\'' + agc.Change_To_Opportunity__r.Id + '\'';
-
                 }
             }
             for (Agency_Opportunity__c info : InfoList) {
@@ -372,14 +395,24 @@
         //鏄剧ず鎻愮ず鎿嶄綔淇℃伅
         if (String.isBlank(this.saveType) && String.isBlank(this.sortKey)) {
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍙栧緱鏈�杩戠殑 ' + oppCount + ' 鏉℃暟鎹�'));
+            //add by Link 2023-6-2
+            remindMsg = '鍙栧緱鏈�杩戠殑 ' + oppCount + ' 鏉℃暟鎹�';
         } else if (!String.isBlank(this.sortKey)) {
             if (oppCount > oppLimit) {
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鏁版嵁瓒呰繃' + oppLimit + '浠讹紝鍙樉绀哄墠' + oppLimit + '浠�'));
+                ApexPages.addmessage(
+                    new ApexPages.message(ApexPages.severity.INFO, '鏁版嵁瓒呰繃' + oppLimit + '浠讹紝鍙樉绀哄墠' + oppLimit + '浠�')
+                );
+                //add by Link 2023-6-2
+                remindMsg = '鏁版嵁瓒呰繃' + oppLimit + '浠讹紝鍙樉绀哄墠' + oppLimit + '浠�';
             } else {
                 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�'));
+                //add by Link 2023-6-2
+                remindMsg = '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�';
             }
         } else {
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�'));
+            //add by Link 2023-6-2
+            remindMsg = '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�';
         }
     }
     //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒宠繘鍏ユ鏂规硶 鍒ゆ柇澶氱鎯呭喌
@@ -395,7 +428,6 @@
                 String cSql = '';
                 soql += ' AND (';
                 for (Integer icount = 0; icount < vals.size(); icount++) {
-
                     //绮剧悽绉戞妧   zxk    2021-08-25   start
                     String val = vals[icount];
                     if (equalOpts == 'contains') {
@@ -412,10 +444,8 @@
                             soql += ' AND ';
                         }
                     }
-
                 }
                 //绮剧悽绉戞妧   zxk    2021-08-25   end
-
 
                 //     String val = vals[icount];
                 //     cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
@@ -459,7 +489,6 @@
             else if (equalOpts == '=' || equalOpts == '<>') {
                 soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\'';
             }
-
             //绮剧悽绉戞妧   zxk    2021-08-25   start
             //璧峰瀛楃
             else if (equalOpts == 'starts with' && numtext.contains(' ')) {
@@ -468,15 +497,13 @@
                 for (Integer icount = 0; icount < vals.size(); icount++) {
                     String val = vals[icount];
                     if (equalOpts == 'starts with') {
-                        soql += ' ' + textOpts + '  LIKE  \'%' + val + '%\'' ;
+                        soql += ' ' + textOpts + '  LIKE  \'%' + val + '%\'';
                         if (icount < vals.size() - 1) {
                             soql += ' OR ';
-
                         }
                     }
                 }
                 soql += ')';
-
             }
             //绮剧悽绉戞妧   zxk    2021-08-25   end
 
@@ -497,22 +524,23 @@
         return soql;
     }
     //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒筹紝骞朵笖杩涘叆makeTextSql锛堬級涔嬪悗锛屽唴鍚暟鎹瓧娈靛寘鍚绉嶆椂杩涘叆姝ゆ柟娉曘��
-    @TestVisible private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
+    @TestVisible
+    private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
         String soql = '';
         if (!String.isBlank(textOpts)) {
             String tmpVal = val;
             if (!String.isBlank(tmpVal)) {
                 if (equalOpts == 'contains' || equalOpts == 'notcontains') {
                     if (equalOpts == 'contains') {
-                        soql += ' ' + textOpts + '  LIKE  \'%' + val + '%\'' ;
+                        soql += ' ' + textOpts + '  LIKE  \'%' + val + '%\'';
                     } else if (equalOpts == 'notcontains') {
-                        soql += ' ( NOT ' + textOpts + '  LIKE  \'%' + val + '%\' ) ' ;
+                        soql += ' ( NOT ' + textOpts + '  LIKE  \'%' + val + '%\' ) ';
                     }
                 } else if (equalOpts == '=' || equalOpts == '<>') {
                     if (equalOpts == '=') {
-                        soql += ' AND ' + textOpts + ' = ' + val ;
+                        soql += ' AND ' + textOpts + ' = ' + val;
                     } else if (equalOpts == '<>') {
-                        soql += ' AND ' + textOpts + ' <> ' + val ;
+                        soql += ' AND ' + textOpts + ' <> ' + val;
                     }
                 }
             } else {
@@ -551,7 +579,6 @@
                 if (oi.changeFlg == '1') {
                     oi.changeFlg = '0';
                     updTarget.add(oi.AgcOpp);
-
                 }
                 // if (oi.changeFlgRt == '1' && oi.opp.id != null) {
                 //     oi.changeFlgRt = '0';
@@ -559,13 +586,15 @@
                 // }
             }
             if (updTarget.size() > 0) {
-                system.debug('updTarget.size:' + updTarget.size() );
+                system.debug('updTarget.size:' + updTarget.size());
                 update updTarget;
             }
             // if (updOpps.size() > 0) {
             //     update updOpps;
             // }
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨瀹屼簡'));
+            //add by Link 2023-6-2
+            remindMsg = '淇濆瓨瀹屼簡';
         } catch (Exception e) {
             //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇风‘瀹氱瀹ゅ垎绫诲拰浜у搧鍖哄垎鐨勫叧绯�'));
         }
@@ -627,4 +656,4 @@
             AgcOpp = record;
         }
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1