force-app/main/default/classes/ContactTriggerHandler.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM624Rest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM624RestAbout.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM624RestAbout.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM624RestAboutTest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM624RestAboutTest.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
force-app/main/default/classes/ContactTriggerHandler.cls
@@ -315,9 +315,9 @@ } } } if (Trigger.isInsert) { accountIdSet.add(contactnew.AccountId); } // if (Trigger.isInsert) { accountIdSet.add(contactnew.AccountId); // } } //手机号唯一校验-医院下新建客户人员校验使用加密手机号,经销商使用普通手机号 thh 20220328 end // 新增联系人时, @@ -349,32 +349,37 @@ } } for (Contact contactnew: newList) { if (Trigger.isInsert) { String accountId = String.valueOf(contactnew.AccountId).substring(0, 15); for (Contact contactnew: newList) { String accountId = String.valueOf(contactnew.AccountId).substring(0, 15); if (accountContactMap.containsKey(accountId)) { Map<String,Contact> contactFullNameMap = accountContactMap.get(accountId); // 通过姓名+手机号判断人员是否重复 thh 20220518 start // String lastNameStr = String.isNotBlank(contactnew.LastName) ? contactnew.LastName:''; // String firstNameStr = String.isNotBlank(contactnew.FirstName) ? contactnew.FirstName:''; // String contactFullName = lastNameStr + firstNameStr + MobilePhoneStr; String contactFullName = contactnew.LastName_Encrypted__c + contactnew.MobilePhone_Encrypted__c;// 20220314 PI改造 by Bright // 通过姓名+手机号判断人员是否重复 thh 20220518 end if (contactFullNameMap.containsKey(contactFullName)) { String accountName = contactFullNameMap.get(contactFullName).Account.Name; String cManageCode = contactFullNameMap.get(contactFullName).CManageCode__c; // 跳过测试程序 和 SPO通过203接口创建的联系人 if (!(Test.isRunningTest() || contactnew.IsFromSPO__c)) { if (accountContactMap.containsKey(accountId)) { Map<String,Contact> contactFullNameMap = accountContactMap.get(accountId); // 通过姓名+手机号判断人员是否重复 thh 20220518 start // String lastNameStr = String.isNotBlank(contactnew.LastName) ? contactnew.LastName:''; // String firstNameStr = String.isNotBlank(contactnew.FirstName) ? contactnew.FirstName:''; // String contactFullName = lastNameStr + firstNameStr + MobilePhoneStr; String contactFullName = contactnew.LastName_Encrypted__c + contactnew.MobilePhone_Encrypted__c;// 20220314 PI改造 by Bright // 通过姓名+手机号判断人员是否重复 thh 20220518 end if (contactFullNameMap.containsKey(contactFullName)) { String accountName = contactFullNameMap.get(contactFullName).Account.Name; String cManageCode = contactFullNameMap.get(contactFullName).CManageCode__c; // 跳过测试程序 和 SPO通过203接口创建的联系人 if (!(Test.isRunningTest() || contactnew.IsFromSPO__c)) { if(Trigger.isInsert) { contactnew.LastName.addError('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+cManageCode+' ] ,不能重复创建,请了解'); } } } // 客户人员删除手机号时,进行判断是否存在同名且手机号为空的客户人员 thh 20220523 start if(Trigger.isUpdate && !UserInfo.getUserId().equals(System.Label.interfaceUserID)) { if (String.isBlank(contactnew.MobilePhone_Encrypted__c)){ contactnew.LastName.addError('相同名字的联系人 人员管理编码 ['+cManageCode+' ] 手机号为空已经存在,不能重复创建,请了解'); } else{ contactnew.LastName.addError('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+cManageCode+' ] ,不能重复创建,请了解'); } } // 客户人员删除手机号时,进行判断是否存在同名且手机号为空的客户人员 thh 20220523 end } } } } } } public static Map<Id,Id> NFM606_IdMap = new Map<Id,Id>(); force-app/main/default/classes/NFM624Rest.cls
@@ -244,17 +244,28 @@ for (Contact ct: peopleList) { if (string.isnotblank(ct.Account.parent.Name)) { Map < String, Contact > snameMap = new Map < String, Contact > (); string namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim(); string nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim(); string namekey; string nameKey2; if(String.isBlank(ct.MobilePhone_Encrypted__c)){ namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim(); nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim(); } else{ namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim(); nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim(); } // snameMap.put(namekey,ct); if (nameMap.containsKey(ct.Account.parent.Name)) { snameMap = nameMap.get(ct.Account.parent.Name); } snameMap.put(namekey, ct); snameMap.put(nameKey2,ct); // 通过姓名+手机号判断人员是否重复 thh 20220518 start snameMap.put(ct.LastName_Encrypted__c.trim() + ct.MobilePhone_Encrypted__c.trim(), ct); // 通过姓名+手机号判断人员是否重复 thh 20220518 end // // 通过姓名+手机号判断人员是否重复 thh 20220518 start // if(String.isBlank(ct.MobilePhone_Encrypted__c)){ // snameMap.put(ct.LastName_Encrypted__c.trim(), ct); // } else{ // snameMap.put(ct.LastName_Encrypted__c.trim() + ct.MobilePhone_Encrypted__c.trim(), ct); // } // // 通过姓名+手机号判断人员是否重复 thh 20220518 end nameMap.put(ct.Account.parent.Name, snameMap); system.debug('snameMap'+snameMap); } @@ -394,7 +405,8 @@ } else { //人员管理编码不存在 //搜索人名/且在当前战略科室科室下 System.debug('人员管理编码不存在'); string namekey = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted; string namekey = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted; string namekey1 = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted; system.debug('DepartmentClasskey = '+DepartmentClasskey); system.debug('nameMap22222222 '+nameMap); if (nameMap.containskey(DepartmentClasskey)) { // 6 完成 更新操作 @@ -402,13 +414,16 @@ System.debug('sMap'+sMap); System.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey)); System.debug('sMap.containsKey(gedata.NameEncrypted)'+sMap.containsKey(gedata.NameEncrypted)); if (sMap.containsKey(namekey) && sMap.get(namekey).UnifiedI_Contact_ID__c == null) { if (sMap.containsKey(namekey)) { system.debug('Id赋值'+sMap); ct.id = sMap.get(namekey).id; // 通过姓名+手机号判断人员是否重复 thh 20220518 start } else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){ ct.id = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).id; // 通过姓名+手机号判断人员是否重复 thh 20220518 end } else if (sMap.containsKey(namekey1) && sMap.get(namekey1).UnifiedI_Contact_ID__c == null) { ct.id = sMap.get(namekey1).id; // // 通过姓名+手机号判断人员是否重复 thh 20220518 start // } else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){ // ct.id = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).id; // // 通过姓名+手机号判断人员是否重复 thh 20220518 end }else { // 7 完成 system.debug('7逻辑 无人员管理编码 有医院 有科室 人名查找无 动作:新建联系人 '); } @@ -441,7 +456,7 @@ } } else { //人员管理编码不存在 system.debug('人员管理编码不存在'); string namekey = gedata.DepartmentName+ ' ' + gedata.NameEncrypted; string namekey = gedata.DepartmentName + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted; //string namekey = gedata.AccountName + ' ' + gedata.DepartmentName + ' ' + gedata.DepartmentClass + ' ' + gedata.Name; system.debug('DepartmentClasskey'+DepartmentClasskey); system.debug('351nameMap '+nameMap); @@ -450,8 +465,8 @@ system.debug('战略科室存在' + nameMap.get(DepartmentClasskey)); Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); system.debug('namekey'+namekey); system.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey) ); if (sMap.containsKey(namekey) && sMap.get(namekey).UnifiedI_Contact_ID__c == null) { //查找存在 8 完成 system.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey)); if (sMap.containsKey(namekey)) { //查找存在 8 完成 system.debug('8逻辑'); system.debug('该联系人存在'); ct.id = sMap.get(namekey).id; @@ -460,13 +475,14 @@ // if(sMap.containsKey(gedata.Name)){ // ct.Id = sMap.get(gedata.Name).Id; // } // 通过姓名+手机号判断人员是否重复 thh 20220518 start }else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){ system.debug('1234567890'); ct.Id = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).Id; //upsertAccountList.add(dpt); upsertContactList.add(ct); } // 通过姓名+手机号判断人员是否重复 thh 20220518 start // else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){ // system.debug('1234567890'); // ct.Id = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).Id; // //upsertAccountList.add(dpt); // upsertContactList.add(ct); // } // 通过姓名+手机号判断人员是否重复 thh 20220518 end system.debug('contactMap ' + contactMap); System.debug('9逻辑'); force-app/main/default/classes/NFM624RestAbout.cls
New file @@ -0,0 +1,322 @@ /********************************************************************** * * * @url: /services/apexrest/NFM624RestAbout * @data: * { } *************************************************************************/ @RestResource(urlMapping = '/NFM624About/*') global with sharing class NFM624RestAbout { private static final String LOG_TYPE = 'NFM624About'; global class GeDatas { public NFMUtil.Monitoring Monitoring; public GeData[] GeData; } global class GeData{ public String PersonManagementCode; //人员管理编码 public String HospitalManagementCode2; //医院平台编码 平台编码 PlatformCode__c public String DepartmentManagementCode2; //科室平台编码 平台编码 PlatformCode__c //public String Name; //姓名 public String NameEncrypted;//姓名密文 add 20220215 public String RelatedHospital; //关联SFDC医院 客户管理编码(手写) AgentCode_Ext__c public String DepartmentClass; //战略科室 public String DepartmentName; //所属科室 public String RelatedDepartment; //关联SFDC科室 客户管理编码(手写) AgentCode_Ext__c //public Boolean AgentFlag; //经销商标识 public String dataId; public String AccountName; //医院名 public String MobileEncrypted; //电话密文 add 20220519 thh } global class Response { public List<ResponseDetail> ResponseDetails {get;set;} } global class ResponseDetail{ public String dataId; public String awsDataId; //=CONTACT.AWS_Data_Id__c public String sfId; } @HttpPost global static void execute() { // 取得接口传输内容 String strData = RestContext.request.requestBody.toString(); GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class); system.debug('ges---'+JSON.serialize(ges) ); if (ges == null) { return; } NFMUtil.Monitoring Monitoring = ges.Monitoring; if (Monitoring == null) { system.debug('monitoring62'); return; } String result; try { BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, LOG_TYPE, ges.GeData); system.debug('rowData = '+rowData); system.debug('String.isBlank(rowData.Log__c) == false?'); if (String.isBlank(rowData.Log__c) == false) { System.debug('进入if方法,成功调用executefuture'); result = JSON.serialize(main(rowData.Id)); system.debug('result'+result); // result main(rowData.Id); } } catch (Exception ex) { System.debug(Logginglevel.ERROR, LOG_TYPE + ':' + ex.getMessage()); System.debug(Logginglevel.ERROR, LOG_TYPE + ':' + ex.getStackTraceString()); } // BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, LOG_TYPE, ges.GeData); // JSONを戻す RestResponse res = RestContext.response; res.addHeader('Content-Type', 'application/json'); res.statusCode = 200; // NFMUtil.NFMResponse result = NFMUtil.getNFMResponse(); // result.SFStatus=SFStatus; // result.SFMessage=SFMessage; String jsonResponse = result; //for test sushanhu 20220401 start //ResponseDetail red =new ResponseDetail(); // red.dataId =ges.[0].dataId; //red.awsDataId ='959174215334887424'; //red.sfId ='0031m00000N7leyAAB'; // Response resp =new Response(); // List<ResponseDetail> listName = new List<ResponseDetail>(); // listName.add(red); // resp= (Response)listName; //for test sushanhu 20220401 end //String jsonResponse = '{"dataID": ""}'; //system.debug('result---'+jsonResponse); res.responseBody = blob.valueOf(jsonResponse);//need //String resp ='{"ResponseDetails":[{"dataId":"959573117074669568","awsDataId":"959174215334887424","sfId":"0031m00000N7leyAAB"}]}'; //res.responseBody = blob.valueOf(resp); //updata response toAWS 20220225 sushanhu end return; } @future global static void executefuture(String rowData_Id) { system.debug('进入executefuture方法' + rowData_Id); main(rowData_Id); } global static Response main(String rowData_Id) { Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt); BatchIF_Log__c rowData = [Select Id, Name, Log__c,Is_Error__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id]; String logstr = rowData.MessageGroupNumber__c + ' start\n'; BatchIF_Log__c iflog = new BatchIF_Log__c(); iflog.Type__c = LOG_TYPE; iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c; iflog.Log__c = logstr; iflog.ErrorLog__c = ''; insert iflog; String rowDataStr = NFMUtil.getRowDataStr(rowData); List < GeData > GeDataList = (List < GeData > ) JSON.deserialize(rowDataStr, List < GeData > .class); // if (GeDataList == null || GeDataList.size() == 0) { // return null; // } Savepoint sp = Database.setSavepoint(); List < string > PersonManagementCodeList = new List < String > (); //人员管理编码List List < String > SFDCCodeList = new List < String > (); List < String > ManagementList = new List < String > (); //医院、科室平台编码List List < String > NameList = new List < String >(); Response responseList = new Response();//返回体List ResponseDetail red = new ResponseDetail(); responseList.ResponseDetails = new List<ResponseDetail>(); try { //根据传过来的管理编码查询如果可以查询得到结果则更新,查询不到则新增 // for(GeData gedata : GeDataList){ // ResponseDetail temp = new ResponseDetail(); // temp.dataID = gedata.dataID; // temp.awsDataId = null; // temp.sfId = null; // responseList.ResponseDetails.add(temp); // } //根据传过来的管理编码查询如果可以查询得到结果则更新,查询不到则新增 List < Gedata > newGeDataList = new List < Gedata > (); for (Gedata gedata: GeDataList) { system.debug('gedata.NameEncrypted'+gedata.NameEncrypted); red.dataID = gedata.dataID; red.awsDataId = null; red.sfid = null; if(string.isnotblank(gedata.HospitalManagementCode2)){ ManagementList.add(gedata.HospitalManagementCode2); } if(string.isnotblank(gedata.DepartmentManagementCode2)){ ManagementList.add(gedata.DepartmentManagementCode2); } if (string.isnotblank(gedata.RelatedHospital)) { SFDCCodeList.add(gedata.RelatedHospital); } if (string.isnotblank(gedata.RelatedDepartment)) { SFDCCodeList.add(gedata.RelatedDepartment); } if (string.isnotblank(gedata.PersonManagementCode)) { PersonManagementCodeList.add(gedata.PersonManagementCode); } if(String.isnotBlank(gedata.NameEncrypted)){ NameList.add(gedata.NameEncrypted); } newGeDataList.add(gedata); System.debug('ManagementList'+ManagementList); System.debug('SFDCCodeList'+SFDCCodeList); } if (newGeDataList.size() > 0){ system.debug('newGeDataList.size()'+newGeDataList.size()); //查询联系人 Map < String, Map < String, Contact >> nameMap = new Map < String, Map < String, Contact >> (); //外层战略科室,内层科室名+联系人名 List < Contact > peopleList = [select Id, Account.Name, //Department__c, Account.parent.Name, UnifiedI_Contact_ID__c, //Account.PlatformCode__c, Account.Management_Code__c, //Account.parent.Department_Class_Label__c, Name,LastName_Encrypted__c, //Account.Parent_Management_Code__c, //Account.Parent_PlatformCode__c, CManageCode__c,AWS_Data_Id__c, // 通过姓名+手机号判断人员是否重复 thh 20220518 start MobilePhone_Encrypted__c // 通过姓名+手机号判断人员是否重复 thh 20220518 end //AccountId from Contact where CManageCode__c IN: PersonManagementCodeList OR (Account.Parent_PlatformCode__c IN: ManagementList AND LastName_Encrypted__c IN:NameList) OR (Account.Parent_Management_Code__c IN: SFDCCodeList AND LastName_Encrypted__c IN:NameList ) ORDER BY MobilePhone ASC,CManageCode__c ASC]; //根据人员管理编码检索联系人 Map < String, Contact > peopleMap = new Map < String, Contact > (); //联系人 system.debug('peopleList '+peopleList); for (Contact ct: peopleList) { if (string.isnotblank(ct.Account.parent.Name)) { Map < String, Contact > snameMap = new Map < String, Contact > (); string namekey; string nameKey2; if(String.isBlank(ct.MobilePhone_Encrypted__c)){ namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim(); nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim(); } else{ namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim(); nameKey2 = ct.Account.Management_Code__c + ' ' + ct.LastName_Encrypted__c.trim() + ' ' + ct.MobilePhone_Encrypted__c.trim(); } snameMap.put(namekey,ct); if (nameMap.containsKey(ct.Account.parent.Name)) { snameMap = nameMap.get(ct.Account.parent.Name); } snameMap.put(nameKey2,ct); snameMap.put(namekey, ct); // // 通过姓名+手机号判断人员是否重复 thh 20220518 start // System.System.debug('ct.MobilePhone_Encrypted__c1:' + ct.MobilePhone_Encrypted__c); // if(String.isBlank(ct.MobilePhone_Encrypted__c)){ // snameMap.put(ct.LastName_Encrypted__c.trim(), ct); // }else{ // snameMap.put(ct.LastName_Encrypted__c.trim() + ct.MobilePhone_Encrypted__c.trim(), ct); // } // System.System.debug('ct.MobilePhone_Encrypted__c2:' + ct.MobilePhone_Encrypted__c); // // 通过姓名+手机号判断人员是否重复 thh 20220518 end nameMap.put(ct.Account.parent.Name, snameMap); system.debug('snameMap'+snameMap.keyset()); } peopleMap.put(ct.CManageCode__c, ct); System.debug('peopleMap'+peopleMap); } for (Gedata gedata: newGeDataList) { String personCode = gedata.PersonManagementCode; string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass; if(string.isnotblank(personCode)){//判断有人员管理编码 //有人员管理编码 system.debug('有人员管理编码'); if (peopleMap.containsKey(personCode)) { system.debug('有人员管理编码取到值'); peopleMap.get(personCode); //red.dataID = gedata.dataID; red.awsDataId = peopleMap.get(personCode).AWS_Data_Id__c; red.sfid = peopleMap.get(personCode).id; }else{ system.debug('有人员管理编码未取到值'); // red.dataID = gedata.dataID; // red.awsDataId = null; // red.sfid = null; } system.debug('red----------->'+red); responseList.ResponseDetails.add(red); }else{ //无人员管理编码 string namekey = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted + ' ' + gedata.MobileEncrypted; string namekey1 = gedata.RelatedDepartment + ' ' + gedata.NameEncrypted; system.debug('DepartmentClasskey = '+DepartmentClasskey); system.debug('nameMap22222222 '+nameMap); if (nameMap.containskey(DepartmentClasskey)) { system.debug('nameMap.containskey(DepartmentClasskey'+nameMap.containskey(DepartmentClasskey)); Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); System.debug('sMap'+sMap); System.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey)); System.debug('Namekey'+namekey); if (sMap.containsKey(namekey)) { system.debug('根据名字匹配存在'); red.awsDataId = sMap.get(namekey).AWS_Data_Id__c; red.sfid = sMap.get(namekey).id; } else if(sMap.containsKey(namekey1) && sMap.get(namekey1).UnifiedI_Contact_ID__c == null) { red.awsDataId = sMap.get(namekey1).AWS_Data_Id__c; red.sfid = sMap.get(namekey1).id; // // 通过姓名+手机号判断人员是否重复 thh 20220518 start // } else if(sMap.containsKey(gedata.NameEncrypted + gedata.MobileEncrypted) && sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).UnifiedI_Contact_ID__c == null){ // red.awsDataId = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).AWS_Data_Id__c; // red.sfid = sMap.get(gedata.NameEncrypted + gedata.MobileEncrypted).id; // // 通过姓名+手机号判断人员是否重复 thh 20220518 end }else { // 7 完成 system.debug('根据名字匹配不存在'); //red.dataID = gedata.dataID; //red.awsDataId = null; //red.sfid = null; } system.debug('red----------->'+red); responseList.ResponseDetails.add(red); system.debug('responseList.ResponseDetails'+responseList.ResponseDetails); }else{ responseList.ResponseDetails.add(red); } } } } rowData.retry_cnt__c = 0; if (System.Test.isRunningTest()) { throw new ControllerUtil.myException('aaa'); } }catch (Exception ex) { // エラーが発生した場合 logstr += ex.getMessage(); iflog.ErrorLog__c += ex.getMessage() + '\n'; iflog.ErrorLog__c += ex.getStackTraceString() + '\n'; } update rowData; system.debug('Rowdata'+rowData); logstr += responseList +'\n'; logstr += 'end'; iflog.Log__c = logstr; update iflog; system.debug('responseList.ResponseDetails'+responseList.ResponseDetails); return responseList; } } force-app/main/default/classes/NFM624RestAbout.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/NFM624RestAboutTest.cls
New file @@ -0,0 +1,102 @@ @isTest public with sharing class NFM624RestAboutTest { static testMethod void testMethod4(){ oly_TriggerHandler.bypass('ContactTriggerHandler'); //用户 User hpowner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); insert hpowner; User hpowner2 = new User(Test_staff__c = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp1', Work_Location__c = '北京', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner1@sunbridge.com', Username = 'olympus_hpowner1@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2'); insert hpowner2; //医院 Account hp = new Account(RecordTypeId = '01210000000QemG', Name = '北京德胜门中医院', OwnerId = hpOwner.Id); hp.FSE_GI_Main_Leader__c = hpOwner.Id; hp.Advance_Payment_Identification_Approval__c = Date.today().addyears(-1); hp.AgentCode_Ext__c = '112358'; hp.PlatformCode__c = '1375'; hp.Is_Active__c = '有効'; insert hp; Account hptemp = [select Id,PlatformCode__c,AgentCode_Ext__c,Is_Active_Formula__c from Account where Id = :hp.Id]; //战略科室 Account dc = [select Id, Name,Parent_PlatformCode__c,Parent_Management_Code__c, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_BF']; NFM624Rest.GeData GeData1 = new NFM624Rest.GeData(); NFM624Rest.GeDatas GaDatas = new NFM624Rest.GeDatas(); Datetime nowDT = Datetime.now(); String nowStr = nowDT.format('yyyyMMddHHmm'); GaDatas.Monitoring = new NFMUtil.Monitoring(); GaDatas.Monitoring.MessageGroupNumber = nowStr + '01'; //有医院没有科室没有人员管理编码——>新建科室+新建联系人 // GaDatas.GeData = new NFM624Rest.Gedata[] { GeData1 }; // GeData1.ContactId = '958432058911227904'; // GeData1.ServiceUserId = '958432058911227904'; // GeData1.PersonManagementCode = ''; // GeData1.HospitalManagementCode2 = '1375'; // GeData1.DepartmentManagementCode2 = '1376'; // GeData1.Name = '***'; // GeData1.NameEncrypted = '24616254c7c7b65d985567f475b667d7'; // GeData1.Mobile = '***********'; // GeData1.MobileEncrypted = 'c34725fe79b3965ea9abfd7c1435cf9a'; // GeData1.State = '北京市'; // GeData1.City = '西城区'; // GeData1.AccountName = '北京德胜门中医院'; // GeData1.RelatedHospital = '112358'; // GeData1.DepartmentClass = '消化科'; // GeData1.DepartmentName = '北京德胜门中医院 消化科 胃镜室'; // GeData1.RelatedDepartment = '5311053'; // GeData1.Type = '*****'; // GeData1.TypeEncrypted = '53173e61ac22874aab5b8d1f802515db'; // GeData1.ContactAddress = '**********'; // GeData1.ContactAddressEncrypted = '121a09fd9e0e9b090c4aa9c95da52810'; // GeData1.ForbiddenStatus = false; // GeData1.RegSource = '1'; // GeData1.AgentFlag = false; // GeData1.ApproverID = hpowner.Id; // GeData1.DataId = '958432058273693696'; // BatchIF_Log__c rowData = NFMUtil.saveRowData(GaDatas.Monitoring, 'NFM624About', GaDatas.GeData); // if (String.isBlank(rowData.Log__c) == false) // NFM624RestAbout.execute(rowData.Id); //有医院有有科室没有人员管理编码——>更新联系人 NFM624Rest.GeData GeData3 = new NFM624Rest.GeData(); GaDatas.GeData = new NFM624Rest.Gedata[] { GeData3 }; // GeData3.ContactId = '958432058911227904'; //GeData3.ServiceUserId = '958432058911227904'; GeData3.PersonManagementCode = ''; GeData3.HospitalManagementCode2 = '1375'; GeData3.DepartmentManagementCode2 = '1376'; //GeData3.Name = '***'; GeData3.NameEncrypted = '24616254c7c7b65d985567f475b667d7'; //GeData3.Mobile = '***********'; //GeData3.MobileEncrypted = 'c34725fe79b3965ea9abfd7c1435cf9a'; //GeData3.State = '北京市'; //GeData3.City = '西城区'; GeData3.AccountName = '北京德胜门中医院'; GeData3.RelatedHospital = '112358'; GeData3.DepartmentClass = '消化科'; GeData3.DepartmentName = '北京德胜门中医院 消化科 胃镜室'; GeData3.RelatedDepartment = '5311053'; //GeData3.Type = '*****'; //GeData3.TypeEncrypted = '53173e61ac22874aab5b8d1f802515db'; //GeData3.ContactAddress = '**********'; //GeData3.ContactAddressEncrypted = '121a09fd9e0e9b090c4aa9c95da52810'; //GeData3.ForbiddenStatus = false; //GeData3.RegSource = '1'; //GeData3.AgentFlag = false; //GeData3.ApproverID = hpowner.Id; GeData3.DataId = '958432058273693696'; BatchIF_Log__c rowData3 = NFMUtil.saveRowData(GaDatas.Monitoring, 'NFM624About', GaDatas.GeData); if (String.isBlank(rowData3.Log__c) == false){ NFM624RestAbout.executefuture(rowData3.Id); } } } force-app/main/default/classes/NFM624RestAboutTest.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <status>Active</status> </ApexClass>