Преглед на файлове

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
周箭河 преди 5 години
родител
ревизия
80b59370b9
променени са 23 файла, в които са добавени 232 реда и са изтрити 33 реда
  1. 2 1
      edu-common/src/main/java/com/keao/edu/common/controller/BaseController.java
  2. 4 3
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java
  3. 25 0
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/pojo/EventType.java
  4. 6 0
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java
  5. 4 6
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/RoomService.java
  6. 2 2
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePluginContext.java
  7. 1 0
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/Student.java
  8. 6 5
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TenantInfoController.java
  9. 8 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/TenantInfoDao.java
  10. 30 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/TenantInfoDto.java
  11. 3 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamRegistration.java
  12. 11 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java
  13. 8 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/TenantInfoService.java
  14. 2 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/UploadFileService.java
  15. 4 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java
  16. 11 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java
  17. 3 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentExamResultServiceImpl.java
  18. 63 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java
  19. 4 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/EmployeeMapper.xml
  20. 2 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
  21. 1 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/StudentMapper.xml
  22. 1 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/SysUserMapper.xml
  23. 31 3
      edu-user/edu-user-server/src/main/resources/config/mybatis/TenantInfoMapper.xml

+ 2 - 1
edu-common/src/main/java/com/keao/edu/common/controller/BaseController.java

@@ -74,7 +74,8 @@ public class BaseController {
 		} else if (e instanceof AccessDeniedException) {
 			return failed("禁止访问");
 		}
-		return failed("系统繁忙");
+//		return failed("系统繁忙");
+		return failed(e.getMessage());
 	}
 
 }

+ 4 - 3
edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java

