Commit bcf13e3c authored by 马超's avatar 马超

值班管理

parent d92229f0
......@@ -14,11 +14,11 @@
type="text/css">
<div class="page-container">
<div class="left-tree">
<button class="btn btn-success" onclick="optMx('add');" style="text-align:center;float:left;">
<button class="btn btn-success" onclick="optMx('add');" style="text-align:center;float:left;margin-left: 30px;">
新建</button>
<button class="btn btn-success" onclick="updateMx();" style="text-align:center;float:left;margin-left: 20px;">
修改</button>
<button class="btn btn-success" onclick="delMx();" style="text-align:center;float:right;">
<%--<button class="btn btn-success" onclick="updateMx();" style="text-align:center;float:left;margin-left: 20px;">
修改</button>--%>
<button class="btn btn-success" onclick="delMx();" style="text-align:center;float:left;margin-left: 20px;">
删除</button>
<input type="hidden" name="check_mx_id" id="check_mx_id">
<input type="hidden" name="check_mx_day" id="check_mx_day">
......
......@@ -5,121 +5,224 @@
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Vector" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_day = null;
String login_id = (String) session.getAttribute("session_login_id");
if ("".equals(login_id)) {
System.out.println("当前没有用户信息");
}
Vector v_type_list = null;
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String Mxday = pub.trimNull(request.getParameter("day"));
int divCount=30;
if(!"".equals(Mxday)){
divCount=Integer.parseInt(Mxday);
}
String divWidth=(divCount+2)*140-80+"px";
String action = pub.trimNull(request.getParameter("action"));
Hashtable ht = new Hashtable();
StringBuffer sql = new StringBuffer();
StringBuffer sql_day = new StringBuffer();
sql.append("select * from zb_type where mx_id=? order by order_num asc ");
sql_day.append("select * from zb_mx_day where mx_id=? and zb_type=? order by day asc ");
StringBuffer group_sql = new StringBuffer();
int listSize=1;
try {
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{mx_id});
if (v_list != null && v_list.size()>0) {
if(!"".equals(mx_id)){
sql.append("select * from zb_mx where id=?");
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{mx_id});
group_sql.append("select * from zb_type where mx_id=? order by order_num asc");
v_type_list = cf.doQuery(conn, group_sql.toString(), null, new Object[]{mx_id});
if(v_type_list!=null && v_type_list.size()>0){
listSize=v_type_list.size();
}
}
if (v_list!=null&&v_list.size() > 0) {
ht = (Hashtable) v_list.get(0);
}
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
<div style="border: solid 1px #eee;margin-top: 20px;height:550px;width:1100px;overflow: auto;">
<%
for(int i=0;i<v_list.size();i++){
Hashtable ht = (Hashtable) v_list.get(i);
String id=pub.trimNull((String)ht.get("id"));
String zb_type=pub.trimNull((String)ht.get("zb_type"));
String b_time=pub.trimNull((String)ht.get("b_time"));
String e_time=pub.trimNull((String)ht.get("e_time"));
%>
<%
if(i==0){%>
<div style="width:<%=divWidth%>;height:40px;float:left;white-space: nowrap;">
<div style="width:140px;height:40px;float:left;border:0.5px solid #000;">
<style>
.input-three {
width: 22%
}
.input-two {
width: 32%
}
.col-sm-2{
width:14%;
}
.col-sm-3{
width:19%;
}
.btn-red{ background-color:red;border: red}
.btn-green{ background-color:green;border: green}
</style>
<div class="">
<form class="form form-horizontal" id="form-admin-add">
<input type="hidden" value="<%=action%>" name="action" id="action">
<input type="hidden" value="<%=mx_id%>" name="mx_id" id="mx_id">
<input type="hidden" id="input_count" name="input_count" value="<%=listSize%>"/>
<input type="hidden" name="mx_day" id="mx_day" value="30" >
<div id="content" class="cl pd-5 bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>模型名字&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10">
<input type="text" class="input-text" name="mx_name" id="mx_name" value="<%=pub.trimNull((String)ht.get("name"))%>" >
</div>
</div>
<div class="row cl" id="zb_type_div">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>时间段&nbsp;
</label>
</div>
<%
for(int n=0;n<30;n++){
Hashtable ht1 = new Hashtable();
if(v_type_list != null && v_type_list.size() > 0){
for (int i = 0; i < v_type_list.size(); i++) {
ht1 = (Hashtable) v_type_list.get(i);
%>
<div style="width:140px;height:40px;line-height:40px;text-align:center;color:#fff;float:left;border:0.5px solid #000;background-color: #00b7ee">
<%=n+1%>
<div class="zbType row cl" id="div_<%=pub.trimNull((String)ht.get("id"))%>">
<input type="hidden" name="zb_type_id_<%=i+1%>" value="<%=pub.trimNull((String)ht1.get("id"))%>">
<label class="form-label col-xs-4" style="margin-top: 0px;">
<input type="text" style="width:30%;" autocomplete="off" class="input-text" value="<%=pub.trimNull((String)ht1.get("zb_type"))%>" placeholder="" id = "zb_type_<%=i+1%>" name="zb_type_<%=i+1%>" >
</label>
<div class="formControls col-xs-6">
<input type="text" style="width:25%;" class="input-text Wdate" onclick="WdatePicker({dateFmt:'HH-mm'})" value="<%=pub.trimNull((String)ht1.get("b_time"))%>" placeholder="" id = "b_time_<%=i+1%>" name="b_time_<%=i+1%>" >
&nbsp;&nbsp;
<input type="text" style="width:25%;" class="input-text Wdate" onclick="WdatePicker({dateFmt:'HH-mm'})" value="<%=pub.trimNull((String)ht1.get("e_time"))%>" placeholder="" id = "e_time_<%=i+1%>" name="e_time_<%=i+1%>" >
&nbsp;&nbsp;默认人数
<input type="text" style="width:20%;" class="input-text " value="<%=pub.trimNull((String)ht1.get("ren_num"))%>" placeholder="" id = "ren_num_<%=i+1%>" name="ren_num_<%=i+1%>" >
</div>
<%
if(i==0){
%>
<a href="javascript:void (0);" onclick="addDiv();" style="font-size: 25px;">+</a>
<%}else{%>
<a href="javascript:void (0);" onclick="deleteDiv('<%=pub.trimNull((String)ht.get("id"))%>');" style="font-size: 25px;display:none;">-</a>
<%}
%>
</div>
<% }%>
</div>
<%}%>
<div style="width:<%=divWidth%>;height:160px;float:left;">
<div style="width:140px;height:160px;float:left;border:0.5px solid #000;text-align: center;line-height: 120px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=b_time%>-<%=e_time%>)</p>
<%
}
}else{
%>
<div class="zbType row cl" id="div_1">
<label class="form-label col-xs-4" style="margin-top: 0px;">
<input type="text" style="width:30%;" autocomplete="off" class="input-text" value="" placeholder="" id = "zb_type_1" name="zb_type_1" >
</label>
<div class="formControls col-xs-6">
<input type="text" style="width:25%;" autocomplete="off" class="input-text Wdate" onclick="WdatePicker({dateFmt:'HH-mm'})" value="" placeholder="" id = "b_time_1" name="b_time_1" >
&nbsp;&nbsp;
<input type="text" style="width:25%;" autocomplete="off" class="input-text Wdate" onclick="WdatePicker({dateFmt:'HH-mm'})" value="" placeholder="" id = "e_time_1" name="e_time_1" >
&nbsp;&nbsp;默认人数
<input type="text" style="width:20%;" class="input-text " value="" placeholder="" id = "ren_num_1" name="ren_num_1" >
</div>
<a href="javascript:void (0);" onclick="addDiv();" style="font-size: 25px;">+</a>
</div>
<%
}
%>
</div>
<%
for(int n=0;n<30;n++){
%>
<div style="text-align:center;width:140px;height:160px;float:left;border:0.5px solid #000;position: relative">
<p style="height:10px;display:none;">
</p>
<button class="btn btn-success" style="display:none;text-align:center;position:absolute; right:0; bottom:0;">
修改</button>
</div>
<%}%>
</form>
</div>
<div class="cl mb-10 bk-gray " style="height: 50px;">
<div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
<input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
</div>
<%}%>
</div>
<script type="text/javascript">
function deleteUser(user_id){
layer.confirm('确认要删除吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?user_id="+user_id+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
searchModel();
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
})
<script>
var count;
var size='<%=listSize%>';
if(size==0){
count=1;
}else{
count=parseInt(size);
}
function addDiv(){
var name_count=parseInt($("#input_count").val());
$("#content").append("<div class=\"zbType row cl\" name=\""+(count+1)+"\" id=\"div_"+(count+1)+"\">\n" +
" <label class=\"form-label col-xs-4\" style=\"margin-top: 0px;\"> " +
" <input type=\"text\" style=\"width:30%;\" autocomplete=\"off\" class=\"input-text\" value=\"\" placeholder=\"\" id = \"zb_type_"+(name_count+1)+"\" name=\"zb_type_"+(name_count+1)+"\" > :</label>\n" +
" <div class=\"formControls col-xs-6\">\n" +
" <input type=\"text\" style=\"width:25%;\" autocomplete=\"off\" class=\"input-text Wdate\" onclick=\"WdatePicker({dateFmt:'HH-mm'})\" value=\"\" placeholder=\"\" id = \"b_time_"+(name_count+1)+"\" name=\"b_time_"+(name_count+1)+"\" >\n" +
" &nbsp;至&nbsp;\n" +
" <input type=\"text\" style=\"width:25%;\" autocomplete=\"off\" class=\"input-text Wdate\" onclick=\"WdatePicker({dateFmt:'HH-mm'})\" value=\"\" placeholder=\"\" id = \"e_time_"+(name_count+1)+"\" name=\"e_time_"+(name_count+1)+"\" >\n" +
" &nbsp;&nbsp;默认人数\n" +
" <input type=\"text\" style=\"width:20%;\" class=\"input-text \" value=\"\" placeholder=\"\" id = \"ren_num_"+(name_count+1)+"\" name=\"ren_num_"+(name_count+1)+"\" >" +
" </div>\n" +
" <a href=\"javascript:void (0);\" onclick=\"deleteDiv("+(count+1)+");\" style=\"font-size: 25px;\">-</a>"+
" </div>");
count++;
//var obj=document.getElementsByClassName("row cl").length;
var obj=$(".zbType").length;
$("#input_count").val(obj);
}
function deleteDiv(div_id){
$("#div_"+div_id).remove();
$('.zbType').each(function(index,element){
if(index!=0){
index=index+1;
//$(this).children(":first").html("号段"+index+":");
var div_index=$(this).attr("name");
$("#zb_type_"+div_index).attr("name","zb_type_"+index);
$("#b_time_"+div_index).attr("name","b_time_"+index);
$("#e_time_"+div_index).attr("name","e_time_"+index);
}
});
//var obj=document.getElementsByClassName("row cl").length;
var obj=$(".zbType").length;
$("#input_count").val(obj);
}
function LayerOpen(title, url, w, h) {
if($("#user_id").val()==''){
layer.alert("请先保存用户再添加相关人员",{icon:5,title:"提示"});
return false;
}
var abc = layer.open({
title:title,
type: 2,
content: url,
area: [w, h],
maxmin: true
});
layer.full(abc);
}
function optOrder(opt,user_id){
function saveForm() {
if($("#mx_name").val()==''){
layer.alert("模型名称不能为空",{icon:5,title:"提示"});
return false;
}
$.ajax({
type: "post",
url: "opt_order.jsp",
data:{"user_id":user_id,"opt":opt},
success: function (data) {
if (data.indexOf("success") >= 0) {
type: "POST",
url: "./action.jsp",
data: $('#form-admin-add').serialize(),
success: function (msg) {
if (msg.indexOf("success") >= 0) {
var mx_id = msg.substring(msg.indexOf(",")+1,msg.length);
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
document.getElementById("check_mx_id").value=mx_id;
searchModel();
openLi(mx_id,7);
});
} else {
layer.msg('操作失败'+data, {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
......@@ -129,17 +232,31 @@
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
function deleteUser(user_id,p_user_id){
layer.confirm('确认要删除吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?&p_user_id="+p_user_id+"&user_id="+user_id+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
location.reload();
if(rel_user_id!=''){
window.parent.location.reload();
}
parent.searchModel();
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
});
}
%>
\ No newline at end of file
</script>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/11
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_day = null;
String login_id = (String) session.getAttribute("session_login_id");
if ("".equals(login_id)) {
System.out.println("当前没有用户信息");
}
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String Mxday = pub.trimNull(request.getParameter("day"));
int divCount=30;
if(!"".equals(Mxday)){
divCount=Integer.parseInt(Mxday);
}
String divWidth=(divCount+2)*140-80+"px";
StringBuffer sql = new StringBuffer();
StringBuffer sql_day = new StringBuffer();
sql.append("select * from zb_type where mx_id=? order by order_num asc ");
sql_day.append("select * from zb_mx_day where mx_id=? and zb_type=? order by day asc ");
try {
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{mx_id});
if (v_list != null && v_list.size()>0) {
}
%>
<div style="border: solid 1px #eee;margin-top: 20px;height:550px;width:1100px;overflow: auto;">
<%
for(int i=0;i<v_list.size();i++){
Hashtable ht = (Hashtable) v_list.get(i);
String id=pub.trimNull((String)ht.get("id"));
String zb_type=pub.trimNull((String)ht.get("zb_type"));
String b_time=pub.trimNull((String)ht.get("b_time"));
String e_time=pub.trimNull((String)ht.get("e_time"));
%>
<%
if(i==0){%>
<div style="width:<%=divWidth%>;height:40px;float:left;white-space: nowrap;">
<div style="width:140px;height:40px;float:left;border:0.5px solid #000;">
</div>
<%
for(int n=0;n<30;n++){
%>
<div style="width:140px;height:40px;line-height:40px;text-align:center;color:#fff;float:left;border:0.5px solid #000;background-color: #00b7ee">
<%=n+1%>
</div>
<% }%>
</div>
<%}%>
<div style="width:<%=divWidth%>;height:160px;float:left;">
<div style="width:140px;height:160px;float:left;border:0.5px solid #000;text-align: center;line-height: 120px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=b_time%>-<%=e_time%>)</p>
</div>
<%
for(int n=0;n<30;n++){
%>
<div style="text-align:center;width:140px;height:160px;float:left;border:0.5px solid #000;position: relative">
<p style="height:10px;display:none;">
</p>
<button class="btn btn-success" style="display:none;text-align:center;position:absolute; right:0; bottom:0;">
修改</button>
</div>
<%}%>
</div>
<%}%>
</div>
<script type="text/javascript">
function deleteUser(user_id){
layer.confirm('确认要删除吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?user_id="+user_id+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
searchModel();
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
})
}
function optOrder(opt,user_id){
$.ajax({
type: "post",
url: "opt_order.jsp",
data:{"user_id":user_id,"opt":opt},
success: function (data) {
if (data.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
searchModel();
});
} else {
layer.msg('操作失败,'+data, {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.Logger" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.text.ParseException" %>
<%!
public static String getUserNames(ConnectionFactory cf,Connection conn,int startIndex,int n,String zb_type){
StringBuffer userNum = new StringBuffer();
userNum.append("select t2.id,t2.user_name,t2.tel,t2.gh,t2.order_num from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? order by t2.order_num asc ");
Vector userListSize = cf.doQuery(conn,userNum.toString(),null,new Object[]{zb_type});
StringBuffer sql=new StringBuffer();
sql.append("select t2.user_name from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? ");
sql.append(" and t2.role_num in(");
List list= new ArrayList();
list.add(zb_type);
String user_names="";
int startIndex_2=startIndex;
for(int i=0;i<n;i++){
startIndex=startIndex+1;
if(startIndex==userListSize.size()+1){
startIndex=1;
}
if(i==n-1){
sql.append(startIndex );
}else{
sql.append(startIndex + ",");
}
}
sql.append(") order by field (t2.role_num,");
for(int i=0;i<n;i++){
startIndex_2=startIndex_2+1;
if(startIndex_2==userListSize.size()+1){
startIndex_2=1;
}
if(i==n-1){
sql.append(startIndex_2 );
}else{
sql.append(startIndex_2 + ",");
}
}
sql.append(") ");
System.out.println("=="+sql.toString()+zb_type);
Vector userList = cf.doQuery(conn,sql.toString(),null,list.toArray());
if(userList!=null && userList.size()>0){
for(int i=0;i<userList.size();i++) {
Hashtable ht1 = (Hashtable) userList.get(i);
String user_name = (String) ht1.get("user_name");
user_names=user_names+user_name+",";
}
}else{
System.out.println("方法查询出错11"+cf.getMsg());
}
return startIndex+"_"+user_names;
}
public static List<String> getDays(String startTime, String endTime) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = dateFormat.parse(startTime);
Date end = dateFormat.parse(endTime);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
public static String getBeforeDay(String specifiedDay)
{
Calendar c = Calendar.getInstance();
Date date = null;
try
{
date = new SimpleDateFormat("yyyy-MM-dd").parse(specifiedDay);
}
catch (ParseException e)
{
e.printStackTrace();
}
c.setTime(date);
int day = c.get(Calendar.DATE);
c.set(Calendar.DATE, day - 1);
String dayBefore = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
return dayBefore;
}
public static int getUserOrder(ConnectionFactory cf,Connection conn,String username) {
int order_num=0;
Vector userList = cf.doQuery(conn,"select order_num from zb_bgs_user where user_name=?",null,new Object[]{username});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
order_num = Integer.parseInt((String) ht1.get("order_num"));
}
return order_num;
}
public static int getStartIndexByDate(ConnectionFactory cf,Connection conn,String date)
{
String zb_user ="";
Vector userList = cf.doQuery(conn,"select zb_user from zb_user_gl_bgs where year=? order by id desc",null,new Object[]{date});
if(userList!=null && userList.size()>0) {
Hashtable ht1 = (Hashtable) userList.get(0);
zb_user = (String) ht1.get("zb_user");
}
if(zb_user.indexOf(",")>0){
zb_user=zb_user.substring(zb_user.lastIndexOf(",")+1,zb_user.length());
}
return getUserOrder(cf,conn,zb_user);
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String action = pub.trimNull(request.getParameter("action"));
String action_msg="";
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String b_time = pub.trimNull(request.getParameter("b_time"));
String e_time = pub.trimNull(request.getParameter("e_time"));
String date_left = pub.trimNull(request.getParameter("date_left"));
String date_right = pub.trimNull(request.getParameter("date_right"));
String user_left = pub.trimNull(request.getParameter("user_left"));
String user_right = pub.trimNull(request.getParameter("user_right"));
String zb_type_left = pub.trimNull(request.getParameter("zb_type_left"));
String zb_type_right = pub.trimNull(request.getParameter("zb_type_right"));
String mx_day ="";
String mxId="";
if(!"".equals(mx_id)){
mx_day = mx_id.substring(mx_id.indexOf("_")+1,mx_id.length());//模型天数
mxId=mx_id.substring(0,mx_id.indexOf("_"));;//模型id
}
int mxDay=1;
if(!"".equals(mx_day)){
mxDay=Integer.parseInt(mx_day);
}
String userNames="";
List<String> list=null;
int selectDay=0;
if(!"".equals(b_time)&&!"".equals(e_time)){
list= getDays(b_time,e_time);//获取两个时间点之间的日期
selectDay=list.size();
}
String add_user = pub.trimNull((String) session.getAttribute("session_login_id"));
if ("".equals(add_user)) {
System.out.println("当前没有用户信息");
}
int startIndexBefore=0;
String add_time = pub.getCurrentServerTime();
StringBuffer sql_add=new StringBuffer("insert into zb_zdpb_bgs (b_time,e_time,mx_id,add_time,add_user) values (?,?,?,?,?)");
try {
conn = com.censoft.db.DBUtil.getConnection();
List list_add= new ArrayList();
list_add.add(b_time);
list_add.add(e_time);
list_add.add(mxId);
list_add.add(add_time);
list_add.add(add_user);
conn.setAutoCommit(false);
boolean is_oper = false;
if("add".equals(action)){
action_msg="新增";
is_oper = cf.executeUpdate(conn, sql_add.toString(),list_add.toArray());
if (!is_oper) {
conn.rollback();
System.out.println("新增zb_zdpb表出错了" + cf.getMsg());
return;
}
int index=0;
StringBuffer sql1=new StringBuffer("insert into zb_user_gl_bgs (year,zb_type,zb_user,order_num,add_user,add_time) values (?,?,?,?,?,?)");
Vector zb_type_list = cf.doQuery(conn,"select * from zb_type_bgs where mx_id=? order by order_num asc",null,new Object[]{mxId});
if(selectDay/mxDay>0){//所选天数比模型天数多
for(int a=0;a<selectDay/mxDay;a++){//按照模型天数轮回
if(zb_type_list!=null && zb_type_list.size()>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
int startIndex=0;
for(int n=0;n<mxDay;n++){//按照模型天数,从开始日期逐天插入
index=a*mxDay+n;//日期坐标索引
if(n==mxDay){
index=0;
}
//根据开始人员序号索引和人数进行插入
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num),zb_type);
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
}
}
}
}
//剩余天数
if(selectDay%mxDay>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
index=selectDay-(selectDay%mxDay);
int startIndex=0;
for(int n=0;n<selectDay%mxDay;n++){
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num),zb_type);
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_user_gl_bgs表出错了" + cf.getMsg());
conn.rollback();
return;
}
index++;
}
}
}
}else if("delete".equals(action)){
is_oper = cf.executeUpdate(conn, "delete from zb_zdpb_bgs where b_time=? and e_time=?"
, new Object[]{b_time,e_time});
if (!is_oper) {
System.out.println("删除zb_zdpb表出错了" + cf.getMsg());
conn.rollback();
return;
}
is_oper = cf.executeUpdate(conn, "delete from zb_user_gl_bgs where year>=? and year<=?"
, new Object[]{b_time,e_time});
if (!is_oper) {
System.out.println("删除zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
}else if("changeUser".equals(action)){
is_oper = cf.executeUpdate(conn, "update zb_user_gl_bgs set zb_user=REPLACE(zb_user,?,?) where year=? and zb_type=?"
, new Object[]{user_left,user_right,date_left,zb_type_left});
if (!is_oper) {
System.out.println("交换zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
is_oper = cf.executeUpdate(conn, "update zb_user_gl_bgs set zb_user=REPLACE(zb_user,?,?) where year=? and zb_type=?"
, new Object[]{user_right,user_left,date_right,zb_type_right});
if (!is_oper) {
System.out.println("交换zb_user_gl_bgs表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
if (!is_oper) {
conn.rollback();
System.out.println("操作出错了" + cf.getMsg());
return;
}
Logger.log(conn, "办公室值班管理",action_msg, add_user, "", request);
conn.commit();
if (!is_oper) {
conn.rollback();
out.println(cf.getMsg());
} else {
out.println("success,"+mx_id);
}
} catch (Exception e) {
conn.rollback();
System.out.println("有异常" + e);
return;
} finally {
if (conn != null) {
conn.setAutoCommit(true);
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.Logger" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.text.ParseException" %>
<%!
public static String getUserNames(ConnectionFactory cf,Connection conn,int startIndex,int n){
Vector userListSize = cf.doQuery(conn,"select id from zb_user",null,new Object[]{});
StringBuffer sql=new StringBuffer("select user_name from zb_user where 1=1 and order_num in(");
List list= new ArrayList();
String user_names="";
int startIndex_2=startIndex;
for(int i=0;i<n;i++){
startIndex=startIndex+1;
if(startIndex==userListSize.size()+1){
startIndex=1;
}
if(i==n-1){
sql.append(startIndex );
}else{
sql.append(startIndex + ",");
}
}
sql.append(") order by field (order_num,");
for(int i=0;i<n;i++){
startIndex_2=startIndex_2+1;
if(startIndex_2==userListSize.size()+1){
startIndex_2=1;
}
if(i==n-1){
sql.append(startIndex_2 );
}else{
sql.append(startIndex_2 + ",");
}
}
sql.append(") ");
Vector userList = cf.doQuery(conn,sql.toString(),null,list.toArray());
if(userList!=null && userList.size()>0){
for(int i=0;i<userList.size();i++) {
Hashtable ht1 = (Hashtable) userList.get(i);
String user_name = (String) ht1.get("user_name");
user_names=user_names+user_name+",";
}
}else{
System.out.println("方法查询出错"+cf.getMsg());
}
return startIndex+"_"+user_names;
}
public static List<String> getDays(String startTime, String endTime) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = dateFormat.parse(startTime);
Date end = dateFormat.parse(endTime);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
public static String getBeforeDay(String specifiedDay)
{
Calendar c = Calendar.getInstance();
Date date = null;
try
{
date = new SimpleDateFormat("yyyy-MM-dd").parse(specifiedDay);
}
catch (ParseException e)
{
e.printStackTrace();
}
c.setTime(date);
int day = c.get(Calendar.DATE);
c.set(Calendar.DATE, day - 1);
String dayBefore = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
return dayBefore;
}
public static int getUserOrder(ConnectionFactory cf,Connection conn,String username) {
int order_num=0;
Vector userList = cf.doQuery(conn,"select order_num from zb_user where user_name=?",null,new Object[]{username});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
order_num = Integer.parseInt((String) ht1.get("order_num"));
}
return order_num;
}
public static int getStartIndexByDate(ConnectionFactory cf,Connection conn,String date)
{
String zb_user ="";
Vector userList = cf.doQuery(conn,"select zb_user from zb_user_gl where year=? order by id desc",null,new Object[]{date});
if(userList!=null && userList.size()>0) {
Hashtable ht1 = (Hashtable) userList.get(0);
zb_user = (String) ht1.get("zb_user");
}
if(zb_user.indexOf(",")>0){
zb_user=zb_user.substring(zb_user.lastIndexOf(",")+1,zb_user.length());
}
return getUserOrder(cf,conn,zb_user);
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String action = pub.trimNull(request.getParameter("action"));
String action_msg="";
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String b_time = pub.trimNull(request.getParameter("b_time"));
String e_time = pub.trimNull(request.getParameter("e_time"));
String date_left = pub.trimNull(request.getParameter("date_left"));
String date_right = pub.trimNull(request.getParameter("date_right"));
String user_left = pub.trimNull(request.getParameter("user_left"));
String user_right = pub.trimNull(request.getParameter("user_right"));
String zb_type_left = pub.trimNull(request.getParameter("zb_type_left"));
String zb_type_right = pub.trimNull(request.getParameter("zb_type_right"));
String mx_day ="";
String mxId="";
if(!"".equals(mx_id)){
mx_day = mx_id.substring(mx_id.indexOf("_")+1,mx_id.length());//模型天数
mxId=mx_id.substring(0,mx_id.indexOf("_"));;//模型id
}
int mxDay=1;
if(!"".equals(mx_day)){
mxDay=Integer.parseInt(mx_day);
}
String userNames="";
List<String> list=null;
int selectDay=0;
if(!"".equals(b_time)&&!"".equals(e_time)){
list= getDays(b_time,e_time);//获取两个时间点之间的日期
selectDay=list.size();
}
String add_user = pub.trimNull((String) session.getAttribute("session_login_id"));
if ("".equals(add_user)) {
System.out.println("当前没有用户信息");
}
int startIndexBefore=0;
String add_time = pub.getCurrentServerTime();
StringBuffer sql_add=new StringBuffer("insert into zb_zdpb (b_time,e_time,mx_id,add_time,add_user) values (?,?,?,?,?)");
try {
conn = com.censoft.db.DBUtil.getConnection();
List list_add= new ArrayList();
list_add.add(b_time);
list_add.add(e_time);
list_add.add(mxId);
list_add.add(add_time);
list_add.add(add_user);
conn.setAutoCommit(false);
boolean is_oper = false;
if("add".equals(action)){
if(!"".equals(b_time)){
String beforeDate=getBeforeDay(b_time);//获取开始时间的上一天
startIndexBefore=getStartIndexByDate(cf,conn,beforeDate);//根据上一天获取最后人员的序号
}
action_msg="新增";
is_oper = cf.executeUpdate(conn, sql_add.toString(),list_add.toArray());
if (!is_oper) {
conn.rollback();
System.out.println("新增zb_zdpb表出错了" + cf.getMsg());
return;
}
int startIndex=startIndexBefore;
int index=0;
StringBuffer sql1=new StringBuffer("insert into zb_user_gl (year,zb_type,zb_user,order_num,add_user,add_time) values (?,?,?,?,?,?)");
Vector zb_type_list = cf.doQuery(conn,"select * from zb_type where mx_id=? order by order_num asc",null,new Object[]{mxId});
if(selectDay/mxDay>0){//所选天数比模型天数多
for(int a=0;a<selectDay/mxDay;a++){//按照模型天数轮回
if(zb_type_list!=null && zb_type_list.size()>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
for(int n=0;n<mxDay;n++){//按照模型天数,从开始日期逐天插入
index=a*mxDay+n;//日期坐标索引
if(n==mxDay){
index=0;
}
//根据开始人员序号索引和人数进行插入
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num));
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
}
}
}
}
//剩余天数
if(selectDay%mxDay>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
index=selectDay-(selectDay%mxDay);
for(int n=0;n<selectDay%mxDay;n++){
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num));
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
index++;
}
}
}
}else if("delete".equals(action)){
is_oper = cf.executeUpdate(conn, "delete from zb_zdpb where b_time=? and e_time=?"
, new Object[]{b_time,e_time});
if (!is_oper) {
System.out.println("删除zb_zdpb表出错了" + cf.getMsg());
conn.rollback();
return;
}
is_oper = cf.executeUpdate(conn, "delete from zb_user_gl where year>=? and year<=?"
, new Object[]{b_time,e_time});
if (!is_oper) {
System.out.println("删除zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
}else if("changeUser".equals(action)){
is_oper = cf.executeUpdate(conn, "update zb_user_gl set zb_user=REPLACE(zb_user,?,?) where year=? and zb_type=?"
, new Object[]{user_left,user_right,date_left,zb_type_left});
if (!is_oper) {
System.out.println("交换zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
is_oper = cf.executeUpdate(conn, "update zb_user_gl set zb_user=REPLACE(zb_user,?,?) where year=? and zb_type=?"
, new Object[]{user_right,user_left,date_right,zb_type_right});
if (!is_oper) {
System.out.println("交换zb_user_gl表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
if (!is_oper) {
conn.rollback();
System.out.println("操作出错了" + cf.getMsg());
return;
}
Logger.log(conn, "值班管理",action_msg, add_user, "", request);
conn.commit();
if (!is_oper) {
conn.rollback();
out.println(cf.getMsg());
} else {
out.println("success,"+mx_id);
}
} catch (Exception e) {
conn.rollback();
System.out.println("有异常" + e);
return;
} finally {
if (conn != null) {
conn.setAutoCommit(true);
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.Logger" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.text.ParseException" %>
<%!
public static String getUserNames(ConnectionFactory cf,Connection conn,int startIndex,int n){
Vector userListSize = cf.doQuery(conn,"select id from zb_user",null,new Object[]{});
StringBuffer sql=new StringBuffer("select user_name from zb_user where 1=1 and order_num in(");
List list= new ArrayList();
String user_names="";
int startIndex_2=startIndex;
for(int i=0;i<n;i++){
startIndex=startIndex+1;
if(startIndex==userListSize.size()+1){
startIndex=1;
}
if(i==n-1){
sql.append(startIndex );
}else{
sql.append(startIndex + ",");
}
}
sql.append(") order by field (order_num,");
for(int i=0;i<n;i++){
startIndex_2=startIndex_2+1;
if(startIndex_2==userListSize.size()+1){
startIndex_2=1;
}
if(i==n-1){
sql.append(startIndex_2 );
}else{
sql.append(startIndex_2 + ",");
}
}
sql.append(") ");
Vector userList = cf.doQuery(conn,sql.toString(),null,list.toArray());
if(userList!=null && userList.size()>0){
for(int i=0;i<userList.size();i++) {
Hashtable ht1 = (Hashtable) userList.get(i);
String user_name = (String) ht1.get("user_name");
user_names=user_names+user_name+",";
}
}else{
System.out.println("方法查询出错"+cf.getMsg());
}
return startIndex+"_"+user_names;
}
public static List<String> getDays(String startTime, String endTime) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = dateFormat.parse(startTime);
Date end = dateFormat.parse(endTime);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
public static int getUserOrder(ConnectionFactory cf,Connection conn,String username) {
int order_num =1;
if(username.indexOf(",")>0){
username=username.substring(username.lastIndexOf(",")+1,username.length());
}
Vector userList = cf.doQuery(conn,"select order_num from zb_user where user_name=?",null,new Object[]{username});
if(userList!=null && userList.size()>0){
for(int i=0;i<userList.size();i++) {
Hashtable ht1 = (Hashtable) userList.get(i);
order_num = Integer.parseInt((String) ht1.get("order_num"));
}
}
return order_num;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String action = pub.trimNull(request.getParameter("action"));
String action_msg="";
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String b_time = pub.trimNull(request.getParameter("b_time"));
String e_time = pub.trimNull(request.getParameter("e_time"));
String mx_day = mx_id.substring(mx_id.indexOf("_")+1,mx_id.length());
String mxId=mx_id.substring(0,mx_id.indexOf("_"));;
int mxDay=1;
if(!"".equals(mx_day)){
mxDay=Integer.parseInt(mx_day);
}
String userNames="";
List<String> list= getDays(b_time,e_time);
int selectDay=list.size();
String add_user = pub.trimNull((String) session.getAttribute("session_login_id"));
if ("".equals(add_user)) {
System.out.println("当前没有用户信息");
}
String add_time = pub.getCurrentServerTime();
StringBuffer sql_add=new StringBuffer("insert into zb_zdpb (b_time,e_time,mx_id,add_time,add_user) values (?,?,?,?,?)");
try {
conn = com.censoft.db.DBUtil.getConnection();
List list_add= new ArrayList();
list_add.add(b_time);
list_add.add(e_time);
list_add.add(mx_id);
list_add.add(add_time);
list_add.add(add_user);
conn.setAutoCommit(false);
boolean is_oper = false;
if("add".equals(action)){
action_msg="新增";
is_oper = cf.executeUpdate(conn, sql_add.toString(),list_add.toArray());
if (!is_oper) {
conn.rollback();
System.out.println("新增zb_zdpb表出错了" + cf.getMsg());
return;
}
if(mxDay==selectDay){
StringBuffer sql1=new StringBuffer("insert into zb_user_gl (year,zb_type,zb_user,order_num,add_user,add_time) values (?,?,?,?,?,?)");
StringBuffer sql2=new StringBuffer("select t1.user_name,t2.zb_type from zb_mx_day t1 join zb_type t2 on t1.zb_type=t2.id" +
" where t1.mx_id=? order by t1.id asc");
Vector mxList=cf.doQuery(conn,sql2.toString(),null,new Object[]{mxId});
if(mxList!=null && mxList.size()>0){
int n=0;
for(int i=0;i<mxList.size();i++) {
if(i%selectDay==0){
n=0;
}
Hashtable ht = (Hashtable) mxList.get(i);
String user_name = pub.trimNull((String) ht.get("user_name"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
System.out.println(n);
is_oper = cf.executeUpdate(conn, sql1.toString(),new Object[]{list.get(n),zb_type,user_name,i+1,add_user,add_time});
if (!is_oper) {
conn.rollback();
System.out.println("插入zb_user_gl表操作出错了" + cf.getMsg());
return;
}
n++;
}
}
}else if(selectDay>mxDay){
int startIndex=0;
int renNum=0;
int index=0;
StringBuffer sql1=new StringBuffer("insert into zb_user_gl (year,zb_type,zb_user,order_num,add_user,add_time) values (?,?,?,?,?,?)");
StringBuffer sql2=new StringBuffer("select t1.user_name,t2.zb_type,t2.ren_num from zb_mx_day t1 join zb_type t2 on t1.zb_type=t2.id" +
" where t1.mx_id=? order by t1.id asc");
Vector mxList=cf.doQuery(conn,sql2.toString(),null,new Object[]{mxId});
if(mxList!=null && mxList.size()>0){
for(int i=0;i<mxList.size();i++) {
Hashtable ht = (Hashtable) mxList.get(i);
String user_name = pub.trimNull((String) ht.get("user_name"));
if(i==mxDay-1){
startIndex=getUserOrder(cf,conn,user_name);
}
String zb_type = pub.trimNull((String) ht.get("zb_type"));
is_oper = cf.executeUpdate(conn, sql1.toString(),new Object[]{list.get(index),zb_type,user_name,i+1,add_user,add_time});
if (!is_oper) {
conn.rollback();
System.out.println("插入zb_user_gl表操作出错了" + cf.getMsg());
return;
}
index++;
}
}
Vector zb_type_list = cf.doQuery(conn,"select * from zb_type where mx_id=? order by order_num asc",null,new Object[]{mxId});
if((selectDay-mxDay)/mxDay>0){
for(int a=0;a<(selectDay-mxDay)/mxDay;a++){
if(zb_type_list!=null && zb_type_list.size()>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
for(int n=0;n<mxDay;n++){
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num));
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_mx_day表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
index++;
}
}
}
}
if(zb_type_list!=null && zb_type_list.size()>0) {
for (int i = 0; i < zb_type_list.size(); i++) {
Hashtable ht = (Hashtable) zb_type_list.get(i);
String ren_num = pub.trimNull((String) ht.get("ren_num"));
String zb_type = pub.trimNull((String) ht.get("zb_type"));
for(int n=0;n<selectDay%mxDay;n++){
userNames=getUserNames(cf,conn,startIndex,Integer.parseInt(ren_num));
if(!"".equals(userNames)){
startIndex = Integer.parseInt(userNames.substring(0,userNames.indexOf("_")));
userNames = userNames.substring(userNames.indexOf("_")+1,userNames.length()-1);
}
is_oper = cf.executeUpdate(conn, sql1.toString()
, new Object[]{list.get(index),zb_type, userNames,index+1,add_user,add_time});
if (!is_oper) {
System.out.println("新增zb_mx_day表出错了" + cf.getMsg());
conn.rollback();
return;
}
}
index++;
}
}
}
}
if (!is_oper) {
conn.rollback();
System.out.println("操作出错了" + cf.getMsg());
return;
}
Logger.log(conn, "值班管理",action_msg, add_user, "", request);
conn.commit();
if (!is_oper) {
conn.rollback();
out.println(cf.getMsg());
} else {
out.println("success,"+mx_id);
}
} catch (Exception e) {
conn.rollback();
System.out.println("有异常" + e);
return;
} finally {
if (conn != null) {
conn.setAutoCommit(true);
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.col-sm-2{
width:100px;
}
.btn-green{ background-color:green;border: green}
</style>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="exportWeek.jsp" >
<div style="height:450px;overflow: hidden;text-align: center">
<div style="width:45%;height:90%;float:left;border: solid 1px #eee;margin-left: 40px">
<div class="row cl">
<label class="form-label col-xs-2 col-sm-2" style="width:100px;">
日期&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-5">
<input type="text" class="input-text Wdate" autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:refrashTask})" name="b_time" id="b_time" value="" >
</div>
</div>
<div id="leftUserList" >
</div>
</div>
<div style="width:45%;height:90%;float:left;border: solid 1px #eee;margin-left: 20px">
<div class="row cl">
<label class="form-label col-xs-2 col-sm-2" style="width:100px;">
日期&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-5">
<input type="text" class="input-text Wdate" autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:refrashTask2})" name="e_time" id="e_time" value="" >
</div>
</div>
<div id="rightUserList" >
</div>
</div>
<div class="cl mb-10 " style="height: 50px;">
<div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
<input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;换班&nbsp;&nbsp;">
</div>
</div>
</div>
</form>
</div>
<script>
function saveForm() {
var date_left=$("#b_time").val();
var date_right=$("#e_time").val();
var user_left=$("input[name='leftUserList_1']:checked").val();
var zb_type_left=user_left.substring(user_left.indexOf("_")+1,user_left.length);
user_left=user_left.substring(0,user_left.indexOf("_"));
var user_right=$("input[name='rightUserList_1']:checked").val();
var zb_type_right=user_right.substring(user_right.indexOf("_")+1,user_right.length);
user_right=user_right.substring(0,user_right.indexOf("_"));
$.ajax({
type: "post",
url: "action.jsp?action=changeUser&date_left="+date_left+"&date_right="+date_right
+"&user_left="+user_left+"&user_right="+user_right+"&zb_type_left="+zb_type_left+"&zb_type_right="+zb_type_right,
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
function refrashTask() {
var value=$("#b_time").val();
$.ajax({
type: "post",
url: "getUserBydate-t.jsp?year="+value+"&divId=leftUserList",
success: function (msg) {
$("#leftUserList").html(msg);
}
});
}
function refrashTask2() {
var value=$("#e_time").val();
$.ajax({
type: "post",
url: "getUserBydate-t.jsp?year="+value+"&divId=rightUserList",
success: function (msg) {
$("#rightUserList").html(msg);
}
});
}
</script>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.col-sm-2{
width:14%;
}
.col-sm-3{
width:19%;
}
.btn-red{ background-color:red;border: red}
.btn-green{ background-color:green;border: green}
</style>
<div class="">
<form class="form form-horizontal" id="form-admin-add">
<input type="hidden" value="add" name="action" id="action">
<div id="content" class="cl pd-5 bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>开始时间&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10">
<input type="text" class="input-text Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="b_time" id="b_time" value="" >
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>结束时间&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10">
<input type="text" class="input-text Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="e_time" id="e_time" value="" >
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>选择模型&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10" id="mx_id">
<script>
$.post("./zd_view_list.jsp?name_id=mx_id&math="+Math.random(),function(data){
document.getElementById("mx_id").innerHTML=data;
}
);
</script>
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2" >
</label>
<div class="formControls col-xs-8 col-sm-10" style="color: red;">
所选时间应为模型天数的整数倍
</div>
</div>
</div>
</form>
</div>
<div class="cl mb-10 bk-gray " style="height: 50px;">
<div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
<input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
<input class="btn btn-primary radius btn-red" type="button" onclick="javascript:deleteForm();" value="&nbsp;&nbsp;重置排班&nbsp;&nbsp;">
</div>
</div>
<script>
function saveForm() {
if($("#b_time").val()==''||$("#e_time").val()==''){
layer.alert("时间不能为空",{icon:5,title:"提示"});
return false;
}
if($("#mx_id option:selected").val()==''){
layer.alert("请选择模型",{icon:5,title:"提示"});
return false;
}
$.ajax({
type: "POST",
url: "./action.jsp",
data: $('#form-admin-add').serialize(),
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
function deleteForm(){
if($("#b_time").val()==''||$("#e_time").val()==''){
layer.alert("时间不能为空",{icon:5,title:"提示"});
return false;
}
layer.confirm('确认要重置吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?b_time="+$("#b_time").val()+"&e_time="+$("#e_time").val()+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
});
}
</script>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/7/7
Time: 15:12
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import=" java.io.BufferedInputStream" %>
<%@ page import=" java.io.BufferedOutputStream" %>
<%@ page import=" java.io.File" %>
<%@ page import=" java.io.FileInputStream" %>
<%@ page import=" java.io.FileOutputStream" %>
<%@ page import=" java.io.IOException" %>
<%@ page import=" java.io.InputStream" %>
<%@ page import=" java.io.OutputStream" %>
<%@ page import=" java.text.SimpleDateFormat" %>
<%@ page import=" javax.servlet.http.HttpServletResponse" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.poi.xssf.usermodel.*" %>
<%@ page import="org.apache.poi.ss.util.CellRangeAddress" %>
<%!
private void download(String path, HttpServletResponse response) {
try {
// path是指欲下载的文件的路径。
File file = new File(path);
// 取得文件名。
String filename = file.getName();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename="+ new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
toClient.write(buffer);
toClient.flush();
toClient.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String year = pub.trimNull(request.getParameter("exportDate"));
System.out.println(year);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = sdf.format(new Date()) + ".xlsx";
// 文件路径
String filePath = fileName;
try {
conn = com.censoft.db.DBUtil.getConnection();
if(!"".equals(year)){
year=year.substring(0,year.length()-1);
}
String[] years=year.split(",");
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_user_gl_bgs where 1=1 ");
sb.append(" and year in ( ");
if(years!=null&&years.length>0){
for(int m=0;m<years.length;m++){
if(m==years.length-1){
sb.append("'" + years[m] + "'");
}else{
sb.append("'" + years[m] + "',");
}
}
}
sb.append(" )");
sb.append(" order by year asc,id asc");
Vector v_list = cf.doQuery(conn, sb.toString(), null, new Object[]{});
if (v_list == null) {
System.out.println("查询出错"+cf.getMsg());
return;
}
// 输出流
OutputStream os = new FileOutputStream(filePath);
// 工作区
XSSFWorkbook wb = new XSSFWorkbook();
// 工作区名
XSSFSheet sheet = wb.createSheet(year+"值班统计");
XSSFCellStyle style=wb.createCellStyle();
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);//水平垂直
XSSFCellStyle cs=wb.createCellStyle();
cs.setWrapText(true);
// 创建表头
String values="日期,班种,姓名及电话";
XSSFRow row = sheet.createRow(0);
String[] value=values.split(",");
for(int i=0;i<3;i++){
XSSFCell row_0=row.createCell(i);
row_0.setCellValue(value[i]);
row_0.setCellStyle(style);
}
// 遍历数据装进table
for (int i = 0; i < v_list.size(); i++) {
// sheet.createRow(i+1) 因为表头是0
Hashtable ht = (Hashtable) v_list.get(i);
String user_name=(String)ht.get("zb_user");
String[] user_names=user_name.split(",");
XSSFRow rows = sheet.createRow(i + 1);
String id = pub.trimNull((String) ht.get("id"));
rows.createCell(0).setCellValue((String)ht.get("year"));
rows.createCell(1).setCellValue((String)ht.get("zb_type"));
String userTel="";
for(int n=0;n<user_names.length;n++) {
String telphone = getTel(cf, conn, user_names[n]);
userTel=userTel+user_names[n]+":"+telphone+"\n";
}
rows.createCell(2).setCellValue(userTel);
}
for(int i=1;i<=v_list.size();i=i+3){
sheet.addMergedRegion(new CellRangeAddress(i,i+2,0,0));//合并单元格
}
wb.write(os);
// 关闭输出流
os.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
download(filePath, response);
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/7/7
Time: 15:12
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import=" java.io.BufferedInputStream" %>
<%@ page import=" java.io.BufferedOutputStream" %>
<%@ page import=" java.io.File" %>
<%@ page import=" java.io.FileInputStream" %>
<%@ page import=" java.io.FileOutputStream" %>
<%@ page import=" java.io.IOException" %>
<%@ page import=" java.io.InputStream" %>
<%@ page import=" java.io.OutputStream" %>
<%@ page import=" java.text.SimpleDateFormat" %>
<%@ page import=" javax.servlet.http.HttpServletResponse" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.poi.xssf.usermodel.*" %>
<%@ page import="org.apache.poi.ss.util.CellRangeAddress" %>
<%!
private void download(String path, HttpServletResponse response) {
try {
// path是指欲下载的文件的路径。
File file = new File(path);
// 取得文件名。
String filename = file.getName();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename="+ new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
toClient.write(buffer);
toClient.flush();
toClient.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String year = pub.trimNull(request.getParameter("exportDate"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = sdf.format(new Date()) + ".xlsx";
// 文件路径
String filePath = fileName;
try {
conn = com.censoft.db.DBUtil.getConnection();
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_user_gl_bgs where year=? ");
sb.append(" order by order_num asc");
Vector v_list = cf.doQuery(conn, sb.toString(), null, new Object[]{year});
if (v_list == null) {
System.out.println("查询出错"+cf.getMsg());
return;
}
// 输出流
OutputStream os = new FileOutputStream(filePath);
// 工作区
XSSFWorkbook wb = new XSSFWorkbook();
// 工作区名
XSSFSheet sheet = wb.createSheet(year+"值班统计");
XSSFCellStyle style=wb.createCellStyle();
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);//水平垂直
XSSFCellStyle cs=wb.createCellStyle();
cs.setWrapText(true);
// 创建表头
String values="日期,班种,姓名及电话";
XSSFRow row = sheet.createRow(0);
String[] value=values.split(",");
for(int i=0;i<3;i++){
XSSFCell row_0=row.createCell(i);
row_0.setCellValue(value[i]);
row_0.setCellStyle(style);
}
// 遍历数据装进table
for (int i = 0; i < v_list.size(); i++) {
// sheet.createRow(i+1) 因为表头是0
Hashtable ht = (Hashtable) v_list.get(i);
String user_name=(String)ht.get("zb_user");
String[] user_names=user_name.split(",");
XSSFRow rows = sheet.createRow(i + 1);
String id = pub.trimNull((String) ht.get("id"));
rows.createCell(0).setCellValue((String)ht.get("year"));
rows.createCell(1).setCellValue((String)ht.get("zb_type"));
String userTel="";
for(int n=0;n<user_names.length;n++) {
String telphone = getTel(cf, conn, user_names[n]);
userTel=user_names[n]+":"+telphone+"\n"+userTel;
}
rows.createCell(2).setCellValue(userTel);
}
for(int i=1;i<=v_list.size();i=i+3){
sheet.addMergedRegion(new CellRangeAddress(i,i+2,0,0));//合并单元格
}
wb.write(os);
// 关闭输出流
os.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
download(filePath, response);
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Vector" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String divId = pub.trimNull(request.getParameter("divId"));
Hashtable ht = new Hashtable();
StringBuffer sb = new StringBuffer();
try {
conn = com.censoft.db.DBUtil.getConnection();
sb.append("select t1.zb_user,t1.zb_type from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
sb.append(" order by t1.id asc");
v_list=cf.doQuery(conn,sb.toString(),null,new Object[]{year});
if(v_list==null){
System.out.println("查询该日期值班人员出错"+cf.getMsg());
}
%>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="export_query.jsp" >
<div id="content" class="cl pd-5 divOverflow" style="overflow:hidden;margin-top: 10px;">
<%
if(v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht = (Hashtable)v_list.get(i);
String zb_type= pub.trimNull((String) ht.get("zb_type"));
String user_name= pub.trimNull((String) ht.get("zb_user"));
%>
<div style="height:110px;float:left;margin-left: 50px;border:0.5px solid #000;">
<div style="width:120px;height:110px;float:left;border-right:0.5px solid #000;text-align: center;line-height: 80px;">
<p style="height:30px;"> <%=zb_type%></p>
</div>
<div style="text-align:center;width:180px;height:110px;line-height:30px;float:left;position: relative">
<%
String[] user_names=user_name.split(",");
for(int n=0;n<user_names.length;n++){
%>
<div style="height:20px;margin:0px;">
<input type="radio" name="<%=divId%>_1" value="<%=user_names[n]%>_<%=zb_type%>" />
<%=user_names[n]%>
</div>
<%
}
%>
</div>
</div>
<%
}
}
%>
</div>
</form>
</div>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/simple-calendar.css">
<script src="<%=request.getContextPath()%>/js/simple-calendar-es.js"></script>
<style>
#container{
margin: 0 auto;
float: none;
width: 95%;
height: 600px;
}
</style>
<div style="margin-top: 10px;display: none;">
<a class="btn btn-primary radius" onclick="operList();" >
导出
</a>
</div>
<div style="margin-top: 10px;text-align: right;margin-right: 40px;">
<a class="btn btn-primary radius" onclick="zdPb();" >
自动排班
</a>
<a class="btn btn-primary radius" onclick="viewUserWeek();" >
周排班表
</a>
<a class="btn btn-primary radius" onclick="changeZb();" >
换班
</a>
</div>
<div id="container"></div>
<form method="post" id="form1" name="form1" action="export_query.jsp" >
<input type="hidden" value="" id="nowDays" name="nowDays">
<input type="hidden" value="" id="nowYear" name="nowYear">
<input type="hidden" value="" id="nowMonth" name="nowMonth">
</form>
<script>
let myCalendar = new SimpleCalendar('#container');
//刷新日历
function addData(year, month) {
var totalDays="";
var now = new Date();//当前日期
var nowDay = now.getDate();// 当天
var nowYear = now.getFullYear();// 年份
var nowMonth = now.getMonth() + 1;// 月份
let daysElement = arrayfrom(this.container.querySelectorAll('.sc-item'));
let day = new Date(year, month - 1, 0);
let week = day.getDay();
if (week == 0) week = 7;
if (week == 7) week = 0;
//计算得到第一个格子的日期
let thispageStart = new Date(Date.parse(day) - (week - 1) * 24 * 3600 * 1000);
//对每一个格子遍历
for (let i = 0; i < 35; i++) {
daysElement[i].className = 'sc-item';
let theday = new Date(Date.parse(thispageStart) + (i-1) * 24 * 3600 * 1000);
let writeyear = theday.getFullYear();
let writeday = theday.getDate();
let writemonth = theday.getMonth() + 1;
if (writemonth != month) {
daysElement[i].classList.add('sc-othermenth');
}
daysElement[i].querySelector('.day').innerHTML = writeday;
getZbUser(writeyear,writemonth,writeday,i);
//daysElement[i].querySelector('.zb_user_button').innerHTML = '<span onclick="editUser('+writeyear+','+writemonth+','+writeday+');" style="text-align:center;position:absolute; right:0; bottom:0;"><img src="../../images/edit.png" width="20" height="15" /></span>';
//判断是否添加阴历
if (true) {
daysElement[i].querySelector('.lunar-day').innerHTML = (new LunarHelp(writeyear, writemonth, writeday)).getLunarDayName();
} else {
daysElement[i].querySelector('.lunar-day').innerHTML = '';
daysElement[i].classList.add('item-nolunar');
}
//console.log(writeyear+""+writemonth+""+writeday);
//添加today样式
if (nowYear == writeyear && nowDay == writeday && nowMonth == writemonth) {
this.selectDay = daysElement[i];
daysElement[i].classList.add("sc-today");
}
if (year == writeyear && month == writemonth) {
totalDays+=writeday+",";
}
}
$("#nowYear").val(year);
$("#nowMonth").val(month);
$("#nowDays").val(totalDays.substring(0,totalDays.length-1));
}
function getZbUser(year,month,day,index) {
let daysElement = arrayfrom(this.container.querySelectorAll('.sc-item'));
$.ajax({
type: "post",
url: "list_ajax.jsp?year="+year+"&month="+month+"&day="+day,
success: function (msg) {
daysElement[index].querySelector('.zb_user').innerHTML = msg;
daysElement[index].querySelector('.zb_user').setAttribute("onclick","viewUser("+year+","+month+","+day+")");
}
});
}
function arrayfrom(nidelist) {
let array = [];
[].forEach.call(nidelist, function(v) {
array.push(v);
});
return array;
}
function viewUser(year,month,day) {
var url = './viewUser-t.jsp?year='+year+'&month='+month+'&day='+day;
viewDeptOrUserInfo(year+''+month+''+day+'日值班表', url, '1100', '550');
}
function changeZb() {
var url = './changeZb-t.jsp';
viewDeptOrUserInfo('换班', url, '1000', '500');
}
function viewUserWeek() {
var url = './viewUserWeek-t.jsp';
viewUserWeekFull('周值班表', url, '1000', '500');
}
function viewUserWeekFull(title, url, w, h) {
var abc = layer.open({
title: title,
type: 2,
content: url,
area: [w, h],
maxmin: true
});
layer.full(abc);
}
function zdPb() {
var url = './edit-t.jsp';
viewDeptOrUserInfo('自动排班', url, '1000', '500');
}
function viewDeptOrUserInfo(title, url, w, h) {
var abc = layer.open({
title: title,
type: 2,
content: url,
area: [w+'px', h+'px'],
maxmin: true
});
//layer.full(abc);
}
</script>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%!
public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
String mx_id="";
Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
mx_id = (String) ht1.get("mx_id");
}
return mx_id;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String month = pub.trimNull(request.getParameter("month"));
String day = pub.trimNull(request.getParameter("day"));
if(month.length()==1){
month="0"+month;
}
month="-"+month;
if(day.length()==1){
day="0"+day;
}
day="-"+day;
List list_s = new ArrayList();
String result="";
try {
StringBuffer sb = new StringBuffer();
sb.append("select t1.zb_user from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
list_s.add(year+month+day);
conn = com.censoft.db.DBUtil.getConnection();
sb.append(" order by t1.id asc");
v_list = cf.doQuery(conn, sb.toString(), null, list_s.toArray());
if (v_list == null) {
out.println("查询出错" + cf.getMsg());
return;
}
if (v_list != null && v_list.size() > 0) {
for (int i = 0; i < v_list.size(); i++) {
Hashtable ht = (Hashtable) v_list.get(i);
String zb_user = pub.trimNull((String) ht.get("zb_user"));
result=result+zb_user+"</br>";
}
}
out.println(result);
} catch (Exception e) {
out.println("查询异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.Logger" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_day = null;
String user_names ="";
String login_id = (String) session.getAttribute("session_login_id");
if ("".equals(login_id)) {
System.out.println("当前没有用户信息");
}
String year = pub.trimNull(request.getParameter("year"));
String zb_type = pub.trimNull(request.getParameter("zb_type"));
String action = pub.trimNull(request.getParameter("action"));
StringBuffer sql = new StringBuffer();
List list = new ArrayList();
sql.append("select t2.id,t2.user_name,t2.tel,t2.gh,t2.order_num from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? order by t2.id desc ");
list.add(zb_type);
try {
conn = com.censoft.db.DBUtil.getConnection();
conn.setAutoCommit(false);
if("update".equals(action)){
String[] userids = request.getParameterValues("userids");
String get_user_names="";
if(userids!=null && userids.length>0) {
for (int i = 0; i < userids.length; i++) {
get_user_names+=userids[i]+",";
}
}
if(!"".equals(get_user_names)){
get_user_names=get_user_names.substring(0,get_user_names.length()-1);
}
//System.out.println("get_user_names="+get_user_names+year+zb_type);
boolean is_oper = cf.executeUpdate(conn, "update zb_user_gl_bgs set zb_user=? where year=? and zb_type=?",
new Object[]{get_user_names,year,zb_type});
if (!is_oper) {
conn.rollback();
System.out.println("修改zb_user_gl表出错了" + cf.getMsg());
return;
}
conn.commit();
}
v_list = cf.doQuery(conn, sql.toString(), null, list.toArray());
if (v_list == null) {
out.println("查询用户出错");
return;
}
v_list_day = cf.doQuery(conn, "select zb_user from zb_user_gl_bgs where year=? and zb_type=?", null, new Object[]{year,zb_type});
if (v_list_day != null && v_list_day.size()>0) {
Hashtable ht1= (Hashtable) v_list_day.get(0);
user_names = pub.trimNull((String) ht1.get("zb_user"));
}
%>
<div style="margin-top: 10px;">
<a class="btn btn-primary radius" onclick="saveGroupForm();" >
确定
</a>
</div>
<div style="width:100%;height:90%;overflow-y: auto">
<form action="selectUser-t.jsp" method="post" id="groupUser" name="groupUser">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="year" id="year" value="<%=year%>">
<input type="hidden" name="zb_type" id="zb_type" value="<%=zb_type%>">
<table class="table table-border table-bordered table-hover table-bg table-sort">
<thead>
<tr class="text-c">
<th width="30">序号</th>
<th width="30">
<input id="checkboxAll" type="checkbox" onclick="checkAll(this);"></input>
</th>
<th width="100">人员姓名</th>
<th width="100">联系电话</th>
<th width="100">工号</th>
</tr>
</thead>
<tbody id="groupUserInfo">
<%
Hashtable ht_1 =null;
if (v_list != null && v_list.size() > 0) {
for (int i = 0; i < v_list.size(); i++) {
Hashtable ht = (Hashtable) v_list.get(i);
String user_name = pub.trimNull((String) ht.get("user_name"));
String tel = pub.trimNull((String) ht.get("tel"));
String gh = pub.trimNull((String) ht.get("gh"));
%>
<tr class="text-c">
<td><%=i+1%>
</td>
<td >
<input type="checkbox" class="info" id="userids" name="userids" value="<%=user_name%>"
<%if(user_names.indexOf(user_name)>=0){%>checked="checked"<%}%>/>
</td>
<td><%=user_name%>
</td>
<td><%=tel%>
</td>
<td><%=gh%>
</td>
</tr>
<%
}
}
%>
</tbody>
</table>
</form>
</div>
<script type="text/javascript">
var checkAll = function (checkbox) {
$(".info").prop("checked", checkbox.checked);
}
function saveGroupForm(){
var isChecked=false;
var us = document.getElementsByName("userids");
for(var i=0;i<us.length;i++){
if(us[i].checked){
isChecked = true;
}
}
if(!isChecked){
layer.alert("请勾选用户",{icon:5,title:"提示"});
return false;
}
$.ajax({
type: "POST",
url: "./selectUser-t.jsp",
data: $('#groupUser').serialize(),
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
//window.parent.location.reload();
window.parent.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/11
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Vector" %>
<%!
public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
String mx_id="";
Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
mx_id = (String) ht1.get("mx_id");
}
return mx_id;
}
public static String getZbTyTime(ConnectionFactory cf,Connection conn,String mx_id,String zb_type) {
String time="";
Vector userList = cf.doQuery(conn,"select b_time,e_time from zb_type_bgs where mx_id=? and zb_type=?"
,null,new Object[]{mx_id,zb_type});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
time = (String) ht1.get("b_time")+"-"+(String) ht1.get("e_time");
}
return time;
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String month = pub.trimNull(request.getParameter("month"));
String day = pub.trimNull(request.getParameter("day"));
if(month.length()==1){
month="0"+month;
}
month="-"+month;
if(day.length()==1){
day="0"+day;
}
day="-"+day;
Hashtable ht = new Hashtable();
StringBuffer sb = new StringBuffer();
try {
conn = com.censoft.db.DBUtil.getConnection();
sb.append("select t1.zb_user,t1.zb_type from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
sb.append(" order by t1.id asc");
String mxId=getMxId(cf,conn,year+month+day);
v_list=cf.doQuery(conn,sb.toString(),null,new Object[]{year+month+day});
if(v_list==null){
System.out.println("查询该日期值班人员出错"+cf.getMsg());
}
%>
<div >
<a class="btn btn-primary radius" onclick="operList();" >
导出
</a>
</div>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="export_query.jsp" >
<input type="hidden" value="<%=year+month+day%>" name="exportDate" id="exportDate">
<div id="content" class="cl pd-5 bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;height: 400px;">
<%
if(v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht = (Hashtable)v_list.get(i);
String zb_type= pub.trimNull((String) ht.get("zb_type"));
String user_name= pub.trimNull((String) ht.get("zb_user"));
String time=getZbTyTime(cf,conn,mxId,zb_type);
%>
<div style="width:1000px;height:120px;float:left;margin-left: 50px;border:0.5px solid #000;position:relative;">
<div style="width:140px;height:120px;float:left;border-right:0.5px solid #000;text-align: center;line-height: 80px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=time%>)</p>
</div>
<%
String[] user_names=user_name.split(",");
for(int n=0;n<user_names.length;n++){
String telphone=getTel(cf,conn,user_names[n]);
%>
<div style="text-align:center;width:140px;height:120px;line-height:120px;float:left;position: relative">
<p style="height:70px;line-height: 80px;margin:0px;">
<img src="../../images/user.png"/>
</p>
<div style="height:50px;margin:0px;">
<div style="height:30px;line-height: 20px;">
<%=user_names[n]%>
</div>
<div style="height:20px;line-height: 10px;">
<%=telphone%>
</div>
</div>
</div>
<%
}
%>
<span onclick="editUser('<%=year+month+day%>','<%=zb_type%>');" style="text-align:center;position:absolute; right:0; bottom:0;">
<img src="../../images/edit.png" width="20" height="15" />
</span>
</div>
<%
}
}
%>
</div>
</form>
</div>
<script>
function operList() {
document.form1.submit();
}
function editUser(year,zb_type) {
var url = './selectUser-t.jsp?year='+year+"&zb_type="+zb_type;
var abc = layer.open({
title: '选择人员',
type: 2,
content: url,
area: ['1000px', '500px'],
maxmin: true,
end:function () {
//searchModel1($("#check_mx_id").val());
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/11
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%!
// 获取当前一周的一星期的日期
private static List<String> GetCurrentWeekAllDate(){
// 获取当天的毫秒时间
long currentTimeMillis = System.currentTimeMillis();
List<String> list = getAllWeekDayDateByMillis(currentTimeMillis);
return list;
}
// 获取指定任意日期当周的一星期的日期
private static void GetSomedayWeekAllDate(){
// 指定天的毫秒时间
long currentTimeMillis = getWhatDaySomeDateMillis("2019-10-15");
List<String> list = getAllWeekDayDateByMillis(currentTimeMillis);
for(String date:list) {
// System.out.println("date : "+date);
}
}
// someDataStr 格式:"yyyy-MM-dd"
// 返回 时间毫秒
private static long getWhatDaySomeDateMillis(String someDataStr) {
Date date= new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
date = format.parse(someDataStr);
return date.getTime();
} catch (Exception e) {
e.printStackTrace();
}
return -1;
}
// 获取指定日期毫秒时间得到 星期几
private static String getWhatDaySomeday(long timeMillis) {
Date toDayDate = new Date(timeMillis);
SimpleDateFormat formatE = new SimpleDateFormat("E");
String week =null;
try {
week = formatE.format(toDayDate);
//System.out.println(week);
} catch (Exception e) {
e.printStackTrace();
}
return week;
}
// 根据 星期几到获取与 星期一 相差几天
private static int getHowManyDayFromMonday(String someDay) {
int day = 0;
switch(someDay) {
case "星期一":
day=0;
break;
case "星期二":
day=1;
break;
case "星期三":
day=2;
break;
case "星期四":
day=3;
break;
case "星期五":
day=4;
break;
case "星期六":
day=5;
break;
case "星期日":
day=6;
break;
default:
System.out.println("不存在这样的星期几 : "+ someDay);
break;
}
return day;
}
// 获取指定日期毫秒时间的当周一星期的日期
private static List<String> getAllWeekDayDateByMillis(long timeMills){
List<String> list = new ArrayList<String>();
// 得到指定时间是周几
String week = getWhatDaySomeday(timeMills);
//System.out.println("日期是:" + week);
// 记录与周一的间隔天数
int dayFromMonday=getHowManyDayFromMonday(week);
//System.out.println("dayFromMonday : "+ dayFromMonday);
// 获取这周第一天毫秒值
long dayMillis = 24*60*60*1000;
// 获取这周第一天的日子
long firstOfWeekMillis = timeMills - dayFromMonday * dayMillis;
// 使用 for 循环得到当前一周的日子(7天的日子)
for(long i = firstOfWeekMillis;i<firstOfWeekMillis+ 7 *dayMillis;i+=dayMillis) {
Date targetDate = new Date(i);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String targetDay = format.format(targetDate);
list.add(targetDay);
}
return list;
}
public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
String mx_id="";
Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
mx_id = (String) ht1.get("mx_id");
}
return mx_id;
}
public static String getZbTyTime(ConnectionFactory cf,Connection conn,String mx_id,String zb_type) {
String time="";
Vector userList = cf.doQuery(conn,"select b_time,e_time from zb_type_bgs where mx_id=? and zb_type=?"
,null,new Object[]{mx_id,zb_type});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
time = (String) ht1.get("b_time")+"-"+(String) ht1.get("e_time");
}
return time;
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_user = null;
Calendar cal = Calendar.getInstance();
Date date=new Date();//现在的日期
cal.setTime(date);
String year=String.valueOf(cal.get(Calendar.YEAR));//获取年
String month = String.valueOf(cal.get(Calendar.MONTH)+1);//获取月(月份从0开始,如果按照中国的习惯,需要加一)
String day=String.valueOf(cal.get(Calendar.DAY_OF_MONTH));//获取日(月中的某一天)
if(month.length()==1){
month="0"+month;
}
month="-"+month;
if(day.length()==1){
day="0"+day;
}
day="-"+day;
Hashtable ht = new Hashtable();
StringBuffer sql = new StringBuffer();
String dates="";
try {
conn = com.censoft.db.DBUtil.getConnection();
String mxId=getMxId(cf,conn,year+month+day);
List<String> dateList=GetCurrentWeekAllDate();
if(dateList!=null && dateList.size()>0){
for(int n=0;n<dateList.size();n++) {
dates=dates+dateList.get(n)+",";
}
}
sql.append("select * from zb_type_bgs where mx_id=? order by order_num asc ");
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{mxId});
%>
<style>
.col-sm-2{
width:14%;
}
.col-sm-3{
width:19%;
}
.btn-green{ background-color:green;border: green}
</style>
<div >
<a class="btn btn-primary radius" onclick="operList();" >
导出
</a>
</div>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="exportWeek.jsp" >
<input type="hidden" value="<%=dates%>" name="exportDate" id="exportDate">
<div style="border: solid 1px #eee;margin-top: 20px;height:550px;overflow: auto;text-align: center">
<div style="width:1250px;height:550px;margin:0 auto;">
<%
for(int i=0;i<v_list.size();i++){
Hashtable ht_2 = (Hashtable) v_list.get(i);
String id=pub.trimNull((String)ht_2.get("id"));
String zb_type=pub.trimNull((String)ht_2.get("zb_type"));
String b_time=pub.trimNull((String)ht_2.get("b_time"));
String e_time=pub.trimNull((String)ht_2.get("e_time"));
StringBuffer sb = new StringBuffer();
sb.append("select t1.zb_user,t1.zb_type from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year in ( ");
if(dateList!=null&&dateList.size()>0){
for(int m=0;m<dateList.size();m++){
if(m==dateList.size()-1){
sb.append("'" + dateList.get(m) + "'");
}else{
sb.append("'" + dateList.get(m) + "',");
}
}
}
sb.append(" )");
sb.append(" and t1.zb_type=? order by t1.id asc");
v_list_user=cf.doQuery(conn,sb.toString(),null,new Object[]{zb_type});
%>
<%if(i==0){%>
<div style="height:40px;float:left;white-space: nowrap;">
<div style="width:150px;height:40px;float:left;border:0.5px solid #000;">
</div>
<%
for(int n=0;n<dateList.size();n++){
String riqi="";
if(n==0){
riqi="周一";
}else if(n==1){riqi="周二";}
else if(n==2){riqi="周三";}
else if(n==3){riqi="周四 ";}
else if(n==4){riqi="周五";}
else if(n==5){riqi="周六";}
else if(n==6){riqi="周日";}
%>
<div style="width:150px;height:40px;line-height:40px;text-align:center;color:#fff;float:left;border:0.5px solid #000;background-color: #00b7ee">
<%=dateList.get(n)%><%=riqi%>
</div>
<% }%>
</div>
<%}%>
<div style="height:160px;float:left;">
<div style="width:150px;height:160px;float:left;border:0.5px solid #000;text-align: center;line-height: 120px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=b_time%>-<%=e_time%>)</p>
</div>
<%
if(v_list_user!=null && v_list_user.size()>0){
for(int n=0;n<v_list_user.size();n++){
Hashtable ht1 = (Hashtable) v_list_user.get(n);
String user_name=pub.trimNull((String)ht1.get("zb_user"));
user_name=user_name.replace(",","</br>");
%>
<div style="text-align:center;width:150px;height:160px;float:left;border:0.5px solid #000;position: relative">
<p style="height:20px;"></p>
<%=user_name%>
</div>
<%}}%>
</div>
<%}%>
</div>
</div>
</form>
</div>
<script>
function operList() {
document.form1.submit();
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/1/15
Time: 10:48
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String value = pub.trimNull(request.getParameter("value"));
value=java.net.URLDecoder.decode(value,"UTF-8");
String name_id = pub.trimNull(request.getParameter("name_id"));
String reg_id = pub.trimNull(request.getParameter("reg_id"));
List list_s = new ArrayList();
Hashtable ht=null;
String first_name="请选择";
String col_name_all="";
try {
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_mx_bgs order by add_time desc");
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sb.toString(),null, list_s.toArray());
if (v_list == null) {
out.println("查询出错" + cf.getMsg());
return;
}
%>
<select class="input-text" name="<%=name_id%>" id="<%=name_id%>" >
<option value=""><%=first_name%></option>
<%
if(v_list!=null && v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht=(Hashtable)v_list.get(i);
String col_name=pub.trimNull((String)ht.get("name"));
String day=pub.trimNull((String)ht.get("day"));
String id=pub.trimNull((String)ht.get("id"));
%>
<option value="<%=id%>_<%=day%>"><%=col_name%></option>
<%
}
}
%>
</select>
<%
} catch (Exception e) {
out.println("查询异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
......@@ -14,12 +14,10 @@
sql.append("select t2.user_name from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? ");
sql.append(" and t2.role_num in(");
//StringBuffer sql=new StringBuffer("select user_name from zb_bgs_user where 1=1 and order_num in(");
List list= new ArrayList();
list.add(zb_type);
String user_names="";
int startIndex_2=startIndex;
System.out.println(zb_type+"---"+startIndex);
for(int i=0;i<n;i++){
startIndex=startIndex+1;
if(startIndex==userListSize.size()+1){
......
......@@ -25,7 +25,6 @@
StringBuffer sql = new StringBuffer();
sql.append("select t2.id,t2.user_name,t2.tel,t2.gh,t2.order_num from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id where t1.role_id=? order by t2.order_num asc ");
//System.out.println(role_id+sql.toString());
try {
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{role_id});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment