当前位置:网站首页>My meeting of OA project (meeting seating & submission for approval)
My meeting of OA project (meeting seating & submission for approval)
2022-07-26 08:43:00 【Xiao Chen likes sugar ①】
Catalog
One 、 Introduction to conference seating plug-in
Two 、 Meeting participant user data initialization
3、 ... and 、 Generation and display of meeting seating pictures
Four 、 Meeting submission for approval
One 、 Introduction to conference seating plug-in


View the source code of the picture with blue background
<html>
<head>
<title> Meeting seating </title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
.tips {
/* position: absolute; */
background: #eee;
display: inline-block;
height: 60px;
width: 60px;
line-height: 60px;
text-align: center;
margin: 5px;
}
.add {
position: fixed;
right: 0;
top: 0
}
#tu {
width: 564px;
height: 330px;
background: lightblue
/*background: url('u=3318199716,2583790385&fm=26&gp=0.jpg');*/
}
</style>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="http://html2canvas.hertzen.com/dist/html2canvas.js"></script>
</head>
<body>
<div id="tu"></div>
<!-- <div class="tips" id="tips1" onmouseover="dragF.drag('tips1');">
<img src="/images/skinslogo.gif"><br> Pictures can be dragged </div>
<div class="tips" id="tips2" onmouseover="dragF.drag('tips2');"> seat 1
</div>
<div class="tips" id="tips3" onmouseover="dragF.drag('tips3');"> seat 2
</div> -->
<div class="add">
<input id="dan_input" type="text" value="">
<button onclick="return addDanMu()"> Add seats </button>
<input id="jie_input" type="button" value=' download '>
</div>
</body>
<script type="text/javascript">
var $id = function(id) {
return document.getElementById(id);
}
var dragF = {
locked: false,
lastObj: undefined,
drag: function(obj) {
$id(obj).onmousedown = function(e) {
var e = e ? e : window.event;
if (!window.event) {
e.preventDefault();
} /* Block annotation <a href='/site/js-5791-1.html' target='_blank'><u> browser </u></a> Drag down a,img Default event for */
dragF.locked = true;
$id(obj).style.position = "absolute";
$id(obj).style.zIndex = "100";
if (dragF.lastObj && dragF.lastObj != $id(obj)) { /* Multi element dragging needs to restore the last element state */
dragF.lastObj.style.zIndex = "1";
}
dragF.lastObj = $id(obj);
var tempX = $id(obj).offsetLeft;
var tempY = $id(obj).offsetTop;
dragF.x = e.clientX;
dragF.y = e.clientY;
document.onmousemove = function(e) {
var e = e ? e : window.event;
if (dragF.locked == false) return false;
$id(obj).style.left = tempX + e.clientX - dragF.x + "px";
$id(obj).style.top = tempY + e.clientY - dragF.y + "px";
if (window.event) {
e.returnValue = false;
} /* prevent ie Next a,img Default event for */
}
document.onmouseup = function() {
dragF.locked = false;
}
}
}
}
</script>
<script>
function addDanMu() {
var dan = document.getElementById("dan_input").value;
if (dan == "") {
alert(" Please enter barrage ~");
return false;
} else {
document.getElementById("dan_input").value = ""; // Empty Bullet screen input box
// var br = document.createElement("BR"); // <br />
var node = document.createElement("DIV"); // <div>
var tipsArr = document.getElementsByClassName('tips');
var i;
// console.log(parseInt(tipsArr[tipsArr.length-1].id.substr(4))+1);
if (tipsArr.length == 0) {
i = 1
} else {
i = parseInt(tipsArr[tipsArr.length - 1].id.substr(4)) + 1;
}
// var aNode = document.createElement("P"); // <p>
node.setAttribute("class", "tips");
node.setAttribute("id", "tips" + i);
node.setAttribute("onmouseover", "dragF.drag('tips" + i + "');");
var textnode = document.createTextNode(dan); // Create a Text node , A barrage of user input , Deposit in Created Element nodes <p> in
// aNode.appendChild(textnode);
node.appendChild(textnode);
// document.body.appendChild(br);
// document.body.appendChild(node);
document.getElementById("tu").appendChild(node);
return true;
}
}
</script>
<script type="text/javascript">
$("#jie_input").on("click", function(event) {
event.preventDefault();
html2canvas(document.getElementById("tu")).then(function(canvas) {
var dataUrl = canvas.toDataURL();
var newImg = document.createElement("img");
newImg.src = dataUrl;
// document.body.appendChild(newImg);
// console.log(dataUrl)
this.downloadFile(' test .png', dataUrl);
});
});
// download
function downloadFile(fileName, content) {
debugger;
let aLink = document.createElement('a');
let blob = this.base64ToBlob(content); //new Blob([content]);
let evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true); //initEvent The last two parameters are not added FF I'll make a mistake next time Event type , Is it bubbling? , Whether to block the default behavior of the browser
aLink.download = fileName;
aLink.href = URL.createObjectURL(blob);
// aLink.dispatchEvent(evt);
//aLink.click()
aLink.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
})); // Compatible with Firefox
}
//base64 turn blob
function base64ToBlob(code) {
let parts = code.split(';base64,');
let contentType = parts[0].split(':')[1];
let raw = window.atob(parts[1]);
let rawLength = raw.length;
let uInt8Array = new Uint8Array(rawLength);
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], {
type: contentType
});
}
</script>
</html>
Then change the source code
Two 、 Meeting participant user data initialization
The analysis of the database should find out Meeting seating user query Use one SQL sentence Join two tables
-- find in set
-- The first parameter : Database fields
-- The second parameter : Condition of column segment
select * from t_oa_user where FIND_IN_SET (id,(select CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id=8))
result :

