From 64a00ecca42ffda234197f070734dfe74972635b Mon Sep 17 00:00:00 2001
From: 6c <420680616@qq.com>
Date: 星期五, 30 八月 2024 16:08:08 +0800
Subject: [PATCH] 会议室bug

---
 src/main/java/com/product/administration/service/ConferenceManagerService.java |  229 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 180 insertions(+), 49 deletions(-)

diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java
index f221f49..e0c6f5b 100644
--- a/src/main/java/com/product/administration/service/ConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -4,7 +4,6 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.google.errorprone.annotations.Var;
 import com.google.zxing.BarcodeFormat;
 import com.google.zxing.EncodeHintType;
 import com.google.zxing.MultiFormatWriter;
@@ -19,25 +18,19 @@
 import com.product.core.dao.BaseDao;
 import com.product.core.entity.DataTableEntity;
 import com.product.core.entity.FieldSetEntity;
-import com.product.core.entity.RequestParameterEntity;
 import com.product.core.exception.BaseException;
 import com.product.core.permission.PermissionService;
 import com.product.core.service.support.AbstractBaseService;
 import com.product.core.service.support.QueryFilterService;
 import com.product.core.spring.context.SpringMVCContextHolder;
 import com.product.core.transfer.Transactional;
-import com.product.core.util.QuickResponUtil;
 import com.product.core.websocket.service.WebsocketMesssageServiceThread;
 import com.product.module.sys.entity.SystemUser;
 import com.product.util.BaseUtil;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.omg.CORBA.OBJ_ADAPTER;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.File;
+
 import java.io.IOException;
 import java.text.DecimalFormat;
 import java.text.Format;
@@ -234,13 +227,12 @@
         }
 
         StringBuilder bs=new StringBuilder();
-        bs.append(" SELECT DISTINCT y.*, g.room_name,g.uuid as meet_room_uuid ");
-        bs.append(" FROM product_oa_conference_apply y");
-        bs.append(" left JOIN product_oa_conference_room_config g ");
-        bs.append(" on y.meeting_room=g.uuid ");
-        bs.append(" where DATE_FORMAT(y.start_time,\"%Y-%m-%d\")=?");
+        bs.append(" SELECT DISTINCT  g.room_name,g.uuid as meet_room_uuid,y.* ");
+        bs.append(" FROM product_oa_conference_room_config g");
+        bs.append(" left JOIN  product_oa_conference_apply y ");
+        bs.append(" on y.meeting_room=g.uuid and DATE_FORMAT(y.start_time,\"%Y-%m-%d\")=? ");
         if(!StringUtils.isEmpty(meeting_resource)){
-            bs.append(" and  y.meeting_resource like ? ");
+            bs.append(" where  y.meeting_resource like ? ");
         }
         bs.append(" ORDER BY y.start_time");
         DataTableEntity dataTableEntity = baseDao.listTable(bs.toString(), param.toArray());
@@ -265,38 +257,50 @@
                 }
                baseDao.executeUpdate("update product_oa_conference_apply set status='"+fieldSetEntity1.getString("status")+"' where uuid='"+fieldSetEntity1.getString("uuid")+"'");
             }
