Kaynağa Gözat

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

yonge 5 yıl önce
ebeveyn
işleme
8fb02cddc2

+ 0 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java

@@ -11,7 +11,6 @@ import com.keao.edu.im.service.RoomService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-
 import java.util.List;
 
 /**

+ 21 - 19
edu-im/edu-im-server/src/main/java/com/keao/edu/im/mec/im/IMHelper.java

@@ -2,7 +2,7 @@ package com.keao.edu.im.mec.im;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.google.gson.JsonObject;
+import com.keao.edu.common.exception.BizException;
 import com.keao.edu.im.http.HttpHelper;
 import com.keao.edu.im.pojo.IMApiResultInfo;
 import com.keao.edu.im.pojo.IMTokenInfo;
@@ -222,11 +222,10 @@ public class IMHelper {
     /**
      * 开始录制
      * @param hostUserId
-     * @param sessionId
      * @return
      * @throws Exception
      */
-    public IMApiResultInfo startRecord(String hostUserId, String sessionId, String roomId) throws Exception {
+    public IMApiResultInfo startRecord(String hostUserId, String roomId) throws Exception {
         if (hostUserId == null) {
             throw new IllegalArgumentException("Paramer 'userId' is required");
         }
@@ -243,12 +242,12 @@ public class IMHelper {
         jsonObject.put("sliceMin","60");
         jsonObject.put("hostUserId",hostUserId);
         JSONObject json = new JSONObject();
-        json.put("sessionId",sessionId);
+        json.put("sessionId",roomQuery(roomId));
         json.put("config",jsonObject);
 
         String body = json.toJSONString();
 
-        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/x-www-form-urlencoded",roomId);
+        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json",roomId);
         httpHelper.setBodyParameter(body, conn);
 
         return JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
@@ -257,11 +256,10 @@ public class IMHelper {
     /**
      * 结束录制
      * @param hostUserId
-     * @param sessionId
      * @return
      * @throws Exception
      */
-    public IMApiResultInfo stopRecord(String hostUserId, String sessionId, String roomId) throws Exception {
+    public IMApiResultInfo stopRecord(String hostUserId, String roomId) throws Exception {
         if (hostUserId == null) {
             throw new IllegalArgumentException("Paramer 'userId' is required");
         }
@@ -278,12 +276,12 @@ public class IMHelper {
         jsonObject.put("sliceMin","60");
         jsonObject.put("hostUserId",hostUserId);
         JSONObject json = new JSONObject();
-        json.put("sessionId",sessionId);
+        json.put("sessionId",roomQuery(roomId));
         json.put("config",jsonObject);
 
         String body = json.toJSONString();
 
-        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/stop.json", "application/x-www-form-urlencoded",roomId);
+        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/stop.json", "application/json",roomId);
         httpHelper.setBodyParameter(body, conn);
 
         return JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
@@ -295,19 +293,23 @@ public class IMHelper {
      * @return
      * @throws Exception
      */
-    public IMApiResultInfo roomQuery(String roomId) throws Exception {
+    public String roomQuery(String roomId) throws Exception {
         if (StringUtils.isEmpty(roomId)) {
             throw new IllegalArgumentException("Paramer 'roomId' is required");
         }
-
-        StringBuilder sb = new StringBuilder();
-        sb.append("roomId=").append(URLEncoder.encode(roomId, UTF8));
-        String body = sb.toString();
-
-        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/room/query", "application/x-www-form-urlencoded",null);
-        httpHelper.setBodyParameter(body, conn);
-        String returnResult = httpHelper.returnResult(conn, body);
-        return null;
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("roomId",roomId);
+
+        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/room/query.json", "application/json",null);
+        httpHelper.setBodyParameter(jsonObject.toJSONString(), conn);
+        String returnResult = httpHelper.returnResult(conn, jsonObject.toJSONString());
+        JSONObject resultObject = JSONObject.parseObject(returnResult);
+        String code = resultObject.get("code").toString();
+        if("200".equals(code)){
+            return resultObject.get("sessionId").toString();
+        }else {
+            throw new BizException("获取sessionId失败");
+        }
     }
 
 

+ 48 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/pojo/RongCodeEnum.java

@@ -0,0 +1,48 @@
+package com.keao.edu.im.pojo;
+
+import com.keao.edu.common.enums.BaseEnum;
+
+public enum RongCodeEnum implements BaseEnum<String, RongCodeEnum> {
+    NO_IN_ROOM("40001", "操作的用户已经不在该房间了"),
+    internal_error("40002", "服务器内部错误"),
+    NOT_ROOM("40003","没有该房间"),
+    USER_ID_NULL("40004", "用户id是空"),
+    LIMIT_ERROR("40005", "房间人数超过限制"),
+    PARAM_ERROR("40006", "请求的参数错误"),
+    TOKEN_ERROR("40007", "token编解码错误"),
+    DB_ERROR("40008", "暂时没有这个错误的抛出"),
+    JSON_ERROR("40009", "解析json失败"),
+    NOT_OPEN_VOICE_ERROR("400010", "用户没有开通音视频服务"),
+    ROOM_TYPE_ERROR("400011", "加入房间的类型错误"),
+    USER_NOT_HAVE_AUTH("400012", "用户没有被授权(混合云)"),
+    NOT_CONFIG_MCU_ADDRESS("400015", "没有配置混流地址"),
+    NOT_ALLOW_VIDEO_BROADCAST("400016", "不允许开启视频直播"),
+    NOT_ALLOW_VOICE_BROADCAST("400017", "不允许开启音频直播"),
+    GET_TOKEN_FAILED("400018", "生成token失败"),
+    USER_IS_BLOCKED("400021", "用户被封禁");
+
+    private String code;
+
+    private String msg;
+
+    RongCodeEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }}

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

@@ -200,8 +200,8 @@ public class RoomServiceImpl implements RoomService {
         roomResult.setRoomId(roomId);
 
         roomResult.setMembers(roomMemberDao.findByRid(roomId));
-        List<Whiteboard> whiteboardList = whiteboardDao.findByRid(roomId);
-        roomResult.setWhiteboards(whiteboardList);
+//        List<Whiteboard> whiteboardList = whiteboardDao.findByRid(roomId);
+//        roomResult.setWhiteboards(whiteboardList);
         log.info("join success: roomId = {}, userId = {}, userName={}, role = {}", roomId, userId, roleEnum);
         return roomResult;
     }
@@ -304,7 +304,7 @@ public class RoomServiceImpl implements RoomService {
         room.setName(roomName);
         room.setCreateDt(createTime);
         room.setDisplay(display);
-        room.setWhiteboardNameIndex(0);
+//        room.setWhiteboardNameIndex(0);
         try {
             roomDao.save(room);
         }catch (Exception e){
@@ -373,7 +373,7 @@ public class RoomServiceImpl implements RoomService {
                 if (apiResultInfo.getCode() == 200) {
                     roomMemberDao.deleteUserByRidAndUid(roomId, userId);
                     roomDao.deleteByRid(roomId);
-                    deleteWhiteboardByUser(roomId, userId);
+//                    deleteWhiteboardByUser(roomId, userId);
                     log.info("dismiss the room: {},userId: {}", roomId,userId);
                 } else {
                     log.error("{} exit {} room error: {}", userId, roomId, apiResultInfo.getErrorMessage());

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/EmployeeController.java

@@ -28,6 +28,8 @@ public class EmployeeController extends BaseController {
 	@ApiOperation("员工服务分页查询")
 	@GetMapping(value = "/list")
 	public HttpResponseResult<PageInfo<Employee>> getList(EmployeeQueryInfo queryInfo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		queryInfo.setUserId(sysUser.getId());
 		return succeed(employeeService.queryPage(queryInfo));
 	}
 

+ 7 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/SubjectDao.java

@@ -51,4 +51,11 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
      * @return
      */
     String findNames(String subjectIdList);
+
+    /**
+     * 是否有使用中的专业
+     * @param id
+     * @return
+     */
+    int countExamSubject(Integer id);
 }

+ 11 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/EmployeeQueryInfo.java

@@ -3,15 +3,22 @@ package com.keao.edu.user.page;
 import com.keao.edu.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
 
-/**
- * @Author Joburgess
- * @Date 2019/9/17
- */
 public class EmployeeQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "角色ID",required = false)
     private Integer roleId;
 
+    @ApiModelProperty(value = "当前用户",required = false)
+    private Integer userId;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
     public Integer getRoleId() {
         return roleId;
     }

+ 4 - 24
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -149,31 +149,11 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
-		if(Objects.isNull(examOrganizationRelation.getExaminationBasicId())){
-			throw new BizException("请指定考级项目");
-		}
-		if(Objects.isNull(examOrganizationRelation.getOrganId())){
-			throw new BizException("请指定合作单位");
-		}
-		Organization organization = organizationService.get(examOrganizationRelation.getOrganId());
-		if(Objects.isNull(organization)){
-			throw new BizException("合作单位不存在");
-		}
-		examOrganizationRelation.setTenantId(TenantContextHolder.getTenantId().toString());
-		if(Objects.isNull(examOrganizationRelation.getSettlementType())){
-			examOrganizationRelation.setSettlementType(organization.getSettlementType());
-		}
-		if(Objects.isNull(organization.getShareProfitAmount())){
-			examOrganizationRelation.setShareProfitAmount(organization.getShareProfitAmount());
-		}
-		examOrganizationRelation.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
-		examOrganizationRelation.setTotalPaymentAmount(BigDecimal.ZERO);
-		Set<Integer> organIds = examOrganizationRelationDao.getOrganIdsWithExam(examOrganizationRelation.getExaminationBasicId());
-		if(organIds.contains(examOrganizationRelation.getOrganId())){
-			examOrganizationRelationDao.update(examOrganizationRelation);
-		}else{
-			examOrganizationRelationDao.insert(examOrganizationRelation);
+		if(Objects.isNull(examOrganizationRelation.getId())){
+			throw new BizException("参数错误");
 		}
+
+		examOrganizationRelationDao.update(examOrganizationRelation);
 	}
 
 	@Override

+ 15 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/SubjectServiceImpl.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.service.impl;
 
 
 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.dao.SubjectDao;
@@ -39,6 +40,20 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
     @Override
     public void upSetSubject(Subject subject) {
         if(subject.getDelFlag() != null && subject.getDelFlag() == true){
+            Subject subject1 = subjectDao.get(subject.getId());
+            if(subject1.getParentSubjectId() == 0){
+                //是否有子类
+                List<Subject> byParentId = subjectDao.findByParentId(subject1.getParentSubjectId(), YesOrNoEnum.NO, subject.getTenantId());
+                if(byParentId != null && byParentId.size() > 0){
+                    throw new BizException("操作失败:有未删除的专业");
+                }
+            }else {
+                //是否在使用
+                int num = subjectDao.countExamSubject(subject.getId());
+                if(num > 0){
+                    throw new BizException("操作失败:当前专业正在使用");
+                }
+            }
             subjectDao.delete(subject.getId());
             return;
         }

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

@@ -104,7 +104,7 @@
 	</update>
 	<sql id="employeeQueryPage">
 		<where>
-				e.del_flag_ = 0 AND e.tenant_id_ = #{tenantId}
+				e.del_flag_ = 0 AND e.tenant_id_ = #{tenantId} AND e.user_id_ != #{userId}
 			<if test="search != null and search != ''">
 				AND (e.user_id_ = #{search} OR su.phone_ LIKE CONCAT('%',#{search},'%') OR su.real_name_ LIKE CONCAT('%',#{search},'%'))
 			</if>

+ 4 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -136,4 +136,8 @@
           #{subjectId}
       </foreach>
     </select>
+    <select id="countExamSubject" resultType="java.lang.Integer">
+        SELECT COUNT(0) FROM exam_subject es
+        WHERE es.subject_id_ IN (SELECT s.id_ FROM `subject` s WHERE s.id_ = #{id});
+    </select>
 </mapper>