From 1578ff18a22a51b0534ddbf3299f0d734a98f5a5 Mon Sep 17 00:00:00 2001
From: zm <2369059705qq.com>
Date: 星期二, 20 八月 2024 14:02:47 +0800
Subject: [PATCH] 考勤加流程调整
---
src/main/java/com/product/administration/service/ConferenceManagerService.java | 248 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 246 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java
index 758e224..5853818 100644
--- a/src/main/java/com/product/administration/service/ConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -1,6 +1,12 @@
package com.product.administration.service;
+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;
@@ -18,9 +24,15 @@
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;
@@ -122,10 +134,10 @@
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);
}
@@ -200,6 +212,238 @@
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 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 ? ");
+ }
+ 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, ");
+ 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);
+ }
+ 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 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;
+ }
+
+
/**
* 浼氳瀹や娇鐢ㄦ儏鍐�
--
Gitblit v1.9.2