From 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85 Mon Sep 17 00:00:00 2001
From: GWY <guweiyi@prec-tech.com>
Date: 星期一, 30 五月 2022 16:15:26 +0800
Subject: [PATCH] 两个LS特殊条件在说明的增减
---
force-app/main/default/classes/SendEmailController.cls | 52 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 44 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/SendEmailController.cls b/force-app/main/default/classes/SendEmailController.cls
index 7025254..822b3bf 100644
--- a/force-app/main/default/classes/SendEmailController.cls
+++ b/force-app/main/default/classes/SendEmailController.cls
@@ -1,4 +1,4 @@
-public without sharing class SendEmailController {
+public without sharing class SendEmailController{
public Mail_Merge__c mail{get; set;}
@@ -23,6 +23,7 @@
public Attachment attachment{get;set;}
public List<Attachment> attachmentList{get;set;}
+ public List<FileAddress__c> newAttachmentList{get;set;}
//SWO_Email_Member__c 杩欎釜瀵硅薄鍙槸涓轰簡鐢熸垚椤甸潰涓婄殑浜哄憳鏄庣粏琛�
// public List<SWO_Email_Member__c> lineDataList_new{get;set;}
@@ -45,18 +46,28 @@
public List<String> ccAddresses ;
public List<String> bccAddresses ;
+ public String AWSDataId{get;set;}
+ public String staticResourceMail{get;set;}
+ public String staticResourceMailMerge{get;set;}
+ public String staticResourceDocument{get;set;}
public SendEmailController() {
id = System.currentPageReference().getParameters().get('id');
type = System.currentPageReference().getParameters().get('type');
typeid = System.currentPageReference().getParameters().get('typeid');
openType = System.currentPageReference().getParameters().get('openType');
+ staticResourceMail = JSON.serialize(PIHelper.getPIIntegrationInfo('Mail'));
+ staticResourceMailMerge = JSON.serialize(PIHelper.getPIIntegrationInfo('Mail_Merge__c'));
+ staticResourceDocument = JSON.serialize(PIHelper.getPIIntegrationInfo('Document'));
}
- public SendEmailController(ApexPages.StandardController stdController) {
- id = System.currentPageReference().getParameters().get('id');
- type = System.currentPageReference().getParameters().get('type');
- typeid = System.currentPageReference().getParameters().get('typeid');
- openType = System.currentPageReference().getParameters().get('openType');
+ public SendEmailController(ApexPages.StandardController controller) {
+ // 20220318 PI 鏀归�� By Bright start
+ // id = System.currentPageReference().getParameters().get('id');
+ // type = System.currentPageReference().getParameters().get('type');
+ // typeid = System.currentPageReference().getParameters().get('typeid');
+ // openType = System.currentPageReference().getParameters().get('openType');
+ this();
+ // 20220318 PI 鏀归�� By Bright end
}
public void init(){
@@ -75,6 +86,23 @@
mail.RECORD__c = typeid;
mail.RECORD_TYPE__c = type;
memberLineDatas = new List<MemberLine>();
+
+ if (!string.isBlank(typeid)) {
+ Id rid = typeid;
+ String sobjname = 'User_FaultInfo__c';
+ sobjname = rid.getSobjectType().getDescribe().getName();
+ List<sobject> lso = Database.query('select id,name from '+sobjname+' where id = :rid');
+ System.debug('lso='+lso);
+ if (lso.size()>0) {
+ name = sobjname.replace('__c','')+':'+lso[0].get('Name');
+ if (sobjname == 'User_FaultInfo__c') {
+ name = 'Case:'+lso[0].get('Name');
+ }
+ }
+ System.debug('name='+name);
+ }
+
+
if(id == null){
isOnClick = false;
mail.FROM__c = UserInfo.getUserEmail();
@@ -95,7 +123,12 @@
}
}
}else{
- mail = [select id,send__c,MESSAGE__c,SUBJECT__c,TYPE__c,FROM__c,DATE__c,RECIPIENT__c,CC__c,BCC__c,RECORD__c,RECORD_TYPE__c,toName__c,ccName__c,bccName__c,ALL_MEMBER__c,ALL_MEMBER_NAME__c,ALL_MEMBER_TYPE__c,EMAIL_SENT__c,SWO__c,CaseF__c,Quotes__c from Mail_Merge__c where id =:id];
+
+
+ mail = [select id,send__c,MESSAGE__c,SUBJECT__c,TYPE__c,FROM__c,DATE__c,RECIPIENT__c,CC__c,BCC__c,RECORD__c,RECORD_TYPE__c,toName__c,ccName__c,bccName__c,ALL_MEMBER__c,ALL_MEMBER_NAME__c,ALL_MEMBER_TYPE__c,EMAIL_SENT__c,SWO__c,CaseF__c,Quotes__c,
+ AWS_Data_Id__c // 20220222 PI鏀归�� by Brigh
+ from Mail_Merge__c where id =:id];
+ AWSDataId=mail.AWS_Data_Id__c;
//mail.TYPE__c == 'reply' 閭欢涓哄洖澶嶉偖浠� 鎴栬�呮槸绯荤粺鑷姩鍙戦�佺殑閭欢
//EMAIL_SENT__c =='YES' 閭欢宸插彂閫�
if(mail.TYPE__c == 'reply' || mail.EMAIL_SENT__c =='YES'){
@@ -147,7 +180,7 @@
replyEmailHead = '\n\n\n\n';
replyEmailHead += '-------------閭欢鍘熶欢--------------\n';
replyEmailHead += '鍙戜欢浜猴細' + mail.FROM__c + ';\n';
- replyEmailHead += '鍙戜欢鏃堕棿锛�' + mail.DATE__c.addHours(8) + ';\n';
+ replyEmailHead += '鍙戜欢鏃堕棿锛�' + (mail.DATE__c==null?Datetime.now():mail.DATE__c.addHours(8)) + ';\n';
replyEmailHead += '鏀朵欢浜猴細' + mailToAddressName + '\n';
replyEmailHead += '鎶勯�侊細' + mailCcAdressName + '\n';
replyEmailHead += '涓婚锛�' + mail.SUBJECT__c + ';\n\n';
@@ -195,6 +228,7 @@
addLine();
}
attachmentList = [select Id,Name,CreatedDate,BodyLength,Body from Attachment where ParentId=:id];
+ newAttachmentList = [select Id,CreatedDate,Name,ViewLink__c,AWS_File_Key__c,FileName__c from FileAddress__c where ParentRecordId__c=:id];
/*if(String.isNotBlank(openType) && openType == 'Reply'){
attachmentList.clear();
}*/
@@ -372,6 +406,7 @@
}
}
mail.EMAIL_SENT__c = 'YES';
+ System.debug('mail='+mail);
upsert mail;
// 杩斿洖鐐瑰嚮閭欢椤甸潰
PageReference ref = new Pagereference('/'+mail.RECORD__c+'?type=mail');
@@ -388,6 +423,7 @@
}
public void save() {
+ System.debug('handleType='+handleType);
toAddresses = new List<String>();
ccAddresses = new List<String>();
bccAddresses = new List<String>();
--
Gitblit v1.9.1