Commit dad3ad64 by 水库浪子

修改系统登录用户不存在抛异常BUG;修改系统用户删除后重新添加报账号重复BUG;修改企业员工添加无法会显BUG;优化企业员工同步为异步同步;

1 parent 5299b5f7
......@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
......@@ -35,6 +36,7 @@ import java.util.List;
public class WeUserController extends BaseController {
@Autowired
@Lazy
private IWeUserService weUserService;
......
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.model.LoginUser;
import com.linkwechat.common.enums.UserStatus;
import com.linkwechat.common.exception.BaseException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.system.mapper.SysRoleMapper;
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.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,8 +14,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/**
* 用户验证处理
*
......@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
@Autowired
private SysPermissionService permissionService;
@Autowired
private IWeUserService iWeUserService;
@Autowired
private RuoYiConfig ruoYiConfig;
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
@Override
......@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);
throw new BaseException("对不起,您的账号:" + username + " 不存在");
// //企业管理登录
// //查询企业管理相关账号
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
......@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// }
userService.insertUser(
user
);
// userService.insertUser(
// user
// );
}
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
......
......@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<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 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 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>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
......
......@@ -34,7 +34,7 @@ import java.util.Date;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeUser
public class WeUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
......@@ -123,7 +123,7 @@ public class WeUser
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */
@ApiModelProperty("激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除")
private Integer isActivate;
private Integer isActivate=new Integer(4);
/** 离职是否分配(1:已分配;0:未分配;) */
@ApiModelProperty("离职是否分配(1:已分配;0:未分配;)")
......
......@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo;
import com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -17,7 +16,6 @@ import java.util.List;
* @author ruoyi
* @date 2020-08-31
*/
@Repository
public interface WeUserMapper extends BaseMapper<WeUser>
{
/**
......
......@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
@Override
@Transactional
@Async
public void synchWeUser(){
//同步部门
......
......@@ -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="position != null and position != ''"> and position = #{position}</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="qqAccount != null and qqAccount != ''"> and qq_account = #{qqAccount}</if>
<if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!