Click to enter another page when meeting seating
myMeeting.js Add a piece of code to
// Open the meeting seating dialog box
function open(id){
layer.open({
type: 2, //layer Provides 5 Layer type . The values that can be passed in are :0( Message box , Default )1( Page layer )2(iframe layer )3( Loading layer )4(tips layer )
title: ' Meeting row ', // Dialog title
area: ['460px', '340px'], // Wide and high
skin: 'layui-layer-rim', // Style class name
content: $("#ctx").val()+'/jsp/meeting/seatPic.jsp?id='+id, // Pop up content . You can pass in ordinary html Content , You can also specify DOM, With more type Different but different
});
}Write a seatPic.jsp The interface of
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${pageContext.request.contextPath }/"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="static/js/layui/css/layui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="static/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="static/js/layui/layui.js"></script>
<script type="text/javascript" src="static/js/plugins/html2canvas/html2canvas.js"></script>
<title> Meeting seating </title>
</head>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
body{
width: 100%;
height: 100%;
/* background: red; */
}
.tips {
/* position: absolute; */
background: pink;
display: inline-block;
height: 60px;
/* width: 60px; */
line-height: 60px;
text-align: center;
margin: 5px;
padding: 0 10px;
}
.add {
position: fixed;
right: 10px;
top: 10px;
display:inline;
}
#tu {
width: 100%;
height: 100%;
/* background: lightblue; */
/*background: url('u=3318199716,2583790385&fm=26&gp=0.jpg');*/
}
.layui-input{
height:30px;
}
</style>
<body id="screen_body">
<div id="tu"></div>
<!-- Don't use layui Form inline mode , It can lead to canvas Of toDataURL() The data is data:, -->
<div class="add">
<div style="display:inline-block;">
<input id="dan_input" type="text" value="" class="layui-input">
</div>
<div style="display:inline-block;">
<button onclick="return addDanMu()" class="layui-btn layui-btn-sm"> Add seats </button><input id="jie_input" type="button" class="layui-btn layui-btn-sm" value=' download '>
</div>
</div>
</body>
<script type="text/javascript">
var $id = function(id) {
return document.getElementById(id);
}
// Drag and drop in the meeting row
var dragF = {
locked: false,
lastObj: undefined,
drag: function(obj) {
$id(obj).onmousedown = function(e) {
var e = e ? e : window.event;
if (!window.event) {
e.preventDefault();
} /* Block annotation <a href='/site/js-5791-1.html' target='_blank'><u> browser </u></a> Drag down a,img Default event for */
dragF.locked = true;
$id(obj).style.position = "absolute";
$id(obj).style.zIndex = "100";
if (dragF.lastObj && dragF.lastObj != $id(obj)) { /* Multi element dragging needs to restore the last element state */
dragF.lastObj.style.zIndex = "1";
}
dragF.lastObj = $id(obj);
var tempX = $id(obj).offsetLeft;
var tempY = $id(obj).offsetTop;
dragF.x = e.clientX;
dragF.y = e.clientY;
document.onmousemove = function(e) {
var e = e ? e : window.event;
if (dragF.locked == false) return false;
$id(obj).style.left = tempX + e.clientX - dragF.x + "px";
$id(obj).style.top = tempY + e.clientY - dragF.y + "px";
if (window.event) {
e.returnValue = false;
} /* prevent ie Next a,img Default event for */
}
document.onmouseup = function() {
dragF.locked = false;
}
}
}
}
</script>
<script type="text/javascript">
var layer;
layui.use(['layer'],function(){
layer=layui.layer;
// Initialize meeting seating : According to the meeting ID Get the names of all participants ( host + Participants + People in attendance )
initMeetingUsers();
// Draw pictures of meeting seating
$("#jie_input").on("click", function(event) {
$('.add').hide();
event.preventDefault();
html2canvas(document.getElementById("screen_body")).then(function(canvas) {
var dataUrl = canvas.toDataURL();
console.log(dataUrl);
var param = {};
param['seatPic'] = dataUrl;
param['id'] = '${param.id}';
param['methodName']='updateSeatPicById';
console.log(param);
// Here you need to upload the pictures of meeting seating
$.post('${pageContext.request.contextPath }/info.action',param,function(rs){
if(rs.success){
// Get the current status first iframe Layer index
var index = parent.layer.getFrameIndex(window.name);
// And then close it
parent.layer.close(index);
// Call the refresh method of the parent page
parent.query();
}else{
layer.msg(rs.msg,{icon:5},function(){});
}
},'json');
});
});
});
function initMeetingUsers(){
//http://localhost:8080/xxx/seatPic.jsp?id=12 -> ${param.id}
$.getJSON('${pageContext.request.contextPath }/user.action',{
'methodName':'queryUserByMeetingId',
'meetingId':'${param.id}'
},function(rs){
console.log(rs);
let data=rs.data;
$.each(data,function(i,e){
$('#dan_input').val(e.name);
addDanMu();
});
});
}
// Add meeting seating
function addDanMu() {
var dan = document.getElementById("dan_input").value;
if (dan == "") {
alert(" Please enter barrage ~");
return false;
} else {
document.getElementById("dan_input").value = ""; // Empty Bullet screen input box
// var br = document.createElement("BR"); // <br />
var node = document.createElement("DIV"); // <div>
var tipsArr = document.getElementsByClassName('tips');
var i;
// console.log(parseInt(tipsArr[tipsArr.length-1].id.substr(4))+1);
if (tipsArr.length == 0) {
i = 1
} else {
i = parseInt(tipsArr[tipsArr.length - 1].id.substr(4)) + 1;
}
// var aNode = document.createElement("P"); // <p>
node.setAttribute("class", "tips");
node.setAttribute("id", "tips" + i);
node.setAttribute("onmouseover", "dragF.drag('tips" + i + "');");
var textnode = document.createTextNode(dan); // Create a Text node , A barrage of user input , Deposit in Created Element nodes <p> in
// aNode.appendChild(textnode);
node.appendChild(textnode);
// document.body.appendChild(br);
// document.body.appendChild(node);
document.getElementById("tu").appendChild(node);
return true;
}
}
</script>
</html>