@@ -58,9 +58,9 @@ public class RoomController{
     public Object statusSync(@RequestBody String body) throws Exception {
         ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
         log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        boolean result = false;
+//        boolean result = false;
         if(notify.getEvent() == 12 || notify.getEvent() == 3){
-            result = roomService.statusSync(notify.getChannelId(), notify.getUserId());
+//            result = roomService.statusSync(notify.getChannelId(), notify.getUserId());
         }else if(notify.getEvent() == 11){
 //            Teacher teacher = teacherDao.get(Integer.parseInt(notify.getUserId()));
 //            Long roomId = Long.parseLong(notify.getChannelId().substring(1));
@@ -71,7 +71,8 @@ public class RoomController{
 //                roomService.joinRoom(teacher.getUsername(),roomId.toString(),false,false);
 //            }
         }
-        return new BaseResponse<>(result);
+        roomService.onChannelNotify(notify);
+        return new BaseResponse<>();
     }
 
     @RequestMapping(value = "/downgrade", method = RequestMethod.POST)

+ 25 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/pojo/EventType.java

@@ -0,0 +1,25 @@
+package com.keao.edu.im.pojo;
+
+public class EventType {
+
+	//整个会场状态同步
+	public static final int CHANNEL_SYNC = 1;
+	//会场创建
+	public static final int CHANNEL_CREATED = 2;
+	//会场销毁
+	public static final int CHANNEL_DESTROYED = 3;
+	//人员加入会场
+	public static final int MEMBER_JOINED = 11;
+	//人员离开会场
+	public static final int MEMBER_LEFT = 12;
+	//人员被踢出会场(暂时不支持)
+	public static final int MEMBER_KICKED = 13;
+	//人员改变角色(暂时不支持)
+	public static final int MEMBER_TYPE_UPDATED = 14;
+	//人员发布资源
+	public static final int PUBLISH_RESOURCE = 20;
+	//人员取消发布资源
+	public static final int UNPUBLISH_RESOURCE = 21;
+	//资源状态发生改变
+	public static final int RESOURCE_STATE_CHANGED = 22;
+}

+ 6 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -1323,6 +1324,11 @@ public class RoomServiceImpl implements RoomService {
         return true;
     }
 
+    @Override
+    public void onChannelNotify(ChannelStateNotify notify) throws IOException {
+
+    }
+
     /*@Override
     public void sendImPlayMidiMessage(PlayMidiMessageData playMidiMessageData) throws Exception {
         SysUser sysUser = sysUserFeignService.queryUserInfo();

+ 4 - 6
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/RoomService.java

@@ -1,14 +1,10 @@
 package com.keao.edu.im.service;
 
+import java.io.IOException;
 import java.util.List;
 
 import com.keao.edu.im.common.ApiException;
-import com.keao.edu.im.pojo.DeviceTypeEnum;
-import com.keao.edu.im.pojo.PlayMidiMessageData;
-import com.keao.edu.im.pojo.ReqChangeUserRoleData;
-import com.keao.edu.im.pojo.ReqDeviceControlData;
-import com.keao.edu.im.pojo.ReqMemberOnlineStatus;
-import com.keao.edu.im.pojo.RoomResult;
+import com.keao.edu.im.pojo.*;
 
 /**
  * Created by super_zou on 2019/11/28.
@@ -84,4 +80,6 @@ public interface RoomService {
      * 发送节拍器自定义消息
      */
 //    void sendImPlayMidiMessage(PlayMidiMessageData playMidiMessageData);
+
+    void onChannelNotify(ChannelStateNotify notify) throws IOException;
 }

+ 2 - 2
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePluginContext.java

@@ -15,7 +15,7 @@ public class StoragePluginContext {
 	
 	public static void addStoragePlugin(StoragePlugin storagePlugin) {
 		if (mapper.containsKey(storagePlugin.getName())) {
-			throw new ThirdpartyException("消息提供方:{}不存在", storagePlugin.getName());
+			throw new ThirdpartyException("存储插件:{}已存在", storagePlugin.getName());
 		}
 		mapper.put(storagePlugin.getName(), storagePlugin);
 	}
@@ -29,7 +29,7 @@ public class StoragePluginContext {
 		StoragePlugin storagePlugin = mapper.get(storagePluginName);
 
 		if (storagePlugin == null) {
-			throw new ThirdpartyException("消息提供方:{}不存在", storagePluginName);
+			throw new ThirdpartyException("存储插件:{}不存在", storagePluginName);
 		}
 
 		return storagePlugin;

+ 1 - 0
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/Student.java

@@ -34,6 +34,7 @@ public class Student extends SysUser{
 		user.setPhone(phone);
 		user.setRealName(phone);
 		this.sysUser = user;
+		this.setRealName(phone);
 	}
 
 	public Student() {

+ 6 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TenantInfoController.java

@@ -8,6 +8,7 @@ import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.tenant.TenantContextHolder;
+import com.keao.edu.user.dto.TenantInfoDto;
 import com.keao.edu.user.entity.TenantInfo;
 import com.keao.edu.user.service.TenantInfoService;
 import io.swagger.annotations.Api;
@@ -30,8 +31,8 @@ public class TenantInfoController extends BaseController {
 	
 	@ApiOperation("机构服务分页查询")
 	@GetMapping(value = "/list")
-	public HttpResponseResult<PageInfo<TenantInfo>> getList(QueryInfo queryInfo) {
-		return succeed(tenantInfoService.queryPage(queryInfo));
+	public HttpResponseResult<PageInfo<TenantInfoDto>> getList(QueryInfo queryInfo) {
+		return succeed(tenantInfoService.queryTenants(queryInfo));
 	}
 
 	@ApiOperation("查询机构详情")
@@ -43,21 +44,21 @@ public class TenantInfoController extends BaseController {
 
 	@ApiOperation("新增机构")
 	@PostMapping(value = "/add")
-	public HttpResponseResult add(TenantInfo tenantInfo) {
+	public HttpResponseResult add(@RequestBody TenantInfoDto tenantInfo) {
 		tenantInfoService.addTenant(tenantInfo);
 		return succeed();
 	}
 
 	@ApiOperation("更新机构")
 	@PostMapping(value = "/update")
-	public HttpResponseResult update(TenantInfo tenantInfo) {
+	public HttpResponseResult update(@RequestBody TenantInfoDto tenantInfo) {
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if(!sysUser.getIsSuperAdmin()){
 			String tenantId = TenantContextHolder.getTenantId().toString();
 			tenantInfo.setId(Integer.parseInt(tenantId));
 		}
 		tenantInfo.setUpdateTime(new Date());
-		tenantInfoService.update(tenantInfo);
+		tenantInfoService.updateTenant(tenantInfo);
 		return succeed();
 	}
 

+ 8 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/TenantInfoDao.java

@@ -1,8 +1,14 @@
 package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.TenantInfoDto;
 import com.keao.edu.user.entity.TenantInfo;
 
+import java.util.List;
+import java.util.Map;
+
 public interface TenantInfoDao extends BaseDAO<Integer, TenantInfo> {
-	
-}
+
+    List<TenantInfoDto> queryTenants(Map<String, Object> params);
+    int countTenants(Map<String, Object> params);
+}

+ 30 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/TenantInfoDto.java

@@ -0,0 +1,30 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.user.entity.TenantInfo;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.07
+ */
+public class TenantInfoDto extends TenantInfo {
+
+    private String roleIds;
+
+    private String roleNames;
+
+    public String getRoleIds() {
+        return roleIds;
+    }
+
+    public void setRoleIds(String roleIds) {
+        this.roleIds = roleIds;
+    }
+
+    public String getRoleNames() {
+        return roleNames;
+    }
+
+    public void setRoleNames(String roleNames) {
+        this.roleNames = roleNames;
+    }
+}

+ 3 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamRegistration.java

@@ -25,7 +25,7 @@ public class ExamRegistration {
 	private Integer studentId;
 
 	@ApiModelProperty(value = "学员基本信息")
-	private SysUser sysUser;
+	private Student sysUser;
 
 	@ApiModelProperty(value = "合作单位编号")
 	private Integer organId;
@@ -117,11 +117,11 @@ public class ExamRegistration {
 		this.status = status;
 	}
 
-	public SysUser getSysUser() {
+	public Student getSysUser() {
 		return sysUser;
 	}
 
-	public void setSysUser(SysUser sysUser) {
+	public void setSysUser(Student sysUser) {
 		this.sysUser = sysUser;
 	}
 

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java

@@ -8,6 +8,8 @@ import com.keao.edu.user.dto.ExamRoomDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 
+import java.util.List;
+
 public interface ExamRoomService extends BaseService<Long, ExamRoom> {
 
     /**
@@ -61,4 +63,13 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @return com.keao.edu.user.dto.ExamRoomStatisticsDto
      */
     ExamRoomStatisticsDto getExamRoomStatisticsInfo(Integer organId, Integer examId);
+
+    /**
+     * @describe 教师教室冲突检测
+     * @author Joburgess
+     * @date 2020.07.07
+     * @param examRooms:
+     * @return void
+     */
+    void checkRoomTeachers(List<ExamRoom> examRooms);
 }

+ 8 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/TenantInfoService.java

@@ -1,10 +1,17 @@
 package com.keao.edu.user.service;
 
+import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.dto.TenantInfoDto;
 import com.keao.edu.user.entity.TenantInfo;
 
 public interface TenantInfoService extends BaseService<Integer, TenantInfo> {
 
-    void addTenant(TenantInfo tenantInfo);
+    void addTenant(TenantInfoDto tenantInfo);
+
+    void updateTenant(TenantInfoDto tenantInfoDto);
+
+    PageInfo<TenantInfoDto> queryTenants(QueryInfo queryInfo);
 
 }

+ 2 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/UploadFileService.java

@@ -3,6 +3,7 @@ package com.keao.edu.user.service;
 import com.keao.edu.common.entity.UploadReturnBean;
 import com.keao.edu.common.exception.BizException;
 import com.keao.edu.thirdparty.storage.StoragePluginContext;
+import com.keao.edu.thirdparty.storage.provider.AliyunOssStoragePlugin;
 import com.keao.edu.thirdparty.storage.provider.QiniuKodoStoragePlugin;
 import com.keao.edu.util.upload.UploadUtil;
 import com.keao.edu.thirdparty.storage.StoragePlugin;
@@ -67,7 +68,7 @@ public class UploadFileService {
 			return uploadReturn;
 		}
 
-		String url = storagePluginContext.uploadFile(QiniuKodoStoragePlugin.PLUGIN_NAME,staticFloder + folder, file);
+		String url = storagePluginContext.uploadFile(AliyunOssStoragePlugin.PLUGIN_NAME,staticFloder + folder, file);
 
 		FileUtils.deleteQuietly(file);
 

+ 4 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -157,9 +157,13 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
 
             List<Integer> subjectIds = dataList.stream().map(ExamRegistration::getSubjectId).collect(Collectors.toList());
             Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
+
+            List<Integer> studentIds = dataList.stream().map(ExamRegistration::getStudentId).collect(Collectors.toList());
+            Map<Integer, String> idPhotoMap = this.getMap("student", "user_id_", "certificate_photo_", studentIds, Integer.class, String.class);
             for (ExamRegistration examRegistration : dataList) {
                 examRegistration.setOrganization(new Organization(examRegistration.getOrganId(), organIdNameMap.get(examRegistration.getOrganId())));
                 examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getSubjectId()));
+                examRegistration.getSysUser().setCertificatePhoto(idPhotoMap.get(examRegistration.getSubjectId()));
                 examRegistration.setExaminationBasic(new ExaminationBasic(examRegistration.getExaminationBasicId(), examIdNameMap.get(examRegistration.getExaminationBasicId())));
             }
         }

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -25,6 +25,7 @@ import com.keao.edu.user.service.OrganizationService;
 import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -180,4 +181,14 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
         return examRoomStatisticsInfo;
 	}
+
+	@Override
+	public void checkRoomTeachers(List<ExamRoom> examRooms) {
+		List<String> days=new ArrayList<>();
+		for (ExamRoom examRoom : examRooms) {
+			if(Objects.nonNull(examRoom.getExamStartTime())){
+//				days.add(DateUtils)
+			}
+		}
+	}
 }

+ 3 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentExamResultServiceImpl.java

@@ -5,6 +5,7 @@ import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.api.entity.Student;
 import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.dao.StudentExamResultDao;
 import com.keao.edu.user.dto.StudentExamResultStatisticsDto;
@@ -61,7 +62,8 @@ public class StudentExamResultServiceImpl extends BaseServiceImpl<Long, StudentE
 			Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
 			Map<Integer, String> organIdNameMap = this.getMap("organization", "id_", "name_", organIds, Integer.class, String.class);
 			for (StudentExamResult s : dataList) {
-				s.getExamRegistration().setSysUser(new SysUser(s.getStudentId(), studentIdNameMap.get(s.getStudentId())));
+				Student student=new Student(s.getStudentId(), studentIdNameMap.get(s.getStudentId()));
+				s.getExamRegistration().setSysUser(student);
 				s.getExamRegistration().setSubject(new Subject(s.getExamRegistration().getSubjectId(), subjectIdNameMap.get(s.getExamRegistration().getSubjectId())));
 				s.getExamRegistration().setOrganization(new Organization(s.getExamRegistration().getOrganId(), organIdNameMap.get(s.getExamRegistration().getSubjectId())));
 			}

+ 63 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java

@@ -3,6 +3,8 @@ package com.keao.edu.user.service.impl;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
+import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.im.api.client.ImFeignService;
 import com.keao.edu.im.api.entity.ImResult;
@@ -11,17 +13,23 @@ import com.keao.edu.user.dao.EmployeeDao;
 import com.keao.edu.user.dao.OrganizationDao;
 import com.keao.edu.user.dao.SysUserDao;
 import com.keao.edu.user.dao.TenantInfoDao;
+import com.keao.edu.user.dto.TenantInfoDto;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.entity.TenantInfo;
 import com.keao.edu.user.enums.YesOrNoEnum;
 import com.keao.edu.user.service.TenantInfoService;
+import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo> implements TenantInfoService {
@@ -43,7 +51,8 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 	}
 
 	@Override
-	public void addTenant(TenantInfo tenantInfo) {
+	@Transactional(rollbackFor = Exception.class)
+	public void addTenant(TenantInfoDto tenantInfo) {
 		if(StringUtils.isBlank(tenantInfo.getContactPhone())){
 			throw new BizException("请填写手机号码");
 		}
@@ -58,10 +67,15 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 		sysUser.setTenantId(tenantInfo.getId().toString());
 		sysUser.setPassword(new BCryptPasswordEncoder().encode("123456"));
 		sysUser.setUserType("SYSTEM");
-		sysUser.setRealName(tenantInfo.getName());
+		sysUser.setRealName(tenantInfo.getContactName());
 		sysUser.setAvatar(tenantInfo.getLogoUrl());
 		sysUser.setPhone(tenantInfo.getContactPhone());
+		sysUser.setRoles(tenantInfo.getSysUser().getRoles());
 		sysUserDao.insert(sysUser);
+		if(StringUtils.isNotBlank(tenantInfo.getRoleIds())){
+			List<Integer> roleIds = Arrays.stream(tenantInfo.getRoleIds().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+			sysUserDao.batchAddEmployeeRole(sysUser.getId(), roleIds);
+		}
 
 		Organization organ=new Organization();
 		organ.setUserId(sysUser.getId());
@@ -86,4 +100,50 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 		sysUser.setImToken(imResult.getToken());
 		sysUserDao.update(sysUser);
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateTenant(TenantInfoDto newTenantInfo) {
+		TenantInfo existTenantInfo = tenantInfoDao.get(newTenantInfo.getId());
+		if(Objects.isNull(existTenantInfo)){
+			throw new BizException("机构不存在");
+		}
+		SysUser sysUser = sysUserDao.queryByPhone(existTenantInfo.getContactPhone());
+		if(Objects.isNull(sysUser)){
+			throw new BizException("机构账户不存在");
+		}
+		if(StringUtils.isNotBlank(newTenantInfo.getRoleIds())){
+			List<Integer> roleIds = Arrays.stream(newTenantInfo.getRoleIds().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+			//删除当前用户角色
+			sysUserDao.delEmployeeRole(sysUser.getId());
+			//新增用户角色
+			sysUserDao.batchAddEmployeeRole(sysUser.getId(),roleIds);
+		}
+		if(StringUtils.isNotBlank(newTenantInfo.getContactName())){
+			sysUser.setRealName(newTenantInfo.getContactName());
+		}
+		if(StringUtils.isNotBlank(newTenantInfo.getContactPhone())){
+			sysUser.setPhone(newTenantInfo.getContactPhone());
+		}
+		sysUserDao.update(sysUser);
+		imFeignService.update(new ImUserModel(sysUser.getId().toString(),sysUser.getRealName(),sysUser.getAvatar()));
+		tenantInfoDao.update(newTenantInfo);
+	}
+
+	@Override
+	public PageInfo<TenantInfoDto> queryTenants(QueryInfo queryInfo) {
+		PageInfo<TenantInfoDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<TenantInfoDto> dataList = new ArrayList<>();
+		int count = tenantInfoDao.countTenants(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = tenantInfoDao.queryTenants(params);
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 4 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -30,7 +30,10 @@
 
     <!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="Employee" >
-		SELECT * FROM employee WHERE user_id_ = #{userId} 
+		SELECT e.*,su.*,sur.role_id_ FROM employee e
+		LEFT JOIN sys_user su ON e.user_id_ = su.id_
+		LEFT JOIN sys_user_role sur ON e.user_id_ = sur.id_
+		WHERE e.user_id_ = #{userId}
 	</select>
 	
 	<!-- 全查询 -->

+ 2 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -148,6 +148,8 @@
 			er.card_no_,
 			er.student_id_,
 			su.real_name_ sys_user_real_name_,
+			er.last_exam_certificate_url_,
+			er.last_music_theory_certificate_url_,
 			er.level_fee_,
 			er.theory_level_fee_,
 			er.organ_id_,

+ 1 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentMapper.xml

@@ -6,7 +6,7 @@
 -->
 <mapper namespace="com.keao.edu.user.dao.StudentDao">
 	
-	<resultMap type="com.keao.edu.user.api.entity.Student" id="Student">
+	<resultMap type="com.keao.edu.user.api.entity.Student" id="Student" extends="com.keao.edu.user.dao.SysUserDao.SysUser">
 		<result column="user_id_" property="userId" />
 		<result column="certificate_photo_" property="certificatePhoto" />
 		<result column="create_time_" property="createTime" />

+ 1 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -30,6 +30,7 @@
         <result column="wechat_id_" property="wechatId"/>
         <result column="is_super_admin_" property="isSuperAdmin"/>
         <result column="tenant_id_" property="tenantId"/>
+        <collection property="roles" ofType="int" column="role_id_"/>
     </resultMap>
 
     <resultMap id="BaseUserInfoDto" type="com.keao.edu.user.dto.BaseUserInfoDto">

+ 31 - 3
edu-user/edu-user-server/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -17,6 +17,11 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
+
+	<resultMap id="TenantInfoDto" type="com.keao.edu.user.dto.TenantInfoDto" extends="TenantInfo">
+		<result column="role_ids_" property="roleIds"/>
+		<result column="role_names_" property="roleNames"/>
+	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="TenantInfo" >
@@ -74,15 +79,17 @@
 	<sql id="queryPageCondition">
 		<where>
 			<if test="search!=null">
-				AND (id_=#{search} OR name_	LIKE CONCAT(#{search}, '%'))
+				AND (ti.id_=#{search} OR ti.name_	LIKE CONCAT(#{search}, '%'))
 			</if>
 		</where>
 	</sql>
 
 	<select id="queryPage" resultMap="TenantInfo" parameterType="map">
-		SELECT * FROM tenant_info
+		SELECT
+			ti.*
+		FROM tenant_info
 		<include refid="queryPageCondition"/>
-		ORDER BY id_ DESC
+		ORDER BY ti.id_ DESC
 		<include refid="global.limit"/>
 	</select>
 	
@@ -91,4 +98,25 @@
 		SELECT COUNT(*) FROM tenant_info
 		<include refid="queryPageCondition"/>
 	</select>
+
+	<select id="queryTenants" resultMap="TenantInfoDto" parameterType="map">
+		SELECT
+			ti.*,
+			GROUP_CONCAT(sr.id_) role_ids_,
+			GROUP_CONCAT(sr.role_name_) role_names_
+		FROM tenant_info ti
+		LEFT JOIN sys_user su ON ti.contact_phone_ = su.phone_
+		LEFT JOIN sys_user_role sur ON sur.user_id_ = su.id_
+		LEFT JOIN sys_role sr ON sr.id_ = sur.role_id_
+		<include refid="queryPageCondition"/>
+		GROUP BY ti.id_
+		ORDER BY ti.id_ DESC
+		<include refid="global.limit"/>
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="countTenants" resultType="int">
+		SELECT COUNT(*) FROM tenant_info
+		<include refid="queryPageCondition"/>
+	</select>
 </mapper>