From e1928eff37b01afcdfd5456944bb3b15d09e3258 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期四, 10 三月 2022 17:44:09 +0800
Subject: [PATCH] 111
---
force-app/main/default/classes/ProRegisterHandler.cls | 441 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 279 insertions(+), 162 deletions(-)
diff --git a/force-app/main/default/classes/ProRegisterHandler.cls b/force-app/main/default/classes/ProRegisterHandler.cls
index 6631322..9092f80 100644
--- a/force-app/main/default/classes/ProRegisterHandler.cls
+++ b/force-app/main/default/classes/ProRegisterHandler.cls
@@ -1,181 +1,298 @@
-public with sharing class ProRegisterHandler extends Oly_TriggerHandler {
- /* 2018-08-31 鏇存柊浜у搧鍐呮渶鏂颁骇鍝佸湪娉ㄥ唽璇�
- 1.鏍规嵁闇�瑕佹洿鏂扮殑浜у搧娉ㄥ唽璇佹壘鍑烘墍鏈夊搴旂殑浜у搧-娉ㄥ唽璇佸叧绯�
- 2.鏍规嵁浜у搧-娉ㄥ唽璇佸叧绯绘壘鍑烘墍鏈夊搴旂殑浜у搧
- 3.鏍规嵁浜у搧鎵惧嚭鍏舵墍闇�鏈�鏂颁骇鍝佹敞鍐岃瘉
- */
- private Map<Id, Product_Register__c> newMap;
- private Map<Id, Product_Register__c> oldMap;
- private List<Product_Register__c> newList;
- private List<Product_Register__c> oldList;
+public without sharing class ProRegisterHandler {
- public ProRegisterHandler() {
- this.newMap = (Map<Id, Product_Register__c>) Trigger.newMap;
- this.oldMap = (Map<Id, Product_Register__c>) Trigger.oldMap;
- this.newList = (List<Product_Register__c>) Trigger.new;
- this.oldList = (List<Product_Register__c>) Trigger.old;
- }
+ public static void updateProduct(List<Product_Register__c> newList, Map<Id, Product_Register__c> newMap, List<Product_Register__c> oldList, Map<Id, Product_Register__c> oldMap) {
- protected override void beforeInsert() {
- updateLink();
- }
+ // 浜у搧-娉ㄥ唽璇佸叧绯� 涓墍鏈� 浜у搧ID
+ List<ID> Product2_ID_list = new list<ID>();
+ // 鐜版湁浜у搧 map
+ Map<ID, Product2> Exist_ProductMap = new map<ID, Product2>();
+ // 闇�瑕佹洿鏂颁骇鍝� list
+ List<Product2> UpdateProductlist = new list<Product2>();
+ // 鏍规嵁鍙樻洿鐨勮瘉ID鎵惧埌鍏宠仈鐨勬墍鏈夌殑浜у搧
+ list<Product_Register_Link__c> ExistPRLList = [select Product2__c,
+ Product_Register__c
+ from Product_Register_Link__c
+ where Product_Register__c in: newList
+ ];
- protected override void beforeUpdate() {
- updateLink();
- }
+ for (Product_Register_Link__c PRL : ExistPRLList) {
+ // 浜у搧ID鐨凩IST
+ Product2_ID_list.add(PRL.Product2__c);
+ }
- protected override void afterUpdate() {
- updateProduct();
- }
+ // 閫氳繃浜у搧ID鎵惧埌璇ヤ骇鍝佹渶鏂版敞鍐岃瘉ID
+ Exist_ProductMap = new Map<ID, Product2> ([select ID, Register_Latest__c, registrationCode__c, clinical_product_code__c
+ from Product2
+ where id in: Product2_ID_list
+ ]);
- //protected override void beforeDelete() {
- // updateProduct();
- //}
- private void updateLink() {
- for (Product_Register__c reg : newList) {
- system.debug('reg.Name--->'+reg.Name);
- reg.RegisterNoURL__c = EncodingUtil.urlEncode(reg.Name, 'UTF-8');
- }
-
- }
- private void updateProduct() {
+ // 閫氳繃浜у搧ID鎵惧埌鎵�鏈夋秹鍙婄殑鏈夋晥鍏崇郴
+ List<Product_Register_Link__c> allPRLList = [select Product2__c,
+ Product_Register__c,
+ Product_Register__r.PrdCompanyAddr__c,
+ Product_Register__r.ValidFrom__c,
+ Product_Register__r.ValidTo__c,
+ Product_Register__r.Name,
+ Product_Register__r.ValidProductRegister__c,
+ Product_Register__r.ClinicalProductCode__c
+ from Product_Register_Link__c
+ where Product2__c in : Product2_ID_list
+ order by Product2__c,
+ LastModifiedDate desc
+ ];
- if (System.Label.UpdRegOnly == '1') return;
+ String tmpProductID = '';
+ Product2 temProduct = new Product2();
+ Map<Id, Product2> UpdProMap = new Map<Id, Product2>();
- // 浜у搧-娉ㄥ唽璇佸叧绯� 涓墍鏈� 浜у搧ID
- List<ID> Product2_ID_list = new list<ID>();
- // 鐜版湁浜у搧 map
- Map<ID, Product2> Exist_ProductMap = new map<ID, Product2>();
- // 闇�瑕佹洿鏂颁骇鍝� list
- List<Product2> UpdateProductlist = new list<Product2>();
- // 鏍规嵁鍙樻洿鐨勮瘉ID鎵惧埌鍏宠仈鐨勬墍鏈夌殑浜у搧
- list<Product_Register_Link__c> ExistPRLList = [select Product2__c,
- Product_Register__c
- from Product_Register_Link__c
- where Product_Register__c in: newList
- ];
+ for (Product_Register_Link__c temPRL : allPRLList) {
- for (Product_Register_Link__c PRL : ExistPRLList) {
- // 浜у搧ID鐨凩IST
- Product2_ID_list.add(PRL.Product2__c);
+ if (!tmpProductID.equals(temPRL.Product2__c)) {
+
+ tmpProductID = temPRL.Product2__c;
+ temProduct = Exist_ProductMap.get(tmpProductID);
+ temProduct.Register_Latest__c = temPRL.Product_Register__c; // 鏈�鏂版敞鍐岃瘉ID
+ temProduct.registrationCode__c = null;
+ temProduct.clinical_product_code__c = null;
+ }
+
+ // 濡傛灉娉ㄥ唽璇佺姸鎬佹湁鏁�,璁板綍鏈夋晥娉ㄥ唽璇佸彿
+ if (temPRL.Product_Register__r.ValidProductRegister__c ) {
+ if (String.isBlank(temProduct.registrationCode__c)) {
+ temProduct.registrationCode__c = temPRL.Product_Register__r.Name + '\n';
+ } else {
+ if (String.isNotBlank(temPRL.Product_Register__r.Name)) {
+ if (temProduct.registrationCode__c.indexOf(temPRL.Product_Register__r.Name) == -1) {
+ temProduct.registrationCode__c += temPRL.Product_Register__r.Name + '\n';
+ }
+ }
+ }
+
+ String clinicalCode = temPRL.Product_Register__r.ClinicalProductCode__c;
+ if (String.isBlank(temProduct.clinical_product_code__c)) {
+ temProduct.clinical_product_code__c = clinicalCode;//temPRL.Product_Register__r.ClinicalProductCode__c;
+ } else {
+
+ if (String.isNotBlank(clinicalCode)) {
+
+ Map<String, String> codeMap = new Map<String, String>();
+ for (String code : temProduct.clinical_product_code__c.split('/')) {
+ codeMap.put(code, code);
+ }
+ codeMap.put(clinicalCode, clinicalCode);
+ temProduct.clinical_product_code__c = '';
+ for (String code : codeMap.values()) {
+ if (String.isBlank(temProduct.clinical_product_code__c)) {
+ temProduct.clinical_product_code__c = code;
+ } else {
+ temProduct.clinical_product_code__c += '/' + code;
+ }
+ }
+
+ }
+
+ }
+ }
+ UpdProMap.put(tmpProductID, temProduct);
+ }
+ if (UpdProMap.keySet().size() > 0) update UpdProMap.values();
+ }
+
+ //浜у搧闄嶇被,鍙娉ㄥ唽璇佹洿鏂颁簡,灏辨鏌ヤ竴閬嶏紝閲嶆柊缁欎骇鍝佷笂鐨勭瓑绾х被鍒瓧娈佃祴鍊笺��
+ //鍙互鎵惧嚭闇�瑕佺殑Id,鐒跺悗璋冪敤鏂规硶銆�
+ public static void checkRegistervervaldatum(List<Product_Register__c> newList, Map<Id, Product_Register__c> newMap, List<Product_Register__c> oldList, Map<Id, Product_Register__c> oldMap) {
+ List<String> prcList = new List<String>();
+ for (Product_Register__c pr : newList) {
+ Product_Register__c oldpr = oldMap.get(pr.Id);
+ //鏈夋晥鏈熺殑濮嬩笌缁堝彉浜�,灏辨妸杩欎釜浜у搧娉ㄥ唽璇佺殑id鏀惧叆涓�涓狶ist闆嗗悎閲岄潰
+ //if (pr.ValidTo__c != oldpr.ValidTo__c || pr.ValidFrom__c != oldpr.ValidFrom__c) {
+ prcList.add(pr.id);
+ //}
+ }
+ //鏀惧埌Map閲岋紝鐢ㄤ簬娉ㄥ唽璇佹洿鏂颁骇鍝�
+ Map<Id,Product2> prt2Map = new Map<Id,Product2>();
+ //閫氳繃涔嬪墠瀛樺偍鐨処d鐢ㄤ簬鍏崇郴琛ㄧ殑鏌ヨ銆�
+ List<Product_Register_Link__c> prlList = new List<Product_Register_Link__c>();
+ prlList = [select Product2__r.id,Product2__r.demoteer_Sap__c,Product2__r.Diedatvanink__c,Product_Register__r.MedPrdClass__c,Product_Register__r.Stelsedag__c,Product_Register__r.ValidTo__c,Product_Register__r.ValidFrom__c
+ from Product_Register_Link__c
+ where Product_Register__r.Id in : prcList];
+ //鏌ヨ鍑轰骇鍝両D
+ List<Id> pro2IdList = new List<Id>();
+ for (Product_Register_Link__c prl1: prlList) {
+ pro2IdList.add(prl1.Product2__r.id);
}
- // 閫氳繃浜у搧ID鎵惧埌璇ヤ骇鍝佹渶鏂版敞鍐岃瘉ID
- Exist_ProductMap = new Map<ID, Product2> ([select ID, Register_Latest__c
- from Product2
- where id in: Product2_ID_list
- ]);
+ List<Product_Register_Link__c> prl1List = new List<Product_Register_Link__c>();
+ prl1List = [select Product2__r.id,Product2__r.demoteer_Sap__c,Product2__r.Diedatvanink__c,Product_Register__r.Stelsedag__c,Product_Register__r.MedPrdClass__c,Product_Register__r.ValidTo__c,Product_Register__r.ValidFrom__c
+ from Product_Register_Link__c
+ where Product2__r.Id in : pro2IdList];
- // 閫氳繃浜у搧ID鎵惧埌鎵�鏈夋秹鍙婄殑鏈夋晥鍏崇郴
- List<Product_Register_Link__c> allPRLList = [select Product2__c,
- Product_Register__c,
- Product_Register__r.PrdCompanyAddr__c,
- Product_Register__r.PrdCompanyAddr2__c,
- Product_Register__r.PrdCompanyAddr3__c,
- Product_Register__r.ValidFrom__c,
- Product_Register__r.ValidTo__c,
- Product_Register__r.Name,
- // 20190401 CHAN-BAPCE6 LHJ Start
- Product_Register__r.BusinessScopeKey__c,
- // 20190401 CHAN-BAPCE6 LHJ End
- Product_Register__r.RegisterNoStatus__c
- from Product_Register_Link__c
- where Product2__c in : Product2_ID_list
- // and If_Delete__c = false
- order by Product2__c,
- Product_Register__r.RegisterNoStatusCode__c,
- LastModifiedDate desc
- ];
-
- String tmpProductID = '';
- String temAllProdStatus = '';
- String temAllProdStatus2 = '';
- String temAllProdStatusAll = '';
- // 20190401 CHAN-BAPCE6 LHJ Start
- String temAllScopeKey = '';
- // 20190401 CHAN-BAPCE6 LHJ End
- Product2 temProduct = new Product2();
- Map<Id, Product2> UpdProMap = new Map<Id, Product2>();
-
- for (Product_Register_Link__c temPRL : allPRLList) {
-
- if (!tmpProductID.equals(temPRL.Product2__c)) {
- tmpProductID = temPRL.Product2__c;
- temProduct = Exist_ProductMap.get(tmpProductID);
- temAllProdStatus = '';
- temAllProdStatus2 = '';
- temAllProdStatusAll = '';
- // 20190401 CHAN-BAPCE6 LHJ Start
- temAllScopeKey = '';
- // 20190401 CHAN-BAPCE6 LHJ End
- temProduct.Register_Latest__c = temPRL.Product_Register__c; // 鏈�鏂版敞鍐岃瘉ID
- temProduct.SFDA_Approbation_No__c = temPRL.Product_Register__r.Name; // CFDA娉ㄥ唽鍙�
- temProduct.SFDA_Approbated_Date__c = temPRL.Product_Register__r.ValidFrom__c; // CFDA娉ㄥ唽鏃�
- temProduct.SFDA_Expiration_Date__c = temPRL.Product_Register__r.ValidTo__c; // CFDA鏈夋晥鏈熼檺
- if(temPRL.Product_Register__r.Name != 'FYL') {
- temProduct.ProduceCompany__c = temPRL.Product_Register__r.PrdCompanyAddr__c; // 鐢熶骇浼佷笟
- //CHAN-C4X63A 銆愬鎵樸�慛FM204瀛楁鈥滅敓浜т紒涓氬湴鍧�鈥濅紭鍖� XHL 20210716 Start
- temProduct.ProduceCompany2__c = temPRL.Product_Register__r.PrdCompanyAddr2__c;
- temProduct.ProduceCompany3__c = temPRL.Product_Register__r.PrdCompanyAddr3__c;
- //CHAN-C4X63A 銆愬鎵樸�慛FM204瀛楁鈥滅敓浜т紒涓氬湴鍧�鈥濅紭鍖� XHL 20210716 End
+ //鏍规嵁Id瀛樻斁浜у搧鎵�灞炵殑鎵�鏈夋敞鍐岃瘉涓嬬殑鍣ㄦ鍒嗙被銆�
+ Map<Id,List<String>> pro2Map = new Map<Id,List<String>>();
+ //瀛樻斁娉ㄥ唽璇佷笂鏈�鍓嶇殑缁存姢鏃�
+ Map<Id,Date> prSteMap = new Map<Id,Date>();
+ if (prl1List.size()>0) {
+ for (Product_Register_Link__c prl: prl1List) {
+ if (pro2Map.containsKey(prl.Product2__r.Id)) {
+ pro2Map.get(prl.Product2__r.Id).add(prl.Product_Register__r.MedPrdClass__c);
+ }else {
+ pro2Map.put(prl.Product2__r.Id, new List<String>());
+ pro2Map.get(prl.Product2__r.Id).add(prl.Product_Register__r.MedPrdClass__c);
}
- temProduct.SFDA_Approbated_Status__c = temPRL.Product_Register__r.RegisterNoStatus__c; // CFDA娉ㄥ唽璇佺姸鎬�
+
+ if (prl.Product_Register__r.MedPrdClass__c == '1') {
+ if (prSteMap.containsKey(prl.Product2__r.Id)) {
+ if (prSteMap.get(prl.Product2__r.Id) > prl.Product_Register__r.Stelsedag__c) {
+ prSteMap.put(prl.Product2__r.Id,prl.Product_Register__r.Stelsedag__c);
+ }
+ }else {
+ prSteMap.put(prl.Product2__r.Id,prl.Product_Register__r.Stelsedag__c);
+ }
+ }
}
- // 濡傛灉娉ㄥ唽璇佺姸鎬佹湁鏁�,璁板綍鏈夋晥娉ㄥ唽璇佸彿
- if (temPRL.Product_Register__r.RegisterNoStatus__c == '鏈夋晥') {
- // LHJ 20190809
- String productRegisterName = temPRL.Product_Register__r.Name;
- if (temAllProdStatus.length() + productRegisterName.length() <= 240) {
- if (!temAllProdStatusAll.contains(productRegisterName)) {
- temAllProdStatus += ';' + productRegisterName;
- temAllProdStatusAll += ';' + productRegisterName;
- }
-
- } else {
- if (!temAllProdStatusAll.contains(productRegisterName)) {
- temAllProdStatus2 += ';' + productRegisterName;
- temAllProdStatusAll += ';' + productRegisterName;
- }
- //temAllProdStatus2 += ';' + productRegisterName;
- }
-
- // 20190401 CHAN-BAPCE6 LHJ Start
- //if (String.isNotBlank(temPRL.Product_Register__r.BusinessScopeKey__c) &&
- // (!temAllScopeKey.contains(temPRL.Product_Register__r.BusinessScopeKey__c))) {
- // temAllScopeKey += ';' + temPRL.Product_Register__r.BusinessScopeKey__c;
- //}
- String businessScopeKey = temPRL.Product_Register__r.BusinessScopeKey__c;
- if (String.isNotBlank(businessScopeKey)) {
- for(String scopeKey:businessScopeKey.split(';')){
- if (!temAllScopeKey.contains(scopeKey)) {
- temAllScopeKey += ';' + scopeKey;
+ for (Product_Register_Link__c prl: prl1List) {
+ if (prSteMap.get(prl.Product2__r.Id) == null) {
+ if (prSteMap.containsKey(prl.Product2__r.Id) && (prl.Product_Register__r.MedPrdClass__c == '2' || prl.Product_Register__r.MedPrdClass__c == '3')) {
+ if (prSteMap.containsKey(prl.Product2__r.Id)) {
+ if (prSteMap.get(prl.Product2__r.Id) > prl.Product_Register__r.Stelsedag__c) {
+ prSteMap.put(prl.Product2__r.Id,prl.Product_Register__r.Stelsedag__c);
+ }
+ }else {
+ prSteMap.put(prl.Product2__r.Id,prl.Product_Register__r.Stelsedag__c);
}
}
-
-
- }
- // 20190401 CHAN-BAPCE6 LHJ End
+ }
}
- if (temAllProdStatus != '') {
- temProduct.RegisterNo_ALL__c = temAllProdStatus.substring(1, temAllProdStatus.length());
- } else {
- temProduct.RegisterNo_ALL__c = '';
- }
- if (temAllProdStatus2 != '') {
- temProduct.RegisterNo_ALL2__c = temAllProdStatus2.substring(1, temAllProdStatus2.length());
- } else {
- temProduct.RegisterNo_ALL2__c = '';
- }
- // 20190401 CHAN-BAPCE6 LHJ Start
- if (temAllScopeKey != '') {
- temProduct.RegScopeKeyAll__c = temAllScopeKey.substring(1, temAllScopeKey.length());
- } else {
- temProduct.RegScopeKeyAll__c = '';
- }
- // 20190401 CHAN-BAPCE6 LHJ End
- UpdProMap.put(tmpProductID, temProduct);
}
- if (UpdProMap.keySet().size() > 0) update UpdProMap.values();
- }
+ System.debug('pro2Map='+pro2Map);
+ System.debug('prSteMap='+prSteMap);
+ //浜у搧Id涓庣瓑绾х被鍒�
+ Map<Id,String> prlMap = new Map<Id,String>();
+ Map<Id,String> prl1Map = new Map<Id,String>();
+ Map<Id,String> prl2Map = new Map<Id,String>();
+ List<ID> pidList = new List<ID>();
+ if (pro2Map.size()>0) {
+ for (Product_Register_Link__c pr: prl1List) {
+ if (pro2Map.containsKey(pr.Product2__r.Id) && prSteMap.containsKey(pr.Product2__r.Id)) {
+ pidList.add(pr.Product2__r.Id);
+ if (pr.Product2__r.demoteer_Sap__c <> null && pr.Product2__r.Diedatvanink__c <> null) {
+ if (pr.Product_Register__r.Stelsedag__c <> null) {
+ if (pr.Product2__r.Diedatvanink__c <= pr.Product_Register__r.Stelsedag__c) {
+ if (pr.Product2__r.demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && pr.Product2__r.demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
+ && pr.Product_Register__r.MedPrdClass__c == '2' || pr.Product_Register__r.MedPrdClass__c == '3') {
+ if (prlMap.get(pr.Product2__r.Id) == null) {
+ prlMap.put(pr.Product2__r.Id, '浜岀被');
+ }else {
+ String Lins = prlMap.get(pr.Product2__r.Id);
+ Lins += '浜岀被';
+ prlMap.put(pr.Product2__r.Id, Lins);
+ }
+ }
+ else if (pr.Product2__r.demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && pr.Product2__r.demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
+ && (pr.Product_Register__r.MedPrdClass__c == '1')) {
+ if (prlMap.get(pr.Product2__r.Id) == null) {
+ prlMap.put(pr.Product2__r.Id, '涓�绫�');
+ }else {
+ String Lins = prlMap.get(pr.Product2__r.Id);
+ Lins += '涓�绫�';
+ prlMap.put(pr.Product2__r.Id, Lins);
+ }
+ }else {
+ if (prlMap.get(pr.Product2__r.Id) == null) {
+ prlMap.put(pr.Product2__r.Id, '闈炵洃绠�');
+ }else {
+ String Lins = prlMap.get(pr.Product2__r.Id);
+ Lins += '闈炵洃绠�';
+ prlMap.put(pr.Product2__r.Id, Lins);
+ }
+ }
+ }else if (pr.Product2__r.Diedatvanink__c > pr.Product_Register__r.Stelsedag__c) {
+ if (pr.Product2__r.demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && pr.Product2__r.demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
+ && pr.Product_Register__r.MedPrdClass__c == '1') {
+ if (prl1Map.get(pr.Product2__r.Id) == null) {
+ prl1Map.put(pr.Product2__r.Id, '涓�绫�');
+ }else {
+ String Lins = prl1Map.get(pr.Product2__r.Id);
+ Lins += '涓�绫�';
+ prl1Map.put(pr.Product2__r.Id, Lins);
+ }
+ }else if (pr.Product2__r.demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && pr.Product2__r.demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
+ && pr.Product_Register__r.MedPrdClass__c == '2' || pr.Product_Register__r.MedPrdClass__c == '3') {
+ if (prl1Map.get(pr.Product2__r.Id) == null) {
+ prl1Map.put(pr.Product2__r.Id, '浜岀被');
+ }else {
+ String Lins = prl1Map.get(pr.Product2__r.Id);
+ Lins += '浜岀被';
+ prl1Map.put(pr.Product2__r.Id, Lins);
+ }
+ }else {
+ if (prlMap.get(pr.Product2__r.Id) == null) {
+ prlMap.put(pr.Product2__r.Id, '闈炵洃绠�');
+ }else {
+ String Lins = prlMap.get(pr.Product2__r.Id);
+ Lins += '闈炵洃绠�';
+ prlMap.put(pr.Product2__r.Id, Lins);
+ }
+ }
+ }
+ }else {
+ prl2Map.put(pr.Product2__r.Id, '绌�');
+ }
+ }
+ }
+ }
+ }
+ System.debug('prlMap='+prlMap);
+ System.debug('prl1Map='+prl1Map);
+ System.debug('prl2Map='+prl2Map);
+
+ List<Product2> por2Lsit = new List<Product2>();
+ //鏌ュ嚭浜у搧鐨刬d鍜岀瓑绾х被鍒殑瀛楁
+ por2Lsit = [select Id,Level_Category__c,demoteer_Sap__c,Diedatvanink__c from Product2 where Id in : pidList];
+ if (por2Lsit.size() > 0) {
+ for (Product2 pr2: por2Lsit) {
+ if (prlMap.containsKey(pr2.Id)) {
+ if ((prlMap.get(pr2.Id).contains('浜岀被') && prlMap.get(pr2.Id).contains('涓�绫�')) ||
+ (!prlMap.get(pr2.Id).contains('涓�绫�') && prlMap.get(pr2.Id).contains('浜岀被'))){
+ pr2.Level_Category__c = '浜岀被';
+ prt2Map.put(pr2.Id, pr2);
+ }else if (prlMap.get(pr2.Id).contains('涓�绫�') && !prlMap.get(pr2.Id).contains('浜岀被')) {
+ pr2.Level_Category__c = '涓�绫�';
+ prt2Map.put(pr2.Id, pr2);
+ }else if (prlMap.get(pr2.Id).contains('闈炵洃绠�') && !prl2Map.containsKey(pr2.Id)) {
+ pr2.Level_Category__c = '闈炵洃绠�';
+ prt2Map.put(pr2.Id, pr2);
+ }else {
+ pr2.Level_Category__c = null;
+ prt2Map.put(pr2.Id, pr2);
+ }
+ }
+ if (prl1Map.containsKey(pr2.Id)) {
+ if (prl1Map.get(pr2.Id).contains('涓�绫�')) {
+ pr2.Level_Category__c = '涓�绫�';
+ prt2Map.put(pr2.Id, pr2);
+ }else if (prl1Map.get(pr2.Id).contains('浜岀被') && !prl1Map.get(pr2.Id).contains('涓�绫�')) {
+ pr2.Level_Category__c = '浜岀被';
+ prt2Map.put(pr2.Id, pr2);
+ }else if (prl1Map.get(pr2.Id).contains('闈炵洃绠�') && !prl2Map.containsKey(pr2.Id)) {
+ pr2.Level_Category__c = '闈炵洃绠�';
+ prt2Map.put(pr2.Id, pr2);
+ }else {
+ pr2.Level_Category__c = null;
+ prt2Map.put(pr2.Id, pr2);
+ }
+ }
+ if (pr2.demoteer_Sap__c == null || pr2.Diedatvanink__c == null) {
+ pr2.Level_Category__c = null;
+ prt2Map.put(pr2.Id, pr2);
+ }
+ }
+ }
+
+ System.debug('prt2Map='+prt2Map);
+ if (prt2Map.size() > 0) {
+ update prt2Map.values();
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1