提交 d857de02 编写于 作者: doc_wei's avatar doc_wei

新增用户完成,bug修改

上级 fc4684b9
......@@ -40,6 +40,12 @@ public interface SysEveUserDao {
public int editUserInstallWinStartMenuSize(Map<String, Object> map) throws Exception;
public int editUserInstallWinTaskPosition(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysUserCodeByMation(Map<String, Object> map) throws Exception;
public int insertSysUserMation(Map<String, Object> map) throws Exception;
public int insertSysUserInstallMation(Map<String, Object> map) throws Exception;
......
......@@ -38,6 +38,8 @@ public interface SysEveUserService {
public void editUserInstallWinStartMenuSize(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallWinTaskPosition(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertSysUserMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
......
package com.skyeye.authority.service.impl;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -109,6 +110,52 @@ public class SysEveUserServiceImpl implements SysEveUserService{
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: insertSysUserMationById
* @Description: 创建账号
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertSysUserMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> userCode = sysEveUserDao.querySysUserCodeByMation(map);
if(userCode == null){
Map<String, Object> user = inputObject.getLogParams();
int pwdNum = (int)(Math.random()*100);
String password = map.get("password").toString();
for(int i = 0; i < pwdNum; i++){
password = ToolUtil.MD5(password);
}
String userId = ToolUtil.getSurFaceId();
map.put("id", userId);
map.put("password", password);
map.put("pwdNum", pwdNum);
map.put("userLock", 0);
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("userId", userId);
bean.put("winBgPicUrl", "/assets/winbgpic/default.jpg");
bean.put("winLockBgPicUrl", "/assets/winlockbgpic/default.jpg");
bean.put("winThemeColor", "31");
bean.put("winStartMenuSize", "sm");
bean.put("winTaskPosition", "bottom");
bean.put("createId", user.get("id"));
bean.put("createTime", ToolUtil.getTimeAndToString());
sysEveUserDao.insertSysUserMation(map);
sysEveUserDao.insertSysUserInstallMation(bean);
}else{
outputObject.setreturnMessage("该账号已存在,请更换!");
}
}
/**
*
......@@ -391,7 +438,5 @@ public class SysEveUserServiceImpl implements SysEveUserService{
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallWinTaskPosition(map);
}
}
......@@ -74,6 +74,9 @@ public class CommonServiceImpl implements CommonService{
case 5://系统桌面锁屏背景自定义图片上传用户自定义
basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB)) + "\\images\\upload\\winlockbgpic" ;
break;
case 6://用户头像
basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB)) + "\\images\\upload\\userphoto" ;
break;
default:
basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB));
break;
......@@ -110,6 +113,9 @@ public class CommonServiceImpl implements CommonService{
case 5://系统桌面锁屏背景自定义图片上传用户自定义
newFileName = "/images/upload/winlockbgpic/" + newFileName ;
break;
case 6://用户头像
newFileName = "/images/upload/userphoto/" + newFileName ;
break;
default:
break;
}
......
......@@ -79,6 +79,22 @@ public class SysEveUserController {
sysEveUserService.querySysUserMationToEditById(inputObject, outputObject);
}
/**
*
* @Title: insertSysUserMationById
* @Description: 创建账号
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/insertSysUserMationById")
@ResponseBody
public void insertSysUserMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.insertSysUserMationById(inputObject, outputObject);
}
/**
*
* @Title: editSysUserMationById
......
......@@ -214,4 +214,28 @@
WHERE user_id = #{userId}
</update>
<select id="querySysUserCodeByMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.user_code userCode
FROM
sys_eve_user a
WHERE
a.user_code = #{userCode}
</select>
<insert id="insertSysUserMation" parameterType="java.util.Map">
INSERT into sys_eve_user
(id, user_code, pwd_num_enc, password, user_name, user_photo, user_idcard, user_sex, user_lock, creater, create_time)
VALUES
(#{id}, #{userCode}, #{pwdNum}, #{password}, #{userName}, #{userPhoto}, #{userIdCard}, #{userSex}, #{userLock}, #{createId}, #{createTime})
</insert>
<insert id="insertSysUserInstallMation" parameterType="java.util.Map">
INSERT into sys_eve_user_install
(id, user_id, win_bg_pic_url, win_lock_bg_pic_url, win_theme_color, win_start_menu_size, win_task_position, create_id, create_time)
VALUES
(#{id}, #{userId}, #{winBgPicUrl}, #{winLockBgPicUrl}, #{winThemeColor}, #{winStartMenuSize}, #{winTaskPosition}, #{createId}, #{createTime})
</insert>
</mapper>
\ No newline at end of file
......@@ -61,6 +61,7 @@
FROM
sys_eve_win_lock_bg_pic a
WHERE a.pic_type = '2'
AND a.create_id = #{createId}
ORDER BY a.create_time DESC
</select>
......
......@@ -52,7 +52,15 @@
<url id="sys005" path="/post/SysEveUserController/editSysUserMationById" val="编辑账号" allUse="1">
<property id="rowId" name="id" ref="required" var="账号ID" />
<property id="userSex" name="userSex" ref="required,num" var="性别" />
<property id="userIdCard" name="userIdCard" ref="required,idcard" var="身份证" />
<property id="userIdCard" name="userIdCard" ref="idcard" var="身份证" />
<property id="userName" name="userName" ref="required" var="用户名" />
<property id="userPhoto" name="userPhoto" ref="required" var="头像" />
</url>
<url id="sysAdd005" path="/post/SysEveUserController/insertSysUserMationById" val="创建账号" allUse="1">
<property id="userCode" name="userCode" ref="required" var="账号" />
<property id="userSex" name="userSex" ref="required,num" var="性别" />
<property id="password" name="password" ref="required" var="密码" />
<property id="userIdCard" name="userIdCard" ref="idcard" var="身份证" />
<property id="userName" name="userName" ref="required" var="用户名" />
<property id="userPhoto" name="userPhoto" ref="required" var="头像" />
</url>
......
......@@ -105,6 +105,8 @@ layui.define(["jquery"], function(exports) {
q();
if(options.uploadType == '1'){
completeUrl += fileBasePath + "\\assets\\smpropic\\" + p[s] + ",";
}else{
completeUrl += fileBasePath + p[s] + ",";
}
}
s++;
......@@ -227,7 +229,7 @@ layui.define(["jquery"], function(exports) {
J.addClass("success").append(g).append(typeof D == "function" ? E : "").data("url", fileBasePath + "\\assets\\smpropic\\" + M.bean.picUrl);
J.attr("oldurl", M.bean.picUrl);
}else{
J.addClass("success").append(g).append(typeof D == "function" ? E : "").data("url", fileBasePath + "\\assets\\smpropic\\" + M.bean.picUrl);
J.addClass("success").append(g).append(typeof D == "function" ? E : "").data("url", fileBasePath + M.bean.picUrl);
J.attr("oldurl", M.bean.picUrl);
}
} else {
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'fileUpload'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$;
//初始化上传
$("#userPhoto").upload({
"action": reqBasePath + "common003",
"data-num": "1",
"data-type": "PNG,JPG,jpeg,gif",
"uploadType": 6,
"function": function (_this, data) {
show("#userPhoto", data);
}
});
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
var params = {
userCode: $("#userCode").val(),
userName: $("#userName").val(),
password: $("#password").val(),
userIdCard: $("#userIdCard").val(),
userSex: $("input[name='userSex']:checked").val(),
};
params.userPhoto = $("#userPhoto").find("input[type='hidden'][name='upload']").attr("oldurl");
AjaxPostUtil.request({url:reqBasePath + "sysAdd005", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
......@@ -31,7 +31,7 @@ layui.config({
"action": reqBasePath + "common003",
"data-num": "1",
"data-type": "PNG,JPG,jpeg,gif",
"uploadType": 2,
"uploadType": 6,
"data-value": json.bean.userPhoto,
//该函数为点击放大镜的回调函数,如没有该函数,则不显示放大镜
"function": function (_this, data) {
......@@ -47,7 +47,6 @@ layui.config({
userName: $("#userName").val(),
userIdCard: $("#userIdCard").val(),
userSex: $("input[name='userSex']:checked").val(),
userPhoto: "11"
};
params.userPhoto = $("#userPhoto").find("input[type='hidden'][name='upload']").attr("oldurl");
......
......@@ -143,6 +143,22 @@ layui.config({
}});
}
//添加用户
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/syseveuser/syseveuseradd.html",
title: "新增用户",
pageId: "syseveroleadd",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
});
$("body").on("click", "#reloadTable", function(){
loadTable();
});
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm">
<div class="layui-form-item">
<label class="layui-form-label">账号<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="userCode" name="userCode" win-verify="required" placeholder="请输入账号" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" id="userName" name="userName" win-verify="required" placeholder="请输入用户名" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码<i class="red">*</i></label>
<div class="layui-input-block">
<input type="password" id="password" name="password" win-verify="required" placeholder="请输入密码" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">身份证</label>
<div class="layui-input-block">
<input type="text" id="userIdCard" name="userIdCard" placeholder="请输入身份证" class="layui-input"/>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">性别</label>
<div class="layui-input-block winui-radio">
<input type="radio" name="userSex" value="0" title="保密" checked="checked"/>
<input type="radio" name="userSex" value="1" title="男" />
<input type="radio" name="userSex" value="2" title="女" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-block">
<div class="upload" id="userPhoto"></div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle">取消</button>
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/syseveuser/'}).use('syseveuseradd');
</script>
</body>
</html>
\ No newline at end of file
......@@ -14,7 +14,7 @@
<div class="layui-form-item">
<label class="layui-form-label">身份证</label>
<div class="layui-input-block">
<input type="text" id="userIdCard" name="userIdCard" win-verify="required|identity" placeholder="请输入身份证" class="layui-input" value="{{userIdCard}}"/>
<input type="text" id="userIdCard" name="userIdCard" placeholder="请输入身份证" class="layui-input" value="{{userIdCard}}"/>
</div>
</div>
<div class="layui-form-item" pane>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册