-            //鏋勯�犳墍闇�瑕佺殑鏍煎紡
-            if(!list.contains(fieldSetEntity.getValue("room_name").toString())){
+
+            if(ObjectUtil.isNotEmpty(fieldSetEntity.getString("uuid"))){
+                //鏋勯�犳墍闇�瑕佺殑鏍煎紡
+                if(!list.contains(fieldSetEntity.getValue("room_name").toString())){
+                    HashMap<String,Object> hashMap=new HashMap<>();
+                    hashMap.put("room_name",fieldSetEntity.getValue("room_name").toString());
+                    hashMap.put("uuid",fieldSetEntity.getValue("meet_room_uuid").toString());
+                    Object getStartTime = dataTableEntity.getData().get(0).getValue("start_time");
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String time = dateFormat.format(getStartTime);
+                    hashMap.put("start_time",time);
+                    list.add(fieldSetEntity.getValue("room_name").toString());
+                    listDate.add(hashMap);
+
+                }
+                fieldSetEntity.setValue("parent",fieldSetEntity.getValue("meet_room_uuid").toString());
                 HashMap<String,Object> hashMap=new HashMap<>();
-                hashMap.put("room_name",fieldSetEntity.getValue("room_name").toString());
-                hashMap.put("uuid",fieldSetEntity.getValue("meet_room_uuid").toString());
-                Object getStartTime = dataTableEntity.getData().get(0).getValue("start_time");
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                String time = dateFormat.format(getStartTime);
-                hashMap.put("start_time",time);
-                list.add(fieldSetEntity.getValue("room_name").toString());
+                for (int j = 0; j < fieldSetEntity.getValues().keySet().size(); j++) {
+                    if(fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("start_time") || fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("end_time")){
+                        Object meeting_time = fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString());
+                        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()));
+                    }
+
+                }
                 listDate.add(hashMap);
 
-            }
-            fieldSetEntity.setValue("parent",fieldSetEntity.getValue("meet_room_uuid").toString());
-            HashMap<String,Object> hashMap=new HashMap<>();
-            for (int j = 0; j < fieldSetEntity.getValues().keySet().size(); j++) {
-                if(fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("start_time") || fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("end_time")){
-                    Object meeting_time = fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString());
-                    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()));
+            }else {
+                if(!list.contains(fieldSetEntity.getValue("room_name").toString())){
+                    HashMap<String,Object> hashMap=new HashMap<>();
+                    hashMap.put("room_name",fieldSetEntity.getValue("room_name").toString());
+                    hashMap.put("uuid",fieldSetEntity.getValue("meet_room_uuid").toString());
+                    list.add(fieldSetEntity.getValue("room_name").toString());
+                    listDate.add(hashMap);
                 }
-
             }
-            listDate.add(hashMap);
 
         }
         return  listDate;
@@ -505,16 +509,23 @@
     }
 
     @Override
