Bladeren bron

用户管理

xubh 5 jaren geleden
bovenliggende
commit
a2ebe120be

+ 23 - 28
src/main/java/com/minpay/huicai/system/action/UserManageAction.java

@@ -13,6 +13,7 @@ import com.minpay.common.format.IFormatService;
 import com.minpay.common.service.ILogService;
 import com.minpay.common.service.IPublicService;
 import com.minpay.common.util.CommonUtil;
+import com.minpay.common.util.RegexUtil;
 import com.minpay.db.table.mapper.ImLogonCtrlMapper;
 import com.minpay.db.table.mapper.ImRoleItemRelMapper;
 import com.minpay.db.table.mapper.ImUserMapper;
@@ -26,6 +27,7 @@ import com.minpay.db.table.model.ImUserExample;
 import com.minpay.db.table.model.ImUserRoleRelExample;
 import com.minpay.db.table.model.ImUserRoleRelKey;
 import com.minpay.db.table.own.mapper.UserMapper;
+import com.mysql.jdbc.StringUtils;
 import com.startup.minpay.frame.business.IMINAction;
 import com.startup.minpay.frame.business.MINHttpServletRequestContext;
 import com.startup.minpay.frame.business.res.MINActionResult;
@@ -40,6 +42,7 @@ import com.startup.minpay.frame.session.MINSession;
 import com.startup.minpay.frame.target.MINAction;
 import com.startup.minpay.frame.target.MINComponent;
 import com.startup.minpay.frame.target.MINParam;
+import com.startup.minpay.frame.target.MINValidator;
 import com.startup.minpay.util.DateTime;
 import com.startup.minpay.util.Str;
 
