| | |
| | | public without sharing class NFM606Controller { |
| | | |
| | | public static String logstr; |
| | | public static String status; |
| | | public static String status; |
| | | //add aws respnse sushanhu 20220228 start |
| | | public static String responseBody; |
| | | //add aws respnse sushanhu 20220228 end |
| | | private static final String LOG_TYPE = 'NFM606'; |
| | | private static final String API = '/admin/api/user/save'; |
| | | public class NFM606 { |
| | |
| | | public String AgentCode; //经销商编码 |
| | | public String AgentUserType; //人员类型 |
| | | public String Email; //电子邮件 |
| | | //add aws pi start sushanhu 20220228 |
| | | public String DataId;//aws 存储凭据 |
| | | //add aws pi end sushanhu 20220228 |
| | | |
| | | } |
| | | |
| | |
| | | Account.ParentId, |
| | | Account.Parent.ParentId, |
| | | UniqueNumber__c, |
| | | AWS_Data_Id__c, |
| | | Name, Email from Contact where id in: conIdList AND RecordTypeId != '01210000000QtkyAAC' |
| | | ]; |
| | | String logstr = iflog.Log__c + ' ' + 'NumberOfRecord=' + conList.size() + '\n'; |
| | |
| | | String flag = ''; |
| | | GeData ged = new GeData(); |
| | | ged.ContactId = String.isBlank(con.UnifiedI_Contact_ID__c) ? '':con.UnifiedI_Contact_ID__c; //智慧医疗ID |
| | | //update to AWS_UnifiedI_Contact_ID__c sushanhu 20220228 start |
| | | //ged.ContactId = String.isBlank(con.) ? '':con.AWS_UnifiedI_Contact_ID__c; //AWS 智慧医疗ID |
| | | ////update to AWS_UnifiedI_Contact_ID__c sushanhu 20220228 end |
| | | ged.ServiceUserId = String.isBlank(con.ServicePlatformCode__c) ? '':con.ServicePlatformCode__c; //服务平台用户ID??? |
| | | ged.Mobile = String.isNotBlank(con.UniqueNumber__c) ? con.UniqueNumber__c:con.MobilePhone;//手机 |
| | | ged.PersonManagementCode = con.CManageCode__c; //人员管理编码 |
| | | ged.Status = '有效'.equals(con.Isactive__c) ? true:false ;//状态 |
| | | ged.Name = '';//姓名 |
| | | ged.Name = con.Name;//姓名 |
| | | ged.Email = ''; |
| | | ged.Hospital =''; //医院编码 |
| | | ged.Department = ''; //科室编码 |
| | |
| | | } |
| | | // 经销商 |
| | | if ('01210000000QfWiAAK'.equals(con.RecordTypeId)) { |
| | | ged.Name = con.Name;//姓名 |
| | | //ged.Name = con.Name;//姓名 |
| | | ged.Account = con.Account.Name;//经销商名 |
| | | ged.AgentCode = con.Account.Management_Code__c;//经销商编码 |
| | | ged.AgentUserType = String.isBlank(con.ContactType__c) ? '': con.ContactType__c.replaceAll(';',',');//人员类型 |
| | | ged.AgentFlag = true;//经销商 |
| | | ged.Email = con.Email; |
| | | } |
| | | ged.DataId =con.AWS_Data_Id__c;//add aws 存储凭据 |
| | | ged = getStateAndCity(ged,con); |
| | | gds.GeData.add(ged); |
| | | |
| | |
| | | me.NumberOfRecord = '' + gds.GeData.size(); |
| | | gds.Monitoring = me; |
| | | |
| | | |
| | | |
| | | logstr = iflog.Log__c + '\nNumberOfRecord=' + gds.GeData.size() + ' '; |
| | | NFMUtil.Monitoring Monitoring = new NFMUtil.Monitoring(); |
| | | Monitoring.Tag = gds.Monitoring.Tag; |
| | |
| | | if (rowData != null) { |
| | | upsert rowData; |
| | | } |
| | | iflog.Log__c = iflog.Log__c + logstr; |
| | | iflog.Log__c = logstr; |
| | | system.debug('======================================'+logstr); |
| | | upsert iflog; |
| | | |
| | | } |
| | | |
| | | private static GeData getStateAndCity(GeData ged,Contact con){ |
| | |
| | | try { |
| | | |
| | | |
| | | // 发往PO |
| | | status = NFMUtil.sendToSapRet(rowDataStr, NFMUtil.NFM606_ENDPOINT); |
| | | System.debug('NFM606Log--status->'+ status); |
| | | // status = '' |
| | | if ('Accepted'.equals(status)) { |
| | | // // 发往PO |
| | | // status = NFMUtil.sendToSapRet(rowDataStr, NFMUtil.NFM606_ENDPOINT); |
| | | // System.debug('NFM606Log--status->'+ status); |
| | | // // status = '' |
| | | // if ('Accepted'.equals(status)) { |
| | | // logstr += status+'\n'; |
| | | // rowDataSFDC.retry_cnt__c = 0; |
| | | // } |
| | | // else { |
| | | // rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, null, status); |
| | | // } |
| | | //update to aws 20220228 sushanhu satrt |
| | | PIHelper.PIIntegration pi =PIHelper.getPIIntegrationInfo('NFM606'); |
| | | NFMUtil.response result =NFMUtil.sendToPiAWS(rowDataStr,pi.newUrl,pi.token); |
| | | system.debug('aws result---'+result); |
| | | responseBody=result.responseBody; |
| | | //Map<String, Object> res = (Map<String, Object>)JSON.deserializeUntyped(responseBody); |
| | | //status=(String)res.get(status); |
| | | status =result.status; |
| | | system.debug('stadtucode--'+result.status); |
| | | if ('202'.equals(status)) { |
| | | logstr += status+'\n'; |
| | | rowDataSFDC.retry_cnt__c = 0; |
| | | } |
| | | rowDataSFDC.retry_cnt__c = 0; |
| | | } |
| | | else { |
| | | logstr+=responseBody+'\n'; |
| | | rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, null, status); |
| | | } |
| | | //update to aws 20220228 sushanhu end |
| | | } catch (Exception ex) { |
| | | // TODO IOException |
| | | // 异常重发 |