-    public HashMap getSignInfo(FieldSetEntity fse) throws BaseException {
+    public HashMap getSignOrVisitInfo(FieldSetEntity fse) throws BaseException {
 
        String meeting_uuid = fse.getString("meeting_uuid");
+       //type=1灏辨槸绛惧埌鏁版嵁锛宼ype=2灏辨槸璁块棶鏁版嵁
+       String type = fse.getString("type");
         List<Object> params=new ArrayList<>();
         params.add(meeting_uuid);
         params.add(meeting_uuid);
 
         StringBuilder sb=new StringBuilder();
         sb.append(" SELECT c.* FROM ( ");
-        sb.append(" SELECT b.staff_id,b.uuid as meeting_uuid,f.show_name,l.uuid as dept_uuid,l.org_level_name,n.sign_status ");
+        sb.append(" SELECT b.staff_id,b.uuid as meeting_uuid,f.show_name,l.uuid as dept_uuid,l.org_level_name,");
+        if(type.equals("1")){
+         sb.append(" n.sign_status");
+        }else {
+            sb.append(" n.visit_status");
+        }
         sb.append(" FROM (" );
         sb.append(" SELECT y.*, ");
         sb.append(" SUBSTRING_INDEX( SUBSTRING_INDEX( participator, ',', n ), ',', - 1 ) AS staff_id");
@@ -526,7 +537,12 @@
         sb.append(" )b ");
         sb.append(" LEFT JOIN product_sys_staffs f on b.staff_id=f.user_id ");
         sb.append(" LEFT JOIN product_sys_org_levels l on f.dept_uuid=l.uuid ");
-        sb.append(" LEFT JOIN product_oa_conference_sign n on b.staff_id=n.user_id and n.meeting_uuid=? ");
+        if(type.equals("1")){
+            sb.append(" LEFT JOIN product_oa_conference_sign n ");
+        }else {
+            sb.append(" LEFT JOIN product_oa_conference_visit n ");
+        }
+        sb.append(" on b.staff_id=n.user_id and n.meeting_uuid=? ");
         sb.append(" )c");
 
         DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(),params.toArray());
@@ -564,7 +580,7 @@
         List<String> list1=new ArrayList();
         List<String> list2=new ArrayList();
         for (int j = 0; j < listDate.size(); j++) {
-            if(ObjectUtil.isNotEmpty(listDate.get(j).get("sign_status"))&&listDate.get(j).get("sign_status").equals("宸茬鍒�")){
+            if((ObjectUtil.isNotEmpty(listDate.get(j).get("sign_status"))&&listDate.get(j).get("sign_status").equals("宸茬鍒�")) || (ObjectUtil.isNotEmpty(listDate.get(j).get("visit_status"))&&listDate.get(j).get("visit_status").equals("宸茶闂�"))  ){
                 if(!list1.contains(listDate.get(j).get("org_level_name"))){
                     list1.add(listDate.get(j).get("org_level_name").toString());
                     HashMap<String,Object> hashMap=new HashMap<>();
@@ -595,11 +611,94 @@
             }
         }
         sign_down=sign_all-sign_count;
-        hashMapResult.put("sign_down",sign_count);
-        hashMapResult.put("no_sign",sign_down);
-        hashMapResult.put("listDateNoSign",listDateNoSign);
-        hashMapResult.put("listDateSign",listDateSign);
+        hashMapResult.put("signOrvisit_down",sign_count);
+        hashMapResult.put("no_signOrvisit",sign_down);
+        hashMapResult.put("listDateNoSignOrVisit",listDateNoSign);
+        hashMapResult.put("listDateSignOrVisit",listDateSign);
         return  hashMapResult;
+    }
+
+    @Override
+    public void sendMsg(FieldSetEntity fse) throws BaseException {
+
+        String meeting_uuid= fse.getString("meeting_uuid");
+        String type = fse.getString("type");
+        String user_ids = fse.getString("user_ids");
+
+        FieldSetEntity product_oa_conference_apply = baseDao.getFieldSetEntity("product_oa_conference_apply", meeting_uuid, false);
+
+
+        //姝ゆ柟寮忔槸鏍规嵁鍚庡彴鑷姩缁熻鏈闂汉鍛�
+       /* List<Object> params=new ArrayList<>();
+        params.add(meeting_uuid);
+        params.add(meeting_uuid);
+
+        StringBuilder sb=new StringBuilder();
+        sb.append(" SELECT c.* FROM ( ");
+        sb.append(" SELECT b.staff_id,b.uuid as meeting_uuid,f.show_name,l.uuid as dept_uuid,l.org_level_name,");
+        if(type.equals("1")){
+            sb.append(" n.sign_status");
+        }else {
+            sb.append(" n.visit_status");
+        }
+        sb.append(" FROM (" );
+        sb.append(" SELECT y.*, ");
+        sb.append(" SUBSTRING_INDEX( SUBSTRING_INDEX( participator, ',', n ), ',', - 1 ) AS staff_id");
+        sb.append(" FROM product_oa_conference_apply y, ");
+        sb.append(" ( SELECT @rownum := @rownum + 1 AS n FROM ( SELECT @rownum := 0 ) r, product_oa_conference_apply ) x ");
+        sb.append(" WHERE 1 = 1 ");
+        sb.append(" AND n <= ( LENGTH( participator ) - LENGTH( REPLACE ( participator, ',', '' ) ) + 1 )");
+        sb.append(" and y.uuid= ? ");
+        sb.append(" )b ");
+        sb.append(" LEFT JOIN product_sys_staffs f on b.staff_id=f.user_id ");
+        sb.append(" LEFT JOIN product_sys_org_levels l on f.dept_uuid=l.uuid ");
+        if(type.equals("1")){
+            sb.append(" LEFT JOIN product_oa_conference_sign n ");
+        }else {
+            sb.append(" LEFT JOIN product_oa_conference_visit n ");
+        }
+        sb.append(" on b.staff_id=n.user_id and n.meeting_uuid=? ");
+        sb.append(" )c");
+        if(type.equals("1")){
+            sb.append("  where c.sign_status is NULL");
+        }else {
+            sb.append("  where c.visit_status is NULL");
+        }
+
+        DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), params.toArray());
+          String user_ids = "";
+        for (int i = 0; i < dataTableEntity.getRows(); i++) {
+            FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
+            if((i+1)==dataTableEntity.getRows()){
+                user_ids=user_ids+fieldSetEntity.getString("staff_id");
+            }else {
+                user_ids=user_ids+fieldSetEntity.getString("staff_id")+",";
+            }
+
+        }*/
+        String content="";
+        if(type.equals("1")){
+            content="浼氳灏嗗紑濮嬬鍒�,"+product_oa_conference_apply.getString("meeting_topic")+"-"+product_oa_conference_apply.getString("start_time")+",璇锋寜鏃剁鍒�";
+        }else {
+            content="鎮ㄦ湁鍦轰細璁渶瑕佸弬涓�,"+product_oa_conference_apply.getString("meeting_topic")+"-"+product_oa_conference_apply.getString("start_time")+",璇锋煡鐪嬩細璁鎯�";
+        }
+        SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
+        int user_id = currentUser.getUser_id();
+        String send_user=user_id+"";
+        //String reminder_mode = product_oa_conference_apply.getString("reminder_mode");
+     /*   //鐭俊
+        if(reminder_mode.equals("0")){
+        }
+        //閭欢
+        if(reminder_mode.equals("1")){
+
+        }
+        //绯荤粺娑堟伅
+        if(reminder_mode.equals("2")){
+
+        }*/
+        WebsocketMesssageServiceThread.getInstance().appendMessage(user_ids, content, "浼氳鎻愰啋", 1,"1", "", "", send_user, 1, 0, 0);
+
     }
 
 
@@ -841,6 +940,38 @@
             fieldSetEntity.setValue(CmnConst.CREATED_BY, fieldSetEntity.getString(CmnConst.CREATED_BY + "_save_value"));
             fieldSetEntity.setValue("meetint_type", fieldSetEntity.getString("meetint_type_save_value"));
         }
+
+
+        //瀛樺偍璁块棶璁板綍
+        SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
+        String fliter="meeting_uuid='"+fse.getUUID()+"' and  user_id='"+currentUser.getUser_id()+"'";
+        DataTableEntity product_oa_conference_visit = baseDao.listTable("product_oa_conference_visit", fliter);
+
+        if(product_oa_conference_visit.getRows()!=0){
+            FieldSetEntity fieldSetEntity1 = product_oa_conference_visit.getFieldSetEntity(0);
+            Integer visit_count = fieldSetEntity1.getInteger("visit_count");
+            visit_count++;
+            fieldSetEntity1.setValue("visit_count",visit_count);
+            fieldSetEntity1.setValue("visit_date_new",new Date());
+            baseDao.update(fieldSetEntity1);
+        }else {
+        FieldSetEntity fieldSetEntityVisit = new FieldSetEntity();
+        fieldSetEntityVisit.setTableName("product_oa_conference_visit");
+        fieldSetEntityVisit.setValue("visit_user",currentUser.getUser_name());
+        fieldSetEntityVisit.setValue("user_id",currentUser.getUser_id());
+        fieldSetEntityVisit.setValue("org_level_uuid","00000000-0000-0000-0000-000000000000");
+        fieldSetEntityVisit.setValue("organization",currentUser.getDept_uuid());
+        fieldSetEntityVisit.setValue("organization_name",currentUser.getCurrentDept().getString("org_level_name"));
+        fieldSetEntityVisit.setValue("visit_date_first",new Date());
+        fieldSetEntityVisit.setValue("visit_date_new",new Date());
+        fieldSetEntityVisit.setValue("visit_count",1);
+        fieldSetEntityVisit.setValue("visit_status","宸茶闂�");
+        fieldSetEntityVisit.setValue("meeting_uuid",fse.getUUID());
+        BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fieldSetEntityVisit);
+        baseDao.add(fieldSetEntityVisit);
+        }
+
+
         return fieldSetEntity;
     }
 

--
Gitblit v1.9.2