@@ -70,7 +73,6 @@ public class UserManageAction implements IMINAction {
 	 * @param roleid
 	 * @param branchid
 	 * @param agent
-	 * @param school
 	 * @param name
 	 * @param logonname
 	 * @param stt
@@ -96,12 +98,13 @@ public class UserManageAction implements IMINAction {
 		MINActionResult res = new MINActionResult();
 		User user = session.getUser();
 		
-		String channel = user.getChannel();
-		
 		// 创建查询条件
 		Map<String, String> p = new HashMap<String, String>();
 		//设置所属机构筛选条件
-		p.put("branchid", branchid);
+		if(!user.getBranchId().equals(Constant.DEFAULT_INSTITUTIONS)){
+			p.put("branchid", user.getBranchId());
+		}
+
 		p.put("dates", dates);
 		
 		if (!Str.isEmptyMaskNull(roleid)) {
@@ -116,10 +119,7 @@ public class UserManageAction implements IMINAction {
 		if (!Str.isEmptyMaskNull(stt)) {
 			p.put("stt", stt);
 		}
-		if(!Constant.CHANNEL_ADMIN.equals(channel)){//非平台渠道增加当前渠道查询条件
-			p.put("channel", channel);
-		}
-		
+
 		p.put("userType", ServConstant.IM_USER_TYPE_ADM);//平台用户
 		
 		MINRowBounds rows = new MINRowBounds(page, limit);
@@ -146,7 +146,6 @@ public class UserManageAction implements IMINAction {
 	 * @param logonname
 	 * @param stt
 	 * @param roleid
-	 * @param mobile
 	 * @param phone
 	 * @param email
 	 * @param address
@@ -230,7 +229,6 @@ public class UserManageAction implements IMINAction {
 	 * @param logonname
 	 * @param roleid
 	 * @param branchid
-	 * @param mobile
 	 * @param phone
 	 * @param email
 	 * @param address
@@ -252,7 +250,7 @@ public class UserManageAction implements IMINAction {
 			@MINParam(key = "address") String address,
 			@MINParam(key = "certtype") String certtype,
 			@MINParam(key = "certno") String certno,
-			@MINParam(key = "channel") String channel,
+			@MINParam(key = "branchid") String branchid,
 			@MINParam(key = "isCustManage") String isCustManage,
 			MINSession session
 			) throws MINBusinessException {
@@ -262,19 +260,6 @@ public class UserManageAction implements IMINAction {
 		id = Constant.PREFIX_USER + id;//增加前缀
 		//获取当前用户渠道
 		User sUser = session.getUser();
-		String userChannel = sUser.getChannel();
-		channel = "M01";
-		if(Constant.CHANNEL_ADMIN.equals(userChannel)){
-			//校验渠道号
-			if(CommonUtil.isEmpty(channel) ){
-				throw new BusinessCodeException("JINM0112");
-			}
-		}
-		//获取渠道,平台的话取页面传递的参数,非平台取当前用户所属渠道
-		String uChannel = Constant.CHANNEL_ADMIN.equals(userChannel)?channel:userChannel;
-//		//新渠道用户统一使用固定角色 10000002 渠道管理员  TODO 需要确定10000002的权限是否满足
-		String roleId = Constant.CHANNEL_ADMIN.equals(userChannel)?roleid:"10000002";//10000002 渠道管理员 
-//		//当新增用户为客户经理时   校验所选角色有客户经理中心菜单
 		// 检查用户名
 		ImUserExample iue = new ImUserExample();
 		iue.createCriteria().andLogonnameEqualTo(logonname);
@@ -291,11 +276,11 @@ public class UserManageAction implements IMINAction {
 		}
 		// 插入用户角色
 		ImUserRoleRelKey record = new ImUserRoleRelKey();
-		record.setRoleid(roleId);
+		record.setRoleid(roleid);
 		record.setUserid(id);
 		Service.lookup(IMINDataBaseService.class).getMybatisMapper(ImUserRoleRelMapper.class).insert(record);
 		//获取默认机构
-		String branchid = Constant.DEFAULT_INSTITUTIONS;
+
 		// 添加用户
 		email = email.toLowerCase();
 		ImUser user = new ImUser();
@@ -319,12 +304,22 @@ public class UserManageAction implements IMINAction {
 		user.setInitpwd(Constant.DEFAULT_PASSWORD_STATUE);
 		user.setInitauthpwd(Constant.DEFAULT_PASSWORD_STATUE);
 		user.setAuthpwd(encryedPwd);
-		user.setChannel(uChannel);//设置用户渠道 多渠道改造
 		Service.lookup(IMINDataBaseService.class).insert(ImUserMapper.class, user);
-		String logInfo = "新增操作员,姓名:" + name +",登录名:"+logonname +",渠道:"+uChannel;
+		String logInfo = "新增操作员,姓名:" + name +",登录名:"+logonname;
 		Service.lookup(ILogService.class).logging(session, logInfo);
 		return res;
 	}
+	@MINValidator(value = USER_ADD)
+	public MINActionResult userAddValidator(
+			@MINParam(key ="branchid", regex = RegexUtil.NOT_NULL, error = "请选择机构") String branchid,
+			@MINParam(key = "roleid", regex = RegexUtil.NOT_NULL, error = "请选择角色") String roleid,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+
+
+
 	/**
 	 * 删除用户
 	 * @param id

+ 33 - 4
src/main/webapp/admin/userManage/addUser.html

@@ -43,11 +43,11 @@
 	           </div>
 			</div>
 			<div class="layui-form-item">
-	            <label class="layui-form-label" style = "width: 150px;">*是否为客户经理:</label>
-	            <div class="layui-input-inline" id ="isCustManage">
+				<label class="layui-form-label" style = "width: 150px;">*商户:</label>
+				<div class="layui-input-inline" id ="branchSelect">
 				</div>
 			</div>
-	        <div class="layui-form-item">
+			<div class="layui-form-item">
 	            <div class="layui-inline">
 	                <label class="layui-form-label" style = "width: 150px;">*手机号:</label>
 	                <div class="layui-input-inline">
@@ -148,7 +148,12 @@
                     if (isEmpty(value)) {
                  		return   '请选择角色!';
                  	} 
-                }
+                },
+				branchSelect: function(value) {
+					if (isEmpty(value)) {
+						return   '请选择商户!';
+					}
+				}
             });
            
             form.verify({
@@ -183,6 +188,30 @@
                 return false;
 			});
         });
+		$.request({
+			action : 'RoleManageAction/roleQueryBranch',
+			data : { },
+			success : function(data) {
+				var selectName ="branchid";
+				var html1 = '<select lay-verify="branchid" name="';
+				html1 = html1 + selectName;
+				html1 = html1 + '" lay-filter="';
+				html1 = html1 + '"';
+				html1 = html1 + '><option value="">请选择</option>';
+				$.each(data.MINQueryResult, function(i, j) {
+					html1 = html1 + '<option ';
+					html1 = html1 + 'value="';
+					html1 = html1 + j.id + '">';
+					html1 = html1 + j.name+ '</option>';
+					//objSelect.options.add(new Option(j.id,j.name));
+					// $("#zcySelect").options.add(new Option(j.name,j.name));
+					// $("#zcySelect").append("<option value="+j.id+">"+j.name+"</option>");
+				})
+				html1 = html1 + '</select>';
+				$("#branchSelect").html(html1);
+				form.render();
+			},
+		});
         initSelect('isCustManage', "IS_SUSTOMER_MANAGER", "isCustManage", '00', true);
     </script>
 </body>

+ 0 - 5
src/main/webapp/admin/userManage/editUser.html

@@ -40,11 +40,6 @@
            	</div>
         </div>
 		<div class="layui-form-item">
-            <label class="layui-form-label" style = "width: 150px;">*是否为客户经理:</label>
-            <div class="layui-input-inline" id ="isCustManage">
-			</div>
-		</div>
-		<div class="layui-form-item">
             <label class="layui-form-label" style = "width: 150px;">状态:</label>
             <div class="layui-input-inline" id ="stt">
            	</div>