Write a dao Method in UserDao
package com.zking.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.zking.entity.User;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
public class UserDao extends BaseDao<User> {
public User login(User user) throws Exception {
String sql = "select * from t_oa_user where loginName='"+user.getLoginName()+"' and pwd='"+user.getPwd()+"' ";
// return super.executeQuery(sql, clz, pageBean);
// according to sql Query qualified users , Usually only one piece of data is returned
List<User> users = super.executeQuery(sql, User.class,null);
return users == null || users.size() == 0 ? null : users.get(0);
}
// Query user information and corresponding roles The role is through case when Got
public List<Map<String, Object>> list(User user,PageBean pageBean) throws Exception{
String sql = "select * \r\n " +
", \r\n " +
"(case rid \r\n " +
"when 1 then ' Administrators ' \r\n" +
"when 2 then ' The initiator ' \r\n" +
"when 3 then ' Approver ' \r\n" +
"when 4 then ' participants ' \r\n" +
"when 5 then ' Conference room manager ' \r\n" +
"else ' other ' end ) roleName \r\n" +
"FROM t_oa_user where 1 = 1";
String name = user.getName();
if(com.zking.util.StringUtils.isNotBlank(name)) {
sql += " and name like '%"+name+"%'";
}
// Use when the attributes of the entity class completely include the column segments queried by the database
// super.executeQuery(sql, User.class, pageBean) return List<Map<String, Object>>, The corresponding is associated table query , Single entity class object , Column segments that do not completely contain queries
return super.executeQuery(sql, pageBean);
}
// Query all users Used to bind the multi-function drop-down box
public List<Map<String, Object>> queryUserAll(User user,PageBean pageBean) throws Exception{
String sql = "select id as value,name from t_oa_user";
return super.executeQuery(sql, pageBean);
}
public int add(User user) throws Exception {
String sql = "insert into t_oa_user(name,loginName,pwd) values(?,?,?)";
return super.executeUpdate(sql,user,new String[] {"name","loginName","pwd"});
}
public int del(User user) throws Exception {
String sql = "delete from t_oa_user where id=?";
return super.executeUpdate(sql,user,new String[] {"id"});
}
public int edit(User user) throws Exception {
String sql = "update t_oa_user set name=?,loginName=?,pwd=? where id=?";
return super.executeUpdate(sql,user,new String[] {"name","loginName","pwd","id"});
}
// Conference seating user information query
public List<User> list(Integer meetingId) throws Exception {
String sql = " select * from t_oa_user where FIND_IN_SET (id,(select CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id= "+meetingId+")) ";
return super.executeQuery(sql, User.class, null);
}
}
UserAction
package com.zking.web;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.util.RequestUtil;
import com.zking.dao.UserDao;
import com.zking.entity.User;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class UserAction extends ActionSupport implements ModelDriver<User>{
private User user = new User();
private UserDao userDao = new UserDao();
public String login(HttpServletRequest req, HttpServletResponse resp) {
try {
User u = userDao.login(user);
// The user record is found through the account name and password
if(u != null) {
// Login successful
//ResponseUtil.writeJson(resp, new R().data("code", 200).data("msg"," success "));
ResponseUtil.writeJson(resp, R.ok(200, " success "));
req.getSession().setAttribute("user", u);
}
else {
// Login failed
//ResponseUtil.writeJson(resp, new R().data("code",0).data("msg"," Wrong account or password "));
ResponseUtil.writeJson(resp, R.error(0, " Wrong account or password "));
}
} catch (Exception e) {
// TODO: handle exception
}
return null;
}
// Meeting seating user query
public String queryUserByMeetingId(HttpServletRequest req, HttpServletResponse resp) {
try {
String meetingId = req.getParameter("meetingId");
List<User> users = userDao.list(Integer.valueOf(meetingId));
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " Conference seating data query succeeded ",users));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting seating data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
// User query
public String list(HttpServletRequest req, HttpServletResponse resp) {
try {
PageBean pageBean = new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> users = userDao.list(user, pageBean);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " User data query succeeded ",pageBean.getTotal(),users));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " User data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
// Query all users to bind the multi-function drop-down box
public String queryUserAll(HttpServletRequest req, HttpServletResponse resp) {
try {
List<Map<String, Object>> users = userDao.queryUserAll(user, null);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " Multi function drop-down box data query succeeded ",users));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Multi function drop-down box data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
// Number of rows affected
int rs = userDao.add(user);
if(rs>0) {
ResponseUtil.writeJson(resp, R.ok(200, " User data added successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add user data "));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " User data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
public String del(HttpServletRequest req, HttpServletResponse resp) {
try {
// Number of rows affected
int rs = userDao.del(user);
if(rs>0) {
ResponseUtil.writeJson(resp, R.ok(200, " User data deleted successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " User data deletion failed "));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " User data deletion failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
public String edit(HttpServletRequest req, HttpServletResponse resp) {
try {
// Number of rows affected
int rs = userDao.edit(user);
if(rs>0) {
ResponseUtil.writeJson(resp, R.ok(200, " User data modified successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " User data modification failed "));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " User data modification failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
@Override
public User getModel() {
return user;
}
}
Log in from
Remember to introduce plug-ins

3、 ... and 、 Generation and display of meeting seating pictures
MeetingInfoDao
package com.zking.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.zking.entity.MeetingInfo;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
import com.zking.util.StringUtils;
public class MeetingInfoDao extends BaseDao<MeetingInfo>{
// Conference information added
public int add (MeetingInfo t) throws Exception {
String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)";
return super.executeUpdate(sql, t, new String[] {"title","content","canyuze","liexize","zhuchiren","location","startTime","endTime","remark"});
}
// General meeting query SQL sentence , Include meeting information table data , Host name 、 Name of approver 、 Meeting status
private String getSQL() {
return "SELECT a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,b.`name`,a.location\r\n" +
",DATE_FORMAT(a.startTime,'%Y-%m-%d %H:%i:%s') as startTime\r\n" +
",DATE_FORMAT(a.endTime,'%Y-%m-%d %H:%i:%s') as endTime\r\n" +
",a.state\r\n" +
",(case a.state\r\n" +
"when 0 then ' Cancel the meeting '\r\n" +
"when 1 then ' newly build '\r\n" +
"when 2 then ' To audit '\r\n" +
"when 3 then ' rejected '\r\n" +
"when 4 then ' To be opened '\r\n" +
"when 5 then ' Have in hand '\r\n" +
"when 6 then ' Start voting '\r\n" +
"else ' At the end of the meeting ' end\r\n" +
") as meetingState\r\n" +
",a.seatPic,a.remark,a.auditor,c.`name` as auditorName\r\n" +
"FROM t_oa_meeting_info a\r\n" +
"inner join t_oa_user b on a.zhuchiren = b.id\r\n" +
"left JOIN t_oa_user c on a.auditor = c.id where 1=1 ";
}
// My meeting
public List<Map<String, Object>> myInfos(MeetingInfo info, PageBean pageBean) throws Exception {
String sql = getSQL();
String title = info.getTitle();
if(StringUtils.isNotBlank(title)) {
sql += " and title like '%"+title+"%'";
}
// According to the current login user ID As a condition of the host field
sql+=" and zhuchiren="+info.getZhuchiren();
//System.out.println(sql);
return super.executeQuery(sql, pageBean);
}
// state :0 Cancel the meeting 1 newly build 2 To audit 3 rejected 4 To be opened 5 Have in hand 6 Start voting 7 Close the meeting , The default value is 1
public int updatezt(MeetingInfo m) throws Exception {
String sql = "update t_oa_meeting_info set state=? where id = ?";
return super.executeUpdate(sql, m, new String[] {"state","id"});
}
// Set the picture of meeting seating
public int updateSeatPicById(MeetingInfo info) throws Exception {
String sql = " update t_oa_meeting_info set seatPic = ? where id=?";
return super.executeUpdate(sql, info, new String[] {"seatPic","id"});
}
}
MeetingInfoAction
package com.zking.web;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.ConvertUtils;
import com.zking.dao.MeetingInfoDao;
import com.zking.entity.MeetingInfo;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.Base64ImageUtils;
import com.zking.util.BaseDao;
import com.zking.util.MyDateConverter;
import com.zking.util.PageBean;
import com.zking.util.PropertiesUtil;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class MeetingInfoAction extends ActionSupport implements ModelDriver<MeetingInfo>{
private MeetingInfo info = new MeetingInfo();
private MeetingInfoDao infoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
ConvertUtils.register(new MyDateConverter(), Date.class);
return info;
}
// Conference seating image generation
public String updateSeatPicById(HttpServletRequest req, HttpServletResponse resp) throws Exception {
/**
* 1. Accept the string corresponding to the picture passed from the front-end page to the background
* 2. With the help of tool classes, the string is generated into an image , Save to the path configured by the configuration file
* 3. Add server hard disk and Request address mapping , Can access
* 4. The requested address Save to the database
*/
try {
// E:/T280/images/123.png
// Get the storage address of the picture
String dirPath = PropertiesUtil.getValue("dirPath");
// Get the browser request path , For subsequent saving to the database
String serverPath = PropertiesUtil.getValue("serverPath"); // serverPath=/test_layui/upload/paizuo/
// Randomly generate a picture name
String fileName = UUID.randomUUID().toString().replaceAll("-", "") + ".png";
//info.getSeatPic();// Picture string
Base64ImageUtils.GenerateImage(info.getSeatPic().replaceAll("data:image/png;base64", ""), dirPath+fileName);
// take seatPic The content inside is modified to the request address
info.setSeatPic(serverPath + fileName);
// Modify the meeting seating The database column segment corresponding to the database image
int rs = infoDao.updateSeatPicById(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was successfully booked "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Meeting seating failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting seating failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// New users
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
//rs It affects the number of rows
int rs = infoDao.add(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " Conference information added successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// My meeting
public String myInfos(HttpServletRequest req, HttpServletResponse resp) {
try {
PageBean pageBean = new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> lst = infoDao.myInfos(info, pageBean);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " My meeting data query succeeded ",pageBean.getTotal(),lst));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " My meeting data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
// My meeting : Delete ( Cancel the meeting )
public String updatezt(HttpServletRequest req, HttpServletResponse resp) {
try {
int rs = infoDao.updatezt(info);
if (rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was cancelled successfully "));
} else {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
}

Four 、 Meeting submission for approval
myMeeting.js
let layer,table,$,form;
let row;
layui.use(['layer','table','jquery','form'],function(){
layer=layui.layer,
table=layui.table,
form=layui.form,
$=layui.jquery;
initTable();
// Query events
$('#btn_search').click(function(){
query();
});
// Initialize approver
initFormSelects();
});
//1. Initialize the data table
function initTable(){
table.render({ // Perform rendering
elem: '#tb', // Specify the original table element selector ( recommend id Selectors )
height: 400, // Custom height
loading: false, // Whether to load the bar ( Default true)
cols: [[ // Set the header
{field: 'id', title: ' Conference number ', width: 90},
{field: 'title', title: ' The title of the meeting ', width: 120},
{field: 'location', title: ' Place of meeting ', width: 140},
{field: 'startTime', title: ' Starting time ', width: 120},
{field: 'endTime', title: ' End time ', width: 120},
{field: 'meetingState', title: ' Meeting status ', width: 120},
{field: 'seatPic', title: ' Meeting row ', width: 120,
templet: function(d){
if(d.seatPic==null || d.seatPic=="")
return " Not yet seated ";
else
return "<img width='120px' src='"+d.seatPic+"'/>";
}
},
{field: 'auditName', title: ' Approved by ', width: 120},
{field: '', title: ' operation ', width: 200,toolbar:'#tbar'},
]]
});
}
//2. Click to query
function query(){
table.reload('tb', {
url: $("#ctx").val()+'/info.action', // Request address
method: 'POST', // Request mode ,GET perhaps POST
loading: true, // Whether to load the bar ( Default true)
page: true, // Pagination or not
where: { // Set additional parameters for asynchronous data interface , Arbitrarily set
'methodName':'myInfos',
'zhuchiren':$('#zhuchiren').val(),
'title':$('#title').val(),
},
request: { // Custom paging request parameter name
pageName: 'page', // Parameter name of page number , Default :page
limitName: 'rows' // Parameter name of data volume per page , Default :limit
},
done: function (res, curr, count) {
console.log(res);
}
});
// Toolbar events
table.on('tool(tb)', function(obj){ // notes :tool Is the toolbar event name ,test yes table Properties of the original container lay-filter=" Corresponding value "
row = obj.data; // Get current row data
var layEvent = obj.event; // get lay-event Corresponding value ( It can also be in the header event The corresponding value of the parameter )
var tr = obj.tr; // Get the current line tr Of DOM object ( If any )
console.log(row);
if(layEvent === 'seat'){ // Meeting row
open(row.id);
} else if(layEvent === 'send'){ // submit for censorship
// Judge whether there are seats
if(row.seatPic==null || row.seatPic==""){
layer.msg(' Please complete the meeting seating first , Then submit for approval !',function(){});
return false;
}
// Before opening the submission page , Please finish the meeting first ID Assignment of
$('#meetingId').val(row.id);
// Open the meeting for approval html Page layer
openLayerAudit();
} else if(layEvent==="back"){ // Feedback details
} else {// Delete
layer.confirm(' Are you sure you want to delete ?', {icon: 3, title:' Tips '}, function(index){
$.post($("#ctx").val()+'/info.action',{
'methodName':'updatezt',
'state':0,
'id':row.id
},function(rs){
if(rs.success){
// Call the query method to refresh the data
query();
}else{
layer.msg(rs.msg,function(){});
}
},'json');
layer.close(index);
});
}
});
}
// Open the meeting seating dialog box
function open(id){
layer.open({
type: 2, //layer Provides 5 Layer type . The values that can be passed in are :0( Message box , Default )1( Page layer )2(iframe layer )3( Loading layer )4(tips layer )
title: ' Meeting row ', // Dialog title
area: ['460px', '340px'], // Wide and high
skin: 'layui-layer-rim', // Style class name
content: $("#ctx").val()+'/jsp/meeting/seatPic.jsp?id='+id, // Pop up content . You can pass in ordinary html Content , You can also specify DOM, With more type Different but different
});
}
// Initialize approver
function initFormSelects(){
$.getJSON($("#ctx").val()+'/user.action',{
'methodName':'queryUserAll'
},function(rs){
console.log(rs);
let data=rs.data;
$.each(data,function(i,e){
$('#auditor').append(new Option(e.name,e.value));
});
// To render
form.render('select');
});
}
// Meeting submission for approval
function openLayerAudit(){
// Each time you open it, you will initialize the submitter and set the default value
$('#auditor').val("");
// You have to re render
form.render('select');
// Pop-up dialog box
layer.open({
type: 1, //layer Provides 5 Layer type . The values that can be passed in are :0( Message box , Default )1( Page layer )2(iframe layer )3( Loading layer )4(tips layer )
title:' Meeting submission for approval ',
area: ['426px', '140px'], // Wide and high
skin: 'layui-layer-rim', // Style class name
content: $('#audit'), // Pop up content . You can pass in ordinary html Content , You can also specify DOM, With more type Different but different
});
}
effect :

MeetingInfoDao
package com.zking.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.zking.entity.MeetingInfo;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
import com.zking.util.StringUtils;
public class MeetingInfoDao extends BaseDao<MeetingInfo>{
// Conference information added
public int add (MeetingInfo t) throws Exception {
String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)";
return super.executeUpdate(sql, t, new String[] {"title","content","canyuze","liexize","zhuchiren","location","startTime","endTime","remark"});
}
// General meeting query SQL sentence , Include meeting information table data , Host name 、 Name of approver 、 Meeting status
private String getSQL() {
return "SELECT a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,b.`name`,a.location\r\n" +
",DATE_FORMAT(a.startTime,'%Y-%m-%d %H:%i:%s') as startTime\r\n" +
",DATE_FORMAT(a.endTime,'%Y-%m-%d %H:%i:%s') as endTime\r\n" +
",a.state\r\n" +
",(case a.state\r\n" +
"when 0 then ' Cancel the meeting '\r\n" +
"when 1 then ' newly build '\r\n" +
"when 2 then ' To audit '\r\n" +
"when 3 then ' rejected '\r\n" +
"when 4 then ' To be opened '\r\n" +
"when 5 then ' Have in hand '\r\n" +
"when 6 then ' Start voting '\r\n" +
"else ' At the end of the meeting ' end\r\n" +
") as meetingState\r\n" +
",a.seatPic,a.remark,a.auditor,c.`name` as auditorName\r\n" +
"FROM t_oa_meeting_info a\r\n" +
"inner join t_oa_user b on a.zhuchiren = b.id\r\n" +
"left JOIN t_oa_user c on a.auditor = c.id where 1=1 ";
}
// My meeting
public List<Map<String, Object>> myInfos(MeetingInfo info, PageBean pageBean) throws Exception {
String sql = getSQL();
String title = info.getTitle();
if(StringUtils.isNotBlank(title)) {
sql += " and title like '%"+title+"%'";
}
// According to the current login user ID As a condition of the host field
sql+=" and zhuchiren="+info.getZhuchiren();
//System.out.println(sql);
return super.executeQuery(sql, pageBean);
}
// state :0 Cancel the meeting 1 newly build 2 To audit 3 rejected 4 To be opened 5 Have in hand 6 Start voting 7 Close the meeting , The default value is 1
public int updatezt(MeetingInfo m) throws Exception {
String sql = "update t_oa_meeting_info set state=? where id = ?";
return super.executeUpdate(sql, m, new String[] {"state","id"});
}
// Set the picture of meeting seating
public int updateSeatPicById(MeetingInfo info) throws Exception {
String sql = " update t_oa_meeting_info set seatPic = ? where id=?";
return super.executeUpdate(sql, info, new String[] {"seatPic","id"});
}
// Meeting submission for approval
public int updateAuditorById(MeetingInfo info) throws Exception {
String sql = " update t_oa_meeting_info set auditor = ? , state =2 where id=?";
return super.executeUpdate(sql, info, new String[] {"auditor","id"});
}
}
MeetingInfoAction
package com.zking.web;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.ConvertUtils;
import com.zking.dao.MeetingInfoDao;
import com.zking.entity.MeetingInfo;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.Base64ImageUtils;
import com.zking.util.BaseDao;
import com.zking.util.MyDateConverter;
import com.zking.util.PageBean;
import com.zking.util.PropertiesUtil;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class MeetingInfoAction extends ActionSupport implements ModelDriver<MeetingInfo>{
private MeetingInfo info = new MeetingInfo();
private MeetingInfoDao infoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
ConvertUtils.register(new MyDateConverter(), Date.class);
return info;
}
// Conference seating image generation
public String updateSeatPicById(HttpServletRequest req, HttpServletResponse resp) throws Exception {
/**
* 1. Accept the string corresponding to the picture passed from the front-end page to the background
* 2. With the help of tool classes, the string is generated into an image , Save to the path configured by the configuration file
* 3. Add server hard disk and Request address mapping , Can access
* 4. The requested address Save to the database
*/
try {
// E:/T280/images/123.png
// Get the storage address of the picture
String dirPath = PropertiesUtil.getValue("dirPath");
// Get the browser request path , For subsequent saving to the database
String serverPath = PropertiesUtil.getValue("serverPath"); // serverPath=/test_layui/upload/paizuo/
// Randomly generate a picture name
String fileName = UUID.randomUUID().toString().replaceAll("-", "") + ".png";
//info.getSeatPic();// Picture string
Base64ImageUtils.GenerateImage(info.getSeatPic().replaceAll("data:image/png;base64", ""), dirPath+fileName);
// take seatPic The content inside is modified to the request address
info.setSeatPic(serverPath + fileName);
// Modify the meeting seating The database column segment corresponding to the database image
int rs = infoDao.updateSeatPicById(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was successfully booked "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Meeting seating failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting seating failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// Meeting submission for approval
public String updateAuditorById(HttpServletRequest req, HttpServletResponse resp) {
try {
//rs It affects the number of rows
int rs = infoDao.updateAuditorById(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was successfully submitted for approval "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " The meeting failed to submit for approval "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " The meeting failed to submit for approval "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// New users
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
//rs It affects the number of rows
int rs = infoDao.add(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " Conference information added successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// My meeting
public String myInfos(HttpServletRequest req, HttpServletResponse resp) {
try {
PageBean pageBean = new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> lst = infoDao.myInfos(info, pageBean);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " My meeting data query succeeded ",pageBean.getTotal(),lst));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " My meeting data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
// My meeting : Delete ( Cancel the meeting )
public String updatezt(HttpServletRequest req, HttpServletResponse resp) {
try {
int rs = infoDao.updatezt(info);
if (rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was cancelled successfully "));
} else {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
}
The status is pending approval

边栏推荐
- Winter vacation homework & Stamp cutting
- The data read by Flink Oracle CDC is always null. Do you know
- Flutter text is left aligned with no blank space in the middle
- Use of room database in kotlin
- Oracle 19C OCP 1z0-082 certification examination question bank (42-50)
- pl/sql之动态sql与异常
- 有限元学习知识点备案
- Mysql8 one master one slave +mycat2 read write separation
- Registration of finite element learning knowledge points
- import error: ‘Icon‘ is not exported from ‘antd‘. Import icon error
猜你喜欢

Seq2seq and attention model learning notes

基于C语言实现的人机交互软件

KV database based on raft consensus protocol
![[untitled]](/img/3e/fb7c4d901643e6ea88a7d90ead045c.png)
[untitled]

Mysql/mariadb (Galera multi master mode) cluster construction

利用模m的原根存在性判断以及求解

pl/sql之动态sql与异常

Kept dual machine hot standby
![[C language] programmer's basic skill method -](/img/0e/e9111d4b341cc42aa4382b5fbd0001.png)
[C language] programmer's basic skill method - "creation and destruction of function stack frames"

Human computer interaction software based on C language
随机推荐
JS工具函数大全
基于C语言的哈夫曼转化软件
Does flinkcdc now support sqlserver instance name connection?
Flitter imitates wechat long press pop-up copy recall paste collection and other custom customization
Using the primitive root of module m to judge and solve
有限元学习知识点备案
[time complexity, space complexity]
Which financial product has the highest yield in 2022?
Arbitrum Nova release! Create a low-cost and high-speed dedicated chain in the game social field
Spark persistence strategy_ Cache optimization
23.6 23.7 web environment web environment variable reading
The effective condition of MySQL joint index and the invalid condition of index
The second lesson is the construction of development environment
Add in the registry right click to open in vscode
[untitled]
Nodejs2day(nodejs的模块化,npm下载包,模块加载机制)
[GUI] GUI programming; AWT package (interface properties, layout management, event monitoring)
IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
General file upload vulnerability getshell of a digital campus system (penetration test -0day)
[C language] programmer's basic skill method - "creation and destruction of function stack frames"