From ead4df22dca33a867279471821ca675f91dec760 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期六, 14 五月 2022 18:44:54 +0800
Subject: [PATCH] FixIssue0514
---
force-app/main/default/classes/SWOController.cls | 71 +++++++++++++++++++++++++----------
1 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/force-app/main/default/classes/SWOController.cls b/force-app/main/default/classes/SWOController.cls
index 8d92469..f45894b 100644
--- a/force-app/main/default/classes/SWOController.cls
+++ b/force-app/main/default/classes/SWOController.cls
@@ -6,6 +6,9 @@
public String accId {get; set;}
public String conId {get; set;}
public List<EmailInfo> mailList {get; set;}
+ public String mailListStr {get{return JSON.serialize(mailList);} set;}// 20220512 PI鏀归�� by zhj
+ public List<String> awsDataIdList{get; set;}// 20220512 PI鏀归�� by zhj
+ public String awsDataIdStr{get{return JSON.serialize(awsDataIdList);} set;}// 20220512 PI鏀归�� by zhj
public String baseUrl {get; set;}
public String type {get; set;}
@@ -17,7 +20,7 @@
public List<RepairPart__c> rpList {get; set;}
- public List<Attachment> attachmentList {get; set;}
+ public List<FileAddress__c> attachmentList {get; set;}
public List<diagnosisInfo> diagnosisList {get; set;}
@@ -34,8 +37,13 @@
private String SwoStatus;
public String staticResource { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
public String contactstaticResource { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
+ public String staticResourceMailMerge { get; private set; }// 20220512 PI鏀归�� by zhj
public String contactAWSDataId { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
+ public String contactName { get; private set; }// 20220522 PI鏀归�� by zhj
+ public String swoawsDataId{set;get;}// 20220313 PI鏀归�� by Chen Yanan
public Boolean isNew { get; set; }// 20220313 PI鏀归�� by Chen Yanan
+ public String frontCaseId { get; set; }// 20220522 PI鏀归�� by zhj
+ public String frontSwoId { get; set; }// 20220524 PI鏀归�� by zhj
//ASSIGNEDTO__c
public SWOController() {
@@ -50,6 +58,7 @@
type = System.currentPageReference().getParameters().get('type');
staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('SWO__c'));// 20220313 PI鏀归�� by Chen Yanan
contactstaticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// 20220313 PI鏀归�� by Chen Yanan
+ staticResourceMailMerge = JSON.serialize(PIHelper.getPIIntegrationInfo('Mail_Merge__c'));// 20220512 PI鏀归�� by zhj
}
public void init() {
@@ -76,7 +85,6 @@
// ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c from User_FaultInfo__c where id = : caseId];
ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c, CONTACT__r.AWS_Data_Id__c, CONTACT__r.Name, CONTACT__r.Email from User_FaultInfo__c where id = : caseId];// 20220313 PI鏀归�� by Chen Yanan
temp = [select id from SWO__c where CASE_NUMBER__c = :caseId];
- contactAWSDataId = String.isNotBlank(ca.CONTACT__r.AWS_Data_Id__c)?ca.CONTACT__r.AWS_Data_Id__c:'';
}
System.debug('ca' + ca.NUMBER__c);
System.debug('temp' + temp.size());
@@ -101,31 +109,31 @@
System.debug('swoList: ' + swoList);// 20220313 PI鏀归�� by Chen Yanan
if (swoList.size() > 0) {
swo = swoList[0];
- contactAWSDataId = String.isNotBlank(swo.CONTACT__r.AWS_Data_Id__c)?swo.CONTACT__r.AWS_Data_Id__c:'';
+ swoawsDataId = swo.AWS_Data_Id__c;// 20220313 PI鏀归�� by Chen Yanan
}
//鍒濆鍖栬褰昐WO 鍘熷ASSIGNED TO锛屼繚瀛樻椂鍒ゆ柇鐢ㄦ埛鏄惁鍙樻洿锛屽鏋滃彉鏇寸粰鐢ㄦ埛鍙戦�侀偖浠�
assignedUser = swo.ASSIGNEDTO__c;
//鍒濆鍖朚ail Merge
List<String> mailIdList = new List<String>();
- List<Attachment> attList = new List<Attachment>();
- Map<String, List<Attachment>> attMap = new Map<String, List<Attachment>>();
+ List<FileAddress__c> attList = new List<FileAddress__c>();
+ Map<String, List<FileAddress__c>> attMap = new Map<String, List<FileAddress__c>>();
- Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c from Mail_Merge__c where SWO__c = :swoid order by id]);
+ Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c ,AWS_Data_Id__c from Mail_Merge__c where SWO__c = :swoid order by id]);
//mailMap = [select id,FROM__c,ccName__c,SUBJECT__c,MESSAGE__c from Mail_Merge__c where SWO__c = :id order by id];
if (mailMap != null) {
mailIdList.addAll(mailMap.keySet());
- attList = [select id, Name, ParentId from Attachment where ParentId in :mailIdList order by ParentId, id];
+ attList = [select id, Name, ParentRecordId__c,FileName__c from FileAddress__c where ParentRecordId__c in :mailIdList order by ParentRecordId__c, id];
if (attList.size() > 0) {
- for (Attachment att : attList) {
- if (attMap.containsKey(att.ParentId)) {
- attMap.get(att.ParentId).add(att);
+ for (FileAddress__c att : attList) {
+ if (attMap.containsKey(att.ParentRecordId__c)) {
+ attMap.get(att.ParentRecordId__c).add(att);
} else {
- List<Attachment> a = new List<Attachment>();
+ List<FileAddress__c> a = new List<FileAddress__c>();
a.add(att);
- attMap.put(att.ParentId, a);
+ attMap.put(att.ParentRecordId__c, a);
}
}
}
@@ -151,7 +159,7 @@
rpList = [select Id, Name, Product__c, DescriptionNew__c, PART_NUMBERNew__c, INST_SERIAL__c, QUANTITY__c, DEFECT_PART_NUMBER__c, DEFECT_SERIAL_NUMBER__c, ANI_DEFECT_CATEGORY__c, HOURS__c, LOCATION__c, BILL_AT_0_VALUE__c, ECN__c, QTY_PICKED__c,
Product__r.Description,Product__r.Product_ECCode__c,Product__r.ProductCode from RepairPart__c where SWO_ID__c = :swoid order by Id];
//鍒濆鍖栭檮浠�
- attachmentList = [select Id, Name, CreatedDate, BodyLength from Attachment where ParentId = :swoid];
+ attachmentList = [select Id, Name, CreatedDate,FileName__c from FileAddress__c where ParentRecordId__c = :swoid];
//鍒濆鍖杁iagnosis
List<Diagnosis_Part__c> diList = new List<Diagnosis_Part__c>();
@@ -184,7 +192,20 @@
swo.SWO_STATUS__c = 'Not Started';
System.debug('SWO: ' + swo);
}
+ // update PIPL 20220426 By Chen Yanan Start
+ System.debug('contactAWSDataId: ' + swo.CONTACT__c);
+ if(swo.CONTACT__c != null || ca.CONTACT__c != null){
+ contactAWSDataId = String.isNotBlank(swo.CONTACT__r.AWS_Data_Id__c)?swo.CONTACT__r.AWS_Data_Id__c:(String.isNotBlank(ca.CONTACT__r.AWS_Data_Id__c)?ca.CONTACT__r.AWS_Data_Id__c:'');// 20220313 PI鏀归�� by Chen Yanan
+ contactName = String.isNotBlank(swo.CONTACT__r.Name)?swo.CONTACT__r.Name:(String.isNotBlank(ca.CONTACT__r.Name)?ca.CONTACT__r.Name:'');// 20220313 PI鏀归�� by Chen Yanan
+ }
+ // update PIPL 20220426 By Chen Yanan End
SwoStatus = swo.SWO_STATUS__c;
+
+ //awsDataIdList
+ awsDataIdList = new List<String>();
+ for (Integer i = 0; i < mailList.size(); i++) {
+ awsDataIdList.add(mailList[i].mm.AWS_Data_Id__c);
+ }
}
/**
@@ -194,7 +215,7 @@
public PageReference save() {
System.debug('save');
//errorMessage = '';
-
+ System.debug('mustData() = ' + mustData());
//褰揝WO Status 鏀瑰彉涓篞uotation for approval鏃�,姝ゆ椂闂寸偣鑷姩鎶撳彇濉厖姝ゅ锛�
if(mustData() == false){
return null;
@@ -283,9 +304,14 @@
}
System.debug('swo save:' + swo); // Update By Yanan
if (swoid == null) {
- swo.CASE_NUMBER__c = caseId;
+ System.debug('frontCaseId = ' + frontCaseId);
+ if(frontCaseId != null){
+ swo.CASE_NUMBER__c = frontCaseId;
+ }
insert swo;
+ System.debug('swo.id = ' + swo.id);
swoid = swo.id;
+ frontSwoId = swo.id;
//ASSIGNED TO 瀛楁鍙樻洿锛岀粰鍙樻洿鍚庣殑鐢ㄦ埛鍙戦偖浠�
/*if(swo.ASSIGNEDTO__c!=null && swo.ASSIGNEDTO__c!=assignedUser){
assignedUser = swo.ASSIGNEDTO__c;
@@ -333,9 +359,12 @@
// }
// if(insertList.size() > 0 ) insert insertList;
- PageReference ref = new Pagereference('/apex/SWOPageRead?id=' + swo.Id +'&type='+type);
- ref.setRedirect(true);
- return ref;
+ //zhj 2020-04-24 鍓嶇杩涜璺宠浆闇�瑕佽繘琛岀‘璁や簨鍔� start
+ // PageReference ref = new Pagereference('/apex/SWOPageRead?id=' + swo.Id +'&type='+type);
+ // ref.setRedirect(true);
+ // return ref;
+ return null;
+ //zhj 2020-04-24 鍓嶇杩涜璺宠浆闇�瑕佽繘琛岀‘璁や簨鍔� end
}
/**
*鏁版嵁楠岃瘉
@@ -611,16 +640,16 @@
public class EmailInfo {
public Mail_Merge__c mm {get; set; }
- public List<Attachment> attList {get; set; }
+ public List<FileAddress__c> attList {get; set; }
public String haveAtt {get; set;}
public EmailInfo() {
}
- public EmailInfo(Mail_Merge__c mm_in, List<Attachment> attList_in) {
+ public EmailInfo(Mail_Merge__c mm_in, List<FileAddress__c> attList_in) {
mm = mm_in;
if (attList_in == null || attList_in.size() == 0) {
haveAtt = 'No';
- attList = new List<Attachment>();
+ attList = new List<FileAddress__c>();
} else {
attList = attList_in;
haveAtt = 'Yes';
--
Gitblit v1.9.1