ShuanghongS 9 місяців тому
батько
коміт
ffe7fa144a
4 змінених файлів з 132 додано та 71 видалено
  1. 1 1
      service/login.class.php
  2. 2 2
      service/ocean_order.class.php
  3. 83 58
      service/tools.class.php
  4. 46 10
      utils/common.class.php

+ 1 - 1
service/login.class.php

@@ -277,7 +277,7 @@ class login {
                 }
 
                 //kln新版查询 date_format,numbers_format
-                $kln_user = common::excuteObjectSql("select * from kln_user_extend where lower(user_login) = '".strtolower($uname)."'");
+                $kln_user = common::excuteObjectSql("select * from public.kln_user_extend where lower(user_login) = '".strtolower($uname)."'");
                 $kln_user_info = array("uname"=>$uname,
                                     "user_type"=>strtolower($rs['user_type']),
                                     "first_name"=>$rs['first_name'],

+ 2 - 2
service/ocean_order.class.php

@@ -951,7 +951,7 @@ class ocean_order {
 
             $sql = "with oo  as (SELECT order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
                     h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,
-                    (select user_login from kln_user_subscribed us  
+                    (select user_login from public.kln_user_subscribed us  
                         where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
                     CASE
 	    	            WHEN (m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Created'::text
@@ -974,7 +974,7 @@ class ocean_order {
 
             $tmp_search_without_limit = "with oo  as (SELECT order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
                     h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,
-                    (select user_login from kln_user_subscribed us  
+                    (select user_login from public.kln_user_subscribed us  
                         where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
                     CASE
 	    	            WHEN (m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Created'::text

+ 83 - 58
service/tools.class.php

@@ -138,8 +138,8 @@ class tools {
             
             $sql = "select u.first_name,u.last_name,u.user_login,u.email,EXTRACT(DAY from (now() - u.last_pwd_change)) as last_pwd_change_date,
                     ue.date_format,ue.numbers_format
-                from ra_online_user u
-                    left join  kln_user_extend ue on u.user_login = ue.user_login
+                from public.ra_online_user u
+                    left join  public.kln_user_extend ue on u.user_login = ue.user_login
                 where lower(u.user_login) = '".strtolower(_getLoginName())."' ";
 
             $data = common::excuteObjectSql($sql);
@@ -453,13 +453,19 @@ class tools {
                     }
                 }
                 if(!empty($v['daily'])){
-                    //取第一组的第一个显示
-                    $dailyFristAndFrist = utils::getDailyAndweeklyFrist($v['daily']);
-                    $instant_sum[]= $dailyFristAndFrist;
+                    $dailys = common::handleDailyWeekedData($v['daily']);
+                    foreach($dailys as $dailyArr){
+                        //取第一组的第一个显示
+                        $dailyFristAndFrist = utils::getDailyAndweeklyFrist($dailyArr);
+                        $instant_sum[]= $dailyFristAndFrist;
+                    }
                 }
                 if(!empty($v['weekly'])){
-                    $weeklyFristAndFrist = utils::getDailyAndweeklyFrist($v['weekly']);
-                    $instant_sum[]= $weeklyFristAndFrist;
+                    $weeklys = common::handleDailyWeekedData($v['weekly']);
+                    foreach($weeklys as $weeklyArr){
+                        $weeklyFristAndFrist = utils::getDailyAndweeklyFrist($weeklyArr);
+                        $instant_sum[]= $weeklyFristAndFrist;
+                    }
                 }
             }
             //根据时间顺序排序
@@ -481,8 +487,9 @@ class tools {
         if($operate == "notifications_see_all"){
             $rules_type = common::check_input($_REQUEST['rules_type']);
             $frequency_type = common::check_input($_REQUEST['frequency_type']);  //这个只会传daily 和weekly
+            $insert_date_format = common::check_input($_REQUEST['insert_date_format']);
 
-            $notificationsData = $this->getNotifications($rules_type,$frequency_type);
+            $notificationsData = $this->getNotifications($rules_type,$frequency_type,$insert_date_format);
             $moreData = $notificationsData[$rules_type][strtolower($frequency_type)];
 
             //这个函数里面带有分开计数的信息
@@ -490,6 +497,7 @@ class tools {
 
             $returnData = array();
             $notificationList = array();
+            $ids = array();
             foreach($moreData as $key => $data){
                 $eventCard = $this->getEventCard($data);
                 //sea all的数据格式和查询全部的格式有区别
@@ -505,19 +513,18 @@ class tools {
                 //移除不需要的字段
                 unset($eventCard["title"]);
                 $notificationList[] = $eventCard;
+                $ids[] =  $data['id'];
             }
             if(!empty($notificationList)){
                 $returnData["notificationList"] = $notificationList;
             }
+
             //点击seall会默认全部标记为已读
-            $all_id = $notificationsData[$rules_type][strtolower($frequency_type."_all_id")];
-            $returnData["all_id"] = $all_id;
-            if(!empty($all_id)){
-                $more_param = common::getInNotInSqlForSearch(strtolower(utils::implode(';',$all_id)));
+            if(!empty($ids)){
+                $more_param = common::getInNotInSqlForSearch(strtolower(utils::implode(';',$ids)));
                 $markReadSql = "update public.kln_notifiation_info set is_send_message = true where id in ($more_param)";
                 //common::excuteUpdateSql($markReadSql);
             }
-            
             common::echo_json_encode(200,$returnData);
             exit();
         }
@@ -546,7 +553,15 @@ class tools {
         if ($operate == "notifications_message_init"){
             $rules_type = common::check_input($_REQUEST['rules_type']);
             //查询所有情况得未读情况 查询最近一年的情况
-            //"select * from  public.kln_notifiation_info where ";
+            "select 
+                    sum(case when (1<>1 or (notifiation_type='Milestone_Update')) then 1 else 0 end) as sea_rc,
+                    sum(case when (1<>1 or (notifiation_type='sea')) then 1 else 0 end) as sea_rc,
+                    sum(case when (1<>1 or (notifiation_type='sea')) then 1 else 0 end) as sea_rc,
+                    sum(case when (1<>1 or (notifiation_type='sea')) then 1 else 0 end) as sea_rc,
+                    sum(case when (1<>1 or (notifiation_type='sea')) then 1 else 0 end) as sea_rc
+                from  public.kln_notifiation_info 
+            where insert_date > NOW() - INTERVAL '1 year' 
+                and notifications_method = 'true' and is_send_message = 'false'";
         }
     }
 
@@ -929,7 +944,7 @@ class tools {
     }
 
 
-    public function getNotifications($notifiation_type,$frequency_type){
+    public function getNotifications($notifiation_type,$frequency_type,$insert_date_format = null){
         if ($frequency_type == "all"){
             $sql_where = " and (ni.frequency_type = 'Instant' 
                             or (ni.frequency_type = 'Daily'  and timezone(ni.daily_time_zone, NOW()::time) > ni.daily_time::time)
@@ -941,22 +956,36 @@ class tools {
             $sql_where = " and (ni.frequency_type = 'Weekly' and timezone(ni.weekly_time_zone, NOW()::time) > ni.weekly_time::time 
                                     and  ni.weekly_week ilike '%'|| EXTRACT(dow FROM timezone(ni.weekly_time_zone, NOW())) ||'%')";
         }
+        //这里的查询会把不同日期的但hbol相同的信息,过滤掉只剩下最新的那一条。所以移除
+        $aa_where = "";
+        if (!empty($insert_date_format)){
+            $aa_where = " where insert_date_format = '$insert_date_format'";
+        }
         
         $more_param = common::getInNotInSqlForSearch($notifiation_type);
-
-        $sql = "select ni.*,
+        $sql = "select *
+                 from  (select ni.*,
                     case when ni.notifiation_type = 'Departure/Arrival_Delay' and ni.delay_unit = 'days'
                             then (EXTRACT(DAY FROM ((delay_act_date||' '||delay_act_time)::timestamp - (delay_est_date||' '||delay_est_time)::timestamp)))
                         when ni.notifiation_type = 'Departure/Arrival_Delay' and ni.delay_unit = 'hours'
                             then (EXTRACT(HOUR FROM ((delay_act_date||' '||delay_act_time)::timestamp - (delay_est_date||' '||delay_est_time)::timestamp)))
                         else 0 
                     end  as delay_diff,
+
                     case when COALESCE(ni.frequency_type,'') = 'Daily'
-                            then to_char(timezone(ni.daily_time_zone, now()),'Mon DD, YYYY')
-                        when COALESCE(ni.frequency_type,'') = 'Weekly'  
-                            then to_char(timezone(ni.weekly_time_zone, now()),'Mon DD, YYYY')
+                            then to_char(timezone(ni.daily_time_zone, ni.insert_date),'Mon DD, YYYY')
+                        when COALESCE(ni.frequency_type,'') = 'Weekly' 
+                            then (select to_char(timezone(ni.weekly_time_zone, ni.insert_date) - (week - 1 || 'day')::INTERVAL,'Mon DD, YYYY')|| ' - ' || to_char(timezone(ni.weekly_time_zone, ni.insert_date) + (7-week || 'day')::INTERVAL,'Mon DD, YYYY')
+			                            from (select   case when EXTRACT(dow FROM timezone(ni.weekly_time_zone, ni.insert_date)) = 0 then 7 
+					                                else  EXTRACT(dow FROM timezone(ni.weekly_time_zone, ni.insert_date)) end as week) as a) 
                         else '' 
                     end  as insert_date_format,
+
+                    case when ni.notifiation_type ='Milestone_Update' 
+                        then public.getPreviousMilestone(ni.serial_no,ni.milestone_code,ccc.transport_mode,ccc.order_from)
+                        else ''
+                    end as milestone_previous_json,
+
                     ccc.order_from,ccc.h_bol,ccc.transport_mode
                 from public.kln_notifiation_info ni
                         left join LATERAL (select oo.h_bol,oo.transport_mode,oo.order_from 
@@ -964,7 +993,7 @@ class tools {
                             where oo.serial_no = ni.serial_no limit 1) ccc on true
                 where lower(ni.user_login) = '".strtolower(_getLoginName())."' 
                         and lower(ni.notifiation_type) in ($more_param)
-                    ".$sql_where." and ni.notifications_method = true order by ni.insert_date desc";
+                    ".$sql_where." and ni.notifications_method = true order by ni.insert_date desc) aa $aa_where";
         error_log($sql);
 
         $data_all_type = common::excuteListSql($sql);
@@ -989,57 +1018,39 @@ class tools {
             $instant = array();
             $daily = array();
             $daily_uniqe = array();
-            $daily_all_id = array();
 
             $weekly  = array();
             $weekly_uniqe = array();
-            $weekly_all_id  = array();
             foreach($data as $d){
                 if ($d['frequency_type'] == "Instant"){
                     $instant[] = $d;
                 }
-                //类型为这个时才用这个去重,否则要加上描述(转船的情况,会让相同的HBOL显示)
+                //Daily 或者 Weekly类型为这个时才用这个去重,否则要加上描述(转船的情况,会让相同的HBOL显示)
                 $uniqe_str = $d['serial_no'];
-                if ($notifiation_type_db == "Departure/Arrival_Delay"){
-                    $uniqe_str = $d['serial_no']."_".$d['delay_name'];
-                } else if($notifiation_type_db == "ETD/ETA_Change"){
-                    $uniqe_str = $d['serial_no']."_".$d['date_change_name'];
+                if ($notifiation_type_db == "Milestone_Update"){
+                    $uniqe_str = $d['serial_no']."_".$d['insert_date_format']."_".$d['milestone_code'];
+                }else if ($notifiation_type_db == "Container_Status_Update"){
+                    $uniqe_str = $d['ctnr']."_".$d['insert_date_format']."_".$d['ctnr_status_code'];
+                }else if($notifiation_type_db == "Departure/Arrival_Delay"){
+                    $uniqe_str = $d['serial_no']."_".$d['insert_date_format']."_".$d['delay_name'];
+                }else if($notifiation_type_db == "ETD/ETA_Change"){
+                    $uniqe_str = $d['serial_no']."_".$d['insert_date_format']."_".$d['date_change_name'];
                 }
+
                 if ($d['frequency_type'] == "Daily"){
-                    if($d["is_send_message"] <> 't'){
-                        $daily_all_id[] = $d["id"];
-                    }
-                    if(utils::in_array($uniqe_str,$daily_uniqe)){
-                        $temp = $daily[$uniqe_str];
-                        //previous只更新最近的一次,并且是需要查询详细的时候,才放开previous的查询
-                        if(empty($temp['previous']) && $frequency_type <> "all"){
-                            $temp['previous'] = $d;
-                        }
-                        $daily[$uniqe_str] = $temp;
-                    } else {
+                    if(!utils::in_array($uniqe_str,$daily_uniqe)){
                         $daily[$uniqe_str] = $d;
                         $daily_uniqe[] = $uniqe_str;
-                    }
+                    } 
                 }
                 if ($d['frequency_type'] == "Weekly"){
-                    if($d["is_send_message"] <> 't'){
-                        $weekly_all_id[] = $d["id"];
-                    }
-                    if(utils::in_array($uniqe_str,$weekly_uniqe)){
-                        $temp = $weekly[$uniqe_str];
-                        //previous只更新最近的一次,并且是需要查询详细的时候,才放开previous的查询
-                        if(empty($temp['previous']) && $frequency_type <> "all"){
-                            $temp['previous'] = $d;
-                        }
-                        $weekly[$uniqe_str] = $temp;
-                    } else {
+                    if(!utils::in_array($uniqe_str,$weekly_uniqe)){
                         $weekly[$uniqe_str] = $d;
                         $weekly_uniqe[] = $uniqe_str;
                     }
                 }
             }
-            $retData[$key]=  array("instant" =>$instant,"daily" =>utils::arrayKeyToInt($daily),"weekly"=>utils::arrayKeyToInt($weekly),
-                "daily_all_id" =>$daily_all_id,"weekly_all_id"=>$weekly_all_id);
+            $retData[$key]=  array("instant" =>$instant,"daily" =>utils::arrayKeyToInt($daily),"weekly"=>utils::arrayKeyToInt($weekly));
         }
         return $retData;
     }
@@ -1062,21 +1073,26 @@ class tools {
                     "previous"=>"",
                     "frequency_type"=>$mInfo["frequency_type"],
                     "serial_no"=>$mInfo["serial_no"],
-                    "order_from"=>$mInfo["order_from"],
+                    "order_from"=>$mInfo["order_from"], 
                     "id"=>$mInfo["id"],
+                    "insert_date_format"=>'',
                     "info"=>new stdClass());
 
             if ($mInfo["frequency_type"] == "Daily"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["title"] = "Milestone Update Daily Summary(".$mInfo["insert_date_format"].")";
-                if(!empty($mInfo["previous"])){
-                    $eventCard["previous"] = array("tag" =>"Previous:".$mInfo["previous"]["milestone_description"]." from ".$mInfo["previous"]["milestone_locations"],
-                        "time" => $mInfo["previous"]["milestone_time"],
-                        "timezone" =>$mInfo["previous"]["milestone_timezone"]);    
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
+                $eventCard["previous"] = '';
+                $milestone_previous = json_decode($mInfo["milestone_previous_json"],true);
+                if(!empty($milestone_previous['milestone'])){
+                    $eventCard["previous"] = array("tag" =>"Previous:".$milestone_previous['milestone']['milestone_description']." from ".$milestone_previous['milestone']['locations'],
+                        "time" => $milestone_previous['milestone']['milestone_time'],
+                        "timezone" =>$milestone_previous['milestone']['timezone']);    
                 }
             } else if($mInfo["frequency_type"] == "Weekly"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["title"] = "Milestone Update Weekly Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
                 if(!empty($mInfo["previous"])){
                     $eventCard["previous"] = array("tag" =>"Previous:".$mInfo["previous"]["milestone_desc"]." from ".$mInfo["previous"]["milestone_description"],
                         "time" => $mInfo["previous"]["milestone_time"],
@@ -1103,11 +1119,13 @@ class tools {
                     "serial_no"=>$mInfo["serial_no"],
                     "order_from"=>$mInfo["order_from"],
                     "id"=>$mInfo["id"],
+                    "insert_date_format"=>'',
                     "info"=>new stdClass());
 
             if ($mInfo["frequency_type"] == "Daily"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["title"] = "Container Status Update Daily Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
                 if(!empty($mInfo["previous"])){
                     //当前状态 前一个的描述
                     $previousCtnrStatusdesc = $this->getContainerStatusDesc($mInfo["previous"]["ctnr_status_code"]);
@@ -1118,6 +1136,7 @@ class tools {
             } else if($mInfo["frequency_type"] == "Weekly"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["title"] = "Container Status Update Weekly Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
                 if(!empty($mInfo["previous"])){
                     //当前状态 前一个的描述
                     $previousCtnrStatusdesc = $this->getContainerStatusDesc($mInfo["previous"]["ctnr_status_code"]);
@@ -1182,6 +1201,7 @@ class tools {
                     "serial_no"=>$mInfo["serial_no"],
                     "order_from"=>$mInfo["order_from"],
                     "id"=>$mInfo["id"],
+                    "insert_date_format"=>'',
                     "info"=>array("route"=>$route,
                         "leg"=>$leg,
                         "etdOrdeparturNum"=>0,
@@ -1197,11 +1217,13 @@ class tools {
                 $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
                 $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
                 $eventCard["title"] = "Container Status Update Daily Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
             } else if($mInfo["frequency_type"] == "Weekly"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
                 $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
                 $eventCard["title"] = "Container Status Update Weekly Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
             }
         }
         if($notifiation_type == "ETD/ETA_Change"){
@@ -1242,6 +1264,7 @@ class tools {
                     "serial_no"=>$mInfo["serial_no"],
                     "order_from"=>$mInfo["order_from"],
                     "id"=>$mInfo["id"],
+                    "insert_date_format"=>'',
                     "info"=>array("route"=>$route,
                         "leg"=>$leg,
                         "etdOrdeparturNum"=>0,
@@ -1257,11 +1280,13 @@ class tools {
                 $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
                 $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
                 $eventCard["title"] = "ETD/ETA Change Daily Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
             } else if($mInfo["frequency_type"] == "Weekly"){
                 $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
                 $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
                 $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
                 $eventCard["title"] = "ETD/ETA Change Weekly Summary(".$mInfo["insert_date_format"].")";
+                $eventCard["insert_date_format"] = $mInfo["insert_date_format"];
             }
         }
         return $eventCard;

+ 46 - 10
utils/common.class.php

@@ -2169,7 +2169,7 @@ class common {
      * checked is_subscribe
     */
     public static function checkedSubscribe($serial_no) { //creates directory tree recursively
-        $is_subscribe_exist = common::excuteOneSql("select user_login from kln_user_subscribed us  
+        $is_subscribe_exist = common::excuteOneSql("select user_login from public.kln_user_subscribed us  
             where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = '".$serial_no."'");
         if(empty($is_subscribe_exist)){
             $is_subscribe = false;
@@ -2202,17 +2202,53 @@ class common {
      * 这里基准event 写死, 根据online查询页面的通用的来, 这里需提问确定
     */
     public  static function getEDICtnrEvent(){
-        $event =array(array("event_name"=>"EE","description"=>"Empty Equipment Dispatched"),array("event_name"=>"I","description"=>"Gate in full for a booking"),array("event_name"=>"AE","description"=>"Container loaded on vessel"),
-                array("event_name"=>"VD","description"=>"Vessel Departure"),array("event_name"=>"VA_RELAY","description"=>"Arrive Relay Port"),array("event_name"=>"UV_RELAY","description"=>"Unloaded at Relay Port"),
-                array("event_name"=>"AE_RELAY","description"=>"Loaded at Relay Port"),array("event_name"=>"VD_RELAY","description"=>"Depart Relay Port"),array("event_name"=>"CU","description"=>"Carrier and Customs Release"),
-                array("event_name"=>"CT","description"=>"Customs release"),array("event_name"=>"CR","description"=>"Carrier release"),array("event_name"=>"VA","description"=>"Vessel Arrival"),
-                array("event_name"=>"UV","description"=>"Unloaded From Vessel"),array("event_name"=>"AG","description"=>"Estimated Delivery"),array("event_name"=>"OA","description"=>"Gate out full from final discharge port"),
-                array("event_name"=>"FT","description"=>"Free Time Expired"),array("event_name"=>"AL","description"=>"Container loaded on Rail"),array("event_name"=>"AR","description"=>"Container unloaded from Rail"),
-                array("event_name"=>"AV","description"=>"Shipment available for pickup or delivery"),array("event_name"=>"D","description"=>"Gate out for delivery to customer"),array("event_name"=>"RD","description"=>"Container returned empty"),
-                array("event_name"=>"C","description"=>"Vessel Estimated Time of Departure"),array("event_name"=>"C_RELAY","description"=>"Estimated Time of Departure from Tranship Port"),array("event_name"=>"AG_DES","description"=>"Estimated Delivery Destination"),
-                array("event_name"=>"IFFADW","description"=>"Shipment in CFS warehouse"),array("event_name"=>"IFFDDW","description"=>"Shipment Out from CFS House"));
+        $event =array(array("event_name"=>"EE","description"=>"Empty Equipment Dispatched"),
+                array("event_name"=>"I","description"=>"Gate in full for a booking"),
+                array("event_name"=>"AE","description"=>"Container loaded on vessel"),
+                array("event_name"=>"VD","description"=>"Vessel Departure"),
+                array("event_name"=>"VA_RELAY","description"=>"Arrive Relay Port"),
+                array("event_name"=>"UV_RELAY","description"=>"Unloaded at Relay Port"),
+                array("event_name"=>"AE_RELAY","description"=>"Loaded at Relay Port"),
+                array("event_name"=>"VD_RELAY","description"=>"Depart Relay Port"),
+                array("event_name"=>"CU","description"=>"Carrier and Customs Release"),
+                array("event_name"=>"CT","description"=>"Customs release"),
+                array("event_name"=>"CR","description"=>"Carrier release"),
+                array("event_name"=>"VA","description"=>"Vessel Arrival"),
+                array("event_name"=>"UV","description"=>"Unloaded From Vessel"),
+                array("event_name"=>"AG","description"=>"Estimated Delivery"),
+                array("event_name"=>"OA","description"=>"Gate out full from final discharge port"),
+                array("event_name"=>"FT","description"=>"Free Time Expired"),
+                array("event_name"=>"AL","description"=>"Container loaded on Rail"),
+                array("event_name"=>"AR","description"=>"Container unloaded from Rail"),
+                array("event_name"=>"AV","description"=>"Shipment available for pickup or delivery"),
+                array("event_name"=>"D","description"=>"Gate out for delivery to customer"),
+                array("event_name"=>"RD","description"=>"Container returned empty"),
+                array("event_name"=>"C","description"=>"Vessel Estimated Time of Departure"),
+                array("event_name"=>"C_RELAY","description"=>"Estimated Time of Departure from Tranship Port"),
+                array("event_name"=>"AG_DES","description"=>"Estimated Delivery Destination"),
+                array("event_name"=>"IFFADW","description"=>"Shipment in CFS warehouse"),
+                array("event_name"=>"IFFDDW","description"=>"Shipment Out from CFS House"));
         return  $event;   
     }
 
+    /**
+     * 处理daily 和 week 不同周或者天的数据分组
+    */
+    public  static function handleDailyWeekedData($notificationsArr){
+        $uniqe = array();
+        $ret = array();
+        foreach($notificationsArr as $info){
+            $uniqe_group_str = $info['insert_date_format'];
+            if(utils::in_array($uniqe_group_str,$uniqe)){
+                $tempArr = $ret[$uniqe_group_str];
+                $tempArr[] = $info;
+                $ret[$uniqe_group_str] = $tempArr;
+            } else {
+                $ret[$uniqe_group_str] = array($info);
+                $uniqe[] = $uniqe_group_str;
+            }
+        }
+        return $ret;
+    }
 }
 ?>