| | |
| | | Report__c report = [select Status__c from Report__c where Id = :recordId]; |
| | | res.status = report.Status__c; |
| | | res.profileId = UserInfo.getProfileId(); |
| | | res.userId = UserInfo.getUserId(); |
| | | res.luShengId = getUserIdByName(LightingButtonConstant.LU_SHENG_NAME); |
| | | res.huDiAnId = getUserIdByName(LightingButtonConstant.HU_DI_AN_NAME); |
| | | res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME); |
| | | System.debug(LoggingLevel.INFO, '*** res: ' + res); |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | |
| | | res.isVOC = report.IsVOC__c; |
| | | res.personId = report.Responsible_Person__r.Id; |
| | | res.profileId = UserInfo.getProfileId(); |
| | | res.userId = UserInfo.getUserId(); |
| | | res.luShengId = getUserIdByName(LightingButtonConstant.LU_SHENG_NAME); |
| | | res.huDiAnId = getUserIdByName(LightingButtonConstant.HU_DI_AN_NAME); |
| | | res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME); |
| | | System.debug(LoggingLevel.INFO, '*** res: ' + res); |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | |
| | | |
| | | //给提交相应的js提供初始化数据 |
| | | @AuraEnabled |
| | | public static void updateForSubmitButton(String reocrdId){ |
| | | public static String updateForSubmitButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = reocrdId; |
| | | rac.Id = recordId; |
| | | rac.Status__c = LightingButtonConstant.RECORD_TYPE_NAME_BY_SUBMIT; |
| | | rac.Submit_time__c = Datetime.now(); |
| | | rac.Submit_report_day__c = Date.today(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //OPDtoSIS操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForOPDtoSISButton(String recordId){ |
| | | public static String updateForOPDtoSISButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | |
| | | //取消提交操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForCancelSubmitReportButton(String recordId){ |
| | | public static String updateForCancelSubmitReportButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | |
| | | rac.Submit_report_day__c = null; |
| | | rac.Submit_time__c = null; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //完毕操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForCompleteButton(String recordId){ |
| | | public static String updateForCompleteButton(String recordId){ |
| | | Report__c rac = new Report__c(); |
| | | try { |
| | | rac.Id = recordId; |
| | | rac.Status__c = LightingButtonConstant.STATUS_COMPLETE; |
| | | rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //OCSM要报告操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForOCSMToReportButton(String recordId){ |
| | | public static String updateForOCSMToReportButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_BE_REPORTED; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | |
| | |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | return e.getMessage(); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //DispatchOCSMQARA操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForDispatchOCSMQARAButton(String recordId){ |
| | | public static String updateForDispatchOCSMQARAButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.Dispatch_OCSM_QARA__c = true; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //OCSM不要报告操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForOCSMNoToReportButton(String recordId){ |
| | | public static String updateForOCSMNoToReportButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_NOT_REPORT; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | |
| | | //取消操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForCancelButton(String recordId){ |
| | | public static String updateForCancelButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | | rac.Status__c = LightingButtonConstant.STATUS_CANCEL; |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | |
| | | //VOC结果确认更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){ |
| | | public static String updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | |
| | | } |
| | | } |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //VOC回答更新相应数据 |
| | |
| | | |
| | | //提交竞争对手报告更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForSubmitCompetitorReportButton(String recordId){ |
| | | public static String updateForSubmitCompetitorReportButton(String recordId){ |
| | | try { |
| | | Report__c rac = new Report__c(); |
| | | rac.Id = recordId; |
| | |
| | | rac.Submit_report_day__c = Date.today(); |
| | | rac.Date__c = Date.today(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | //VOC回答更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForVOCSubmitButton(String recordId ,String createdById){ |
| | | public static String updateForVOCSubmitButton(String recordId ,String createdById){ |
| | | try { |
| | | Report__c rac = [select Status__c,JingliApprovalManager__r.Id,BuchangApprovalManager__r.Id,SalesManager__r.Id,BuchangApprovalManagerSales__r.Id,ZongjianApprovalManager__c,Submit_time__c,Submit_report_day__c,Owner.Id from Report__c where Id = :recordId]; |
| | | // share |
| | |
| | | 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; |
| | | return null; |
| | | } |
| | | rac.Status__c = LightingButtonConstant.STATUS_VOC_WRITE_OVER; |
| | | rac.Submit_time__c = Date.today(); |
| | | rac.Submit_report_day__c = Date.today(); |
| | | update rac; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left, right); |
| | | } |
| | | } |
| | | //VOC判定更新相应数据 |
| | |
| | | } |
| | | //VOC完毕操作更新相应数据 |
| | | @AuraEnabled |
| | | public static void updateForVOCFinishButton (String recordId) { |
| | | public static String updateForVOCFinishButton (String recordId) { |
| | | try { |
| | | Report__c report = [select Id,Status__C from Report__c where Id = :recordId]; |
| | | report.Status__c = LightingButtonConstant.STATUS_VOC_FINISH; |
| | | update report; |
| | | return null; |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(','); |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | | public static string getUserIdByName(String name){ |
| | | User user = null; |
| | | try { |
| | | user = [select Id from User where Name =:name]; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | return user.Id; |
| | | } |
| | | @AuraEnabled |
| | | public static string getProfileIdByName(String name){ |
| | | Profile profile = null; |
| | | try { |
| | | profile = [select Id from Profile where Name =:name]; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | return profile.Id; |
| | | } |
| | | public class InitData{ |
| | | @AuraEnabled |
| | |
| | | public String DeveloperName; |
| | | @AuraEnabled |
| | | public String userId; |
| | | |
| | | @AuraEnabled |
| | | public String luShengId; |
| | | @AuraEnabled |
| | | public String huDiAnId; |
| | | @AuraEnabled |
| | | public String systemProfileId; |
| | | |
| | | |
| | | |