first commit
This commit is contained in:
280
comm/Cms/WebContent/banner_add.jsp
Executable file
280
comm/Cms/WebContent/banner_add.jsp
Executable file
@@ -0,0 +1,280 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>横幅管理
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<form action="<%=basePath%>normal/adminBannerAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">
|
||||
新增横幅
|
||||
<ul class="panel-tools">
|
||||
<li><a class="icon minimise-tool"><i
|
||||
class="fa fa-minus"></i></a></li>
|
||||
<li><a class="icon expand-tool"><i class="fa fa-expand"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminBannerAction!add.action"
|
||||
method="post" name="mainForm" id="mainForm" enctype="multipart/form-data">
|
||||
<s:hidden name="id" id="id"></s:hidden>
|
||||
<s:hidden name="img" id="img"></s:hidden>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">业务代码</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="content_code" name="content_code" cssClass="form-control "
|
||||
placeholder="业务代码(同种内容不同语言代码相同)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">图片</label>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<input type="file" id="fileName" name="fileName" onchange="upload();" style="position:absolute;opacity:0;">
|
||||
<label for="fileName">
|
||||
|
||||
<img width="150px" height="55px" id="show_img" style="float: left;"
|
||||
|
||||
src="<%=base%>/image/add.png" alt="点击上传图片" />
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">路径</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="url" name="url" cssClass="form-control "
|
||||
placeholder="路径" />
|
||||
</div>
|
||||
</div>
|
||||
<p class="ballon color1">排序索引,数字越小越靠前</p>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">排序索引</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="sort_index" name="sort_index" cssClass="form-control "
|
||||
placeholder="排序索引" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">模块</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="model" cssClass="form-control "
|
||||
name="model" list="modelMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">语言</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="language" cssClass="form-control "
|
||||
name="language" list="languageMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">是否可点击</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<s:select id="click" cssClass="form-control "
|
||||
name="click" list="#{'0':'否','1':'是'}"
|
||||
listKey="key" listValue="value" value="on_sale" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">是否展示</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<s:select id="on_show" cssClass="form-control "
|
||||
name="on_show" list="#{'0':'否','1':'是'}"
|
||||
listKey="key" listValue="value" value="on_sale" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-1">
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="modal_succeeded" tabindex="-1"
|
||||
role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" >
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">确认新增</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">登录人资金密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="login_safeword" type="password" name="login_safeword"
|
||||
class="login_safeword" placeholder="请输入登录人资金密码" >
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group" style="">
|
||||
|
||||
<label for="input002" class="col-sm-3 control-label form-label">验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="email_code" type="text" name="email_code"
|
||||
class="login_safeword" placeholder="请输入验证码" >
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button id="email_code_button"
|
||||
class="btn btn-light " onClick="sendCode();" >获取验证码</button>
|
||||
<a id="email_code_button" href="javascript:sendCode();" class="btn btn-light" style="margin-bottom: 10px" >获取超级签验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">超级谷歌验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="super_google_auth_code" name="super_google_auth_code"
|
||||
placeholder="请输入超级谷歌验证码" >
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0;">
|
||||
<button type="button" class="btn "
|
||||
data-dismiss="modal">关闭</button>
|
||||
<button id="sub" type="submit"
|
||||
class="btn btn-default" >确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<a href="javascript:goUrl(<s:property value="pageNo" />)"
|
||||
class="btn">取消</a> <a href="javascript:submit()"
|
||||
class="btn btn-default">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
<script src="<%=basePath%>js/util.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function submit() {
|
||||
/* swal({
|
||||
title : "是否保存?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
var sHTML = $('#content_text').val();
|
||||
$("#content").val(sHTML);
|
||||
document.getElementById("mainForm").submit();
|
||||
}); */
|
||||
$('#modal_succeeded').modal("show");
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
//初始化执行一次
|
||||
setTimeout(function() {
|
||||
start();
|
||||
}, 100);
|
||||
function start(){
|
||||
var img = $("#img").val();
|
||||
if(img!=null&&img!=""){
|
||||
var show_img = document.getElementById('show_img');
|
||||
show_img.src="<%=base%>wap/public/showimg!showImg.action?imagePath="+img;
|
||||
}
|
||||
}
|
||||
function upload(){
|
||||
var fileReader = new FileReader();
|
||||
var formData = new FormData();
|
||||
var file = document.getElementById('fileName').files[0];
|
||||
formData.append("file", file);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=basePath%>normal/uploadimg!execute.action?random="
|
||||
+ Math.random(),
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success : function(data) {
|
||||
console.log(data);
|
||||
$("#img").val(data.data)
|
||||
var show_img = document.getElementById('show_img');
|
||||
show_img.src="<%=base%>wap/public/showimg!showImg.action?imagePath="+data.data;
|
||||
|
||||
},
|
||||
error : function(XMLHttpRequest, textStatus,
|
||||
errorThrown) {
|
||||
console.log("请求错误");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
262
comm/Cms/WebContent/banner_list.jsp
Executable file
262
comm/Cms/WebContent/banner_list.jsp
Executable file
@@ -0,0 +1,262 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>横幅管理
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">查询条件</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminBannerAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<s:hidden name="pageNo" id="pageNo"></s:hidden>
|
||||
<%-- <div class="col-md-12 col-lg-4">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<s:textfield id="para_title" name="para_title" cssClass="form-control " placeholder="标题"/>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div> --%>
|
||||
|
||||
<div class="col-md-12 col-lg-4">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<s:select id="para_language" cssClass="form-control "
|
||||
name="para_language"
|
||||
list="languageMap" listKey="key"
|
||||
listValue="value" headerKey="" headerValue="所有语言"
|
||||
value="para_language" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2">
|
||||
<button type="submit" class="btn btn-block btn-light">确定</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%-- <form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminCmsAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form> --%>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- Start Panel -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-title">查询结果</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<a href="<%=basePath%>normal/adminBannerAction!toAdd.action"
|
||||
class="btn btn-light" style="margin-bottom: 10px"><i
|
||||
class="fa fa-pencil"></i>新增横幅</a>
|
||||
</sec:authorize>
|
||||
<div class="panel-body">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<td >业务代码</td>
|
||||
<td >模块</td>
|
||||
</sec:authorize>
|
||||
<td class="col-md-2">语言</td>
|
||||
<!-- <td >访问路径</td> -->
|
||||
<td >图片</td>
|
||||
<td >可否点击</td>
|
||||
<td >是否展示</td>
|
||||
<td >排序</td>
|
||||
<!-- <td class="col-md-2" width="150px">日期</td> -->
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN">
|
||||
<td class="col-md-2"></td>
|
||||
</sec:authorize>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<s:iterator value="page.elements" status="stat">
|
||||
<tr>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<td><s:property value="content_code" /></td>
|
||||
<td><s:property value="model" /></td>
|
||||
</sec:authorize>
|
||||
<td class="col-md-2"><s:property value="language" /></td>
|
||||
<%-- <td class="col-md-2"><s:property value="url" /></td> --%>
|
||||
<td class="col-md-2"><img alt="" width="150px" height="55px" src="<s:property value="image" />"></td>
|
||||
<td>
|
||||
<s:if test="click==1"><span class="right label label-success">是</span></s:if>
|
||||
<s:else><span class="right label label-danger">否</span></s:else>
|
||||
</td>
|
||||
<td>
|
||||
<s:if test="on_show==1"><span class="right label label-success">是</span></s:if>
|
||||
<s:else><span class="right label label-danger">否</span></s:else>
|
||||
</td>
|
||||
<td><s:property value="sort_index" /></td>
|
||||
<%-- <td><s:date name="createTime" format="yyyy-MM-dd " /></td> --%>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN">
|
||||
<td>
|
||||
<%-- <a href="<%=basePath%>normal/adminCmsAction!toUpdate.action?id=<s:property value="id" />"
|
||||
class="btn btn-light" style="margin-bottom: 10px">修改</a> --%>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-light">操作</button>
|
||||
<button type="button"
|
||||
class="btn btn-light dropdown-toggle"
|
||||
data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span> <span class="sr-only">Toggle
|
||||
Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
|
||||
<li><a
|
||||
href="<%=basePath%>normal/adminBannerAction!toUpdate.action?id=<s:property value="id" />">修改</a></li>
|
||||
|
||||
<li><a
|
||||
href="javascript:ondelete('<s:property value="id" />')">删除</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</sec:authorize>
|
||||
</tr>
|
||||
</s:iterator>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<%@ include file="include/page_simple.jsp"%>
|
||||
<nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- End Panel -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
|
||||
<form action="<%=basePath%>normal/adminBannerAction!delete.action"
|
||||
method="post" id="ondelete">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
<s:hidden name="id" id="news_id"></s:hidden>
|
||||
<div class="col-sm-1">
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="modal_succeeded" tabindex="-1"
|
||||
role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" >
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">确认新增</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">登录人资金密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="login_safeword" type="password" name="login_safeword"
|
||||
class="login_safeword" placeholder="请输入登录人资金密码" >
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group" style="">
|
||||
|
||||
<label for="input002" class="col-sm-3 control-label form-label">验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="email_code" type="text" name="email_code"
|
||||
class="login_safeword" placeholder="请输入验证码" >
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button id="email_code_button"
|
||||
class="btn btn-light " onClick="sendCode();" >获取验证码</button>
|
||||
<a id="email_code_button" href="javascript:sendCode();" class="btn btn-light" style="margin-bottom: 10px" >获取超级签验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">超级谷歌验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="super_google_auth_code" name="super_google_auth_code"
|
||||
placeholder="请输入超级谷歌验证码" >
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0;">
|
||||
<button type="button" class="btn "
|
||||
data-dismiss="modal">关闭</button>
|
||||
<button id="sub" type="submit"
|
||||
class="btn btn-default" >确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal -->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
function ondelete(id) {
|
||||
$("#news_id").val(id);
|
||||
$('#modal_succeeded').modal("show");
|
||||
/* swal({
|
||||
title : "是否确认删除?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
document.getElementById("ondelete").submit();
|
||||
}); */
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
289
comm/Cms/WebContent/banner_update.jsp
Executable file
289
comm/Cms/WebContent/banner_update.jsp
Executable file
@@ -0,0 +1,289 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>横幅管理
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<form action="<%=basePath%>normal/adminBannerAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">
|
||||
修改公告
|
||||
<ul class="panel-tools">
|
||||
<li><a class="icon minimise-tool"><i
|
||||
class="fa fa-minus"></i></a></li>
|
||||
<li><a class="icon expand-tool"><i class="fa fa-expand"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminBannerAction!update.action"
|
||||
method="post" name="mainForm" id="mainForm" enctype="multipart/form-data">
|
||||
<s:hidden name="id" id="id"></s:hidden>
|
||||
<s:hidden name="img" id="img"></s:hidden>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">业务代码</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="content_code" name="content_code" cssClass="form-control "
|
||||
placeholder="业务代码(同种内容不同语言代码相同)" />
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">图片</label>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<input type="file" id="fileName" name="fileName" onchange="upload();" style="position:absolute;opacity:0;">
|
||||
<label for="fileName">
|
||||
|
||||
<img width="150px" height="55px" id="show_img" style="float: left;"
|
||||
|
||||
src="<%=base%>/image/add.png" alt="点击上传图片" />
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">路径</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="url" name="url" cssClass="form-control "
|
||||
placeholder="路径" />
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<p class="ballon color1">排序索引,数字越小越靠前</p>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">排序索引</label>
|
||||
<div class="col-sm-4">
|
||||
<s:textfield id="sort_index" name="sort_index" cssClass="form-control "
|
||||
placeholder="排序索引" />
|
||||
</div>
|
||||
</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">模块</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="model" cssClass="form-control "
|
||||
name="model" list="modelMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">语言</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="language" cssClass="form-control "
|
||||
name="language" list="languageMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">是否可点击</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<s:select id="click" cssClass="form-control "
|
||||
name="click" list="#{'0':'否','1':'是'}"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label">是否展示</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<s:select id="on_show" cssClass="form-control "
|
||||
name="on_show" list="#{'0':'否','1':'是'}"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-1">
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="modal_succeeded" tabindex="-1"
|
||||
role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" >
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">确认新增</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">登录人资金密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="login_safeword" type="password" name="login_safeword"
|
||||
class="login_safeword" placeholder="请输入登录人资金密码" >
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group" style="">
|
||||
|
||||
<label for="input002" class="col-sm-3 control-label form-label">验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="email_code" type="text" name="email_code"
|
||||
class="login_safeword" placeholder="请输入验证码" >
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button id="email_code_button"
|
||||
class="btn btn-light " onClick="sendCode();" >获取验证码</button>
|
||||
<a id="email_code_button" href="javascript:sendCode();" class="btn btn-light" style="margin-bottom: 10px" >获取超级签验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" >
|
||||
<label for="input002" class="col-sm-3 control-label form-label">超级谷歌验证码</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="super_google_auth_code" name="super_google_auth_code"
|
||||
placeholder="请输入超级谷歌验证码" >
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 0;">
|
||||
<button type="button" class="btn "
|
||||
data-dismiss="modal">关闭</button>
|
||||
<button id="sub" type="submit"
|
||||
class="btn btn-default" >确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<a href="javascript:goUrl(<s:property value="pageNo" />)"
|
||||
class="btn">取消</a> <a href="javascript:submit()"
|
||||
class="btn btn-default">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
<script src="<%=basePath%>js/util.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function submit() {
|
||||
/* swal({
|
||||
title : "是否保存?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
var sHTML = $('#content_text').val();
|
||||
$("#content").val(sHTML);
|
||||
document.getElementById("mainForm").submit();
|
||||
}); */
|
||||
$('#modal_succeeded').modal("show");
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//初始化执行一次
|
||||
setTimeout(function() {
|
||||
start();
|
||||
}, 100);
|
||||
function start(){
|
||||
var img = $("#img").val();
|
||||
if(img!=null&&img!=""){
|
||||
var show_img = document.getElementById('show_img');
|
||||
<%-- show_img.src="<%=base%>wap/public/showimg!showImg.action?imagePath="+img; --%>
|
||||
show_img.src=img;
|
||||
}
|
||||
}
|
||||
function upload(){
|
||||
var fileReader = new FileReader();
|
||||
var formData = new FormData();
|
||||
var file = document.getElementById('fileName').files[0];
|
||||
formData.append("file", file);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=basePath%>normal/uploadimg!execute.action?random="
|
||||
+ Math.random(),
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success : function(data) {
|
||||
console.log(data);
|
||||
// $("#img").val(data.data)
|
||||
// var show_img = document.getElementById('show_img');
|
||||
<%-- show_img.src="<%=base%>wap/public/showimg!showImg.action?imagePath="+data.data; --%>
|
||||
|
||||
$("#img").val("<%=base%>wap/public/showimg!showImg.action?imagePath="+data.data)
|
||||
var show_img = document.getElementById('show_img');
|
||||
show_img.src=$("#img").val();
|
||||
|
||||
},
|
||||
error : function(XMLHttpRequest, textStatus,
|
||||
errorThrown) {
|
||||
console.log("请求错误");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
165
comm/Cms/WebContent/cms_add.jsp
Executable file
165
comm/Cms/WebContent/cms_add.jsp
Executable file
@@ -0,0 +1,165 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>用户端内容管理公告
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_LIST")'>
|
||||
<form action="<%=basePath%>normal/adminCmsAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form>
|
||||
</s:if>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">
|
||||
新增公告
|
||||
<ul class="panel-tools">
|
||||
<li><a class="icon minimise-tool"><i
|
||||
class="fa fa-minus"></i></a></li>
|
||||
<li><a class="icon expand-tool"><i class="fa fa-expand"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_ADD")'>
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminCmsAction!add.action"
|
||||
method="post" name="mainForm" id="mainForm">
|
||||
<s:hidden name="id" id="id"></s:hidden>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">标题</label>
|
||||
<div class="col-sm-10">
|
||||
<s:textfield id="title" name="title" cssClass="form-control "
|
||||
placeholder="标题" />
|
||||
</div>
|
||||
</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">业务代码</label>
|
||||
<div class="col-sm-10">
|
||||
<s:textfield id="content_code" name="content_code" cssClass="form-control "
|
||||
placeholder="业务代码(同种内容不同语言代码相同)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">模块</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="model" cssClass="form-control "
|
||||
name="model" list="modelMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">语言</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="language" cssClass="form-control "
|
||||
name="language" list="languageMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-11">
|
||||
<div id="summernote"></div>
|
||||
</div>
|
||||
<s:hidden name="content" id="content"></s:hidden>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<a href="javascript:goUrl(<s:property value="pageNo" />)"
|
||||
class="btn">取消</a> <a href="javascript:submit()"
|
||||
class="btn btn-default">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</s:if>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
<script src="<%=basePath%>js/util.js" type="text/javascript"></script>
|
||||
<script type="text/javascript"
|
||||
src="<%=basePath%>js/summernote/summernote.min.js"></script>
|
||||
|
||||
<script>
|
||||
/* SUMMERNOTE*/
|
||||
$(document).ready(function() {
|
||||
$('#summernote').summernote();
|
||||
var content=$("#content").val();
|
||||
$('#summernote').code(content)
|
||||
});
|
||||
</script>
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_ADD")'>
|
||||
<script type="text/javascript">
|
||||
function submit() {
|
||||
swal({
|
||||
title : "是否保存?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
var sHTML = $('#summernote').code();
|
||||
$("#content").val(sHTML);
|
||||
document.getElementById("mainForm").submit();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</s:if>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
206
comm/Cms/WebContent/cms_list.jsp
Executable file
206
comm/Cms/WebContent/cms_list.jsp
Executable file
@@ -0,0 +1,206 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>用户端内容管理
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">查询条件</div>
|
||||
<div class="panel-body">
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_LIST")'>
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminCmsAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<s:hidden name="pageNo" id="pageNo"></s:hidden>
|
||||
<div class="col-md-12 col-lg-4">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<s:textfield id="para_title" name="para_title" cssClass="form-control " placeholder="标题"/>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-4">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<s:select id="para_language" cssClass="form-control "
|
||||
name="para_language"
|
||||
list="languageMap" listKey="key"
|
||||
listValue="value" headerKey="" headerValue="所有语言"
|
||||
value="para_language" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2">
|
||||
<button type="submit" class="btn btn-block btn-default">确定</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</s:if>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%-- <form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminCmsAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form> --%>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- Start Panel -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-title">查询结果</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_TOADD")'>
|
||||
<a href="<%=basePath%>normal/adminCmsAction!toAdd.action"
|
||||
class="btn btn-light" style="margin-bottom: 10px"><i
|
||||
class="fa fa-pencil"></i>新增公告</a>
|
||||
</s:if>
|
||||
</sec:authorize>
|
||||
<div class="panel-body">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td >标题</td>
|
||||
<!-- <td>内容</td> -->
|
||||
<!-- <td class="col-md-1">模块</td> -->
|
||||
<td class="col-md-2">语言</td>
|
||||
<!-- <td class="col-md-2" width="150px">日期</td> -->
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN">
|
||||
<td class="col-md-2"></td>
|
||||
</sec:authorize>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<s:iterator value="page.elements" status="stat">
|
||||
<tr>
|
||||
<%-- <td><a
|
||||
href="<%=basePath%>normal/adminCmsAction!toAdd.action?id=<s:property value="id" />"
|
||||
target="_blank"><s:property value="title" /></a></td> --%>
|
||||
<td><s:property value="title" /></td>
|
||||
<%-- <td title="<s:property value="content"/>">
|
||||
<s:if test="content.length()>=17">
|
||||
<s:property value="content.substring(0,17)+'....'" />
|
||||
</s:if>
|
||||
<s:else><s:property value="content"/></s:else>
|
||||
</td> --%>
|
||||
<%-- <td><s:property value="model" /></td> --%>
|
||||
<td class="col-md-2"><s:property value="language" /></td>
|
||||
<%-- <td><s:date name="createTime" format="yyyy-MM-dd " /></td> --%>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN">
|
||||
<td>
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_TOUPDATE")'>
|
||||
<a href="<%=basePath%>normal/adminCmsAction!toUpdate.action?id=<s:property value="id" />"
|
||||
class="btn btn-light" style="margin-bottom: 10px">修改</a>
|
||||
</s:if>
|
||||
<%-- <div class="btn-group">
|
||||
<button type="button" class="btn btn-light">操作</button>
|
||||
<button type="button"
|
||||
class="btn btn-light dropdown-toggle"
|
||||
data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span> <span class="sr-only">Toggle
|
||||
Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
|
||||
<li><a
|
||||
href="<%=basePath%>normal/adminCmsAction!toAdd.action?id=<s:property value="id" />">修改</a></li>
|
||||
|
||||
<li><a
|
||||
href="javascript:ondelete('<s:property value="id" />')">删除</a></li>
|
||||
|
||||
</ul>
|
||||
</div> --%>
|
||||
</td>
|
||||
</sec:authorize>
|
||||
</tr>
|
||||
</s:iterator>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<%@ include file="include/page_simple.jsp"%>
|
||||
<nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- End Panel -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
|
||||
<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_ROOT">
|
||||
<form action="<%=basePath%>normal/adminCmsAction!delete.action"
|
||||
method="post" id="ondelete">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
<s:hidden name="id" id="news_id"></s:hidden>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
function ondelete(id) {
|
||||
$("#news_id").val(id);
|
||||
swal({
|
||||
title : "是否确认删除?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
document.getElementById("ondelete").submit();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</sec:authorize>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
165
comm/Cms/WebContent/cms_update.jsp
Executable file
165
comm/Cms/WebContent/cms_update.jsp
Executable file
@@ -0,0 +1,165 @@
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%@ include file="include/pagetop.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="include/head.jsp"%>
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="include/loading.jsp"%>
|
||||
<%@ include file="include/top.jsp"%>
|
||||
<%@ include file="include/menu_left.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTENT -->
|
||||
<div class="content">
|
||||
|
||||
|
||||
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START CONTAINER -->
|
||||
<div class="container-default">
|
||||
<h3>用户端内容管理公告
|
||||
</h3>
|
||||
<%@ include file="include/alert.jsp"%>
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<!-- START queryForm -->
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_LIST")'>
|
||||
<form action="<%=basePath%>normal/adminCmsAction!list.action"
|
||||
method="post" id="queryForm">
|
||||
<input type="hidden" name="pageNo" id="pageNo"
|
||||
value="${param.pageNo}">
|
||||
</form>
|
||||
</s:if>
|
||||
<!-- END queryForm -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-title">
|
||||
修改公告
|
||||
<ul class="panel-tools">
|
||||
<li><a class="icon minimise-tool"><i
|
||||
class="fa fa-minus"></i></a></li>
|
||||
<li><a class="icon expand-tool"><i class="fa fa-expand"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_UPDATE")'>
|
||||
<form class="form-horizontal"
|
||||
action="<%=basePath%>normal/adminCmsAction!update.action"
|
||||
method="post" name="mainForm" id="mainForm">
|
||||
<s:hidden name="id" id="id"></s:hidden>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">标题</label>
|
||||
<div class="col-sm-10">
|
||||
<s:textfield id="title" name="title" cssClass="form-control "
|
||||
placeholder="标题" />
|
||||
</div>
|
||||
</div>
|
||||
<sec:authorize ifAnyGranted="ROLE_ROOT">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">业务代码</label>
|
||||
<div class="col-sm-10">
|
||||
<s:textfield id="content_code" name="content_code" cssClass="form-control "
|
||||
placeholder="业务代码(同种内容不同语言代码相同)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">模块</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="model" cssClass="form-control "
|
||||
name="model" list="modelMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label form-label">语言</label>
|
||||
<div class="col-sm-2">
|
||||
<s:select id="language" cssClass="form-control "
|
||||
name="language" list="languageMap"
|
||||
listKey="key" listValue="value" />
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-11">
|
||||
<div id="summernote"></div>
|
||||
</div>
|
||||
<s:hidden name="content" id="content"></s:hidden>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<a href="javascript:goUrl(<s:property value="pageNo" />)"
|
||||
class="btn">取消</a> <a href="javascript:submit()"
|
||||
class="btn btn-default">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</s:if>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
<%@ include file="include/footer.jsp"%>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
<!-- //////////////////////////////////////////////////////////////////////////// -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<%@ include file="include/js.jsp"%>
|
||||
<script src="<%=basePath%>js/util.js" type="text/javascript"></script>
|
||||
<script type="text/javascript"
|
||||
src="<%=basePath%>js/summernote/summernote.min.js"></script>
|
||||
|
||||
<script>
|
||||
/* SUMMERNOTE*/
|
||||
$(document).ready(function() {
|
||||
$('#summernote').summernote();
|
||||
var content=$("#content").val();
|
||||
$('#summernote').code(content)
|
||||
});
|
||||
</script>
|
||||
<s:if test='isResourceAccessible("ADMIN_CMS_UPDATE")'>
|
||||
<script type="text/javascript">
|
||||
function submit() {
|
||||
swal({
|
||||
title : "是否保存?",
|
||||
text : "",
|
||||
type : "warning",
|
||||
showCancelButton : true,
|
||||
confirmButtonColor : "#DD6B55",
|
||||
confirmButtonText : "确认",
|
||||
closeOnConfirm : false
|
||||
}, function() {
|
||||
var sHTML = $('#summernote').code();
|
||||
$("#content").val(sHTML);
|
||||
document.getElementById("mainForm").submit();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</s:if>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
27
comm/Cms/config/applicationContext-cms.xml
Executable file
27
comm/Cms/config/applicationContext-cms.xml
Executable file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
|
||||
<bean id="cmsService"
|
||||
class="project.cms.internal.CmsServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
<bean id="bannerService"
|
||||
class="project.cms.internal.BannerServiceImpl" init-method="init" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<!-- <property name="redisHandler" ref="redisHandler" /> -->
|
||||
</bean>
|
||||
|
||||
<dubbo:service
|
||||
interface="project.cms.BannerService"
|
||||
ref="bannerService" />
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
37
comm/Cms/config/applicationContext-cms_admin.xml
Executable file
37
comm/Cms/config/applicationContext-cms_admin.xml
Executable file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
<bean id="cmsService"
|
||||
class="project.cms.internal.CmsServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
<!-- <property name="pagedDao" ref="pagedDao" /> -->
|
||||
</bean>
|
||||
<bean id="adminCmsService"
|
||||
class="project.cms.internal.AdminCmsServiceImpl">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="pagedDao" ref="pagedDao" />
|
||||
<property name="cmsService" ref="cmsService" />
|
||||
</bean>
|
||||
|
||||
<!-- <bean id="bannerService"
|
||||
class="project.cms.internal.BannerServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean> -->
|
||||
<bean id="adminBannerService"
|
||||
class="project.cms.internal.AdminBannerServiceImpl">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="pagedDao" ref="pagedDao" />
|
||||
</bean>
|
||||
|
||||
<dubbo:reference id="bannerService"
|
||||
interface="project.cms.BannerService" check="false" />
|
||||
|
||||
</beans>
|
||||
23
comm/Cms/config/applicationContext-cms_data.xml
Executable file
23
comm/Cms/config/applicationContext-cms_data.xml
Executable file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
<!-- init-method="init" -->
|
||||
|
||||
<bean id="cmsService"
|
||||
class="project.cms.internal.CmsServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
<bean id="cmsLoadCacheService"
|
||||
class="data.loadcache.CmsLoadCacheService">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
11
comm/Cms/config/applicationContext-hibernate.xml
Executable file
11
comm/Cms/config/applicationContext-hibernate.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
|
||||
admin
|
||||
|
||||
<!-- cms -->
|
||||
<value>cmsService</value>
|
||||
<value>adminCmsService</value>
|
||||
<value>adminBannerService</value>
|
||||
api
|
||||
<!-- cms -->
|
||||
<value>cmsService</value>
|
||||
<value>bannerService</value>
|
||||
2
comm/Cms/config/cms.properties
Executable file
2
comm/Cms/config/cms.properties
Executable file
@@ -0,0 +1,2 @@
|
||||
system_cms_language=chinese
|
||||
system_cms_model_list=system,info,help_center,knowledge
|
||||
13
comm/Cms/config/normal.xml
Executable file
13
comm/Cms/config/normal.xml
Executable file
@@ -0,0 +1,13 @@
|
||||
|
||||
admin
|
||||
<action name="adminCmsAction"
|
||||
class="project.cms.web.AdminCmsAction">
|
||||
<result name="list">/cms_list.jsp</result>
|
||||
<result name="add">/cms_add.jsp</result>
|
||||
<result name="update">/cms_update.jsp</result>
|
||||
</action>
|
||||
|
||||
api
|
||||
|
||||
<action name="cms" class="project.cms.web.CmsAction">
|
||||
</action>
|
||||
26
comm/Cms/dbscript/1.0/DDL-MYSQL.SQL
Executable file
26
comm/Cms/dbscript/1.0/DDL-MYSQL.SQL
Executable file
@@ -0,0 +1,26 @@
|
||||
DROP TABLE IF EXISTS `T_CMS`;
|
||||
CREATE TABLE `T_CMS` (
|
||||
`UUID` varchar(32) NOT NULL,
|
||||
`TITLE` varchar(128) NOT NULL COMMENT '标题',
|
||||
`CONTENT` longtext COMMENT '内容',
|
||||
`CREATE_TIME` datetime DEFAULT NULL COMMENT '时间',
|
||||
`MODEL` varchar(32) DEFAULT NULL COMMENT '模块',
|
||||
PRIMARY KEY (`UUID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `T_BANNER`;
|
||||
CREATE TABLE `T_BANNER` (
|
||||
`UUID` varchar(32) NOT NULL,
|
||||
`LANGUAGE` varchar(32) DEFAULT NULL COMMENT '语言',
|
||||
`CONTENT_CODE` varchar(16) DEFAULT NULL,
|
||||
`IMAGE` longtext COMMENT '标题',
|
||||
`URL` varchar(256) DEFAULT NULL,
|
||||
`MODEL` varchar(32) DEFAULT NULL COMMENT '模块',
|
||||
`ON_SHOW` int(2) DEFAULT NULL COMMENT '时间',
|
||||
`SORT_INDEX` int(11) DEFAULT NULL,
|
||||
`CLICK` int(2) DEFAULT NULL,
|
||||
`CREATE_TIME` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`UUID`),
|
||||
KEY `INDEX_MODEL` (`MODEL`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
13
comm/Cms/dbscript/2.1/CMS-DDL-MYSQL.SQL
Executable file
13
comm/Cms/dbscript/2.1/CMS-DDL-MYSQL.SQL
Executable file
@@ -0,0 +1,13 @@
|
||||
DROP TABLE IF EXISTS `T_CMS`;
|
||||
CREATE TABLE `T_CMS` (
|
||||
`UUID` varchar(32) NOT NULL,
|
||||
`TITLE` varchar(128) NOT NULL COMMENT '标题',
|
||||
`CONTENT` longtext COMMENT '内容',
|
||||
`CREATE_TIME` datetime DEFAULT NULL COMMENT '时间',
|
||||
`MODEL` varchar(32) DEFAULT NULL COMMENT '模块',
|
||||
PRIMARY KEY (`UUID`),
|
||||
`LANGUAGE` varchar(32) DEFAULT NULL COMMENT '语言',
|
||||
KEY `INDEX_MODEL` (`MODEL`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE T_CMS ADD `CONTENT_CODE` varchar(16) ;
|
||||
71
comm/Cms/dbscript/2.1/CMS-DML-MYSQL.SQL
Executable file
71
comm/Cms/dbscript/2.1/CMS-DML-MYSQL.SQL
Executable file
File diff suppressed because one or more lines are too long
19
comm/Cms/spring/applicationContext-cms.xml
Executable file
19
comm/Cms/spring/applicationContext-cms.xml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
|
||||
<bean id="cmsService"
|
||||
class="project.cms.internal.CmsServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
23
comm/Cms/spring/applicationContext-cms_admin.xml
Executable file
23
comm/Cms/spring/applicationContext-cms_admin.xml
Executable file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
|
||||
<bean id="adminCmsService"
|
||||
class="project.cms.internal.AdminCmsServiceImpl">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="pagedDao" ref="pagedDao" />
|
||||
<property name="cmsService" ref="cmsService" />
|
||||
</bean>
|
||||
|
||||
<bean id="cmsService" class="project.cms.internal.CmsServiceImpl">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
23
comm/Cms/spring/applicationContext-cms_data.xml
Executable file
23
comm/Cms/spring/applicationContext-cms_data.xml
Executable file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
<!-- init-method="init" -->
|
||||
|
||||
<bean id="cmsService"
|
||||
class="project.cms.internal.CmsServiceImpl" >
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
<bean id="cmsLoadCacheService"
|
||||
class="project.data.loadcache.CmsLoadCacheService">
|
||||
<property name="hibernateTemplate" ref="hibernateTemplate" />
|
||||
<property name="redisHandler" ref="redisHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
10
comm/Cms/spring/applicationContext-hibernate.xml
Executable file
10
comm/Cms/spring/applicationContext-hibernate.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
|
||||
admin
|
||||
|
||||
<!-- cms -->
|
||||
<value>cmsService</value>
|
||||
<value>adminCmsService</value>
|
||||
|
||||
api
|
||||
<!-- cms -->
|
||||
<value>cmsService</value>
|
||||
11
comm/Cms/src/project/cms/AdminBannerService.java
Executable file
11
comm/Cms/src/project/cms/AdminBannerService.java
Executable file
@@ -0,0 +1,11 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import kernel.web.Page;
|
||||
|
||||
public interface AdminBannerService {
|
||||
|
||||
public Page pagedQuery(int pageNo, int pageSize,String language);
|
||||
|
||||
}
|
||||
21
comm/Cms/src/project/cms/AdminCmsService.java
Executable file
21
comm/Cms/src/project/cms/AdminCmsService.java
Executable file
@@ -0,0 +1,21 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import kernel.web.Page;
|
||||
|
||||
public interface AdminCmsService {
|
||||
|
||||
|
||||
public void saveOrUpdate(Cms entity);
|
||||
|
||||
|
||||
public Cms findById(String id);
|
||||
|
||||
public void delete(Cms cms);
|
||||
|
||||
public Map<String, String> getModelDatasDictionary();
|
||||
|
||||
|
||||
Page pagedQuery(int pageNo, int pageSize, String language, String title, String startTime, String endTime, Integer type, Integer status);
|
||||
}
|
||||
39
comm/Cms/src/project/cms/Banner.hbm.xml
Executable file
39
comm/Cms/src/project/cms/Banner.hbm.xml
Executable file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping>
|
||||
<class name="project.cms.Banner" table="T_BANNER">
|
||||
<id name="id" type="java.lang.String">
|
||||
<column name="UUID" />
|
||||
<generator class="uuid.hex" />
|
||||
</id>
|
||||
<property name="language" type="java.lang.String">
|
||||
<column name="LANGUAGE" />
|
||||
</property>
|
||||
<property name="content_code" type="java.lang.String">
|
||||
<column name="CONTENT_CODE" />
|
||||
</property>
|
||||
<property name="image" type="java.lang.String">
|
||||
<column name="IMAGE" />
|
||||
</property>
|
||||
<property name="url" type="java.lang.String">
|
||||
<column name="URL" />
|
||||
</property>
|
||||
<property name="model" type="java.lang.String">
|
||||
<column name="MODEL" />
|
||||
</property>
|
||||
<property name="on_show" type="int">
|
||||
<column name="ON_SHOW" />
|
||||
</property>
|
||||
<property name="sort_index" type="int">
|
||||
<column name="SORT_INDEX" />
|
||||
</property>
|
||||
<property name="click" type="int">
|
||||
<column name="CLICK" />
|
||||
</property>
|
||||
<property name="createTime" type="timestamp">
|
||||
<column name="CREATE_TIME" />
|
||||
</property>
|
||||
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
128
comm/Cms/src/project/cms/Banner.java
Executable file
128
comm/Cms/src/project/cms/Banner.java
Executable file
@@ -0,0 +1,128 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import kernel.bo.EntityObject;
|
||||
|
||||
public class Banner extends EntityObject implements Comparable<Banner> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8252272898082376329L;
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 业务代码, 同种内容 不同语言下的code相同
|
||||
*/
|
||||
private String content_code;
|
||||
/**
|
||||
* 展示图片
|
||||
*/
|
||||
private String image;
|
||||
/**
|
||||
* 访问路径
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 是否展示
|
||||
*/
|
||||
private int on_show;
|
||||
/**
|
||||
* 排列顺序(数字相同按时间排,越小排越前)
|
||||
*/
|
||||
private int sort_index;
|
||||
/**
|
||||
* 类型,top:顶部展示,other:其他地方展示,poster:弹窗海报
|
||||
*/
|
||||
private String model;
|
||||
/**
|
||||
* 是否可以点击跳转
|
||||
*/
|
||||
private int click;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getContent_code() {
|
||||
return content_code;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setContent_code(String content_code) {
|
||||
this.content_code = content_code;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public int getClick() {
|
||||
return click;
|
||||
}
|
||||
|
||||
public void setClick(int click) {
|
||||
this.click = click;
|
||||
}
|
||||
|
||||
public int getSort_index() {
|
||||
return sort_index;
|
||||
}
|
||||
|
||||
public void setSort_index(int sort_index) {
|
||||
this.sort_index = sort_index;
|
||||
}
|
||||
|
||||
public int getOn_show() {
|
||||
return on_show;
|
||||
}
|
||||
|
||||
public void setOn_show(int on_show) {
|
||||
this.on_show = on_show;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Banner paramT) {
|
||||
// TODO Auto-generated method stub
|
||||
return this.sort_index - paramT.getSort_index();
|
||||
}
|
||||
|
||||
}
|
||||
37
comm/Cms/src/project/cms/BannerService.java
Executable file
37
comm/Cms/src/project/cms/BannerService.java
Executable file
@@ -0,0 +1,37 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface BannerService {
|
||||
|
||||
public void save(Banner entity);
|
||||
|
||||
public void update(Banner entity);
|
||||
|
||||
public void delete(String id);
|
||||
|
||||
// public Banner findById(String id);
|
||||
public Banner cacheById(String id);
|
||||
|
||||
/**
|
||||
* 获取cms根据相关模块和国际化语言
|
||||
*
|
||||
* @param model
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public List<Banner> cacheListByModelAndLanguage(String model, String language);
|
||||
|
||||
/**
|
||||
* 获取cms根据相关业务code和国际化语言
|
||||
*
|
||||
* @param contentCode
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public Banner cacheByCodeAndLanguage(String contentCode, String language);
|
||||
|
||||
public Map<String,Object> bindOne(Banner entity);
|
||||
|
||||
}
|
||||
30
comm/Cms/src/project/cms/Cms.hbm.xml
Executable file
30
comm/Cms/src/project/cms/Cms.hbm.xml
Executable file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping>
|
||||
<class name="project.cms.Cms" table="T_CMS">
|
||||
<id name="id" type="java.lang.String">
|
||||
<column name="UUID" />
|
||||
<generator class="uuid.hex" />
|
||||
</id>
|
||||
<property name="title" type="java.lang.String">
|
||||
<column name="TITLE" />
|
||||
</property>
|
||||
<property name="content" type="java.lang.String">
|
||||
<column name="CONTENT" />
|
||||
</property>
|
||||
<property name="createTime" type="timestamp">
|
||||
<column name="CREATE_TIME" />
|
||||
</property>
|
||||
<property name="language" type="java.lang.String">
|
||||
<column name="LANGUAGE" />
|
||||
</property>
|
||||
<property name="type" type="java.lang.Integer">
|
||||
<column name="TYPE" />
|
||||
</property>
|
||||
<property name="status" type="java.lang.Integer">
|
||||
<column name="STATUS" />
|
||||
</property>
|
||||
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
81
comm/Cms/src/project/cms/Cms.java
Executable file
81
comm/Cms/src/project/cms/Cms.java
Executable file
@@ -0,0 +1,81 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import kernel.bo.EntityObject;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Cms extends EntityObject {
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 模块所属类型 '类型 0-公告管理,1-文章管理'
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* '0-启用,1-禁用'
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
22
comm/Cms/src/project/cms/CmsRedisKeys.java
Executable file
22
comm/Cms/src/project/cms/CmsRedisKeys.java
Executable file
@@ -0,0 +1,22 @@
|
||||
package project.cms;
|
||||
|
||||
public class CmsRedisKeys {
|
||||
/**
|
||||
* CMS,查询语言的map
|
||||
*/
|
||||
public final static String CMS_LANGUAGE = "CMS_LANGUAGE_";
|
||||
/**
|
||||
* CMS,language+contentCode 做key
|
||||
*/
|
||||
public final static String CMS_ID = "CMS_ID";
|
||||
|
||||
/**
|
||||
* Banner,查询语言的map
|
||||
*/
|
||||
public final static String Banner_LANGUAGE = "BANNER_LANGUAGE_";
|
||||
/**
|
||||
* Banner,language+contentCode 做key
|
||||
*/
|
||||
public final static String Banner_LANGUAGE_CONTENTCODE = "BANNER_LANGUAGE_CONTENTCODE_";
|
||||
|
||||
}
|
||||
34
comm/Cms/src/project/cms/CmsService.java
Executable file
34
comm/Cms/src/project/cms/CmsService.java
Executable file
@@ -0,0 +1,34 @@
|
||||
package project.cms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CmsService {
|
||||
|
||||
public void saveOrUpdate(Cms entity);
|
||||
|
||||
public void delete(Cms cms);
|
||||
|
||||
/**
|
||||
* 获取cms根据相关模块和国际化语言
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public List<Cms> cacheListByModelAndLanguage(String language);
|
||||
|
||||
/**
|
||||
* 根据国际化语言获取cms
|
||||
* @param lang
|
||||
* @return
|
||||
*/
|
||||
public List<Cms> findCmsListByLang(String lang);
|
||||
|
||||
/**
|
||||
* 获取cms根据相关业务code和国际化语言
|
||||
*
|
||||
* @param contentCode
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public Cms cacheByCodeAndLanguage(String contentCode, String language);
|
||||
|
||||
}
|
||||
138
comm/Cms/src/project/cms/PropertiesUtilCms.java
Executable file
138
comm/Cms/src/project/cms/PropertiesUtilCms.java
Executable file
@@ -0,0 +1,138 @@
|
||||
package project.cms;
|
||||
|
||||
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Properties;
|
||||
|
||||
import kernel.util.JsonUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import project.mall.seller.dto.MallLevelCondExpr;
|
||||
|
||||
/**
|
||||
* 读取Properties综合类,默认绑定到classpath下的config.properties文件。
|
||||
*/
|
||||
public class PropertiesUtilCms {
|
||||
private static Log log = LogFactory.getLog(PropertiesUtilCms.class);
|
||||
private static String CONFIG_FILENAME = "config/cms.properties";
|
||||
private static Properties prop = null;
|
||||
|
||||
public PropertiesUtilCms() {
|
||||
if (prop == null) {
|
||||
loadProperties();
|
||||
}
|
||||
};
|
||||
|
||||
private synchronized static void loadProperties() {
|
||||
byte buff[]=null;
|
||||
try {
|
||||
//Open the props file
|
||||
InputStream is=PropertiesUtilCms.class.getResourceAsStream("/" + CONFIG_FILENAME);
|
||||
prop = new Properties();
|
||||
//Read in the stored properties
|
||||
prop.load(is);
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("读取配置文件失败!!!");
|
||||
prop = null;
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到属性值
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getProperty(String key) {
|
||||
if (prop == null) {
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
String value = prop.getProperty(key);
|
||||
if(value ==null){
|
||||
return null;
|
||||
}
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到内容包含汉字的属性值
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getGBKProperty(String key) {
|
||||
String value = getProperty(key);
|
||||
try {
|
||||
value = new String(value.getBytes("ISO8859-1"),"GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
}
|
||||
|
||||
if(value ==null){
|
||||
return null;
|
||||
}
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到属性值,
|
||||
* @param key
|
||||
* @param defaultValue
|
||||
* @return
|
||||
*/
|
||||
public static String getProperty(String key, String defaultValue) {
|
||||
if (prop == null) {
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
String value = prop.getProperty(key, defaultValue);
|
||||
if(value ==null){
|
||||
return null;
|
||||
}
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到内容包含汉字的属性值,如果不存在则使用默认值
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getGBKProperty(String key, String defaultValue) {
|
||||
try {
|
||||
defaultValue = new String(defaultValue.getBytes("GBK"), "ISO8859-1");
|
||||
String value = getProperty(key, defaultValue);
|
||||
value = new String(value.getBytes("ISO8859-1"), "GBK");
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return value.trim();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUTFProperty(String key, String defaultValue) {
|
||||
try {
|
||||
defaultValue = new String(defaultValue.getBytes("UTF-8"),
|
||||
"ISO8859-1");
|
||||
String value = getProperty(key, defaultValue);
|
||||
value = new String(value.getBytes("ISO8859-1"), "UTF-8");
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return value.trim();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String json = "{\"params\":[{\"code\":\"rechargeAmount\",\"title\":\"运行资金\",\"value\":5000},{\"code\":\"popularizeUserCount\",\"title\":\"分店数\",\"value\":3}],\"expression\":\"popularizeUserCount >= 3 || rechargeAmount >= 5000\"}";
|
||||
MallLevelCondExpr mallLevelCondExpr = JsonUtils.json2Object(json, MallLevelCondExpr.class);
|
||||
}
|
||||
}
|
||||
47
comm/Cms/src/project/cms/data/loadcache/CmsLoadCacheService.java
Executable file
47
comm/Cms/src/project/cms/data/loadcache/CmsLoadCacheService.java
Executable file
@@ -0,0 +1,47 @@
|
||||
package project.cms.data.loadcache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||
|
||||
import project.cms.Cms;
|
||||
import project.cms.CmsRedisKeys;
|
||||
import project.redis.RedisHandler;
|
||||
|
||||
public class CmsLoadCacheService extends HibernateDaoSupport {
|
||||
private static final Log logger = LogFactory.getLog(CmsLoadCacheService.class);
|
||||
|
||||
private RedisHandler redisHandler;
|
||||
|
||||
public void loadcache() {
|
||||
load();
|
||||
logger.info("完成Cms数据加载redis");
|
||||
}
|
||||
|
||||
public void load() {
|
||||
StringBuffer queryString = new StringBuffer(" FROM Cms WHERE STATUS = 0");
|
||||
List<Cms> list = (List<Cms>)this.getHibernateTemplate().find(queryString.toString());
|
||||
for (Cms cms : list) {
|
||||
redisHandler.setSync(CmsRedisKeys.CMS_ID + cms.getId(), cms);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
Map<String, List<Cms>> collect = list.stream().collect(Collectors.groupingBy(Cms::getLanguage));
|
||||
for (Map.Entry<String, List<Cms>> entry : collect.entrySet()) {
|
||||
redisHandler.setSync(CmsRedisKeys.CMS_LANGUAGE + entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRedisHandler(RedisHandler redisHandler) {
|
||||
this.redisHandler = redisHandler;
|
||||
}
|
||||
|
||||
}
|
||||
40
comm/Cms/src/project/cms/internal/AdminBannerServiceImpl.java
Executable file
40
comm/Cms/src/project/cms/internal/AdminBannerServiceImpl.java
Executable file
@@ -0,0 +1,40 @@
|
||||
package project.cms.internal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||
|
||||
import kernel.web.Page;
|
||||
import kernel.web.PagedQueryDao;
|
||||
import project.cms.AdminBannerService;
|
||||
|
||||
public class AdminBannerServiceImpl extends HibernateDaoSupport implements AdminBannerService {
|
||||
|
||||
private PagedQueryDao pagedDao;
|
||||
|
||||
public Page pagedQuery(int pageNo, int pageSize, String language) {
|
||||
StringBuffer queryString = new StringBuffer("");
|
||||
queryString.append(" FROM Banner WHERE 1=1 ");
|
||||
Map parameters = new HashMap();
|
||||
|
||||
if (StringUtils.isNotEmpty(language)) {
|
||||
queryString.append("AND language=:language ");
|
||||
parameters.put("language", language);
|
||||
}
|
||||
// if (StringUtils.isNotEmpty(title)) {
|
||||
// queryString.append("AND title like:title ");
|
||||
// parameters.put("title", "%" + title + "%");
|
||||
// }
|
||||
queryString.append(" order by sort_index ASC, createTime desc ");
|
||||
Page page = this.pagedDao.pagedQueryHql(pageNo, pageSize, queryString.toString(), parameters);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public void setPagedDao(PagedQueryDao pagedDao) {
|
||||
this.pagedDao = pagedDao;
|
||||
}
|
||||
|
||||
}
|
||||
99
comm/Cms/src/project/cms/internal/AdminCmsServiceImpl.java
Executable file
99
comm/Cms/src/project/cms/internal/AdminCmsServiceImpl.java
Executable file
@@ -0,0 +1,99 @@
|
||||
package project.cms.internal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import kernel.util.DateUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||
|
||||
import kernel.web.Page;
|
||||
import kernel.web.PagedQueryDao;
|
||||
import project.cms.*;
|
||||
import project.redis.RedisHandler;
|
||||
|
||||
public class AdminCmsServiceImpl extends HibernateDaoSupport implements AdminCmsService {
|
||||
|
||||
private CmsService cmsService;
|
||||
private PagedQueryDao pagedDao;
|
||||
|
||||
private RedisHandler redisHandler;
|
||||
|
||||
@Override
|
||||
public Page pagedQuery(int pageNo, int pageSize, String language, String title, String startTime, String endTime, Integer type, Integer status) {
|
||||
StringBuffer queryString = new StringBuffer(" SELECT ");
|
||||
queryString.append(" UUID id, TITLE title, CONTENT content, CREATE_TIME createTime, LANGUAGE language, TYPE type, STATUS status FROM T_CMS WHERE 1=1 ");
|
||||
Map<String, Object> parameters = new HashMap();
|
||||
if (StringUtils.isNotEmpty(language)) {
|
||||
queryString.append("AND LANGUAGE=:language ");
|
||||
parameters.put("language", language);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(title)) {
|
||||
queryString.append("AND TITLE like:title ");
|
||||
parameters.put("title", "%" + title + "%");
|
||||
}
|
||||
if (-2 != status) {
|
||||
queryString.append(" and STATUS =:status");
|
||||
parameters.put("status", status);
|
||||
}
|
||||
if (-2 != type) {
|
||||
queryString.append(" and TYPE =:type");
|
||||
parameters.put("type", type);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(startTime)) {
|
||||
queryString.append(" AND DATE(CREATE_TIME) >= DATE(:startTime) ");
|
||||
parameters.put("startTime", DateUtils.toDate(startTime));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(endTime)) {
|
||||
queryString.append(" AND DATE(CREATE_TIME) <= DATE(:endTime) ");
|
||||
parameters.put("endTime", DateUtils.toDate(endTime));
|
||||
}
|
||||
queryString.append(" order by CREATE_TIME desc ");
|
||||
Page page = this.pagedDao.pagedQuerySQL(pageNo, pageSize, queryString.toString(), parameters);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public void saveOrUpdate(Cms entity) {
|
||||
cmsService.saveOrUpdate(entity);
|
||||
redisHandler.setSync(CmsRedisKeys.CMS_ID + entity.getId(),entity);
|
||||
}
|
||||
|
||||
public Cms findById(String id) {
|
||||
Cms cms = (Cms) redisHandler.get(CmsRedisKeys.CMS_ID + id);
|
||||
if (Objects.isNull(cms)){
|
||||
cms = getHibernateTemplate().get(Cms.class, id);
|
||||
redisHandler.setSync(CmsRedisKeys.CMS_ID + id, cms);
|
||||
}
|
||||
return cms;
|
||||
}
|
||||
|
||||
public Map<String, String> getModelDatasDictionary() {
|
||||
String datas = PropertiesUtilCms.getProperty("system_cms_model_list");
|
||||
String[] splits = datas.split(",");
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
for (String data : splits) {
|
||||
map.put(data, data);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void delete(Cms cms) {
|
||||
cmsService.delete(cms);
|
||||
}
|
||||
|
||||
public void setCmsService(CmsService cmsService) {
|
||||
this.cmsService = cmsService;
|
||||
}
|
||||
|
||||
public void setPagedDao(PagedQueryDao pagedDao) {
|
||||
this.pagedDao = pagedDao;
|
||||
}
|
||||
|
||||
public void setRedisHandler(RedisHandler redisHandler) {
|
||||
this.redisHandler = redisHandler;
|
||||
}
|
||||
|
||||
}
|
||||
96
comm/Cms/src/project/cms/internal/BannerServiceImpl.java
Executable file
96
comm/Cms/src/project/cms/internal/BannerServiceImpl.java
Executable file
@@ -0,0 +1,96 @@
|
||||
package project.cms.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.hibernate.criterion.DetachedCriteria;
|
||||
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||
|
||||
import kernel.util.DateUtils;
|
||||
import project.cms.Banner;
|
||||
import project.cms.BannerService;
|
||||
|
||||
public class BannerServiceImpl extends HibernateDaoSupport implements BannerService {
|
||||
|
||||
/**
|
||||
* base64过大,不适合做redis
|
||||
*/
|
||||
private Map<String, Banner> cache = new ConcurrentHashMap<String, Banner>();
|
||||
|
||||
public void init() {
|
||||
DetachedCriteria query = DetachedCriteria.forClass(Banner.class);
|
||||
List<Banner> list = (List<Banner>) getHibernateTemplate().findByCriteria(query);
|
||||
for (Banner banner : list) {
|
||||
cache.put(banner.getId().toString(), banner);
|
||||
}
|
||||
}
|
||||
|
||||
public void save(Banner entity) {
|
||||
|
||||
this.getHibernateTemplate().save(entity);
|
||||
cache.put(entity.getId().toString(), entity);
|
||||
}
|
||||
|
||||
public void update(Banner entity) {
|
||||
getHibernateTemplate().update(entity);
|
||||
cache.put(entity.getId().toString(), entity);
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
Banner entity = cacheById(id);
|
||||
getHibernateTemplate().delete(entity);
|
||||
cache.remove(id);
|
||||
}
|
||||
|
||||
public Banner cacheById(String id) {
|
||||
return cache.get(id);
|
||||
// return (Banner) getHibernateTemplate().get(Banner.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Banner> cacheListByModelAndLanguage(String model, String language) {
|
||||
// TODO Auto-generated method stub
|
||||
List<Banner> list = new ArrayList<Banner>();
|
||||
for (Banner banner : cache.values()) {
|
||||
if (banner.getOn_show() == 1 && model.equals(banner.getModel()) && language.equals(banner.getLanguage())) {
|
||||
list.add(banner);
|
||||
}
|
||||
}
|
||||
Collections.sort(list);
|
||||
// List<Banner> list = this.getHibernateTemplate().find(" FROM Banner WHERE on_show=1 AND model=? AND language=? ORDER BY sort_index ASC",new Object[] {model,language});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Banner cacheByCodeAndLanguage(String contentCode, String language) {
|
||||
// TODO Auto-generated method stub
|
||||
for (Banner banner : cache.values()) {
|
||||
if (banner.getOn_show() == 1 && contentCode.equals(banner.getContent_code())
|
||||
&& language.equals(banner.getLanguage())) {
|
||||
return banner;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
// List<Banner> list = this.getHibernateTemplate().find(" FROM Banner WHERE on_show=1 AND content_code=? AND language=?",new Object[] {contentCode,language});
|
||||
// return CollectionUtils.isEmpty(list)?null:list.get(0);
|
||||
}
|
||||
|
||||
public Map<String, Object> bindOne(Banner entity) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("content_code", entity.getContent_code());
|
||||
result.put("image", entity.getImage());
|
||||
result.put("index", entity.getSort_index());
|
||||
result.put("language", entity.getLanguage());
|
||||
result.put("model", entity.getModel());
|
||||
result.put("url", entity.getUrl());
|
||||
result.put("click", entity.getClick());
|
||||
result.put("create_time", DateUtils.format(entity.getCreateTime(), DateUtils.DF_yyyyMMddHHmm));
|
||||
result.put("id", entity.getId());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
107
comm/Cms/src/project/cms/internal/CmsServiceImpl.java
Executable file
107
comm/Cms/src/project/cms/internal/CmsServiceImpl.java
Executable file
@@ -0,0 +1,107 @@
|
||||
package project.cms.internal;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import kernel.exception.BusinessException;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||
import project.cms.Cms;
|
||||
import project.cms.CmsRedisKeys;
|
||||
import project.cms.CmsService;
|
||||
import project.redis.RedisHandler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class CmsServiceImpl extends HibernateDaoSupport implements CmsService {
|
||||
private RedisHandler redisHandler;
|
||||
|
||||
public void saveOrUpdate(Cms entity) {
|
||||
getHibernateTemplate().saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setCmsLanguageList(String Language){
|
||||
List<Cms> cmsList = findCmsList(Language);
|
||||
if (CollectionUtils.isNotEmpty(cmsList)){
|
||||
redisHandler.setSync(CmsRedisKeys.CMS_LANGUAGE+Language,cmsList);
|
||||
} else {
|
||||
redisHandler.remove(CmsRedisKeys.CMS_LANGUAGE+Language);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Cms> findCmsList(String lang) {
|
||||
Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(Cms.class);
|
||||
if(!kernel.util.StringUtils.isEmptyString(lang)){
|
||||
criteria.add( Restrictions.eq("language", lang) );
|
||||
}
|
||||
criteria.add( Restrictions.eq("status", 0 ) );
|
||||
if(CollectionUtils.isNotEmpty(criteria.list())){
|
||||
return criteria.list();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Cms> findCmsListByLang(String lang) {
|
||||
Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(Cms.class);
|
||||
if(!kernel.util.StringUtils.isEmptyString(lang)){
|
||||
criteria.add( Restrictions.eq("language", lang) );
|
||||
}
|
||||
criteria.add( Restrictions.eq("status", 0 ) );
|
||||
criteria.addOrder(Order.desc("createTime"));
|
||||
if(CollectionUtils.isNotEmpty(criteria.list())){
|
||||
return criteria.list();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Cms cacheByCodeAndLanguage(String contentCode, String language) {
|
||||
Cms cms = (Cms) redisHandler.get(CmsRedisKeys.CMS_ID + language);
|
||||
return cms;
|
||||
}
|
||||
|
||||
public List<Cms> cacheListByModelAndLanguage(String language) {
|
||||
language = StringUtils.isEmpty(language) ? "en" : language;
|
||||
|
||||
JSONArray jsonArray = (JSONArray) redisHandler.get(CmsRedisKeys.CMS_LANGUAGE + language);
|
||||
if (null == jsonArray) {
|
||||
throw new BusinessException("无该语种的配置");
|
||||
}
|
||||
List<Cms> cacheLanguage = jsonArray.toJavaList(Cms.class);
|
||||
// 按时间降序
|
||||
Collections.sort(cacheLanguage, new Comparator<Cms>() {
|
||||
@Override
|
||||
public int compare(Cms paramT1, Cms paramT2) {
|
||||
// TODO Auto-generated method stub
|
||||
return -paramT1.getCreateTime().compareTo(paramT2.getCreateTime());
|
||||
}
|
||||
|
||||
});
|
||||
return cacheLanguage;
|
||||
}
|
||||
|
||||
public void delete(Cms entity) {
|
||||
this.getHibernateTemplate().delete(entity);
|
||||
// if (entity != null) {
|
||||
|
||||
// redisHandler.remove(CmsRedisKeys.CMS_ID+entity.getId());
|
||||
// List<Cms> cmsList = findCmsList(entity.getLanguage());
|
||||
// if (CollectionUtils.isNotEmpty(cmsList)){
|
||||
// redisHandler.setSync(CmsRedisKeys.CMS_LANGUAGE+entity.getLanguage(),cmsList);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public void setRedisHandler(RedisHandler redisHandler) {
|
||||
this.redisHandler = redisHandler;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
470
comm/Cms/src/project/cms/web/AdminBannerAction.java
Executable file
470
comm/Cms/src/project/cms/web/AdminBannerAction.java
Executable file
@@ -0,0 +1,470 @@
|
||||
package project.cms.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.security.providers.encoding.PasswordEncoder;
|
||||
|
||||
import kernel.exception.BusinessException;
|
||||
import kernel.util.ImageUtils;
|
||||
import kernel.util.StringUtils;
|
||||
import kernel.web.PageActionSupport;
|
||||
import project.Constants;
|
||||
import project.cms.AdminBannerService;
|
||||
import project.cms.Banner;
|
||||
import project.cms.BannerService;
|
||||
import project.cms.PropertiesUtilCms;
|
||||
import project.log.LogService;
|
||||
import security.Role;
|
||||
import security.SecUser;
|
||||
import security.internal.SecUserService;
|
||||
|
||||
public class AdminBannerAction extends PageActionSupport {
|
||||
private static final Log logger = LogFactory.getLog(AdminBannerAction.class);
|
||||
private static final long serialVersionUID = 5666899648868642390L;
|
||||
private AdminBannerService adminBannerService;
|
||||
private BannerService bannerService;
|
||||
private SecUserService secUserService;
|
||||
private LogService logService;
|
||||
private PasswordEncoder passwordEncoder;
|
||||
private String id;
|
||||
/**
|
||||
* 类型,top:顶部展示,other:其他地方展示
|
||||
*/
|
||||
private String model;
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 业务代码
|
||||
*/
|
||||
private String content_code;
|
||||
/**
|
||||
* 展示图片
|
||||
*/
|
||||
private String img;
|
||||
/**
|
||||
* 访问路径
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 是否展示
|
||||
*/
|
||||
private int on_show;
|
||||
/**
|
||||
* 排列顺序(数字相同按时间排,越小排越前)
|
||||
*/
|
||||
private int sort_index;
|
||||
|
||||
/**
|
||||
* 是否可以点击跳转
|
||||
*/
|
||||
private int click;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String para_language;
|
||||
|
||||
private String para_title;
|
||||
|
||||
private File fileName;
|
||||
|
||||
private Map<String, String> modelMap = Constants.BANNER_MODEL;
|
||||
private Map<String, String> languageMap = Constants.LANGUAGE;
|
||||
private String login_safeword;
|
||||
|
||||
public String list() {
|
||||
this.pageSize = 30;
|
||||
this.page = this.adminBannerService.pagedQuery(this.pageNo, this.pageSize, this.para_language);
|
||||
for (Banner banner : (List<Banner>) this.page.getElements()) {
|
||||
banner.setLanguage(Constants.LANGUAGE.get(banner.getLanguage()));
|
||||
banner.setModel(Constants.BANNER_MODEL.get(banner.getModel()));
|
||||
}
|
||||
return "list";
|
||||
|
||||
}
|
||||
|
||||
public String toAdd() {
|
||||
// this.modelMap = this.adminBannerService.getModelDatasDictionary();
|
||||
// this.modelMap = Constants.CMS_MODEL;
|
||||
// this.languageMap = Constants.LANGUAGE;
|
||||
if (!checkIsRoot()) {
|
||||
this.error = "root 权限下才可添加";
|
||||
return list();
|
||||
}
|
||||
// if (!StringUtils.isNullOrEmpty(this.id)) {
|
||||
// Banner entity = this.adminBannerService.findById(this.id);
|
||||
// if (null == entity) {
|
||||
// this.error = "内容不存在或已删除";
|
||||
// return "add";
|
||||
// }
|
||||
// this.title = entity.getTitle();
|
||||
// this.content = entity.getContent();
|
||||
// this.model = entity.getModel();
|
||||
// this.language = entity.getLanguage();
|
||||
// this.content_code = entity.getContent_code();
|
||||
// } else {
|
||||
language = PropertiesUtilCms.getProperty("system_cms_language");
|
||||
// }
|
||||
return "add";
|
||||
}
|
||||
|
||||
public String add() {
|
||||
try {
|
||||
this.error = verif();
|
||||
if (!StringUtils.isNullOrEmpty(this.error)) {
|
||||
return "add";
|
||||
}
|
||||
if (!checkIsRoot()) {
|
||||
throw new BusinessException("root 权限下才可添加");
|
||||
}
|
||||
SecUser sec = this.secUserService.findUserByLoginName(this.getUsername_login());
|
||||
checkLoginSafeword(sec, this.getUsername_login(), this.login_safeword);
|
||||
Banner entity = new Banner();
|
||||
// if (!StringUtils.isNullOrEmpty(this.id)) {
|
||||
// entity = this.adminBannerService.findById(this.id);
|
||||
//
|
||||
// } else {
|
||||
// entity.setCreateTime(new Date());
|
||||
// }
|
||||
if (StringUtils.isEmptyString(this.model))
|
||||
throw new BusinessException("请选择模块");
|
||||
if (StringUtils.isEmptyString(this.language))
|
||||
throw new BusinessException("请选择语言");
|
||||
if (StringUtils.isEmptyString(this.content_code))
|
||||
throw new BusinessException("请填写业务码");
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setModel(this.model);
|
||||
entity.setLanguage(this.language);
|
||||
entity.setContent_code(this.content_code);
|
||||
entity.setUrl(url);
|
||||
entity.setClick(click);
|
||||
entity.setOn_show(on_show);
|
||||
entity.setSort_index(sort_index);
|
||||
entity.setImage(ImageUtils.reduceImg(fileName, 1f));
|
||||
// ImageUtils.
|
||||
this.bannerService.save(entity);
|
||||
String log = MessageFormat.format(
|
||||
"ip:" + this.getIp() + ",管理员新增banner,id:{0},路径:{1},语言:{2},模块:{3},业务代码:{4},索引:{5},可否点击:{6},是否展示:{7}", entity.getId(),
|
||||
entity.getUrl(), entity.getLanguage(), entity.getModel(), entity.getContent_code(),
|
||||
entity.getSort_index(),entity.getClick(),entity.getOn_show());
|
||||
saveLog(sec, this.username_login, log);
|
||||
this.message = "操作成功";
|
||||
} catch (BusinessException e) {
|
||||
this.error = e.getMessage();
|
||||
return toAdd();
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
this.error = ("[ERROR] 服务器错误");
|
||||
return toAdd();
|
||||
}
|
||||
return list();
|
||||
}
|
||||
|
||||
public String toUpdate() {
|
||||
if (!StringUtils.isNullOrEmpty(this.id)) {
|
||||
Banner entity = this.bannerService.cacheById(this.id);
|
||||
if (null == entity) {
|
||||
this.error = "内容不存在或已删除";
|
||||
return list();
|
||||
}
|
||||
// this.title = entity.getTitle();
|
||||
// this.content = entity.getContent();
|
||||
this.img = entity.getImage();
|
||||
this.on_show = entity.getOn_show();
|
||||
this.click = entity.getClick();
|
||||
this.sort_index = entity.getSort_index();
|
||||
if (this.checkIsRoot()) {
|
||||
this.model = entity.getModel();
|
||||
this.language = entity.getLanguage();
|
||||
this.content_code = entity.getContent_code();
|
||||
this.url = entity.getUrl();
|
||||
}
|
||||
} else {
|
||||
this.error = "内容不存在或已删除";
|
||||
return list();
|
||||
}
|
||||
return "update";
|
||||
}
|
||||
|
||||
public String update() {
|
||||
try {
|
||||
this.error = verif();
|
||||
if (!StringUtils.isNullOrEmpty(this.error)) {
|
||||
return "update";
|
||||
}
|
||||
SecUser sec = this.secUserService.findUserByLoginName(this.getUsername_login());
|
||||
checkLoginSafeword(sec, this.getUsername_login(), this.login_safeword);
|
||||
|
||||
Banner entity = new Banner();
|
||||
if (!StringUtils.isNullOrEmpty(this.id)) {
|
||||
entity = this.bannerService.cacheById(this.id);
|
||||
if (null == entity)
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
} else {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
String log = MessageFormat.format(
|
||||
"ip:" + this.getIp() + ",管理员修改banner,id:{0},原路径:{1},原语言:{2},原模块:{3},原业务代码:{4},原索引:{5},原可否点击:{6},原是否展示:{7}",
|
||||
entity.getId(), entity.getUrl(), entity.getLanguage(), entity.getModel(), entity.getContent_code(),
|
||||
entity.getSort_index(),entity.getClick(),entity.getOn_show());
|
||||
// entity.setTitle(this.title);
|
||||
// entity.setContent(this.content);
|
||||
entity.setClick(click);
|
||||
entity.setOn_show(on_show);
|
||||
entity.setSort_index(sort_index);
|
||||
if(fileName!=null) {
|
||||
entity.setImage(ImageUtils.reduceImg(fileName, 1f));
|
||||
}
|
||||
if (this.checkIsRoot()) {
|
||||
if (StringUtils.isEmptyString(this.model))
|
||||
throw new BusinessException("请选择模块");
|
||||
if (StringUtils.isEmptyString(this.language))
|
||||
throw new BusinessException("请选择语言");
|
||||
if (StringUtils.isEmptyString(this.content_code))
|
||||
throw new BusinessException("请填写业务码");
|
||||
entity.setModel(this.model);
|
||||
entity.setLanguage(this.language);
|
||||
entity.setContent_code(this.content_code);
|
||||
entity.setUrl(url);
|
||||
}
|
||||
this.bannerService.update(entity);
|
||||
log += MessageFormat.format(",新路径:{0},新语言:{1},新模块:{2},新业务代码:{3},新索引:{4},新可否点击:{5},新是否展示:{6}", entity.getUrl(),
|
||||
entity.getLanguage(), entity.getModel(), entity.getContent_code(), entity.getSort_index(),entity.getClick(),entity.getOn_show());
|
||||
saveLog(sec, this.username_login, log);
|
||||
this.message = "操作成功";
|
||||
} catch (BusinessException e) {
|
||||
this.error = e.getMessage();
|
||||
return toUpdate();
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
this.error = ("[ERROR] 服务器错误");
|
||||
return toUpdate();
|
||||
}
|
||||
return list();
|
||||
}
|
||||
|
||||
private boolean checkIsRoot() {
|
||||
String username = this.getUsername_login();
|
||||
// root才可以改动
|
||||
SecUser secUser = secUserService.findUserByLoginName(username);
|
||||
for (Role role : secUser.getRoles()) {
|
||||
if (Constants.SECURITY_ROLE_ROOT.equals(role.getRoleName())) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
public String delete() {
|
||||
try {
|
||||
if (!checkIsRoot()) {
|
||||
throw new BusinessException("权限不足");
|
||||
}
|
||||
if (StringUtils.isNullOrEmpty(this.id)) {
|
||||
throw new BusinessException("请传入id");
|
||||
}
|
||||
SecUser sec = this.secUserService.findUserByLoginName(this.getUsername_login());
|
||||
checkLoginSafeword(sec, this.getUsername_login(), this.login_safeword);
|
||||
Banner entity = this.bannerService.cacheById(this.id);
|
||||
if (null == entity) {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
this.bannerService.delete(this.id);
|
||||
String log = MessageFormat.format(
|
||||
"ip:" + this.getIp() + ",管理员删除banner,id:{0},路径:{1},语言:{2},模块:{3},业务代码:{4},索引:{5},可否点击:{6},是否展示:{7}", entity.getId(),
|
||||
entity.getUrl(), entity.getLanguage(), entity.getModel(), entity.getContent_code(),
|
||||
entity.getSort_index(),entity.getClick(),entity.getOn_show());
|
||||
saveLog(sec, this.username_login, log);
|
||||
this.message = "操作成功";
|
||||
} catch (BusinessException e) {
|
||||
this.error = e.getMessage();
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
this.error = ("[ERROR] 服务器错误");
|
||||
}
|
||||
return list();
|
||||
}
|
||||
|
||||
public String verif() {
|
||||
if (StringUtils.isNullOrEmpty(this.img)) {
|
||||
return "请上传图片!";
|
||||
}
|
||||
// if (this.index < 0) {
|
||||
// return "请输入正确的排序索引!";
|
||||
// }
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证登录人资金密码
|
||||
*
|
||||
* @param operatorUsername
|
||||
* @param loginSafeword
|
||||
*/
|
||||
protected void checkLoginSafeword(SecUser secUser, String operatorUsername, String loginSafeword) {
|
||||
// SecUser sec = this.secUserService.findUserByLoginName(operatorUsername);
|
||||
String sysSafeword = secUser.getSafeword();
|
||||
String safeword_md5 = passwordEncoder.encodePassword(loginSafeword, operatorUsername);
|
||||
if (!safeword_md5.equals(sysSafeword)) {
|
||||
throw new BusinessException("登录人资金密码错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void saveLog(SecUser secUser, String operator, String context) {
|
||||
project.log.Log log = new project.log.Log();
|
||||
log.setCategory(Constants.LOG_CATEGORY_OPERATION);
|
||||
log.setOperator(operator);
|
||||
log.setUsername(secUser.getUsername());
|
||||
log.setPartyId(secUser.getPartyId());
|
||||
log.setLog(context);
|
||||
log.setCreateTime(new Date());
|
||||
logService.saveSync(log);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setAdminBannerService(AdminBannerService adminBannerService) {
|
||||
this.adminBannerService = adminBannerService;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public Map<String, String> getModelMap() {
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
public void setModelMap(Map<String, String> modelMap) {
|
||||
this.modelMap = modelMap;
|
||||
}
|
||||
|
||||
public String getPara_language() {
|
||||
return para_language;
|
||||
}
|
||||
|
||||
public void setPara_language(String para_language) {
|
||||
this.para_language = para_language;
|
||||
}
|
||||
|
||||
public String getPara_title() {
|
||||
return para_title;
|
||||
}
|
||||
|
||||
public void setPara_title(String para_title) {
|
||||
this.para_title = para_title;
|
||||
}
|
||||
|
||||
public Map<String, String> getLanguageMap() {
|
||||
return languageMap;
|
||||
}
|
||||
|
||||
public void setLanguageMap(Map<String, String> languageMap) {
|
||||
this.languageMap = languageMap;
|
||||
}
|
||||
|
||||
public String getContent_code() {
|
||||
return content_code;
|
||||
}
|
||||
|
||||
public void setContent_code(String content_code) {
|
||||
this.content_code = content_code;
|
||||
}
|
||||
|
||||
public void setSecUserService(SecUserService secUserService) {
|
||||
this.secUserService = secUserService;
|
||||
}
|
||||
|
||||
public void setLogService(LogService logService) {
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
}
|
||||
|
||||
public void setLogin_safeword(String login_safeword) {
|
||||
this.login_safeword = login_safeword;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public int getClick() {
|
||||
return click;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
public void setClick(int click) {
|
||||
this.click = click;
|
||||
}
|
||||
|
||||
public void setBannerService(BannerService bannerService) {
|
||||
this.bannerService = bannerService;
|
||||
}
|
||||
|
||||
public void setFileName(File fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public int getOn_show() {
|
||||
return on_show;
|
||||
}
|
||||
|
||||
public void setOn_show(int on_show) {
|
||||
this.on_show = on_show;
|
||||
}
|
||||
|
||||
public int getSort_index() {
|
||||
return sort_index;
|
||||
}
|
||||
|
||||
public void setSort_index(int sort_index) {
|
||||
this.sort_index = sort_index;
|
||||
}
|
||||
|
||||
// public void setFile(File file) {
|
||||
// this.file = file;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
110
comm/Cms/src/project/cms/web/BannerAction.java
Executable file
110
comm/Cms/src/project/cms/web/BannerAction.java
Executable file
@@ -0,0 +1,110 @@
|
||||
package project.cms.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
// import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import kernel.exception.BusinessException;
|
||||
import kernel.util.JsonUtils;
|
||||
import kernel.web.BaseAction;
|
||||
import kernel.web.ResultObject;
|
||||
import project.cms.Banner;
|
||||
import project.cms.BannerService;
|
||||
|
||||
public class BannerAction extends BaseAction {
|
||||
|
||||
private static Log logger = LogFactory.getLog(BannerAction.class);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7047628687006590684L;
|
||||
private BannerService bannerService;
|
||||
private String id;
|
||||
private String model;
|
||||
private String language;
|
||||
/**
|
||||
* 业务代码, 同种内容 不同语言下的code相同
|
||||
*/
|
||||
private String content_code;
|
||||
|
||||
// public String get() throws IOException {
|
||||
// HttpServletResponse response = ServletActionContext.getResponse();
|
||||
// response.setContentType("application/json;charset=UTF-8");
|
||||
// response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
// ResultObject resultObject = new ResultObject();
|
||||
// PrintWriter out = response.getWriter();
|
||||
// Map<String, Object> data = new HashMap<String, Object>();
|
||||
// try {
|
||||
// Banner banner = bannerService.cacheByCodeAndLanguage(this.content_code, this.language);
|
||||
// resultObject.setData(bannerService.bindOne(banner));
|
||||
// } catch (BusinessException e) {
|
||||
// resultObject.setCode("1");
|
||||
// resultObject.setMsg(e.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// resultObject.setCode("1");
|
||||
// resultObject.setMsg("程序错误");
|
||||
// logger.error("error:", e);
|
||||
// }
|
||||
// this.result = JsonUtils.getJsonString(resultObject);
|
||||
// out.println(this.result);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public String list() throws IOException {
|
||||
// HttpServletResponse response = ServletActionContext.getResponse();
|
||||
// response.setContentType("application/json;charset=UTF-8");
|
||||
// response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
// ResultObject resultObject = new ResultObject();
|
||||
// PrintWriter out = response.getWriter();
|
||||
// try {
|
||||
// List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
|
||||
// List<Banner> cacheListByModel = bannerService.cacheListByModelAndLanguage(this.model, this.language);
|
||||
//
|
||||
// for (Banner banner : cacheListByModel) {
|
||||
// result.add(bannerService.bindOne(banner));
|
||||
// }
|
||||
// resultObject.setData(result);
|
||||
// } catch (BusinessException e) {
|
||||
// resultObject.setCode("1");
|
||||
// resultObject.setMsg(e.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// resultObject.setCode("1");
|
||||
// resultObject.setMsg("程序错误");
|
||||
// logger.error("error:", e);
|
||||
// }
|
||||
// this.result = JsonUtils.getJsonString(resultObject);
|
||||
// out.println(this.result);
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setContent_code(String content_code) {
|
||||
this.content_code = content_code;
|
||||
}
|
||||
|
||||
public void setBannerService(BannerService bannerService) {
|
||||
this.bannerService = bannerService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
389
comm/Cms/src/project/web/admin/AdminCmsController.java
Executable file
389
comm/Cms/src/project/web/admin/AdminCmsController.java
Executable file
@@ -0,0 +1,389 @@
|
||||
package project.web.admin;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.providers.encoding.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import kernel.exception.BusinessException;
|
||||
import kernel.util.StringUtils;
|
||||
import kernel.web.PageActionSupport;
|
||||
import project.Constants;
|
||||
import project.cms.AdminCmsService;
|
||||
import project.cms.Cms;
|
||||
import project.cms.PropertiesUtilCms;
|
||||
import project.log.LogService;
|
||||
import project.news.News;
|
||||
import security.Role;
|
||||
import security.SecUser;
|
||||
import security.internal.SecUserService;
|
||||
|
||||
/**
|
||||
* 用户端内容管理
|
||||
*/
|
||||
@RestController
|
||||
public class AdminCmsController extends PageActionSupport {
|
||||
|
||||
private Logger logger = LogManager.getLogger(AdminCmsController.class);
|
||||
|
||||
@Autowired
|
||||
private AdminCmsService adminCmsService;
|
||||
@Autowired
|
||||
private SecUserService secUserService;
|
||||
@Autowired
|
||||
private LogService logService;
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
private final String action = "normal/adminCmsAction!";
|
||||
|
||||
/**
|
||||
* 获取 用户端内容管理 列表
|
||||
*/
|
||||
@RequestMapping(action + "list.action")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
String pageNo = request.getParameter("pageNo");
|
||||
String message = request.getParameter("message");
|
||||
String error = request.getParameter("error");
|
||||
String language = request.getParameter("language");
|
||||
String title = request.getParameter("title");
|
||||
String startTime = request.getParameter("startTime");
|
||||
String endTime = request.getParameter("endTime");
|
||||
Integer status = request.getParameter("status") == null ? -2 : Integer.parseInt(request.getParameter("status"));
|
||||
Integer type = request.getParameter("type") == null ? -2 : Integer.parseInt(request.getParameter("type"));
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
modelAndView.setViewName("cms_list");
|
||||
|
||||
try {
|
||||
|
||||
this.checkAndSetPageNo(pageNo);
|
||||
|
||||
this.pageSize = 20;
|
||||
|
||||
this.page = this.adminCmsService.pagedQuery(this.pageNo, this.pageSize, language, title, startTime, endTime, type, status);
|
||||
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
modelAndView.addObject("error", "[ERROR] " + t.getMessage());
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.addObject("pageNo", this.pageNo);
|
||||
modelAndView.addObject("pageSize", this.pageSize);
|
||||
modelAndView.addObject("page", this.page);
|
||||
modelAndView.addObject("message", message);
|
||||
modelAndView.addObject("error", error);
|
||||
modelAndView.addObject("title", title);
|
||||
modelAndView.addObject("language",language);
|
||||
modelAndView.addObject("startTime", startTime);
|
||||
modelAndView.addObject("endTime", endTime);
|
||||
modelAndView.addObject("type", type);
|
||||
modelAndView.addObject("status", status);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增 用户端内容管理 页面
|
||||
*/
|
||||
@RequestMapping(action + "toAdd.action")
|
||||
public ModelAndView toAdd(HttpServletRequest request) {
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
|
||||
try {
|
||||
|
||||
// if (!this.checkIsRoot()) {
|
||||
// throw new BusinessException("root 权限下才可添加");
|
||||
// }
|
||||
|
||||
// modelAndView.addObject("language", PropertiesUtilCms.getProperty("system_cms_language"));
|
||||
// modelAndView.addObject("modelMap", Constants.CMS_MODEL);
|
||||
// modelAndView.addObject("languageMap", Constants.LANGUAGE);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
modelAndView.addObject("error", "[ERROR] " + t.getMessage());
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.setViewName("cms_add");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增 用户端内容管理
|
||||
*
|
||||
* title 标题
|
||||
* content 内容
|
||||
* model 模块
|
||||
* language 语言
|
||||
* content_code 业务代码
|
||||
*/
|
||||
@RequestMapping(action + "add.action")
|
||||
public ModelAndView add(HttpServletRequest request, Cms cms) {
|
||||
String login_safeword = request.getParameter("login_safeword");
|
||||
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
|
||||
try {
|
||||
|
||||
String error = this.verif(cms.getTitle(), cms.getContent());
|
||||
if (!StringUtils.isNullOrEmpty(error)) {
|
||||
throw new BusinessException(error);
|
||||
}
|
||||
|
||||
// if (!this.checkIsRoot()) {
|
||||
// throw new BusinessException("root 权限下才可添加");
|
||||
// }
|
||||
|
||||
String username_login = this.getUsername_login();
|
||||
|
||||
SecUser sec = this.secUserService.findUserByLoginName(username_login);
|
||||
|
||||
cms.setCreateTime(new Date());
|
||||
this.adminCmsService.saveOrUpdate(cms);
|
||||
|
||||
String log = null;
|
||||
log = MessageFormat.format("ip:" + this.getIp() + ",管理员新增cms,id:{0},标题:{1},语言:{2},模块:{3}",
|
||||
cms.getId(), cms.getTitle(), cms.getLanguage());
|
||||
this.saveLog(sec, username_login, log);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
// modelAndView.addObject("model", model);
|
||||
// modelAndView.addObject("language", language);
|
||||
// modelAndView.addObject("content_code", content_code);
|
||||
// modelAndView.addObject("title", title);
|
||||
// modelAndView.addObject("content", content);
|
||||
// modelAndView.addObject("modelMap", Constants.CMS_MODEL);
|
||||
// modelAndView.addObject("languageMap", Constants.LANGUAGE);
|
||||
modelAndView.setViewName("cms_add");
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
modelAndView.addObject("error", "[ERROR] " + t.getMessage());
|
||||
// modelAndView.addObject("model", model);
|
||||
// modelAndView.addObject("language", language);
|
||||
// modelAndView.addObject("content_code", content_code);
|
||||
// modelAndView.addObject("title", title);
|
||||
// modelAndView.addObject("content", content);
|
||||
// modelAndView.addObject("modelMap", Constants.CMS_MODEL);
|
||||
// modelAndView.addObject("languageMap", Constants.LANGUAGE);
|
||||
modelAndView.setViewName("cms_add");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.addObject("message", "操作成功");
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 用户端内容管理 页面
|
||||
*
|
||||
* title 标题
|
||||
* content 内容
|
||||
* model 模块
|
||||
* language 语言
|
||||
* content_code 业务代码
|
||||
*/
|
||||
@RequestMapping(action + "toUpdate.action")
|
||||
public ModelAndView toUpdate(HttpServletRequest request) {
|
||||
String id = request.getParameter("id");
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
|
||||
try {
|
||||
|
||||
if (StringUtils.isNullOrEmpty(id)) {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
|
||||
Cms cms = this.adminCmsService.findById(id);
|
||||
if (null == cms) {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
|
||||
modelAndView.addObject("cms", cms);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
modelAndView.addObject("error", "[ERROR] " + t.getMessage());
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.setViewName("cms_update");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 用户端内容管理
|
||||
*
|
||||
* title 标题
|
||||
* content 内容
|
||||
* model 模块
|
||||
* language 语言
|
||||
* content_code 业务代码
|
||||
*/
|
||||
@RequestMapping(action + "update.action")
|
||||
public ModelAndView update(HttpServletRequest request, Cms cms) {
|
||||
String login_safeword = request.getParameter("login_safeword");
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
|
||||
try {
|
||||
|
||||
String error = this.verif(cms.getTitle(), cms.getContent());
|
||||
if (!StringUtils.isNullOrEmpty(error)) {
|
||||
throw new BusinessException(error);
|
||||
}
|
||||
|
||||
String username_login = this.getUsername_login();
|
||||
|
||||
SecUser sec = this.secUserService.findUserByLoginName(username_login);
|
||||
|
||||
this.checkLoginSafeword(sec, username_login, login_safeword);
|
||||
|
||||
if (StringUtils.isNullOrEmpty(cms.getId().toString())) {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
|
||||
Cms entity = this.adminCmsService.findById(cms.getId().toString());
|
||||
if (null == entity) {
|
||||
throw new BusinessException("内容不存在或已删除");
|
||||
}
|
||||
cms.setCreateTime(entity.getCreateTime());
|
||||
|
||||
String log = null;
|
||||
log = MessageFormat.format("ip:" + this.getIp() + ",管理员修改cms,id:{0},原标题:{1},原语言:{2},原模块:{3}",
|
||||
entity.getId(), entity.getTitle(), entity.getLanguage());
|
||||
|
||||
this.adminCmsService.saveOrUpdate(cms);
|
||||
saveLog(sec, username_login, log);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("cms", cms);
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
modelAndView.setViewName("cms_update");
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error(" error ", t);
|
||||
modelAndView.addObject("cms", cms);
|
||||
modelAndView.addObject("error", "[ERROR] " + t.getMessage());
|
||||
modelAndView.setViewName("cms_update");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.addObject("message", "操作成功");
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 新闻管理
|
||||
*/
|
||||
@RequestMapping(action + "delete.action")
|
||||
public ModelAndView delete(HttpServletRequest request) {
|
||||
String id = request.getParameter("id");
|
||||
String login_safeword = request.getParameter("login_safeword");
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
modelAndView.setViewName("redirect:/" + action + "list.action");
|
||||
|
||||
try {
|
||||
|
||||
String userNameLogin = this.getUsername_login();
|
||||
|
||||
SecUser sec = this.secUserService.findUserByLoginName(userNameLogin);
|
||||
this.checkLoginSafeword(sec, userNameLogin, login_safeword);
|
||||
|
||||
Cms cms = this.adminCmsService.findById(id);
|
||||
|
||||
String log = MessageFormat.format("ip:" + this.getIp() + ",管理员删除公告,id:{0},原标题:{1},原语言:{2},原模块:{3}",
|
||||
cms.getId(), cms.getTitle(), cms.getLanguage(), cms.getType());
|
||||
this.saveLog(sec, userNameLogin, log);
|
||||
this.adminCmsService.delete(cms);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
modelAndView.addObject("error", e.getMessage());
|
||||
return modelAndView;
|
||||
} catch (Throwable t) {
|
||||
logger.error("update error ", t);
|
||||
modelAndView.addObject("error", "程序错误");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
modelAndView.addObject("message", "操作成功");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
private boolean checkIsRoot() {
|
||||
String username = this.getUsername_login();
|
||||
// root才可以改动
|
||||
SecUser secUser = this.secUserService.findUserByLoginName(username);
|
||||
for (Role role : secUser.getRoles()) {
|
||||
if (Constants.SECURITY_ROLE_ROOT.equals(role.getRoleName())) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public String verif(String title, String content) {
|
||||
if (StringUtils.isNullOrEmpty(title)) {
|
||||
return "请输入标题!";
|
||||
}
|
||||
if (StringUtils.isNullOrEmpty(content)) {
|
||||
return "请输入内容!";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证登录人资金密码
|
||||
*/
|
||||
protected void checkLoginSafeword(SecUser secUser, String operatorUsername, String loginSafeword) {
|
||||
// SecUser sec = this.secUserService.findUserByLoginName(operatorUsername);
|
||||
String sysSafeword = secUser.getSafeword();
|
||||
String safeword_md5 = this.passwordEncoder.encodePassword(loginSafeword, operatorUsername);
|
||||
if (!safeword_md5.equals(sysSafeword)) {
|
||||
throw new BusinessException("登录人资金密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
public void saveLog(SecUser secUser, String operator, String context) {
|
||||
project.log.Log log = new project.log.Log();
|
||||
log.setCategory(Constants.LOG_CATEGORY_OPERATION);
|
||||
log.setOperator(operator);
|
||||
log.setUsername(secUser.getUsername());
|
||||
log.setPartyId(secUser.getPartyId());
|
||||
log.setLog(context);
|
||||
log.setCreateTime(new Date());
|
||||
logService.saveSync(log);
|
||||
}
|
||||
|
||||
}
|
||||
88
comm/Cms/src/project/web/api/CmsController.java
Executable file
88
comm/Cms/src/project/web/api/CmsController.java
Executable file
@@ -0,0 +1,88 @@
|
||||
package project.web.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import kernel.exception.BusinessException;
|
||||
import kernel.util.DateUtils;
|
||||
import kernel.web.ResultObject;
|
||||
import project.cms.Cms;
|
||||
import project.cms.CmsService;
|
||||
|
||||
/**
|
||||
* 用户端内容管理
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
public class CmsController {
|
||||
|
||||
private Logger logger = LogManager.getLogger(CmsController.class);
|
||||
|
||||
@Autowired
|
||||
private CmsService cmsService;
|
||||
|
||||
private final String action = "/api/cms!";
|
||||
|
||||
/**
|
||||
* 获取 用户端内容管理
|
||||
*/
|
||||
@RequestMapping(action + "get.action")
|
||||
public Object get(HttpServletRequest request) {
|
||||
String language = request.getParameter("lang");
|
||||
ResultObject resultObject = new ResultObject();
|
||||
|
||||
try {
|
||||
if (null == language){
|
||||
throw new BusinessException("语言参数错误");
|
||||
}
|
||||
List<Cms> list = this.cmsService.findCmsListByLang(language);
|
||||
if (null != list) {
|
||||
resultObject.setData(list.get(0));
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
resultObject.setCode("1");
|
||||
resultObject.setMsg(e.getMessage());
|
||||
} catch (Throwable t) {
|
||||
resultObject.setCode("1");
|
||||
resultObject.setMsg("程序错误");
|
||||
logger.error("error:", t);
|
||||
}
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 用户端内容管理 列表
|
||||
*/
|
||||
@RequestMapping(action + "list.action")
|
||||
public Object list(HttpServletRequest request) {
|
||||
String language = request.getParameter("lang");
|
||||
|
||||
ResultObject resultObject = new ResultObject();
|
||||
|
||||
try {
|
||||
|
||||
List<Cms> cacheListByModel = this.cmsService.cacheListByModelAndLanguage(language);
|
||||
resultObject.setData(cacheListByModel);
|
||||
|
||||
} catch (BusinessException e) {
|
||||
resultObject.setCode("1");
|
||||
resultObject.setMsg(e.getMessage());
|
||||
} catch (Throwable t) {
|
||||
resultObject.setCode("1");
|
||||
resultObject.setMsg("程序错误");
|
||||
logger.error("error:", t);
|
||||
}
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user