From 0b9605b411d7aa07c704153d8c3ff4baa0dc1a66 Mon Sep 17 00:00:00 2001
From: 18756 <1875631620@qq.com>
Date: 星期四, 22 八月 2024 10:06:12 +0800
Subject: [PATCH] 会议室功能签到信息8.22

---
 src/main/java/com/product/administration/service/ide/IConferenceManagerService.java  |    2 
 src/main/java/com/product/administration/controller/ConferenceManagerController.java |   50 +++++++++++++---
 src/main/java/com/product/administration/service/ConferenceManagerService.java       |  116 +++++++++++++++++++++++++++++++++++---
 3 files changed, 149 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/product/administration/controller/ConferenceManagerController.java b/src/main/java/com/product/administration/controller/ConferenceManagerController.java
index d1c0944..4be1f50 100644
--- a/src/main/java/com/product/administration/controller/ConferenceManagerController.java
+++ b/src/main/java/com/product/administration/controller/ConferenceManagerController.java
@@ -518,19 +518,19 @@
      * @throws IOException
      * @throws WriterException
      */
-    @GetMapping("/get_QrCode/{version}")
+    @PostMapping("/get_QrCode/{version}")
     @ApiVersion(1)
-    public void getQrCode(String uuid,HttpServletRequest request, HttpServletResponse response) throws IOException, WriterException {
+    public void getQrCode(HttpServletRequest request, HttpServletResponse response) throws IOException, WriterException {
 
         //鑾峰彇鍙傛暟
         FieldSetEntity fse = null;
-      /*  Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
         if (bean != null) {
             RequestParameterEntity reqp = (RequestParameterEntity) bean;
             fse = reqp.getFormData();
 
-            if(fse!=null &&  !StringUtils.isEmpty(fse.getString("uuid"))){*/
-              //  String uuid = fse.getString("uuid");
+            if(fse!=null &&  !StringUtils.isEmpty(fse.getString("uuid"))){
+                String uuid = fse.getString("uuid");
                 // 璁剧疆鍝嶅簲娴佷俊鎭�
                 response.setContentType("image/jpg");
                 response.setHeader("Pragma", "no-cache");
@@ -549,9 +549,8 @@
                 BitMatrix bitMatrix = conferenceManagerService.getQrCode(jsonData.toString());
                 //浠ユ祦鐨勫舰寮忚緭鍑哄埌鍓嶇
                 MatrixToImageWriter.writeToStream(bitMatrix , "jpg" , stream);
-
-           // }
-        //}
+           }
+        }
 
 
     }
@@ -580,12 +579,18 @@
     }
 
 
+    /**
+     * 浼氳绛惧埌鍔熻兘
+     * @param request
+     * @return
+     * @throws ParseException
+     */
     @PostMapping("/conference_sign/{version}")
     @ApiVersion(1)
     public  String ConferenceSign(HttpServletRequest request) throws ParseException {
         //鑾峰彇鍙傛暟
         FieldSetEntity fse = null;
-        /*Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
         if (bean != null) {
             RequestParameterEntity reqp = (RequestParameterEntity) bean;
             fse = reqp.getFormData();
@@ -593,11 +598,36 @@
         //鍒ゆ柇鍙傛暟鏄惁涓虹┖
         if (bean == null || fse == null) {
             return this.error(com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getValue(), com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getText());
-        }*/
+        }
         String s = conferenceManagerService.ConferenceSign(fse);
         return OK(s);
     }
 
 
+    /**
+     * 鑾峰彇绛惧埌淇℃伅
+     * @param request
+     * @return
+     */
+    @PostMapping("/get_sign_info/{version}")
+    @ApiVersion(1)
+    public String getSignInfo(HttpServletRequest request){
+
+        FieldSetEntity fse = null;
+        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+        if (bean != null) {
+            RequestParameterEntity reqp = (RequestParameterEntity) bean;
+            fse = reqp.getFormData();
+        }
+        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
+        if (bean == null || fse == null) {
+            return this.error(com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getValue(), com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getText());
+        }
+        HashMap signInfo = conferenceManagerService.getSignInfo(fse);
+        return OK(signInfo);
+
+    }
+
+
 
 }
diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java
index e6eac8d..f221f49 100644
--- a/src/main/java/com/product/administration/service/ConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -467,19 +467,19 @@
 
 
         JSONObject jsonObject = new JSONObject();
