From e2b452e71090b5f561055f345ccd257e5f757764 Mon Sep 17 00:00:00 2001
From: 18756 <1875631620@qq.com>
Date: 星期一, 19 八月 2024 13:53:15 +0800
Subject: [PATCH] 会议室功能8.19

---
 src/main/java/com/product/administration/service/ConferenceManagerService.java |   66 ++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java
index 6c8d85e..e3b995a 100644
--- a/src/main/java/com/product/administration/service/ConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -201,10 +201,11 @@
     }
 
     @Override
+    @Transactional
     public List getKbData(FieldSetEntity fse) throws BaseException {
 
         List<Object>param=new ArrayList<>();
-       String meeting_date= fse.getString("meeting_date");
+        String meeting_date= fse.getString("meeting_date");
         String meeting_resource = fse.getString("meeting_resource");
         param.add(meeting_date);
         if(!StringUtils.isEmpty(meeting_resource)){
@@ -226,9 +227,27 @@
         DataTableEntity dataTableEntity = baseDao.listTable(bs.toString(), param.toArray());
         List<String> list=new ArrayList();
         List<HashMap> listDate=new ArrayList<>();
-        //鏋勯�犳墍闇�瑕佺殑鏍煎紡
+
         for(int i=0;i<dataTableEntity.getRows();i++){
             FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i);
+
+            //鍒濆鍖栦細璁鐨勪娇鐢ㄧ殑鐘舵��
+            String filter=" meeting_room = '"+fieldSetEntity.getString("meeting_room")+"' and DATE_FORMAT(start_time,\"%Y-%m-%d\") ='"+meeting_date+"'";
+            DataTableEntity product_oa_conference_apply = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{});
+            for (int i1 = 0; i1 < product_oa_conference_apply.getRows(); i1++) {
+                FieldSetEntity fieldSetEntity1 = product_oa_conference_apply.getData().get(i);
+                Date date = new Date();
+                if(date.before(fieldSetEntity1.getDate("start_time"))){
+                    fieldSetEntity1.setValue("status","鏈紑濮�");
+                }else if(date.after(fieldSetEntity1.getDate("end_time"))){
+                    fieldSetEntity1.setValue("status","宸茬粨鏉�");
+                }else {
+                    fieldSetEntity1.setValue("status","浼氳涓�");
+                }
+
+            }
+            baseDao.update(product_oa_conference_apply);
+            //鏋勯�犳墍闇�瑕佺殑鏍煎紡
             if(!list.contains(fieldSetEntity.getValue("room_name").toString())){
                 HashMap<String,Object> hashMap=new HashMap<>();
                 hashMap.put("room_name",fieldSetEntity.getValue("room_name").toString());
@@ -249,6 +268,11 @@
                     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     String time = dateFormat.format(meeting_time);
                     hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),time);
+                    if(fieldSetEntity.getValues().keySet().toArray()[j].equals("start_time")){
+                        hashMap.put("start_date",time);
+                    }else {
+                        hashMap.put("end_date",time);
+                    }
                 }else {
                     hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString()));
                 }
@@ -261,13 +285,13 @@
     }
 
     @Override
-    public DataTableEntity getMeetingDetails(FieldSetEntity fse) throws BaseException {
-
-        //String uuid = fse.getString("uuid");
-        String uuid="96f161b4-6360-40ba-8dc1-72bb39d56be4";
-        /*if(!StringUtils.isEmpty(uuid)){*/
+    public List getMeetingDetails(FieldSetEntity fse) throws BaseException {
+        String meeting_room = fse.getString("meeting_room");
+        String meeting_date = fse.getString("meeting_date");
+        if(!StringUtils.isEmpty(meeting_room)&&!StringUtils.isEmpty(meeting_date)){
             List<Object>param=new ArrayList<>();
-            param.add(uuid);
+            param.add(meeting_room);
+            param.add(meeting_date);
             StringBuilder sb=new StringBuilder();
             sb.append(" SELECT b.uuid,b.start_time,b.end_time,b.record_man,b.record_master,b.status, ");
             sb.append(" CONCAT(DATE_FORMAT(b.start_time,\"%H-%i-%S\"),'~',DATE_FORMAT(b.end_time,\"%H-%i-%S\"))  as time_quantum,");
@@ -281,7 +305,8 @@
             sb.append(" FROM product_oa_conference_apply T1 ");
             sb.append(" JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 ) T2");
             sb.append(" ON T2.digit < ( length( T1.meeting_resource )- length( REPLACE ( T1.meeting_resource, ',', '' ))+ 1 )");
-            sb.append(" WHERE t1.uuid = ? ");
+            sb.append(" WHERE t1.meeting_room = ? ");
+            sb.append(" and DATE_FORMAT(t1.start_time,\"%Y-%m-%d\")=? ");
             sb.append(" ) a");
             sb.append(" LEFT JOIN product_sys_dict t ON a.type = t.dict_value ");
             sb.append(" AND t.dict_name = '浼氳瀹よ祫婧�'");
@@ -289,25 +314,16 @@
             sb.append(" group by b.uuid,b.start_time,b.end_time,b.record_man,b.record_master,b.status ");
             DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray());
 
+          List dataList =new ArrayList();
             for (int i = 0; i < dataTableEntity.getRows(); i++) {
-                Date date = new Date();
-                String uuid1 = dataTableEntity.getData().get(0).getString("uuid");
-                String filter="uuid = '"+uuid1+"'";
-                DataTableEntity product_oa_conference_apply = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{});
-                if(date.before(dataTableEntity.getData().get(0).getDate("start_time"))){
-                    product_oa_conference_apply.getData().get(0).setValue("status","鏈紑濮�");
-                }else if(date.after(dataTableEntity.getData().get(0).getDate("end_time"))){
-                    product_oa_conference_apply.getData().get(0).setValue("status","宸插彇娑�");
-
-                }else {
-                    product_oa_conference_apply.getData().get(0).setValue("status","浼氳涓�");
-                }
-                baseDao.update(product_oa_conference_apply);
+                FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i);
+                Map<Object, Object> values = fieldSetEntity.getValues();
+                dataList.add(values);
             }
-            return  dataTableEntity;
-       /* }else {
+            return  dataList;
+        }else {
             return null;
-        }*/
+        }
 
     }
 

--
Gitblit v1.9.2