| | |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | //给VOC结果确认相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static InitData initForVOCConfirmButton (String recordId) { |
| | | InitData res = new initData(); |
| | |
| | | return res; |
| | | } |
| | | |
| | | |
| | | //给完毕相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static InitData initForCompleteButton(String recordId){ |
| | | InitData res = new InitData(); |
| | |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | //给Intake universal code编辑相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static InitData initForASRCEditorButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | String recordTypeId = 'ASRCDecision'; |
| | | String developerName = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION; |
| | | try { |
| | | PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc]; |
| | | PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :developerName Order by LastModifiedDate desc]; |
| | | if (report != null && !report.isEmpty()) { |
| | | res.LastModifiedDate = report[0].LastModifiedDate; |
| | | res.Id = report[0].Id; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //给Final universal code编辑相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static InitData initForASACEditorButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | String recordTypeId = 'ASACDecision'; |
| | | String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION; |
| | | try { |
| | | PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc]; |
| | | if (report != null && !report.isEmpty()) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //给OPDtoSIS相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static InitData initForOPDtoSISButton(String recordId){ |
| | | InitData res = new InitData(); |
| | |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = reocrdId; |
| | | rac.Status__c = '提交'; |
| | | rac.Status__c = LightingButtonConstant.RECORD_TYPE_NAME_BY_SUBMIT; |
| | | rac.Submit_time__c = Datetime.now(); |
| | | rac.Submit_report_day__c = Date.today(); |
| | | update rac; |
| | |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //OPDtoSIS操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForOPDtoSISButton(String recordId,String recordTypeId){ |
| | | public static void updateForOPDtoSISButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.RecordTypeId = recordTypeId; |
| | | rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId(); |
| | | update rac; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.Status__c = '草案中'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_DRAFT; |
| | | rac.Submit_report_day__c = null; |
| | | rac.Submit_time__c = null; |
| | | update rac; |
| | |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //完毕操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForCompleteButton(String recordId,String recordTypeId){ |
| | | public static void updateForCompleteButton(String recordId){ |
| | | Report__c rac = new Report__c(); |
| | | try { |
| | | rac.Id = recordId; |
| | | rac.Status__c = '完毕'; |
| | | rac.RecordTypeId = recordTypeId; |
| | | rac.Status__c = LightingButtonConstant.STATUS_COMPLETE; |
| | | rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId(); |
| | | update rac; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.OCSMAdministrativeReportStatus__c = '待报告'; |
| | | rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_BE_REPORTED; |
| | | update rac; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | |
| | | |
| | | //SIStoOPD操作更新相应数据 |
| | | @AuraEnabled |
| | | public static String updateForSIStoOPDButton(String recordId,String recordTypeId){ |
| | | public static String updateForSIStoOPDButton(String recordId){ |
| | | Report__c rac = new Report__c(); |
| | | try { |
| | | rac.Id = recordId; |
| | | rac.RecordTypeId = recordTypeId; |
| | | rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.OCSMAdministrativeReportStatus__c = '无需报告'; |
| | | rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_NOT_REPORT; |
| | | update rac; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.Status__c = '取消'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_CANCEL; |
| | | update rac; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | } |
| | | } |
| | | |
| | | |
| | | //VOC结果确认更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | if (Satisfy == '是') { |
| | | rac.Status__c = '结果确认完毕'; |
| | | } else if (Satisfy == '否') { |
| | | if (Satisfy == LightingButtonConstant.CN_YES) { |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED; |
| | | } else if (Satisfy == LightingButtonConstant.CN_NO) { |
| | | // 対応結果(一回目)に値なければ、一回目の「否」と見なす |
| | | if (Satisfy1 != '否') { |
| | | if (Satisfy1 != LightingButtonConstant.CN_NO) { |
| | | Report__c[] records = [SELECT Id, VOC_Satisfy__c, VOC_Unsatisfy_Reason__c, VOC_follow_up_result__c, VOC_solution_category__c FROM Report__c WHERE Id = :recordId]; |
| | | rac.VOC_Satisfy__c = null; |
| | | rac.VOC_Unsatisfy_Reason__c = null; |
| | |
| | | rac.VOC_Unsatisfy_Reason1__c = records[0].VOC_Unsatisfy_Reason__c; |
| | | rac.VOC_follow_up_result1__c = records[0].VOC_follow_up_result__c; |
| | | rac.VOC_solution_category1__c = records[0].VOC_solution_category__c; |
| | | rac.Status__c = '草案中'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_DRAFT; |
| | | } |
| | | // 対応結果(一回目)に値あれば、二回目の「否」と見なす |
| | | else { |
| | | rac.Status__c = '结果确认完毕'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED; |
| | | } |
| | | } |
| | | update rac; |
| | |
| | | public static String updateForVOCAnswerButton(String recordId){ |
| | | try { |
| | | Report__c rac = [select Status__c from Report__c where Id = :recordId]; |
| | | rac.Status__c = '回答完毕'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_END_OF_ANSWER; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //提交竞争对手报告更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForSubmitCompetitorReportButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.Status__c = '申請中'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_APPLYING; |
| | | rac.Submit_time__c = Datetime.now(); |
| | | rac.Submit_report_day__c = Date.today(); |
| | | rac.Date__c = Date.today(); |
| | |
| | | rac.Id = recordId; |
| | | User[] records = [SELECT Job_Category__c FROM User WHERE Id = :createdById]; |
| | | List<String> userAccess = new List<String>(); |
| | | if (records[0].Job_Category__c == '销售服务') { |
| | | userAccess.add(rac.JingliApprovalManager__c + '_Read'); |
| | | userAccess.add(rac.BuchangApprovalManager__c + '_Read'); |
| | | if (records[0].Job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) { |
| | | userAccess.add(rac.JingliApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | userAccess.add(rac.BuchangApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | rac.VOC_CreatedBy_jingli__c = rac.JingliApprovalManager__c; |
| | | rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManager__c; |
| | | } else { |
| | | userAccess.add(rac.SalesManager__c + '_Read'); |
| | | userAccess.add(rac.BuchangApprovalManagerSales__c + '_Read'); |
| | | userAccess.add(rac.SalesManager__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | userAccess.add(rac.BuchangApprovalManagerSales__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | rac.VOC_CreatedBy_jingli__c = rac.SalesManager__c; |
| | | rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManagerSales__c; |
| | | } |
| | | userAccess.add(rac.ZongjianApprovalManager__c + '_Read'); |
| | | String rtn = ControllerUtil.setSObjectShare('Report__Share','VOCShare__c',recordId,userAccess,rac.Owner.Id); |
| | | if (rtn != 'OK') { |
| | | userAccess.add(rac.ZongjianApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | String rtn = ControllerUtil.setSObjectShare(LightingButtonConstant.SOBJECT_NAME_OF_REPORT_SHARE,LightingButtonConstant.SOBJECT_NAME_OF_VOC_SHARE,recordId,userAccess,rac.Owner.Id); |
| | | if (rtn != LightingButtonConstant.OK) { |
| | | return; |
| | | } |
| | | rac.Status__c = '填写完毕'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_WRITE_OVER; |
| | | rac.Submit_time__c = Date.today(); |
| | | rac.Submit_report_day__c = Date.today(); |
| | | update rac; |
| | |
| | | |
| | | } |
| | | } |
| | | //VOC判定更新相应数据 |
| | | @AuraEnabled |
| | | public static String updateForVOCCheckButton (String recordId,String isVOC,String personId) { |
| | | try { |
| | | Report__c rac = [select Owner.Id,VOC_jingli__r.Id,VOC_buzhang__r.Id,VOC_zongjian__r.Id,VOC_Finish__c,VOC_share_date__c,Responsible_Person__r.Id from Report__c where Id = :recordId]; |
| | | if (isVOC == 'VOC') { |
| | | if (isVOC == LightingButtonConstant.VOC_NAME) { |
| | | // VOC対応者の経理部長総監を設定 |
| | | User[] records = [SELECT Id, Job_Category__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM User WHERE Id = :personId]; |
| | | if (records[0].job_Category__c == '销售服务') { |
| | | if (records[0].job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) { |
| | | rac.VOC_jingli__c = records[0].JingliApprovalManager__c == null ? '' : records[0].JingliApprovalManager__c; |
| | | rac.VOC_buzhang__c = records[0].BuchangApprovalManager__c == null ? '' : records[0].BuchangApprovalManager__c; |
| | | } else { |
| | |
| | | rac.VOC_buzhang__c = records[0].BuchangApprovalManagerSales__c == null ? '' : records[0].BuchangApprovalManagerSales__c; |
| | | } |
| | | rac.VOC_zongjian__c = records[0].ZongjianApprovalManager__c == null ? '' : records[0].ZongjianApprovalManager__c; |
| | | rac.Status__c = '判定完毕'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_CHECK_OVER; |
| | | rac.VOC_Finish__c = false; |
| | | Date serverTimestamp = Date.today(); |
| | | rac.VOC_share_date__c = serverTimestamp; |
| | | // share |
| | | List<String> userAccess = new List<String>(); |
| | | userAccess.add(rac.Responsible_Person__c + '_Edit'); |
| | | userAccess.add(rac.VOC_jingli__c + '_Read'); |
| | | userAccess.add(rac.VOC_buzhang__c + '_Read'); |
| | | userAccess.add(rac.VOC_zongjian__c + '_Read'); |
| | | String rtn = ControllerUtil.setSObjectShare('Report__Share','VOCShare__c',recordId,userAccess,rac.Owner.Id); |
| | | if (rtn != 'OK') { |
| | | userAccess.add(rac.Responsible_Person__c + LightingButtonConstant.USER_ACCESS_EDIT); |
| | | userAccess.add(rac.VOC_jingli__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | userAccess.add(rac.VOC_buzhang__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | userAccess.add(rac.VOC_zongjian__c + LightingButtonConstant.USER_ACCESS_READ); |
| | | String rtn = ControllerUtil.setSObjectShare(LightingButtonConstant.SOBJECT_NAME_OF_REPORT_SHARE,LightingButtonConstant.SOBJECT_NAME_OF_VOC_SHARE,recordId,userAccess,rac.Owner.Id); |
| | | if (rtn != LightingButtonConstant.OK) { |
| | | return null; |
| | | } |
| | | update rac; |
| | | } else { |
| | | rac.Status__c = '完毕'; |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_FINISH; |
| | | rac.VOC_Finish__c = true; |
| | | update rac; |
| | | } |
| | |
| | | return exc; |
| | | } |
| | | } |
| | | //VOC完毕操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForVOCFinishButton (String recordId) { |
| | | try { |
| | | Report__c report = [select Id,Status__C from Report__c where Id = :recordId]; |
| | | report.Status__c = '完毕'; |
| | | report.Status__c = LightingButtonConstant.STATUS_VOC_FINISH; |
| | | update report; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |