public without sharing class eSignFormAttachmentController {
|
|
//存放所有的附件
|
public List<AccessoryData> acccData { get; set; }
|
//存放所有的附件的状态
|
public eSignForm__c eSignForm { get; set; }
|
//区分医院经销商标识符
|
public String identifier { get; set; }
|
public String identifier2 { get; set; }
|
//附件表的parentId
|
public String parentId;
|
public String baseUrl { get; private set; } // 阿里云迁移 by DTT-亚楠 20240107
|
public eSignFormAttachmentController() {
|
parentId = System.currentPageReference().getParameters().get('parentId');
|
//parentId = 'a421000000367mz';
|
acccData = new List<AccessoryData>();
|
System.debug('tiaoshiListjiheparentId==='+parentId);
|
}
|
public void init() {
|
this.baseUrl = URL.getOrgDomainURL().toExternalForm();
|
getAccessory();
|
String soql = 'SELECT agencyAutoSignUpStatus__c,id,HPSignUpStatus__c,Group_purchase_PCL__c,OCM_man_province_cus__c,agencySignUpDate__c,Sales_Root_Formula__c,HPSignUpDate__c from eSignForm__c where id = :parentId ';
|
List<eSignForm__c> eSignFormData = Database.query(soql);
|
eSignForm = eSignFormData[0];
|
System.debug('eSignForm==='+eSignForm);
|
}
|
|
public void getAccessory(){
|
//zzm 20231026 start
|
// parentId = 'a2K0l000000wyICEAY';
|
|
//lwc改造
|
List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
|
FROM ContentDocumentLink
|
WHERE LinkedEntityId = :parentId];
|
List<ID> fileIDs = new List<ID>();
|
for (ContentDocumentLink docLink : cdlList) {
|
fileIDs.add(docLink.ContentDocumentId);
|
}
|
List<ContentVersion> acc = [SELECT Id,Title,VersionData, ContentDocumentId,FileType
|
FROM ContentVersion WHERE ContentDocumentId IN : fileIDs];
|
|
|
// String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc';
|
// List<Attachment> acc = Database.query(soql);
|
Map<String,String> identifierMap = new Map<String,String>();
|
if(acc != null && acc.size() > 0){
|
for(Integer i = 0;i<acc.size();i++){
|
if(acc[i].Title.substring(0,1)=='A'){
|
acc[i].Description = '经销商';
|
identifierMap.put(acc[i].Description,acc[i].Description);
|
}else if(acc[i].Title.substring(0,1)=='H'){
|
acc[i].Description = '医院';
|
identifierMap.put(acc[i].Description,acc[i].Description);
|
}else{
|
acc[i].Description = '';
|
}
|
//zzm 20231026 end
|
acccData.add(new AccessoryData(acc[i]));
|
}
|
if(identifierMap.containsKey('经销商') && !identifierMap.containsKey('医院')){
|
identifier='经销商';
|
}else if(identifierMap.containsKey('医院') && !identifierMap.containsKey('经销商') ){
|
identifier2='医院';
|
}else if(identifierMap.containsKey('医院') && identifierMap.containsKey('经销商')){
|
identifier='经销商';
|
identifier2='医院';
|
}
|
}
|
System.debug('tiaoshiListjihe==='+acccData);
|
}
|
|
/**
|
* 为了方便前端table获取值
|
*/
|
class AccessoryData {
|
//20231026 zzm start
|
public ContentVersion accessory { get; set; }
|
//20231026 zzm end
|
public Boolean canEdit { get; private set; }
|
public Boolean hasError { get; private set; }
|
public Boolean hasFieldError { get; private set; }
|
public Integer lineNo { get; private set; }
|
public String changeFlg { get; set; }
|
public String reasonFlg { get; set; }
|
//复选框id值
|
public String chk { get;set; }
|
//20231026 zzm start
|
public AccessoryData(ContentVersion record) {
|
//20231026 zzm end
|
accessory = record;
|
canEdit = true;
|
hasError = false;
|
hasFieldError = false;
|
lineNo = 0;
|
changeFlg = '0';
|
reasonFlg = '0';
|
chk = 'chk'+lineNo;
|
}
|
}
|
}
|