From 1f296034a85c447df33cf4e09ed111eb3f42daf9 Mon Sep 17 00:00:00 2001
From: Liu Cheng <liucheng@prec-tech.com>
Date: 星期五, 10 六月 2022 15:05:00 +0800
Subject: [PATCH] DLIU-CES8B9 【FY23系统课题10】-紧急-已借用自然日、借出状态(明细)字段逻辑调整
---
force-app/main/default/classes/EquipmentRentalLostReportController.cls | 4 ++
force-app/main/default/classes/LostReportHandlerTest.cls | 94 +++++++++++++++++++++++++++++++++++++++++++++++
force-app/main/default/classes/LostReportHandler.cls | 2 +
3 files changed, 100 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/EquipmentRentalLostReportController.cls b/force-app/main/default/classes/EquipmentRentalLostReportController.cls
index 7bade62..a65710b 100644
--- a/force-app/main/default/classes/EquipmentRentalLostReportController.cls
+++ b/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);
}
}
diff --git a/force-app/main/default/classes/LostReportHandler.cls b/force-app/main/default/classes/LostReportHandler.cls
index d99a218..e8f0238 100644
--- a/force-app/main/default/classes/LostReportHandler.cls
+++ b/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);
}
diff --git a/force-app/main/default/classes/LostReportHandlerTest.cls b/force-app/main/default/classes/LostReportHandlerTest.cls
index 3aa268f..78f0cc8 100644
--- a/force-app/main/default/classes/LostReportHandlerTest.cls
+++ b/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() {
// 鐥呴櫌銈掍綔銈�
--
Gitblit v1.9.1