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/SetPersonalTargetController.cls |   83 +++++++++++++++++++++++++++--------------
 1 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/force-app/main/default/classes/SetPersonalTargetController.cls b/force-app/main/default/classes/SetPersonalTargetController.cls
index b5dc5f2..fd2a244 100644
--- a/force-app/main/default/classes/SetPersonalTargetController.cls
+++ b/force-app/main/default/classes/SetPersonalTargetController.cls
@@ -228,7 +228,7 @@
         // 鑱蜂綅
         if (plist == null) {
             plist = new List<Position>();
-            plist.add(new Position('涓�鑸�', true));
+            plist.add(new Position('涓撳憳', true));  //20220517 lt SWAG-CD28H3
             plist.add(new Position('楂樼骇', true));
             plist.add(new Position('涓荤', true));
             //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
@@ -435,8 +435,9 @@
                         String sf = csvRecordData[1].replace(' ', '');
                         String dandang = csvRecordData[3].replace(' ', '');
                         String zw = csvRecordData[4].replace(' ', '');
-                        UserInfoList.add(bu + sf + dandang + zw);
-                        szMap.put(bu + sf + dandang + zw, csvRecordData);
+                        String key_flg = (bu + sf + dandang + zw).replaceAll('"', '');
+                        UserInfoList.add(key_flg);
+                        szMap.put(key_flg, csvRecordData);
                         sfs.add(sf);//鎶婄渷浠芥斁杩涘幓
                         bus.add(bu);//鏈儴
                         zws.add(zw);//鑱屼綅
@@ -486,30 +487,30 @@
                     List<String> csvRecordData = szMap.get(key);
                     Amount_Major_Product__c upsertAMP = new Amount_Major_Product__c();
                     //鑾峰彇瀵煎叆鏁伴噺
-                    Decimal GI_Amount = String.isNotBlank(csvRecordData[GI_Number]) ? Decimal.valueof(csvRecordData[GI_Number]) : 0.00;
+                    Decimal GI_Amount = String.isNotBlank(csvRecordData[GI_Number]) && String.isNotBlank(csvRecordData[GI_Number].replaceAll('"', '')) ? Decimal.valueof(csvRecordData[GI_Number].replaceAll('"', '')) : 0.00;
                      
                     DataSplicing(GI_Amount,userid + '_GI',Amount_Major_ProductMap1,userinfors);
                     
-                    Decimal ET_Amount = String.isNotBlank(csvRecordData[ET_Number]) ? Decimal.valueOf(csvRecordData[ET_Number]) : 0.00;
+                    Decimal ET_Amount = String.isNotBlank(csvRecordData[ET_Number]) && String.isNotBlank(csvRecordData[ET_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ET_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(ET_Amount,userid + '_ET',Amount_Major_ProductMap1,userinfors);
                     
-                    Decimal BF_Amount = String.isNotBlank(csvRecordData[BF_Number]) ? Decimal.valueOf(csvRecordData[BF_Number]) : 0.00;
+                    Decimal BF_Amount = String.isNotBlank(csvRecordData[BF_Number]) && String.isNotBlank(csvRecordData[BF_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[BF_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(BF_Amount,userid + '_BF',Amount_Major_ProductMap1,userinfors);
                     
-                    Decimal GS_Amount = String.isNotBlank(csvRecordData[GS_Number]) ? Decimal.valueOf(csvRecordData[GS_Number]) : 0.00;
+                    Decimal GS_Amount = String.isNotBlank(csvRecordData[GS_Number]) && String.isNotBlank(csvRecordData[GS_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GS_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(GS_Amount,userid + '_GS',Amount_Major_ProductMap1,userinfors);
                    
-                    Decimal URO_Amount = String.isNotBlank(csvRecordData[URO_Number]) ? Decimal.valueOf(csvRecordData[URO_Number]) : 0.00;
+                    Decimal URO_Amount = String.isNotBlank(csvRecordData[URO_Number]) && String.isNotBlank(csvRecordData[URO_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[URO_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(URO_Amount,userid + '_URO',Amount_Major_ProductMap1,userinfors);
                     
-                    Decimal GYN_Amount = String.isNotBlank(csvRecordData[GYN_Number]) ? Decimal.valueOf(csvRecordData[GYN_Number]) : 0.00;
+                    Decimal GYN_Amount = String.isNotBlank(csvRecordData[GYN_Number]) && String.isNotBlank(csvRecordData[GYN_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GYN_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(GYN_Amount,userid + '_GYN',Amount_Major_ProductMap1,userinfors);
                    
-                    Decimal ENT_Amount = String.isNotBlank(csvRecordData[ENT_Number]) ? Decimal.valueOf(csvRecordData[ENT_Number]) : 0.00;
+                    Decimal ENT_Amount = String.isNotBlank(csvRecordData[ENT_Number]) && String.isNotBlank(csvRecordData[ENT_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ENT_Number].replaceAll('"', '')) : 0.00;
                     DataSplicing(ENT_Amount,userid + '_ENT',Amount_Major_ProductMap1,userinfors);
                     system.debug('ENG_Number--->'+csvRecordData[ENG_Number]);
                     //鍥犱负鏈�鍚庝竴鍒楁暟鎹湁绌烘牸锛屾墍浠ュ姞.trim()
-                    Decimal ENG_Amount = String.isNotBlank(csvRecordData[ENG_Number]) ? Decimal.valueOf(csvRecordData[ENG_Number].trim()) : 0.00;
+                    Decimal ENG_Amount = String.isNotBlank(csvRecordData[ENG_Number]) && String.isNotBlank(csvRecordData[ENG_Number].replaceAll('"', ''))? Decimal.valueOf(csvRecordData[ENG_Number].replaceAll('"', '').trim()) : 0.00;
                     // Decimal.valueOf(String str)
                     DataSplicing(ENG_Amount,userid + '_ENG',Amount_Major_ProductMap1,userinfors);
                     
@@ -605,7 +606,7 @@
     }
     private List<User> getUserList(List<String> UserInfoList) {//鏍规嵁涓婁紶鏂囦欢涓緱鏈儴锛岀渷浠斤紝鎷呭綋锛岃亴浣� 寰楀埌浜唘ser 淇℃伅
         String soql = 'select Id, UserInfos__c, Salesdepartment__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
-                      + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, Post__c,Job_Category__c'
+                      + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, HR_Post__c,Job_Category__c'
                       + ' from User where IsActive = true and Test_staff__c = false and UserType = \'Standard\' '
                       + ' and Salesdepartment__c <> \'7.鑳介噺\' '
                       + ' and UserInfos__c IN :UserInfoList order by Salesdepartment__c, Province__c';
@@ -658,6 +659,7 @@
         ref.setRedirect(true);
         return ref;
     }
+    /** 20220613 WLIG-CER9NQ you 椤甸潰涓嬁鎺夋敼鎴恇atch鎵ц
     // 2020/06/05 SWAG-BQ7CM9 鐐瑰嚮鏇存柊鎸夐挳 by ljh
     public Pagereference UpdateBtn() {
         system.debug('=====UpdateBtn-1');
@@ -670,7 +672,7 @@
         }
         return null;
     }
-
+    **/
     // 鐐瑰嚮杩斿洖鎸夐挳
     public Pagereference backBtn() {
         // HOME銇埢銈�
@@ -717,7 +719,7 @@
     // 銉︺兗銈躲伄妞滅储
     private List<User> getUserList(Boolean searchByDpt, Boolean searchByProvince, Boolean defaultSearch) {
         String soql = 'select Id, Salesdepartment__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
-                      + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, Post__c'
+                      + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, HR_Post__c'
                       + ' from User where IsActive = true and Test_staff__c = false and UserType = \'Standard\' '
                       // CHAN-BBLCYP 20190509 LHJ Start
                       + ' and Salesdepartment__c <> \'7.鑳介噺\' ';
@@ -766,9 +768,28 @@
 
         // 鑱蜂綅鏉′欢
         List<String> positionNames = new List<String>();
+        String s1 = '缁忕悊';
+        String s2 = '鎬荤洃';
         for (Position p : plist) {
             if (p.check) {
-                positionNames.add(p.positionName);
+                //positionNames.add(p.positionName);
+                //20220406 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
+                //20220517 lt SWAG-CD28H3  娉ㄩ噴
+                if(p.positionName == '楂樼骇'){
+                    positionNames.add('楂樼骇涓撳憳');
+                }else{
+                    positionNames.add(p.positionName);
+                }
+                // if(p.positionName == '缁忕悊绾�'){
+                //     positionNames.add('鍓粡鐞�');
+                //     positionNames.add('缁忕悊');
+                // }
+                // if(p.positionName == '鎬荤洃绾�'){
+                //     positionNames.add('鍓儴闀�');
+                //     positionNames.add('閮ㄩ暱');
+                //     positionNames.add('鎬荤洃');
+                // }
+                //20220406 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀筫nd
             }
         }
         if (positionNames.size() > 0) {
@@ -776,25 +797,29 @@
             soql += ' and (';
             for (Integer i = 0; i < positionNames.size(); i++) {
                 if (i == positionNames.size() - 1) {
-                    soql += ' Post__c = \'' + positionNames[i] + '\'';
-                    //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
-                    if(positionNames[i] == '缁忕悊绾�'){
-                        soql += ' or Post__c = \'鍓粡鐞哱' or Post__c = \'缁忕悊\'';
+                    //20220517 lt SWAG-CD28H3 Start
+                    if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+                        soql += ' HR_Post__c = \'' + positionNames[i] + '\'';
                     }
-                    if(positionNames[i] == '鎬荤洃绾�'){
-                        soql += ' or Post__c = \'鍓儴闀縗' or Post__c = \'閮ㄩ暱\' or Post__c = \'鎬荤洃\'';
+                    else if(positionNames[i] == '缁忕悊绾�'){
+                        soql += ' HR_Post__c like \'%' + s1 + '%\'';
                     }
-                    //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� end
+                    else if(positionNames[i] == '鎬荤洃绾�'){
+                        soql += ' HR_Post__c like \'%' + s2 + '%\'';
+                    }
+                    //20220517 lt SWAG-CD28H3 End
                 } else {
-                    soql += ' Post__c = \'' + positionNames[i] + '\' or';
-                    //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
-                    if(positionNames[i] == '缁忕悊绾�'){
-                        soql += ' Post__c = \'鍓粡鐞哱' or Post__c = \'缁忕悊\' or ';
+                    //20220517 lt SWAG-CD28H3 Start
+                    if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+                        soql += ' HR_Post__c = \'' + positionNames[i] + '\' or';
                     }
-                    if(positionNames[i] == '鎬荤洃绾�'){
-                        soql += ' Post__c = \'鍓儴闀縗' or Post__c = \'閮ㄩ暱\' or Post__c = \'鎬荤洃\'';
+                    else if(positionNames[i] == '缁忕悊绾�'){
+                        soql += ' HR_Post__c like \'%' + s1 + '%\' or';
                     }
-                    //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� end
+                    else if(positionNames[i] == '鎬荤洃绾�'){
+                        soql += ' HR_Post__c like \'%' + s2 + '%\' or';
+                    }
+                    //20220517 lt SWAG-CD28H3 End
                 }
             }
             soql += ')';

--
Gitblit v1.9.1