Commit 1042d8f0 by 朱天成

投票2.0

parent 473407a6
...@@ -346,3 +346,6 @@ ...@@ -346,3 +346,6 @@
.icon-ext-13_48 { .icon-ext-13_48 {
background:url('../../../../images/icons/(13,48).png') no-repeat left center; background:url('../../../../images/icons/(13,48).png') no-repeat left center;
} }
.icon-ext-07_14 {
background:url('../../../../images/icons/(07,14).png') no-repeat left center;
}
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="userVoteTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="voteTab_searchForm" style="float:left">
主题内容: <input class="easyui-textbox" id="FIELD_CONTENT" name="FIELD_CONTENT" style="width:200px"/>&nbsp;&nbsp;
<input type="checkbox" name="FIELD_USERSELF" value="0" onclick="searchRow()" checked />仅显示我参与的
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<div id="advsearch" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/endedVoteTab.js" charset="utf-8"></script>
/**
* 序号:
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//定义grid列表
var ls_title="投票管理功能&nbsp;&nbsp;<font color='#993300'></font>";
var is_column = [ [
{field : 'CONTENT',title : '主题内容',width : 150,align : 'center'},
{field :'opt',title : '操作',width : 150,align : 'center',
formatter:function(value,row,index){
var lookBtn='<a style="cursor:pointer" onclick="javascript:lookfor('+index+')">查看</a>'
return '<div class=\'optBtns\'>'+(lookBtn)+'</div>';
}
}
] ];
//列表加载完成回调
function reportrollback(){
}
//设置颜色和每行高度
function rowstyler(index,row){
}
//展示列表
queryData.FIELD_USERSELF=0;
reportgrid("list",ls_title,gaowj.WEB_APP_NAME + "/voteData_list_ended",queryData,is_column,60,80);
/****/
/**
* 序号:
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">投票</a>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
}
/**
* 序号:
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function lookfor(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'lookfor';
openLookRow("voteView_userVoteTabDetail",is_row[0],"查看",true,0.65,0.95,0,0);
}
function openLookRow(editUrl,is_row,is_title,is_max,is_width,is_height,is_left,is_top){
$('#detail').dialog( {
title : is_title,
iconCls : $.getJwWindowPic(),
width : ls_width * is_width,
height :ls_height * is_height,
closed : false,
cache : false,
maximizable:is_max,
left:is_left,
top:is_top,
href : editUrl,
queryParams:get_FIELD(is_row),
modal : true,
buttons : [ {
text : '关闭',
iconCls : 'icon-back',
handler : function() {
closeBox('detail');
}
} ],
onLoad:function editUrlOnload(){
if(is_row.OPETYPE=='lookfor'){
lookforUrlOnloadCallback(is_row);
}else{
updateUrlOnloadCallback(is_row);
}
}
});
}
//加载投票子页面成功后的回调
function lookforUrlOnloadCallback(is_row,index){
var listItem=voteModule.voteDataAction.listItem({
FIELD_MANAGE_ID:is_row.UUID
}).listItems;
var listUserChecked=voteModule.voteDataAction.listUserChecked({
FIELD_MANAGE_ID:is_row.UUID
}).listusercheckeds;
for(var i=0;i<listItem.length;i++){
add_vote_item(listItem[i].INDEX_NAME,listItem[i].CONTENT,listItem[i].UUID);
}
for(var j=0;j<listUserChecked.length;j++){
$("input[name='vote_item_delete']").each(function(index) {
if ($("input[name='vote_item_delete']").get(index).value == listUserChecked[j].ITEM_ID) {
$("input[name='vote_item_delete']").get(index).checked = true;
}
});
}
}
/**
* 功能:刷新
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function refreshRow(){
$('#list').datagrid('load',{});
$("#voteTab_searchForm")[0].reset();
}
/****/
/**
* 功能:查询
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function searchRow(){
var v_query = $("#voteTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
function add_vote_item(index,content,uuid){
if(typeof index == 'undefined'){
index='';
}
if(typeof content == 'undefined'){
content='';
}
if(typeof uuid == 'undefined'){
uuid='';
}
var vote_item_list=$(".vote_item_list");
var item=$("<div class='vote_item_one' style='overflow: auto;margin-bottom:10px'></div>");
vote_item_list.append(item);
var vote_item_checkbox=$('<div></div>');
vote_item_checkbox.addClass('vote_item_checkbox');
var vote_item_info=$('<div></div>');
vote_item_info.addClass('vote_item_info');
item.append(vote_item_checkbox);
item.append(vote_item_info);
vote_item_checkbox.append('<input type="checkbox" name="vote_item_delete" value="'+uuid+'"/>');
vote_item_info.append(index+'.'+content);
$.parser.parse('.vote_item_one');
}
/**
* 序号:
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//定义grid列表
var ls_title="投票管理功能&nbsp;&nbsp;<font color='#993300'></font>";
var is_column = [ [
{field : 'CONTENT',title : '主题内容',width : 150,align : 'center'},
{field : 'VOTE_COUNT',title : '状态',width : 150,align : 'center',
formatter:function(value,row,index){
return value>0?"已投":"未投";
}
},
{field :'opt',title : '操作',width : 150,align : 'center',
formatter:function(value,row,index){
var voteBtn='<a style="cursor:pointer" onclick="javascript:editRow('+index+')">投票</a>'
var lookBtn='<a style="cursor:pointer" onclick="javascript:lookfor('+index+')">查看</a>'
return '<div class=\'optBtns\'>'+(row.VOTE_COUNT>0?lookBtn:voteBtn)+'</div>';
}
}
] ];
//列表加载完成回调
function reportrollback(){
}
//设置颜色和每行高度
function rowstyler(index,row){
}
//展示列表
reportgrid("list",ls_title,gaowj.WEB_APP_NAME + "/voteData_list_ongoing",queryData,is_column,60,80);
/****/
/**
* 序号:
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">投票</a>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
}
/**
* 序号:
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//加载投票子页面
function editRow(index) {
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'update';
openEditRow("voteView_userVoteTabDetail",is_row[0],"投票",true,0.65,0.95,0,0);
}
function lookfor(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'lookfor';
openLookRow("voteView_userVoteTabDetail",is_row[0],"查看",true,0.65,0.95,0,0);
}
function openLookRow(editUrl,is_row,is_title,is_max,is_width,is_height,is_left,is_top){
$('#detail').dialog( {
title : is_title,
iconCls : $.getJwWindowPic(),
width : ls_width * is_width,
height :ls_height * is_height,
closed : false,
cache : false,
maximizable:is_max,
left:is_left,
top:is_top,
href : editUrl,
queryParams:get_FIELD(is_row),
modal : true,
buttons : [ {
text : '关闭',
iconCls : 'icon-back',
handler : function() {
closeBox('detail');
}
} ],
onLoad:function editUrlOnload(){
if(is_row.OPETYPE=='lookfor'){
lookforUrlOnloadCallback(is_row);
}else{
updateUrlOnloadCallback(is_row);
}
}
});
}
//加载投票子页面成功后的回调
function lookforUrlOnloadCallback(is_row,index){
var listItem=voteModule.voteDataAction.listItem({
FIELD_MANAGE_ID:is_row.UUID
}).listItems;
var listUserChecked=voteModule.voteDataAction.listUserChecked({
FIELD_MANAGE_ID:is_row.UUID
}).listusercheckeds;
for(var i=0;i<listItem.length;i++){
add_vote_item(listItem[i].INDEX_NAME,listItem[i].CONTENT,listItem[i].UUID);
}
for(var j=0;j<listUserChecked.length;j++){
$("input[name='vote_item_delete']").each(function(index) {
if ($("input[name='vote_item_delete']").get(index).value == listUserChecked[j].ITEM_ID) {
$("input[name='vote_item_delete']").get(index).checked = true;
}
});
}
}
//加载投票子页面成功后的回调
function updateUrlOnloadCallback(is_row){
var listItem=voteModule.voteDataAction.listItem({
FIELD_MANAGE_ID:is_row.UUID
}).listItems;
for(var i=0;i<listItem.length;i++){
add_vote_item(listItem[i].INDEX_NAME,listItem[i].CONTENT,listItem[i].UUID);
}
}
//保存
function updateData(is_entity){
var uuids='';
var i=0;
$(".vote_item_list :checkbox:checked").each(function(index){
uuids+=','+$(this).val();
i++;
});
var min=$("input[name=FIELD_MIN_COUNT]").val();
var max=$("input[name=FIELD_MAX_COUNT]").val();
var flag=$("input[name=FIELD_STATUS_FLAG]").val();
//判断用户选择的选项是否在上下限之间,如果不在,则提示用户,不进行提交操作
if(min==max&&i!=min){
$.messager.alert("必须选择"+max+"个选项");
return;
}else if(i<min||i>max){
$.messager.alert("请选择"+min+"到"+max+"个选项");
return;
}
if(uuids.length>0){
uuids=uuids.substring(1);
}
is_entity.FIELD_UUIDS=uuids;
is_entity.FIELD_FLAG =flag;
v_result = voteModule.voteActAction.insertUserVote(is_entity);
$('#list').datagrid('reload');
return v_result;
// }
}
/**
* 功能:刷新
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function refreshRow(){
$('#list').datagrid('load',{});
$("#voteTab_searchForm")[0].reset();
}
/****/
/**
* 功能:查询
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function searchRow(){
var v_query = $("#voteTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
/**
* 查询自己参与
* **/
function userselfRow(){
// $("#list").each(function(index) {
// var content=$(this).val();
// if ($(this).VOTE_COUNT >0) {
// $('#list').datagrid('load',content);
// }
// });
// if(row.VOTE_COUNT>0){
//
// }
// $('#list').datagrid('load',v_query);
}
function add_vote_item(index,content,uuid){
if(typeof index == 'undefined'){
index='';
}
if(typeof content == 'undefined'){
content='';
}
if(typeof uuid == 'undefined'){
uuid='';
}
var vote_item_list=$(".vote_item_list");
var item=$("<div class='vote_item_one' style='overflow: auto;margin-bottom:10px'></div>");
vote_item_list.append(item);
var vote_item_checkbox=$('<div></div>');
vote_item_checkbox.addClass('vote_item_checkbox');
var vote_item_info=$('<div></div>');
vote_item_info.addClass('vote_item_info');
item.append(vote_item_checkbox);
item.append(vote_item_info);
vote_item_checkbox.append('<input type="checkbox" name="vote_item_delete" value="'+uuid+'"/>');
vote_item_info.append(index+'.'+content);
$.parser.parse('.vote_item_one');
}
...@@ -7,18 +7,29 @@ var voteModule = function(format) { ...@@ -7,18 +7,29 @@ var voteModule = function(format) {
//定义数据交互 //定义数据交互
voteModule.prototype = BusinessObject; voteModule.prototype = BusinessObject;
//插入附件数据 //插入主题
voteModule.prototype.insertVote = function(){}; voteModule.prototype.insertVote = function(){};
//修改附件数据 //插入用户投票
voteModule.prototype.insertUserVote = function(){};
//修改主题
voteModule.prototype.updateVote = function(){}; voteModule.prototype.updateVote = function(){};
//删除附件数据 //删除主题
voteModule.prototype.deleteVote = function(){}; voteModule.prototype.deleteVote = function(){};
//获取主题选项
voteModule.prototype.listItem = function(){};
//获取用户选项
voteModule.prototype.listUserChecked = function(){};
//删除主题选项
voteModule.prototype.deleteItem = function(){};
//提前结束
voteModule.prototype.endVote = function(){};
//附件数据_分页 //主题_分页
voteModule.prototype.list = function(){}; voteModule.prototype.list = function(){};
//附件所有数据 //主题所有数据
voteModule.prototype.listAll = function(){}; voteModule.prototype.listAll = function(){};
//创建一个数据操作对象,然后再后续使用 //创建一个数据操作对象,然后再后续使用
voteModule.voteActAction = new voteModule("json").delegate("voteAct"); voteModule.voteActAction = new voteModule("json").delegate("voteAct");
//创建一个数据获取对象,然后再后续使用 //创建一个数据获取对象,然后再后续使用
......
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="userVoteTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="voteTab_searchForm" style="float:left">
主题内容: <input class="easyui-textbox" id="FIELD_CONTENT" name="FIELD_CONTENT" style="width:200px"/>&nbsp;&nbsp;
<input type="checkbox" name="FIELD_USERSELF" value="0" onclick="searchRow()" />仅显示我参与的
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<div id="advsearch" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/ongoingVoteTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<style>
.vote_item_list div div{
float:left;
}
.vote_item_content{
margin: 10px 15px;
}
.vote_item_info{
margin-left: 26px;
}
.vote_item_index input{
width:120px;
}
.tableStyle span,.vote_item_content span{
border:none;
}
</style>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<input type="hidden" name="FIELD_STATUS_FLAG" id="STATUS_FLAG" value="${is_row.STATUS_FLAG}" />
<input type="hidden" name="FIELD_MIN_COUNT" id="MIN_COUNT" value="${is_row.MIN_COUNT}" />
<input type="hidden" name="FIELD_MAX_COUNT" id="MAX_COUNT" value="${is_row.MAX_COUNT}" />
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>主题内容:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" readonly="readonly" id="CONTENT" name="FIELD_CONTENT" style="width: 400px" required="true" value="${is_row.CONTENT}" />
</td>
</tr>
</table>
</form>
<form id="voteItemInputForm">
<div class="vote_item_content">
<div style="margin-bottom: 8px;" class="vote_item_item">
<input class="easyui-textbox" readonly="readonly" id="SUB_TITLE" name="FIELD_SUB_TITLE" style="width: 400px;" value="${is_row.SUB_TITLE}" a/>
</div>
<div class="vote_item_list">
</div>
</div>
</form>
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}"/>
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}"/>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>会议内容:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="adv_CONTENT" name="FIELD_CONTENT" style="width:365px" />
</td>
</tr>
<tr>
<td style="width: 20%;" class="tableStyleLable">
<span>
投票开始时间从:
</span>
</td>
<td style="width: 80%">
<input class="easyui-datetimebox" id="adv_START_START_TIME" name="FIELD_START_START_TIME"/>
<span>到</span>
<input id="adv_END_START_TIME" name="FIELD_END_START_TIME" type="text" class="easyui-datetimebox">
</td>
</tr>
<tr>
<td style="width: 20%;" class="tableStyleLable">
<span>
投票结束时间从:
</span>
</td>
<td style="width: 80%">
<input class="easyui-datetimebox" id="adv_START_END_TIME" name="FIELD_START_END_TIME"/>
<span>到</span>
<input id="adv_END_END_TIME" name="FIELD_END_END_TIME" type="text" class="easyui-datetimebox">
</td>
</tr>
</table>
</form>
\ No newline at end of file
...@@ -8,18 +8,19 @@ ...@@ -8,18 +8,19 @@
<table id="list" style="width: 100%; height: 100%;"></table> <table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb"> <div id="tb">
<form id="voteTab_searchForm" style="float:left"> <form id="voteTab_searchForm" style="float:left">
主题名称: <input class="easyui-textbox" id="FIELD_CONTENT" name="FIELD_CONTENT" style="width:200px"/>&nbsp;&nbsp; 主题内容: <input class="easyui-textbox" id="FIELD_CONTENT" name="FIELD_CONTENT" style="width:200px"/>&nbsp;&nbsp;
开始时间: <input class="easyui-datetimebox" id="adv_START_START_TIME" name="FIELD_START_START_TIME" style="width:150px"/>
-<input class="easyui-datetimebox" id="adv_END_START_TIME" name="FIELD_END_START_TIME" style="width:150px"/>&nbsp;&nbsp;
结束时间: <input class="easyui-datetimebox" id="adv_START_END_TIME" name="FIELD_START_END_TIME" style="width:150px"/>
-<input class="easyui-datetimebox" id="adv_END_END_TIME" name="FIELD_END_END_TIME" style="width:150px"/>&nbsp;&nbsp;
</form> </form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">主题查询</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增主题</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除主题</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件上传</a>
</div> </div>
<div id="detail" style="overflow:auto;"></div> <div id="detail" style="overflow:auto;"></div>
<div id="advsearch" style="overflow:auto;"></div> <div id="advsearch" style="overflow:auto;"></div>
<div id="uploadcommon" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteModule.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteTab.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/jwapp/pages/vote/js/voteTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%> <%@page contentType="text/html; charset=UTF-8"%>
<style>
.vote_item_list div div{
float:left;
}
.vote_item_content{
margin: 10px 15px;
}
.vote_item_info{
margin-left: 26px;
}
.vote_item_index input{
width:120px;
}
</style>
<form id="inputForm" method="post" style="width: 100%;"> <form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}"/> <input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}"/> <input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;"> <table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr> <tr>
<td style="width: 15%;" class="tableStyleLable"> <td style="width: 15%;" class="tableStyleLable">
<span>主题内容:</span> <span>主题内容:</span>
</td> </td>
<td style="width: 85%"> <td style="width: 85%">
<input class="easyui-textbox" id="CONTENT" name="FIELD_CONTENT" style="width:400px" required=true value="${is_row.CONTENT}"/> <input class="easyui-textbox" id="CONTENT" name="FIELD_CONTENT" style="width: 400px" required="true" value="${is_row.CONTENT}" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="tableStyleLable"> <td style="width: 15%;" class="tableStyleLable">
<span>投票开始时间:</span> <span>副标题:</span>
</td> </td>
<td> <td style="width: 85%">
<input class="easyui-datetimebox" id="START_TIME" name="FIELD_START_TIME" style="width:400px" value="${is_row.START_TIME}"/> <input class="easyui-textbox" id="SUB_TITLE" name="FIELD_SUB_TITLE" style="width: 400px" required="true" value="${is_row.SUB_TITLE}" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>上限值:</span>
</td>
<td style="width: 85%">
<input class="easyui-numberspinner" id="MAX_COUNT" name="FIELD_MAX_COUNT" style="width: 400px" required="true" data-options="min:0" value="${is_row.MAX_COUNT}" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>下限值:</span>
</td>
<td style="width: 85%">
<input class="easyui-numberspinner" id="MIN_COUNT" name="FIELD_MIN_COUNT" style="width: 400px" required="true" data-options="min:0" value="${is_row.MIN_COUNT}" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -24,10 +54,18 @@ ...@@ -24,10 +54,18 @@
<span>投票结束时间:</span> <span>投票结束时间:</span>
</td> </td>
<td> <td>
<input class="easyui-datetimebox" id="END_TIME" name="FIELD_END_TIME" style="width:400px" value="${is_row.END_TIME}"/> <input id="END_TIME" name="FIELD_END_TIME" style="width: 400px" value="${is_row.END_TIME}" />
</td> </td>
</tr> </tr>
</table>
</form>
</table> <form id="voteItemInputForm">
<div class="vote_item_content">
<div style="margin-bottom: 8px;">
<a onclick="add_vote_item()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
<a onclick="delete_vote_item()" class="easyui-linkbutton" data-options="iconCls:'icon-clear'">删除</a>
</div>
<div class="vote_item_list">
</div>
</div>
</form> </form>
\ No newline at end of file
...@@ -13,45 +13,143 @@ public interface VoteBusiness { ...@@ -13,45 +13,143 @@ public interface VoteBusiness {
/** /**
* 插入 * 插入
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
void insert_vote(Map<String,Object> entity) throws BusinessException ; void insert_vote(Map<String, Object> entity) throws BusinessException;
/**
* 插入
*
* @param entity
* @throws BusinessException
*/
void insert_userVote(Map<String, Object> entity) throws BusinessException;
/** /**
* 更新 * 更新
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
void update_vote(Map<String,Object> entity) throws BusinessException ; void update_vote(Map<String, Object> entity) throws BusinessException;
/** /**
* 删除记录 * 删除记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
void delete_vote(List<String> list)throws BusinessException; void delete_vote(List<String> list) throws BusinessException;
/** /**
* 分页获取记录 * 分页获取记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
Page<Map<String, Object>> list_vote(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ; Page<Map<String, Object>> list_vote(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
/** /**
* 获取所有记录 * 获取所有记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
List<Map<String,Object>> list_vote(Map<String, Object> query) throws BusinessException ; List<Map<String, Object>> list_vote(Map<String, Object> query) throws BusinessException;
/** /**
* 获取所有记录数 * 获取所有记录数
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
int listCount_vote(Map<String, Object> query) throws BusinessException ; int listCount_vote(Map<String, Object> query) throws BusinessException;
} /**
* 获取选项
*
* @param entity
* @throws BusinessException
*/
List<Map<String, Object>> list_item(Map<String, Object> query) throws BusinessException;
/**
* 删除记录
*
* @param entity
* @throws BusinessException
*/
void delete_item(List<String> list) throws BusinessException;
/**
* 提前结束投票
*
* @param entity
* @throws BusinessException
*/
void update_endvote(Map<String, Object> entity) throws BusinessException;
/**
* 分页获取记录
*
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_ongoing(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录
*
* @param entity
* @throws BusinessException
*/
List<Map<String, Object>> list_ongoing(Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录数
*
* @param entity
* @throws BusinessException
*/
int listCount_ongoing(Map<String, Object> query) throws BusinessException;
/**
* 分页获取记录
*
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_ended(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录
*
* @param entity
* @throws BusinessException
*/
List<Map<String, Object>> list_ended(Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录数
*
* @param entity
* @throws BusinessException
*/
int listCount_ended(Map<String, Object> query) throws BusinessException;
/**
* 获取用户选择
*
* @param entity
* @throws BusinessException
*/
List<Map<String, Object>> list_userchecked(Map<String, Object> query) throws BusinessException;
}
...@@ -11,14 +11,31 @@ public interface voteDAO { ...@@ -11,14 +11,31 @@ public interface voteDAO {
void insert_vote(Map<String,Object> entity) throws BusinessException ; void insert_vote(Map<String,Object> entity) throws BusinessException ;
void insert_item(Map<String,Object> itemmap) throws BusinessException ;
void insert_userVote(Map<String,Object> itemmap) throws BusinessException ;
void update_vote(Map<String,Object> entity) throws BusinessException ; void update_vote(Map<String,Object> entity) throws BusinessException ;
void update_item(Map<String,Object> item) throws BusinessException ;
void delete_vote(List<String> list) throws BusinessException; void delete_vote(List<String> list) throws BusinessException;
void delete_vote_item(List<String> list) throws BusinessException;
void delete_vote_action(List<String> list) throws BusinessException;
void delete_item(List<String> list) throws BusinessException;
List<Map<String,Object>> list_vote(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ; List<Map<String,Object>> list_vote(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_vote(Map<String,Object> query) throws BusinessException ; List<Map<String,Object>> list_vote(Map<String,Object> query) throws BusinessException ;
int listCount_vote(Map<String, Object> query) throws BusinessException ; int listCount_vote(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_item(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_userchecked(Map<String,Object> query) throws BusinessException ;
} }
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jw.app.business.vote.voteDAO"> <mapper namespace="com.jw.app.business.vote.voteDAO">
<sql id="WHERE">
<where>
<trim prefixOverrides="and">
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="USERSELF == 0">
and f.vote_count > 0
</if>
<if test="CONTENT != null and CONTENT != ''">
and f.CONTENT like concat('%',#{CONTENT},'%')
</if>
<if test="CREATE_ID != null and CREATE_ID != ''">
and f.CREATE_ID like concat('%',#{CREATE_ID},'%')
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.CREATE_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.CREATE_TIME &lt;= #{END_TIME}
</if>
<if test="UPDATE_ID != null and UPDATE_ID != ''">
and f.UPDATE_ID = #{UPDATE_ID}
</if>
<if test="UPDATE_TIME != null and UPDATE_TIME != ''">
and f.UPDATE_TIME = #{UPDATE_TIME}
</if>
<if test="START_START_TIME != null and START_START_TIME != ''">
and f.START_TIME &gt;= #{START_START_TIME}
</if>
<if test="END_START_TIME != null and END_START_TIME != ''">
and f.START_TIME &lt;= #{END_START_TIME}
</if>
<if test="START_END_TIME != null and START_END_TIME != ''">
and f.END_TIME &gt;= #{START_END_TIME}
</if>
<if test="END_END_TIME != null and END_END_TIME != ''">
and f.END_TIME &lt;= #{END_END_TIME}
</if>
</trim>
</where>
</sql>
<insert id="insert_vote" parameterType="map"> <insert id="insert_vote" parameterType="map">
insert into VOTE_MANAGER( insert into VOTE_MANAGE(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<insert id="insert_item" parameterType="map">
insert into VOTE_MANAGE_ITEM(
<trim prefix="" suffixOverrides=",">
<foreach collection="itemListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="itemList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<insert id="insert_userVote" parameterType="map">
insert into VOTE_MANAGE_ACTION(
<trim prefix="" suffixOverrides=","> <trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key"> <foreach collection="infoListKey" item="key">
${key}, ${key},
...@@ -20,7 +93,23 @@ ...@@ -20,7 +93,23 @@
<update id="update_vote" parameterType="map"> <update id="update_vote" parameterType="map">
<![CDATA[ <![CDATA[
update VOTE_MANAGER set update VOTE_MANAGE set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</where>
</update>
<update id="update_item" parameterType="map">
<![CDATA[
update VOTE_MANAGE_ITEM set
]]> ]]>
<trim prefix="" suffixOverrides=","> <trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info"> <foreach collection="info" item="info">
...@@ -36,7 +125,7 @@ ...@@ -36,7 +125,7 @@
<delete id="delete_vote" parameterType="list"> <delete id="delete_vote" parameterType="list">
<![CDATA[ <![CDATA[
delete from VOTE_MANAGER where UUID IN delete from VOTE_MANAGE where UUID IN
]]> ]]>
<foreach collection="list" item="UUID" open="(" separator="," <foreach collection="list" item="UUID" open="(" separator=","
close=")"> close=")">
...@@ -44,73 +133,115 @@ ...@@ -44,73 +133,115 @@
</foreach> </foreach>
</delete> </delete>
<select id="list_vote" parameterType="map" resultType="upperCaseKeyMap"> <delete id="delete_vote_item" parameterType="list">
<![CDATA[ <![CDATA[
select f.* delete from VOTE_MANAGE_ITEM where MANAGE_ID IN
from VOTE_MANAGER f where 1=1
]]> ]]>
<if test="UUID != null and UUID != ''"> <foreach collection="list" item="UUID" open="(" separator=","
and f.UUID = #{UUID} close=")">
</if> #{UUID}
<if test="CONTENT != null and CONTENT != ''"> </foreach>
and f.CONTENT like concat('%',#{CONTENT},'%') </delete>
</if>
<if test="START_TIME != null and START_TIME != ''"> <delete id="delete_vote_action" parameterType="list">
and f.START_TIME = #{START_TIME} <![CDATA[
</if> delete from VOTE_MANAGE_ACTION where MANAGE_ID IN
<if test="END_TIME != null and END_TIME != ''"> ]]>
and f.END_TIME = #{END_TIME} <foreach collection="list" item="UUID" open="(" separator=","
</if> close=")">
<if test="CREATE_ID != null and CREATE_ID != ''"> #{UUID}
and f.CREATE_ID like concat('%',#{CREATE_ID},'%') </foreach>
</if> </delete>
<if test="START_TIME != null and START_TIME != ''">
and f.CREATE_TIME &gt;= #{START_TIME} <delete id="delete_item" parameterType="list">
</if> <![CDATA[
<if test="END_TIME != null and END_TIME != ''"> delete from VOTE_MANAGE_ITEM where UUID IN
and f.CREATE_TIME &lt;= #{END_TIME} ]]>
</if> <foreach collection="list" item="UUID" open="(" separator=","
<if test="UPDATE_ID != null and UPDATE_ID != ''"> close=")">
and f.UPDATE_ID = #{UPDATE_ID} #{UUID}
</foreach>
</delete>
<select id="list_vote" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM
(
SELECT
manage.*,
SUM( CASE WHEN action.uuid IS NULL THEN 0 ELSE 1 END ) AS vote_count
FROM
( SELECT * FROM `vote_manage`
<where>
<trim prefixOverrides="and">
<if test="STATUS_FLAG != null and STATUS_FLAG != ''">
and STATUS_FLAG = #{STATUS_FLAG}
</if> </if>
<if test="UPDATE_TIME != null and UPDATE_TIME != ''"> </trim>
and f.UPDATE_TIME = #{UPDATE_TIME} </where>
) manage
LEFT JOIN ( SELECT * FROM `vote_manage_action`
<where>
<trim prefixOverrides="and">
<if test="USER_ID != null and USER_ID != ''">
and USER_ID = #{USER_ID}
</if> </if>
</trim>
</where>
) action ON manage.uuid = action.manage_id
GROUP BY
manage.uuid
) f
<include refid="WHERE"></include>
order by f.CREATE_TIME DESC order by f.CREATE_TIME DESC
</select> </select>
<select id="listCount_vote" parameterType="map" resultType="int"> <select id="listCount_vote" parameterType="map" resultType="int">
<![CDATA[ SELECT count(*) FROM
select count(*) c from VOTE_MANAGER f where 1=1 (
]]> SELECT
<if test="UUID != null and UUID != ''"> manage.*,
and f.UUID = #{UUID} SUM( CASE WHEN action.uuid IS NULL THEN 0 ELSE 1 END ) AS vote_count
</if> FROM
<if test="CONTENT != null and CONTENT != ''"> ( SELECT * FROM `vote_manage`
and f.CONTENT like concat('%',#{CONTENT},'%') <where>
</if> <trim prefixOverrides="and">
<if test="START_TIME != null and START_TIME != ''"> <if test="STATUS_FLAG != null and STATUS_FLAG != ''">
and f.START_TIME = #{START_TIME} and STATUS_FLAG = #{STATUS_FLAG}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.END_TIME = #{END_TIME}
</if>
<if test="CREATE_ID != null and CREATE_ID != ''">
and f.CREATE_ID like concat('%',#{CREATE_ID},'%')
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.CREATE_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.CREATE_TIME &lt;= #{END_TIME}
</if>
<if test="UPDATE_ID != null and UPDATE_ID != ''">
and f.UPDATE_ID = #{UPDATE_ID}
</if> </if>
<if test="UPDATE_TIME != null and UPDATE_TIME != ''"> </trim>
and f.UPDATE_TIME = #{UPDATE_TIME} </where>
) manage
LEFT JOIN ( SELECT * FROM `vote_manage_action`
<where>
<trim prefixOverrides="and">
<if test="USER_ID != null and USER_ID != ''">
and USER_ID = #{USER_ID}
</if> </if>
</trim>
</where>
) action ON manage.uuid = action.manage_id
GROUP BY
manage.uuid
) f
<include refid="WHERE"></include>
</select>
<select id="list_item" parameterType="map" resultType="upperCaseKeyMap">
select *
from vote_manage_item
where manage_id=#{MANAGE_ID}
order by sort_num ASC
</select> </select>
<select id="list_userchecked" parameterType="map" resultType="upperCaseKeyMap">
select *
from VOTE_MANAGE_ACTION
where manage_id=#{MANAGE_ID}
order by CREATE_TIME ASC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.jw.app.vote.action; ...@@ -3,6 +3,7 @@ package com.jw.app.vote.action;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.jw.app.business.VoteBusiness; import com.jw.app.business.VoteBusiness;
...@@ -17,11 +18,8 @@ import com.gaowj.standard.utils.CacheKit; ...@@ -17,11 +18,8 @@ import com.gaowj.standard.utils.CacheKit;
public class actAction extends BasicAction { public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -2591076090760872233L; private static final long serialVersionUID = -2591076090760872233L;
private JSONObject jsonObject = new JSONObject(); private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() { public JSONObject getJsonObject() {
return jsonObject; return jsonObject;
...@@ -40,6 +38,7 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -40,6 +38,7 @@ private JSONObject jsonObject = new JSONObject();
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class); VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX); Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject(); jsonObject = new JSONObject();
try { try {
entity = QueryParamUtil.StringToDate(entity); entity = QueryParamUtil.StringToDate(entity);
...@@ -53,11 +52,34 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -53,11 +52,34 @@ private JSONObject jsonObject = new JSONObject();
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类) //sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class); SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertVote", "" + entity, sysbusiness.insert_logBusiness("insertVote", "" + entity,
"增加学生测试数据", (String) entity.get("UUID"), (String) entity.get("NAME"), "votedemo1"); "增加投票主题", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "votedemo1");
// jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
//更新缓存 } catch (Exception e) {
CacheKit.update("ehcache11", "com_jw_app_vote_dataAction_listAll", business.list_vote(null)); jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
// e.printStackTrace();
}
return "json";
}
/**
* 插入用户投票
* @param entity
* @throws BusinessException
*/
public String insertUserVote() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
business.insert_userVote(entity);
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功")); jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) { } catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败")); jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
...@@ -85,8 +107,31 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -85,8 +107,31 @@ private JSONObject jsonObject = new JSONObject();
// 操作日志 // 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class); SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateVote", "" + entity, sysbusiness.insert_logBusiness("updateVote", "" + entity,
"修改测试数据",(String) entity.get("UUID"), (String) entity.get("NAME"),"votedemo1"); "修改投票主题",(String) entity.get("UUID"), (String) entity.get("CONTENT"),"votedemo1");
// jsonObject.putAll(Status.getStatusSuccessMessage("修改成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("修改失败"));
e.printStackTrace();
}
return "json";
}
/**
* 更新
* @param entity
* @throws BusinessException
*/
public String endVote() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
//去除不要更新的字段
entity.remove("OPETYPE");
//修改
entity = QueryParamUtil.StringToDate(entity);
business.update_endvote(entity);
jsonObject.putAll(Status.getStatusSuccessMessage("修改成功")); jsonObject.putAll(Status.getStatusSuccessMessage("修改成功"));
} catch (Exception e) { } catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("修改失败")); jsonObject.putAll(Status.getStatusErrorMessage("修改失败"));
...@@ -112,9 +157,7 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -112,9 +157,7 @@ private JSONObject jsonObject = new JSONObject();
// 操作日志 // 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class); SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteVote", "" + ListKey, sysbusiness.insert_logBusiness("deleteVote", "" + ListKey,
"删除测试数据", deletekey, "多个流水号","votedemo1"); "删除投票主题", deletekey, "多个流水号","votedemo1");
//
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功")); jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) { } catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败")); jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
...@@ -123,4 +166,5 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -123,4 +166,5 @@ private JSONObject jsonObject = new JSONObject();
return "json"; return "json";
} }
} }
...@@ -22,11 +22,8 @@ import com.gaowj.business.util.TestMd5; ...@@ -22,11 +22,8 @@ import com.gaowj.business.util.TestMd5;
import com.gaowj.standard.utils.CacheKit; import com.gaowj.standard.utils.CacheKit;
public class dataAction extends BasicAction{ public class dataAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = 1829141492939513911L; private static final long serialVersionUID = 1829141492939513911L;
private JSONObject jsonObject = new JSONObject(); private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数 private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页 private int page = 1;// 当前第几页
public JSONObject getJsonObject() { public JSONObject getJsonObject() {
...@@ -79,6 +76,58 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -79,6 +76,58 @@ private JSONObject jsonObject = new JSONObject();
return "json"; return "json";
} }
public String list_ongoing() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_ongoing(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateTimeToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String list_ended() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_ended(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateTimeToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/** /**
* 获取所有记录 * 获取所有记录
* @param entity * @param entity
...@@ -115,25 +164,10 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -115,25 +164,10 @@ private JSONObject jsonObject = new JSONObject();
String tt = PropUtil.getValue("login_main_url", "quartz_service", ""); String tt = PropUtil.getValue("login_main_url", "quartz_service", "");
//缓存使用 List<Map<String, Object>> listData = business.list_vote(query);
//查看src下ehcache.xml缓存配置文件。(ehcache1-ehcache10表示有10个缓存对象,分别只能缓存1-10分钟,最后有个ehcache11可以持久缓存)
List<Map<String, Object>> listData = null;
TestMd5 md5 = new TestMd5();
String queryMD5 = "";
try {
queryMD5 = md5.MD5(query.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
listData = CacheKit.get("ehcache11", "com_jw_app_vote_dataAction_listAll_"+queryMD5);
if(listData == null){
listData = business.list_vote(query);
CacheKit.put("ehcache11", "com_jw_app_vote_dataAction_listAll_"+queryMD5,listData);
}
int listDataCount = listData.size(); int listDataCount = listData.size();
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData)); data.put("rowSet", QueryParamUtil.DateTimeToString(listData));
data.put("pageNo", 1); data.put("pageNo", 1);
data.put("pageSize", listDataCount); data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount); data.put("pageCount", listDataCount);
...@@ -151,4 +185,32 @@ private JSONObject jsonObject = new JSONObject(); ...@@ -151,4 +185,32 @@ private JSONObject jsonObject = new JSONObject();
return "json"; return "json";
} }
public String listItem() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
List<Map<String, Object>> listItems=business.list_item(query);
jsonObject = new JSONObject();
jsonObject.put("listItems", listItems);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listUserChecked() throws BusinessException {
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
List<Map<String, Object>> listusercheckeds=business.list_userchecked(query);
jsonObject = new JSONObject();
jsonObject.put("listusercheckeds", listusercheckeds);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
} }
...@@ -8,15 +8,26 @@ import com.gaowj.business.exception.BusinessException; ...@@ -8,15 +8,26 @@ import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils; import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction { public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6259964352154128000L; private static final long serialVersionUID = -6259964352154128000L;
public String voteTab() throws BusinessException{ public String ongoingVoteTab() throws BusinessException{
return "ongoingVoteTab";
}
public String endedVoteTab() throws BusinessException{
return "endedVoteTab";
}
public String voteTab() throws BusinessException{
return "voteTab"; return "voteTab";
} }
public String userVoteTabDetail() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
return "userVoteTabDetail";
}
public String voteTabDetail() throws BusinessException{ public String voteTabDetail() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX); Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query); request.setAttribute("is_row", query);
......
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