From 3962c2bb0435484b60a3e408e4738d792e249a53 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 05 六月 2023 11:09:55 +0800
Subject: [PATCH] LEX CommunityNewCmp
---
force-app/main/default/classes/LexLicenceReminderController.cls | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/LexLicenceReminderController.cls b/force-app/main/default/classes/LexLicenceReminderController.cls
new file mode 100644
index 0000000..97a1cf3
--- /dev/null
+++ b/force-app/main/default/classes/LexLicenceReminderController.cls
@@ -0,0 +1,53 @@
+public without sharing class LexLicenceReminderController {
+
+ @AuraEnabled
+ public static Results initReminder(){
+ Results results = new Results();
+ try {
+ User useracc = [SELECT AccountId, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
+ String accountId = useracc.AccountId;
+ List<Account> accList = [SELECT Name,Medical_Equipment_Expiration_Date__c FROM Account WHERE Id =:accountId];
+ Account accountInfo = new Account();
+ if(accList.size() == 1){
+ accountInfo = accList[0];
+ }else{
+ results.result = 'Fail';
+ results.isShowReminder = false;
+ results.errorMsg = '鏈幏鍙栧埌缁忛攢鍟嗕俊鎭�';
+ return results;
+ }
+ if(accountInfo.Medical_Equipment_Expiration_Date__c != null){
+ Integer days = LexUtility.getLicenceReminderDays();
+ Date today = Date.today();
+ // Date today = Date.newInstance(2024, 7, 21);
+ Integer numberDaysDue = today.daysBetween(accountInfo.Medical_Equipment_Expiration_Date__c);
+ if(numberDaysDue > days){
+ results.isShowReminder = false;
+ }else{
+ results.isShowReminder = true;
+ results.days = numberDaysDue;
+ }
+ results.result = 'Success';
+ }else {
+ results.result = 'Fail';
+ results.errorMsg = '鏈幏鍙栧埌鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佹湁鏁堟湡闄�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.isShowReminder = false;
+ results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public Boolean isShowReminder;
+ @AuraEnabled
+ public Integer days;
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1