-       /* if(!StringUtils.isEmpty(fse.getString("uuid"))&&!StringUtils.isEmpty(fse.getString("date"))){*/
-            /*String uuid = fse.getString("uuid");
+        if(!StringUtils.isEmpty(fse.getString("uuid"))&&!StringUtils.isEmpty(fse.getString("date"))){
+            String uuid = fse.getString("uuid");
             String date = fse.getString("date");
             SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date parseDate = dateFormat.parse(date);
-            long between = DateUtil.between(parseDate, new Date(), DateUnit.SECOND);*/
-               String uuid="5591f2ea-b7bd-49c4-999a-9a1045edc717";
-           /* if(between>20){
+            long between = DateUtil.between(parseDate, new Date(), DateUnit.SECOND);
+
+            if(between>20){
                 jsonObject.put("code","200");
                 jsonObject.put("msg","浜岀淮鐮佸凡澶辨晥");
                 jsonObject.put("status","fail");
 
-            }else {*/
+            }else {
 
                 SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
                 FieldSetEntity fieldSetEntity = new FieldSetEntity();
@@ -493,17 +493,115 @@
                 fieldSetEntity.setValue("sign_status","宸茬鍒�");
                 fieldSetEntity.setValue("meeting_uuid",uuid);
 
-               // BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse);
+                BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse);
                 baseDao.add(fieldSetEntity);
                 jsonObject.put("code","200");
                 jsonObject.put("msg","绛惧埌鎴愬姛");
                 jsonObject.put("status","sucess");
-           /* }*/
-      /*  }*/
+            }
+        }
 
         return jsonObject.toString();
     }
 
+    @Override
+    public HashMap getSignInfo(FieldSetEntity fse) throws BaseException {
+
+       String meeting_uuid = fse.getString("meeting_uuid");
+        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(" 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 ");
+        sb.append(" LEFT JOIN product_oa_conference_sign n on b.staff_id=n.user_id and n.meeting_uuid=? ");
+        sb.append(" )c");
+
+        DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(),params.toArray());
+        List<HashMap> listDate=new ArrayList<>();
+        List<HashMap> listDateSign=new ArrayList<>();
+        List<HashMap> listDateNoSign=new ArrayList<>();
+
+        List<String> list=new ArrayList();
+
+        int sign_count=0;
+        int sign_all=0;
+        int sign_down=0;
+        HashMap<String,Object> hashMapResult=new HashMap<>();
+        for (int i = 0; i < dataTableEntity.getRows(); i++) {
+            FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
+
+            if(!list.contains(fieldSetEntity.getString("org_level_name"))){
+                HashMap<String,Object> hashMap=new HashMap<>();
+                hashMap.put("dept_uuid",fieldSetEntity.getString("dept_uuid"));
+                hashMap.put("org_level_name",fieldSetEntity.getString("org_level_name"));
+                list.add(fieldSetEntity.getString("org_level_name"));
+                listDate.add(hashMap);
+            }
+
+            fieldSetEntity.setValue("parent",fieldSetEntity.getString("dept_uuid"));
+            HashMap<String,Object> hashMap=new HashMap<>();
+            for (int j = 0; j < fieldSetEntity.getValues().keySet().size(); j++) {
+                hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString()));
+
+            }
+            listDate.add(hashMap);
+
+        }
+        sign_all=listDate.size();
+        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(!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<>();
+                    hashMap.put("dept_uuid",listDate.get(j).get("dept_uuid"));
+                    hashMap.put("org_level_name",listDate.get(j).get("org_level_name"));
+                    listDateSign.add(hashMap);
+                }
+                sign_count++;
+                //閬垮厤閲嶅娣诲姞閮ㄩ棬
+                if(listDate.get(j).size()!=2){
+                    listDateSign.add(listDate.get(j));
+                }
+
+            }else {
+                if(!list2.contains(listDate.get(j).get("org_level_name"))){
+                    list2.add(listDate.get(j).get("org_level_name").toString());
+                    HashMap<String,Object> hashMap=new HashMap<>();
+                    hashMap.put("dept_uuid",listDate.get(j).get("dept_uuid"));
+                    hashMap.put("org_level_name",listDate.get(j).get("org_level_name"));
+                    listDateNoSign.add(hashMap);
+                }
+                //閬垮厤閲嶅娣诲姞閮ㄩ棬
+                if(listDate.get(j).size()!=2){
+                    listDateNoSign.add(listDate.get(j));
+                }
+
+
+            }
+        }
+        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);
+        return  hashMapResult;
+    }
+
 
     /**
      * 浼氳瀹や娇鐢ㄦ儏鍐�
diff --git a/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java b/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
index 389a4d8..ed3a691 100644
--- a/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
@@ -49,6 +49,8 @@
 
     String ConferenceSign(FieldSetEntity fse) throws BaseException, ParseException;
 
+    HashMap  getSignInfo(FieldSetEntity fse) throws  BaseException;
+
 
 
 

--
Gitblit v1.9.2