许鹏程
2024-08-22 56ea74f3d449c9821b3b02bad61178c03b1d7e9a
Merge remote-tracking branch 'origin/master'
已修改3个文件
261 ■■■■■ 文件已修改
src/main/java/com/product/administration/controller/ConferenceManagerController.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/ConferenceManagerService.java 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/ide/IConferenceManagerService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/controller/ConferenceManagerController.java
@@ -19,7 +19,9 @@
import com.product.module.sys.config.SystemErrorCode;
import com.product.module.sys.version.ApiVersion;
import com.product.util.BaseUtil;
import org.omg.CORBA.DATA_CONVERSION;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -28,6 +30,9 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -533,18 +538,18 @@
                response.setDateHeader("Expires", 0);
                OutputStream stream = response.getOutputStream();
                //后端跳转地址
               // String content = ("http://www.baidu.com");
                JSONObject jsonData = new JSONObject();
                jsonData.put("uuid",uuid);
                jsonData.put("date",new Date());
                //jsonData.put("url",content);
                Date date = new Date();
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String formatDate = dateFormat.format(date);
                jsonData.put("date",formatDate);
                //获取一个二维码图片
                BitMatrix bitMatrix = conferenceManagerService.getQrCode(jsonData.toString());
                //以流的形式输出到前端
                MatrixToImageWriter.writeToStream(bitMatrix , "jpg" , stream);
            }
           }
        }
@@ -574,6 +579,55 @@
    }
    /**
     * 会议签到功能
     * @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);
        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());
        }
        String s = conferenceManagerService.ConferenceSign(fse);
        return OK(s);
    }
    /**
     * 获取签到信息
     * @param request
     * @return
     */
    @PostMapping("/get_signOrVisit_info/{version}")
    @ApiVersion(1)
    public String getSignOrVisitInfo(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.getSignOrVisitInfo(fse);
        return OK(signInfo);
    }
}
src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -1,7 +1,10 @@
package com.product.administration.service;
import cn.hutool.core.date.DateUnit;
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;
@@ -38,6 +41,7 @@
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.Format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -458,6 +462,158 @@
    }
    @Override
    public String ConferenceSign(FieldSetEntity fse) throws BaseException, ParseException {
        JSONObject jsonObject = new JSONObject();
        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);
            if(between>20){
                jsonObject.put("code","200");
                jsonObject.put("msg","二维码已失效");
                jsonObject.put("status","fail");
            }else {
                SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
                FieldSetEntity fieldSetEntity = new FieldSetEntity();
                fieldSetEntity.setTableName("product_oa_conference_sign");
                fieldSetEntity.setValue("sign_user",currentUser.getUser_name());
                fieldSetEntity.setValue("user_id",currentUser.getUser_id());
                fieldSetEntity.setValue("org_level_uuid","00000000-0000-0000-0000-000000000000");
                fieldSetEntity.setValue("organization",currentUser.getDept_uuid());
                fieldSetEntity.setValue("organization_name",currentUser.getCurrentDept().getString("org_level_name"));
                fieldSetEntity.setValue("sign_date",new Date());
                fieldSetEntity.setValue("sign_status","已签到");
                fieldSetEntity.setValue("meeting_uuid",uuid);
                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 getSignOrVisitInfo(FieldSetEntity fse) throws BaseException {
       String meeting_uuid = fse.getString("meeting_uuid");
       //type=1就是签到数据,type=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,");
        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");
        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("signOrvisit_down",sign_count);
        hashMapResult.put("no_signOrvisit",sign_down);
        hashMapResult.put("listDateNoSignOrVisit",listDateNoSign);
        hashMapResult.put("listDateSignOrVisit",listDateSign);
        return  hashMapResult;
    }
    /**
     * 会议室使用情况
@@ -697,6 +853,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;
    }
src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
@@ -7,6 +7,7 @@
import com.product.core.exception.BaseException;
import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
@@ -46,6 +47,12 @@
    void  CancelAndStart(FieldSetEntity fse)throws  BaseException;
    String ConferenceSign(FieldSetEntity fse) throws BaseException, ParseException;
    HashMap  getSignOrVisitInfo(FieldSetEntity fse) throws  BaseException;