“djh”
2 天以前 cf1fc0bcd00d62c0eed7934a21949edcab8849fb
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
@@ -14,13 +14,16 @@
import com.gkhy.exam.common.utils.RedisUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.common.utils.StringUtils;
import com.gkhy.exam.system.domain.ExStudent;
import com.gkhy.exam.system.domain.SysUserRole;
import com.gkhy.exam.system.mapper.SysUserMapper;
import com.gkhy.exam.system.mapper.SysUserRoleMapper;
import com.gkhy.exam.system.service.ExStudentService;
import com.gkhy.exam.system.service.SysConfigService;
import com.gkhy.exam.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.Validator;
import java.util.ArrayList;
@@ -49,6 +52,9 @@
    private Validator validator;
    @Autowired
    private SysUserRoleMapper userRoleMapper;
    @Autowired
    private ExStudentService exStudentService;
    @Override
    public CommonPage<SysUser> selectUserList(SysUser user) {
@@ -132,7 +138,16 @@
    }
    @Override
    @Transactional(rollbackFor = RuntimeException.class)
    public int addUser(SysUser user) {
        ExStudent exStudent = new ExStudent();
        exStudent.setCompanyId(user.getCompanyId());
        exStudent.setName(user.getName());
        exStudent.setPassword(user.getPassword());
        exStudent.setDeptId(user.getDeptId());
        exStudent.setDuty(user.getDuty());
        exStudent.setSex(user.getSex());
        exStudent.setPhone(user.getPhone());
        checkRequestData(user);
        checkUserAllowed(user);
        user.setCreateBy(SecurityUtils.getUsername());
@@ -145,6 +160,8 @@
        userRoleList.add(sysUserRole);
        userRoleMapper.batchUserRole(userRoleList);
        exStudentService.insertStudent(exStudent);
        if(row<1){
            throw new ApiException("新增用户失败");
        }