Commit 38a5e626 by 罗绍泽

Merge remote-tracking branch 'origin/zhutc' into develop

# Conflicts:
#	WebContent/gaowj/ria/jquery/jquery-easyui-1.4.1/themes/icon.css
parents 3d191322 1042d8f0
......@@ -348,4 +348,7 @@
}
.icon-ext-10_20 {
background:url('../../../../images/icons/(10,20).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) {
//定义数据交互
voteModule.prototype = BusinessObject;
//插入附件数据
//插入主题
voteModule.prototype.insertVote = function(){};
//修改附件数据
//插入用户投票
voteModule.prototype.insertUserVote = function(){};
//修改主题
voteModule.prototype.updateVote = 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.listAll = function(){};
//创建一个数据操作对象,然后再后续使用
voteModule.voteActAction = new voteModule("json").delegate("voteAct");
//创建一个数据获取对象,然后再后续使用
......
......@@ -39,8 +39,8 @@ var ls_ywlx = 'YBYW';
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//投票状态
var v_statusquery_data = [{CODE_ID:'0',CODE_NAME:'未开始'},{CODE_ID:'1',CODE_NAME:'已开始'},{CODE_ID:'2',CODE_NAME:'已结束'}];
/****/
/**
......@@ -57,6 +57,15 @@ var ls_ywlx = 'YBYW';
var ls_title="投票管理功能&nbsp;&nbsp;<font color='#993300'></font>";
var is_column = [ [
{field : 'CONTENT',title : '主题内容',width : 150,align : 'center'},
{field : 'SUB_TITLE',title : '副标题',width : 150,align : 'center'},
{field : 'MAX_COUNT',title : '上限值',width : 80,align : 'center'},
{field : 'MIN_COUNT',title : '下限值',width : 80,align : 'center'},
{field : 'STATUS_FLAG',title : '状态',width : 80,align : 'center',
formatter : function(value) {
return getCodeName(v_statusquery_data, value);
}
},
{field : 'REALLY_END_TIME',title : '实际结束时间',width : 150,align : 'center'},
{field : 'START_TIME',title : '开始时间',width : 150,align : 'center'},
{field : 'END_TIME',title : '结束时间',width : 150,align : 'center'},
{field : 'CREATE_ID',title : '创建人',width : 80,align : 'center'},
......@@ -67,7 +76,13 @@ var is_column = [ [
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
$('#FIELD_STATUS_FLAG').combobox({
data : v_statusquery_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
//设置颜色和每行高度
function rowstyler(index,row){
......@@ -100,8 +115,8 @@ function formatMenu(value, data,index) {
function getOptionMenu(data,index){
var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span> <a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">编辑</a> | <span class=\"icon-clear\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"deleteRow('"
+ index + "')\">删除</a> | <span class=\"icon-ext-file\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"uploadcommonRow('"
+ index + "')\">附件</a>";
+ index + "')\">删除</a> | <span class=\"icon-reload\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"voteEndRow('"
+ index + "')\">结束</a>";
return returnData;
}
......@@ -131,19 +146,30 @@ function addRow(){
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
initDateBox();
}
//保存
function insertData(is_entity){
// is_entity.FIELD_CREATE_TIME = strToDateObj(is_entity.FIELD_CREATE_TIME);
// is_entity.FIELD_RECEIVE_DATE = strToDateObj(is_entity.FIELD_RECEIVE_DATE);
var v_result = voteModule.voteActAction.insertVote(is_entity);
$('#list').datagrid('reload');
return v_result;
var returnIsValid = $('#voteItemInputForm').form('validate');
if (returnIsValid) {
var items=[];
$("input[name=vote_item_index]").each(function(index){
items.push({
INDEX_NAME:$(this).val(),
CONTENT:$("input[name=vote_item_info]").eq(index).val(),
UUID:$("input[name=vote_item_check]").eq(index).val()
});
});
is_entity.FIELD_ITEMS=JSON.stringify(items);
var v_result = voteModule.voteActAction.insertVote(is_entity);
$('#list').datagrid('reload');
return v_result;
}
}
//加载修改子页面
function editRow(index) {
function editRow(index) {
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
......@@ -153,16 +179,80 @@ function editRow(index) {
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
initDateBox();
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);
}
$('#STATUS_FLAG').combobox({
data : v_statusquery_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
function addZero(d){
if(d<10){
return "0"+d;
}
return d;
}
function initDateBox(){
$("#END_TIME").datetimebox({
required:true,
formatter:function(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
var h = date.getHours();
var min = date.getMinutes();
var s = date.getSeconds();
var nowDate=new Date();
if(date.getTime() < nowDate.getTime()){
h = nowDate.getHours();
min = nowDate.getMinutes();
s = nowDate.getSeconds();
}
return y+'-'+addZero(m)+'-'+addZero(d)+' '+addZero(h)+':'+addZero(min)+':'+addZero(s);
}
});
$('#END_TIME').datetimebox('calendar').calendar({
validator: function(date){
return new Date().getTime()<=date||date.getDate()==new Date().getDate();
}
});
/*$('#ss').numberspinner({
min: 10,
max: 100,
editable: false
});*/
}
//保存
function updateData(is_entity){
// is_entity.FIELD_CREATE_TIME = strToDateObj(is_entity.FIELD_CREATE_TIME);
// is_entity.FIELD_RECEIVE_DATE = strToDateObj(is_entity.FIELD_RECEIVE_DATE);
v_result = voteModule.mvoteActAction.updateVote(is_entity);
var returnIsValid = $('#voteItemInputForm').form('validate');
if (returnIsValid) {
var items=[];
$("input[name=vote_item_index]").each(function(index){
items.push({
INDEX_NAME:$(this).val(),
CONTENT:$("input[name=vote_item_info]").eq(index).val(),
UUID:$("input[name=vote_item_delete]").eq(index).val()
});
});
is_entity.FIELD_ITEMS=JSON.stringify(items);
v_result = voteModule.voteActAction.updateVote(is_entity);
$('#list').datagrid('reload');
return v_result;
}
}
/****/
......@@ -232,6 +322,28 @@ function deleteBatchRow(){
/****/
/**
*
* 提前结束
*
**/
function voteEndRow(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var code = is_row[0].UUID;
$.messager.confirm('提示', '确定提前结束?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_UUID = code;
var v_result = voteModule.voteActAction.endVote(v_query);
$('#list').datagrid('reload');
}
});
}
/**
* 序号:8
* 功能:刷新
* 参数:
......@@ -263,87 +375,43 @@ function searchRow(){
}
/****/
/**
* 序号:10
* 功能:高级查询弹出
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
//加载高级查询子页面
function advsearchRow(){
var is_row={OPETYPE:'ww'};
openAdvsearchRow("voteView_voteAdvsearch",is_row,"高级查询",true,0.65,0.95,0,0);
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
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);
}
//高级查询
function advsearchData(is_entity){
// is_entity.FIELD_START_TIME = strToDateObj(is_entity.FIELD_START_TIME);
// is_entity.FIELD_END_TIME = strToDateObj(is_entity.FIELD_END_TIME);
// is_entity.FIELD_START_SCHOOLTIME = strToDateObj(is_entity.FIELD_START_SCHOOLTIME);
// is_entity.FIELD_END_SCHOOLTIME = strToDateObj(is_entity.FIELD_END_SCHOOLTIME);
$('#list').datagrid('load',is_entity);
}
/****/
/**
* 序号:11
* 功能:处理接口附件
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function uploadcommonRow(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var vote_item_checkbox=$('<div></div>');
vote_item_checkbox.addClass('vote_item_checkbox');
var code = is_row[0].UUID;
var vote_item_index=$('<div></div>');
vote_item_index.addClass('vote_item_index');
var vote_item_info=$('<div></div>');
vote_item_info.addClass('vote_item_info');
item.append(vote_item_checkbox);
item.append(vote_item_index);
item.append(vote_item_info);
vote_item_checkbox.append('<input type="checkbox" name="vote_item_delete" value="'+uuid+'"/>');
vote_item_index.append('<input class="easyui-validatebox easyui-textbox" data-options="required:true" name="vote_item_index" value="'+index+'" />');
vote_item_info.append('<input class="easyui-validatebox easyui-textbox" data-options="required:true" name="vote_item_info" style="width: 400px" value="'+content+'"/>');
var is_row={MAINDATA_ID:code,MODULE_ID:ls_module_id};
var editUrl = "uploadFileCommonView_uploadfileCommonTab?FIELD_MODULE_ID="+ls_module_id+"&FIELD_MAINDATA_ID="+code;
openViewIframRow("uploadcommon",editUrl,is_row,"毕业证附件",true,0.65,0.95,0,0);
$.parser.parse('.vote_item_one');
}
/****/
/**
* 序号:12
* 功能:批量处理接口附件
* 参数:
* 说明:
* 作者:朱天成
* 时间:2018-08-07
* 单位:杰夫兄弟智慧科技有限公司
* 备注:需更改
**/
function uploadcommonBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].UUID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
var is_row={MAINDATA_ID:code,MODULE_ID:ls_module_id};
var editUrl = "uploadFileCommonView_uploadfileCommonTab?FIELD_MODULE_ID="+ls_module_id+"&FIELD_MAINDATA_ID="+code;
openViewIframRow("uploadcommon",editUrl,is_row,"批量毕业证附件",true,0.65,0.95,0,0);
function delete_vote_item(){
$(".vote_item_list :checkbox:checked").each(function(){
$(this).parent().parent().remove();
});
}
/****/
\ 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()" />仅显示我参与的
</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 @@
<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 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>
<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-search',plain:true" onclick="javascript:searchRow()">查询</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-clear',plain:true" onclick="javascript:deleteBatchRow()">删除主题</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件上传</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>
</div>
<div id="detail" 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/vote/js/voteModule.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%;">
<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="CONTENT" name="FIELD_CONTENT" style="width:400px" required=true value="${is_row.CONTENT}"/>
</td>
</tr>
<tr>
<td class="tableStyleLable">
<span>投票开始时间:</span>
</td>
<td>
<input class="easyui-datetimebox" id="START_TIME" name="FIELD_START_TIME" style="width:400px" value="${is_row.START_TIME}"/>
</td>
</tr>
<tr>
<td class="tableStyleLable">
<span>投票结束时间:</span>
</td>
<td>
<input class="easyui-datetimebox" id="END_TIME" name="FIELD_END_TIME" style="width:400px" value="${is_row.END_TIME}"/>
</td>
</tr>
</table>
<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="CONTENT" name="FIELD_CONTENT" style="width: 400px" required="true" value="${is_row.CONTENT}" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>副标题:</span>
</td>
<td style="width: 85%">
<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>
</tr>
<tr>
<td class="tableStyleLable">
<span>投票结束时间:</span>
</td>
<td>
<input id="END_TIME" name="FIELD_END_TIME" style="width: 400px" value="${is_row.END_TIME}" />
</td>
</tr>
</table>
</form>
<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>
\ No newline at end of file
......@@ -10,48 +10,146 @@ import com.gaowj.business.util.Page;
@Service
public interface VoteBusiness {
/**
* 插入
*
* @param entity
* @throws BusinessException
*/
void insert_vote(Map<String, Object> entity) throws BusinessException;
/**
* 插入
*
* @param entity
* @throws BusinessException
*/
void insert_vote(Map<String,Object> entity) throws BusinessException ;
void insert_userVote(Map<String, Object> entity) throws BusinessException;
/**
* 更新
*
* @param entity
* @throws BusinessException
*/
void update_vote(Map<String,Object> entity) throws BusinessException ;
/**
void update_vote(Map<String, Object> entity) throws BusinessException;
/**
* 删除记录
*
* @param entity
* @throws BusinessException
*/
void delete_vote(List<String> list)throws BusinessException;
/**
void delete_vote(List<String> list) throws BusinessException;
/**
* 分页获取记录
*
* @param entity
* @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
* @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
* @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;
}
package com.jw.app.business.vote;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -12,13 +12,18 @@ import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.RowBounds;
import com.jw.app.business.VoteBusiness;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.SessionUtil;
import com.gaowj.standard.utils.CacheKit;
public class VoteBusinessImpl implements VoteBusiness {
private voteDAO voteDAO;
public voteDAO getvoteDAO() {
......@@ -31,96 +36,278 @@ public class VoteBusinessImpl implements VoteBusiness {
@Override
public void insert_vote(Map<String, Object> entity) throws BusinessException {
if(entity.get("UUID")==null){
entity.put("UUID", java.util.UUID.randomUUID().toString());
}
if(entity.get("CREATE_ID")==null){
entity.put("CREATE_ID", SessionUtil.getCode() );
}
if(entity.get("CREATE_TIME")==null){
entity.put("CREATE_TIME", new Date());
String items = entity.get("ITEMS").toString();
entity.remove("ITEMS");
entity.put("UUID", java.util.UUID.randomUUID().toString());
entity.put("START_TIME", new Date());
entity.put("CREATE_ID", SessionUtil.getCode());
entity.put("CREATE_TIME", new Date());
entity.put("UPDATE_ID", SessionUtil.getEmname());
entity.put("UPDATE_TIME", new Date());
entity.put("STATUS_FLAG", 1);
// 动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
voteDAO.insert_vote(entity);
}
if(entity.get("UPDATE_ID")==null){
entity.put("UPDATE_ID", SessionUtil.getEmname());
// 插入明细表
JSONArray itemArray = JSONArray.fromObject(items);
for (int i = 0; i < itemArray.size(); i++) {
Map<String, Object> itemmap = new HashMap<String, Object>();
JSONObject item = itemArray.getJSONObject(i);
item.put("UUID", java.util.UUID.randomUUID().toString());
item.put("CREATE_ID", SessionUtil.getCode());
item.put("CREATE_TIME", SessionUtil.getCurrenttime());
item.put("UPDATE_ID", SessionUtil.getEmname());
item.put("MANAGE_ID", entity.get("UUID"));
item.put("UPDATE_TIME", SessionUtil.getCurrenttime());
item.put("SORT_NUM", i);
List<String> itemListKey = new ArrayList<String>();
List<Object> itemList = new ArrayList<Object>();
Set<String> key = item.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
itemList.add(item.get(str));
itemListKey.add(str);
}
itemmap.put("itemListKey", itemListKey);
itemmap.put("itemList", itemList);
// 插入
voteDAO.insert_item(itemmap);
}
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
@Override
public void insert_userVote(Map<String, Object> entity) throws BusinessException {
String flag = (String) entity.get("STATUS_FLAG");
if (flag.equals("1")) {
String s = (String) entity.get("UUIDS");
List<String> uuidsList = Arrays.asList(s.split(","));
for (int i = 0; i < uuidsList.size(); i++) {
String item = uuidsList.get(i);
Map<String, Object> itemmap = new HashMap<String, Object>();
itemmap.put("UUID", java.util.UUID.randomUUID().toString());
itemmap.put("MANAGE_ID", entity.get("UUID"));
itemmap.put("ITEM_ID", item);
itemmap.put("USER_ID", SessionUtil.getCode());
itemmap.put("VOTE_TIME", SessionUtil.getCurrenttime());
itemmap.put("CREATE_ID", SessionUtil.getCode());
itemmap.put("CREATE_TIME", SessionUtil.getCurrenttime());
itemmap.put("UPDATE_ID", SessionUtil.getEmname());
itemmap.put("UPDATE_TIME", SessionUtil.getCurrenttime());
// 动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if (itemmap.keySet() != null) {
Set<String> key = itemmap.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(itemmap.get(str));
infoListKey.add(str);
}
itemmap.put("infoListKey", infoListKey);
itemmap.put("infoList", infoList);
}
voteDAO.insert_userVote(itemmap);
}
}
// if(entity.get("SAVEDAYS")==null){
// String ls_savedays = PropUtil.getValue("set_savedays", "quartz_service", "14");
// entity.put("SAVEDAYS", Integer.parseInt(ls_savedays));
// }
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
voteDAO.insert_vote(entity);
}
}
@Override
public void update_vote(Map<String, Object> entity) throws BusinessException {
//动态传值修改
// 动态传值修改
String items = entity.get("ITEMS").toString();
entity.remove("ITEMS");
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("UUID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
voteDAO.update_vote(entity);
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("UUID", str))
continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
voteDAO.update_vote(entity);
}
// 修改明细表
List<Map<String, Object>> updateItemList = new ArrayList<Map<String, Object>>();
// 用户新存储的明细
JSONArray itemArray = JSONArray.fromObject(items);
// 投票表原明细
Map<String, Object> query = new HashMap<String, Object>();
query.put("MANAGE_ID", entity.get("UUID"));
List<Map<String, Object>> listOldItem = voteDAO.list_item(query);
//
// List<>
// 筛选新增的明细
for (int i = 0; i < itemArray.size(); i++) {
JSONObject item = itemArray.getJSONObject(i);
item.put("SORT_NUM", i);
if (item.get("UUID") != null && !"".equals(item.get("UUID"))) {
// 表示旧数据
// update item(UUID)
Set<String> key1 = item.keySet();
for (String str : key1) {
Map<String, Object> updateItemMap = new HashMap<String, Object>();
updateItemMap.put("key", str);
updateItemMap.put("value", item.get(str));
updateItemList.add(updateItemMap);
}
item.put("info", updateItemList);
voteDAO.update_item(item);
} else {
// 表示新数据
// insert item
Map<String, Object> itemmap = new HashMap<String, Object>();
item.put("UUID", java.util.UUID.randomUUID().toString());
item.put("MANAGE_ID", entity.get("UUID"));
item.put("CREATE_ID", SessionUtil.getCode());
item.put("CREATE_TIME", SessionUtil.getCurrenttime());
item.put("UPDATE_ID", SessionUtil.getEmname());
item.put("UPDATE_TIME", SessionUtil.getCurrenttime());
List<String> itemListKey = new ArrayList<String>();
List<Object> itemList = new ArrayList<Object>();
Set<String> key = item.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
itemList.add(item.get(str));
itemListKey.add(str);
}
itemmap.put("itemListKey", itemListKey);
itemmap.put("itemList", itemList);
// 插入
voteDAO.insert_item(itemmap);
}
}
List<String> listMoveUuid = new ArrayList<String>();
outer: for (Map<String, Object> oldItem : listOldItem) {
for (int i = 0; i < itemArray.size(); i++) {
JSONObject item = itemArray.getJSONObject(i);
if (oldItem.get("UUID").equals(item.get("UUID"))) {
// 表示该明细不需要删除
continue outer;
}
}
// 如果没有在新明细中查询到,则表示该明细需要删除
listMoveUuid.add((String) oldItem.get("UUID"));
}
if (listMoveUuid.size() > 0) {
voteDAO.delete_item(listMoveUuid);
}
}
@Override
public void delete_vote(List<String> list) throws BusinessException {
voteDAO.delete_vote(list);
voteDAO.delete_vote_item(list);
voteDAO.delete_vote_action(list);
}
@Override
public void delete_item(List<String> list) throws BusinessException {
voteDAO.delete_item(list);
}
@Override
public Page<Map<String, Object>> list_vote(int pageNo, int pageSize, Map<String, Object> query)
throws BusinessException {
query.put("CREATE_ID", SessionUtil.getCode());
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = voteDAO.list_vote(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = listCount_vote(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public Page<Map<String, Object>> list_ongoing(int pageNo, int pageSize, Map<String, Object> query)
throws BusinessException {
// 计算起始记录
query.put("STATUS_FLAG", 1);
query.put("USER_ID", SessionUtil.getEmname());
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = voteDAO.list_vote(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = listCount_vote(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public Page<Map<String, Object>> list_vote(int pageNo, int pageSize,Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = voteDAO.list_vote(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = listCount_vote(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
public Page<Map<String, Object>> list_ended(int pageNo, int pageSize, Map<String, Object> query)
throws BusinessException {
query.put("STATUS_FLAG", 2);
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = voteDAO.list_vote(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = listCount_vote(query);
return page;
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_vote(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> list_data = CacheKit.get("ehcache10", "vote"+query);
if(list_data==null || list_data.size()==0){
list_data=voteDAO.list_vote(query);
CacheKit.put("ehcache10", "vote"+query, list_data);
List<Map<String, Object>> list_data = CacheKit.get("ehcache10", "vote" + query);
if (list_data == null || list_data.size() == 0) {
list_data = voteDAO.list_vote(query);
CacheKit.put("ehcache10", "vote" + query, list_data);
}
return list_data;
}
......@@ -130,5 +317,63 @@ public class VoteBusinessImpl implements VoteBusiness {
return voteDAO.listCount_vote(query);
}
}
@Override
public int listCount_ongoing(Map<String, Object> query) throws BusinessException {
return voteDAO.listCount_vote(query);
}
@Override
public int listCount_ended(Map<String, Object> query) throws BusinessException {
return voteDAO.listCount_vote(query);
}
@Override
public List<Map<String, Object>> list_ongoing(Map<String, Object> query) throws BusinessException {
return voteDAO.list_vote(query);
}
@Override
public List<Map<String, Object>> list_ended(Map<String, Object> query) throws BusinessException {
return voteDAO.list_vote(query);
}
@Override
public List<Map<String, Object>> list_item(Map<String, Object> query) throws BusinessException {
return voteDAO.list_item(query);
}
@Override
public List<Map<String, Object>> list_userchecked(Map<String, Object> query) throws BusinessException {
return voteDAO.list_userchecked(query);
}
@Override
public void update_endvote(Map<String, Object> entity) throws BusinessException {
// 动态传值修改
entity.put("REALLY_END_TIME", new Date());
entity.put("UPDATE_TIME", new Date());
entity.put("UPDATE_ID", SessionUtil.getEmname());
entity.put("STATUS_FLAG", 2);
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("UUID", str))
continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
voteDAO.update_vote(entity);
}
}
}
......@@ -10,15 +10,32 @@ import com.gaowj.business.exception.BusinessException;
public interface voteDAO {
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_item(Map<String,Object> item) 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(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" ?>
<!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">
<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 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=",">
<foreach collection="infoListKey" item="key">
${key},
......@@ -20,7 +93,7 @@
<update id="update_vote" parameterType="map">
<![CDATA[
update VOTE_MANAGER set
update VOTE_MANAGE set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
......@@ -30,87 +103,145 @@
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</if>
</where>
</update>
<update id="update_item" parameterType="map">
<![CDATA[
update VOTE_MANAGE_ITEM 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>
<delete id="delete_vote" parameterType="list">
<![CDATA[
delete from VOTE_MANAGER where UUID IN
delete from VOTE_MANAGE where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
#{UUID}
</foreach>
</delete>
<delete id="delete_vote_item" parameterType="list">
<![CDATA[
delete from VOTE_MANAGE_ITEM where MANAGE_ID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<delete id="delete_vote_action" parameterType="list">
<![CDATA[
delete from VOTE_MANAGE_ACTION where MANAGE_ID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<delete id="delete_item" parameterType="list">
<![CDATA[
delete from VOTE_MANAGE_ITEM where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_vote" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from VOTE_MANAGER f where 1=1
]]>
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="CONTENT != null and CONTENT != ''">
and f.CONTENT like concat('%',#{CONTENT},'%')
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.START_TIME = #{START_TIME}
</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 test="UPDATE_TIME != null and UPDATE_TIME != ''">
and f.UPDATE_TIME = #{UPDATE_TIME}
</if>
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>
</trim>
</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>
</trim>
</where>
) action ON manage.uuid = action.manage_id
GROUP BY
manage.uuid
) f
<include refid="WHERE"></include>
order by f.CREATE_TIME DESC
</select>
<select id="listCount_vote" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from VOTE_MANAGER f where 1=1
]]>
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="CONTENT != null and CONTENT != ''">
and f.CONTENT like concat('%',#{CONTENT},'%')
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.START_TIME = #{START_TIME}
</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 test="UPDATE_TIME != null and UPDATE_TIME != ''">
and f.UPDATE_TIME = #{UPDATE_TIME}
</if>
SELECT count(*) 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>
</trim>
</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>
</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 id="list_userchecked" parameterType="map" resultType="upperCaseKeyMap">
select *
from VOTE_MANAGE_ACTION
where manage_id=#{MANAGE_ID}
order by CREATE_TIME ASC
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.jw.app.vote.action;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.jw.app.business.VoteBusiness;
......@@ -17,11 +18,8 @@ import com.gaowj.standard.utils.CacheKit;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -2591076090760872233L;
private JSONObject jsonObject = new JSONObject();
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
......@@ -40,6 +38,7 @@ private JSONObject jsonObject = new JSONObject();
VoteBusiness business = BusinessManager.getBusiness(VoteBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
......@@ -53,11 +52,34 @@ private JSONObject jsonObject = new JSONObject();
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertVote", "" + entity,
"增加学生测试数据", (String) entity.get("UUID"), (String) entity.get("NAME"), "votedemo1");
//
//更新缓存
CacheKit.update("ehcache11", "com_jw_app_vote_dataAction_listAll", business.list_vote(null));
//
"增加投票主题", (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 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("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
......@@ -85,8 +107,31 @@ private JSONObject jsonObject = new JSONObject();
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
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("修改成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("修改失败"));
......@@ -112,9 +157,7 @@ private JSONObject jsonObject = new JSONObject();
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteVote", "" + ListKey,
"删除测试数据", deletekey, "多个流水号","votedemo1");
//
"删除投票主题", deletekey, "多个流水号","votedemo1");
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
......@@ -122,5 +165,6 @@ private JSONObject jsonObject = new JSONObject();
}
return "json";
}
}
......@@ -22,11 +22,8 @@ import com.gaowj.business.util.TestMd5;
import com.gaowj.standard.utils.CacheKit;
public class dataAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = 1829141492939513911L;
private JSONObject jsonObject = new JSONObject();
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
......@@ -79,6 +76,58 @@ private JSONObject jsonObject = new JSONObject();
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
......@@ -115,25 +164,10 @@ private JSONObject jsonObject = new JSONObject();
String tt = PropUtil.getValue("login_main_url", "quartz_service", "");
//缓存使用
//查看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);
}
List<Map<String, Object>> listData = business.list_vote(query);
int listDataCount = listData.size();
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("pageSize", listDataCount);
data.put("pageCount", listDataCount);
......@@ -150,5 +184,33 @@ private JSONObject jsonObject = new JSONObject();
}
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,14 +8,25 @@ import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction {
/**
*
*/
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";
}
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{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
......
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