From 8badb57ea2c82557850ad5b39281c3e8714eb119 Mon Sep 17 00:00:00 2001
From: liuyan <liuyan@prec-tech.com>
Date: 星期四, 24 十一月 2022 10:08:31 +0800
Subject: [PATCH] 科室信息漏传SPO问题

---
 force-app/main/default/classes/SetPersonalTargetController.cls |   66 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/classes/SetPersonalTargetController.cls b/force-app/main/default/classes/SetPersonalTargetController.cls
index a267071..1e37e85 100644
--- a/force-app/main/default/classes/SetPersonalTargetController.cls
+++ b/force-app/main/default/classes/SetPersonalTargetController.cls
@@ -228,13 +228,17 @@
         // 鑱蜂綅
         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));
-            plist.add(new Position('鍓粡鐞�', true));
-            plist.add(new Position('缁忕悊', false));
-            plist.add(new Position('鍓儴闀�', false));
-            plist.add(new Position('閮ㄩ暱', false));
+            //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
+            // plist.add(new Position('鍓粡鐞�', true));
+            // plist.add(new Position('缁忕悊', false));
+            // plist.add(new Position('鍓儴闀�', false));
+            // plist.add(new Position('閮ㄩ暱', false));
+            plist.add(new Position('缁忕悊绾�', true));
+            plist.add(new Position('鎬荤洃绾�', false));
+            //20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
         }
 
         // 褰撳墠鐢ㄦ埛淇℃伅
@@ -601,7 +605,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';
@@ -713,7 +717,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.鑳介噺\' ';
@@ -762,24 +766,64 @@
 
         // 鑱蜂綅鏉′欢
         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) {
+            
             soql += ' and (';
             for (Integer i = 0; i < positionNames.size(); i++) {
                 if (i == positionNames.size() - 1) {
-                    soql += ' Post__c = \'' + positionNames[i] + '\'';
+                    //20220517 lt SWAG-CD28H3 Start
+                    if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+                        soql += ' HR_Post__c = \'' + positionNames[i] + '\'';
+                    }
+                    else if(positionNames[i] == '缁忕悊绾�'){
+                        soql += ' HR_Post__c like \'%' + s1 + '%\'';
+                    }
+                    else if(positionNames[i] == '鎬荤洃绾�'){
+                        soql += ' HR_Post__c like \'%' + s2 + '%\'';
+                    }
+                    //20220517 lt SWAG-CD28H3 End
                 } else {
-                    soql += ' Post__c = \'' + positionNames[i] + '\' or';
+                    //20220517 lt SWAG-CD28H3 Start
+                    if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+                        soql += ' HR_Post__c = \'' + positionNames[i] + '\' or';
+                    }
+                    else if(positionNames[i] == '缁忕悊绾�'){
+                        soql += ' HR_Post__c like \'%' + s1 + '%\' or';
+                    }
+                    else if(positionNames[i] == '鎬荤洃绾�'){
+                        soql += ' HR_Post__c like \'%' + s2 + '%\' or';
+                    }
+                    //20220517 lt SWAG-CD28H3 End
                 }
             }
             soql += ')';
         }
         soql += ' order by Salesdepartment__c, Province__c, UserRole.Name';
-        System.debug('**********'+soql);
+        System.debug('**********123'+soql);
         return Database.query(soql);
     }
 

--
Gitblit v1.9.1