From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111
---
force-app/main/default/classes/NewAgencyOpportunityController.cls | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/force-app/main/default/classes/NewAgencyOpportunityController.cls b/force-app/main/default/classes/NewAgencyOpportunityController.cls
index 63c7134..0fd31c6 100644
--- a/force-app/main/default/classes/NewAgencyOpportunityController.cls
+++ b/force-app/main/default/classes/NewAgencyOpportunityController.cls
@@ -1,9 +1,9 @@
-public class NewAgencyOpportunityController {
+public without sharing class NewAgencyOpportunityController {
static string sobjectType = 'Agency_Opportunity__c';
@AuraEnabled
- public static ControllerResponse Init(string rid, string record_type_id){
+ public static ControllerResponse Init(string rid, String pid, string record_type_id){
system.debug('rid='+rid+',length='+(rid==null?'null':rid.length()+''));
system.debug('record_type_id='+record_type_id+',length='+(record_type_id==null?'null':record_type_id.length()+''));
@@ -62,6 +62,10 @@
data.put('data', ao);
}
+ if(!string.isBlank(pid) && !pid.contains('__c')){
+ Id parentId = pid;
+ data.put('pidType', parentId.getSObjectType().getDescribe().getName());
+ }
data.put('fields', SObjectHelper.GetFieldInfos(sobjectType));
data.put('staticResource', Json.serialize(PIHelper.getPIIntegrationInfo('Agency_Contact__c')));
res.IsSuccess = true;
@@ -69,7 +73,7 @@
}
@AuraEnabled
- public static ControllerResponse Save(Map<string,object> data,string transId,Id recordTypeId){
+ public static ControllerResponse Save(Map<string,object> data,string transId,String recordTypeId){
system.debug('data='+data);
system.debug(!data.containsKey('Id') );
system.debug( data.get('Id') == null);
@@ -87,7 +91,7 @@
}
- public static ControllerResponse SaveCore(Sobject sobj, Map<string,object> data,string transId,Id recordTypeId ) {
+ public static ControllerResponse SaveCore(Sobject sobj, Map<string,object> data,string transId,String recordTypeId ) {
Integer index = 0;
string sobjectTypeValue = sobj.getSObjectType().getDescribe().getName();
System.debug('sobjectTypeValue:'+sobjectTypeValue+' Info:' + JSON.serialize(data));
@@ -163,10 +167,12 @@
}
}
@AuraEnabled
- public static ControllerResponse getAWSDataIds(String agencyHospitalId){
+ public static ControllerResponse getAWSDataIds(String agencyHospitalId, String accountId){
+ system.debug('agencyHospitalId = ' + agencyHospitalId + 'accountId = ' + accountId);
ControllerResponse r = new ControllerResponse();
List<String> conAWSIds = new List<String>();
- List<Agency_Contact__c> agencyContact = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c from Agency_Contact__c where Agency_Hospital__c =:agencyHospitalId and AWS_Data_Id__c!='']);
+ List<Agency_Contact__c> agencyContact = [select Id, AWS_Data_Id__c from Agency_Contact__c where (Department_Class__r.ParentId =:accountId or Agency_Hospital__c =:agencyHospitalId) and AWS_Data_Id__c!=''];
+ System.debug('agencyContact = ' + Json.serialize(agencyContact));
for(Agency_Contact__c ac : agencyContact){
conAWSIds.add(ac.AWS_Data_Id__c);
}
@@ -176,19 +182,29 @@
}
@AuraEnabled
- public static ControllerResponse searchAgencyContacts(String awsAgencyContactIds,String accountId){
- system.debug('awsAgencyContactIds = ' + awsAgencyContactIds);
+ public static ControllerResponse searchAgencyContacts(String awsAgencyContactIds,String agencyHospitalId,String accountId){
+ system.debug('awsAgencyContactIds = ' + awsAgencyContactIds + 'agencyHospitalId = ' + agencyHospitalId + 'accountId = ' + accountId);
ControllerResponse resp = new ControllerResponse();
resp.IsSuccess = false;
Map<String,Agency_Contact__c> awsIdToContactMapTemp = new Map<String,Agency_Contact__c>();
if(!checkNullString(awsAgencyContactIds)){
List<String> awsDataIds = (List<String>) JSON.deserialize(awsAgencyContactIds, List<String>.class);
+ System.debug('awsDataIds = ' + awsDataIds.size());
List<Agency_Contact__c> conListTemp = new List<Agency_Contact__c>();
- if(!checkNullString(accountId)){
- Agency_Hospital_Link__c act = [select id from Agency_Hospital_Link__c where id = :accountId];
- conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name,Department_Class__r.Name from Agency_Contact__c where Agency_Hospital__c =: act.Id and AWS_Data_Id__c in:awsDataIds]);
+ String accId = '';
+ String accHospitalId = '';
+ if(!checkNullString(agencyHospitalId) || !checkNullString(accountId)){
+ List<Agency_Hospital_Link__c> actList = [select id from Agency_Hospital_Link__c where id = :agencyHospitalId];
+ List<Account> accList = [select Id, parentId from Account where id = :accountId];
+ if (actList.size() > 0) {
+ accHospitalId = actList[0].Id;
+ }
+ if (accList.size() > 0) {
+ accId = accList[0].Id;
+ }
+ conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name, Department_Class__r.Parent.Name from Agency_Contact__c where (Department_Class__r.ParentId =:accId or Agency_Hospital__c =: accHospitalId) and AWS_Data_Id__c in:awsDataIds]);
}else {
- conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c,Agency_Hospital__r.Name,Department_Class__r.Name from Agency_Contact__c where AWS_Data_Id__c in:awsDataIds]);
+ conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name, Department_Class__r.Name from Agency_Contact__c where AWS_Data_Id__c in:awsDataIds]);
}
for(Agency_Contact__c con:conListTemp){
awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con);
--
Gitblit v1.9.1