Browse Source

1、作业消息推送
2、对外课程组查看
3、课外训练调整

Joburgess 5 years ago
parent
commit
938e687745

+ 4 - 4
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -40,8 +40,8 @@
 			<if test="teacherId != null">
 				AND teacher_id_ = #{teacherId}
 			</if>
-			<if test="organId != null">
-				AND o.id_ = #{organId}
+			<if test="organIdList != null">
+				AND FIND_IN_SET(o.id_, #{organIdList})
 			</if>
 			<if test="studentId != null">
 				AND user_id_ = #{studentId}
@@ -243,8 +243,8 @@
 			<if test="teacherId != null">
 				AND teacher_id_ = #{teacherId}
 			</if>
-			<if test="organId != null">
-				AND o.id_ = #{organId}
+			<if test="organIdList != null">
+				AND FIND_IN_SET(o.id_, #{organIdList})
 			</if>
 			<if test="studentId != null">
 				AND user_id_ = #{studentId}

+ 32 - 5
mec-web/src/main/java/com/ym/mec/web/controller/ExtracurricularExercisesReplyController.java

@@ -1,17 +1,23 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.page.ExtraExercilseReplyQueryInfo;
+import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.biz.dal.page.ExtraExercilseReplyQueryInfo;
-import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
+import java.util.Arrays;
+import java.util.List;
 
 @Api(tags = "课外训练学生作业服务")
 @RequestMapping("extracurricularExercisesReply")
@@ -20,10 +26,31 @@ public class ExtracurricularExercisesReplyController extends BaseController {
 
     @Autowired
     private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "获取课外训练作业列表")
     @GetMapping("/queryPageList")
     private HttpResponseResult findExtraExercilses(ExtraExercilseReplyQueryInfo queryInfo){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+                queryInfo.setOrganIdList(employee.getOrganIdList());
+            } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
+                throw new BizException("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                    throw new BizException("非法请求");
+                }
+            }
+        }
         return succeed(extracurricularExercisesReplyService.findExtraExercises(queryInfo));
     }
 }