From addada941082cac58b7ff8b16e3bd4c1c5b49fcc Mon Sep 17 00:00:00 2001 From: 18756 <1875631620@qq.com> Date: 星期二, 20 八月 2024 17:27:34 +0800 Subject: [PATCH] 会议室功能取消开启优化8.20 --- src/main/java/com/product/administration/service/ConferenceManagerService.java | 131 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java index 2f438ed..8cecf0c 100644 --- a/src/main/java/com/product/administration/service/ConferenceManagerService.java +++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java @@ -2,6 +2,12 @@ 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; @@ -10,18 +16,26 @@ 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; import java.text.SimpleDateFormat; @@ -236,7 +250,7 @@ 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.getData().get(i); + FieldSetEntity fieldSetEntity1 = product_oa_conference_apply.getFieldSetEntity(i1); Date date = new Date(); if(date.before(fieldSetEntity1.getDate("start_time"))){ fieldSetEntity1.setValue("status","鏈紑濮�"); @@ -245,9 +259,8 @@ }else { fieldSetEntity1.setValue("status","浼氳涓�"); } - + baseDao.executeUpdate("update product_oa_conference_apply set status='"+fieldSetEntity1.getString("status")+"' where uuid='"+fieldSetEntity1.getString("uuid")+"'"); } - baseDao.update(product_oa_conference_apply); //鏋勯�犳墍闇�瑕佺殑鏍煎紡 if(!list.contains(fieldSetEntity.getValue("room_name").toString())){ HashMap<String,Object> hashMap=new HashMap<>(); @@ -306,10 +319,10 @@ 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(" 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(" 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(" 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 = '浼氳瀹よ祫婧�'"); @@ -330,6 +343,16 @@ 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; @@ -339,6 +362,102 @@ } + @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"); + //瀹归敊绾у埆涓篐 + 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); + } + + } + /** * 浼氳瀹や娇鐢ㄦ儏鍐� -- Gitblit v1.9.2