19626
2023-10-07 988f9735377909b6310301e582c15804e004783f
force-app/main/default/classes/ReportController.cls
@@ -17,7 +17,7 @@
            res.recordTypeId1 = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SIS_ENG).getRecordTypeId();
            res.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SIS_ET).getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
@@ -36,7 +36,7 @@
            res.opdPlan = rent.OPDPlan__c;
            res.recordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
@@ -257,7 +257,7 @@
        try {
           res =  new InitData();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
@@ -276,7 +276,7 @@
            res.datec = re.Date__c;
            res.practitioner1 = re.Practitioner1__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
@@ -293,18 +293,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //OPDtoSIS操作更新相应数据
@@ -317,18 +318,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
@@ -344,18 +346,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //完毕操作更新相应数据
@@ -369,18 +372,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //OCSM要报告操作更新相应数据
@@ -393,18 +397,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
@@ -418,18 +423,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //DispatchOCSMQARA操作更新相应数据
@@ -442,18 +448,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //OCSM不要报告操作更新相应数据
@@ -466,18 +473,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
@@ -491,18 +499,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    
@@ -536,18 +545,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
@@ -561,18 +571,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
@@ -589,18 +600,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //VOC回答更新相应数据
@@ -649,18 +661,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return errorMessage(e);
        }
    }
    //VOC判定更新相应数据
@@ -723,18 +736,19 @@
            update report;
            return null;
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            return errorMessage(e);
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
        }
    }
    @AuraEnabled
@@ -743,7 +757,7 @@
        try {
            user = [select Id from User where Name =:name]; 
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return user.Id;
    }
@@ -753,10 +767,25 @@
        try {
            profile = [select Id from Profile where Name =:name];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return profile.Id;
    }
    public static string errorMessage(Exception e){
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
        }
    }
    public class InitData{
        @AuraEnabled
        public String status;