DLIU-CES8B9 【FY23系统课题10】-紧急-已借用自然日、借出状态(明细)字段逻辑调整
3个文件已修改
100 ■■■■■ 已修改文件
force-app/main/default/classes/EquipmentRentalLostReportController.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LostReportHandler.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LostReportHandlerTest.cls 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRentalLostReportController.cls
@@ -440,6 +440,10 @@
                                                            DeleteLostReport_Detail_Reason__c = needCancelLRMap.get(deleLRId).DeleteLostReport_Detail_Reason__c));
                      Rental_Apply_Equipment_Set_Detail__c raesd = new Rental_Apply_Equipment_Set_Detail__c(Id = deleLRId);
                      raesd.LostReport_Detail__c = null;
                      //add by lc 20220601 start 已借用自然日、借出状态(明细)字段逻辑调整
                      // 删除遗失报告明细时,清除遗失报告批准时间
                      raesd.LostReportApprovalDate__c = null;
                      //add by lc 20220601 end 已借用自然日、借出状态(明细)字段逻辑调整
                      raesdList.add(raesd);
                  }
              }
force-app/main/default/classes/LostReportHandler.cls
@@ -556,6 +556,7 @@
        //根据遗失报告查询遗失报告明细
        if(LostReprotSet.size()>0){
            List<LostReport_Detail__c> LostReprotDetailList = [SELECT Id,Rental_Apply_Equipment_Set_Detail__c FROM LostReport_Detail__c WHERE Rental_Apply_Equipment_Set_Detail__c != null AND LostReport__c in :LostReprotSet];
            Date today = Date.today();
            if(LostReprotDetailList.size()>0){
                //存放借出备品配套一览明细
                List<Rental_Apply_Equipment_Set_Detail__c> needUpdateRentalDetail = new List<Rental_Apply_Equipment_Set_Detail__c>();
@@ -563,6 +564,7 @@
                    Rental_Apply_Equipment_Set_Detail__c tempDetail = new Rental_Apply_Equipment_Set_Detail__c();
                    tempDetail.Id = ld.Rental_Apply_Equipment_Set_Detail__c;
                    tempDetail.LoseReportApprovaled__c = true;
                    tempDetail.LostReportApprovalDate__c = today;
                    needUpdateRentalDetail.add(tempDetail);
                }  
                
force-app/main/default/classes/LostReportHandlerTest.cls
@@ -1,5 +1,99 @@
@isTest
private class LostReportHandlerTest {
    // AWSServiceTool2没上线就把这部分注释 start 20220408
   @TestSetup
    static void setup(){
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Agency_Contact__c','Contact'});
    }
    @isTest
    static void Test1(){
        Test.setMock(HttpCalloutMock.class, new HttpMock());
        List<Agency_Contact__c> lra = new List<Agency_Contact__c>();
        lra.add(new Agency_Contact__c(
        ));
        insert lra;
        Test.startTest();
        //system.debug(PIHelper.getPIIntegrationInfo('Agency_Contact__c').newEncryptUrl);
        AWSServiceTool2.EncryptPushCore(Json.serialize(lra),'Agency_Contact__c');
        AWSServiceTool2.EncryptPushFuture(null,null);
        Test.stopTest();
    }
   @isTest
    static void Test2(){
        Test.setMock(HttpCalloutMock.class, new HttpMock());
        List<Agency_Contact__c> lra = new List<Agency_Contact__c>();
        lra.add(new Agency_Contact__c(
            Aws_Data_Id__c = '123456'
        ));
        insert lra;
        Test.startTest();
        //system.debug(PIHelper.getPIIntegrationInfo('Agency_Contact__c').newEncryptUrl);
        AWSServiceTool2.EncryptPushCore(Json.serialize(lra),'Agency_Contact__c');
        Test.stopTest();
    }
    @isTest
    static void Test3(){
        Test.setMock(HttpCalloutMock.class, new HttpMock());
        Test.startTest();
        AWSServiceTool2.EncryptPushData(new string[]{'0031000000O4Cff'});
        Test.stopTest();
    }
  //@isTest
  //  static void Test2(){
  //      Test.setMock(HttpCalloutMock.class, new HttpMock());
  //      List<Agency_Contact__c> lra = new List<Agency_Contact__c>();
  //      lra.add(new Agency_Contact__c(
  //          Id = 'a2R1m0000007BPD',
  //          Aws_Data_Id__c = '123456'
  //      ));
  //      Test.startTest();
  //      //system.debug(PIHelper.getPIIntegrationInfo('Agency_Contact__c').newEncryptUrl);
  //      AWSServiceTool2.EncryptPushCore(Json.serialize(lra),'Agency_Contact__c');
  //      Test.stopTest();
  //  }
    class HttpMock implements HttpCalloutMock{
            public HTTPResponse respond(HTTPRequest request) {
            // 创建一个假的回应
            System.debug('------------------------------------------------------');
            HttpResponse response = new HttpResponse();
            string body = '';
            system.debug(request.getEndpoint());
            if(request.getEndpoint().contains('token')){
                system.debug('url=token');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": "freqfewqfewewfewfew", "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else if(request.getEndpoint().contains('insert')){
                system.debug('url=Insert');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "a2R1m0000007BPD" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else if(request.getEndpoint().contains('update')){
                system.debug('url=update');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "a2R1m0000007BPD" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else{
            }
            response.setBody(body);
            response.setStatus('OK');
            response.setStatusCode(200);
            return response;
            // }
        }
    }
    // AWSServiceTool2没上线就把这部分注释 end
    // 202220531 ljh end
    // 创建Asset数据
    static void setupTestData() {
        // 病院を作る