generated from root/miduo_server
渠道管理添加是否和谐参数
parent
2836006e24
commit
26afff8ba5
|
@ -40,6 +40,7 @@ public class WebSecurityConfig extends WebMvcConfigurerAdapter{
|
|||
addInterceptor.excludePathPatterns("/error");
|
||||
addInterceptor.excludePathPatterns("/login**");
|
||||
addInterceptor.excludePathPatterns("/req/**");
|
||||
addInterceptor.excludePathPatterns("/webGetChannelInfo**");
|
||||
|
||||
addInterceptor.addPathPatterns("/**");
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
|
@ -51,6 +50,22 @@ public class ChannelInfoController {
|
|||
return "channelInfo";
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部获取渠道信息
|
||||
* @param map
|
||||
* @returnc
|
||||
*/
|
||||
@RequestMapping(value = "/webGetChannelInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public String webGetChannelInfo(HttpServletRequest request) throws Exception {
|
||||
String ccId = request.getParameter("ccId");
|
||||
ChannelInfo info = channelInfoDao.getChannelInfoById(ccId);
|
||||
if (info == null){
|
||||
return "-1";
|
||||
}
|
||||
return String.valueOf(info.getShielding());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param request
|
||||
|
@ -88,6 +103,60 @@ public class ChannelInfoController {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/updateChannel", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int updateChannel(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.UPDATE_CHANNEL_PERMISSIONS);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
// 参数处理
|
||||
String ccId = map.get("ccId");
|
||||
String name = map.get("name");
|
||||
int shielding = Integer.parseInt(map.get("shielding"));
|
||||
// 验证是否重复
|
||||
List<ChannelInfo> infos = channelInfoDao.getChannelInfosById(ccId);
|
||||
if (infos == null || infos.size() != 1){
|
||||
return 0;
|
||||
}
|
||||
ChannelInfo info = infos.get(0);
|
||||
info.setId(ccId);
|
||||
info.setName(name);
|
||||
info.setShielding(shielding);
|
||||
// 修改
|
||||
channelInfoDao.updateChannelInfo(info);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改界面
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/toUpdateChannel", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String toUpdateChannel(ModelMap model, String id) throws Exception {
|
||||
List<ChannelInfo> infos = channelInfoDao.getChannelInfosById(id);
|
||||
if (infos == null){
|
||||
throw new Exception("id错误,渠道未找到,修改失败");
|
||||
}
|
||||
if (infos.size() != 1){
|
||||
throw new Exception("id已存在,修改失败");
|
||||
}
|
||||
ChannelInfo info = infos.get(0);
|
||||
model.addAttribute("info", info);
|
||||
return "updateChannel";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param request
|
||||
|
|
|
@ -33,6 +33,14 @@ public interface ChannelInfoDao {
|
|||
*/
|
||||
ChannelInfo getChannelInfoById(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 单个查询,id
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<ChannelInfo> getChannelInfosById(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param channelInfo
|
||||
|
@ -47,4 +55,11 @@ public interface ChannelInfoDao {
|
|||
*/
|
||||
void deleteChannelInfo(ChannelInfo channelInfo) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param channelInfo
|
||||
* @throws Exception
|
||||
*/
|
||||
void updateChannelInfo(ChannelInfo channelInfo) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.jmfy.utils.Connect;
|
|||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -44,6 +45,13 @@ public class ChannelInfoDaoImpl implements ChannelInfoDao {
|
|||
return mongoTemplate.findOne(query, ChannelInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelInfo> getChannelInfosById(String id) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("_id").is(id));
|
||||
return mongoTemplate.find(query, ChannelInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertChannelInfo(ChannelInfo channelInfo) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
|
@ -55,4 +63,21 @@ public class ChannelInfoDaoImpl implements ChannelInfoDao {
|
|||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
mongoTemplate.remove(channelInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateChannelInfo(ChannelInfo channelInfo) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query(Criteria.where("_id").is(channelInfo.getId()));
|
||||
Update update = new Update();
|
||||
if (channelInfo.getId() != null){
|
||||
update.set("id",channelInfo.getId());
|
||||
}
|
||||
if (channelInfo.getName() != null){
|
||||
update.set("name",channelInfo.getName());
|
||||
}
|
||||
if (channelInfo.getShielding() >= 0){
|
||||
update.set("shielding",channelInfo.getShielding());
|
||||
}
|
||||
mongoTemplate.upsert(query,update,ChannelInfo.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,16 @@ public class ChannelInfo {
|
|||
@Field(value = "name")
|
||||
private String name;
|
||||
|
||||
@Field(value = "shielding")
|
||||
private int shielding;
|
||||
|
||||
public ChannelInfo(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.shielding = 0;
|
||||
}
|
||||
|
||||
public ChannelInfo() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -37,4 +44,12 @@ public class ChannelInfo {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getShielding() {
|
||||
return shielding;
|
||||
}
|
||||
|
||||
public void setShielding(int shielding) {
|
||||
this.shielding = shielding;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,13 +93,14 @@ public enum PowersEnum {
|
|||
|
||||
// 游戏管理
|
||||
GAME_MANAGER(1400,"游戏管理",1400,1,""),
|
||||
PACKAGE_NAME_MANAGER(1401,"频道管理",1400,1,"packageInfoList"),
|
||||
PACKAGE_NAME_MANAGER(1401,"频道管理(公告用)",1400,1,"packageInfoList"),
|
||||
ADD_PACKAGE_NAME(1402,"权限: 添加频道",1400,0,""),
|
||||
DELETE_PACKAGE_NAME(1403,"权限: 删除频道",1400,0,""),
|
||||
|
||||
CHANNEL_NAME_MANAGER(1404,"渠道管理",1400,1,"channelInfoList"),
|
||||
ADD_CHANNEL_PERMISSIONS(1405,"权限: 添加渠道",1400,0,""),
|
||||
DELETE_CHANNEL_PERMISSIONS(1406,"权限: 删除渠道",1400,0,""),
|
||||
UPDATE_CHANNEL_PERMISSIONS(1410,"权限: 修改渠道",1400,0,""),
|
||||
|
||||
HAND_IN_MANAGER(1407,"提审服管理",1400,1,"tishenInfoList"),
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<tr class="text-c" style="width: 300px;">
|
||||
<th width="200">ID</th>
|
||||
<th width="200">名称</th>
|
||||
<th width="200">是否和谐</th>
|
||||
<th width="200">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -50,8 +51,12 @@
|
|||
<!--<td><input type="checkbox" value="" name=""/></td>-->
|
||||
<td th:text="${obj.id}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.name}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.shielding}" style="text-align: center;"></td>
|
||||
<td style="text-align: center; width: 300px">
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary"
|
||||
onclick="return updateChannel(this)"><i class="Hui-iconfont"></i> 修改
|
||||
</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-danger"
|
||||
onclick="return deleteChannel(this)"><i class="Hui-iconfont"></i> 删除
|
||||
</button>
|
||||
</td>
|
||||
|
@ -82,6 +87,12 @@
|
|||
]
|
||||
});
|
||||
|
||||
// 修改密码
|
||||
function updateChannel(obj) {
|
||||
var id = $(obj).attr("id");
|
||||
window.location = "/toUpdateChannel?id=" + id;
|
||||
}
|
||||
|
||||
// 添加
|
||||
function addChannel() {
|
||||
var name = $("#channel").val();
|
||||
|
@ -111,29 +122,34 @@
|
|||
})
|
||||
}
|
||||
|
||||
// 单个审核
|
||||
// 删除
|
||||
function deleteChannel(obj) {
|
||||
var id = $(obj).attr("id");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
url: "/deleteChannelInfo",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('操作失败,数据不存在!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 2) {
|
||||
layer.msg('没有权限', {icon: 6, time: 1000});
|
||||
var msg = "您真的确定要删除id为:{" + id +"}的渠道吗?\n\n请确认!";
|
||||
if (confirm(msg) === true) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
url: "/deleteChannelInfo",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('操作失败,数据不存在!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 2) {
|
||||
layer.msg('没有权限', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<link rel="Bookmark" href="/favicon.ico"/>
|
||||
<link rel="Shortcut Icon" href="/favicon.ico"/>
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
|
||||
<!--[if IE 6]>
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<![endif]-->
|
||||
<!--/meta 作为公共模版分离出去-->
|
||||
|
||||
<title>基本设置</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb">
|
||||
<a href="javascript:;" onclick="history.go(-1)"><i class="Hui-iconfont"></i> 首页</a>
|
||||
<span class="c-gray en">></span>
|
||||
渠道管理
|
||||
<span class="c-gray en">></span>
|
||||
渠道信息
|
||||
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont"></i></a>-->
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" th:object="${info}" action="*" method="post">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>修改渠道信息</span>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
ccId:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="ccId" placeholder="" th:value="*{getId()}" class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
名称:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="name" placeholder="" th:value="*{getName()}" class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
是否和谐:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select th:name="shielding" class="input-text" id="shielding"><!--下拉列表-->
|
||||
<div th:switch="*{getShielding()}">
|
||||
<option th:value="0">否</option>
|
||||
<option th:value="1">是</option>
|
||||
</div>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="button" onclick="updateChannelInfo()"><i class="Hui-iconfont"></i> 保存</button>
|
||||
<button class="btn btn-default radius" type="button"><a href="/channelInfoList"> 取消 </a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
|
||||
<script th:inline="javascript">
|
||||
$(function () {
|
||||
$('.skin-minimal input').iCheck({
|
||||
checkboxClass: 'icheckbox-blue',
|
||||
radioClass: 'iradio-blue',
|
||||
increaseArea: '20%'
|
||||
});
|
||||
$("#tab-system").Huitab({
|
||||
index: 0
|
||||
});
|
||||
});
|
||||
|
||||
//当页面加载完成的时候,自动调用该方法
|
||||
window.onload = function () {
|
||||
var inf = [[${info}]];
|
||||
$("#shielding option[value='" + inf.shielding + "']").attr("selected", "selected");
|
||||
};
|
||||
|
||||
function updateChannelInfo() {
|
||||
var ccId = $("input[name='ccId']").val();
|
||||
var name = $("input[name='name']").val();
|
||||
var shielding = $("#shielding option:selected").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"ccId": ccId,
|
||||
"name": name,
|
||||
"shielding": shielding
|
||||
},
|
||||
url: "/updateChannel",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
alert("修改成功");
|
||||
window.location.href="/channelInfoList";
|
||||
}
|
||||
if (data === 0) {
|
||||
alert("修改失败");
|
||||
}
|
||||
if (data === 2) {
|
||||
alert("权限不足!");
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
</html>
|
|
@ -26,9 +26,10 @@
|
|||
<h1><p class="f-20 text-success">太初行管理后台</p></h1>
|
||||
</div>
|
||||
<div style="margin-left: 20px;font-size: 18px">
|
||||
<p style="color: red">更新日志[2021-10-19]</p>
|
||||
<p style="color: red">更新日志[2021-10-25]</p>
|
||||
<p>1、服务器信息添加删除按钮</p>
|
||||
<p>2、订单列表修改时间输入方式,小幅度速度优化</p>
|
||||
<p>3、渠道管理添加是否和谐参数</p>
|
||||
</div>
|
||||
<footer class="footer mt-20">
|
||||
</footer>
|
||||
|
|
Loading…
Reference in New Issue