111
k94314517
2023-08-24 06997ad92d77b7dd8a002df16b5b0cadc528d5f5
server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java
@@ -213,10 +213,13 @@
                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【手机号】员工账号已经存!");
            }
            cuu.setPhone(null);
            cuu.setCode(p.getNo());
            if(companyUserService.findOne(cuu) !=null){
                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【工号】已经存!");
            if (StringUtils.isNotBlank(p.getNo())){
                cuu.setCode(p.getNo());
                if(companyUserService.findOne(cuu) !=null){
                    throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【工号】已经存!");
                }
            }
            SystemUser systemUser = new SystemUser();
            systemUser.setUsername(cu.getPhone());
            systemUser.setDeleted(Boolean.FALSE);
@@ -325,10 +328,12 @@
        cu.setDeleted(Constants.ZERO);
        cu.setCreateTime(date);
        cu.setCode("NO."+userParam.getPhone());
        cu.setIsMaster(com.getIsNew());//是否主账号
        cu.setPhoneAuthStatus(Constants.ZERO+"");
        cu.setQrcodeid(barcodeParamExtService.getByType(com.getId(),com.getRootDepartment().getId(),Constants.BARCODEPARAM_TYPE.user)+"");
        cu.setComDepartId(com.getRootDepartment().getId());
        cu.setDepartmentId(com.getRootDepartment().getId());
        cu.setOrigin(userParam.getOrigin());
        if(userParam.getOrigin() == Constants.COMPANY_ORIGIN.lingyang){
            cu.setLingyangUserid(userParam.getUserId());
        }else if(userParam.getOrigin() == Constants.COMPANY_ORIGIN.edgp){
@@ -463,7 +468,6 @@
        if(srList!=null && srList.size()>0){
            List<SystemUserRole> urList = new ArrayList<>();
            for(SystemRole tr :srList){
                SystemUserRole userRole = new SystemUserRole();
                userRole.setUserId(cu.getUserId());
                userRole.setDeleted(false);
@@ -473,7 +477,7 @@
                userRole.setCreateTime(userRole.getInvalidTime());
                userRole.setRemark("羚羊企业生成自动导入");
                urList.add(userRole);
//                    systemUserRoleMapper.insert(userRole);
//              systemUserRoleMapper.insert(userRole);
            }
            systemRoleMapper.insertRoleUserBatch(urList);
        }
@@ -569,10 +573,14 @@
                    throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号已存在!");
                }
            }
            cu.setCode(systemUser.getEmpNo());
            if(companyUserService.findOne(cu) !=null){
                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在");
            //存在工号需要唯一判断
            if (StringUtils.isNotBlank(systemUser.getEmpNo())){
                cu.setCode(systemUser.getEmpNo());
                if(companyUserService.findOne(cu) !=null){
                    throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在");
                }
            }
            cu.setUserId(userId);
            cu.setComDepartId(loginUser.getComDepartment().getId());
            cu.setCreateUser(loginUser.getId());
@@ -688,6 +696,8 @@
                if (codeUser != null && !codeUser.getId().equals(cu.getId())) {
                    throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在");
                }
            }else if (StringUtils.isBlank(systemUser.getEmpNo())) {
                u.setCode(systemUser.getEmpNo());
            }
            u.setId(cu.getId());
            u.setName(systemUser.getRealname());