许鹏程
2024-08-23 394d19ca078d342474a8803db3186452348ac113
Merge remote-tracking branch 'origin/master'
已修改3个文件
203 ■■■■ 文件已修改
src/main/java/com/product/administration/controller/ConferenceManagerController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/ConferenceManagerService.java 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/ide/IConferenceManagerService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/controller/ConferenceManagerController.java
@@ -11,7 +11,6 @@
import com.product.administration.service.ide.IConferenceManagerService;
import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
@@ -19,9 +18,7 @@
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;
@@ -30,7 +27,6 @@
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;
@@ -605,7 +601,7 @@
    /**
     * 获取签到信息
     * 获取签到或者访问信息
     * @param request
     * @return
     */
@@ -628,6 +624,28 @@
    }
    /**
     * 发送消息
     * @param request
     * @return
     */
    @PostMapping("/sendMsg/{version}")
    @ApiVersion(1)
    public String sendMsg(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());
        }
        conferenceManagerService.sendMsg(fse);
        return OK();
    }
}
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;
@@ -509,7 +513,7 @@
       String meeting_uuid = fse.getString("meeting_uuid");
       //type=1就是签到数据,type=2就是访问数据
        String type = fse.getString("type");
       String type = fse.getString("type");
        List<Object> params=new ArrayList<>();
        params.add(meeting_uuid);
        params.add(meeting_uuid);
@@ -576,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<>();
@@ -614,6 +618,89 @@
        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);
    }
    /**
     * 会议室使用情况
src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
@@ -51,6 +51,8 @@
    HashMap  getSignOrVisitInfo(FieldSetEntity fse) throws  BaseException;
     void sendMsg(FieldSetEntity fse) throws  BaseException;