| | |
| | | |
| | | 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.product.administration.config.CmnConst; |
| | | import com.product.administration.config.SystemCode; |
| | | import com.product.administration.service.ide.IConferenceManagerService; |
| | |
| | | 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; |
| | |
| | | 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","未开始"); |
| | |
| | | }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<>(); |
| | |
| | | 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 = '会议室资源'"); |
| | |
| | | |
| | | } |
| | | HashMap<String,Object> hashMap=new HashMap<>(); |
| | | BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse); |
| | | if(flag==false){ |
| | | hashMap.put("code","200"); |
| | | hashMap.put("msg","此时间段已被占用"); |
| | |
| | | return hashMap; |
| | | } |
| | | |
| | | @Override |
| | | public String getQrCode(FieldSetEntity fse) throws BaseException, WriterException, IOException { |
| | | String uuid="96f161b4-6360-40ba-8dc1-72bb39d56be4"; |
| | | int BLACK = 0xFF000000; |
| | | int WHITE = 0xFFFFFFFF; |
| | | Date date = new Date(); |
| | | String text = "http://127.0.0.1:9998/lx/api/conference/get_QrCode_Info/v1?uuid=" + uuid+"&date="+date; |
| | | String path = "D:/QRCode"; // 图片生成的位置 |
| | | int width = 400; |
| | | int height = 400; |
| | | // 二维码图片格式 |
| | | String format = "jpg"; |
| | | // 设置编码,防止中文乱码 |
| | | Hashtable<EncodeHintType, Object> ht = new Hashtable<EncodeHintType, Object>(); |
| | | ht.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | // 设置二维码参数(编码内容,编码类型,图片宽度,图片高度,格式) |
| | | BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height, ht); |
| | | // 生成二维码(定义二维码输出服务器路径) |
| | | File outputFile = new File(path); |
| | | if (!outputFile.exists()) { |
| | | // 创建文件夹 |
| | | outputFile.mkdir(); |
| | | }else { |
| | | outputFile.delete(); |
| | | outputFile.mkdir(); |
| | | } |
| | | |
| | | int b_width = bitMatrix.getWidth(); |
| | | int b_height = bitMatrix.getHeight(); |
| | | // 建立图像缓冲器 |
| | | BufferedImage image = new BufferedImage(b_width, b_height, BufferedImage.TYPE_3BYTE_BGR); |
| | | for (int x = 0; x < b_width; x++) { |
| | | for (int y = 0; y < b_height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE); |
| | | } |
| | | } |
| | | // 生成二维码 |
| | | ImageIO.write(image, format, new File(path + "/code." + format)); |
| | | // 二维码的名称 |
| | | // code.jpg |
| | | |
| | | return path + "/code." + format; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 会议室使用情况 |