| @@ -96,7 +96,7 @@ public class HomeController extends BaseController { | |||||
| ResultData data = new ResultData(); | ResultData data = new ResultData(); | ||||
| if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { | if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { | ||||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| try { | try { | ||||
| Subject subject = SecurityUtils.getSubject(); | Subject subject = SecurityUtils.getSubject(); | ||||
| @@ -108,9 +108,6 @@ public class HomeController extends BaseController { | |||||
| info.setBopenId("保密"); | info.setBopenId("保密"); | ||||
| if(StringUtils.isNotBlank(info.getWebOpenId())) { | if(StringUtils.isNotBlank(info.getWebOpenId())) { | ||||
| info.setWebOpenId("保密"); | info.setWebOpenId("保密"); | ||||
| info.setWithWechat(true); | |||||
| } else { | |||||
| info.setWithWechat(false); | |||||
| } | } | ||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| @@ -118,7 +115,7 @@ public class HomeController extends BaseController { | |||||
| } | } | ||||
| data.data = info; | data.data = info; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.USER_PASSWD_ERR); | |||||
| } | } | ||||
| return data; | return data; | ||||
| } | } | ||||
| @@ -160,7 +157,7 @@ public class HomeController extends BaseController { | |||||
| } else { | } else { | ||||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | ||||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| } | } | ||||
| @@ -174,9 +171,6 @@ public class HomeController extends BaseController { | |||||
| info.setBopenId("保密"); | info.setBopenId("保密"); | ||||
| if(StringUtils.isNotBlank(info.getWebOpenId())) { | if(StringUtils.isNotBlank(info.getWebOpenId())) { | ||||
| info.setWebOpenId("保密"); | info.setWebOpenId("保密"); | ||||
| info.setWithWechat(true); | |||||
| } else { | |||||
| info.setWithWechat(false); | |||||
| } | } | ||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| @@ -184,7 +178,7 @@ public class HomeController extends BaseController { | |||||
| } | } | ||||
| data.data = info; | data.data = info; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.USER_PASSWD_ERR); | |||||
| } | } | ||||
| return data; | return data; | ||||
| } | } | ||||
| @@ -248,9 +242,6 @@ public class HomeController extends BaseController { | |||||
| info.setBopenId("保密"); | info.setBopenId("保密"); | ||||
| if(StringUtils.isNotBlank(info.getWebOpenId())) { | if(StringUtils.isNotBlank(info.getWebOpenId())) { | ||||
| info.setWebOpenId("保密"); | info.setWebOpenId("保密"); | ||||
| info.setWithWechat(true); | |||||
| } else { | |||||
| info.setWithWechat(false); | |||||
| } | } | ||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| @@ -258,7 +249,7 @@ public class HomeController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(info); | return new ResultData(info); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.USER_PASSWD_ERR); | |||||
| } | } | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | ||||
| @@ -105,7 +105,6 @@ public class WechatLoginController extends BaseController { | |||||
| info.setPassword("保密"); | info.setPassword("保密"); | ||||
| info.setBopenId("保密"); | info.setBopenId("保密"); | ||||
| info.setWebOpenId("保密"); | info.setWebOpenId("保密"); | ||||
| info.setWithWechat(true); | |||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| info.setMenus(menus); | info.setMenus(menus); | ||||
| @@ -189,7 +188,6 @@ public class WechatLoginController extends BaseController { | |||||
| info.setPassword("保密"); | info.setPassword("保密"); | ||||
| info.setBopenId("保密"); | info.setBopenId("保密"); | ||||
| info.setWebOpenId("保密"); | info.setWebOpenId("保密"); | ||||
| info.setWithWechat(true); | |||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| info.setMenus(menus); | info.setMenus(menus); | ||||
| @@ -59,6 +59,7 @@ public enum ErrorCode{ | |||||
| /** | /** | ||||
| * 用户2000-2099 | * 用户2000-2099 | ||||
| */ | */ | ||||
| USER_PASSWD_ERR(1987, "用户名或者密码错误"), | |||||
| USER_IS_MULTI(1988, "有多个手机号,请联系富茂管理员"), | USER_IS_MULTI(1988, "有多个手机号,请联系富茂管理员"), | ||||
| USER_IS_NOT_MEMBER(1989,"用户还未授权手机号成为会员"), | USER_IS_NOT_MEMBER(1989,"用户还未授权手机号成为会员"), | ||||
| USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | ||||
| @@ -71,16 +71,18 @@ public class MallUserInfo implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | ||||
| private String nickName; | private String nickName; | ||||
| @io.swagger.annotations.ApiModelProperty(value="手机",name="phone") | |||||
| @io.swagger.annotations.ApiModelProperty(value="手机,系统内手机号唯一",name="phone") | |||||
| private String phone; | private String phone; | ||||
| /** B端用户微信openid,领导看数据塔台用 */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="bopenId",name="bopenId") | |||||
| @io.swagger.annotations.ApiModelProperty(value="B端用户微信openid,领导看数据塔台用",name="bopenId") | |||||
| private String bopenId; | private String bopenId; | ||||
| /** B端用户微信openid,领导看数据塔台用 */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="webOpenId",name="webOpenId") | |||||
| @io.swagger.annotations.ApiModelProperty(value="admin用户微信登录用,可绑定多个账户",name="webOpenId") | |||||
| private String webOpenId; | private String webOpenId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="0 未绑定wechat,1绑定微信",name="withWechat") | |||||
| private Integer withWechat; | |||||
| @Transient | @Transient | ||||
| private Long roleId; | private Long roleId; | ||||
| @@ -99,9 +101,6 @@ public class MallUserInfo implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String captcha; | private String captcha; | ||||
| @Transient | |||||
| private boolean withWechat; | |||||
| /**1合同审批 2账单审批**/ | /**1合同审批 2账单审批**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="1合同审批 2账单审批",name="flowPermission") | @io.swagger.annotations.ApiModelProperty(value="1合同审批 2账单审批",name="flowPermission") | ||||
| private String flowPermission; | private String flowPermission; | ||||
| @@ -218,11 +217,11 @@ public class MallUserInfo implements Serializable { | |||||
| this.captcha = captcha; | this.captcha = captcha; | ||||
| } | } | ||||
| public boolean isWithWechat() { | |||||
| public Integer getWithWechat() { | |||||
| return withWechat; | return withWechat; | ||||
| } | } | ||||
| public void setWithWechat(boolean withWechat) { | |||||
| public void setWithWechat(Integer withWechat) { | |||||
| this.withWechat = withWechat; | this.withWechat = withWechat; | ||||
| } | } | ||||
| @@ -15,15 +15,18 @@ | |||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | ||||
| <result column="with_wechat" jdbcType="INTEGER" property="withWechat"/> | |||||
| <result column="flow_permission" property="flowPermission"/> | <result column="flow_permission" property="flowPermission"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allSafeColumns"> | <sql id="allSafeColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`flow_permission` | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`flow_permission`, | |||||
| isnull(`web_open_id`) has_wechat | |||||
| </sql> | </sql> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`bopen_id`,`web_open_id`,`flow_permission` | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`flow_permission`, | |||||
| `bopen_id`,`web_open_id`,isnull(`web_open_id`) has_wechat | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -208,6 +211,7 @@ | |||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | ||||
| <result column="with_wechat" jdbcType="INTEGER" property="withWechat"/> | |||||
| <result column="flow_permission" property="flowPermission"/> | <result column="flow_permission" property="flowPermission"/> | ||||
| <result column="mall_name" jdbcType="VARCHAR" property="mallName"/> | <result column="mall_name" jdbcType="VARCHAR" property="mallName"/> | ||||
| @@ -218,11 +222,13 @@ | |||||
| <sql id="allSafeVColumns"> | <sql id="allSafeVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | ||||
| isnull(u.`web_open_id`) with_wechat, | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | ||||
| </sql> | </sql> | ||||
| <sql id="allVColumns"> | <sql id="allVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | ||||
| u.`bopen_id`,u.`web_open_id`,isnull(u.`web_open_id`) with_wechat | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | ||||
| </sql> | </sql> | ||||
| @@ -85,29 +85,23 @@ public class HomeController extends BaseController { | |||||
| ResultData data = new ResultData(); | ResultData data = new ResultData(); | ||||
| if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { | if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { | ||||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| try { | try { | ||||
| Subject subject = SecurityUtils.getSubject(); | Subject subject = SecurityUtils.getSubject(); | ||||
| UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); | UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); | ||||
| subject.login(token); | subject.login(token); | ||||
| // List<MallRole> roleList = sysRoleService.findRoleByUserId(user.getId()); | |||||
| // if (null != roleList && roleList.size() > 0) { | |||||
| // List<MallPermission> permissionList = sysPermissionService | |||||
| // .findPermissionByRoleIds(roleList.stream().map(MallRole::getId).collect(Collectors.toList())); | |||||
| // user.setRole(roleList); | |||||
| // user.setPermission(permissionList); | |||||
| // } | |||||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | ||||
| info.setPassword("保密"); | info.setPassword("保密"); | ||||
| // System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); | |||||
| info.setBopenId("保密"); | |||||
| info.setWebOpenId("保密"); | |||||
| String menus = mallUserRoleService.getPermissionsByUser(info); | String menus = mallUserRoleService.getPermissionsByUser(info); | ||||
| if(menus != null) { | if(menus != null) { | ||||
| info.setMenus(menus); | info.setMenus(menus); | ||||
| } | } | ||||
| data.data = info; | data.data = info; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||||
| return new ResultData(ErrorCode.USER_PASSWD_ERR); | |||||
| } | } | ||||
| return data; | return data; | ||||
| } | } | ||||