账户角色查询

master
gaojie 2019-05-06 16:40:16 +08:00
parent 17d5451f24
commit 3468f54f54
8 changed files with 224 additions and 11 deletions

View File

@ -3,6 +3,7 @@ package com.jmfy.controller;
import com.jmfy.dao.*;
import com.jmfy.model.*;
import com.jmfy.model.vo.CUserVo;
import com.jmfy.model.vo.RoleVo;
import com.jmfy.redisProperties.GlobalsDef;
import com.jmfy.utils.JsonUtil;
import org.springframework.stereotype.Controller;
@ -13,7 +14,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by huangds on 2017/10/24.
@ -27,6 +30,37 @@ public class UserInfoController {
@Resource
ItemDao itemDao;
@RequestMapping(value = "/getAllUserId", method = {RequestMethod.POST, RequestMethod.GET})
public String getAllUserId(HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String openId = parameterMap.get("userId");
List<CUserInfo> userInfos = userInfoDao.findUserInfo(openId);
List<RoleVo> roleVos = new ArrayList<>();
for (CUserInfo cUserInfo:userInfos){
int serverid = cUserInfo.getServerid();
int userId = cUserInfo.getUserId();
RoleVo roleVo = new RoleVo();
CUser cUser = userInfoDao.findCuserInfo(serverid,userId);
if (cUser == null ){
continue;
}
roleVo.setServerId(cUserInfo.getServerid());
roleVo.setUserId(cUserInfo.getUserId());
roleVo.setUserName(cUser.getUserName());
CUserPrivilegeInfo cUserPrivilegeInfo = userInfoDao.getCUserPrivilegeInfo(serverid,userId);
roleVo.setSave_amt(cUserPrivilegeInfo.getSave_amt());
CFamilyUser cFamilyUser = familyDao.getCFamilyUserById(serverid,userId);
if (cFamilyUser != null){
roleVo.setFamilyId(String.valueOf(cFamilyUser.getFamilyId()));
}else{
roleVo.setFamilyId(String.valueOf(0));
}
roleVos.add(roleVo);
}
map.put("RoleVos",roleVos);
return "roleList";
}
@RequestMapping(value = "/getUserInfo", method = {RequestMethod.POST, RequestMethod.GET})
public String getSendMail(HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);

View File

@ -10,7 +10,7 @@ import java.util.List;
public interface UserInfoDao {
CUserInfo findUserInfo(int serverId, String openId, String plat) throws Exception;
List<CUserInfo> findUserInfo(String openId) throws Exception;
CUser findCuserInfo(int serverId ,int userId) throws Exception;

View File

@ -24,14 +24,13 @@ public class UserInfoDaoImpl implements UserInfoDao {
public static final String dbName ="ysj_core";
@Override
public CUserInfo findUserInfo(int serverId, String openId, String plat) throws Exception {
public List<CUserInfo> findUserInfo(String openId) throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query();
Criteria cr = new Criteria();
cr.andOperator(Criteria.where("openId").is(openId), Criteria.where("serverid").is(serverId));
cr.andOperator(Criteria.where("openId").is(openId));
query.addCriteria(cr);
CUserInfo cUserInfo = mongoTemplate.findOne(query, CUserInfo.class);
return cUserInfo;
return mongoTemplate.find(query, CUserInfo.class);
}
@Override

View File

@ -0,0 +1,34 @@
package com.jmfy.model.vo;
public class RoleVo implements java.io.Serializable {
public int userId;
public int serverId;
public String userName;
public String familyId ;
public float save_amt; //目前儲值
public void setUserId(int userId) {
this.userId = userId;
}
public void setServerId(int serverId) {
this.serverId = serverId;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setFamilyId(String familyId) {
this.familyId = familyId;
}
public void setSave_amt(float save_amt) {
this.save_amt = save_amt;
}
}

View File

@ -1,10 +1,4 @@
server.port=8888
##数据库配置
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://60.1.1.11:3306/Tlog?useUnicode=true&characterEncoding=utf-8
#spring.datasource.username=root
#spring.datasource.password=123456
#开发,时关闭缓存不然没法看到实时页面
spring.thymeleaf.cache=false
@ -12,6 +6,7 @@ spring.thymeleaf.content-type=text/html
spring.thymeleaf.mode =LEGACYHTML5
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/ysj_core
#spring.data.mongodb.uri = mongodb://150.116.94.74:27017/ysj_core
spring.data.oldMongodb.uri= mongodb://60.1.1.14:27017
# redis config

View File

@ -0,0 +1,76 @@
<!DOCTYPE HTML>
<html>
<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" />
<!--[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="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/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="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/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]-->
<title>個人信息查询</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 個人信息管理 <span class="c-gray en">&gt;</span> 查询账号角色 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" style="text-align: center">
<h1><span style="color: red">查询账号角色</span></h1>
<form class="form form-horizontal" id="form-article-add" action="/getAllUserId" method="post" onsubmit="return getUserInfo()">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
&nbsp;&nbsp;ID</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="userId" placeholder="" value="" class="input-text"/>
<span class="USERID"></span>
</div>
</div>
<!--<div class="row cl">-->
<!--<label class="form-label col-xs-4 col-sm-2">-->
<!--<span class="c-red">*</span>-->
<!--平&nbsp;&nbsp;&nbsp;台&nbsp;&nbsp;&nbsp;</label>-->
<!--<div class="formControls col-xs-8 col-sm-9">-->
<!--<select name="plat" class="input-text">&lt;!&ndash;下拉列表&ndash;&gt;-->
<!--<option value="android" selected = "selected">Android</option>-->
<!--<option value="ios" >IOS</option>-->
<!--</select>-->
<!--</div>-->
<!--</div>-->
<div class="row cl" style="text-align: center" >
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="submit" style="font-size: 15px"><i class="Hui-iconfont">&#xe665;</i> 查询账号角色</button>
</div>
</div>
</form>
</div>
<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="../static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
function getUserInfo() {
var userId = $("input[name='userId']").val();
var erroCode = $('.SERVERID');
if (userId === '' || userId == null) {
erroCode = $('.USERID');
erroCode.html('<span style="color: red; ">用户id不能为空!</span>');
return false;
}
return true
}
</script>
</body>
</html>

View File

@ -101,6 +101,7 @@
<dd>
<ul>
<li><a data-href="/html/getuserInfo.html" data-title="個人信息查询" href="javascript:;">個人信息查询</a></li>
<li><a data-href="/html/getRole.html" data-title="账号角色查询" href="javascript:;">账号角色查询</a></li>
</ul>
</dd>
</dl>

View File

@ -0,0 +1,74 @@
<!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"/>
<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"/>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<title>账号角色信息</title>
</head>
<body>
<nav class="breadcrumb">
<a href="javascript:;" onclick="history.go(-1)"><i class="Hui-iconfont">&#xe67f;</i> 首页</a>
<span class="c-gray en">&gt;</span> 個人信息管理
<span class="c-gray en">&gt;</span> 查询账号角色
</nav>
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">账号角色信息</span></h2>
<div class="text-c">
<div class="mt-20">
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
<thead>
<tr class="text-c">
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
<th width="200">角色ID</th>
<th width="200">所在服务器ID</th>
<th width="200">角色名字</th>
<th width="200">所在宗门ID</th>
<th width="200">充值金额</th>
</tr>
</thead>
<tr th:each="obj:${RoleVos}">
<td th:text="${obj.userId}" style="text-align: center;"></td>
<td th:text="${obj.serverId}" style="text-align: center;"></td>
<td th:text="${obj.userName}" style="text-align: center;"></td>
<td th:text="${obj.familyId}" style="text-align: center;"></td>
<td th:text="${obj.save_amt}" style="text-align: center;"></td>
</tr>
</table>
</div>
</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/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
"aaSorting": [[ 1, "desc" ]],//默认第几个排序
"bStateSave": true,//状态保存
"pading":false,
"aoColumnDefs": [
//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
{"orderable":false,"aTargets":[0,4]}// 不参与排序的列
]
});
</script>
</body>
</html>