Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6b41cd9f
authored
May 12, 2021
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改系统登录用户不存在抛异常BUG;修改系统用户删除后重新添加报账号重复BUG;修改企业员工添加无法会显BUG;优化企业员工同步为异步同步;
1 parent
e1bcb9ba
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
33 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
linkwe-framework/src/main/java/com/linkwechat/framework/web/service/UserDetailsServiceImpl.java
linkwe-system/src/main/resources/mapper/system/SysUserMapper.xml
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUser.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
View file @
6b41cd9
...
@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
...
@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
...
@@ -35,6 +36,7 @@ import java.util.List;
...
@@ -35,6 +36,7 @@ import java.util.List;
public
class
WeUserController
extends
BaseController
{
public
class
WeUserController
extends
BaseController
{
@Autowired
@Autowired
@Lazy
private
IWeUserService
weUserService
;
private
IWeUserService
weUserService
;
...
...
linkwe-framework/src/main/java/com/linkwechat/framework/web/service/UserDetailsServiceImpl.java
View file @
6b41cd9
package
com
.
linkwechat
.
framework
.
web
.
service
;
package
com
.
linkwechat
.
framework
.
web
.
service
;
import
cn.hutool.core.util.ArrayUtil
;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.core.domain.entity.SysRole
;
import
com.linkwechat.common.core.domain.entity.SysUser
;
import
com.linkwechat.common.core.domain.entity.SysUser
;
import
com.linkwechat.common.core.domain.model.LoginUser
;
import
com.linkwechat.common.core.domain.model.LoginUser
;
import
com.linkwechat.common.enums.UserStatus
;
import
com.linkwechat.common.enums.UserStatus
;
import
com.linkwechat.common.exception.BaseException
;
import
com.linkwechat.common.exception.BaseException
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.system.mapper.SysRoleMapper
;
import
com.linkwechat.system.service.ISysUserService
;
import
com.linkwechat.system.service.ISysUserService
;
import
com.linkwechat.common.core.domain.entity.WeCorpAccount
;
import
com.linkwechat.wecom.service.IWeCorpAccountService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -23,8 +14,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
...
@@ -23,8 +14,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.stream.Collectors
;
/**
/**
* 用户验证处理
* 用户验证处理
*
*
...
@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
...
@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
@Autowired
@Autowired
private
SysPermissionService
permissionService
;
private
SysPermissionService
permissionService
;
@Autowired
private
IWeUserService
iWeUserService
;
@Autowired
private
RuoYiConfig
ruoYiConfig
;
@Autowired
private
SysRoleMapper
roleMapper
;
@Autowired
private
IWeCorpAccountService
iWeCorpAccountService
;
@Override
@Override
...
@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
...
@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
SysUser
user
=
userService
.
selectUserByUserName
(
username
);
SysUser
user
=
userService
.
selectUserByUserName
(
username
);
if
(
StringUtils
.
isNull
(
user
))
if
(
StringUtils
.
isNull
(
user
))
{
{
log
.
info
(
"登录用户:{} 不存在."
,
username
);
throw
new
BaseException
(
"对不起,您的账号:"
+
username
+
" 不存在"
);
// //企业管理登录
// //企业管理登录
// //查询企业管理相关账号
// //查询企业管理相关账号
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
...
@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
...
@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// .build();
// }
// }
userService
.
insertUser
(
//
userService.insertUser(
user
//
user
);
//
);
}
}
else
if
(
UserStatus
.
DELETED
.
getCode
().
equals
(
user
.
getDelFlag
()))
else
if
(
UserStatus
.
DELETED
.
getCode
().
equals
(
user
.
getDelFlag
()))
{
{
...
...
linkwe-system/src/main/resources/mapper/system/SysUserMapper.xml
View file @
6b41cd9
...
@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
</select>
<select
id=
"checkUserNameUnique"
parameterType=
"String"
resultType=
"int"
>
<select
id=
"checkUserNameUnique"
parameterType=
"String"
resultType=
"int"
>
select count(1) from sys_user where user_name = #{userName} limit 1
select count(1) from sys_user where user_name = #{userName}
and del_flag='0'
limit 1
</select>
</select>
<select
id=
"checkPhoneUnique"
parameterType=
"String"
resultMap=
"SysUserResult"
>
<select
id=
"checkPhoneUnique"
parameterType=
"String"
resultMap=
"SysUserResult"
>
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
and del_flag='0'
limit 1
</select>
</select>
<select
id=
"checkEmailUnique"
parameterType=
"String"
resultMap=
"SysUserResult"
>
<select
id=
"checkEmailUnique"
parameterType=
"String"
resultMap=
"SysUserResult"
>
select user_id, email from sys_user where email = #{email} limit 1
select user_id, email from sys_user where email = #{email}
and del_flag='0'
limit 1
</select>
</select>
<insert
id=
"insertUser"
parameterType=
"SysUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
<insert
id=
"insertUser"
parameterType=
"SysUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUser.java
View file @
6b41cd9
...
@@ -34,7 +34,7 @@ import java.util.Date;
...
@@ -34,7 +34,7 @@ import java.util.Date;
@Builder
@Builder
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
WeUser
public
class
WeUser
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -123,7 +123,7 @@ public class WeUser
...
@@ -123,7 +123,7 @@ public class WeUser
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */
/** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */
@ApiModelProperty
(
"激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除"
)
@ApiModelProperty
(
"激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除"
)
private
Integer
isActivate
;
private
Integer
isActivate
=
new
Integer
(
4
)
;
/** 离职是否分配(1:已分配;0:未分配;) */
/** 离职是否分配(1:已分配;0:未分配;) */
@ApiModelProperty
(
"离职是否分配(1:已分配;0:未分配;)"
)
@ApiModelProperty
(
"离职是否分配(1:已分配;0:未分配;)"
)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserMapper.java
View file @
6b41cd9
...
@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo;
...
@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo;
import
com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo
;
import
com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,7 +16,6 @@ import java.util.List;
...
@@ -17,7 +16,6 @@ import java.util.List;
* @author ruoyi
* @author ruoyi
* @date 2020-08-31
* @date 2020-08-31
*/
*/
@Repository
public
interface
WeUserMapper
extends
BaseMapper
<
WeUser
>
public
interface
WeUserMapper
extends
BaseMapper
<
WeUser
>
{
{
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
View file @
6b41cd9
...
@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService;
...
@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService;
import
com.linkwechat.wecom.service.IWeUserService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
...
@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
*/
@Override
@Override
@Transactional
@Transactional
@Async
public
void
synchWeUser
(){
public
void
synchWeUser
(){
//同步部门
//同步部门
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
View file @
6b41cd9
...
@@ -47,7 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -47,7 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"departmentStr != null and departmentStr != '' "
>
and FIND_IN_SET(#{departmentStr},department)
</if>
<if
test=
"departmentStr != null and departmentStr != '' "
>
and FIND_IN_SET(#{departmentStr},department)
</if>
<if
test=
"position != null and position != ''"
>
and position = #{position}
</if>
<if
test=
"position != null and position != ''"
>
and position = #{position}
</if>
<if
test=
"isLeaderInDept != null "
>
and is_leader_in_dept = #{isLeaderInDept}
</if>
<if
test=
"isLeaderInDept != null "
>
and is_leader_in_dept = #{isLeaderInDept}
</if>
<if
test=
"joinTime != null "
>
and join_time = #{joinTime}
</if>
<if
test=
"beginTime != null and beginTime !='' and endTime !=null and endTime !=''"
>
and DATE_FORMAT(join_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
</if>
<if
test=
"idCard != null and idCard != ''"
>
and id_card = #{idCard}
</if>
<if
test=
"idCard != null and idCard != ''"
>
and id_card = #{idCard}
</if>
<if
test=
"qqAccount != null and qqAccount != ''"
>
and qq_account = #{qqAccount}
</if>
<if
test=
"qqAccount != null and qqAccount != ''"
>
and qq_account = #{qqAccount}
</if>
<if
test=
"telephone != null and telephone != ''"
>
and telephone = #{telephone}
</if>
<if
test=
"telephone != null and telephone != ''"
>
and telephone = #{telephone}
</if>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment