From ba1c90575c47f9cb5c2ce0a20da90d3b1739b5fa Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 26 四月 2022 11:47:45 +0800
Subject: [PATCH] 0425 Commit
---
force-app/main/default/classes/ProRegisterBatch.cls | 99 +++++++++++++++++++------------------------------
1 files changed, 39 insertions(+), 60 deletions(-)
diff --git a/force-app/main/default/classes/ProRegisterBatch.cls b/force-app/main/default/classes/ProRegisterBatch.cls
index fa78838..4b3e1fe 100644
--- a/force-app/main/default/classes/ProRegisterBatch.cls
+++ b/force-app/main/default/classes/ProRegisterBatch.cls
@@ -1,66 +1,45 @@
global class ProRegisterBatch implements Database.Batchable<sObject> {
- String regId;
+ String regId;
+
+ global ProRegisterBatch(String regId) {
+ this.regId = regId;
+ }
- Boolean IsNeedExecute = false; // 2021-03-05 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 鏄惁绗﹀悎鎵ц鏉′欢
-
- global ProRegisterBatch(String regId) {
- this.regId = regId;
- }
+ global ProRegisterBatch() {
+
+ }
+
+ global Database.QueryLocator start(Database.BatchableContext BC) {
+ Date yesterday = Date.Today() - 1;
+
+ if (String.isBlank(this.regId)) {
+ return Database.getQueryLocator([select id, ValidProductRegister__c
+ from Product_Register__c
+ where ValidProductRegister__c = false
+ and ValidTo__c = yesterday ]);
- global ProRegisterBatch() {
-
- }
+ } else {
+ if (this.regId == 'updateAllInvalidData') {
+ return Database.getQueryLocator([select id, ValidProductRegister__c
+ from Product_Register__c
+ where ValidProductRegister__c = false ]);
+
+ } else {
+ return Database.getQueryLocator([select id, ValidProductRegister__c
+ from Product_Register__c
+ where id = :this.regId
+ and ValidTo__c <= :Date.Today()]);
+ }
+
+ }
+ }
- // 2021-03-05 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 start
- global ProRegisterBatch(Boolean NeedExecute) {
- this.IsNeedExecute = NeedExecute;
- }
- // 2021-03-05 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 end
-
- global Database.QueryLocator start(Database.BatchableContext BC) {
-
- if (String.isBlank(this.regId)) {
- return Database.getQueryLocator([select id, RegisterNoStatus__c
- from Product_Register__c
- where RegisterNoStatus__c = '鏈夋晥'
- and ValidTo__c <= :Date.Today()]);
+ global void execute(Database.BatchableContext BC, List<Product_Register__c> dcList) {
+
+ if (dcList.size() > 0) update dcList;
+ }
- } else {
- return Database.getQueryLocator([select id, RegisterNoStatus__c
- from Product_Register__c
- where RegisterNoStatus__c = '鏈夋晥'
- and id = :this.regId
- and ValidTo__c <= :Date.Today()]);
- }
- }
-
- global void execute(Database.BatchableContext BC, List<Product_Register__c> dcList) {
- List<Product_Register__c> updList = main(dcList);
- if (updList.size() > 0) update updList;
- }
-
- public static List<Product_Register__c> main(List<Product_Register__c> dcList) {
-
- List<Product_Register__c> updList = new List<Product_Register__c>();
-
- for (Product_Register__c reg : dcList) {
-
- reg.RegisterNoStatus__c = '澶辨晥-涓嶅啀娉ㄥ唽';
-
- updList.add(reg);
- }
- return updList;
- }
-
- global void finish(Database.BatchableContext BC) {
-
- //2021-03-10 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 start
- if(!Test.isRunningTest() &&IsNeedExecute==true){
- //batch閲岃皟鐢ㄤ笅涓�涓猙atch鏃讹紝甯屾湜璺熷師鏈夌殑Schedule閲岄潰浼犵殑鏉℃暟淇濇寔涓�鑷�
- Id execBTId = Database.executebatch(new RentalApplyDailyBatch(true),100);
- }
- //2021-03-10 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 end
-
- }
-
+ global void finish(Database.BatchableContext BC) {
+
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1