From 9b197b7fac92278fb591ea8f4942c7d5687cb5ce Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期一, 28 三月 2022 18:01:22 +0800
Subject: [PATCH] LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备0328
---
force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls | 46 ++++++++++++++++++++++++++--------------------
1 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls b/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls
index 99d2209..2fda9a3 100644
--- a/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls
+++ b/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls
@@ -1,4 +1,12 @@
+/**
+ * @description :
+ * @author : ChangeMeIn@UserSettingsUnder.SFDoc
+ * @group :
+ * @last modified on : 03-17-2022
+ * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc
+**/
global without sharing class NewConsumApplyEquipSetDetailController {
+ public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute
public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;}
public String awsToken{set;get;}
public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
@@ -33,6 +41,7 @@
}
LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Consum_Apply_Equipment_Set_Detail__c','classic');
layoutSections = LayoutWrapperValue.layoutSections;
+ layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute
List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList;
Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap;
requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList);
@@ -60,28 +69,25 @@
Consum_Apply_Equipment_Set_Detail__c consumApplyInfo = new Consum_Apply_Equipment_Set_Detail__c();
//鑷畾涔夋牸寮忚浆鎹�
for (String fieldAPI: fieldValueMap.keySet()) {
- system.debug('field API'+fieldAPI);
- String fieldValue = String.valueOf(fieldAPIToTypeMap.get(fieldAPI));
- if(String.isBlank(fieldValue)){
- continue;
- }
- Schema.DescribeFieldResult fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe();
- Schema.DisplayType fieldDatas = fielddataType.getType();
- if(String.valueOf(fielddatas)=='DATE'){
- consumApplyInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-')));
- }else if(String.valueOf(fielddatas)=='DATETIME'){
- String dt = String.valueOf(fieldValueMap.get(fieldAPI));
- if(String.isNotBlank(dt)&&dt.contains('T')){
- dt = dt.replace('T',' ');
- consumApplyInfo.put(fieldAPI, Datetime.valueOfGmt(dt));
- }
- }else if(String.valueOf(fielddatas)=='Number'||String.valueOf(fielddatas)=='DOUBLE'){
- // ||String.valueOf(fielddatas)=='Decimal'
- consumApplyInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI))));
- } else if(String.valueof(fielddatas)=='BOOLEAN'){
+ system.debug('field API='+fieldAPI);
+ Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType();
+ String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI));
+ system.debug('Field Type:'+fielddataType+' field Value='+fieldValue);
+ if(String.valueOf(fielddataType)=='DATE'){
+ consumApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-')));
+ }else if(String.valueOf(fielddataType)=='DATETIME'){
+ if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){
+ fieldValue = fieldValue.replace('T',' ');
+ consumApplyInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue));
+ }else{
+ consumApplyInfo.put(fieldAPI, null);
+ }
+ }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){
+ consumApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue));
+ } else if(String.valueof(fielddataType)=='BOOLEAN'){
consumApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI));
}else {
- consumApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI)));
+ consumApplyInfo.put(fieldAPI,fieldValue);
}
}
--
Gitblit v1.9.1