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.common.lang.DateUtils;
|
import com.product.common.lang.StringUtils;
|
import com.product.core.dao.BaseDao;
|
import com.product.core.entity.DataTableEntity;
|
import com.product.core.entity.FieldSetEntity;
|
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.websocket.service.WebsocketMesssageServiceThread;
|
import com.product.module.sys.entity.SystemUser;
|
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.util.*;
|
|
/**
|
* @Author cheng
|
* @Description
|
* @Date 2021/4/20 14:42
|
* @Version 1.0
|
*/
|
@Service("conferenceManagerService")
|
public class ConferenceManagerService extends AbstractBaseService implements IConferenceManagerService {
|
|
@Autowired
|
BaseDao baseDao;
|
|
@Autowired
|
QueryFilterService queryFilterService;
|
@Autowired
|
PermissionService permissionService;
|
|
/**
|
* 会议室列表
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
public DataTableEntity getListConferenceRoom(FieldSetEntity fse) throws BaseException {
|
String queryFilter = queryFilterService.getQueryFilter(fse);
|
String dataFilter = permissionService.getDataFilter(CmnConst.ORG_LEVEL_UUID);
|
StringBuilder filter = new StringBuilder();
|
if (!StringUtils.isEmpty(queryFilter)) {
|
filter.append(queryFilter);
|
}
|
String created_by_field = fse.getString("created_by_field");
|
if (!StringUtils.isEmpty(created_by_field)) {
|
Integer userId = SpringMVCContextHolder.getCurrentUser().getUser_id();
|
if (filter.length() > 0) {
|
filter.append("and (" + created_by_field + " = " + userId + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(created_by_field + " = " + userId);
|
filter.append(" ) ");
|
}
|
} else if (!StringUtils.isEmpty(dataFilter)) {
|
if (filter.length() > 0) {
|
filter.append("and (" + dataFilter + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(dataFilter);
|
filter.append(" ) ");
|
}
|
}
|
if (!StringUtils.isEmpty(fse.getString("filter"))) {
|
if (filter.length() > 0) {
|
filter.append("and (" + fse.getString("filter") + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(fse.getString("filter"));
|
filter.append(" ) ");
|
}
|
}
|
DataTableEntity dt = baseDao.listTable(fse.getTableName(), filter.toString(), null, null, CmnConst.CREATED_UTC_DATETIME, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE), false);
|
baseDao.loadPromptData(dt);
|
return dt;
|
}
|
|
/**
|
* 会议室详情
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
public FieldSetEntity findConferenceRoom(FieldSetEntity fse) throws BaseException {
|
return baseDao.getFieldSetEntity(fse.getTableName(), fse.getUUID(), true);
|
}
|
|
/**
|
* 保存会议室
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
@Transactional
|
@Override
|
public boolean saveConferenceRoom(FieldSetEntity fse) throws BaseException {
|
//重名验证对象
|
FieldSetEntity nameVerification = null;
|
if (StringUtils.isEmpty(fse.getUUID())) {
|
fse.setValue(CmnConst.ORG_LEVEL_UUID, SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());
|
nameVerification = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_CONFERENCE_ROOM_CONFIG, "room_name=?", new Object[] {fse.getString("room_name")}, false);
|
}else {
|
nameVerification = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_CONFERENCE_ROOM_CONFIG, "room_name=? and uuid!=?", new Object[] {fse.getString("room_name"), fse.getUUID()}, false);
|
}
|
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
|
* @throws BaseException
|
*/
|
@Transactional
|
@Override
|
public boolean delConferenceRoom(FieldSetEntity fse) throws BaseException {
|
return baseDao.delete(fse.getTableName(), fse.getUUID().split(","));
|
}
|
|
/**
|
* 会议申请保存
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
@Override
|
@Transactional
|
public String saveConferenceApply(FieldSetEntity fse) throws BaseException {
|
if ("0".equals(fse.getString("type"))){
|
baseDao.saveFieldSetEntity(fse);
|
return fse.getUUID();
|
}
|
if (StringUtils.isEmpty(fse.getUUID())) {
|
fse.setValue(CmnConst.ORG_LEVEL_UUID, SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());
|
fse.setValue("flow_flag", 0);
|
}
|
if (StringUtils.isEmpty(fse.getString("meeting_room"))) {
|
throw new BaseException(SystemCode.CONFERENCE_ROOM_REQUIRED.getValue(), SystemCode.CONFERENCE_ROOM_REQUIRED.getText());
|
}
|
String start_time = fse.getDate(CmnConst.START_TIME, CmnConst.YYYYMMDDHHMMSS);
|
String end_time = fse.getDate(CmnConst.END_TIME, CmnConst.YYYYMMDDHHMMSS);
|
StringBuilder sql = new StringBuilder();
|
sql.append(" SELECT ");
|
sql.append(" uuid ");
|
sql.append(" FROM ");
|
sql.append(" product_oa_conference_apply ");
|
sql.append(" WHERE ");
|
sql.append(" meeting_room=? ");
|
Object[] params;
|
if (!StringUtils.isEmpty(fse.getUUID())) {
|
sql.append(" and uuid !=? ");
|
params = new Object[]{fse.getString("meeting_room"), fse.getUUID(), start_time, end_time, start_time, end_time, start_time, end_time};
|
} else {
|
params = new Object[]{fse.getString("meeting_room"), start_time, end_time, start_time, end_time, start_time, end_time};
|
}
|
sql.append(" and (( start_time >=? AND start_time <= ? ) ");
|
sql.append(" OR ( start_time <= ? AND end_time >= ? ) ");
|
sql.append(" OR ( end_time >= ? AND end_time <= ? ) ");
|
sql.append(" ) and flow_flag in (1,2) ");
|
DataTableEntity dataTableEntity = baseDao.listTable(sql.toString(), params);
|
//验证会议室在选择时间段内是否被使用
|
if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
|
// 会议室在时间段内被使用抛出错误
|
throw new BaseException(SystemCode.CONFERENCE_ROOM_IS_USED.getValue(), SystemCode.CONFERENCE_ROOM_IS_USED.getText());
|
}
|
BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse);
|
baseDao.saveFieldSetEntity(fse);
|
return fse.getUUID();
|
}
|
|
@Override
|
@Transactional
|
public boolean delConferenceApply(FieldSetEntity fse) throws BaseException {
|
return baseDao.delete(fse.getTableName(), fse.getUUID().split(","));
|
}
|
|
@Override
|
@Transactional
|
public List getKbData(FieldSetEntity fse) throws BaseException {
|
|
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);
|
}
|
|
StringBuilder bs=new StringBuilder();
|
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(" where y.meeting_resource like ? ");
|
}
|
bs.append(" ORDER BY y.start_time");
|
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);
|
|
//初始化会议室的使用的状态
|
String filter=" meeting_room = '"+fieldSetEntity.getString("meeting_room")+"' and DATE_FORMAT(start_time,\"%Y-%m-%d\") ='"+meeting_date+"'";
|
DataTableEntity product_oa_conference_apply = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{});
|
for (int i1 = 0; i1 < product_oa_conference_apply.getRows(); i1++) {
|
FieldSetEntity fieldSetEntity1 = product_oa_conference_apply.getFieldSetEntity(i1);
|
Date date = new Date();
|
if(date.before(fieldSetEntity1.getDate("start_time"))){
|
fieldSetEntity1.setValue("status","未开始");
|
}else if(date.after(fieldSetEntity1.getDate("end_time"))){
|
fieldSetEntity1.setValue("status","已结束");
|
}else {
|
fieldSetEntity1.setValue("status","会议中");
|
}
|
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())){
|
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<>();
|
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);
|
|
}
|
return listDate;
|
}
|
|
@Override
|
public List getMeetingDetails(FieldSetEntity fse) throws BaseException {
|
String meeting_room = fse.getString("meeting_room");
|
String meeting_date = fse.getString("meeting_date");
|
if(!StringUtils.isEmpty(meeting_room)&&!StringUtils.isEmpty(meeting_date)){
|
List<Object>param=new ArrayList<>();
|
param.add(meeting_room);
|
param.add(meeting_date);
|
StringBuilder sb=new StringBuilder();
|
sb.append(" SELECT b.uuid,b.start_time,b.end_time,b.meeting_topic,b.status,b.record_man as record_man_uuid, ");
|
sb.append(" (select user_name from product_sys_users where user_id=b.record_man) as record_man,");
|
sb.append(" (select user_name from product_sys_users where user_id=b.record_master) as record_master,");
|
sb.append(" CONCAT(DATE_FORMAT(b.start_time,\"%H-%i-%S\"),'~',DATE_FORMAT(b.end_time,\"%H-%i-%S\")) as time_quantum,");
|
sb.append(" DATE_FORMAT(b.start_time,\"%Y-%m-%d\") as meeting_date,");
|
sb.append(" GROUP_CONCAT(b.dict_label SEPARATOR ',') AS meeting_resouces ");
|
sb.append(" FROM (");
|
sb.append(" SELECT DISTINCT a.uuid,a.start_time,a.end_time,a.meeting_topic,a.record_man,a.record_master,a.status,t.dict_label ");
|
sb.append(" FROM (");
|
sb.append(" SELECT T1.*, ");
|
sb.append(" SUBSTRING_INDEX( SUBSTRING_INDEX( T1.meeting_resource, ',', T2.digit + 1 ), ',',- 1 ) AS type ");
|
sb.append(" FROM product_oa_conference_apply T1 ");
|
sb.append(" LEFT JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 ) T2");
|
sb.append(" ON T2.digit < ( length( T1.meeting_resource )- length( REPLACE ( T1.meeting_resource, ',', '' ))+ 1 )");
|
sb.append(" WHERE T1.meeting_room = ? ");
|
sb.append(" and DATE_FORMAT(T1.start_time,\"%Y-%m-%d\")=? ");
|
sb.append(" ) a");
|
sb.append(" LEFT JOIN product_sys_dict t ON a.type = t.dict_value ");
|
sb.append(" AND t.dict_name = '会议室资源'");
|
sb.append(" )b ");
|
sb.append(" group by b.uuid,b.start_time,b.end_time,b.meeting_topic,b.record_man,b.record_master,b.status ");
|
DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray());
|
|
List dataList =new ArrayList();
|
for (int i = 0; i < dataTableEntity.getRows(); i++) {
|
FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i);
|
Map<Object, Object> MapValues = fieldSetEntity.getValues();
|
if(ObjectUtil.isNotEmpty(MapValues.get("start_time")) || ObjectUtil.isNotEmpty( MapValues.get("end_time"))){
|
Object start_time = MapValues.get("start_time");
|
Object end_time = MapValues.get("end_time");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
String start_time_date = dateFormat.format(start_time);
|
String end_time_date = dateFormat.format(end_time);
|
MapValues.put("start_time",start_time_date);
|
MapValues.put("end_time",end_time_date);
|
}
|
|
Date date = new Date();
|
//是否能够取消
|
if(date.before(fieldSetEntity.getDate("start_time"))){
|
MapValues.put("isCancel",true);
|
}
|
//是否执行开启功能
|
if(date.before(fieldSetEntity.getDate("start_time")) && fieldSetEntity.getString("status").equals("已取消")){
|
MapValues.put("isStart",true);
|
}
|
dataList.add(MapValues);
|
}
|
return dataList;
|
}else {
|
return null;
|
}
|
|
}
|
|
@Override
|
@Transactional
|
public HashMap 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(SpringMVCContextHolder.getCurrentUser(), fse);
|
if(flag==false){
|
hashMap.put("code","200");
|
hashMap.put("msg","此时间段已被占用");
|
hashMap.put("status","sucess");
|
}else {
|
if(ObjectUtil.isNotEmpty(fse.getValue("uuid"))){
|
baseDao.update(fse);
|
}else {
|
baseDao.add(fse);
|
}
|
hashMap.put("code","200");
|
hashMap.put("msg","成功");
|
hashMap.put("status","sucess");
|
}
|
return hashMap;
|
}
|
|
@Override
|
public BitMatrix getQrCode(String content) throws BaseException, WriterException, IOException {
|
|
//二维码的宽高
|
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();
|
}
|
|
return bitMatrix;
|
}
|
|
@Override
|
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(fieldSetEntity.getString("status").equals("已取消")){
|
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();
|
}
|
|
@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("已签到")) || (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<>();
|
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;
|
}
|
|
@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);
|
|
}
|
|
|
/**
|
* 会议室使用情况
|
*
|
* @return
|
* @throws BaseException
|
*/
|
public String getConferenceRoomUsage(FieldSetEntity fse) throws BaseException {
|
SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
|
String org_level_uuid = currentUser != null ? currentUser.getOrg_level_uuid() : null;
|
if (currentUser == null || StringUtils.isEmpty(org_level_uuid)) {
|
return null;
|
}
|
String clientType = currentUser.getClientType();
|
System.out.println(clientType);
|
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, ");
|
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.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 ");
|
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);
|
sql.setLength(0);
|
if (!BaseUtil.dataTableIsEmpty(dt)) {
|
if (!com.product.admin.config.CmnConst.MOBILE_CLIENT_TYPE.equalsIgnoreCase(clientType)) {
|
List<String> weekRefer = new ArrayList<>();
|
weekRefer.add("星期一");
|
weekRefer.add("星期二");
|
weekRefer.add("星期三");
|
weekRefer.add("星期四");
|
weekRefer.add("星期五");
|
weekRefer.add("星期六");
|
weekRefer.add("星期日");
|
// key = 会议室 value : key=星期几上午或下午 value=每次申请会议室的数据
|
Map<String, Map<String, List<Map<Object, Object>>>> room = new HashMap<>();
|
Map<String, String> room_name = new LinkedHashMap<>();
|
for (int i = 0; i < dt.getRows(); i++) {
|
FieldSetEntity fs = dt.getFieldSetEntity(i);
|
String uuid = fs.getUUID();
|
Map<String, List<Map<Object, Object>>> data = room.get(uuid);
|
if (data == null) {
|
data = new HashMap<>();
|
room_name.put(uuid, fs.getString("room_name"));
|
room.put(uuid, data);
|
}
|
putMeetingToWeek(data, fs, fse);
|
}
|
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
objectObjectHashMap.put("room", room);
|
return BaseUtil.success(room_name, objectObjectHashMap);
|
} else {
|
//移动端
|
List<Map<String, String>> roomList = !fse.getBoolean("roomList") ? new ArrayList<>() : null;
|
Map<String, List<Object>> meetingRecordMap = new HashMap<>();
|
for (int i = 0; i < dt.getRows(); i++) {
|
FieldSetEntity fs = dt.getFieldSetEntity(i);
|
JSONObject jsonObject = BaseUtil.fieldSetEntityToJson(fs);
|
String roomUid = fs.getString(CmnConst.UUID);
|
List<Object> meetingRecordList = meetingRecordMap.get(roomUid);
|
if (meetingRecordList == null) {
|
meetingRecordList = new ArrayList<>();
|
meetingRecordMap.put(roomUid, meetingRecordList);
|
Map<String, String> room = new HashMap<>();
|
room.put("name", fs.getString("room_name"));
|
room.put("value", fs.getUUID());
|
if (roomList != null) {
|
roomList.add(room);
|
}
|
}
|
if (!StringUtils.isEmpty(fs.getString("apply_uuid"))) {
|
Date start_time = fs.getDate("start_time");
|
Calendar calendar = Calendar.getInstance();
|
calendar.setTime(start_time);
|
jsonObject.put("year", calendar.get(Calendar.YEAR));
|
jsonObject.put("month", calendar.get(Calendar.MONTH) + 1);
|
jsonObject.put("day", calendar.get(Calendar.DAY_OF_MONTH));
|
Format f1 = new DecimalFormat("00");
|
jsonObject.put("start_h_m", calendar.get(Calendar.HOUR_OF_DAY) + ":" + f1.format(calendar.get(Calendar.MINUTE)));
|
calendar.setTime(fs.getDate("end_time"));
|
jsonObject.put("end_h_m", calendar.get(Calendar.HOUR_OF_DAY) + ":" + f1.format(calendar.get(Calendar.MINUTE)));
|
meetingRecordList.add(jsonObject);
|
}
|
}
|
Map<String, Object> result = new HashMap<>();
|
result.put("roomList", roomList);
|
result.put("meetingRecord", meetingRecordMap);
|
return BaseUtil.success(result);
|
}
|
}
|
return null;
|
}
|
|
private void putMeetingToWeek(Map<String, List<Map<Object, Object>>> data, FieldSetEntity fs, FieldSetEntity fse) throws BaseException {
|
|
Date start_time = fs.getDate(CmnConst.START_TIME);
|
// 周几
|
if (start_time == null) {
|
return;
|
}
|
String week = BaseUtil.getWeek(start_time);
|
Calendar calendar = Calendar.getInstance();
|
calendar.setTime(start_time);
|
// 0 上午 1 下午
|
int am_pm = calendar.get(Calendar.HOUR_OF_DAY) != 12 ? calendar.get(Calendar.AM_PM) : 0;
|
Date end_time = fs.getDate(CmnConst.END_TIME);
|
calendar.setTime(end_time);
|
int end_am_pm = calendar.get(Calendar.HOUR_OF_DAY) != 12 ? calendar.get(Calendar.AM_PM) : 0;
|
;
|
//是否同一天
|
boolean samedate = DateUtils.isSameDay(start_time, end_time);
|
if (end_am_pm == am_pm && samedate) {
|
// 开始时间 和结束时间属于同一时间段且是同一天
|
} else {
|
if (end_am_pm != am_pm && samedate) {
|
// 开始时间 和结束时间不属于同一时间段且是同一天
|
putMeetingToWeek(data, week, end_am_pm, fs.getValues());
|
} else {
|
// 不在同一天
|
//获取开始到结束的每一天
|
List<Object> timePeriodDate = BaseUtil.getTimePeriodDate(start_time, end_time, false);
|
putMeetingToWeek(data, timePeriodDate, fse, fs, am_pm);
|
}
|
}
|
//记录的开始时间不能大于每周的开始时间
|
if (!start_time.before(fse.getDate("startTime"))) {
|
List<Map<Object, Object>> maps = data.get(week + "_" + am_pm);
|
if (maps == null) {
|
maps = new ArrayList<>();
|
data.put(week + "_" + am_pm, maps);
|
}
|
maps.add(fs.getValues());
|
}
|
}
|
|
private void putMeetingToWeek(Map<String, List<Map<Object, Object>>> data, List<Object> timePeriodDate, FieldSetEntity fse, FieldSetEntity fs, int am_pm) {
|
Calendar calendar = Calendar.getInstance();
|
Date start_time = fs.getDate(CmnConst.START_TIME);
|
Date end_time = fs.getDate(CmnConst.END_TIME);
|
for (int j = 0; j < timePeriodDate.size(); j++) {
|
//每天的date
|
Date o = (Date) timePeriodDate.get(j);
|
|
if (o.before(fse.getDate("startTime")) || fse.getDate("endTime").before(o)) {
|
continue;
|
}
|
String week_evey = BaseUtil.getWeek(o);
|
//是否是同一天
|
if (DateUtils.isSameDay(start_time, o)) {
|
//是否为上午时段
|
if (am_pm == 0) {
|
putMeetingToWeek(data, week_evey, 1, fs.getValues());
|
}
|
} else if ((j + 1) < timePeriodDate.size()) {
|
putMeetingToWeek(data, week_evey, 0, fs.getValues());
|
putMeetingToWeek(data, week_evey, 1, fs.getValues());
|
} else {
|
SimpleDateFormat dtf = new SimpleDateFormat(CmnConst.YYYYMMDDHHMMSS);
|
String date1 = dtf.format(o);
|
String date2 = dtf.format(end_time);
|
if (date1.equals(date2)) {
|
//最后结束日期
|
calendar.setTime(o);
|
int cc = calendar.get(Calendar.HOUR_OF_DAY) != 12 ? calendar.get(Calendar.AM_PM) : 0;
|
if (cc == 1) {
|
//如果最后一天是下午则加上 上午
|
putMeetingToWeek(data, week_evey, 0, fs.getValues());
|
}
|
putMeetingToWeek(data, week_evey, cc, fs.getValues());
|
} else {
|
|
}
|
}
|
}
|
}
|
|
private void putMeetingToWeek(Map<String, List<Map<Object, Object>>> data, String week, int am_pm, Map<Object, Object> values) {
|
List<Map<Object, Object>> list = data.get(week + "_" + am_pm);
|
if (list == null) {
|
list = new ArrayList<>();
|
data.put(week + "_" + am_pm, list);
|
}
|
Map<Object, Object> clone = new TreeMap<>();
|
clone.putAll(values);
|
list.add(clone);
|
}
|
|
/**
|
* 会议室详情
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
public FieldSetEntity findConferenceApply(FieldSetEntity fse) throws BaseException {
|
FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntity(fse.getTableName(), fse.getUUID(), true);
|
DataTableEntity dt = new DataTableEntity();
|
dt.addFieldSetEntity(fieldSetEntity);
|
if (!com.product.admin.config.CmnConst.MOBILE_CLIENT_TYPE.equals(SpringMVCContextHolder.getCurrentUser().getClientType())) {
|
baseDao.loadPromptData(dt);
|
fieldSetEntity.setValue("flow_flag", fieldSetEntity.getString("flow_flag_save_value"));
|
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;
|
}
|
|
/**
|
* 会议申请列表
|
*
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
public DataTableEntity getListConferenceApply(FieldSetEntity fse) throws BaseException {
|
String queryFilter = queryFilterService.getQueryFilter(fse);
|
|
String dataFilter = permissionService.getDataFilter(CmnConst.ORG_LEVEL_UUID);
|
|
StringBuilder filter = new StringBuilder();
|
if (!StringUtils.isEmpty(queryFilter)) {
|
filter.append(queryFilter);
|
}
|
String created_by_field = fse.getString("created_by_field");
|
if (!StringUtils.isEmpty(created_by_field)) {
|
Integer userId = SpringMVCContextHolder.getCurrentUser().getUser_id();
|
if (filter.length() > 0) {
|
filter.append("and (" + created_by_field + " = " + userId + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(created_by_field + " = " + userId);
|
filter.append(" ) ");
|
}
|
} else if (!StringUtils.isEmpty(dataFilter)) {
|
if (filter.length() > 0) {
|
filter.append("and (" + dataFilter + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(dataFilter);
|
filter.append(" ) ");
|
}
|
}
|
if (!StringUtils.isEmpty(fse.getString("filter"))) {
|
if (filter.length() > 0) {
|
filter.append("and (" + fse.getString("filter") + ") ");
|
} else {
|
filter.append(" ( ");
|
filter.append(fse.getString("filter"));
|
filter.append(" ) ");
|
}
|
}
|
DataTableEntity dt = baseDao.listTable(fse.getTableName(), filter.toString(), new Object[]{}, null, "ifnull(updated_utc_datetime,created_utc_datetime) desc", fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE), false);
|
baseDao.loadPromptData(dt);
|
return dt;
|
}
|
|
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[]{});
|
baseDao.loadPromptData(dt);
|
DataTableEntity dtt = new DataTableEntity();
|
if (!BaseUtil.dataTableIsEmpty(dt)) {
|
for (int i = 0; i < dt.getRows(); i++) {
|
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, "record_master"));
|
//参加者
|
String[] participators = dt.getString(i, "participator").split(",");
|
users.addAll(Arrays.asList(participators));
|
String uuid = dt.getFieldSetEntity(i).getUUID();
|
String date = dt.getDate(i, CmnConst.START_TIME, CmnConst.YYYYMMDDHHMMSS);
|
if (date == null) {
|
date = "";
|
}
|
users.remove(created_user);
|
Iterator<String> iterator = users.iterator();
|
WebsocketMesssageServiceThread.getInstance().appendMessage(dt.getString(i, CmnConst.CREATED_BY + "_save_value"), "您发起的会议将在" + date + "开始", "您有新的会议提醒", dt.getInt(i, CmnConst.CREATED_BY + "_save_value"), "4", "162028970334036i3V1L458?uuid=" + uuid, CmnConst.PRODUCT_OA_CONFERENCE_APPLY, uuid, dt.getInt(i, CmnConst.CREATED_BY + "_save_value"), 0, 0);
|
while (iterator.hasNext()) {
|
String send_user = iterator.next();
|
WebsocketMesssageServiceThread.getInstance().appendMessage(send_user, "来自" + dt.getString(i, CmnConst.CREATED_BY) + "发起的会议将在" + date + "开始", "您有新的会议提醒", dt.getInt(i, CmnConst.CREATED_BY + "_save_value"), "4", "162028970334036i3V1L458?uuid=" + uuid, CmnConst.PRODUCT_OA_CONFERENCE_APPLY, uuid, dt.getInt(i, CmnConst.CREATED_BY + "_save_value"), 0, 0);
|
}
|
dt.getMeta().setFields(new Object[]{CmnConst.UUID, "to_remind"});
|
dt.getFieldSetEntity(i).getMeta().setFields(new Object[]{CmnConst.UUID});
|
dt.setFieldValue(i, "to_remind", 1);
|
|
}
|
baseDao.update(dt);
|
}
|
}
|
}
|