From 5835379ec30b1667c4e522db9d294c9b7bb8633a Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 26 四月 2022 12:00:31 +0800
Subject: [PATCH] SSBG Back up
---
force-app/main/default/classes/ControllerUtil.cls | 5477 -----------------------------------------------------------
1 files changed, 6 insertions(+), 5,471 deletions(-)
diff --git a/force-app/main/default/classes/ControllerUtil.cls b/force-app/main/default/classes/ControllerUtil.cls
index d58e34c..7736d00 100644
--- a/force-app/main/default/classes/ControllerUtil.cls
+++ b/force-app/main/default/classes/ControllerUtil.cls
@@ -1,35 +1,4 @@
global without sharing class ControllerUtil {
- // 銉堛儶銈疅琛屽洖鏁般倰鍒跺尽銇欍倠銆佷竴鍥炵洰false銆佷簩鍥炵洰锛坵orkflow瀵惧繙鐢級true
- //public static Boolean XinEventOppotunityPileUpExeFlg = false;
- // 绌嶃伩涓娿亽銈扞sScheduled銉曘儵銈拌ō瀹氥伄寰屻伀瀹熻
- public static Boolean EventOpportunityPileUpExeFlg = false;
- // EventC鈬扙vent鍑︾悊寰屻�侀�嗘洿鏂般倰銈广儷銉肩敤
- public static Boolean NotUpdEventCFlg = false;
- // 绌嶃伩涓娿亽鍑︾悊寰屻�併儓銉偓銈掋偣銉兗鐢�
- public static Boolean EscapeNFM001Trigger = false;
- public static Boolean EscapeNFM001AgencyContractTrigger = false;
- public static Boolean EscapeNFM007Trigger = false;
- public static Boolean EscapeOpportunityBefUpdTrigger = false;
- public static Boolean EscapeOpportunityHpDeptUpdTrigger = false;
- public static Boolean EscapeSyncOpportunityTrigger = false;
- public static Boolean EscapeMaintenanceContractAfterUpdateTrigger = false;
- public static Boolean EscapeSyncProduct2Trigger = false;
-
- // 鍟嗚珖銇洿鏂颁笉鍙爡鐩儶銈广儓
- public static List<String> oppColumnList = System.Label.Opportunity_Columns.split(',');
-
- // 鍓婇櫎瀵捐薄銇瓻vent
- public static Set<Id> delEventIdSet = new Set<Id>();
-
- // 100鏃ュ畾鏁�
- public static Integer ReportDayRange = 100;
-
- // 鍟嗚珖銉偝銉笺儔銈裤偆銉�
- public static String[] oppRecordTypeDevNames = new String[] {'Opportunity'};
-
- public static final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
-
-
public ControllerUtil() {
Integer i = 0;
i++;
@@ -110,5293 +79,14 @@
i++;
i++;
i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- }
-
- WebService static String selectCommonSequence(String valueField, String formatField) {
- Boolean insertNew = false;
- //鍙栧緱鍏遍�氭帯鐣簭鍒�
- String soql = 'select id,' + valueField + ',' + formatField + ' from Common_Sequence__c for update';
- List<Common_Sequence__c> csList = Database.query(soql);
- if (csList.size() == 0) {
- //鍏遍�氭帯鐣簭鍒楁病鏁版嵁锛屾柊寤�
- Common_Sequence__c newCS = new Common_Sequence__c();
- newCS.Name = '鍏遍�氭帯鐣簭鍒�';
- newCS.EvaluationPDF_NextValue__c = 1;
- insert newCS;
- insertNew = true;
- //鍐嶅彇寰楀叡閫氭帯鐣簭鍒�
- csList = Database.query(soql);
- }
- Common_Sequence__c cs = csList[0];
- //鎺$暘缂栫爜
- String format = String.valueOf(cs.get(formatField));
- //涓嬩釜鎺$暘鍊�
- Decimal nextValue = Decimal.valueOf(String.valueOf(cs.get(valueField)));
- //鎺$暘
- nextValue += 1;
- cs.put(valueField, nextValue);
- update csList;
- //杩斿洖鎺$暘缂栫爜
- return format;
- }
-
- public static String generateRandomStr(Integer len) {
- String randStr = '';
- while (randStr.length() < len) {
- Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
- randStr += chars.substring(idx, idx+1);
- }
- return randStr;
- }
-
- public static List<Document> getPdfBlobForPreview(String docId) {
- return [select Id, Name, Body, CreatedDate from Document where Id = :docId];
- }
-
- public static List<SMARM__c> getSmarmByUser(Map<String, Schema.SObjectField> fieldMap, String fromUserId, String toUserId) {
- String sql = 'select ';
- String fields = '';
- for (String field : fieldMap.keySet()) {
- if (fields.length() > 0) {
- fields += ', ';
- }
- fields += field;
- }
- sql += fields;
- sql += ' from SMARM__c where Review_Practitioner__c = :fromUserId and Review_Target__c = :toUserId and (Status__c = \'鑽夋涓璡' or Status__c = \'Delete\')';
- List<SMARM__c> sList = Database.query(sql);
- return sList;
- }
-
- public static void createDocForEmail(List<Document> docList) {
- Folder f = [select Id from Folder where DeveloperName = 'EmailImgFolder'];
- for (Document doc : docList) {
- doc.FolderId = f.Id;
- doc.IsPublic = true;
- }
- insert docList;
- }
-
- public static List<SMARM__c> getSmarmById(String sql) {
- return Database.query(sql);
- }
-
- public static List<Attachment> getSmarmAtts(String smarmId) {
- return [select Id, Name, Body from Attachment where ParentId = :smarmId order by Name];
- }
-
- public static void insertAttachments(List<Attachment> atts) {
- if (atts.size() > 0) insert atts;
- }
-
- public static void updateAttachments(List<Attachment> atts) {
- if (atts.size() > 0) update atts;
- }
-
- public static void deleteAttachments(List<Attachment> atts) {
- if (atts.size() > 0) delete atts;
- }
-
- public static void upsertSMARM(SMARM__c smarm) {
- upsert smarm;
- }
-
- public static void insertSMARMShare(List<SObject> smarmShare) {
- insert smarmShare;
- }
-
- public static List<Account> selectAccountForTrigger(List<String> accIds) {
- return [Select Id, Name, Management_Code__c, OwnerId, ParentId, Parent.ParentId,Parent.Parent.Name, RecordTypeId from Account where Id IN :accIds];
- }
- public static Map<Id, Contact> selectContactAccountForTrigger(List<Id> contactIds) {
- return new Map<Id, Contact>([Select Id, AccountId, Account.ParentId, Account.Parent.ParentId, Account.RecordTypeId from Contact where Id IN :contactIds]);
- }
- public static list<Contact> selectContactForCampaignMember(Set<Id> contactIds) {
- return [Select Id, campaign__c,campaign__r.Lesson_Type__c, campaign__r.TrainingType__c from Contact where Id IN :contactIds];
- }
- public static List<Contact> selectDummyContact() {
- return [select id, Email from Contact where email <> null limit 1];
- }
-
- public static List<Account> selectBossMailAddr(List<String> accIds) {
- return [select Id, Parent.Boss__r.Email, Parent.Sub_Boss__r.Email, Parent.Boss__r.Name, Parent.Sub_Boss__r.Name from Account where Id in : accIds];
- }
-
- public static List<Event> eventSelectById(String id){
- List<Event> eParamList = [select id, ActivityDate, OwnerId, Subject, whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
- StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c,
- Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
- Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c
- from Event where id = :id];
- return eParamList;
- }
- public static List<Event> eventSelectByDate(Date whereDate, User ur){
- List<Event> calenderList = [select id, ActivityDate, OwnerId, Subject, whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
- StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
- Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
- Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c,EventStatus__c,cancelReason__c,cancelReasonOther__c,cancelReasonSelect__c,cancelReasonSelectFSE__c,delayReason__c,delayReasonOther__c,delayReasonSelect__c,delayReasonSelectFSE__c,delayToDate__c
- from Event where WS_flg__c = false and ActivityDate = :whereDate and OwnerId = :ur.Id and EventStatus__c not in ('04 鍙栨秷','05 寤舵湡','06 鍏抽棴','07 鏈墽琛�') order by StartDateTime];
- return calenderList;
- }
-
- public static List<Daily_Report__c> reportSelectByDate(Date whereDate, String ownerId){
- List<Daily_Report__c> reportList = [select id, name, Reporter__c, Reported_Date__c, Daily_Report_Data_Type__c,
- Working_Time_From__c, Working_Time_To__c, Status__c, Mail_Send_Check__c,
- Business_Trip__c, Submit_Date_New__c, Submit_DateTime_New__c, Approved_Date__c,
- Approved_DateTime__c, CreatedById, Feed_Back_From_Manager__c, FeedbackManager__c,
- Planning_Time__c, Submission_Elapsed_Hour__c, Approval_Elapsed_Time__c,
- Activity_ID__c, Manager_Mail__c, Status_With_Check__c
- from Daily_Report__c where Reported_Date__c =:whereDate and OwnerId =:ownerId];
- return reportList;
- }
-
- public static List<RecordType> recordTypeSelectForTrainingtestResult(){
- List<RecordType> rtList = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Training_test_Result__c'];
- return rtList;
- }
-
- public static List<Training_test_Result__c> trainingtestResultSelectByContactIds(Set<Id> ids){
- List<Training_test_Result__c> ttrList = [select Id, RecordType.DeveloperName, employee__c from Training_test_Result__c where employee__c in :ids];
- return ttrList;
- }
-
- public static void updateSObjectContact(List<SObject> contactList) {
- if (contactList != null && contactList.size() > 0) update contactList;
- }
-
- public static Map<Id, Contact> selectActiveUserFromContact(List<Id> contactIds) {
- return new Map<Id, Contact>([Select Id, User__c From Contact Where Id IN: contactIds and User__r.isActive = true]);
+
}
- /**
- * add 2021/12/23 wangweipeng satrt
- * [updateFutureOds 鏇存柊ods鐨剈ser__c瀛楁]
- * @param odsEmployeeNoList [鍛樺伐缂栫爜]
- * @param odsEmployeeNoMap [鍛樺伐缂栫爜瀵瑰簲鐨剈ser Id]
- *
- */
- @future
- public static void updateFutureOds(List<String> odsEmployeeNoList,Map<String,Id> odsEmployeeNoMap) {
- if(odsEmployeeNoList != null && odsEmployeeNoList.size() > 0){
- List<ODS__c> odsData = [select id,name,User__c,Employee_No__c from ODS__c where Employee_No__c in :odsEmployeeNoList];
- if(odsData != null && odsData.size() > 0){
- for(ODS__c ods : odsData){
- ods.User__c = odsEmployeeNoMap.get(ods.Employee_No__c);
- }
- update odsData;
- }
- }
- }
- //add 2021/12/23 wangweipeng end
-
- /*
- https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_non_mix_sobjects.htm
- */
- @future
- public static void upsertFutureContact(List<String> userEmployeeNoList) {
- upsertFutureContactInterface(userEmployeeNoList);
- }
- //@future
- public static void upsertFutureContactInterface(List<String> userEmployeeNoList) {
- // 绀惧唴鍛樺伐銇儸銈炽兗銉夈偪銈ゃ儣
- Id rtId = '01210000000Qtky';
- // 鐜版湁鑱旂郴浜�
- Map<String, Contact> conMap = new Map<String, Contact>();
- // UserToContact 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
- List<User> usrList = [select Id, Notes_File_Name__c,FirstName, LastName, Email, Mobile_Phone__c, Employee_No__c, Work_Location__c, Post__c, Job_Category__c, Hire_Date__c, Gender__c, Dept__c, Pregnant_Rest__c, Salesdepartment__c, Stay_or_not__c,IsMEBG__c, Work_Location_HR__c from User where Employee_No__c IN :userEmployeeNoList];
- List<Contact> conList = [select Id,Notes_File_Name__c, User__c, Employee_No_manual__c,Isactive__c,IsMEBG__c, Work_Location_HR__c from Contact where Employee_No_manual__c IN :userEmployeeNoList and RecordTypeId = :rtId];
- for (Contact con : conList) {
- //conMap.put(con.Employee_No_manual__c, con);
- conMap.put(con.Employee_No_manual__c.toLowerCase(), con);
- }
- List<Contact> upsertList = new List<Contact>();
- for (User local : usrList) {
- //update wangweipeng 2021/11/19
- //涓嶈兘濉啓璇稿鈥滃尰鐢熲�濓紝鈥滆�佸笀鈥濓紝鈥滄姢澹�濓紝鈥滈櫌闀库�濓紝鈥滄煇鏌愨�濈瓑澶磋浠gО
- if(String.isNotBlank(local.FirstName)){
- if(UserInfo.getProfileId() != '00e10000000Y3o5' && UserInfo.getProfileId() != '00e10000000Y3o5'){
- if(local.FirstName == '鑰佸笀' || local.FirstName == '鍖荤敓' || local.FirstName == '涓讳换' || local.FirstName == '闄㈤暱'
- || local.FirstName == '绉戦暱' || local.FirstName == '璇鹃暱' || local.FirstName == '鎶ゅ+' || local.FirstName == '鎶ゅ+闀�'
- || local.FirstName == '鍏堢敓' || local.FirstName == '濂冲+' || local.FirstName == '绛夌瓑' || local.FirstName == '鏌�'
- || local.FirstName == '鏌愭煇' || local.FirstName == '鏌愭煇鏌�' || local.FirstName == '澶уか')
- {
- System.debug('----浠g爜锛氳濉啓姝g‘鐨勫悕瀛楋紝涓嶈兘濉啓璇稿鈥滃尰鐢熲�濓紝鈥滆�佸笀鈥濓紝鈥滄姢澹�濓紝鈥滈櫌闀库�濓紝鈥滄煇鏌愨�濈瓑澶磋浠gО!');
- continue;
- }
- }
- }
- //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
- // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
- if (conMap.containsKey(local.Employee_No__c.toLowerCase())) {
- //if (conMap.containsKey(local.Employee_No__c)) {
- // 鏇存柊鐜版湁鑱旂郴浜�
- Contact tmp = conMap.get(local.Employee_No__c.toLowerCase());
- tmp.User__c = local.Id;
- tmp.FirstName = local.FirstName;
- tmp.LastName = local.LastName;
- tmp.Email = local.Email;
- tmp.Notes_File_Name__c = local.Notes_File_Name__c;//20170220鏂板
- tmp.MobilePhone = local.Mobile_Phone__c;
- tmp.Employee_No_manual__c = local.Employee_No__c;
- tmp.Work_Location_manual__c = local.Work_Location__c;
- //鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級鏀瑰彉鏇存柊鍒拌仈绯讳汉涓� thh 2022-02-16 start
- tmp.Work_Location_HR__c = local.Work_Location_HR__c;
- //鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級鏀瑰彉鏇存柊鍒拌仈绯讳汉涓� thh 2022-02-16 end
- tmp.Post_picklist__c = local.Post__c;
- tmp.Job_Category_picklist__c = local.Job_Category__c;
- tmp.Hire_date_text__c = local.Hire_Date__c;
- tmp.Gender_text__c = local.Gender__c;
- tmp.Dept__c = local.Dept__c;
- tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
- tmp.Salesdepartment_Text__c = local.Salesdepartment__c;
- tmp.Stay_or_not__c = local.Stay_or_not__c;
- tmp.IsMEBG__c = local.IsMEBG__c;//鏄惁MEBG
- if(String.isNotBlank(local.Stay_or_not__c)){
- tmp.Isactive__c = local.Stay_or_not__c == '鍦ㄨ亴' ? '鏈夋晥':'鏃犳晥';
- }
- upsertList.add(tmp);
- } else {
- // 鏂板仛鑱旂郴浜�
- Contact tmp = new Contact();
- tmp.RecordTypeId = rtId;
- tmp.AccountId = System.Label.Olympus_AccountID_Internal_staff;
- tmp.User__c = local.Id;
- tmp.FirstName = local.FirstName;
- tmp.LastName = local.LastName;
- tmp.Notes_File_Name__c = local.Notes_File_Name__c;//20170220鏂板
- tmp.Email = local.Email;
- tmp.MobilePhone = local.Mobile_Phone__c;
- tmp.Employee_No_manual__c = local.Employee_No__c;
- tmp.Work_Location_manual__c = local.Work_Location__c;
- //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 start
- tmp.Work_Location_HR__c = local.Work_Location__c;
- tmp.Work_Location_picklist__c = local.Work_Location__c;
- //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 end
- tmp.Post_picklist__c = local.Post__c;
- tmp.Job_Category_picklist__c = local.Job_Category__c;
- tmp.Hire_date_text__c = local.Hire_Date__c;
- tmp.Gender_text__c = local.Gender__c;
- tmp.Dept__c = local.Dept__c;
- tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
- tmp.Salesdepartment_Text__c = local.Salesdepartment__c;
- tmp.Stay_or_not__c = local.Stay_or_not__c;
- tmp.IsMEBG__c = local.IsMEBG__c;//鏄惁MEBG
- if(String.isNotBlank(local.Stay_or_not__c)){
- tmp.Isactive__c = '鍦ㄨ亴'.equals(local.Stay_or_not__c) ? '鏈夋晥':'鏃犳晥';
- }
- upsertList.add(tmp);
- }
- }
- upsert upsertList;
- }
-
- public static void updateFutureUserByContact(List<String> userEmployeeNoList) {
- // 鐜版湁鐢ㄦ埛
- Map<String, User> usrMap = new Map<String, User>();
- // ContactToUser 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
- List<Contact> conList = [select Id, FirstName, LastName, Email, MobilePhone, Employee_No_manual__c, Work_Location_manual__c, Post_picklist__c, Job_Category_picklist__c, Hire_date_text__c, Gender_text__c, Dept__c, Pregnant_Rest__c, Stay_or_not__c from Contact where Employee_No_manual__c IN :userEmployeeNoList];
- List<User> usrList = [select Id, Employee_No__c from User where Employee_No__c IN :userEmployeeNoList];
- for (User usr : usrList) {
- //update wangweipeng 2021/11/19
- //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
- //鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
- usrMap.put(usr.Employee_No__c.toLowerCase(), usr);
- }
-
- List<User> updateList = new List<User>();
- for (Contact local : conList) {
- //update wangweipeng 2021/11/19
- //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
- // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
- if (usrMap.containsKey(local.Employee_No_manual__c.toLowerCase())) {
- // 鏇存柊鐜版湁鐢ㄦ埛
- User tmp = usrMap.get(local.Employee_No_manual__c);
- tmp.FirstName = local.FirstName;
- tmp.LastName = local.LastName;
- tmp.Email = local.Email;
- tmp.Mobile_Phone__c = local.MobilePhone;
- //tmp.Employee_No__c = local.Employee_No_manual__c;
- tmp.Work_Location__c = local.Work_Location_manual__c;
- tmp.Post__c = local.Post_picklist__c;
- tmp.Job_Category__c = local.Job_Category_picklist__c;
- tmp.Hire_Date__c = local.Hire_date_text__c;
- tmp.Gender__c = local.Gender_text__c;
- tmp.Dept__c = local.Dept__c;
- tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
- tmp.Stay_or_not__c = local.Stay_or_not__c;
- updateList.add(tmp);
- }
- }
- update updateList;
- }
-
- //add wangweipeng 2021/11/18 start
- //鏍规嵁ods鐨勫憳宸ョ紪鐮侊紝鏇存柊鎴栨柊澧� user琛ㄧ殑鏁版嵁
- public static void updateFutureOdsByUser(List<String> userEmployeeNoList) {
- //鑾峰彇鑷畾涔夋爣绛撅紝鑷繁瀹氫箟锛岀敤鏉ョ┖鏇存柊鏁版嵁鎴栧鐞嗗巻鍙叉暟鎹�
- //鍦ㄥ鐞嗗巻鍙茶褰曟椂锛氳亴浣嶅拰鑱岀 濡傛灉ods鐨勫�间负绌猴紝閭d箞user瀵硅薄鐨勮繖涓や釜瀛楁灏变笉闇�瑕佹洿鏂�
- Integer buffer = Integer.valueOf(System.Label.ODS_Null_Update_Sign);
- // 鐜版湁鐢ㄦ埛
- Map<String, User> usrMap = new Map<String, User>();
- // ContactToUser 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
- List<ODS__c> conList = [select id,Alias__c,Branch__c,Category3__c,Category4__c,Category5__c,Category6__c,Employee_No__c,Hire_Date__c,FirstName__c,LastName__c,Name__c,Email__c,MobilePhone__c,Post__c,Job_Category__c,Job_Type__c,Product_specialist_incharge_product__c,Sales_Speciality__c,Work_Location__c,Stay_or_not__c,LeaveDate__c,UniqueId__c,Null_Update__c from ODS__c where Employee_No__c in :userEmployeeNoList];
-
- List<User> usrList = [select Id, PBI_Enable__c ,PBIAuthorizedSetting__c,Employee_No__c from User where Employee_No__c IN :userEmployeeNoList];
- for (User usr : usrList) {
- //usrMap.put(usr.Employee_No__c, usr);
- //鐢变簬娴嬭瘯鏃讹紝鍙戠幇ods鐨勫憳宸ョ紪鐮佸拰user鐨勫憳宸ョ紪鐮佸ぇ灏忓啓涓嶄竴鑷达紝鎵�鏈夋垜浠湪杩欓噷鎶婂憳宸ョ紪鐮佸叏閮ㄨ浆涓哄皬鍐�
- //鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
- usrMap.put(usr.Employee_No__c.toLowerCase(), usr);
- }
-
- List<User> updateList = new List<User>();
- List<User> insertList = new List<User>();
- List<String> updateId = new List<String>();
- for (ODS__c odsc : conList) {
- //鐢变簬娴嬭瘯鏃讹紝鍙戠幇ods鐨勫憳宸ョ紪鐮佸拰user鐨勫憳宸ョ紪鐮佸ぇ灏忓啓涓嶄竴鑷达紝鎵�鏈夋垜浠湪杩欓噷鎶婂憳宸ョ紪鐮佸叏閮ㄨ浆涓哄皬鍐�
- // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
- if (usrMap.containsKey(odsc.Employee_No__c.toLowerCase())) {
- // 鏇存柊鐜版湁鐢ㄦ埛
- User userData = usrMap.get(odsc.Employee_No__c.toLowerCase());
-
- userData.Group_sales_dept__c = odsc.Category3__c;//缁熸嫭鏈儴
- if(String.isNotBlank(odsc.Category4__c)){
- userData.Dept__c = odsc.Category4__c;//鏈儴
- }
- userData.Category5__c = odsc.Category5__c;//閮�
- userData.Category6__c = odsc.Category6__c;//璇�
- //userData.Employee_No__c = odsc.Employee_No__c;//鍛樺伐缂栫爜
- userData.Hire_Date__c = odsc.Hire_Date__c;//鍏ヨ亴鏃ユ湡
- //userData.Email = odsc.Email__c;//鐢靛瓙閭欢
- userData.Mobile_Phone__c = odsc.MobilePhone__c;//鎵嬫満鍙风爜
- //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴浣嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
- if(String.isNotBlank(odsc.Post__c) || buffer != 1){
- userData.Post__c = odsc.Post__c;//鑱屼綅
- }
- String zz = '';
- if(odsc.Job_Category__c == '鏈嶅姟'){
- zz = '閿�鍞湇鍔�';
- }else if(odsc.Job_Category__c == '鎺ㄥ箍'){
- zz = '閿�鍞帹骞�';
- }else{
- zz = odsc.Job_Category__c;
- }
- //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴绉嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
- if(String.isNotBlank(zz) || buffer != 1){
- userData.Job_Category__c = zz;//鑱岀
- }
- //userData.Product_specialist_incharge_product__c = odsc.Product_specialist_incharge_product__c;//璐熻矗浜у搧锛堜富锛�
- //userData.Sales_Speciality__c = odsc.Sales_Speciality__c;//閿�鍞伐浣滃唴瀹�
- //HR淇℃伅涓婄殑宸ヤ綔鍦版洿鏂板埌鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級涓� thh 2022-02-16 start
- userData.Work_Location_HR__c = odsc.Work_Location__c;
- //HR淇℃伅涓婄殑宸ヤ綔鍦版洿鏂板埌鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級涓� thh 2022-02-16 end
- userData.Stay_or_not__c = odsc.Stay_or_not__c;//鍦ㄨ亴/宸茬鑱�
- //鐢变簬user鏈変竴涓獙璇佽鍒欙紝濡傛灉鍊间负宸茬鑱岋紝閭d箞PBI涓嶈兘涓簍rue锛屾墍浠ユ墜鍔ㄨ缃负false锛屽苟鎶奝BI瀵硅薄鐨勫�艰涓篺alse
- if(userData.Stay_or_not__c == '宸茬鑱�' && userData.PBI_Enable__c){//PBI鏄惁鍚敤
- userData.PBI_Enable__c = false;
- updateId.add(userData.id);
- }
- userData.Null_Update__c = odsc.Null_Update__c;
- userData.QuitDate__c = odsc.LeaveDate__c;//绂昏亴鏃ユ湡
- userData.IsMEBG__c=true;//鏄惁MEBG
- updateList.add(userData);
- }else{
- //濡傛灉娌℃湁鍦╱ser琛ㄤ腑鎵惧埌瀵瑰簲鐨勫憳宸ョ紪鐮侊紝閭d箞鏂板user
- User userData = new User();
- userData.Group_sales_dept__c = odsc.Category3__c;//缁熸嫭鏈儴
- if(String.isNotBlank(odsc.Category4__c)){
- userData.Dept__c = odsc.Category4__c;//鏈儴
- }
- userData.Category5__c = odsc.Category5__c;//閮�
- userData.Category6__c = odsc.Category6__c;//璇�
- userData.Employee_No__c = odsc.Employee_No__c;//鍛樺伐缂栫爜
- userData.Hire_Date__c = odsc.Hire_Date__c;//鍏ヨ亴鏃ユ湡
- userData.Email = odsc.Email__c;//鐢靛瓙閭欢,鏂板缓鏃讹紝濉啓鐢靛瓙閭欢
- userData.Username = '_'+odsc.Email__c;//鐢ㄦ埛鍚�
- userData.Mobile_Phone__c = odsc.MobilePhone__c;//鎵嬫満鍙风爜
- //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴浣嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
- if(String.isNotBlank(odsc.Post__c) || buffer != 1){
- userData.Post__c = odsc.Post__c;//鑱屼綅
- }
- String zz = '';
- if(odsc.Job_Category__c == '鏈嶅姟'){
- zz = '閿�鍞湇鍔�';
- }else if(odsc.Job_Category__c == '鎺ㄥ箍'){
- zz = '閿�鍞帹骞�';
- }else{
- zz = odsc.Job_Category__c;
- }
- //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴绉嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
- if(String.isNotBlank(zz) || buffer != 1){
- userData.Job_Category__c = zz;//鑱岀
- }
- userData.Null_Update__c = odsc.Null_Update__c;
- userData.Product_specialist_incharge_product__c = odsc.Product_specialist_incharge_product__c;//璐熻矗浜у搧锛堜富锛�
- userData.Sales_Speciality__c = odsc.Sales_Speciality__c;//閿�鍞伐浣滃唴瀹�
- //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 start
- userData.Work_Location_HR__c = odsc.Work_Location__c;
- userData.Work_Location__c = odsc.Work_Location__c;
- //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 end
- userData.Stay_or_not__c = odsc.Stay_or_not__c;//鍦ㄨ亴/宸茬鑱�
- userData.QuitDate__c = odsc.LeaveDate__c;//绂昏亴鏃ユ湡
- userData.IsMEBG__c=true;//鏄惁MEBG
- //鐢变簬ods鐨勫鍜屽悕閮芥槸鎷奸煶锛屾墍浠ヨ幏鍙杗ame__c鐨勫�硷紝骞朵笖棣栧瓧姣嶇涓�浣嶄负濮擄紝鍏朵綑涓哄悕
- if(String.isNotBlank(odsc.Name__c)){
- if(odsc.Name__c.length() > 1){
- userData.LastName = odsc.Name__c.substring(0,1);
- userData.FirstName = odsc.Name__c.substring(1,odsc.Name__c.length());
- userData.Alias = odsc.Name__c;
- }
- }
- //浠ヤ笅鏄郴缁熼粯璁�
- userData.FederationIdentifier = odsc.Employee_No__c + '@olympus.com.cn';
- userData.EmailEncodingKey = 'UTF-8';//鐢靛瓙閭欢缂栫爜
- userData.IsActive = false;
- userData.TimeZoneSidKey = 'Asia/Shanghai';//鏃跺尯
- userData.LocaleSidKey = 'ja_JP';//鍖哄煙
- userData.LanguageLocaleKey = 'zh_CN';//璇█
- //userData.DefaultCurrencyIsoCode = 'CNY';//榛樿甯佺 ISO 浠g爜
- //userData.CurrencyIsoCode = 'CNY';//淇℃伅甯佺
- //榛樿ods鍒涘缓鐨剈ser鐢ㄦ埛鐨勭畝妗d负 999_鐪嬩笉瑙丳rofile
- userData.Profileid = '00e10000000dFYJ';
-
- insertList.add(userData);
- }
- }
-
- //PBI鏁版嵁鏇存柊
- //鐢变簬user鏈変竴涓獙璇佽鍒欙紝濡傛灉鍊煎彉涓哄凡绂昏亴锛岄偅涔圥BI涓嶈兘涓簍rue锛屾墍浠ユ墜鍔ㄨ缃负false锛屽苟鎶奝BI瀵硅薄鐨勫�艰涓篺alse
- if(updateId.size() > 0){
- List<PBIAuthorization__c> pbiUpd = [select id,name,PBI_Enable__c,User__c from PBIAuthorization__c where user__c in :updateId and PBI_Enable__c = true];
- if(pbiUpd != null && pbiUpd.size() > 0){
- for(PBIAuthorization__c pc : pbiUpd){
- pc.PBI_Enable__c = false;
- }
- }
- //棣栧厛鏇存柊 PBI鏉冮檺涓篺alse
- if(pbiUpd.size() > 0){
- update pbiUpd;
- }
- }
- if(insertList.size() > 0 || updateList.size() > 0){
- ID jobId = system.enqueueJob(new UserUpsertQueueable(insertList,updateList));
- AsyncApexJob jobInfo = [select status,NumberOfErrors from AsyncApexJob where id =:jobId];
- System.debug('--------------------闃熷垪鏃ュ織'+jobInfo);
- }
- }
- //add wangweipeng 2021/11/18 start
-
- @future (callout=true)
- public static void upsertFutureContact(String sessionId, List<Id> userIdList) {
- HttpRequest req = new HttpRequest();
- req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/apexrest/UserToContact');
-System.debug('Endpoint ' + req.getEndpoint());
- req.setMethod('POST');
-
- // header
- String authorizationHeader = 'OAuth ' + sessionId;
-System.debug(authorizationHeader);
- req.setHeader('Authorization', authorizationHeader);
-
- // body
- String restBody = '{"userIdList":' + JSON.serialize(userIdList) + '}';
-System.debug('JSON ' + restBody);
- req.setBody(restBody);
-
- // Create a new http object to send the request object
- Http http = new Http();
- HTTPResponse res = http.send(req);
-System.debug(res.getBody());
- }
-
- public static List<Daily_Report__c> reportSelectById(String id){
- List<Daily_Report__c> reportList = [select id, name, Reporter__c, Reported_Date__c, Daily_Report_Data_Type__c,
- Working_Time_From__c, Working_Time_To__c, Status__c, Mail_Send_Check__c,
- Business_Trip__c, Submit_Date_New__c, Submit_DateTime_New__c, Approved_Date__c,
- Approved_DateTime__c, CreatedById, Feed_Back_From_Manager__c, FeedbackManager__c,
- Planning_Time__c, Submission_Elapsed_Hour__c, Approval_Elapsed_Time__c,
- Activity_ID__c, Manager_Mail__c, Status_With_Check__c
- from Daily_Report__c where Id = :id];
- return reportList;
- }
-
- public static List<Event> eventSelectByUsers(String soql, List<Date> mdates, List<Id> users) {
- return Database.query(soql);
- }
- public static Map<Id, Daily_Report__c> reportMapSelectByIds(List<Id> ids){
- Map<Id, Daily_Report__c> reportMap = new Map<Id, Daily_Report__c>([select id, Status__c, Submit_Date_New__c
- from Daily_Report__c where Id IN :ids]);
- return reportMap;
- }
-
- public static List<Opportunity> oppSelectForPersonTaget(Id rtId, User[] users, String currentPeriod) {
- Opportunity[] opportunitys = [select
- Id, OwnerId, Opportunity_Category__c, Proportion__c, CloseDate,
- Amount, Objective__c, Target_category__c,
- SAP_Province__c, RecordTypeId, OCM_Target_period__c
- from Opportunity
- where Target_category__c = '鎷呭綋鐩爣'
- and RecordTypeId = :rtId
- and OwnerId in :users
- and OCM_Target_period__c = :currentPeriod
- ];
- return opportunitys;
- }
-
- public static List<Opportunity> oppSelectForLock(List<String> oppIds) {
- List<Opportunity> opps = [select Id
- ,Last_Visit_Scheduled_Date__c
- ,Xin_Last_Follow_Up_Date_For_Report__c, Xin_Gross_Follow_Num__c,Visit_President_Count__c,Visit_Head_Doctor_Count__c,Num_Of_NTC__c
- // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
- ,Follow_up_comment__c
- // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 End
- ,Num_Of_OPD__c
- from Opportunity where Id in :oppIds for update];
- return opps;
- }
-
- public static List<Opportunity> oppSelectForCity(List<String> oppIds) {
- List<Opportunity> opps = [select Id, Account.Parent.RecordTypeId, Account.Parent.Parent.RecordTypeId, Account.Parent.Parent.City_Master__r.Name, Account.City_Master__r.Name from Opportunity where Id in :oppIds];
- return opps;
- }
-
- public static void updOppList(List<Opportunity> oppUpdateList){
- if (oppUpdateList != null && oppUpdateList.size() > 0) update oppUpdateList;
- }
-
- public static void updOpp(Opportunity opp) {
- update opp;
- }
-
- public static List<Opportunity2__c> opp2SelectForSync(List<String> oppIds) {
- List<Opportunity2__c> opp2s = [select Id, Opportunity__c from Opportunity2__c where Opportunity__c in :oppIds];
- return opp2s;
- }
-
- public static List<Product2__c> pr2SelectForSync(List<Product2> pr2Ids) {
- List<Product2__c> pr2s = [select Id, Product2__c from Product2__c where Product2__c in :pr2Ids];
- return pr2s;
- }
-
- public static List<Maintenance_Contract__c> mcSelectForLock(List<String> serviceIds) {
- List<Maintenance_Contract__c> mcs = [select Id, Xin_Last_Follow_Day__c from Maintenance_Contract__c where Id in :serviceIds for update];
- return mcs;
- }
-
- public static void delEvent1ForTrigger(List<String> conIds) {
- List<Activity_History_Daily_Report__c> ahdrList = [select Id from Activity_History_Daily_Report__c where Contact__c in :conIds];
- if (ahdrList.size() > 0) delete ahdrList;
- }
-
- public static void delEvent2ForTrigger(List<String> oppIds) {
- List<Event_Oppotunity__c> eoList = [select Id from Event_Oppotunity__c where Opportunity__c in :oppIds];
- if (eoList.size() > 0) delete eoList;
- }
-
- public static void delEvent3ForTrigger(List<String> mcIds) {
- List<Event_Service__c> esList = [select Id from Event_Service__c where Service__c in :mcIds];
- if (esList.size() > 0) delete esList;
- }
-
- public static void upsEventC(List<Event__c> acts) {
- System.debug('Event__c1111' + acts);
- if(acts.size() > 0) upsert acts;
- }
-
- public static void upsEvent(List<Event> acts) {
- if(acts.size() > 0) upsert acts;
- }
-
- public static void delEvent(Set<String> eventCIdSet, Map<Id, Event__c> eventC_eventMap) {
- // 鍓婇櫎銇欍倠鍓嶃伀銆乨elete_flg銈抰rue銇仚銈�
- List<Event> delList = [select Id from Event where EventC_ID__c in :eventCIdSet];
- ControllerUtil.delEventIdSet.addAll((new Map<Id, SObject>(delList)).keySet());
- if (delList.size() > 0) {
- delete delList;
- }
- // Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�
- delList = [select Id from Event where Id in :eventC_eventMap.keySet()];
- ControllerUtil.delEventIdSet.addAll((new Map<Id, SObject>(delList)).keySet());
- if (delList.size() > 0) {
- delete delList;
- }
- }
-
- public static void delEventOnly(String Id) {
- List<Event> delList = [select Id from Event where id = :Id];
- if (delList.size() > 0) {
- delete delList;
- }
- }
-
- public static void insSFDelete(List<SFDelete__c> dlist) {
- if (dlist.size() > 0) insert dList;
- }
-
- public static void upsEventC2Event(Map<Id, Event__c> eventCMap, Map<Id, Event__c> eventC_eventMap) {
- List<Event> unDelList = new List<Event>();
- List<Event> upsList = new List<Event>();
- List<Id> updateEIds = new List<Id>();
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
- Set<String> idSet = new Set<String>();
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� end
- Map<String, String> dupUpdIdMap = new Map<String, String>();
-
- // 鏃ュ牨鐢婚潰銇嬨倝Event__c銈掓洿鏂般仚銈嬫檪
- // 鈶燛vent銇獷vent__c銇搞伄鍙傜収ID銇屻亗銈�
- // IsArchived = false 銈掓潯浠躲伀杩藉姞銇欍倠銇撱仺銇倛銈娿�侊紤骞翠互涓娿伄鍫村悎Event_C銇嬨倝Event銇稿悓鏈熴仐銇俱仜銈擄紒锛�
- if (eventCMap.keySet().size() > 0) {
- List<Event> eList = [select Id, EventC_ID__c, IsDeleted from Event where EventC_ID__c in :eventCMap.keySet() and IsArchived = false all rows];
- if (eList.size() > 0) {
- for (Event e : eList) {
- updateEIds.add(e.Id);
- Event__c ec = eventCMap.get(e.EventC_ID__c);
-System.debug('Event銇獷vent__c銇搞伄鍙傜収ID銇屻亗銈�:::::' + e.Id + ',' + e.EventC_ID__c);
-System.debug('ec.Subject__c:::::'+ec.Subject__c);
-System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
-System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
-System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
-System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
-System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
-System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
-System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
-System.debug('ec.Location__c:::::'+ec.Location__c);
-System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
-System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
-System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
-System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
-System.debug('ec.whatid__c:::::'+ec.whatid__c);
- e.Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c;
- e.IsAllDayEvent = false;
- e.ActivityDateTime = ec.StartDateTime__c;
- e.StartDateTime = ec.StartDateTime__c;
- e.EndDateTime = ec.EndDateTime__c;
- e.DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60);
- e.Main_Visit_Location__c = ec.Main_Visit_Location__c;
- e.Activity_Type2__c = ec.Activity_Type2__c;
- e.Purpose_Type__c = ec.Purpose_Type__c;
- e.Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c;
- e.Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c;
- e.Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c;
- e.Related_Opportunity1__c = ec.Related_Opportunity1__c;
- e.Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c;
- e.Related_Opportunity2__c = ec.Related_Opportunity2__c;
- e.Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c;
- e.Related_Opportunity3__c = ec.Related_Opportunity3__c;
- e.Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c;
- e.Related_Opportunity4__c = ec.Related_Opportunity4__c;
- e.Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c;
- e.Related_Opportunity5__c = ec.Related_Opportunity5__c;
- e.Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c;
- e.Related_Service1__c = ec.Related_Service1__c;
- e.Related_Service1_ID__c = ec.Related_Service1_ID__c;
- e.Visitor1__c = ec.Visitor1__c;
- e.Visitor2__c = ec.Visitor2__c;
- e.Visitor3__c = ec.Visitor3__c;
- e.Visitor4__c = ec.Visitor4__c;
- e.Visitor5__c = ec.Visitor5__c;
- e.Visitor1_ID__c = ec.Visitor1_ID__c;
- e.Visitor2_ID__c = ec.Visitor2_ID__c;
- e.Visitor3_ID__c = ec.Visitor3_ID__c;
- e.Visitor4_ID__c = ec.Visitor4_ID__c;
- e.Visitor5_ID__c = ec.Visitor5_ID__c;
- e.Activity_Purpose__c = ec.Activity_Purpose__c;
- e.Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c;
- e.Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c;
- e.whatid__c = ec.whatid__c;
- e.EventC_ID__c = ec.Id;
- e.WhatId = ec.Daily_Report__c;
- e.IsScheduled__c = ec.IsScheduled__c;
- e.BeforeActivityDate__c = ec.BeforeActivityDate__c;
- e.AppCdId__c = ec.AppCdId__c;
- e.SyncCreatedDate__c = ec.SyncCreatedDate__c;
- e.WS_flg__c = false;
- if (e.IsDeleted) {
-System.debug('e.IsDeleted:::::'+e.IsDeleted);
- unDelList.add(e);
- }
- if (ec.Activity_Type2__c == 'Holiday') {
- e.ShowAs = 'OutOfOffice';
- }
- upsList.add(e);
- eventCMap.remove(e.EventC_ID__c); // 鏇存柊銇椼仧銈傘伄銈扢ap銇嬨倝鍓婇櫎
- dupUpdIdMap.put(e.Id, e.Id);
- }
- }
- }
- List<Event__c> ecList = eventCMap.values();
- // 鈶″弬鐓D銇傘倠銈傘伄銈掗櫎銇勩仸銆佹柊瑕�
- if (ecList.size() > 0) {
- List<Event> insE = new List<Event>();
- for (Event__c ec : ecList) {
- // Event__c銇獷vent_ID__c銇屻仾銇勩�併仱銇俱倞鏃ュ牨鐢婚潰銇嬨倝浣滄垚銇曘倢銇熸檪
- if (ec.Event_ID__c == null) {
-System.debug('Event__c銇獷vent_ID__c銇屻仾銇勩�併仱銇俱倞鏃ュ牨鐢婚潰銇嬨倝浣滄垚銇曘倢銇熸檪:::::' + ec.Id);
-System.debug('ec.Subject__c:::::'+ec.Subject__c);
-System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
-System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
-System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
-System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
-System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
-System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
-System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
-System.debug('ec.Location__c:::::'+ec.Location__c);
-System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
-System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
-System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
-System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
-System.debug('ec.whatid__c:::::'+ec.whatid__c);
- Event e = new Event(
- OwnerId = ec.Reporter__c,
- Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c,
- IsAllDayEvent = false,
- ActivityDateTime = ec.StartDateTime__c,
- StartDateTime = ec.StartDateTime__c,
- EndDateTime = ec.EndDateTime__c,
- DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60),
- Main_Visit_Location__c = ec.Main_Visit_Location__c,
- Activity_Type2__c = ec.Activity_Type2__c,
- Purpose_Type__c = ec.Purpose_Type__c,
- Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c,
- Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c,
- Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c,
- Related_Opportunity1__c = ec.Related_Opportunity1__c,
- Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c,
- Related_Opportunity2__c = ec.Related_Opportunity2__c,
- Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c,
- Related_Opportunity3__c = ec.Related_Opportunity3__c,
- Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c,
- Related_Opportunity4__c = ec.Related_Opportunity4__c,
- Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c,
- Related_Opportunity5__c = ec.Related_Opportunity5__c,
- Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c,
- Related_Service1__c = ec.Related_Service1__c,
- Related_Service1_ID__c = ec.Related_Service1_ID__c,
- Visitor1__c = ec.Visitor1__c,
- Visitor2__c = ec.Visitor2__c,
- Visitor3__c = ec.Visitor3__c,
- Visitor4__c = ec.Visitor4__c,
- Visitor5__c = ec.Visitor5__c,
- Visitor1_ID__c = ec.Visitor1_ID__c,
- Visitor2_ID__c = ec.Visitor2_ID__c,
- Visitor3_ID__c = ec.Visitor3_ID__c,
- Visitor4_ID__c = ec.Visitor4_ID__c,
- Visitor5_ID__c = ec.Visitor5_ID__c,
- Activity_Purpose__c = ec.Activity_Purpose__c,
- Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c,
- Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c,
- whatid__c = ec.whatid__c,
- EventC_ID__c = ec.Id,
- IsScheduled__c = ec.IsScheduled__c,
- WhatId = ec.Daily_Report__c,
- BeforeActivityDate__c = ec.BeforeActivityDate__c,
- AppCdId__c = ec.AppCdId__c,
- SyncCreatedDate__c = ec.SyncCreatedDate__c,
- WS_flg__c = false,
- EventStatus__c = '02 鎺ュ彈'
- );
- if (ec.Activity_Type2__c == 'Holiday') {
- e.ShowAs = 'OutOfOffice';
- }
- upsList.add(e);
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
- //鎶ュ憡涓�瑙堟柊寤轰簨浠舵椂,灏嗕簨浠剁殑Id璧嬪�煎埌鎶ュ憡涓�瑙堜笂
- idSet.add(ec.Id);
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� end
- } else {
- // 銈枫兂銉椼儷銇嬨倝閬风Щ銇欍倠鍫村悎銆丒vent_ID__c蹇呫仛銇傘倠銇嬨倝銆併儜銈�
- }
- }
- }
-
- // Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�
- if (eventC_eventMap.keySet().size() > 0) {
- List<Event> eList = [select Id, IsDeleted from Event where Id in :eventC_eventMap.keySet() and IsArchived = false all rows];
- if (eList.size() > 0) {
- for (Event e : eList) {
- if (dupUpdIdMap.containsKey(e.Id)) {
- continue;
- }
- updateEIds.add(e.Id);
- Event__c ec = eventC_eventMap.get(e.Id);
-System.debug('Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�:::::' + e.Id + ',' + ec.Id);
-System.debug('ec.Subject__c:::::'+ec.Subject__c);
-System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
-System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
-System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
-System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
-System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
-System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
-System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
-System.debug('ec.Location__c:::::'+ec.Location__c);
-System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
-System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
-System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
-System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
-System.debug('ec.whatid__c:::::'+ec.whatid__c);
- e.Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c;
- e.IsAllDayEvent = false;
- e.ActivityDateTime = ec.StartDateTime__c;
- e.StartDateTime = ec.StartDateTime__c;
- e.EndDateTime = ec.EndDateTime__c;
- e.DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60);
- e.Main_Visit_Location__c = ec.Main_Visit_Location__c;
- e.Activity_Type2__c = ec.Activity_Type2__c;
- e.Purpose_Type__c = ec.Purpose_Type__c;
- e.Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c;
- e.Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c;
- e.Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c;
- e.Related_Opportunity1__c = ec.Related_Opportunity1__c;
- e.Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c;
- e.Related_Opportunity2__c = ec.Related_Opportunity2__c;
- e.Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c;
- e.Related_Opportunity3__c = ec.Related_Opportunity3__c;
- e.Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c;
- e.Related_Opportunity4__c = ec.Related_Opportunity4__c;
- e.Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c;
- e.Related_Opportunity5__c = ec.Related_Opportunity5__c;
- e.Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c;
- e.Related_Service1__c = ec.Related_Service1__c;
- e.Related_Service1_ID__c = ec.Related_Service1_ID__c;
- e.Visitor1__c = ec.Visitor1__c;
- e.Visitor2__c = ec.Visitor2__c;
- e.Visitor3__c = ec.Visitor3__c;
- e.Visitor4__c = ec.Visitor4__c;
- e.Visitor5__c = ec.Visitor5__c;
- e.Visitor1_ID__c = ec.Visitor1_ID__c;
- e.Visitor2_ID__c = ec.Visitor2_ID__c;
- e.Visitor3_ID__c = ec.Visitor3_ID__c;
- e.Visitor4_ID__c = ec.Visitor4_ID__c;
- e.Visitor5_ID__c = ec.Visitor5_ID__c;
- e.Activity_Purpose__c = ec.Activity_Purpose__c;
- e.Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c;
- e.Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c;
- e.whatid__c = ec.whatid__c;
- e.EventC_ID__c = ec.Id;
- e.IsScheduled__c = ec.IsScheduled__c;
- e.WhatId = ec.Daily_Report__c;
- e.BeforeActivityDate__c = ec.BeforeActivityDate__c;
- e.AppCdId__c = ec.AppCdId__c;
- e.SyncCreatedDate__c = ec.SyncCreatedDate__c;
- e.WS_flg__c = false;
- if (e.IsDeleted) {
-System.debug('e.IsDeleted:::::'+e.IsDeleted);
- unDelList.add(e);
- }
- if (ec.Activity_Type2__c == 'Holiday') {
- e.ShowAs = 'OutOfOffice';
- }
- upsList.add(e);
- }
- }
- }
- StaticParameter.NotUpdEventCFlg = true;
- if (unDelList.size() > 0) undelete unDelList;
- if (upsList.size() > 0) {
- List<Event> eList = [select EventC_ID__c, IsDeleted, Related_Opportunity1_ID__c,WhatId, WhoID from Event where Id in :updateEIds and IsArchived = false for update];
-System.debug('upsert 鐩村墠 start');
- for (Event e : eList) {
-System.debug('e.Id:::::'+e.Id);
-System.debug('e.EventC_ID__c:::::'+e.EventC_ID__c);
-System.debug('e.IsDeleted:::::'+e.IsDeleted);
-System.debug('e.Related_Opportunity1_ID__c:::::'+e.Related_Opportunity1_ID__c);
-System.debug('e.WhatId:::::'+e.WhatId);
-System.debug('e.WhoID:::::'+e.WhoID);
- }
-System.debug('upsert 鐩村墠 end');
- upsert upsList;
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
- //鏍规嵁IdSet 缁欐姤鍛婁竴瑙堢殑浜嬩欢Id璧嬪��
- List<Event__c> needUpdateEvent = new List<Event__c>();
- for(event e :upsList){
- if( IdSet.contains(e.EventC_ID__c) ){
- Event__c ec = new Event__c();
- ec.Id = e.EventC_ID__c;
- ec.Event_ID__c = e.Id;
- needUpdateEvent.add(ec);
- }
- }
-
- if(needUpdateEvent.size()>0){
- update needUpdateEvent;
- }
- //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
-
- }
- }
-
- public static void eventDelIns(Set<Id> actDelListForDelIns,
- List<Activity_History_Daily_Report__c> ahdrUpSertList, List<Event_Oppotunity__c> eoUpSertList,List<Event_Service__c> esUpSertList){
- // 鍙栧紩鍏堣铂浠昏�呫�佸紩鍚堛�併偟銉笺儞銈瑰绱勩伄娲诲嫊銇� delete insert 銇欍倠
- List<Activity_History_Daily_Report__c> ahdrDelList = [select id from Activity_History_Daily_Report__c where EventC_ID__c =:actDelListForDelIns ];
- List<Event_Oppotunity__c> eoDelList = [select id from Event_Oppotunity__c where EventC_ID__c =:actDelListForDelIns ];
- List<Event_Service__c> esDelList = [select id from Event_Service__c where EventC_ID__c =:actDelListForDelIns ];
-
- if(ahdrDelList.size() > 0){
- delete ahdrDelList;
- }
- if(eoDelList.size() > 0){
- delete eoDelList;
- }
- if(esDelList.size() > 0){
- delete esDelList;
- }
- if(ahdrUpSertList.size() > 0){
- insert ahdrUpSertList;
- }
- if(eoUpSertList.size() > 0){
- insert eoUpSertList;
- }
- if(esUpSertList.size() > 0){
- insert esUpSertList;
- }
- }
-
- public static void eventDel(String delId){
- List<Event__c> ecList = [select id from Event__c where Id =:delId];
- if(ecList.size() > 0){
- delete ecList;
- }
-
- List<Report__c> rList = [select id, Delete_Flg__c from Report__c where Event_Id__c =:delId];
- if(rList.size() > 0){
- delete rList;
- }
-
- List<Visit_Report__c> vrList = [select id, Delete_Flg__c from Visit_Report__c where Event_Id__c =:delId];
- if(vrList.size() > 0){
- delete vrList;
- }
-
- List<QIS_Report__c> qrList = [select id from QIS_Report__c where Event_Id__c =:delId];
- if(qrList.size() > 0){
- delete qrList;
- }
-
- List<Activity_History_Daily_Report__c> e1List = [select id from Activity_History_Daily_Report__c where EventC_Id__c =:delId];
- if(e1List.size() > 0){
- delete e1List;
- }
-
- List<Event_Oppotunity__c> e2List = [select id from Event_Oppotunity__c where EventC_Id__c =:delId];
- if(e2List.size() > 0){
- delete e2List;
- }
-
- List<Event_Service__c> e3List = [select id from Event_Service__c where EventC_Id__c =:delId];
- if(e3List.size() > 0){
- delete e3List;
- }
- }
-
- public static void insOpp2List(List<Opportunity2__c> opp2List){
- if (opp2List != null && opp2List.size() > 0) insert opp2List;
- }
- public static void updOpp2List(List<Opportunity2__c> opp2List){
- if (opp2List != null && opp2List.size() > 0) update opp2List;
- }
- public static void delOpp2List(List<Opportunity2__c> opp2List){
- if (opp2List != null && opp2List.size() > 0) delete opp2List;
- }
-
- public static void insPr2List(List<Product2__c> pr2List){
- if (pr2List != null && pr2List.size() > 0) insert pr2List;
- }
- public static void updelPr2List(List<Product2__c> updPr2List, List<Product2__c> delPr2List){
- if (updPr2List != null && updPr2List.size() > 0) update updPr2List;
- if (delPr2List != null && delPr2List.size() > 0) delete delPr2List;
- }
- public static void delPr2List(List<Product2__c> pr2List){
- if (pr2List != null && pr2List.size() > 0) delete pr2List;
- }
-
- public static void insMBAccountList(List<MB_Account__c> mbaccList){
- if (mbaccList != null && mbaccList.size() > 0) insert mbaccList;
- }
- public static void delMBAccountList(List<Account> accountIds){
- List<MB_Account__c> mbaccs = [select Id, Account__c from MB_Account__c where Account__c in :accountIds];
- if (mbaccs != null && mbaccs.size() > 0) delete mbaccs;
- }
-
- public static void updMBAccountList(List<Account> accountIds){
- List<MB_Account__c> mbaccs = [select Id, Account__r.HP_146POCM_Category_From_Dept__c, Account__r.Province_formula__c, Account__r.Department_Class_Name__c from MB_Account__c where Account__c in :accountIds];
- if (mbaccs.size() > 0) {
- for (MB_Account__c mbacc : mbaccs) {
- mbacc.Opp_OCM_text__c = mbacc.Account__r.HP_146POCM_Category_From_Dept__c;
- mbacc.State_Text__c = mbacc.Account__r.Province_formula__c;
- mbacc.Opportunity_Category_text__c = mbacc.Account__r.Department_Class_Name__c;
- }
- update mbaccs;
- }
- }
-
- // 瑷虹檪绉戦厤涓嬨伄MB銉嗐兗銉栥儷銈掓洿鏂�
- public static void updMBChildFromDpt(Map<Id, Account> accDptMap) {
- if (accDptMap.keySet().size() == 0) return;
- List<MB_Repair__c> mbRepList = [Select Id, Repair__r.Account__c from MB_Repair__c where Repair__r.Account__c IN :accDptMap.keySet()];
- if (mbRepList.size() > 0) {
- for (MB_Repair__c mb : mbRepList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Repair__r.Account__c).OCM_Category__c;
- mb.State_Text__c = accDptMap.get(mb.Repair__r.Account__c).State_Text__c;
- mb.Opportunity_Category_text__c = accDptMap.get(mb.Repair__r.Account__c).Department_Class_Name__c;
- }
- update mbRepList;
- }
- List<MB_Event__c> mbEvtList = [Select Id, Event__r.Account_ID__c from MB_Event__c where Event__r.Account_ID__c IN :accDptMap.keySet()];
- if (mbEvtList.size() > 0) {
- for (MB_Event__c mb : mbEvtList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Event__r.Account_ID__c).OCM_Category__c;
- mb.State_Text__c = accDptMap.get(mb.Event__r.Account_ID__c).State_Text__c;
- mb.Opportunity_Category_text__c = accDptMap.get(mb.Event__r.Account_ID__c).Department_Class_Name__c;
- }
- update mbEvtList;
- }
- List<MB_Report__c> mbRptList = [Select Id, Report__r.Hospital_Department__c from MB_Report__c where Report__r.Hospital_Department__c IN :accDptMap.keySet()];
- if (mbRptList.size() > 0) {
- for (MB_Report__c mb : mbRptList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).OCM_Category__c;
- mb.State_Text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).State_Text__c;
- mb.Opportunity_Category_text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).Department_Class_Name__c;
- }
- update mbRptList;
- }
- List<MB_Maintenance_Contract__c> mbmcList = [Select Id, Maintenance_Contract__r.Department__c from MB_Maintenance_Contract__c where Maintenance_Contract__r.Department__c IN :accDptMap.keySet()];
- if (mbmcList.size() > 0) {
- for (MB_Maintenance_Contract__c mb : mbmcList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).OCM_Category__c;
- mb.State_Text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).State_Text__c;
- mb.Opportunity_Category_text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).Department_Class_Name__c;
- }
- update mbmcList;
- }
- List<MB_Asset__c> mbAstList = [Select Id, Asset__r.AccountId from MB_Asset__c where Asset__r.AccountId IN :accDptMap.keySet()];
- if (mbAstList.size() > 0) {
- for (MB_Asset__c mb : mbAstList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Asset__r.AccountId).OCM_Category__c;
- mb.State_Text__c = accDptMap.get(mb.Asset__r.AccountId).State_Text__c;
- mb.Opportunity_Category_text__c = accDptMap.get(mb.Asset__r.AccountId).Department_Class_Name__c;
- }
- update mbAstList;
- }
- // 鍟嗚珖銆佸晢璜囧晢鍝併�佹敞娈嬨伀銇ゃ亜銇︺�丱CM_Category__c 銇岄仌銇嗗牬鍚堛伄銇� 鏇存柊瀵捐薄
- List<MB_Opportunity__c> mboppList = [Select Id, Opportunity__r.AccountId from MB_Opportunity__c where OCM_IsSame__c = false and Opportunity__r.AccountId IN :accDptMap.keySet()];
- if (mboppList.size() > 0) {
- for (MB_Opportunity__c mb : mboppList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Opportunity__r.AccountId).OCM_Category__c;
- }
- update mboppList;
- }
- List<MB_OpportunityLineItem__c> mbOliList = [Select Id, Opportunity__r.AccountId from MB_OpportunityLineItem__c where OCM_IsSame__c = false and Opportunity__r.AccountId IN :accDptMap.keySet()];
- if (mbOliList.size() > 0) {
- for (MB_OpportunityLineItem__c mb : mbOliList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Opportunity__r.AccountId).OCM_Category__c;
- }
- update mbOliList;
- }
- List<MB_Statu_Achievements__c> mbSAList = [Select Id, Statu_Achievements__r.Opportunity__r.AccountId from MB_Statu_Achievements__c where OCM_IsSame__c = false and Statu_Achievements__r.Opportunity__r.AccountId IN :accDptMap.keySet()];
- if (mbSAList.size() > 0) {
- for (MB_Statu_Achievements__c mb : mbSAList) {
- mb.Opp_OCM_text__c = accDptMap.get(mb.Statu_Achievements__r.Opportunity__r.AccountId).OCM_Category__c;
- }
- update mbSAList;
- }
- }
- public static void updMBChildFromOpp(Map<Id, Opportunity> oppMap) {
- if (oppMap.keySet().size() == 0) return;
- List<MB_Opportunity__c> mboppList = [Select Id, Opportunity__c from MB_Opportunity__c where Opportunity__c IN :oppMap.keySet()];
- if (mboppList.size() > 0) {
- for (MB_Opportunity__c mb : mboppList) {
- mb.State_Text__c = oppMap.get(mb.Opportunity__c).SaleProvince_SAP__c;
- mb.Opportunity_Category_text__c = oppMap.get(mb.Opportunity__c).Opportunity_Category__c;
- mb.Distributor_InCharge_opp__c = oppMap.get(mb.Opportunity__c).Distributor_InCharge_opp__c;
- mb.Group_purchase_PCL__c = oppMap.get(mb.Opportunity__c).Group_purchase_PCL__c;
- }
- update mboppList;
- }
- List<MB_OpportunityLineItem__c> mbOliList = [Select Id, Opportunity__c from MB_OpportunityLineItem__c where Opportunity__c IN :oppMap.keySet()];
- if (mbOliList.size() > 0) {
- for (MB_OpportunityLineItem__c mb : mbOliList) {
- mb.State_Text__c = oppMap.get(mb.Opportunity__c).SaleProvince_SAP__c;
- mb.Opportunity_Category_text__c = oppMap.get(mb.Opportunity__c).Opportunity_Category__c;
- mb.Distributor_InCharge_opp__c = oppMap.get(mb.Opportunity__c).Distributor_InCharge_opp__c;
- mb.Group_purchase_PCL__c = oppMap.get(mb.Opportunity__c).Group_purchase_PCL__c;
- }
- update mbOliList;
- }
- List<MB_Statu_Achievements__c> mbSAList = [Select Id, Statu_Achievements__r.Opportunity__c from MB_Statu_Achievements__c where Statu_Achievements__r.Opportunity__c IN :oppMap.keySet()];
- if (mbSAList.size() > 0) {
- for (MB_Statu_Achievements__c mb : mbSAList) {
- mb.State_Text__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).SaleProvince_SAP__c;
- mb.Opportunity_Category_text__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Opportunity_Category__c;
- mb.Distributor_InCharge_opp__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Distributor_InCharge_opp__c;
-// mb.Group_purchase_PCL__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Group_purchase_PCL__c;
- }
- update mbSAList;
- }
- }
- public static void updMBChildFromUser(Map<Id, User> userMap) {
- // 鐩銇仱銇勩仸銆侀亱鐢ㄥ伌銇с�佺洰妯欑敾闈€伀銇﹀啀淇濆瓨銇欍倠銇撱仺
- if (userMap.keySet().size() == 0) return;
- List<MB_Daily_Report__c> mbDRList = [Select Id, Daily_Report__r.Reporter__c from MB_Daily_Report__c where Daily_Report__r.Reporter__c IN :userMap.keySet()];
- if (mbDRList.size() > 0) {
- for (MB_Daily_Report__c mb : mbDRList) {
- mb.State_Text__c = userMap.get(mb.Daily_Report__r.Reporter__c).Province__c;
- }
- update mbDRList;
- }
- List<MB_Event__c> mbEvtList = [Select Id, Event__r.Daily_Report__r.Reporter__c from MB_Event__c where Event__r.Hospital_ID__c = null and Event__r.Daily_Report__r.Reporter__c IN :userMap.keySet()];
- if (mbEvtList.size() > 0) {
- for (MB_Event__c mb : mbEvtList) {
- mb.State_Text__c = userMap.get(mb.Event__r.Daily_Report__r.Reporter__c).Province__c;
- }
- update mbEvtList;
- }
- }
- public static void upUserFederationIdentifier(List<User> userList) {
- update userList;
- }
-
- public static void insMBStatuAchievementList(List<MB_Statu_Achievements__c> ins_mbs){
- if (ins_mbs != null && ins_mbs.size() > 0) insert ins_mbs;
- }
- public static void delMBStatuAchievementList(List<Statu_Achievements__c> del_parents){
- List<MB_Statu_Achievements__c> mbSAList = [select Id, Statu_Achievements__c from MB_Statu_Achievements__c where Statu_Achievements__c in :del_parents];
- if (mbSAList != null && mbSAList.size() > 0) delete mbSAList;
- }
-
- public static void insMBRepairList(List<MB_Repair__c> mbrepairList){
- if (mbrepairList != null && mbrepairList.size() > 0) insert mbrepairList;
- }
- public static void delMBRepairList(List<Repair__c> del_parents){
- List<MB_Repair__c> mbrepairList = [select Id, Repair__c from MB_Repair__c where Repair__c in :del_parents];
- if (mbrepairList != null && mbrepairList.size() > 0) delete mbrepairList;
- }
-
- public static void insMBEventList(List<MB_Event__c> mbeventList){
- if (mbeventList != null && mbeventList.size() > 0) insert mbeventList;
- }
- public static void delMBEventList(List<Event__c> del_parents){
- List<MB_Event__c> mbeventList = [select Id, Event__c from MB_Event__c where Event__c in :del_parents];
- if (mbeventList != null && mbeventList.size() > 0) delete mbeventList;
- }
-
- public static void insMBReportList(List<MB_Report__c> mbreportList){
- if (mbreportList != null && mbreportList.size() > 0) insert mbreportList;
- }
- public static void delMBReportList(List<Report__c> del_parents){
- List<MB_Report__c> mbreportList = [select Id, Report__c from MB_Report__c where Report__c in :del_parents];
- if (mbreportList != null && mbreportList.size() > 0) delete mbreportList;
- }
-
- public static void insMBDRList(List<MB_Daily_Report__c> mbdrList){
- if (mbdrList != null && mbdrList.size() > 0) insert mbdrList;
- }
- public static void delMBDRList(List<Daily_Report__c> del_parents){
- List<MB_Daily_Report__c> mbdrList = [select Id, Daily_Report__c from MB_Daily_Report__c where Daily_Report__c in :del_parents];
- if (mbdrList != null && mbdrList.size() > 0) delete mbdrList;
- }
-
- public static void insMBMCList(List<MB_Maintenance_Contract__c> mbmcList){
- if (mbmcList != null && mbmcList.size() > 0) insert mbmcList;
- }
- public static void delMBMCList(List<Maintenance_Contract__c> del_parents){
- List<MB_Maintenance_Contract__c> mbmcList = [select Id, Maintenance_Contract__c from MB_Maintenance_Contract__c where Maintenance_Contract__c in :del_parents];
- if (mbmcList != null && mbmcList.size() > 0) delete mbmcList;
- }
-
- public static void insMBTgtList(List<MB_Target__c> mbtgtList){
- if (mbtgtList != null && mbtgtList.size() > 0) insert mbtgtList;
- }
- public static void delMBTgtList(List<Opportunity> del_parents){
- List<MB_Target__c> mbtgtList = [select Id, Opportunity__c from MB_Target__c where Opportunity__c in :del_parents];
- if (mbtgtList != null && mbtgtList.size() > 0) delete mbtgtList;
- }
- public static void insMBOppList(List<MB_Opportunity__c> mboppList){
- if (mboppList != null && mboppList.size() > 0) insert mboppList;
- }
- public static void delMBOppList(List<Opportunity> del_parents){
- List<MB_Opportunity__c> mboppList = [select Id, Opportunity__c from MB_Opportunity__c where Opportunity__c in :del_parents];
- if (mboppList != null && mboppList.size() > 0) delete mboppList;
- }
-
- public static void insMBTgtLineItemList(List<MB_TargetLineItem__c> mbTliList){
- if (mbTliList != null && mbTliList.size() > 0) insert mbTliList;
- }
- public static void delMBTgtLineItemList(List<String> del_parentIds){
- List<MB_TargetLineItem__c> mbTliList = [select Id, Opportunity__c from MB_TargetLineItem__c where OpportunityLineItemId__c in :del_parentIds];
- if (mbTliList != null && mbTliList.size() > 0) delete mbTliList;
- }
- public static void insMBOppLineItemList(List<MB_OpportunityLineItem__c> mbOliList){
- if (mbOliList != null && mbOliList.size() > 0) insert mbOliList;
- }
- public static void delMBOppLineItemList(List<String> del_parentIds){
- List<MB_OpportunityLineItem__c> mbOliList = [select Id, Opportunity__c from MB_OpportunityLineItem__c where OpportunityLineItemId__c in :del_parentIds];
- if (mbOliList != null && mbOliList.size() > 0) delete mbOliList;
- }
-
- public static void insMBAssetList(List<MB_Asset__c> mbassList){
- if (mbassList != null && mbassList.size() > 0) insert mbassList;
- }
- public static void delMBAssetList(List<Asset> del_parentIds) {
- List<MB_Asset__c> mbassList = [select Id, Asset__c from MB_Asset__c where Asset__c in :del_parentIds];
- if (mbassList != null && mbassList.size() > 0) delete mbassList;
- }
-
- public static void updDailyReport(Daily_Report__c report) {
- System.debug('Daily_Report__c11111' + report);
- update report;
- }
-
- public static void updMcList(List<Maintenance_Contract__c> mcs) {
- update mcs;
- }
-
- public static void updQuote(Quote quo) {
- update quo;
- }
-
- public static void delOppLine(List<OpportunityLineItem> ols) {
- delete ols;
- }
-
- public static void insOppLine(List<OpportunityLineItem> ols) {
- insert ols;
- }
-
- public static void updateMaintenance_Contract_Estimate(List<Maintenance_Contract_Estimate__c> mces) {
- update mces;
- }
- public static void deleteMaintenance_Contract_Asset_Estimate(List<Maintenance_Contract_Asset_Estimate__c> mcaes) {
- delete mcaes;
- }
- public static void insertMaintenance_Contract_Asset_Estimate(List<Maintenance_Contract_Asset_Estimate__c> mcaes) {
- insert mcaes;
- }
-
- public static void insMaterialFor(List<Material_For__c> mfList) {
- if (mfList != null && mfList.size() > 0) insert mfList;
- }
-
- public static void insProDocMidTbl(List<Product_and_document_middle_table__c> pdmtList) {
- if (pdmtList != null && pdmtList.size() > 0) insert pdmtList;
- }
-
- public static void insCicProMidTbl(List<CIC_case_and_product_middle_table__c> cpmtList) {
- if (cpmtList != null && cpmtList.size() > 0) insert cpmtList;
- }
-
- public static void delMaterialFor(String materialId, List<String> productIds) {
- List<Material_For__c> dels = [select Id from Material_For__c where Material__c = :materialId and Product__c in :productIds];
- if (dels.size() > 0) delete dels;
- }
-
- public static void delProDocMidTbl(String proDocId, List<String> productIds) {
- List<Product_and_document_middle_table__c> dels = [select Id from Product_and_document_middle_table__c where Product_document__c = :proDocId and Product_name__c in :productIds];
- if (dels.size() > 0) delete dels;
- }
-
- public static void delCicProMidTbl(String cicProId, List<String> productIds) {
- List<CIC_case_and_product_middle_table__c> dels = [select Id from CIC_case_and_product_middle_table__c where CIC__c = :cicProId and Product__c in :productIds];
- if (dels.size() > 0) delete dels;
- }
-
-//bp2
-// // 澶囧搧鐢�
-// public static void updEquipmentSetList(List<Equipment_Set__c> esList) {
-// if (esList != null && esList.size() > 0) update esList;
-// }
-// public static void updEquipmentSet(Equipment_Set__c es) {
-// if (es != null) update es;
-//// }
-//bp2
-// public static void setEquipmentSetProvisionFlg(Set<Id> esIds) {
-// // 鍌欏搧Set銇ㄨ哺鍑哄倷鍝丼et涓�瑕с伄涓诲緭闁總銈掕В闄ゃ仐銇熴仧銈併�併亾銇嗐仐銇﹀倷鍝丼et銇哺鍑哄倷鍝丼et涓�瑕с伄浠舵暟銈掕▓绠椼仚銈嬨仐銇嬨仾銇�
-// // 浠舵暟锛�0锛氥�屽紩褰撴笀銆嶃儠銉┿偘锛漈rue銆併仹銇亼銈屻伆False
-// AggregateResult[] ars = [select Count(Id) cnt, Equipment_Set__c from Rental_Apply_Equipment_Set__c where Equipment_Set__c in :esIds and RAES_Status__c != '涓婃灦瀹屼簡'and RAES_Status__c != '鍙栨秷鍒嗛厤' group by Equipment_Set__c];
-// List<Equipment_Set__c> esList = new List<Equipment_Set__c>();
-// for (AggregateResult ar : ars) {
-// Equipment_Set__c es = new Equipment_Set__c();
-// // 銉偝銉笺儔銇傘倠
-// if (esIds.contains(String.valueOf(ar.get('Equipment_Set__c')))) {
-// esList.add(new Equipment_Set__c(
-// Id = String.valueOf(ar.get('Equipment_Set__c')),
-// Provision_finish__c = true
-// ));
-// esIds.remove((Id)String.valueOf(ar.get('Equipment_Set__c')));
-// }
-// }
-// if (esIds.size() > 0) {
-// for (Id id : esIds) {
-// esList.add(new Equipment_Set__c(
-// Id = id,
-// Provision_finish__c = false
-// ));
-// }
-// }
-// update esList;
-// }
-//bp2
-// public static Equipment_Set__c setEquipmentSetProvisionFlg(Equipment_Set__c es) {
-// // 鑷垎銇屻�屼笂鏋跺畬浜嗐�嶃伀銇倠銇伅銆併仢銇緦銉堛儶銈仹銈勩倞銇俱仚銇嬨倝銆併亾銇撱伅鑷垎銇甀d銈掓姕銇戙仸銆佽嚜鍒嗕互澶栥伄涓�瑕с伅銆屼笂鏋跺畬浜嗐�嶃仹銇傘倠銇嬨倰鍒ゆ柇
-// List<Rental_Apply_Equipment_Set__c> raeslist = [select Id from Rental_Apply_Equipment_Set__c where Equipment_Set__c = :es.Id and Id != :es.Last_Reserve_Rental_Apply_Equipment_Set__c and RAES_Status__c != '涓婃灦瀹屼簡'and RAES_Status__c != '鍙栨秷鍒嗛厤'];
-// if (raeslist.size() == 0) {
-// es.Provision_finish__c = false;
-// }
-// return es;
-// }
-
-//bp2 // 澶囧搧Set鍥炲簱寰屻�併伝銇嬨伄鍊熷嚭澶囧搧Set涓�瑙堛倰閫氱煡
-// public static void informOtherRAES(Id esId, Id lastRAESId) {
-// List<Rental_Apply_Equipment_Set__c> raesList = [select Id, Re_Inform_Mail__c from Rental_Apply_Equipment_Set__c where Equipment_Set__c = :esId and Id != :lastRAESId order by Rental_Start_Date__c];
-// if (raesList.size() > 0) {
-// raesList[0].Re_Inform_Mail__c = (raesList[0].Re_Inform_Mail__c == null || raesList[0].Re_Inform_Mail__c == '0') ? '1' : '0';
-// update raesList[0];
-// }
-// }
-
-//bp2
-// public static void insEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
-// if (esdList != null && esdList.size() > 0) insert esdList;
-// }
-// public static void updEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
-// if (esdList != null && esdList.size() > 0) update esdList;
-// }
-// public static void delEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
-// if (esdList != null && esdList.size() > 0) delete esdList;
-// }
-
- public static void insRentalApply(Rental_Apply__c ra) {
- if (ra != null) insert ra;
- }
- public static void updRentalApply(Rental_Apply__c ra) {
- if (ra != null) update ra;
- }
- public static void updRentalApplyList(List<Rental_Apply__c> ra) {
- if (ra.size() > 0) update ra;
- }
- public static void insRentalApplyEquipmentSet(List<Rental_Apply_Equipment_Set__c> raesList) {
- if (raesList != null && raesList.size() > 0) insert raesList;
- }
- public static void delRentalApplyEquipmentSet(List<Rental_Apply_Equipment_Set__c> raesList) {
- if (raesList != null && raesList.size() > 0) delete raesList;
- }
- public static void delConsumableAccessoriesInvoiceSet(List<Consumable_accessories_invoice__c> raesList) {
- if (raesList != null && raesList.size() > 0) delete raesList;
- }
-
-////bp2
-// public static void RAESDetailRollup(List<Id> raesIds) {
-// Map<Id, AggregateResult> allCntAr = new Map<Id, AggregateResult>([
-// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
-// from Rental_Apply_Equipment_Set_Detail__c
-// where Rental_Apply_Equipment_Set__c in : raesIds
-// group by Rental_Apply_Equipment_Set__c
-// ]);
-// Map<Id, AggregateResult> cliCntAr = new Map<Id, AggregateResult>([
-// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
-// from Rental_Apply_Equipment_Set_Detail__c
-// where Rental_Apply_Equipment_Set__c in : raesIds
-// and Check_lost_Item__c = '娆犲搧'
-// group by Rental_Apply_Equipment_Set__c
-// ]);
-// Map<Id, AggregateResult> cdsCntAr = new Map<Id, AggregateResult>([
-// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
-// from Rental_Apply_Equipment_Set_Detail__c
-// where Rental_Apply_Equipment_Set__c in : raesIds
-////bp2 and CDS_complete_time__c = null
-// and Asset__r.Loaner_CDS_Info__c = '闇�瑕佹竻娲�'
-// group by Rental_Apply_Equipment_Set__c
-// ]);
-// Map<Id, AggregateResult> iraCntAr = new Map<Id, AggregateResult>([
-// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
-// from Rental_Apply_Equipment_Set_Detail__c
-// where Rental_Apply_Equipment_Set__c in : raesIds
-// and Inspection_result_after__c = 'NG'
-// group by Rental_Apply_Equipment_Set__c
-// ]);
-// Map<Id, AggregateResult> aiwCntAr = new Map<Id, AggregateResult>([
-// select count(Id) Cnt_id, Rental_Apply_Equipment_Set__c Id
-// from Rental_Apply_Equipment_Set_Detail__c
-// where Rental_Apply_Equipment_Set__c in : raesIds
-// and Arrival_in_wh__c = false
-// group by Rental_Apply_Equipment_Set__c
-// ]);
-// Map<Id, Rental_Apply_Equipment_Set__c> raesUpdMap = new Map<Id, Rental_Apply_Equipment_Set__c>();
-// for (Id raesId : raesIds) {
-// Rental_Apply_Equipment_Set__c raes = raesUpdMap.get(raesId);
-// if (raes == null) {
-// // raesIds 銇噸瑜囥亴銇傘倠鍫村悎銇蹇溿�佽ΚId銇伄銇ч厤涓嬨伄銈傘伄銈掍竴绶掋伀鍑︾悊銇欍倠銇ㄣ亶鐧虹敓銇椼伨銇欍��
-// // 闆嗚▓銇椼仧鍊ゃ伅鍚屻仒銇伅銇氥�佷竴鍥炪仩銇戣ō瀹氥仚銈屻伆銇勩亜銇с仚銆�
-// raes = new Rental_Apply_Equipment_Set__c(
-// Id = raesId,
-// Count_Detail__c = 0,
-// Count_Lost__c = 0,
-// Count_NotComplete_CDS__c = 0,
-// Count_NG_Inspection_Result_After__c = 0,
-// Count_Not_Arrival_in_wh__c = 0
-// );
-// raesUpdMap.put(raesId, raes);
-// if (allCntAr.get(raesId) != null) {
-// raes.Count_Detail__c = Integer.valueOf(allCntAr.get(raesId).get('Cnt_Id'));
-// }
-// if (cliCntAr.get(raesId) != null) {
-// raes.Count_Lost__c = Integer.valueOf(cliCntAr.get(raesId).get('Cnt_Id'));
-// }
-// if (cdsCntAr.get(raesId) != null) {
-// raes.Count_NotComplete_CDS__c = Integer.valueOf(cdsCntAr.get(raesId).get('Cnt_Id'));
-// }
-// if (iraCntAr.get(raesId) != null) {
-// raes.Count_NG_Inspection_Result_After__c = Integer.valueOf(iraCntAr.get(raesId).get('Cnt_Id'));
-// }
-// if (aiwCntAr.get(raesId) != null) {
-// raes.Count_Not_Arrival_in_wh__c = Integer.valueOf(aiwCntAr.get(raesId).get('Cnt_Id'));
-// }
-// }
-// }
-// update raesUpdMap.values();
-// }
-
- // Asset銇嬨倝鐥呴櫌銇銇夸笂銇掋倛銇�
- public static AggregateResult[] selectAssetSetHospitalCount(Set<Id> hpIds) {
- return [select Account.Parent.ParentId Parent_ParentId,
- Sum(This_year_inspection_times__c) SUM_inspection_times,
- Sum(This_year_inspection_count__c) SUM_inspection_count
- from Asset where Account.Parent.ParentId in : hpIds
- group by Account.Parent.ParentId];
- }
- // Asset銇嬨倝鎴︾暐绉戝銇銇夸笂銇掋倛銇�
- public static AggregateResult[] selectAssetSetDCCount(Set<Id> dcIds) {
- return [select Account.ParentId Parent_Id,
- Sum(This_year_inspection_times__c) SUM_inspection_times,
- Sum(This_year_inspection_count__c) SUM_inspection_count
- from Asset where Account.ParentId in : dcIds
- group by Account.ParentId];
- }
- //鏃ユ姤鐢ㄧ殑锛屾樉绀轰笉灞炰簬鑷韩鏉冮檺鐨勫尰闄�
- public static List<Account> ShowAccount(list<String> AccountIdList){
- List<Account> accountList = [select id,Name from Account where Id in :AccountIdList];
- return accountList;
- }
- public static List<Campaign> ShowCampaign(list<String> CampaignIdList){
- List<Campaign> campaignList = [select Id, Name from Campaign where Id in :CampaignIdList];
- return campaignList;
- }
- // Smarm__c銇嬨倝User銇銇夸笂銇掋倛銇�
- public static AggregateResult[] selectSmarmSetUserCount(Set<Id> userIds, List<Id> delIds) {
- if (delIds.size() == 0) {
- return [select Review_Target__c Review_Target,
- COUNT(Id) Cnt_Id,
- Max(Report_Date__c) Max_Report_Date
- from SMARM__c where Review_Target__c in : userIds
- group by Review_Target__c];
- } else {
- return [select Review_Target__c Review_Target,
- COUNT(Id) Cnt_Id,
- Max(Report_Date__c) Max_Report_Date
- from SMARM__c where Review_Target__c in : userIds
- and Id not in : delIds
- group by Review_Target__c];
- }
- }
- public static void updateUserList(List<User> userList) {
- update userList;
- }
-
- public static void upsertAsset(List<Asset> astList) {
- if (astList.size() > 0) {
- upsert astList;
- }
- }
- public static void deleteAsset(List<Id> astIds) {
- if (astIds.size() > 0) {
- delete [Select Id from Asset where Id In: astIds];
- }
- }
-
- // SoNo_DeliveryDate_Text__c 銇仸 upsert
- public static void upsertStatuAchievementsJournalByKey(List<Statu_Achievements_Journal__c> pList) {
- if (pList.size() > 0) {
- upsert pList SoNo_DeliveryDate_Text__c;
- }
- }
- public static List<Statu_Achievements_Journal__c> selectStatuAchievementsJournalByKey(List<String> pList) {
- return [Select SoNo_DeliveryDate_Text__c, ShippedAmount__c from Statu_Achievements_Journal__c where SoNo_DeliveryDate_Text__c in :pList];
- }
-
- // CHAN-BCPCA3 鎻掑叆骞舵洿鏂� 铏氭嫙 DN start
- public static void upsertStatuAchievementsDNByKey(List<Statu_Achievements_DN__c> pList) {
- if (pList.size() > 0) {
- upsert pList DNKey__c;
- }
- }
- // CHAN-BCPCA3 鎻掑叆骞舵洿鏂� 铏氭嫙 DN end
-
- public static void deleteStatuAchievementsJournalByKey(List<String> pList) {
- for(List<Statu_Achievements_Journal__c> delList : [Select SoNo_DeliveryDate_Text__c, ShippedAmount__c from Statu_Achievements_Journal__c where SoNo_DeliveryDate_Text__c in :pList]) {
- delete delList;
- }
- }
-
- // 鐪佸崢浣� or 鍏ㄥ浗銇ê鐧傜銈掓绱紝鏈�鍒濄伄50浠�
- public static Map<Id, Account> selectDepartByHospitalState(String nameCondition, String reporterState, Integer limitCnt) {
- User loginUser = [Select Id, State_Hospital__c, Job_Category__c from User where Id =: UserInfo.getUserId()];
- String queryString = 'select Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name from Account where' + nameCondition + ' Hospital__r.RecordType.DeveloperName = \'HP\' and Is_Active__c <> \'鐒″姽\'';
- if (loginUser.Job_Category__c == 'GI甯傚満'
- || loginUser.Job_Category__c == 'SP甯傚満'
- || loginUser.Job_Category__c == '鏈嶅姟鏈儴'
- || loginUser.Job_Category__c == '鍩硅'
- ) {
- // 鍏ㄥ浗绡勫洸銆併仾銇倐銇椼仾銇�
- } else {
- // 鐪佸崢浣嶃伄鏉′欢杩藉姞
- system.debug('selectDepartByHospitalState reporterState=' + reporterState);
- queryString += ' and Parent.Parent.State_Master__r.Name = :reporterState';
- }
- queryString += ' order by Name limit :limitCnt';
- system.debug('selectDepartByHospitalState queryString=' + queryString);
- return new Map<Id, Account>((List<Account>) Database.query(queryString));
- }
-
- public static void updateAgencyName(Map<Id, Account> hpNameAfterAccMap) {
- List<Agency_Hospital_Link__c> ahls = [Select Id, Name,Hospital__c From Agency_Hospital_Link__c where Hospital__c in :hpNameAfterAccMap.keySet()];
- List<Agency_Hospital_Link__c> updAHList = new List<Agency_Hospital_Link__c>();
- if (ahls.size() > 0) {
- for (Agency_Hospital_Link__c ahl: ahls) {
- Account hp = hpNameAfterAccMap.get(ahl.Hospital__c);
- String hpName = hp.Name;
- if (ahl.Name != hpName) {
- ahl.Name = hpName;
- updAHList.add(ahl);
- }
- }
- update updAHList;
- }
- }
-
- public static void updateDeptName(Map<Id, Account> hpAfterAccMap) {
- if (hpAfterAccMap.size() > 0) {
- // 澶夋洿蹇呰銇� 鎴︾暐瑾插銆両D銈掗泦銈併倠
- List<String> dcNameIds = new List<String>();
- List<Account> updAccList = new List<Account>();
- List<Account> updChkList = new List<Account>();
- // 鎴︾暐瑾插ID:NAME
- Map<String, String> dcNameMap = new Map<String, String>();
- // 鎴︾暐瑾插鍚嶇О銈掕ō瀹�
- List<Account> accDcs = [Select Id, Name, ParentId, Parent.RecordTypeId, Department_Class_Label__c from Account where ParentId IN :hpAfterAccMap.keySet()];
- if (accDcs.size() > 0) {
- for (Account child: accDcs) {
- dcNameIds.add(child.Id);
- if (child.Name != hpAfterAccMap.get(child.ParentId).Name + ' ' + child.Department_Class_Label__c) {
- child.Name = hpAfterAccMap.get(child.ParentId).Name + ' ' + child.Department_Class_Label__c;
- // 鍏ュ姏瑕忓墖鍥為伩
- child.Sys_Dept_Name_Change_Chk__c = true;
- updChkList.add(child);
- }
- child.OCM_Category__c = hpAfterAccMap.get(child.ParentId).OCM_Category__c;
- child.State_Text__c = hpAfterAccMap.get(child.ParentId).State_Text__c;
- dcNameMap.put(child.Id, child.Name);
- updAccList.add(child);
- }
- // 瑷虹檪绉戝悕绉般倰瑷畾
- List<Account> accDpts = [Select Id, Name, ParentId, Parent.ParentId, Department_Name__c from Account where ParentId IN :dcNameIds];
- if (accDpts.size() > 0) {
- for (Account child: accDpts) {
- child.Name = dcNameMap.get(child.ParentId) + ' ' + child.Department_Name__c;
- child.OCM_Category__c = hpAfterAccMap.get(child.Parent.ParentId).OCM_Category__c;
- child.State_Text__c = hpAfterAccMap.get(child.Parent.ParentId).State_Text__c;
- updAccList.add(child);
- }
- }
- update updAccList;
- // 鍏ュ姏瑕忓墖鍥炲京
- if (updChkList.size() > 0) {
- for (Account child: updChkList) {
- child.Sys_Dept_Name_Change_Chk__c = false;
- }
- update updChkList;
- }
- }
- }
- }
-
- public static void collectDeptId(List<String> accIds, Map<String, String> purposeOfAdviceMap, List<String> hospitalIds) {
- if (hospitalIds.size() > 0) {
- List<Account> accList = [Select Id, Name, Is_Active__c, Hospital__c from Account where Hospital__c IN :hospitalIds];
- for (Account acc : accList) {
- accIds.add(acc.Id);
- purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Hospital__c));
- }
- }
- }
-
- public static void collectChildIdForAgent(List<String> accIds, Map<String, String> purposeOfAdviceMap, List<String> agentIds) {
- if (agentIds.size() > 0) {
- //-----------20180913---------XinHongLu-------------------Start--------------------
- //Is_Active_Formula__c = '鏈夋晥',璇ユ潯浠朵负"濂戠害"涓烘湁鏁堟椂,鎴戜滑浼犵粰sap
- //-----------20180913---------XinHongLu-------------------End--------------------
- List<Account> accList = [Select Id, Name, Is_Active__c, Agent_Ref__c, AgencyContract_Management_Code__c from Account where Is_Active_Formula__c = '鏈夋晥' and Agent_Ref__c IN :agentIds order by Agent_Ref__c, AgencyContract_Management_Code__c, CreatedDate desc];
- if (accList.size() > 0) update accList;
- String tmpAgentRef = null;
- String tmpAgencyContractManagementCode = null;
- for (Account acc : accList) {
- if ((tmpAgentRef == null || tmpAgentRef != acc.Agent_Ref__c)
- || (tmpAgencyContractManagementCode == null || tmpAgencyContractManagementCode != acc.AgencyContract_Management_Code__c)) {
- tmpAgentRef = acc.Agent_Ref__c;
- tmpAgencyContractManagementCode = acc.AgencyContract_Management_Code__c;
- accIds.add(acc.Id);
- purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Agent_Ref__c));
- NFM001Controller.debug_msg += '_1';
-System.debug(Logginglevel.DEBUG, 'collectChildIdForAgent acc.AgencyContract_Management_Code__c:::::' + acc.AgencyContract_Management_Code__c);
- }
- }
- }
- }
-// public static List<Account> getDoubleChildForAgent(Map<String, Account> agentStateIds) {
-// List<Account> childList = new List<Account>();
-// if (agentStateIds.size() > 0) {
-// childList = [Select Id, Agency_State_Master__c, AgencyContract_Management_Code__c from Account where RecordType.Name IN ('濂戠磩') and Agency_State_Master__c IN :agentStateIds.keySet() and Id NOT IN :agentStateIds.values()];
-// }
-// return childList;
-// }
-
- public static void updateDeptIsActive(List<String> accIds, Map<String, String> purposeOfAdviceMap,
- List<String> hospitalIdsNeedUpdateAccountIsActive, Map<Id, String> hpIsActiveMap, Map<Id, String> hpDateToMap) {
- if (hospitalIdsNeedUpdateAccountIsActive.size() > 0) {
- List<Account> accList = [
- Select Id, Name,Is_Active__c, DepartmentEffectiveDateTo__c, Hospital__c, Hospital__r.DepartmentEffectiveDateTo__c
- from Account
- where Hospital__c IN :hospitalIdsNeedUpdateAccountIsActive];
- List<Account> accUpdList = new List<Account>();
- for (Account acc : accList) {
- if (acc.Is_Active__c == hpIsActiveMap.get(acc.Hospital__c)) {
- // 鐥呴櫌锛堝鏇村緦锛夈仺瑷虹檪绉戙伄Is_Active__c銇屽悓銇樸伄鍫村悎
- continue;
- }
- if (hpIsActiveMap.get(acc.Hospital__c) == '鐒″姽' && acc.DepartmentEffectiveDateTo__c == null) {
- // 鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇宯ull銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�
-System.debug(Logginglevel.DEBUG, '鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇宯ull銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�');
- }
- else if (hpIsActiveMap.get(acc.Hospital__c) == '鏈夊姽' && acc.DepartmentEffectiveDateTo__c == acc.Hospital__r.DepartmentEffectiveDateTo__c) {
- // 鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇岀梾闄�(澶夋洿鍓�)銇ㄥ悓銇樸伄銈傘伄銇屽璞°�佸嚘鐞嗗璞�
-System.debug(Logginglevel.DEBUG, '鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇岀梾闄€仺鍚屻仒銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�');
- } else {
-System.debug(Logginglevel.DEBUG, '鍑︾悊瀵捐薄澶栥�佺梾闄s_Active__c=' + hpIsActiveMap.get(acc.Hospital__c) + ', 瑷虹檪绉慏ateto=' + acc.DepartmentEffectiveDateTo__c + ', 鐥呴櫌Dateto=' + hpDateToMap.get(acc.Hospital__c));
- continue;
- }
- accIds.add(acc.Id);
- purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Hospital__c));
-System.debug(Logginglevel.DEBUG, 'purposeOfAdviceMap 鐥呴櫌=' + purposeOfAdviceMap.get(acc.Hospital__c));
- accUpdList.add(acc);
- acc.Is_Active__c = hpIsActiveMap.get(acc.Hospital__c);
- acc.DepartmentEffectiveDateTo__c = hpDateToMap.get(acc.Hospital__c);
- }
- if (accUpdList.size() > 0) {
- update accUpdList;
- }
- }
- }
- //CHAN-AZJ6JS 杩芥函绯荤粺鏉ョ殑璇环锛屽彇娑圵IN鏃讹紝缁忛攢鍟嗚鍗曡嚜鍔ㄦ敼鍒扳�滈┏鍥炩��
- public static void selectAndupdateOrderSatus(List<String> idList) {
- List<Consumable_order__c> orderList = [select id, Order_status__c from Consumable_order__c where Name = :idList and Order_status__c = '鎵瑰噯' and RecordType.DeveloperName = 'Order'];
- for (Consumable_order__c order : orderList) {
- order.Order_status__c = '椹冲洖';
- }
- update orderList;
- }
- //鏇存柊璁㈠崟
- public static void updateOrderSatus(List<Consumable_order__c> docList) {
- update docList;
- }
- //鏇存柊鏄庣粏2
- public static void updateOrderDetailsSatus(List<Consumable_order_details2__c> docList) {
- update docList;
- }
- //鏇存柊鏄庣粏1
- public static void updateOrderDetails1Satus(List<Consumable_orderdetails__c> docList) {
- update docList;
- }
-
- public static void updRentalApplyList(List<Consumable_order__c> ra) {
- if (ra.size() > 0) update ra;
- }
-
- public static List<Event__c> getEventCList(Date whereDate, Daily_Report__c oya) {
- return [
- select Id, Event_ID__c, Daily_Report__c, Subject__c, StartDateTime__c, EndDateTime__c, Main_Visit_Location__c,
- Location__c, whatId__c, Activity_Type2__c, Activity_Type2_Before__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c,
- Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Companion__c, Purpose__c, Purpose_Type__c, Purpose_Type2__c, Purpose_Type3__c, Purpose_Type4__c, Purpose_Type5__c,
- Purpose_TypeFSE__c, Purpose_TypeFSE2__c, Purpose_TypeFSE3__c, Purpose_TypeFSE4__c, Purpose_TypeFSE5__c,
- Purpose_TypeEscFSE__c, Purpose_TypeEscFSE2__c, Purpose_TypeEscFSE3__c, Purpose_TypeEscFSE4__c, Purpose_TypeEscFSE5__c,
- Related_Opportunity1__c, Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,
- Related_Opportunity1_ID__c, Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Related_Service1__c, Related_Service2__c,
- Related_Service1_ID__c, Related_Service2_ID__c,
- Description__c, Hospital_Info__c, Doctor_Info__c, Technology_Treatment__c,
- New_Query__c, Update_Query__c, Lost_Info__c, VOC__c, Meeting_Info__c, Product_Description_Id__c,
- Maintenance_Contract_ID__c, Asset_Manual_ID__c, Rental_Apply_ID__c,
- OPD_ID__c, NTC_ID__c, ReportAccompanied_ID__c, CityStatus_ID__c, Conflict_ID__c, Claim_ID__c, Improvement_ID__c, OnCall_ID__c,
- nextPlanDate__c, nextPlanTimePurpose__c, Activity_ID__c,
- Minister__c, Minister_Comment__c, Manager__c, Manager_Comment__c,
- Free_Input__c, Visitor_Place_Free__c, Mail_Send_Btn__c,
- Lead_ID__c, Lead_Count__c, InsReport_ID__c,
- Activity_Purpose__c,Activity_PurposeFSE__c,Activity_PurposeEscFSE__c,ETAPPAct__c
- ,IsAlertInputDep__c // 2018/11/21 SWAG-B6Q8BS 鍒ゆ柇鏄惁闇�瑕佸脊绐楁洿鏂板鎴蜂俊鎭�
- ,SLARecorded__c,UseReport__c,SLAReportInfo__c//20210701 zh SLA
- // 20200420 浠诲姟鏃ユ姤绠$悊 add gzw start
- // ,eventStatus__c, delayToDate__c, delayReason__c,DurationInMinutes__c,BeforeActivityDate__c,OPDPlan_Flag__c,IsScheduled__c,AppCdId__c,SyncCreatedDate__c
-
- ,eventStatus__c, CancelReason__c, delayToDate__c, delayReason__c,DurationInMinutes__c,cancelReasonSelect__c,cancelReasonSelectFSE__c,cancelReasonOther__c,delayReasonOther__c,delayReasonSelect__c,delayReasonSelectFSE__c,BeforeActivityDate__c,OPDPlan_Flag__c,IsScheduled__c,AppCdId__c,SyncCreatedDate__c
- // 20200420 浠诲姟鏃ユ姤绠$悊 add gzw end
- from Event__c where ActivityDate__c =:whereDate and Daily_Report__c = :oya.Id order by StartDateTime__c
- ];
- }
-
- public static List<Event__c> getNextEventCList(List<String> nextEcIds) {
- return [
- select Id, Event_ID__c, Daily_Report__c, Subject__c, StartDateTime__c, EndDateTime__c, Main_Visit_Location__c,
- Location__c, whatId__c, Activity_Type2__c, Activity_Type2_Before__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c,
- Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Companion__c, Purpose__c, Purpose_Type__c, Purpose_Type2__c, Purpose_Type3__c, Purpose_Type4__c, Purpose_Type5__c,
- Purpose_TypeFSE__c, Purpose_TypeFSE2__c, Purpose_TypeFSE3__c, Purpose_TypeFSE4__c, Purpose_TypeFSE5__c,
- Purpose_TypeEscFSE__c, Purpose_TypeEscFSE2__c, Purpose_TypeEscFSE3__c, Purpose_TypeEscFSE4__c, Purpose_TypeEscFSE5__c,
- Related_Opportunity1__c, Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,
- Related_Opportunity1_ID__c, Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Related_Service1__c, Related_Service2__c,
- Related_Service1_ID__c, Related_Service2_ID__c,
- Description__c, Hospital_Info__c, Doctor_Info__c, Technology_Treatment__c,
- New_Query__c, Update_Query__c, Lost_Info__c, VOC__c, Meeting_Info__c, Product_Description_Id__c,
- Maintenance_Contract_ID__c, Asset_Manual_ID__c, Rental_Apply_ID__c,
- OPD_ID__c, NTC_ID__c, ReportAccompanied_ID__c, CityStatus_ID__c, Conflict_ID__c, Claim_ID__c, Improvement_ID__c, OnCall_ID__c,
- nextPlanDate__c, nextPlanTimePurpose__c, Activity_ID__c,
- Minister__c, Minister_Comment__c, Manager__c, Manager_Comment__c,
- Free_Input__c, Visitor_Place_Free__c, Mail_Send_Btn__c,
- Lead_ID__c, Lead_Count__c, InsReport_ID__c,
- Activity_Purpose__c,Activity_PurposeFSE__c,Activity_PurposeEscFSE__c
- ,IsAlertInputDep__c // 2018/11/21 SWAG-B6Q8BS 鍒ゆ柇鏄惁闇�瑕佸脊绐楁洿鏂板鎴蜂俊鎭�
- from Event__c where Id in :nextEcIds order by StartDateTime__c
- ];
- }
-
- public static Map<String, Map<String, String>> getAccsByName(List<String> accList) {
- Map<String, Map<String, String>> accMap = new Map<String, Map<String, String>>();
- Map<String, String> accIds = new Map<String, String>();
-
- List<Account> accs = [select Id, Name from Account where Name in : accList];
- for (Account acc : accs) {
- if (accMap.containsKey(acc.Name)) {
- accIds = accMap.get(acc.Name);
- } else {
- accIds = new Map<String, String>();
- }
- accIds.put(acc.Id, acc.Id);
- accMap.put(acc.Name, accIds);
- }
- return accMap;
- }
-
- public static Map<String, Map<String, String>> getCampsByName(List<String> campList) {
- Map<String, Map<String, String>> campMap = new Map<String, Map<String, String>>();
- Map<String, String> campIds = new Map<String, String>();
-
- List<Campaign> camps = [select Id, Name from Campaign where Name in : campList];
- for (Campaign camp : camps) {
- if (campMap.containsKey(camp.Name)) {
- campIds = campMap.get(camp.Name);
- } else {
- campIds = new Map<String, String>();
- }
- campIds.put(camp.Id, camp.Id);
- campMap.put(camp.Name, campIds);
- }
- return campMap;
- }
-
- // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
- //public static AggregateResult[] selectForOpp_Last_Follow_Up_Date(List<String> oppIds) {
- //return [select Opportunity__c, Max(End_Time__c) maxET from Event_Oppotunity__c where Opportunity__c in : oppIds
- // and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
- // group by Opportunity__c];
- //}
- public static List<Event_Oppotunity__c> selectForOpp_Last_Follow_Up_Date(List<String> oppIds) {
- return [select Opportunity__c, End_Time__c, EventC_ID__r.Description__c
- from Event_Oppotunity__c
- where Opportunity__c in : oppIds
- and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�'
- and Daily_Report__r.Status_With_Check__c <> ''
- order by Opportunity__c, End_Time__c desc
- ];
- }
- // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
-
-
- public static List<Event> selectForOpp_Last_Visit_Scheduled_Date(List<String> oppIds) {
- // Max(ActivityDateTime)銇屻仱銇嬨亪銇亜銇熴倎銆乬roup by 銈掋倓銈併伨銇椼仧銆�
- return [select Id, Related_Opportunity1_ID__c, ActivityDateTime from Event where Related_Opportunity1_ID__c != null and Related_Opportunity1_ID__c in :oppIds
- order by Related_Opportunity1_ID__c, ActivityDateTime desc];
- }
-
- public static AggregateResult[] selectEventOppForAggregateFollowToOpp(List<String> oppIds) {
- return [select Opportunity__c
- , count(Name) cnt
- , sum(Visit_President_Flag__c) vprCnt
- , sum(Visit_Head_Doctor_Flag__c) vhdCnt
- , sum(NTC_Flag__c) ntcCnt
- from Event_Oppotunity__c where Opportunity__c in :oppIds
- and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
- group by Opportunity__c];
- }
-
- public static List<Report__c> selectReportForAggregateOpdToOpp(List<String> oppIds) {
- return [select Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c
- from Report__c where Status__c <> '浣滄垚涓�' and Status__c <> '鍙栨秷銇�' and Status__c <> ''
- and (Opportunity1__c in :oppIds or Opportunity2__c in :oppIds or Opportunity3__c in :oppIds or Opportunity4__c in :oppIds or Opportunity5__c in :oppIds)
- and RecordType.DeveloperName = 'OPD'];
- }
-
- // 锛曘仱銇晢璜囥倰瑕嬨倠銇熴倎銆乬roup by 銇屻仹銇嶃仾銇勩伄銇с�佹绱㈠緦loop銇椼仸闆嗚▓銇欍倠
- public static AggregateResult[] selectForService_Last_Follow_Up_Date(List<String> serviceIds) {
- return [select Service__c, Max(Date__c) maxD from Event_Service__c where Service__c in : serviceIds
- and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
- group by Service__c];
- }
-
- public static void updateContactMonth(List<String> conIds, List<Date> conDates) {
- Map<String, Integer> conCntMap = new Map<String, Integer>();
- AggregateResult[] ar = [select count(Id) cnt, Contact__c, Date__c from Activity_History_Daily_Report__c
- where Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
- and Contact__c in :conIds group by Contact__c, Date__c];
- if (ar.size() > 0) {
- for (Integer i = 0; i < ar.size(); i++) {
- Date actDate = (Date) ar[i].get('Date__c');
- String key = String.valueOf(ar[i].get('Contact__c')) + String.valueOf(actDate.year()) + (actDate.month() < 10 ? '0' + actDate.month() : '' + actDate.month());
- if (conCntMap.containsKey(key)) {
- conCntMap.put(key, conCntMap.get(key) + Integer.valueOf(ar[i].get('cnt')));
- } else {
- conCntMap.put(key, Integer.valueOf(ar[i].get('cnt')));
- }
- }
- }
-
- // 銇撱亾銇嬨倝12銉舵湀銇偒銈︺兂銉堛倰鏇存柊
- Map<Id, Contact> conThisMap = new Map<Id, Contact>([select Id, Visit_Count1__c, Visit_Count2__c, Visit_Count3__c, Visit_Count4__c, Visit_Count5__c, Visit_Count6__c,
- Visit_Count7__c, Visit_Count8__c, Visit_Count9__c, Visit_Count10__c, Visit_Count11__c, Visit_Count12__c
- from Contact where Id in :conIds for update]);
- if (conThisMap.size() > 0) {
- Map<String, Contact> updMap = new Map<String, Contact>();
- for (Integer i = 0; i < conIds.size(); i++) {
- Contact con = conThisMap.get(conIds[i]);
- if (updMap.containsKey(con.Id)) {
- con = updMap.get(con.Id);
- }
-
- if (con != null) {
- Date repDate = conDates[i];
- Integer year = repDate.year();
- Integer month = repDate.month();
-
- Integer cnt = null;
- if (conCntMap != null) {
- cnt = conCntMap.get(con.Id + '' + year + ((month < 10) ? '0' : '') + month);
- }
- if(month == 1) {
- if (!equalTwoNum(con.Visit_Count1__c, cnt)) {
- con.Visit_Count1__c = cnt;
- }
- } else if(month == 2) {
- if (!equalTwoNum(con.Visit_Count2__c, cnt)) {
- con.Visit_Count2__c = cnt;
- }
- } else if(month == 3) {
- if (!equalTwoNum(con.Visit_Count3__c, cnt)) {
- con.Visit_Count3__c = cnt;
- }
- } else if(month == 4) {
- if (!equalTwoNum(con.Visit_Count4__c, cnt)) {
- con.Visit_Count4__c = cnt;
- }
- } else if(month == 5) {
- if (!equalTwoNum(con.Visit_Count5__c, cnt)) {
- con.Visit_Count5__c = cnt;
- }
- } else if(month == 6) {
- if (!equalTwoNum(con.Visit_Count6__c, cnt)) {
- con.Visit_Count6__c =cnt;
- }
- } else if(month == 7) {
- if (!equalTwoNum(con.Visit_Count7__c, cnt)) {
- con.Visit_Count7__c = cnt;
- }
- } else if(month == 8) {
- if (!equalTwoNum(con.Visit_Count8__c, cnt)) {
- con.Visit_Count8__c = cnt;
- }
- } else if(month == 9) {
- if (!equalTwoNum(con.Visit_Count9__c, cnt)) {
- con.Visit_Count9__c = cnt;
- }
- } else if(month == 10) {
- if (!equalTwoNum(con.Visit_Count10__c, cnt)) {
- con.Visit_Count10__c = cnt;
- }
- } else if(month == 11) {
- if (!equalTwoNum(con.Visit_Count11__c, cnt)) {
- con.Visit_Count11__c = cnt;
- }
- } else if(month == 12){
- if (!equalTwoNum(con.Visit_Count12__c, cnt)) {
- con.Visit_Count12__c = cnt;
- }
- } else {
- // TODO Exception
- }
- updMap.put(con.Id, con);
- }
- }
- List<Contact> updCon = updMap.values();
- if (updCon.size() > 0) update updCon;
- }
- }
-
- public static List<SObject> getPe99Info(String soql, String userId) {
- return Database.query(soql);
- }
-
- public static Boolean checkInsHpChange(Id irHpId, Map<Id, Id> iiHpMap) {
- Boolean isChange = false;
- for (String key : iiHpMap.keySet()) {
- Id iiHpId = iiHpMap.get(key);
- if (irHpId != iiHpId) {
- isChange = true;
- break;
- }
- }
- return isChange;
- }
-
-
- // equal:true
- private static Boolean equalTwoNum(Decimal val1, Integer val2) {
- if (val1 == null && val2 == null) {
- return true;
- } else if (val1 != null && val2 != null && val1 == Decimal.valueOf(val2)) {
- return true;
- } else {
- return false;
- }
- }
-
- // JS鐢ㄦ绱�
- @ReadOnly
- @RemoteAction
- global static String getQueryJson(String sql) {
- system.debug('=====sql:' + sql);
- List<SObject> rs = Database.query(sql);
- String rsStr = JSON.serialize(rs);
- system.debug('=====rsStr:' + rsStr);
- return rsStr;
- }
-
- // JS鐢ㄦ洿鏂�
- @ReadOnly
- @RemoteAction
- global static String getUpdateResult(String j) {
- system.debug('=====json:' + j);
- SObject obj = (SObject)JSON.deserializeStrict(j, SObject.class);
- Database.SaveResult rs = Database.update(obj);
- String rsStr = rs.isSuccess() ? '1' : '0';
- system.debug('=====rsStr:' + rsStr);
- return rsStr;
- }
-
- WebService static String getAccessToken() {
- return UserInfo.getSessionId();
- }
-
- WebService static void addBatchIfLog(String typeStr, Integer isError, String logStr) {
- BatchIF_Log__c log = new BatchIF_Log__c(
- Type__c = typeStr,
- Is_Error__c = isError
- );
- if (isError == 0) {
- log.log__c = logStr;
- } else {
- log.ErrorLog__c = logStr;
- }
- insert log;
- }
-
- WebService static String deleteRepair(String rid) {
- try {
- Repair__c r = new Repair__c(Id = rid);
- delete r;
- return 'OK';
- } catch (Exception e) {
- return e.getMessage();
- }
- }
- /*
- =======================================================================================================================
- ===================================================SI 璇环閮ㄥ垎util闆嗗悎=================================================
- =======================================================================================================================
- */
- /**
- OCM-SI闇�姹傝〃鐢紝澶嶅埗鍔熻兘锛屼粎闄愬綋鍓嶆墍鏈塖I闇�姹傝〃澶辨晥鐨勬椂鍊欙紝鎵嶈兘浣跨敤
- */
- WebService static String ISO_Copy_Func(id isoID){
- IS_Opportunity_Demand__c checkISO = [select Opportunity_ID__c from IS_Opportunity_Demand__c where id =:isoID];
- String opporID = checkISO.Opportunity_ID__c;
- List<IS_Opportunity_Demand__c> isoListForCheck = [select id, Func_SOD_Status__c,Abort_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c=:opporID];
- for(IS_Opportunity_Demand__c iso: isoListForCheck){
- if(iso.Abort_Date__c==null){
- return '瀛樺湪鏈粓姝㈢殑SI闇�姹傝〃锛屼笉鑳藉鍒�';
- }
- }
-
- return ISO_DemandOperAndDemonsController.CopyFunc(isoID);
- }
- /**
- OCM-SI闇�姹傝〃鐢紝鑷畾涔夋彁浜ゅ緟瀹℃壒
- */
- WebService static String ISO_Submit_Func(id isoID){
- List<IS_Opportunity_Demand__c> submintISOList = new List<IS_Opportunity_Demand__c>();
- submintISOList = [SELECT id,Data_Check_TF__c from IS_Opportunity_Demand__c WHERE id =:isoID];
- List<IS_Opportunity_Demand__c> isOppList = new List<IS_Opportunity_Demand__c>();
- for(IS_Opportunity_Demand__c iso: submintISOList){
- if(iso.Data_Check_TF__c){
- Savepoint sp = Database.setSavepoint();
- try {
- Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
- psr.setObjectId(isoID);
- Approval.ProcessResult submitResult = Approval.process(psr);
- return 'Fin';
- }catch(exception e){
- String ioError = e.getMessage();
- Database.rollback(sp);
- return ''+ioError;
- }
- }else{
- return '璇风幇鍦ㄧ紪杈戦〉闈紝妫�鏌ユ暟鎹畬鏁存�э紝鐒跺悗鍐嶆墽琛屾彁浜�';
- }
- }
- if(isOppList.size() > 0){
- update isOppList;
- }
- return 'Fin';
- }
- /**
- OCM-SI璇环鏂囦欢涓婁紶鐢紝鑷畾涔夋彁浜ゅ緟瀹℃壒
- */
- WebService static String SI_FileUpdateSubmit(id subID){
- //List<Attachment> CheckFile = [select id from Attachment where ParentId=:subID];
- //if(CheckFile.size()==0){
- // return '璇蜂笂浼犻檮浠跺悗鍐嶆彁浜�';
- //}else{
- Savepoint sp = Database.setSavepoint();
- try {
- Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
- psr.setObjectId(subID);
- Approval.ProcessResult submitResult = Approval.process(psr);
- return 'Fin';
- }catch(exception e){
- String ioError = e.getMessage();
- Database.rollback(sp);
- return ''+ioError;
- }
- //}
- }
- /**
- OCM娉ㄦ畫鐢紝褰撴敞娈嬫洿鏂版椂锛屽垽鏂暟涓棩鏈熸槸鍚﹀彉闈╋紝濡傝嫢鍙橀潻锛屽垯鏇存柊瀵瑰簲璇环鐨勬槧灏勬椂闂达紙鍙栨渶澶у�硷級;
- */
- public static String updateOppoMuiltDate(id opporID){
- List<AggregateResult> ArResult = [select
- Max(ContractReceivedDate__c ) al,
- Max(FirstApproveDate__c ) bl,
- Max(LastApproveDate__c ) cl,
- Max(X30_Deposit_Day__c) dl,
- Max(Deposit_In_Full_Day__c) el,
- Max(SoLatestDeliveryDate__c) fl,
- Max(DeliveryDate__c ) gl,
- Max(DeliveryDate_backup__c) hl,
- Max(InstallDate__c) il,
- Max(Collection_Day_Invoice__c) jl,
- Max(Inspection_explanation_day__c) kl
- from
- Statu_Achievements__c
- WHERE Opportunity__c =: opporID];
- Opportunity ops = [SELECT Contract_Recieve_Date__c ,
- First_Review_Date__c ,
- LastApproveDate__c ,
- X30_Deposit_Day__c,
- Pay_All_Money__c,
- Last_Delivery_Date__c,
- DeliveryDate__c ,
- InstallDate__c,
- Inspection_explanation_day__c
- From Opportunity
- WHERE id =:opporID];
- for(AggregateResult ar : ArResult ){
- if(Date.valueOf(ar.get('al')) != ops.Contract_Recieve_Date__c){
- ops.Contract_Recieve_Date__c = Date.valueOf(ar.get('al'));
- }
- if(Date.valueOf(ar.get('bl')) != ops.First_Review_Date__c){
- ops.First_Review_Date__c = Date.valueOf(ar.get('bl'));
- }
- if(Date.valueOf(ar.get('cl')) != ops.LastApproveDate__c){
- ops.LastApproveDate__c = Date.valueOf(ar.get('cl'));
- }
- if(Date.valueOf(ar.get('dl')) != ops.X30_Deposit_Day__c){
- ops.X30_Deposit_Day__c = Date.valueOf(ar.get('dl'));
- }
- if(Date.valueOf(ar.get('el')) != ops.Pay_All_Money__c){
- ops.Pay_All_Money__c = Date.valueOf(ar.get('el'));
- }
- if(Date.valueOf(ar.get('fl')) != ops.Last_Delivery_Date__c){
- ops.Last_Delivery_Date__c = Date.valueOf(ar.get('fl'));
- }
- if(Date.valueOf(ar.get('gl')) != ops.DeliveryDate__c){
- ops.DeliveryDate__c = Date.valueOf(ar.get('gl'));
- }
- if(Date.valueOf(ar.get('il')) != ops.InstallDate__c){
- ops.InstallDate__c = Date.valueOf(ar.get('il'));
- system.debug(ar.get('il')+'2333333333');
- }
- if(Date.valueOf(ar.get('kl')) != ops.Inspection_explanation_day__c){
- ops.Inspection_explanation_day__c = Date.valueOf(ar.get('kl'));
- }
- }
- update ops;
-
- ControllerUtil.refreshSIOpporStatus(opporID);
- return 'Fin';
- }
- /**
- OCM璇环鐢紝鍒锋柊OCM鈥斺�擲I鐨勭姸鎬�
- */
- public static string refreshSIOpporStatus(id opporID){
- Opportunity ops = [SELECT Last_Install_Confirm_Date__c,
- InstallDate__c,
- DeliveryDate__c,
- Last_Delivery_Date__c,
- Pay_All_Money__c ,
- X30_Deposit_Day__c ,
- LastApproveDate__c,
- First_Review_Date__c,
- Contract_Recieve_Date__c,
- SFDCLast_Process_Date__c,
- Input_Dealer_HP_date__c,
- Agency_Contract_Date_last_update__c,
- Assistant_Applied_Date__c,
- Closing_Bid_Date__c,
- Bid_Date__c,
- Autholization_Activated_Date__c,
- Authorized_Date__c,
- Last_Follow_Up_Date__c,
- Key_tipics_last_update_day__c,
- Status_List_SI__c
- FROM Opportunity
- WHERE id=:opporID];
- if(ops.Last_Install_Confirm_Date__c!=null){ops.Status_List_SI__c ='16 宸茬粨鏉�';}
- else if(ops.InstallDate__c!=null){ops.Status_List_SI__c ='15 宸插畨瑁�';}
- else if(ops.DeliveryDate__c!=null){ops.Status_List_SI__c ='14 宸插彂璐�';}
- else if(ops.Last_Delivery_Date__c!=null){ops.Status_List_SI__c ='13 宸插垎閰嶏紝寰呭彂璐�';}
- else if(ops.Pay_All_Money__c!=null){ops.Status_List_SI__c ='12 宸茶璐э紝浠樺叏娆�';}
- else if(ops.X30_Deposit_Day__c!=null){ops.Status_List_SI__c ='11 宸茶璐э紝浠樿閲�';}
- else if(ops.LastApproveDate__c!=null){ops.Status_List_SI__c ='10 搴撳瓨宸查鐣欙紝鏈粯娆�';}
- else if(ops.First_Review_Date__c!=null){ops.Status_List_SI__c ='9 宸插綍鍏ヨ鍗曪紝鏈粯娆�';}
- else if(ops.Contract_Recieve_Date__c!=null){ops.Status_List_SI__c ='9 宸插綍鍏ヨ鍗曪紝鏈粯娆�';}
- else if(ops.SFDCLast_Process_Date__c!=null){ops.Status_List_SI__c ='8 宸茬绾�';}
- else if(ops.Input_Dealer_HP_date__c!=null){ops.Status_List_SI__c ='7 鐢ㄦ埛宸茬绾�';}
- else if(ops.Agency_Contract_Date_last_update__c!=null){ops.Status_List_SI__c ='6 鐢ㄦ埛鏈绾�';}
- else if(ops.Assistant_Applied_Date__c!=null){ops.Status_List_SI__c ='5 浠锋牸鐢宠涓�';}
- else if(ops.Closing_Bid_Date__c!=null){ops.Status_List_SI__c ='4 宸蹭腑鏍�';}
- else if(ops.Bid_Date__c!=null ||ops.Autholization_Activated_Date__c!=null||ops.Authorized_Date__c!=null){ops.Status_List_SI__c ='3 宸叉巿鏉�';}
- else if(ops.Last_Follow_Up_Date__c!=null){ops.Status_List_SI__c ='2 璺熻繘涓�';}
- else if(ops.Key_tipics_last_update_day__c!=null){ops.Status_List_SI__c ='1 杩樻病鎷滆';}
- else{ops.Status_List_SI__c = '0 杩樻病璺熻繘';}
- update ops;
- return 'Fin';
- }/**
- OCM璇环鏂囦欢涓婁紶鐢紝瀹為檯涓婁紶鏂囦欢鍚庯紝鍒锋柊涓婁紶鏃堕棿
- */
- public static String UpdateFileDateSet(List<String> SIopportunityIds){
- List<SI_Attachment__c> attFileList = [select id,Opportunity_ID__c,File_Upload_Date__c,Type__c from SI_Attachment__c where id in:SIopportunityIds];
- List<id> oppsId = new List<id>();
- Map<id,id> SODOwnerMap = new Map<id,id>();
- for(SI_Attachment__c siAc : attFileList){
- oppsId.add(siAc.Opportunity_ID__c);
- }
- List<IS_Opportunity_Demand__c> sodList = [select OwnerId,id,Opportunity_ID__c from IS_Opportunity_Demand__c where Opportunity_ID__c in:oppsId];
- for(IS_Opportunity_Demand__c sod: sodList){
- SODOwnerMap.put(sod.Opportunity_ID__c, sod.OwnerId);
- }
- for(SI_Attachment__c siAc : attFileList){
- siAc.File_Upload_Date__c = Date.today();
- siAc.SI_SOD_Owner__c = SODOwnerMap.get(siAc.Opportunity_ID__c);
- }
- savepoint sp = Database.setsavepoint();
- try{
- update attFileList;
- return 'Fin';
- }catch(exception o){
- Database.rollback(sp);
- return 'Database Error';
- }
-
- }
-
- /**
- OCM璇环鏂囦欢涓婁紶鐢紝璇环涓婁紶鏂囦欢锛屾牴鎹枃浠剁绫伙紝鏇存柊瀵瑰簲SI闇�姹傝〃鐘舵��
- */
- public static String UpdateSIFunctionStatus(List<String> SIopportunityIds){
- system.debug('Inside+++++++++++++++');
- List<SI_Attachment__c> attFileList = [select id,Opportunity_ID__c,Type__c from SI_Attachment__c where id in:SIopportunityIds];
- List<id> oppid = new List<id>();
- for(SI_Attachment__c si : attFileList){
- oppid.add(si.Opportunity_ID__c);
- }
- List<IS_Opportunity_Demand__c> isoFileList = new List<IS_Opportunity_Demand__c>();
- List<Opportunity> opslist = [select id,Project_decide_date__c,bid_Confrim_Date__c from Opportunity where id in:oppid];
- List<Opportunity> opslistUpdate = new List<Opportunity>();
- Map<Id,String> AttTypeToISODate = new Map<Id,String>();
- isoFileList = [ select Id,CAD_Upload_Date__c,Program_Plan_Upload_Date__c,
- Param_Upload_Date__c,Bid_Document_Upload_Date__c,
- ConfirmBook_Upload_Date__c,Opportunity_ID__c
- from IS_Opportunity_Demand__c
- where Opportunity_ID__c in:oppid
- and Func_SOD_Status__c !='宸茬粓姝�'];
- for(SI_Attachment__c att: attFileList){
- AttTypeToISODate.put(att.Opportunity_ID__c,att.Type__c);
- }
- for(IS_Opportunity_Demand__c iso : isoFileList){
- if(AttTypeToISODate.get(iso.Opportunity_ID__c) == 'CAD鍥剧焊'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎵嬫湳瀹ゅ噣鍖栧钩闈㈠浘锛堝惈璁惧瀹氫綅锛�'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '鐩爣鏈棿鍚婂瀹氫綅鍥�'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '鐩爣鏈棿鍑�鍖栫珛浣撳浘'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '绀烘暀鐐规ゼ灞傚钩闈㈠浘'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '妤煎眰寤虹瓚骞抽潰鍥�'||
- AttTypeToISODate.get(iso.Opportunity_ID__c) == '鍏朵粬宸ョ▼鏂囦欢娓呭崟'){
- if( iso.CAD_Upload_Date__c == null || AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎵嬫湳瀹ゅ噣鍖栧钩闈㈠浘锛堝惈璁惧瀹氫綅锛�'){
- iso.CAD_Upload_Date__c = Date.today();
-
- }
- }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '椤圭洰鏂规涔�'){
- iso.Program_Plan_Upload_Date__c = Date.today();
- for(Opportunity op : opslist){
- op.Project_decide_date__c = Date.today();
- opslistUpdate.add(op);
- System.debug('椤圭洰鏂规涔p'+opslistUpdate);
- }
- }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎷涙爣鍙傛暟'){
- iso.Param_Upload_Date__c = Date.today();
- }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '鏍囦功' ){
- iso.Bid_Document_Upload_Date__c = Date.today();
- for(Opportunity op : opslist){
- op.bid_Confrim_Date__c = Date.today();
- opslistUpdate.add(op);
- }
- }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == 'OCAP/TUV璁よ瘉'){
- iso.ConfirmBook_Upload_Date__c = Date.today();
- }
- }
- savepoint sp = Database.setsavepoint();
- try{
- update isoFileList;
- if(opslistUpdate.size()>0){
- update opslistUpdate;
- }
-
- }catch(exception o){
- Database.rollback(sp);
- return 'Failed: '+o;
- system.debug('鏈嶅姟鍣ㄤ睛閿欙細'+o);
- }
- return 'Fin';
- }
- /**
- OCM鎶ヤ环鐢紝褰撹浠风紪鐮佹洿鏂版椂锛屾姤浠风紪鐮佺浉搴旀敼鍙�
- */
- public static String ResetQuoteNo(List<id> oppidList){
- List<Quote> UpdateQuoteList = new List<Quote>();
- List<Opportunity> oppNoList = new List<Opportunity>();
- Map<id,String> oppIdnoMap = new Map<id,String>();
- oppNoList = [SELECT id,Opportunity_No__c from Opportunity where id in:oppNoList];
- for(Opportunity ops : oppNoList){
- oppIdnoMap.put(ops.id, ops.Opportunity_No__c);
- }
- UpdateQuoteList = [SELECT id,Quote_No__c,Opportunityid from Quote WHERE Opportunityid in:oppidList order by Opportunityid];
- Integer index = 0;
- id flgId = null;
- for(Quote Qu : UpdateQuoteList){
- if(flgId == null){
- id ids = Qu.Opportunityid;
- }
- if(flgId == Qu.Opportunityid){
- index ++;
- }else{
- flgId = Qu.Opportunityid;
- index = 1;
- }
- Qu.Quote_No__c = oppIdnoMap.get(Qu.Opportunityid) + (index>9?(String.valueof(index)):('0'+String.valueof(index)));
- }
- return 'Fin';
- }
- /**
- OCM_SI鏇存柊瀵瑰簲鎶ヤ环鐘舵�侊紝
- */
- WebService static String setQuote(string oppid){
- system.debug('2323^^^^^^^^^^^^');
- List<IS_Opportunity_Demand__c> updateList = [SELECT Quote_Locked_Date__c from IS_Opportunity_Demand__c WHERE Opportunity_ID__c =:oppid ];
- for(IS_Opportunity_Demand__c iso : updateList){
- iso.Quote_Locked_Date__c = Date.today();
- }
- update updateList;
- return 'Fin';
- }
- /**
- OCM璇环鎷嗗崟鐢紝鐢ㄦ潵澶嶅埗鍘熸湁璇环鐨勬姤浠�
- */
- public static String CopyQuoteFromOppor(id oldOppor,String opporName , id newOppor,Opportunity ModelOppor){
- List<Quote> newQuoteList = new List<Quote>();
- Map<id,id> newToold = new Map<id,id>();
- Map<id,QuoteLineItem> QuidWithQLitem = new Map<id,QuoteLineItem>();
- List<id> QuoteidOldList = new List<id>();
- List<Opportunity> opGetname = [SELECT Opportunity_No__c from Opportunity where id = :newOppor];
- if(opGetname.size()>0){
- String nameCode = opGetname[0].Opportunity_No__c;
- system.debug(nameCode+'nameCode');
- }
- String ele = '%'+ModelOppor.old_Oppo_No__c +'%';
- List<Quote> countQu = [SELECT id from Quote WHERE Quote_No__c like :ele];
- List<Quote> oldQuoteList = [SELECT Id,
- Name,
- CurrencyIsoCode,
- CreatedDate,
- OpportunityId,
- Pricebook2Id,
- ContactId,
- QuoteNumber,
- IsSyncing,
- ShippingHandling,
- Tax,
- Status,
- ExpirationDate,
- Description,
- Subtotal,
- TotalPrice,
- LineItemCount,
- BillingName,
- ShippingName,
- QuoteToName,
- AdditionalName,
- Email,
- Phone,
- Fax,
- AccountId,
- Discount,
- GrandTotal,
- Agency1__c,
- Agency1_Profit__c,
- Agency1_Profit_Rate__c,
- Agency2__c,
- Agency2_Profit__c,
- Agency2_Profit_Rate__c,
- Agent1_Agent2_Price__c,
- OCM_Agent1_Price__c,
- OCM_Sales_Forecast__c,
- Estimation_List_Price__c,
- Stocking_Price__c,
- Dealer_Final_Price__c,
- Quote_No__c,
- Stock_Pre_Arrangement__c,
- Quote_Date__c,
- Unit_Price__c,
- Offer_Amount__c,
- TOTAL__c,
- Discount__c,
- Pricing__c,
- Preferential_Trading_Price__c,
- Contract__c,
- Quote_Expiration_Date__c,
- Quote_Comment__c,
- Discount_Amount_Calculate__c,
- Discount_Amount__c,
- Print_HP_Name__c,
- Quote_Adjust_Amount__c,
- Quote_Adjust_Calculate__c,
- Quote_No_Auto__c,
- Installation_location__c,
- QuoteName__c,
- PriceRefreshDate__c,
- Quote_Print_Date__c,
- OCM_Sales_Forecast_Without_Tax__c,
- Quote_Decision__c,
- Cancel_Decide__c,
- TotalPrice__c,
- Quote_Decision_Date__c,
- Quote_CreatedDate__c,
- IsSelected__c,
- HasType3Machine__c,
- OCM_Sales_Forecast_F__c,
- Dealer_Final_Price_F__c,
- Agent1_Agent2_Price_Page__c,
- Dealer_Final_Price_Page__c,
- OCM_Agent1_Price_Page__c,
- QuoteTotal_Page__c,
- Quote_Adjust_Amount_Page__c,
-
- OCM_Agent1_Price_F__c,
-
- Agent1_Agent2_Price_F__c,
- Agency2_Profit_F__c,
- Agency2_Profit_Rate_F__c,
- Quote_Adjust_Amount_F__c,
- Quote_Adjust_Calculate_F__c,
- TotalPrice_F__c,
- Discount_Amount_F__c,
- Discount_Amount_Calculate_F__c,
- BidAnnounce__c,
- Quote_No_last2__c
- FROM
- Quote
- WHERE
- OpportunityId = :oldOppor
- order by
- CreatedDate];
-
- Integer i = countQu.size();
- i=1;
- for(Quote Qu : oldQuoteList){
- //瑕佹寜鐓у師鏈夐『搴忛噰鐣�
- system.debug(Qu.Id+'===============4');
- String title = ModelOppor.old_Oppo_No__c;
- QuoteidOldList.add(Qu.Id);
- Qu.Id = null;
- Qu.OpportunityId = newOppor;
- Qu.Quote_No__c = title.substring(0,title.length() - 7)+ModelOppor.Opp_Number__c+ '-'+(i>9?(String.valueof(i)):('0'+i));
- newQuoteList.add(Qu);
- i++;
- }
- Savepoint sp = Database.setSavepoint();
- try{
- insert newQuoteList;
- } catch(Exception o){
- Database.rollback(sp);
- return 'Insert Failed'+o;
- }
- for(Integer k = 0; k < newQuoteList.size(); k++){
- newToold.put(QuoteidOldList[k],newQuoteList[k].id);
- }
- List<QuoteLineItem> oldQuoteitemList = [Select Id,Asset_Model_No__c,SFDA_Status__c,Product_Sales_Possibility__c,
- Name__c,BSS_Category__c,Quote.Quote_Print_Date__c,Quoteid,
- Qty_Unit__c,Cost__c,UnitPrice__c,ListPrice__c,Quantity,TotalPrice__c,
- PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c,PricebookEntry.Product2.VenderName__c, Product2.VenderName__c,Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
- PricebookEntryId, PricebookEntry.Product2Id,UnitPrice_Page__c,PricebookEntry.Product2.Packing_list_manual__c,PricebookEntry.Product2.StorageStatus__c
- From QuoteLineItem where Quoteid = :QuoteidOldList];
- for(QuoteLineItem qli : oldQuoteitemList){
- QuidWithQLitem.put(qli.Quoteid,qli);
- }
- system.debug(newToold+'newTooldnewTooldnewToold');
- system.debug(QuoteidOldList+'QuoteListQuoteListQuoteList');
- List<QuoteLineItem> copyQuoteItemList = new List<QuoteLineItem>();
- for(String Qu : QuoteidOldList){
- system.debug(Qu+'===============1');
- for(QuoteLineItem qlir : oldQuoteitemList){
- if(qlir.Quoteid == Qu){
- system.debug(qlir+'===============2');
- system.debug(QuidWithQLitem.get(Qu)+'===============3');
- QuoteLineItem qli = qlir.clone();
- qli.Quoteid = newToold.get(Qu);
- qli.Id = null;
- qli.UnitPrice = 0;
- copyQuoteItemList.add(qli);
- }
-
- }
- }
- Savepoint spl = Database.setSavepoint();
- try{
- insert copyQuoteItemList;
- } catch(Exception o){
- Database.rollback(spl);
- return 'Insert Failed copyQuoteItemList '+o;
- }
- return 'Fin';
- }
- /**
- OCM鎶ヤ环鐢紝鍒ゆ柇SI闇�姹傝〃鐨勭姸鎬�
- */
- WebService static String getStatusForISO(id opporID){
- //缈昏瘧宸叉壒鍑嗙殑鏁伴噺
- Integer Abort = 0;
- Integer Applying = 0;
- Integer CommitCode = 0;
- List<IS_Opportunity_Demand__c> isoList = [ SELECT
- id,
- name,
- Abort_Date__c,
- Approval_Date__c,
- Func_SOD_Status__c
- FROM
- IS_Opportunity_Demand__c
- where
- Opportunity_ID__c = :opporID
- AND
- (
- Approval_Date__c !=null
- )];
-
- if(isoList.size()==0){
- return 'Abort';
-
- }else if(isoList.size()>0){
- return 'CommitCode';
- }
- return 'NoneIn';
-
- }
- /**
- OCM鐢紝鍙栨秷SI闇�姹傝〃
- */
- WebService static String setAbortSI(id isoID,String AbortReason){
- List<IS_Opportunity_Demand__c> updateList = new List<IS_Opportunity_Demand__c>();
- List<id> oppidList = new List<id>();
- List<Opportunity> Opplist = new List<Opportunity>();
- if(AbortReason==null||String.isBlank(AbortReason)){
- return '璇疯緭鍏ョ粓姝I闇�姹傚師鍥�';
- }else{
- updateList = [SELECT id,Abort_SI_Reason__c,Abort_Date__c,Opportunity_ID__c from IS_Opportunity_Demand__c where id = :isoID];
- for(IS_Opportunity_Demand__c iso : updateList){
- iso.Abort_SI_Reason__c = AbortReason;
- iso.Abort_Date__c = Date.today();
- oppidList.add(iso.Opportunity_ID__c);
- }
- Opplist = [SELECT Project_decide_date__c , Stock_Submit_Date__c , Stock_Confrim_Date__c from Opportunity WHERE id in:oppidList];
- for(Opportunity ops : Opplist){
- ops.Project_decide_date__c = null;
- ops.Stock_Submit_Date__c = null;
- ops.Stock_Confrim_Date__c = null;
- }
- Savepoint sp = Database.setSavepoint();
- try{
- update Opplist;
- update updateList;
- return 'Fin';
- }catch (Exception o){
- Database.rollback(sp);
- return 'DataBase is Crashed,Connect with the Developer PLEASE';
- }
- }
- }
- /**
- OCM璇环鐢紝鍙栨秷SI璇环锛屽皢鐩稿叧鑱旂殑SI闇�姹傝〃鏃犳晥鍖�
- */
- public static void updateSIodcList(List<String> OpporList){
- //璇环澶卞崟锛屽皢璇环瀵瑰簲鐨凷I闇�姹傝〃鏃犳晥鍖�
- List<IS_Opportunity_Demand__c> ODCLIST = new List<IS_Opportunity_Demand__c>();
- ODCLIST = [SELECT id,Abort_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c in:OpporList and Abort_Date__c=null];
- for(IS_Opportunity_Demand__c Od : ODCLIST){
- Od.Abort_Date__c = Date.today();
- }
- update ODCLIST;
- }
- /*
- =======================================================================================================================
- ===================================================SI 璇环閮ㄥ垎util闆嗗悎=================================================
- =======================================================================================================================
- */
- WebService static void addBatchIfLogForCnt(String typeStr, String operationType, String fileType, String hpId) {
- BatchIF_Log__c log = new BatchIF_Log__c(
- Type__c = typeStr,
- Is_Error__c = 0
- );
- log.Account__c = hpId;
- log.Log__c = operationType;
- log.Log2__c = fileType;
-
- insert log;
- }
-
- WebService static String setSObjectShare(String sobjectName, String rowCause, String parentId, List<String> userAccess, String ownerId) {
- try {
- List<SObject> sObjList = new List<SObject>();
- for (String ua : userAccess) {
- String userid = ua.split('_')[0];
- String access = ua.split('_')[1];
- SObject sObj = Schema.getGlobalDescribe().get(sobjectName).newSObject();
- if (String.isBlank(userid) == false && userid.substring(0, 15) != ownerId.substring(0, 15)) {
- sObj.put('RowCause', rowCause);
- sObj.put('ParentId', parentId);
- sObj.put('UserOrGroupId', userid);
- sObj.put('AccessLevel', access);
- sObjList.add(sObj);
- }
- }
- if (sObjList.size() > 0) insert sObjList;
- return 'OK';
- } catch (Exception e) {
- return e.getMessage();
- }
- }
- // SWAG-BJ29Z4 钀ヤ笟鍔╃悊鍏变韩璇环瀛楁瀹℃壒鍔犲叆鍏变韩 start
- WebService static String setOpportunityShare(String sobjectName, String parentId, List<String> userAccess, String ownerId) {
- System.debug(sobjectName+'======'+parentId+'======'+ownerId);
- try {
- List<SObject> sObjList = new List<SObject>();
- for (String ua : userAccess) {
- String userid = ua.split('_')[0];
- String access = ua.split('_')[1];
- SObject sObj = Schema.getGlobalDescribe().get(sobjectName).newSObject();
- if (String.isBlank(userid) == false && userid.substring(0, 15) != ownerId.substring(0, 15)) {
- // sObj.put('RowCause', rowCause);
- sObj.put('ParentId', parentId);
- sObj.put('UserOrGroupId', userid);
- sObj.put('AccessLevel', access);
- sObjList.add(sObj);
- }
- }
- System.debug(sObjList+'======');
- if (sObjList.size() > 0) insert sObjList;
- return 'OK';
- } catch (Exception e) {
- return e.getMessage();
- }
- }
- // SWAG-BJ29Z4 钀ヤ笟鍔╃悊鍏变韩璇环瀛楁瀹℃壒鍔犲叆鍏变韩 end
-
- public static void insertBatchIfLog(BatchIF_Log__c bl) {
- insert bl;
- }
-
- public static List<BatchIF_Log__c> getBatchIfLogForRequest(String typeStr, String hpId, Datetime dt) {
- return [select Id from BatchIF_Log__c where Type__c = :typeStr and Account__c = :hpId
- and RequestStatus__c != 'Finish' and RequestStatus__c != 'Error' and CreatedDate > :dt];
- }
- public static Integer getOlympusWorkDayCount(Date fromDate, Date toDate) {
- AggregateResult[] calAggResult = [Select Count(Id) cnt From OlympusCalendar__c Where Date__c >= :fromDate And Date__c <= :toDate And IsWorkDay__c = 1];
- Integer workDayCount = (Integer) calAggResult[0].get('cnt');
- return workDayCount;
- }
-
public static Pricebook2 getStandardPricebook() {
- if (system.Test.isRunningTest()) {
- return new Pricebook2(Id = System.Test.getStandardPricebookId(), Name = 'Standard Pricebook');
+ if (Test.isRunningTest()) {
+ return new Pricebook2(Id = Test.getStandardPricebookId(), Name = 'Standard Pricebook');
} else {
- List<Pricebook2> pbs = [Select Id, Name From Pricebook2 where IsStandard = true AND isActive = true];
+ List<Pricebook2> pbs = [Select Id, Name From Pricebook2 where IsStandard = true];
if (pbs.size() > 0) {
return pbs[0];
} else {
@@ -5404,167 +94,12 @@
}
}
}
- public static Set<Id> getAllSubRoleIds(Id userRoleId, String additionalRoleName) {
- // currentRoleId 銇� additionalRoleName 銇俱仛 query銇欍倠
- Map<Id, UserRole> parentRoleMap = new Map<Id, UserRole>();
- Boolean isAdditional = false;
- if (String.isBlank(additionalRoleName) == true) {
- parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId]);
- } else {
- isAdditional = true;
- List<String> addtionalRoleNameList = additionalRoleName.split(',');
- parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId or DeveloperName in :addtionalRoleNameList]);
- }
- //MAP<Id, UserRole> parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId or DeveloperName = :additionalRoleName]);
- Map<Id, Set<Id>> allRoleMap = new Map<Id, Set<Id>>();
- for (UserRole role : [select Id, ParentRoleId from UserRole]) {
- Set<Id> roleIds = allRoleMap.get(role.ParentRoleId);
- if (roleIds == null) {
- roleIds = new Set<Id>();
- }
- roleIds.add(role.Id);
- allRoleMap.put(role.ParentRoleId, roleIds);
- }
- return getSubRoleRecursive(parentRoleMap.keySet(), allRoleMap, isAdditional, userRoleId);
- }
- private static Set<Id> getSubRoleRecursive(Set<Id> roleIds, Map<Id, Set<Id>> allRoleMap, Boolean isAdditional, Id userRoleId) {
- Set<Id> currentRoleIds = new Set<Id>();
-
- // get all of the roles underneath the passed roles
- for (Id parentRoleId : roleIds) {
- if (allRoleMap.get(parentRoleId) != null) {
- currentRoleIds.addAll(allRoleMap.get(parentRoleId));
- }
- }
-
- // go fetch some more rolls!
- if(currentRoleIds.size() > 0) {
- currentRoleIds.addAll(getSubRoleRecursive(currentRoleIds, allRoleMap, isAdditional, userRoleId));
- }
-
- // 鍏艰伔銇牬鍚堛�佸吋鑱稲ole鑷韩銇甀d銈傚叆銈屻倠
- if (isAdditional) {
- roleIds.remove(userRoleId);
- currentRoleIds.addAll(roleIds);
- }
- return currentRoleIds;
- }
-
- public static String getOppSearchSQOL(String visitorPlaceId, String nameCondition) {
- Account a = null;
- a = [select Id, Hospital__c, Agent_Ref__c, Parent.Parent.RecordType.DeveloperName, Parent.RecordType.DeveloperName, RecordType.DeveloperName from Account where Id=:visitorPlaceId];
-
-// String nameCondition = '%' + String.escapeSingleQuotes(query.replaceAll('%', '')) + '%';
- system.debug('cond=' + nameCondition);
-
- // 妞滅储
- String queryString = '';
- String temptoday = Date.today().format().replace('/', '-');
- //String tempLastDate = Date.today().addDays(365).format().replace('/', '-');
- String tempLastDate = Date.today().addDays(-365).format().replace('/', '-');
- // 鐥呴櫌
- if (a.Parent.Parent.RecordType.DeveloperName == 'HP') {
- // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId = \'01210000000QekK\' order by Name, Opportunity_No__c, Department_Name__c limit 31';
- // 20200616 CHAN-BQM8LU vivek start
- // 20191126 SWAG-BJA6JK LHJ Start
- // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210824 zh SWAG-C5S46P start
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and CountNoInstall__c > 0 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
-
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and DeliveryDate__c > '+temptoday+' and DeliveryDate__c <= '+tempLastDate+')) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210824 zh SWAG-C5S46P end
- // 20191126 SWAG-BJA6JK LHJ End
- //20210826 mzy SWAG-C5S46P start
- //鏀逛负鐢� 鍙戣揣瀹屾瘯鏃� 鍒ゆ柇 涓� 灏� 2012骞村垱寤虹殑涓旇浠风姸鎬佹槸鍙戣揣/瀹屾瘯鐨勬暟鎹帓闄�
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210826 mzy SWAG-C5S46P end
- // 20200616 CHAN-BQM8LU vivek end
- }
- // 璨╁2搴�
- else if (a.RecordType.DeveloperName == 'Agency') {
- // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId = \'01210000000QekK\' order by Name, Opportunity_No__c, Department_Name__c limit 31';
- // 20200616 CHAN-BQM8LU vivek start
- // 20191126 SWAG-BJA6JK LHJ Start
- // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210824 zh SWAG-C5S46P start
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and CountNoInstall__c > 0 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
-
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and DeliveryDate__c > '+temptoday+' and DeliveryDate__c <= '+tempLastDate+')) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210824 zh SWAG-C5S46P end
- //20210826 mzy SWAG-C5S46P start
- //鏀逛负鐢� 鍙戣揣瀹屾瘯鏃� 鍒ゆ柇 涓� 灏� 2012骞村垱寤虹殑涓旇浠风姸鎬佹槸鍙戣揣/瀹屾瘯鐨勬暟鎹帓闄�
- //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
- //20210826 mzy SWAG-C5S46P end
- // 20191126 SWAG-BJA6JK LHJ End
- // 20200616 CHAN-BQM8LU vivek end
- }
-
- return queryString;
- }
- // 鐢ㄦ潵瑙e喅缁忛攢鍟嗘椿鍔ㄧ殑鎷呭綋
- public static List<Agency_Opportunity__c> DatabaseQuery(String soql){
- return DataBase.query(soql);
+ public static void updateExpress(List<Loaner_Express__c> upLeList){
+ update upLeList;
}
public class myException extends Exception {}
- WebService static String qureySoql(String soql) {
- List<SObject> rtnList = Database.query(soql);
- String rtnJSON = JSON.serialize(Database.query(soql), true);
- System.debug('rtnJSON:' + rtnJSON);
- return rtnJSON;
- }
- // GIR 椤圭洰闇�姹傜敤锛屾壘涓嶅埌Add_report鐨勬祴璇曠▼搴� 20191219 by vivek start
- WebService static Account getAccountForJs(String id){
- return [select Id, Name, Province_formula__c, Hospital__r.Salesdepartment_HP__c,Department_Class__r.Name,Department_Class__r.OwnerId, Department_Class__r.Owner.Name, Department_Class__r.Id, OwnerId, Owner.Name,
- Hospital__r.Name, Hospital__r.Id, Hospital__r.OCM_Category__c,Hospital__r.OCM_Management_Province__r.GI_assistant__c,Hospital__r.OCM_Management_Province__r.GI_assistant__r.Name
- from Account where Id = :id];
- }
- // GIR 椤圭洰闇�姹傜敤锛屾壘涓嶅埌Add_report鐨勬祴璇曠▼搴� 20191219 by vivek end
-
- // 浠诲姟鍜屾棩鎶� 2020-05-23 update by vivek start
- public static Event__c getNoIdEventC(Event__c dlyevt){
- dlyevt.Id = null;
- return dlyevt;
- }
- public static Event getNoIdEvent(Event dlyec){
- dlyec.Id = null;
- return dlyec;
-
- }
- public static Event getEventList(Id eventcid){
- Event dlyec = [select id, ActivityDate, OwnerId, Subject, task_id__c,whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
- StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
- Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
- Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c,Opd_Plan__c
- from Event where EventC_ID__c = :eventcid];
- return dlyec;
- }
-
- public static List<Event> getEventsList(Set<String> eventcid){
- List<Event> dlyec = [select id, ActivityDate, OwnerId, Subject, whatid__c,task_id__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
- StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
- Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
- Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
- Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
- Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
- Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c
- from Event where Id = :eventcid];
- return dlyec;
- }
- // 浠诲姟鍜屾棩鎶� 2020-05-23 update by vivek end
-
- //澶变絾鎶ュ憡鐢宠淇濆瓨 2021-09-13 upsert zxk start
- public static void lostOrder(Lost_Report__c lostData) {
- upsert lostData;
- }
}
\ No newline at end of file
--
Gitblit v1.9.1