| | |
| | | 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.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import com.product.administration.config.CmnConst; |
| | | import com.product.administration.config.SystemCode; |
| | | import com.product.administration.service.ide.IConferenceManagerService; |
| | |
| | | import com.product.core.transfer.Transactional; |
| | | import com.product.core.websocket.service.WebsocketMesssageServiceThread; |
| | | import com.product.module.sys.entity.SystemUser; |
| | | import com.product.oa.task.service.TaskDistributionService; |
| | | import com.product.util.BaseUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.text.DecimalFormat; |
| | | import java.text.Format; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | QueryFilterService queryFilterService; |
| | | @Autowired |
| | | PermissionService permissionService; |
| | | @Autowired |
| | | TaskDistributionService taskDistributionService; |
| | | |
| | | /** |
| | | * 会议室列表 |
| | | * 会议室配置列表 |
| | | * |
| | | * @param fse |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 会议室详情 |
| | | * 会议室配置详情 |
| | | * |
| | | * @param fse |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存会议室 |
| | | * 保存会配置议室 |
| | | * |
| | | * @param fse |
| | | * @return |
| | |
| | | if (nameVerification!=null) { |
| | | throw new BaseException(SystemCode.CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME.getValue(), SystemCode.CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME.getText()); |
| | | } |
| | | |
| | | BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse); |
| | | //重名验证 |
| | | |
| | | return baseDao.saveFieldSetEntity(fse); |
| | | } |
| | | |
| | | /** |
| | | * 删除会议室 |
| | | * 会议室配置删除 |
| | | * |
| | | * @param fse |
| | | * @return |
| | |
| | | public boolean delConferenceApply(FieldSetEntity fse) throws BaseException { |
| | | return baseDao.delete(fse.getTableName(), fse.getUUID().split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 会议看板信息 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public DataTableEntity getKanBanData(FieldSetEntity fse) { |
| | | String queryStartDate = fse.getString("query_start_date"); |
| | | String queryEndDate = fse.getString("query_end_date"); |
| | | String meeting_resource = fse.getString("meeting_resource"); |
| | | StringBuilder sbSql = new StringBuilder(); |
| | | sbSql.append("SELECT \n"); |
| | | sbSql.append(" A.meeting_room AS meeting_room_uuid, \n"); |
| | | sbSql.append(" start_time, \n"); |
| | | sbSql.append(" end_time, \n"); |
| | | sbSql.append(" DATE(start_time) as start_date, \n"); |
| | | sbSql.append(" DATE(end_time) as end_date, \n"); |
| | | sbSql.append(" TIME(start_time) as start_time_part, \n"); |
| | | sbSql.append(" TIME(end_time) as end_time_part, \n"); |
| | | sbSql.append(" HOUR(start_time) as start_hour, \n"); |
| | | sbSql.append(" HOUR(end_time) as end_hour, \n"); |
| | | sbSql.append(" DATEDIFF(end_time, start_time) AS diff_day, \n"); |
| | | sbSql.append(" (SELECT room_name FROM product_oa_conference_room_config WHERE uuid = A.meeting_room) as meeting_room \n"); |
| | | sbSql.append("FROM product_oa_conference_apply A \n"); |
| | | sbSql.append("WHERE (end_time >= ? AND start_time <= ?)"); |
| | | sbSql.append("AND status != '已取消'"); |
| | | |
| | | DataTableEntity dtRecord = baseDao.listTable(sbSql.toString(), new Object[] {queryStartDate, queryEndDate + " 23:59:59"}); |
| | | String replace_meeting_resource=""; |
| | | if(!StringUtils.isEmpty(meeting_resource)){ |
| | | |
| | | String[] split = meeting_resource.split(","); |
| | | for (int i = 0; i < split.length; i++) { |
| | | replace_meeting_resource += "CONCAT(',', enable_seal, ',') LIKE '%,"+split[i]+",%'"; |
| | | if(i!=split.length-1){ |
| | | replace_meeting_resource += " and "; |
| | | } |
| | | } |
| | | } |
| | | DataTableEntity dtRoom = baseDao.listTable(CmnConst.PRODUCT_OA_CONFERENCE_ROOM_CONFIG, replace_meeting_resource); |
| | | |
| | | // 初始化会议室记录 |
| | | Map<String, FieldSetEntity> roomRecord = new HashMap<>(); |
| | | for (int i = 0; i < dtRoom.getRows(); i++) { |
| | | FieldSetEntity fseRoom = dtRoom.getFieldSetEntity(i); |
| | | FieldSetEntity fseRoomMeeting = new FieldSetEntity(CmnConst.PRODUCT_OA_CONFERENCE_APPLY); |
| | | fseRoomMeeting.setValue("room_name", fseRoom.getString("room_name")); |
| | | fseRoomMeeting.setValue("room_uuid", fseRoom.getString("uuid")); |
| | | roomRecord.put(fseRoom.getString("room_name"), fseRoomMeeting); |
| | | } |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDate queryStart = LocalDate.parse(queryStartDate, formatter); |
| | | LocalDate queryEnd = LocalDate.parse(queryEndDate, formatter); |
| | | |
| | | // 处理会议记录 |
| | | for (int i = 0; i < dtRecord.getRows(); i++) { |
| | | FieldSetEntity record = dtRecord.getFieldSetEntity(i); |
| | | String meetingRoom = record.getString("meeting_room"); |
| | | if (!roomRecord.containsKey(meetingRoom)) continue; |
| | | |
| | | FieldSetEntity roomMeeting = roomRecord.get(meetingRoom); |
| | | |
| | | String startDateStr = record.getString("start_date"); |
| | | String endDateStr = record.getString("end_date"); |
| | | String startTime = record.getString("start_time_part"); |
| | | String endTime = record.getString("end_time_part"); |
| | | int startHour = record.getInteger("start_hour"); |
| | | int endHour = record.getInteger("end_hour"); |
| | | int diffDay = record.getInteger("diff_day"); |
| | | |
| | | LocalDate startDate = LocalDate.parse(startDateStr, formatter); |
| | | LocalDate endDate = LocalDate.parse(endDateStr, formatter); |
| | | |
| | | if (diffDay > 0) { |
| | | // 跨天会议 - 处理每一天 |
| | | LocalDate currentDate = startDate.isBefore(queryStart) ? queryStart : startDate; |
| | | LocalDate lastDate = endDate.isAfter(queryEnd) ? queryEnd : endDate; |
| | | |
| | | while (!currentDate.isAfter(lastDate)) { |
| | | DayOfWeek dayOfWeek = currentDate.getDayOfWeek(); |
| | | boolean isFirstDay = currentDate.equals(startDate); |
| | | boolean isLastDay = currentDate.equals(endDate); |
| | | |
| | | if (isFirstDay) { |
| | | // 开始日 |
| | | if (startHour < 12) { |
| | | // 上午开始,拆分成上午段和下午全天 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_AM", startTime + "-12:00:00"); |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", "12:00:00-00:00:00"); |
| | | } else { |
| | | // 下午开始,只有下午段 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", startTime + "-00:00:00"); |
| | | } |
| | | } else if (isLastDay) { |
| | | // 结束日 |
| | | // 上午全天 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_AM", "00:00:00-12:00:00"); |
| | | if (endHour >= 12) { |
| | | // 结束在下午,拆分成上午全天和下午段 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", "12:00:00-" + endTime); |
| | | } |
| | | } else { |
| | | // 中间日 - 全天 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_AM", "00:00:00-12:00:00"); |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", "12:00:00-00:00:00"); |
| | | } |
| | | |
| | | currentDate = currentDate.plusDays(1); |
| | | } |
| | | } else { |
| | | // 单天会议 |
| | | LocalDate date = LocalDate.parse(startDateStr, formatter); |
| | | DayOfWeek dayOfWeek = date.getDayOfWeek(); |
| | | |
| | | if (startHour < 12 && endHour > 12) { |
| | | // 跨上下午的会议,拆分成上午段和下午段 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_AM", startTime + "-12:00:00"); |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", "12:00:00-" + endTime); |
| | | } else if (startHour < 12) { |
| | | // 纯上午会议 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_AM", startTime + "-" + endTime); |
| | | } else { |
| | | // 纯下午会议 |
| | | addTimeSlot(roomMeeting, dayOfWeek + "_PM", startTime + "-" + endTime); |
| | | } |
| | | } |
| | | } |
| | | |
| | | DataTableEntity dtKanBan = new DataTableEntity(); |
| | | for (FieldSetEntity fseKanban : roomRecord.values()) { |
| | | dtKanBan.addFieldSetEntity(fseKanban); |
| | | } |
| | | return dtKanBan; |
| | | } |
| | | |
| | | private void addTimeSlot(FieldSetEntity roomMeeting, String field, String timeSlot) { |
| | | String existing = roomMeeting.getString(field); |
| | | if (StringUtils.isEmpty(existing)) { |
| | | roomMeeting.setValue(field, timeSlot); |
| | | } else { |
| | | roomMeeting.setValue(field, existing + "," + timeSlot); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 会议看板-会议记录 |
| | | */ |
| | | @Override |
| | | public DataTableEntity getMeetingRecords(FieldSetEntity fse) throws BaseException { |
| | | String meeting_room = fse.getString("meeting_room"); |
| | | String meeting_start_date = fse.getString("meeting_start_date"); |
| | | String meeting_end_date = fse.getString("meeting_end_date"); |
| | | String meeting_resource = fse.getString("meeting_resource"); |
| | | String replace_meeting_resource=""; |
| | | if(!StringUtils.isEmpty(meeting_resource)){ |
| | | |
| | | String[] split = meeting_resource.split(","); |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(i!=split.length-1){ |
| | | replace_meeting_resource=replace_meeting_resource+"T1.meeting_resource like '%"+split[i]+"%' and "; |
| | | }else { |
| | | replace_meeting_resource=replace_meeting_resource+"T1.meeting_resource like '%"+split[i]+"%'"; |
| | | } |
| | | } |
| | | } |
| | | if(!StringUtils.isEmpty(meeting_room)&&!StringUtils.isEmpty(meeting_start_date)&&!StringUtils.isEmpty(meeting_end_date)){ |
| | | List<Object>param=new ArrayList<>(); |
| | | param.add(meeting_room); |
| | | param.add(meeting_start_date); |
| | | param.add(meeting_end_date); |
| | | StringBuilder sb=new StringBuilder(); |
| | | sb.append("\nSELECT "); |
| | | sb.append("\n b.uuid,b.meeting_topic,b.status,b.meeting_recorder as meeting_recorder_uuid,"); |
| | | sb.append("\n b.start_time,b.end_time,DATE_FORMAT(b.start_time,'%Y-%m-%d') as meeting_date,"); |
| | | sb.append("\n (select user_name from product_sys_users where user_id=b.meeting_recorder) as meeting_recorder,"); |
| | | sb.append("\n (select user_name from product_sys_users where user_id=b.meeting_master) as meeting_master,"); |
| | | sb.append("\n CONCAT(DATE_FORMAT(b.start_time,\"%H:%i\"),'~',DATE_FORMAT(b.end_time,\"%H:%i\")) as time_quantum,"); |
| | | sb.append("\n GROUP_CONCAT(b.dict_label SEPARATOR ',') AS meeting_resouces,"); |
| | | sb.append("\n C.uuid AS minute_uuid,C.flow_flag AS minute_flow_flag"); |
| | | sb.append("\nFROM ("); |
| | | sb.append("\n SELECT DISTINCT a.uuid,a.start_time,a.end_time,a.meeting_topic,a.meeting_recorder,a.meeting_master,a.status,t.dict_label "); |
| | | sb.append("\n FROM ("); |
| | | sb.append("\n SELECT T1.*, "); |
| | | sb.append("\n SUBSTRING_INDEX( SUBSTRING_INDEX( T1.meeting_resource, ',', T2.digit + 1 ), ',',- 1 ) AS type "); |
| | | sb.append("\n FROM product_oa_conference_apply T1 "); |
| | | sb.append("\n LEFT JOIN ("); |
| | | sb.append("\n SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 "); |
| | | sb.append("\n ) T2"); |
| | | sb.append("\n ON T2.digit < ( length( T1.meeting_resource )- length( REPLACE ( T1.meeting_resource, ',', '' ))+ 1 )"); |
| | | sb.append("\n WHERE T1.meeting_room = ? "); |
| | | sb.append("\n AND T1.start_time between ? AND ? "); |
| | | if(!StringUtils.isEmpty(meeting_resource)){ |
| | | sb.append(" AND ("+replace_meeting_resource+" )"); |
| | | } |
| | | sb.append("\n ) a"); |
| | | sb.append("\n LEFT JOIN product_sys_dict t ON a.type = t.dict_value AND t.dict_name = '会议室资源'"); |
| | | sb.append("\n)b "); |
| | | sb.append("\nLEFT JOIN product_oa_conference_minute C ON C.meeting_uuid = B.uuid"); |
| | | sb.append("\nGROUP BY b.uuid,b.start_time,b.end_time,b.meeting_topic,b.meeting_recorder,b.meeting_master,b.status,C.uuid,C.flow_flag "); |
| | | DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray()); |
| | | if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) { |
| | | for (int i = 0; i < dataTableEntity.getRows(); i++) { |
| | | FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i); |
| | | String status = fieldSetEntity.getString("status"); |
| | | Date startTime = fieldSetEntity.getDate("start_time"); |
| | | Date endTime = fieldSetEntity.getDate("end_time"); |
| | | Date date = new Date(); |
| | | //是否能够取消/编辑/启用 |
| | | if(date.before(startTime)){ |
| | | if("已取消".equals(status)) { |
| | | fieldSetEntity.setValue("isRestart", true); |
| | | } else if ("已启用".equals(status) || BaseUtil.strIsNull(status)) { |
| | | fieldSetEntity.setValue("isCancel", true); |
| | | } |
| | | fieldSetEntity.setValue("isUpdate", true); |
| | | if (BaseUtil.strIsNull(status)) { |
| | | fieldSetEntity.setValue("status", "未开始"); |
| | | } |
| | | } else { |
| | | //是否能够录入会议纪要 |
| | | if(date.after(endTime)){ |
| | | if (BaseUtil.strIsNull(status)) { |
| | | fieldSetEntity.setValue("status", "已结束"); |
| | | } |
| | | fieldSetEntity.setValue("isFinish", true); |
| | | } else { |
| | | if (BaseUtil.strIsNull(status)) { |
| | | fieldSetEntity.setValue("status", "进行中"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return dataTableEntity; |
| | | }else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // @Override |
| | | // @Transactional |
| | | // public void saveOrUpdateMeetingInfo(FieldSetEntity fse) throws BaseException { |
| | | // |
| | | // Date start_time_date = fse.getDate("start_time"); |
| | | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // String format = dateFormat.format(start_time_date); |
| | | // |
| | | // |
| | | // String filter=" DATE_FORMAT(start_time,\"%Y-%m-%d\") ='"+format.split(" ")[0]+"'"; |
| | | // DataTableEntity dataTableEntity = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{}); |
| | | // boolean flag=true; |
| | | // for (int i = 0; i < dataTableEntity.getRows(); i++) { |
| | | // FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i); |
| | | // Date start_time = fse.getDate("start_time"); |
| | | // Date end_time = fse.getDate("end_time"); |
| | | // Date start_time1 =fieldSetEntity.getDate("start_time"); |
| | | // Date end_time1 = fieldSetEntity.getDate("end_time"); |
| | | // if(start_time1.before(start_time) && end_time1.after(start_time)){ |
| | | // flag=false; |
| | | // } |
| | | // if(start_time1.before(end_time) && end_time1.after(end_time)){ |
| | | // flag=false; |
| | | // } |
| | | // |
| | | // if(start_time1.after(start_time) && end_time1.before(end_time)){ |
| | | // flag=false; |
| | | // } |
| | | // |
| | | // } |
| | | // HashMap<String,Object> hashMap=new HashMap<>(); |
| | | // BaseUtil.createCreatorAndCreationTime(fse); |
| | | // if(flag==false){ |
| | | // throw new BaseException("", "时间段被占用"); |
| | | // } |
| | | // baseDao.saveFieldSetEntity(fse); |
| | | // } |
| | | |
| | | @Override |
| | | public List getKbData(FieldSetEntity fse) throws BaseException { |
| | | public BitMatrix getQrCode(String content) throws BaseException, WriterException, IOException { |
| | | |
| | | List<Object>param=new ArrayList<>(); |
| | | String meeting_date= fse.getString("meeting_date"); |
| | | String meeting_resource = fse.getString("meeting_resource"); |
| | | param.add(meeting_date); |
| | | if(!StringUtils.isEmpty(meeting_resource)){ |
| | | String replace_meeting_resource = meeting_resource.replace(",", "%"); |
| | | meeting_resource="%"+replace_meeting_resource+"%"; |
| | | param.add(meeting_resource); |
| | | //二维码的宽高 |
| | | int width = 200; |
| | | int height = 200; |
| | | |
| | | //其他参数,如字符集编码 |
| | | Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | //容错级别为H |
| | | hints.put(EncodeHintType.ERROR_CORRECTION , ErrorCorrectionLevel.H); |
| | | //白边的宽度,可取0~4 |
| | | hints.put(EncodeHintType.MARGIN , 0); |
| | | |
| | | BitMatrix bitMatrix = null; |
| | | try { |
| | | |
| | | bitMatrix = new MultiFormatWriter().encode(content, |
| | | BarcodeFormat.QR_CODE, width, height, hints); |
| | | |
| | | } catch (WriterException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | 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\")=?"); |
| | | if(!StringUtils.isEmpty(meeting_resource)){ |
| | | bs.append(" and y.meeting_resource like ? "); |
| | | } |
| | | 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); |
| | | 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); |
| | | |
| | | } |
| | | 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); |
| | | }else { |
| | | hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString())); |
| | | } |
| | | |
| | | } |
| | | listDate.add(hashMap); |
| | | |
| | | } |
| | | return listDate; |
| | | return bitMatrix; |
| | | } |
| | | |
| | | @Override |
| | | public List getMeetingDetails(FieldSetEntity fse) throws BaseException { |
| | | public void CancelAndStart(FieldSetEntity fse) throws BaseException { |
| | | |
| | | String uuid = fse.getString("uuid"); |
| | | String filter=" uuid='"+uuid+"'"; |
| | | DataTableEntity product_oa_conference_apply = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{}); |
| | | if(product_oa_conference_apply.getRows()!=0){ |
| | | FieldSetEntity fieldSetEntity = product_oa_conference_apply.getFieldSetEntity(0); |
| | | if("已取消".equals(fieldSetEntity.getString("status"))){ |
| | | fieldSetEntity.setValue("status","已启用"); |
| | | }else { |
| | | fieldSetEntity.setValue("status","已取消"); |
| | | } |
| | | baseDao.update(fieldSetEntity); |
| | | } |
| | | |
| | | } |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | /** |
| | | * 获取会议访问/签到信息 |
| | | */ |
| | | public DataTableEntity getMeetingSignOrVisit(FieldSetEntity fse) throws BaseException { |
| | | String meeting_uuid = fse.getString("meeting_uuid"); |
| | | String type = fse.getString("type"); |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("\nSELECT c.* FROM ( "); |
| | | sb.append("\n 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("\n FROM (" ); |
| | | sb.append("\n SELECT y.*, "); |
| | | sb.append("\n SUBSTRING_INDEX( SUBSTRING_INDEX( participator, ',', n ), ',', - 1 ) AS staff_id"); |
| | | sb.append("\n FROM product_oa_conference_apply y,(SELECT @rownum := @rownum + 1 AS n FROM ( SELECT @rownum := 0 ) r, product_oa_conference_apply ) x "); |
| | | sb.append("\n WHERE 1 = 1 AND n <= ( LENGTH( participator ) - LENGTH( REPLACE ( participator, ',', '' ) ) + 1 )"); |
| | | sb.append("\n and y.uuid= ? "); |
| | | sb.append("\n )b "); |
| | | sb.append("\n LEFT JOIN product_sys_staffs f on b.staff_id=f.user_id "); |
| | | sb.append("\n LEFT JOIN product_sys_org_levels l on f.dept_uuid=l.uuid "); |
| | | if(type.equals("1")){ |
| | | sb.append("\n LEFT JOIN product_oa_conference_sign n "); |
| | | }else { |
| | | sb.append("\n LEFT JOIN product_oa_conference_visit n "); |
| | | } |
| | | sb.append("\n ON b.staff_id=n.user_id and n.meeting_uuid=? "); |
| | | sb.append("\n)c"); |
| | | // 获取会议访问/签到信息 |
| | | DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), new Object[] {meeting_uuid, meeting_uuid}); |
| | | // 遍历会议访问/签到信息 |
| | | for (int i = 0; i < dataTableEntity.getRows(); i++) { |
| | | FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i); |
| | | } |
| | | return dataTableEntity; |
| | | } |
| | | |
| | | @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); |
| | | |
| | | |
| | | return null; |
| | | //此方式是根据后台自动统计未访问人员 |
| | | /* 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); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | String startTime = fse.getString("startTime"); |
| | | String endTime = fse.getString("endTime"); |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" SELECT "); |
| | | sql.append(" a.uuid, "); |
| | | sql.append(" b.uuid apply_uuid, "); |
| | | sql.append(" a.room_name, "); |
| | | sql.append(" b.meeting_topic, "); |
| | | sql.append("\nSELECT "); |
| | | sql.append("\n a.uuid,b.uuid apply_uuid,a.room_name,b.meeting_topic, b.flow_flag, "); |
| | | if (com.product.admin.config.CmnConst.MOBILE_CLIENT_TYPE.equalsIgnoreCase(clientType)) { |
| | | //移动端 |
| | | sql.append(" date_format(b.start_time,'%Y-%m-%d %H:%i:%s') start_time, "); |
| | | sql.append(" date_format(b.end_time,'%Y-%m-%d %H:%i:%s') end_time, "); |
| | | } else { |
| | | |
| | | sql.append(" b.start_time, "); |
| | | sql.append(" b.end_time, "); |
| | | sql.append(" b.start_time, b.end_time, "); |
| | | } |
| | | sql.append(" b.flow_flag, "); |
| | | sql.append(" ( SELECT user_name FROM product_sys_users WHERE user_id = b.created_by ) proposer "); |
| | | sql.append(" FROM "); |
| | | sql.append(" product_oa_CONFERENCE_room_config a "); |
| | | sql.append(" LEFT JOIN ( SELECT flow_flag,meeting_room,uuid,meeting_topic,start_time,end_time,created_by FROM "); |
| | | sql.append(" product_oa_conference_apply b WHERE "); |
| | | sql.append("start_time>=? and start_time<=? or (end_time>=? and start_time<=?) "); |
| | | sql.append(" and start_time is not null and end_time is not null and flow_flag in (1,2) ) b "); |
| | | sql.append(" ON a.uuid = b.meeting_room "); |
| | | sql.append(" WHERE "); |
| | | sql.append(" a.`status` = 1 "); |
| | | sql.append(" AND org_level_uuid = ? "); |
| | | sql.append(" AND enabled_time <= now( ) "); |
| | | sql.append(" GROUP BY "); |
| | | sql.append(" a.uuid, "); |
| | | sql.append(" b.uuid, "); |
| | | sql.append(" a.room_name, "); |
| | | sql.append(" b.meeting_topic, "); |
| | | sql.append(" b.start_time, "); |
| | | sql.append(" b.end_time, "); |
| | | sql.append(" b.created_by,b.flow_flag "); |
| | | sql.append(" ORDER BY "); |
| | | sql.append(" b.start_time "); |
| | | sql.append("\n ( SELECT user_name FROM product_sys_users WHERE user_id = b.created_by ) proposer "); |
| | | sql.append("\nFROM product_oa_CONFERENCE_room_config a "); |
| | | sql.append("\nLEFT JOIN ("); |
| | | sql.append("\n SELECT flow_flag,meeting_room,uuid,meeting_topic,start_time,end_time,created_by "); |
| | | sql.append("\n FROM product_oa_conference_apply b "); |
| | | sql.append("\n WHERE start_time >= ? and start_time <= ? or (end_time >= ? and start_time <= ?) "); |
| | | sql.append("\n and start_time is not null and end_time is not null and flow_flag in (1,2) "); |
| | | sql.append("\n) b"); |
| | | sql.append("\nON a.uuid = b.meeting_room "); |
| | | //这个东西取消了 |
| | | // sql.append("\nWHERE a.`status` = 1 AND org_level_uuid = ? AND enabled_time <= now() "); |
| | | sql.append("\nWHERE a.`status` = 1 AND org_level_uuid = ? "); |
| | | sql.append("\nGROUP BY a.uuid, b.uuid,a.room_name,b.meeting_topic,b.start_time,b.end_time,b.created_by,b.flow_flag "); |
| | | sql.append("\nORDER BY b.start_time "); |
| | | DataTableEntity dt = baseDao.listTable(sql.toString(), new Object[]{startTime, endTime, startTime, endTime, org_level_uuid}); |
| | | dt.getMeta().addAliasTable(CmnConst.PRODUCT_OA_CONFERENCE_APPLY, "b"); |
| | | baseDao.loadPromptData(dt); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | baseDao.loadPromptData(dt); |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * 会议纪要列表 |
| | | * @param fse |
| | | * @return |
| | | */ |
| | | public DataTableEntity listMeetingMinute(FieldSetEntity fse) { |
| | | StringBuilder sbSql = new StringBuilder(); |
| | | sbSql.append("\nSELECT B.meeting_master,start_time,end_time, A.*"); |
| | | sbSql.append("\nFROM product_oa_conference_minute A"); |
| | | sbSql.append("\nLEFT JOIN product_oa_conference_apply B ON B.uuid = A.meeting_uuid"); |
| | | return baseDao.listTable(sbSql.toString(), new Object[] {}, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE)); |
| | | } |
| | | |
| | | /** |
| | | * 会议纪要详情 |
| | | * @param fse |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findMeetingMinute(FieldSetEntity fse) { |
| | | List<String> param = new ArrayList<>(); |
| | | String filter = null; |
| | | if (StringUtils.isEmpty(fse.getUUID())) { |
| | | filter = "B.uuid = ?"; |
| | | param.add(fse.getString("meeting_uuid")); |
| | | } else { |
| | | filter = "A.uuid = ?"; |
| | | param.add(fse.getUUID()); |
| | | } |
| | | StringBuilder sbSql = new StringBuilder(); |
| | | sbSql.append("\nSELECT "); |
| | | sbSql.append("\n B.uuid AS meeting_uuid,B.meeting_topic,B.meeting_master,B.meeting_recorder,B.participator,CONCAT(start_time,'-',end_time)AS meeting_time, "); |
| | | sbSql.append("\n A.uuid,A.meeting_minute,A.copy_user,A.flow_flag"); |
| | | sbSql.append("\nFROM product_oa_conference_minute A"); |
| | | sbSql.append("\nRIGHT JOIN product_oa_conference_apply B ON B.uuid = A.meeting_uuid"); |
| | | sbSql.append("\nWHERE ").append(filter); |
| | | FieldSetEntity fseMeetingMinute = baseDao.getFieldSetEntityBySQL(sbSql.toString(), param.toArray(), false); |
| | | baseDao.loadPromptData(fseMeetingMinute); |
| | | if(!StringUtils.isEmpty(fseMeetingMinute.getUUID())) { |
| | | DataTableEntity dtMeetingMinute = baseDao.listTable("product_oa_conference_minute_sub", "main_uuid = ?", new Object[] {fseMeetingMinute.getUUID()}); |
| | | fseMeetingMinute.addSubDataTable(dtMeetingMinute); |
| | | } |
| | | return fseMeetingMinute; |
| | | } |
| | | |
| | | /** |
| | | * 自动发起任务 |
| | | * @param fse |
| | | */ |
| | | public void autoMeetingtask(FieldSetEntity fse) { |
| | | DataTableEntity dtMeetingMinute = fse.getSubDataTable("product_oa_conference_minute_sub"); |
| | | if(!BaseUtil.dataTableIsEmpty(dtMeetingMinute)) { |
| | | for (int i = 0; i < dtMeetingMinute.getRows(); i++) { |
| | | FieldSetEntity fseMeetingMinute = dtMeetingMinute.getFieldSetEntity(i); |
| | | if ("1".equals(fseMeetingMinute.getString("item_task"))) { |
| | | FieldSetEntity fseOaTask = new FieldSetEntity("product_oa_task_distribution"); |
| | | fseOaTask.setValue("task_name", fseMeetingMinute.getString("item_name")); |
| | | fseOaTask.setValue("task_description", fseMeetingMinute.getString("item_detail")); |
| | | fseOaTask.setValue("task_persons", fseMeetingMinute.getString("item_user")); |
| | | fseOaTask.setValue("owner", fseMeetingMinute.getString("item_mananger")); |
| | | fseOaTask.setValue("task_start_time", fseMeetingMinute.getString("plan_finish_time")); |
| | | fseOaTask.setValue("task_finish_time", fseMeetingMinute.getString("plan_start_time")); |
| | | fseOaTask.setValue("task_source", 1); |
| | | fseOaTask.setValue("task_status", 1); |
| | | fseOaTask.setValue("task_complete_sche", 0); |
| | | fseOaTask.setValue("finish_type", 0); |
| | | fseOaTask.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid()); |
| | | baseDao.add(fseOaTask); |
| | | |
| | | // 发送任务消息 |
| | | taskDistributionService.sendTaskMessage(fseOaTask, fseMeetingMinute.getString("item_user"), "admin", 1, fseOaTask.getUUID()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void taskMeetingRminder() { |
| | | DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_CONFERENCE_APPLY, " flow_flag=2 and ( to_remind IS NULL OR to_remind = 0 ) AND reminder_time > 0 and reminder_time>=(( UNIX_TIMESTAMP(start_time ) - UNIX_TIMESTAMP( now( ) ) ) / 60) ", new Object[]{}); |
| | |
| | | Set<String> users = new HashSet<>(); |
| | | String created_user = dt.getString(i, CmnConst.CREATED_BY + "_save_value"); |
| | | //记录人 |
| | | users.add(dt.getString(i, "record_man")); |
| | | users.add(dt.getString(i, "meeting_recorder")); |
| | | //主持人 |
| | | users.add(dt.getString(i, "record_master")); |
| | | users.add(dt.getString(i, "meeting_master")); |
| | | //参加者 |
| | | String[] participators = dt.getString(i, "participator").split(","); |
| | | users.addAll(Arrays.asList(participators)); |