| | |
| | | } |
| | | if(falg && provinceList != null && cityList != null && provinceList.size() > 0 && cityList.size() > 0){ |
| | | String addressSQl = 'SELECT ID,Customer__c,Customer_Name__c,Contacts__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c' |
| | | + ',Contacts__r.LastName_Encrypted__c,ZipCode_Encrypted__c,Detailed_Address_Encrypted__c,Telephone_Encrypted__c' // PI改造 By Bright 20220407 |
| | | + ' from Address__c ' |
| | | + ' where Address_Classification__c = \'办事处\' and Province_Name__c in :provinceList and City_Name__c in :cityList ' |
| | | + ' order by Using_Datetime__c desc NULLS LAST '; |
| | | |
| | | system.debug('addressSQl='+addressSQl); |
| | | List<Address__c> addressList = Database.query(addressSQl); |
| | | |
| | | if(addressList != null && addressList.size() > 0){ |
| | | system.debug(addressList[0]); |
| | | for (Repair__c nObj : newList) { |
| | | if(nObj.Hospital__c != null && nObj.address_Contacts__c == null && nObj.address_Telephone__c == null && nObj.address_Contacts_Name__c == null && nObj.address_City__c == null && nObj.Detailed_Address__c == null){ |
| | | //由于为了减少select ,所以获取我们配置好的map,根据保有设备上医院的 OCSM管理省(文本) 的值,获取对应的地址上的省和市 |
| | |
| | | if(provinceAndCity.equals(pAc)){ |
| | | //联系人 |
| | | String contactsName = ''; |
| | | String contactsNameEncrypt = '';// 20220407 PI改造 By Bright |
| | | if(!String.isBlank(addressList[0].Contacts__c)){ |
| | | contactsName = addressList[0].Contacts_Name__c; |
| | | contactsNameEncrypt = addressList[0].Contacts__r.LastName_Encrypted__c;// 20220407 PI改造 By Bright |
| | | } |
| | | //省+市 |
| | | String address = addressList[0].Detailed_Address__c.trim(); |
| | | String addressEncrypt = addressList[0].Detailed_Address_Encrypted__c; |
| | | String cityName = addressList[0].City_Name__c.trim(); |
| | | String ProvinceCity = addressList[0].Province_Name__c.trim()+cityName; |
| | | //防止详细地址里面带着省份和市 |
| | |
| | | ContactPerson = addressList[0].Customer_Name__c; |
| | | } |
| | | nObj.address_Contacts__c=contactsName; |
| | | nObj.address_Contacts_Encrypt__c=contactsNameEncrypt;// 20220407 PI改造 By Bright |
| | | nObj.address_ZipCode__c = addressList[0].ZipCode__c; |
| | | nObj.address_ZipCode_Encrypt__c = addressList[0].ZipCode_Encrypted__c;// 20220407 PI改造 By Bright |
| | | nObj.address_City__c = cityName; |
| | | nObj.address_Contacts_Name__c = ContactPerson; |
| | | nObj.address_Telephone__c=addressList[0].Telephone__c; |
| | | nObj.address_Telephone_Encrypt__c=addressList[0].Telephone_Encrypted__c;// 20220407 PI改造 By Bright |
| | | nObj.Detailed_Address__c=address; |
| | | nObj.Detailed_Address_Encrypt__c=addressEncrypt;// 20220407 PI改造 By Bright |
| | | nObj.Encrypt_Update_Flag__c=true;// 20220411 PI改造 By Bright |
| | | system.debug('nObj assign and Encrypt_Update_Flag__c set true'); |
| | | } |
| | | } |
| | | } |