From de9565270a88b0749d17c1961cd41399c8483c96 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 17:46:45 +0800
Subject: [PATCH] merge
---
force-app/main/default/classes/updateESignBatch.cls | 436 +++++++++++++++++++++++++++--------------------------
1 files changed, 223 insertions(+), 213 deletions(-)
diff --git a/force-app/main/default/classes/updateESignBatch.cls b/force-app/main/default/classes/updateESignBatch.cls
index 0f55d79..8862e8d 100644
--- a/force-app/main/default/classes/updateESignBatch.cls
+++ b/force-app/main/default/classes/updateESignBatch.cls
@@ -1,4 +1,4 @@
-global class updateESignBatch implements Database.Batchable < sObject > , Database.Stateful {
+global class updateESignBatch implements Database.Batchable<sObject>, Database.Stateful {
//鐢靛瓙绛炬敹鍗�-绛炬敹鍗曞綍鍏ヨ〃鏇存柊绛炬敹鍗� 绮剧悽鎶�鏈� wql 2020-09-25 start
/*
鈶犳甯告墽琛� Database.executeBatch(new updateESignBatch(), 20);
@@ -29,18 +29,17 @@
//瀛樻斁闇�瑕佹洿鏂扮殑绛炬敹鍗昳d
private String id;
//瀛樻斁闇�瑕佹洿鏂扮殑涓�浜涚鏀跺崟
- private List < String > ids;
+ private List<String> ids;
//瀛樻斁宸茬粡鏈�缁堢姸鎬佺殑flag
private Boolean flag;
//鐢ㄤ簬鎵цbatch鍚屾椂璁板綍鏃ュ織淇℃伅
private BatchIF_Log__c iflog;
- global List < String > emailMessages = new List < String > ();
+ global List<String> emailMessages = new List<String>();
global Integer totalCount = 0; // 鎬讳欢鏁�
global Integer failedCount = 0; //澶辫触浠舵暟
global Boolean ManualExecution_Identification = false;
//榛樿璺戞墍鏈夌鏀跺崟
global updateESignBatch() {
-
iflog = new BatchIF_Log__c();
iflog.Type__c = 'ESignBatch';
iflog.Is_Error__c = 0;
@@ -75,7 +74,7 @@
// insert iflog;
}
//鎵归噺鏇存柊绛炬敹鍗�
- global updateESignBatch(List < String > ids) {
+ global updateESignBatch(List<String> ids) {
//鎵嬪姩鏍囪瘑缃垚true
this.ManualExecution_Identification = true;
this.ids = ids;
@@ -88,7 +87,6 @@
}
//鏇存柊鏌愪竴鏉$殑绛炬敹鍗�
global updateESignBatch(String id) {
-
//鎵嬪姩鏍囪瘑缃垚true
this.ManualExecution_Identification = true;
system.debug('鎵嬪姩浼犲弬1锛�' + ManualExecution_Identification);
@@ -114,7 +112,7 @@
// insert iflog;
}
//鎵归噺鏇存柊宸插鐞嗙殑绛炬敹鍗�
- global updateESignBatch(List < String > ids, boolean flag) {
+ global updateESignBatch(List<String> ids, boolean flag) {
//鎵嬪姩鏍囪瘑缃垚true
this.ManualExecution_Identification = true;
this.ids = ids;
@@ -138,9 +136,11 @@
// 濡傛灉鍝熷悓鍚嶇殑Batch璁″垝鍒犻櫎宸插瓨鍦ㄧ殑璁″垝閲嶆柊璁剧疆
if (haveError) {
haveError = false;
- for (CronTrigger ct : [SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
- FROM CronTrigger
- WHERE CronJobDetail.Name = :scB.scName]) {
+ for (CronTrigger ct : [
+ SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
+ FROM CronTrigger
+ WHERE CronJobDetail.Name = :scB.scName
+ ]) {
System.abortJob(ct.Id);
}
try {
@@ -202,7 +202,7 @@
if (spafter != null && String.isNotBlank(spafter)) {
b.scName = baseName + '005';
b.scTime = spafter + ' ' + day + ' ' + month + ' ? ' + year;
-
+
// system.schedule(sJobame,spafter + ' ' + day + ' ' + month + ' ? ' + year, new AgencyShareUpdateBatchSchedule());
return b;
} else {
@@ -242,49 +242,49 @@
b.scName = baseName + '001';
b.scTime = '0 ' + minMin + ' ' + (hour + 1) + ' ' + day + ' ' + month + ' ? ' + year;
// system.schedule(sJobame,'0 ' + minMin + ' ' + (hour + 1) +' ' + day + ' ' + month + ' ? ' + year, new AgencyShareUpdateBatchSchedule());
-
}
return b;
}
public static void removeOtherSc(String likeName, String needName) {
String likeStr = likeName + '00%';
- for (CronTrigger ct : [SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
- FROM CronTrigger
- WHERE CronJobDetail.Name Like :likeStr
- AND CronJobDetail.Name != :needName]) {
+ for (CronTrigger ct : [
+ SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
+ FROM CronTrigger
+ WHERE CronJobDetail.Name LIKE :likeStr AND CronJobDetail.Name != :needName
+ ]) {
System.abortJob(ct.Id);
}
}
- global void execute(Database.BatchableContext BC, list < eSignForm__c > eSignList) {
+ global void execute(Database.BatchableContext BC, list<eSignForm__c> eSignList) {
//鐢ㄤ綔褰曞叆琛ㄧ殑妫�绱㈡潯浠�
- List < String > esFormidList = new List < String > ();
+ List<String> esFormidList = new List<String>();
//瀛樻斁绛炬敹鍗曞綍鍏ヨ〃鏄庣粏
- List < eSignFormLineItemEntry__c > eSignFormLineItemEntryList = new List < eSignFormLineItemEntry__c > ();
+ List<eSignFormLineItemEntry__c> eSignFormLineItemEntryList = new List<eSignFormLineItemEntry__c>();
//鐢ㄤ綔绛炬敹鍗曟槑缁嗙殑妫�绱㈡潯浠�
- List < String > eSignFormLineIdList = new List < String > ();
+ List<String> eSignFormLineIdList = new List<String>();
//鏇存柊鐨勭鏀跺崟鏄庣粏
- List < eSignFormLineItem__c > eSignFormLuRUList = new List < eSignFormLineItem__c > ();
+ List<eSignFormLineItem__c> eSignFormLuRUList = new List<eSignFormLineItem__c>();
//瀛樻斁鏈�鍚庢洿鏂扮殑 褰曞叆琛╥d
- List < Id > fileIdList = new List < Id > ();
+ List<Id> fileIdList = new List<Id>();
//瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id
- Map < Id, Id > eSignIdMap = new Map < Id, Id > ();
+ Map<Id, Id> eSignIdMap = new Map<Id, Id>();
//瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id 鐢ㄤ簬鏈�鍚庝竴鏉$鏀跺崟褰曞叆琛ㄤ笉鍒犻櫎
- Map < Id, Id > eSignFormLastIdMap = new Map < Id, Id > ();
+ Map<Id, Id> eSignFormLastIdMap = new Map<Id, Id>();
//瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id 鐢ㄤ簬鏂囦欢鏇存柊
- Map < Id, Id > eSignFlieIdMap = new Map < Id, Id > ();
+ Map<Id, Id> eSignFlieIdMap = new Map<Id, Id>();
//瀛樻斁褰曞叆琛╥d锛屽綍鍏ヨ〃
- Map < String, eSignFormEntry__c > lasteSignFormEntryMap = new Map < String, eSignFormEntry__c > ();
+ Map<String, eSignFormEntry__c> lasteSignFormEntryMap = new Map<String, eSignFormEntry__c>();
//瀛樻斁鏈�鏂扮殑 绛炬敹鍗曟槑缁唅d锛岀鏀跺崟鏄庣粏褰曞叆id
- Map < Id, Id > eSignFormLineItemEntryIdMap = new Map < Id, Id > ();
+ Map<Id, Id> eSignFormLineItemEntryIdMap = new Map<Id, Id>();
//绛炬敹鍗曞綍鍏ヨ〃鏄庣粏id锛岀鏀跺崟褰曞叆琛ㄦ槑缁�
- Map < String, eSignFormLineItemEntry__c > lasteSignFormLineItemEntryMap = new Map < String, eSignFormLineItemEntry__c > ();
+ Map<String, eSignFormLineItemEntry__c> lasteSignFormLineItemEntryMap = new Map<String, eSignFormLineItemEntry__c>();
//瀛樻斁 绛炬敹鍗昳d,鏂囦欢鏁伴噺
- Map < String, Integer > fileMap = new Map < String, Integer > ();
+ Map<String, Integer> fileMap = new Map<String, Integer>();
//椹冲洖鍚庡垹闄ゆ枃浠� 鍚� 鎺掑簭闂 绮剧悽鎶�鏈� wql 2020/12/24 start
List<Attachment> esignAttachAgencyList = new List<Attachment>();
List<Attachment> esignAttachHPList = new List<Attachment>();
@@ -292,73 +292,73 @@
Map<String, Integer> fileHPMap = new Map<String, Integer>();
//椹冲洖鍚庡垹闄ゆ枃浠� 鍚� 鎺掑簭闂 绮剧悽鎶�鏈� wql 2020/12/24 end
//瀛樻斁ocsm绠$悊鐪�
- List < String > provinceList = new List < String > ();
+ List<String> provinceList = new List<String>();
//瀛樻斁15浣嶇鏀跺崟id,ocsm绠$悊鐪�
- Map < Id, String > provinceMap = new Map < Id, String > ();
+ Map<Id, String> provinceMap = new Map<Id, String>();
//瀛樻斁鐢ㄤ簬鏇存柊鐨勭鏀跺崟鏁扮粍
- List < eSignForm__c > eSignFormList = new List < eSignForm__c > ();
+ List<eSignForm__c> eSignFormList = new List<eSignForm__c>();
//瀛樻斁绛炬敹鍗曞綍鍏ヨ〃id锛宯ame
- Map < Id, String > eSignNameMap = new Map < Id, String > ();
+ Map<Id, String> eSignNameMap = new Map<Id, String>();
//瀛樻斁绛炬敹鍗曞綍鍏ヨ〃id锛宼ype
- Map < Id, String > eSignTypeMap = new Map < Id, String > ();
+ Map<Id, String> eSignTypeMap = new Map<Id, String>();
//鍒犻櫎涓棿琛ㄦ暟鎹敤
- Map < String, eSignFormEntry__c > eSignStringMap = new Map < String, eSignFormEntry__c > ();
+ Map<String, eSignFormEntry__c> eSignStringMap = new Map<String, eSignFormEntry__c>();
//瀛樻斁鎵�鏈夌鏀跺崟褰曞叆琛╥d
- List < String > luruIsSubmitList = new List < String > ();
+ List<String> luruIsSubmitList = new List<String>();
//瀛樻斁鎵�鏈夌鏀跺崟褰曞叆琛╥d
- List < String > luruIsLastSubmitList = new List < String > ();
+ List<String> luruIsLastSubmitList = new List<String>();
//鍒ゆ柇鏄惁鏈夋湭澶勭悊鐨勫綍鍏ヨ〃
- Map < Id, eSignFormEntry__c > unprocessedESignEneryMap = new Map < Id, eSignFormEntry__c > ();
+ Map<Id, eSignFormEntry__c> unprocessedESignEneryMap = new Map<Id, eSignFormEntry__c>();
//鐢ㄤ簬鍒ゆ柇鍒犻櫎椹冲洖鐨勯檮浠剁殑绛涢�夋潯浠�
- Map < Id, eSignForm__c > rejectESignEneryMap = new Map < Id, eSignForm__c > ();
+ Map<Id, eSignForm__c> rejectESignEneryMap = new Map<Id, eSignForm__c>();
//椹冲洖鍚� 鍒犻櫎涔嬪墠涓婁紶鐨勬枃浠秈d
List<Attachment> deleteLastFileList = new List<Attachment>();
//瀛樻斁鏈洿鏂板墠鐨勭粡閿�鍟嗗鎵圭姸鎬�
- Map < String, String > oldESignAgencyStatusMap = new Map < String, String > ();
+ Map<String, String> oldESignAgencyStatusMap = new Map<String, String>();
//瀛樻斁鏈洿鏂板墠鐨勫尰闄㈠鎵圭姸鎬�
- Map < String, String > oldESignHPStatusMap = new Map < String, String > ();
+ Map<String, String> oldESignHPStatusMap = new Map<String, String>();
try {
//寰幆瀛樻斁绛炬敹鍗昳d 鐢ㄤ綔妫�绱㈢鏀跺崟褰曞叆琛ㄧ殑鏉′欢
system.debug('eSignList:' + eSignList);
if (eSignList.size() > 0) {
for (eSignForm__c esForm : eSignList) {
//瀛樻斁绛炬敹鍗昳d,ocsm绠$悊鐪� 濡傛灉璇环鏄泦閲� 鍒欏彇ocsm绠$悊鐪佷负闆嗛噰璇剧殑鎷呭綋
- if(esForm.Statu_Achievements__r.Opportunity__r.Group_purchase_PCL__c){
+ if (esForm.Statu_Achievements__r.Opportunity__r.Group_purchase_PCL__c) {
provinceMap.put(esForm.Id, '闆嗛噰璇�');
//妫�绱㈡潯浠�
provinceList.add('闆嗛噰璇�');
- }else{
+ } else {
provinceMap.put(esForm.Id, esForm.OCM_man_province_cus__c);
//妫�绱㈡潯浠�
provinceList.add(esForm.OCM_man_province_cus__c);
}
-
+
esFormidList.add(esForm.Id);
//鏈夌粡閿�鍟嗛┏鍥炴垨鑰呭尰闄㈤┏鍥炴椂鍒犻櫎涔嬪墠闄勪欢
if (esForm.agencyRejectDate__c != null || esForm.HPRejectDate__c != null) {
rejectESignEneryMap.put(esForm.Id, esForm);
}
-
-
}
}
system.debug('rejectESignEneryMap:' + rejectESignEneryMap);
//濡傛灉map涓嶄负绌� 鍒欎綔涓虹瓫閫夋潯浠�
- if (rejectESignEneryMap.size()>0) {
- List<Attachment> deleteFileList = [SELECT parentId, createdDate, Name,Description
- FROM Attachment
- WHERE parentId IN: rejectESignEneryMap.keySet() order by createdDate];
+ if (rejectESignEneryMap.size() > 0) {
+ List<Attachment> deleteFileList = [
+ SELECT parentId, createdDate, Name, Description
+ FROM Attachment
+ WHERE parentId IN :rejectESignEneryMap.keySet()
+ ORDER BY createdDate
+ ];
system.debug('deleteFileList:' + deleteFileList);
if (deleteFileList.size() > 0) {
for (eSignForm__c esFile : rejectESignEneryMap.values()) {
-
for (Attachment att : deleteFileList) {
if (esFile.agencyRejectDate__c != null || esFile.HPRejectDate__c != null) {
- if (att.parentId == esFile.Id ) {
+ if (att.parentId == esFile.Id) {
//鈶犵粡閿�鍟嗛┏鍥炲悗闇�瑕佸垹闄ょ殑闄勪欢
if (esFile.agencyRejectDate__c != null) {
if (att.Name.substring(0, 1) == 'A' && att.createdDate < esFile.agencyRejectDate__c) {
@@ -372,14 +372,9 @@
}
}
}
-
-
}
}
-
}
-
-
}
}
system.debug('椹冲洖鍚庡垹闄ょ殑鏂囦欢锛�' + deleteLastFileList);
@@ -389,12 +384,47 @@
}
//妫�绱㈡墍鏈夊綍鍏ヨ〃
- List < eSignFormEntry__c > eSignFormEntryList = [select id, Name, entryType__c, eSignForm__c, eSignForm__r.OCM_man_province_cus__c, salesManageConfirmDate__c, salesHPManageConfirmDate__c, agencyScanDayBack__c, agencySignUpDateBack__c, agencyConfirmDateBack__c, HPScanDayBack__c, HPSignUpDateBack__c, HPConfirmDateBack__c,
- eSignForm__r.Name, IsSubmit__c, IsHPSubmit__c, IsAgencyConfirmSubmit__c, agencyAutoSignUpStatus__c, HPSignUpStatus__c, Sales_Root_Formula__c, Sales_assistant_ID__c, IsHandled__c, IsHPHandled__c, createdDate, AgencyWorkflowEmailBack__c, HPWorkflowEmailBack__c, AgencyWorkflowEmail__c, HPWorkflowEmail__c, eSignForm__r.Id, agencyDNSignUpStatus__c, HPDNSignUpStatus__c, agencyReject__c, HPReject__c, IsAgencyScan__c, IsHPScan__c
- from eSignFormEntry__c
- where eSignForm__c IN: esFormidList
- order by eSignForm__c, createdDate asc
- ];
+ List<eSignFormEntry__c> eSignFormEntryList = [
+ SELECT
+ id,
+ Name,
+ entryType__c,
+ eSignForm__c,
+ eSignForm__r.OCM_man_province_cus__c,
+ salesManageConfirmDate__c,
+ salesHPManageConfirmDate__c,
+ agencyScanDayBack__c,
+ agencySignUpDateBack__c,
+ agencyConfirmDateBack__c,
+ HPScanDayBack__c,
+ HPSignUpDateBack__c,
+ HPConfirmDateBack__c,
+ eSignForm__r.Name,
+ IsSubmit__c,
+ IsHPSubmit__c,
+ IsAgencyConfirmSubmit__c,
+ agencyAutoSignUpStatus__c,
+ HPSignUpStatus__c,
+ Sales_Root_Formula__c,
+ Sales_assistant_ID__c,
+ IsHandled__c,
+ IsHPHandled__c,
+ createdDate,
+ AgencyWorkflowEmailBack__c,
+ HPWorkflowEmailBack__c,
+ AgencyWorkflowEmail__c,
+ HPWorkflowEmail__c,
+ eSignForm__r.Id,
+ agencyDNSignUpStatus__c,
+ HPDNSignUpStatus__c,
+ agencyReject__c,
+ HPReject__c,
+ IsAgencyScan__c,
+ IsHPScan__c
+ FROM eSignFormEntry__c
+ WHERE eSignForm__c IN :esFormidList
+ ORDER BY eSignForm__c, createdDate ASC
+ ];
if (eSignFormEntryList.size() > 0) {
for (Id eid : esFormidList) {
@@ -408,13 +438,12 @@
//鏈鐞嗙殑
unprocessedESignEneryMap.put(eid, eSignFormEntryWhole);
}
- if (eSignFormEntryWhole.eSignForm__r.Id == eid) {
+ if (eSignFormEntryWhole.eSignForm__r.Id == eid) {
//瀛樻斁 绛炬敹鍗昳d锛屽綍鍏ヨ〃id 鏂囦欢鐢�
eSignFlieIdMap.put(eSignFormEntryWhole.Id, eid);
//瀛樻斁绛炬敹鍗曞綍鍏ヨ〃锛宨d锛宯ame 鏂囦欢鐢�
eSignNameMap.put(eid, eSignFormEntryWhole.eSignForm__r.Name);
}
-
//瀛樻斁褰曞叆琛╥d锛岃褰曠被鍨� id锛宼ype 鏂囦欢鐢�
eSignTypeMap.put(eSignFormEntryWhole.Id, eSignFormEntryWhole.entryType__c);
@@ -426,10 +455,8 @@
for (Id esFormid : esFormidList) {
//鍐呭眰鏄鏀跺崟褰曞叆琛�
for (eSignFormEntry__c eSignFormEntry : eSignFormEntryList) {
-
//鈶犲彇鏈�鏂扮殑 褰曞叆琛� + 鏈鐞嗙殑
if (esFormid.equals(eSignFormEntry.eSignForm__c)) {
-
if (!eSignFormEntry.IsHandled__c) {
//瀛樻斁 绛炬敹鍗昳d锛屽綍鍏ヨ〃id
eSignIdMap.put(esFormid, eSignFormEntry.Id);
@@ -438,9 +465,7 @@
// break;
}
eSignFormLastIdMap.put(esFormid, eSignFormEntry.Id);
-
}
-
}
}
//鏈�鍚庢洿鏂扮殑褰曞叆琛╥d
@@ -455,13 +480,15 @@
//閲嶆柊瀵归檮浠舵帓搴� 瑙勫垯鍙樹负鏍规嵁绛炬敹鍗曠幇鏈夐檮浠跺簭鍙疯繘琛屾帓搴� 绮剧悽鎶�鏈� wql start
//鏆傛椂瀛樻斁涓�涓嬬鏀跺崟鍚嶇О
Map<string, string> tempMap = new Map<string, string>();
- List<Attachment> tempAttList = [SELECT parentId, createdDate, Name,Description
- FROM Attachment
- WHERE parentId IN: esFormidList order by createdDate];
+ List<Attachment> tempAttList = [
+ SELECT parentId, createdDate, Name, Description
+ FROM Attachment
+ WHERE parentId IN :esFormidList
+ ORDER BY createdDate
+ ];
if (tempAttList.size() > 0) {
//澶栧眰寰幆绛炬敹鍗�
for (String es : esFormidList) {
-
//鍐呭眰寰幆闄勪欢
for (Attachment att : tempAttList) {
//濡傛灉id鐩哥瓑
@@ -473,7 +500,6 @@
} else if (name.substring(0, 1).equals('H')) {
esignAttachHPList.add(att);
}
-
}
}
//鍒嗗埆瀛樺叆鍒扮粡閿�鍟唎r鍖婚櫌鐨勯檮浠秏ap 鐢ㄤ簬鍚庢湡鍛藉悕
@@ -486,7 +512,6 @@
//娓呯┖list 渚涗笅涓�涓鏀跺崟浣跨敤
esignAttachAgencyList.clear();
esignAttachHPList.clear();
-
}
}
system.debug('fileAgencyMap:' + fileAgencyMap);
@@ -494,10 +519,21 @@
//閲嶆柊瀵归檮浠舵帓搴� 瑙勫垯鍙樹负鏍规嵁绛炬敹鍗曠幇鏈夐檮浠跺簭鍙疯繘琛屾帓搴� 绮剧悽鎶�鏈� wql end
//鏍规嵁鎵�鏈夌殑绛炬敹鍗曞綍鍏ヨ〃id妫�绱㈡墍鏈夌殑绛炬敹鍗曟槑缁嗗綍鍏�
- List < eSignFormLineItemEntry__c > eSignFormLineItemEntryLists = [select id, eSignFormEntry__r.entryType__c, eSignFormEntry__r.IsHandled__c, eSignFormLineItem__c, eSignFormEntry__c,
- agencyConfirmResult__c, HPConfirmResult__c, HPGoodStatus__c, agencyGoodStatus__c
- from eSignFormLineItemEntry__c where eSignFormEntry__c in : luruIsSubmitList and eSignFormEntry__r.IsHandled__c = false order by createdDate asc
- ];
+ List<eSignFormLineItemEntry__c> eSignFormLineItemEntryLists = [
+ SELECT
+ id,
+ eSignFormEntry__r.entryType__c,
+ eSignFormEntry__r.IsHandled__c,
+ eSignFormLineItem__c,
+ eSignFormEntry__c,
+ agencyConfirmResult__c,
+ HPConfirmResult__c,
+ HPGoodStatus__c,
+ agencyGoodStatus__c
+ FROM eSignFormLineItemEntry__c
+ WHERE eSignFormEntry__c IN :luruIsSubmitList AND eSignFormEntry__r.IsHandled__c = FALSE
+ ORDER BY createdDate ASC
+ ];
if (eSignFormLineItemEntryLists.size() > 0) {
for (eSignFormLineItemEntry__c eSignFormLineItemEntry : eSignFormLineItemEntryLists) {
eSignFormLineIdList.add(eSignFormLineItemEntry.eSignFormLineItem__c);
@@ -506,7 +542,11 @@
system.debug('eSignFormLineIdList:' + eSignFormLineIdList);
if (eSignFormLineIdList.size() > 0) {
//鏍规嵁绛炬敹鍗曟槑缁嗗綍鍏ヨ〃 鍘绘绱㈢鏀跺崟鏄庣粏
- List < eSignFormLineItem__c > eSignFormLineItemList = [select id, agencyGoodStatus__c, HPGoodStatus__c from eSignFormLineItem__c where id IN: eSignFormLineIdList];
+ List<eSignFormLineItem__c> eSignFormLineItemList = [
+ SELECT id, agencyGoodStatus__c, HPGoodStatus__c
+ FROM eSignFormLineItem__c
+ WHERE id IN :eSignFormLineIdList
+ ];
if (eSignFormLineItemList.size() > 0) {
//澶栧眰绛炬敹鍗曟槑缁�
for (eSignFormLineItem__c eSignFormLineItem : eSignFormLineItemList) {
@@ -526,7 +566,6 @@
if (eSignFormLineIdList.size() > 0) {
//寰幆 鏇存柊绛炬敹鍗�
for (Id esefId : eSignFormLineIdList) {
-
if (lasteSignFormLineItemEntryMap.containsKey(esefId)) {
eSignFormLineItemEntry__c luru = lasteSignFormLineItemEntryMap.get(esefId);
//new 涓�涓鏀跺崟鏄庣粏瀵硅薄
@@ -547,8 +586,6 @@
eSignFormLuRuList.add(eSignLuRu);
}
}
-
-
}
}
System.debug('鏇存柊鐨勭鏀跺崟鏄庣粏list:' + eSignFormLuRUList);
@@ -581,17 +618,15 @@
if (eSignFormEntry.agencyScanDayBack__c != null && eSignFormEntry.IsAgencyScan__c) {
eSignForm.agencyAutoSignUpStatus__c = '鑽夋涓�';
eSignForm.agencyReject__c = false;
-
}
}
}
//鏈洿鏂板墠鐨勭粡閿�鍟嗗鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
- if(eSignFormEntry.agencyAutoSignUpStatus__c!=null &&eSignFormEntry.agencyAutoSignUpStatus__c!=''){
+ if (eSignFormEntry.agencyAutoSignUpStatus__c != null && eSignFormEntry.agencyAutoSignUpStatus__c != '') {
oldESignAgencyStatusMap.put('A' + eSignForm.id, eSignFormEntry.agencyAutoSignUpStatus__c);
- }else{
+ } else {
oldESignAgencyStatusMap.put('A' + eSignForm.id, '鏃�');
}
-
}
if (eSignFormEntry.HPDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
//濡傛灉鍖婚櫌纭鏃ヤ负绌虹殑璇� 杩涘幓鍒ゆ柇鏇存柊鍖婚櫌瀹℃壒鐘舵��
@@ -603,17 +638,15 @@
if (eSignFormEntry.HPScanDayBack__c != null && eSignFormEntry.IsHPScan__c) {
eSignForm.HPSignUpStatus__c = '鑽夋涓�';
eSignForm.HPReject__c = false;
-
}
}
}
//鏈洿鏂板墠鐨勫尰闄㈠鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
- if(eSignFormEntry.HPSignUpStatus__c!=null &&eSignFormEntry.HPSignUpStatus__c!=''){
+ if (eSignFormEntry.HPSignUpStatus__c != null && eSignFormEntry.HPSignUpStatus__c != '') {
oldESignHPStatusMap.put('H' + eSignForm.id, eSignFormEntry.HPSignUpStatus__c);
- }else{
+ } else {
oldESignHPStatusMap.put('H' + eSignForm.id, '鏃�');
}
-
}
//濡傛灉娌″彉鍖栧垯涓嶆洿鏂�
@@ -672,43 +705,34 @@
Sales_Root_Formula = eSignFormEntry.Sales_Root_Formula__c;
//褰曞叆绫诲瀷
type = eSignFormEntry.entryType__c;
-
}
system.debug('绛炬敹鍗曞璞�-----锛�' + eSignForm);
if (eSignForm != null) {
system.debug('eSignFormid:' + eSignFormid);
if (eSignForm.id != null) {
-
eSignFormList.add(eSignForm);
}
-
}
system.debug('eSignFormList111:' + eSignFormList);
if (eSignFormList.size() > 0) {
//鏇存柊OCSM绠$悊鐪� 鎷呭綋
eSignFormList = updateOwner(provinceList, provinceMap, eSignFormList, false);
}
-
-
}
}
-
-
}
if (eSignFormList.size() <= 0) {
system.debug('鎴戣蛋鍒拌繖閲屼簡锛�');
- eSignFormList = updateOwner(provinceList, provinceMap, eSignList, true);
+ eSignFormList = updateOwner(provinceList, provinceMap, eSignList, true);
}
-
- List<Id> fileList = new List<Id> ();
+ List<Id> fileList = new List<Id>();
if (fileIdList.size() > 0) {
for (Id fileId : fileIdList) {
if (!fileList.contains(fileId)) {
fileList.add(fileId);
}
-
}
}
@@ -717,23 +741,27 @@
//鐢ㄤ簬鏈�鍚巌nsert 闄勪欢
List<Attachment> insertAttactment = new List<Attachment>();
//闄勪欢 start
- List<Attachment> attachMentList = [SELECT id, parentId, Body, Name, ContentType,Description from Attachment where parentId IN :fileList and Description!='鐢靛瓙绛炬敹鍗曪細宸插鐞�'];
- //淇宸插鐞嗘暟鎹� 闄勪欢娌℃洿鏂� 鍗虫病鏈夐檮浠惰兘鎻愪氦鐨刡ug 绮剧悽鎶�鏈� wql 2021/01/19 start
+ List<Attachment> attachMentList = [
+ SELECT id, parentId, Body, Name, ContentType, Description
+ FROM Attachment
+ WHERE parentId IN :fileList AND Description != '鐢靛瓙绛炬敹鍗曪細宸插鐞�'
+ ];
+ //淇宸插鐞嗘暟鎹� 闄勪欢娌℃洿鏂� 鍗虫病鏈夐檮浠惰兘鎻愪氦鐨刡ug 绮剧悽鎶�鏈� wql 2021/01/19 start
List<Attachment> eSignEntryAttachMentList = new List<Attachment>();
//鏂囦欢鏁伴噺 鐢ㄤ簬鏂囦欢鍛藉悕
Integer agencyCount = 0;
Integer hpCount = 0;
String name;
- String type ;
+ String type;
Integer agencyFileCountNum = 0;
Integer hpFileCountNum = 0;
Integer i = 0;
Integer j = 0;
//璁板綍璇ョ鏀跺崟鐨勬渶鏂扮粡閿�鍟嗛檮浠舵暟閲�
- Map<id,Integer> eSignAgencyAttSum = new Map<id,Integer> ();
+ Map<id, Integer> eSignAgencyAttSum = new Map<id, Integer>();
//璁板綍璇ョ鏀跺崟鐨勬渶鏂板尰闄㈤檮浠舵暟閲�
- Map<id,Integer> eSignHpAttSum = new Map<id,Integer> ();
+ Map<id, Integer> eSignHpAttSum = new Map<id, Integer>();
//鍚屼竴鏉″綍鍏ヨ〃澶氫釜闄勪欢鏍囪瘑
Boolean agencyNumFlag = false;
@@ -748,9 +776,7 @@
system.debug('eSignFlieIdMap:' + eSignFlieIdMap);
system.debug('eSignNameMap:' + eSignNameMap);
for (Id eSignFormEntryId : fileList) {
-
for (Attachment attach : attachMentList) {
-
if (attach.parentId == eSignFormEntryId) {
Id eid = eSignFlieIdMap.get(attach.parentId);
system.debug('eid:' + eid);
@@ -761,15 +787,14 @@
//鍥犱负澶栧眰寰幆鏄腑闂磋〃 濡傛灉2鏉′互涓婂綍鍏ヨ〃閮芥湁缁忛攢鍟嗛檮浠� 鍒欎娇鐢ㄦ渶鏂版瀯寤虹殑缁忛攢鍟嗛檮浠舵暟閲忔潵鍛藉悕
//鍚﹀垯鍙栨湭鏇存柊涔嬪墠鏈夌殑缁忛攢鍟嗛檮浠舵暟閲� 骞朵笖 涓嶆槸1涓綍鍏ヨ〃澶氫釜闄勪欢 涔熷氨鏄痜alse鐨勬椂鍊� 鍙栨ā鎷熺殑鏈�鏂版暟閲�
- if(eSignAgencyAttSum.size()>0&&!agencyNumFlag){
+ if (eSignAgencyAttSum.size() > 0 && !agencyNumFlag) {
agencyCount = eSignAgencyAttSum.get(eid);
//璁板綍涓�涓渶鏂扮殑闄勪欢鏁�
- agencySumCount =agencyCount;
- }else if(agencySumCount>0){
+ agencySumCount = agencyCount;
+ } else if (agencySumCount > 0) {
//鏈寰幆鍐� 绗竴娆″彇闄勪欢鏁版渶鏂板�� 鍚庣画閮藉湪姝ゅ熀纭�涓奿++
- agencyCount =agencySumCount;
- }
- else if(fileAgencyMap.size() > 0){
+ agencyCount = agencySumCount;
+ } else if (fileAgencyMap.size() > 0) {
//鍙湁涓�鏉℃暟鎹椂锛屼娇鐢ㄦ闄勪欢鏁板嵆鍙� 鍚庣画鍦ㄦ鍩虹涓奿++
agencyCount = fileAgencyMap.get(eid);
}
@@ -791,20 +816,19 @@
//缁忛攢鍟嗛檮浠跺懡鍚� end
//鍥犱负澶栧眰寰幆鏄腑闂磋〃 濡傛灉2鏉′互涓婂綍鍏ヨ〃閮芥湁鍖婚櫌闄勪欢 鍒欎娇鐢ㄦ渶鏂版瀯寤虹殑鍖婚櫌闄勪欢鏁伴噺鏉ュ懡鍚�
//鍚﹀垯鍙栨湭鏇存柊涔嬪墠鏈夌殑鍖婚櫌闄勪欢鏁伴噺 骞朵笖 涓嶆槸1涓綍鍏ヨ〃澶氫釜闄勪欢 涔熷氨鏄痜alse鐨勬椂鍊� 鍙栨ā鎷熺殑鏈�鏂版暟閲�
- if(eSignHpAttSum.size()>0&&!hpNumFlag){
+ if (eSignHpAttSum.size() > 0 && !hpNumFlag) {
hpCount = eSignHpAttSum.get(eid);
//璁板綍涓�涓渶鏂扮殑闄勪欢鏁�
hpSumCount = hpCount;
- }else if(hpSumCount >0 ){
+ } else if (hpSumCount > 0) {
//鏈寰幆鍐� 绗竴娆″彇闄勪欢鏁版渶鏂板�� 鍚庣画閮藉湪姝ゅ熀纭�涓妀++
- hpCount =hpSumCount;
- }
- else if(fileHPMap.size() > 0){
+ hpCount = hpSumCount;
+ } else if (fileHPMap.size() > 0) {
//鍙湁涓�鏉℃暟鎹椂锛屼娇鐢ㄦ闄勪欢鏁板嵆鍙� 鍚庣画鍦ㄦ鍩虹涓妀++
hpCount = fileHPMap.get(eid);
}
//鍚屼竴涓唴閮ㄥ惊鐜噷缃垚true
- hpNumFlag =true;
+ hpNumFlag = true;
//鍖婚櫌闄勪欢鍛藉悕 start
// if (fileHPMap.size() > 0) {
// hpCount = fileHPMap.get(eid);
@@ -817,12 +841,12 @@
hpFileCountNum = hpCount + 1 + j;
}
//鏋勫缓鏈�鏂扮殑绛炬敹鍗曠粡閿�鍟嗛檮浠舵暟閲�
- if(agencyFileCountNum>0){
- eSignAgencyAttSum.put(eid,agencyFileCountNum);
+ if (agencyFileCountNum > 0) {
+ eSignAgencyAttSum.put(eid, agencyFileCountNum);
}
//鏋勫缓鏈�鏂扮殑绛炬敹鍗曞尰闄㈤檮浠舵暟閲�
- if(hpFileCountNum>0){
- eSignHpAttSum.put(eid,hpFileCountNum);
+ if (hpFileCountNum > 0) {
+ eSignHpAttSum.put(eid, hpFileCountNum);
}
//鍖婚櫌闄勪欢鍛藉悕 end
//鐢ㄤ簬鎷嗗垎缁忛攢鍟�/鍖婚櫌 鍖哄埆鏂囦欢鍚�
@@ -863,24 +887,20 @@
//瑕佹洿鏂扮殑绛炬敹鍗曢檮浠�
insertAttactment.add(newAttachment);
//鍙嶆洿鏂板綍鍏ヨ〃鐨勯檮浠� 鐢ㄦ潵鍒ゆ柇闄勪欢鏄惁琚洿鏂�
- Attachment oldAttachment = new Attachment();
+ Attachment oldAttachment = new Attachment();
oldAttachment.Id = attach.Id;
oldAttachment.Description = '鐢靛瓙绛炬敹鍗曪細宸插鐞�';
eSignEntryAttachMentList.add(oldAttachment);
-
}
-
-
}
//鏁村崟寰幆鍚� 娓呯┖鍊�
i = 0;
j = 0;
- agencyNumFlag= false;
- hpNumFlag =false;
- agencySumCount =0;
- hpSumCount=0;
+ agencyNumFlag = false;
+ hpNumFlag = false;
+ agencySumCount = 0;
+ hpSumCount = 0;
}
-
}
//鐢靛瓙绛炬敹鍗� 澧炲姞鏈鏇存柊闄勪欢鏁伴噺 2020/01/07 绮剧悽鎶�鏈� wql start
@@ -888,7 +908,7 @@
if (insertAttactment.size() > 0) {
insert insertAttactment;
//鍙嶅悜鏇存柊褰曞叆琛ㄩ檮浠�
- if(eSignEntryAttachMentList.size()>0){
+ if (eSignEntryAttachMentList.size() > 0) {
update eSignEntryAttachMentList;
}
@@ -896,7 +916,6 @@
if (eSignFormList.size() > 0) {
//澶栧眰鎵�鏈夌鏀跺崟
for (eSignForm__c es : eSignFormList) {
-
//a涓虹粡閿�鍟嗛檮浠剁殑鏁伴噺 h涓哄尰闄㈤檮浠剁殑鏁伴噺
Integer a = 0;
Integer h = 0;
@@ -906,54 +925,46 @@
if (es.Id != null) {
if (es.Id.equals(att.parentId)) {
if (es.agencyAutoSignUpStatus__c != null) {
- if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size()>0) {
- if(!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')){
- if (att.Name.substring(0, 1).equals('A')) {
- a ++;
- }
+ if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size() > 0) {
+ if (!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')) {
+ if (att.Name.substring(0, 1).equals('A')) {
+ a++;
}
-
+ }
}
}
if (es.HPSignUpStatus__c != null) {
- if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size()>0) {
- if(!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')){
+ if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size() > 0) {
+ if (!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')) {
if (att.Name.substring(0, 1).equals('H')) {
- h ++;
+ h++;
}
}
-
}
}
-
}
}
-
}
//鍙湁鐪熸鎵爜鎻愪氦鐨� 骞朵笖娌℃湁闄勪欢鎵嶄細琚洿鏂�
if (es.agencyAutoSignUpStatus__c != null) {
- if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size()>0) {
- if(!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')){
+ if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size() > 0) {
+ if (!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')) {
es.agencyAttachNum__c = a;
}
-
}
}
//鍙湁鐪熸鎵爜鎻愪氦鐨� 骞朵笖娌℃湁闄勪欢鎵嶄細琚洿鏂�
if (es.HPSignUpStatus__c != null) {
- if (es.HPSignUpStatus__c.equals('鐢宠涓�') &&oldESignHPStatusMap.size()>0 ) {
- if(!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')){
- es.HPAttachNum__c = h;
+ if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size() > 0) {
+ if (!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')) {
+ es.HPAttachNum__c = h;
}
-
-
}
}
a = 0;
h = 0;
-
}
}
//鐢靛瓙绛炬敹鍗� 澧炲姞鏈鏇存柊闄勪欢鏁伴噺 2020/01/07 绮剧悽鎶�鏈� wql end
@@ -986,35 +997,30 @@
}
}
}
-
-
- }catch(NullPointerException npe){
-
- iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:绌烘寚閽堥敊璇�-琛屽彿:'+ npe.getLineNumber()+ '\n';
- }
- catch (Exception e) {
+ } catch (NullPointerException npe) {
+ iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:绌烘寚閽堥敊璇�-琛屽彿:' + npe.getLineNumber() + '\n';
+ } catch (Exception e) {
// Database.rollback(sp);
-
- iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:'+ e.getMessage() + '\n';
+ iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:' + e.getMessage() + '\n';
}
- try{
- System.debug('luruIsLastSubmitList:'+luruIsLastSubmitList);
+ try {
+ System.debug('luruIsLastSubmitList:' + luruIsLastSubmitList);
if (luruIsLastSubmitList.size() > 0) {
//鍒犻櫎涓棿琛ㄦ暟鎹紙鍥犱负浣忎富璇﹀叧绯伙紝鍒犻櫎褰曞叆琛ㄥ嵆鍙級
deleteMiddleData(eSignStringMap, luruIsLastSubmitList);
}
- }catch(Exception e){
- iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:'+ e.getMessage() + '\n';
+ } catch (Exception e) {
+ iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:' + e.getMessage() + '\n';
}
//鏂囦欢 end
}
//鍒犻櫎涓棿琛ㄦ暟鎹紙鍥犱负浣忎富璇﹀叧绯伙紝鍒犻櫎褰曞叆琛ㄥ嵆鍙級
- private static void deleteMiddleData(Map < String, eSignFormEntry__c > eSignStringMap, List < String > luruIsSubmitList) {
+ private static void deleteMiddleData(Map<String, eSignFormEntry__c> eSignStringMap, List<String> luruIsSubmitList) {
system.debug('妫�绱㈢殑鎵�鏈夊綍鍏ヨ〃锛�' + eSignStringMap);
system.debug('鏈�鍚庡綍鍏ョ殑id 锛�' + luruIsSubmitList + '----鏁伴噺锛�' + luruIsSubmitList.size());
- list < eSignFormEntry__c > eSignFormDeleteList = new list < eSignFormEntry__c > ();
+ list<eSignFormEntry__c> eSignFormDeleteList = new List<eSignFormEntry__c>();
for (String essm : eSignStringMap.keySet()) {
for (String lisl : luruIsSubmitList) {
if (essm.equals(lisl)) {
@@ -1027,12 +1033,10 @@
}
system.debug('鍒犻櫎鐨勬暟鎹甶d锛�' + eSignFormDeleteList + '----鏁伴噺锛�' + eSignFormDeleteList.size());
-
-
//鍒犻櫎绛炬敹鍗曞綍鍏ヨ〃鍏朵粬鏁版嵁
if (eSignFormDeleteList.size() > 0) {
//寰幆閬嶅巻id 鍒犻櫎鏂囦欢
- List<String> fileDeleteIdList = new List<String> ();
+ List<String> fileDeleteIdList = new List<String>();
List<Attachment> deleteAttachmentList = new List<Attachment>();
for (eSignFormEntry__c eSigf : eSignFormDeleteList) {
@@ -1040,8 +1044,13 @@
}
//寰幆鎵惧埌鏂囦欢id
if (fileDeleteIdList.size() > 0) {
-
- List<Attachment> attachMentList = [SELECT id, parentId, Body, Name, ContentType,Description from Attachment where parentId = :fileDeleteIdList];
+ // 2022-02-28 shashiming Apex heap size too large
+ // 鍘绘帀Body瀛楁
+ List<Attachment> attachMentList = [
+ SELECT id, parentId, Name, ContentType, Description
+ FROM Attachment
+ WHERE parentId = :fileDeleteIdList
+ ];
if (attachMentList.size() > 0) {
for (Attachment att : attachMentList) {
@@ -1054,8 +1063,6 @@
delete deleteAttachmentList;
}
}
-
-
}
//鍒犻櫎褰曞叆琛�
delete eSignFormDeleteList;
@@ -1063,15 +1070,24 @@
}
@TestVisible
//鏇存柊钀ヤ笟閮ㄦ媴褰�
- private static List < eSignForm__c > updateOwner(List < String > provinceList, Map < Id, String > provinceMap, List < eSignForm__c > eSignFormList, boolean ocsmFlag) {
+ private static List<eSignForm__c> updateOwner(
+ List<String> provinceList,
+ Map<Id, String> provinceMap,
+ List<eSignForm__c> eSignFormList,
+ boolean ocsmFlag
+ ) {
//钀ヤ笟鎷呭綋 map
- Map < String, String > provinceOwnerMap = new Map < String, String > ();
+ Map<String, String> provinceOwnerMap = new Map<String, String>();
//钀ヤ笟鍔╃悊 map
- Map < String, String > provinceGIMap = new Map < String, String > ();
+ Map<String, String> provinceGIMap = new Map<String, String>();
- List < eSignForm__c > eSignFormLastList = new List < eSignForm__c >();
+ List<eSignForm__c> eSignFormLastList = new List<eSignForm__c>();
//妫�绱CSM绠$悊鐪佸璞�
- List < OCM_Management_Province__c > ompList = [select id, Name, SalesManage__c,GI_assistant__c from OCM_Management_Province__c where Name IN: provinceList];
+ List<OCM_Management_Province__c> ompList = [
+ SELECT id, Name, SalesManage__c, GI_assistant__c
+ FROM OCM_Management_Province__c
+ WHERE Name IN :provinceList
+ ];
//瀛樻斁map<鐪侊紝鎷呭綋>
for (OCM_Management_Province__c omp : ompList) {
//涓嶇敤map<String,list>鐨� 鍘熷洜鏄� 鎯� ocsm绠$悊鐪� 鍜岀鏀跺崟 钀ヤ笟鎷呭綋鐨勯『搴忎繚鎸佷竴鑷�
@@ -1124,7 +1140,6 @@
// }
// }
-
// }
// return eSignFormLastList;
@@ -1158,43 +1173,39 @@
if (ocsmFlag) {
//缁欐渶鍚庤鏇存柊鐨勭鏀跺崟鐨勫鎵硅�咃紙钀ヤ笟閮ㄦ媴褰擄級璧嬪��
for (Integer cnt = 0; cnt < eSignFormList.size(); cnt++) {
- if (provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id)) != eSignFormList[cnt].RC_Manager__c ||provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')) {
-
+ if (
+ provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id)) != eSignFormList[cnt].RC_Manager__c ||
+ provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')
+ ) {
eSignForm__c eSignForm = new eSignForm__c();
eSignForm.Id = eSignFormList[cnt].Id;
eSignForm.RC_Manager__c = provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id));
- //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
- if(provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')){
+ //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
+ if (provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')) {
eSignForm.Sales_assistant_name_text__c = provinceGIMap.get(provinceMap.get(eSignFormList[cnt].Id));
}
//闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 end
eSignFormLastList.add(eSignForm);
}
-
}
return eSignFormLastList;
-
} else {
//缁欐渶鍚庤鏇存柊鐨勭鏀跺崟鐨勫鎵硅�咃紙钀ヤ笟閮ㄦ媴褰擄級璧嬪��
for (eSignForm__c esf : eSignFormList) {
if (provinceOwnerMap.get(provinceMap.get(esf.Id)) != null) {
esf.RC_Manager__c = provinceOwnerMap.get(provinceMap.get(esf.Id));
- //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
- if(provinceMap.get(esf.Id).equals('闆嗛噰璇�')){
+ //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
+ if (provinceMap.get(esf.Id).equals('闆嗛噰璇�')) {
esf.Sales_assistant_name_text__c = provinceGIMap.get(provinceMap.get(esf.Id));
}
//闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 end
}
-
}
return eSignFormList;
}
-
}
-
global void finish(Database.BatchableContext BC) {
-
//鏇存柊璇ユ棩蹇楃殑鏁版嵁淇℃伅
iflog.Log__c += '\nupdateESignBatch end';
String tmp = iflog.ErrorLog__c;
@@ -1232,7 +1243,7 @@
//鍐欐绮剧悽鐢ㄦ埛 涓婄嚎鍚庡簲璇ヤ細淇敼鎴愯嚜瀹氫箟鏍囩
// String batchUserId = '00510000005sEEM';
String batchUserId = System.Label.Batch_User_Id;
- List<User> us = [Select Id, NAme, Email From User Where Id = : batchUserId];
+ List<User> us = [SELECT Id, NAme, Email FROM User WHERE Id = :batchUserId];
if (!us.isEmpty()) {
User use = us[0];
if (String.isNotBlank(use.Email)) {
@@ -1240,16 +1251,11 @@
if (System.Label.ESign_Error_Send_To_CC != 'null') {
MailCc = System.Label.ESign_Error_Send_To_CC.split(',');
}
- FixtureUtil.sendMessage(batchUserId,
- MailCc,
- 'updateESignBatch Error',
- body
- );
+ FixtureUtil.sendMessage(batchUserId, MailCc, 'updateESignBatch Error', body);
}
}
}
}
-
}
public class ErrorBean {
// public String objectName;
@@ -1266,7 +1272,7 @@
messageMap = new Map<Id, String>();
overMax = false;
}
- public void setError (Database.SaveResult[] saveRes, Integer maxCut, Schema.sObjectType obj) {
+ public void setError(Database.SaveResult[] saveRes, Integer maxCut, Schema.sObjectType obj) {
if (messageMap.keySet().size() <= maxCut && overMax == false) {
String objectName = obj.getDescribe().getName();
String objectLabel = obj.getDescribe().getLabel();
@@ -1278,12 +1284,16 @@
break;
}
for (Database.Error err : saveRe.getErrors()) {
-
- String message = objectName + ':'
- + objectLabel + ':'
- + err.getStatusCode() + ':'
- + err.getFields() + ':'
- + err.getMessage();
+ String message =
+ objectName +
+ ':' +
+ objectLabel +
+ ':' +
+ err.getStatusCode() +
+ ':' +
+ err.getFields() +
+ ':' +
+ err.getMessage();
// 鏁版嵁閲岄潰鏈夊鏁伴敊璇俊鎭殑璇濆彧鑾峰彇绗竴鏉�
messageMap.put(saveRe.getId(), message);
break;
@@ -1296,8 +1306,8 @@
}
//瀹氭椂璺戜换鍔�
- public Class ScBean {
+ public class ScBean {
public String scName;
public String scTime;
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.1