Explorar el Código

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan hace 5 años
padre
commit
e1863e2080

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ExtraExercilseQueryInfo.java

@@ -20,7 +20,7 @@ public class ExtraExercilseQueryInfo extends QueryInfo {
 
 	private String title;// 作业标题
 	
-	private Integer organId;
+	private String organIdList;
 
 	private Date assignStartTime;// 布置作业的开始时间
 
@@ -66,12 +66,12 @@ public class ExtraExercilseQueryInfo extends QueryInfo {
 		this.title = title;
 	}
 
-	public Integer getOrganId() {
-		return organId;
+	public String getOrganIdList() {
+		return organIdList;
 	}
 
-	public void setOrganId(Integer organId) {
-		this.organId = organId;
+	public void setOrganIdList(String organIdList) {
+		this.organIdList = organIdList;
 	}
 
 	public Date getAssignStartTime() {

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

@@ -34,8 +34,8 @@
 			<if test="batchNo != null">
 				and batch_no_ = #{batchNo}
 			</if>
-			<if test="organId != null">
-				AND o.id_ = #{organId}
+			<if test="organIdList != null">
+				AND FIND_IN_SET(o.id_, #{organIdList})
 			</if>
 			<if test="assignStartTime != null">
 				AND date(ee.create_time_) &gt;= #{assignStartTime}
@@ -112,7 +112,8 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ExtracurricularExercises" parameterType="map">
-		SELECT ee.*,u.username_,o.name_ organ_name_ FROM extracurricular_exercises ee left join sys_user u on ee.teacher_id_ = u.id_
+		SELECT ee.*,u.real_name_ username_,o.name_ organ_name_
+		FROM extracurricular_exercises ee left join sys_user u on ee.teacher_id_ = u.id_
 		left join teacher t on t.id_ = ee.teacher_id_
 		left join organization o on o.id_ = t.organ_id_
 		<include refid="queryPageCondition"/>

+ 34 - 8
mec-web/src/main/java/com/ym/mec/web/controller/ExtracurricularExercisesController.java

@@ -1,20 +1,25 @@
 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.ExtraExercilseQueryInfo;
+import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.biz.service.ExtracurricularExercisesService;
+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 java.util.Objects;
-
 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.ExtraExercilseQueryInfo;
-import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
-import com.ym.mec.biz.service.ExtracurricularExercisesService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
 
 @Api(tags = "课外训练服务")
 @RequestMapping("extracurricularExercises")
@@ -25,10 +30,31 @@ public class ExtracurricularExercisesController extends BaseController {
     private ExtracurricularExercisesService extracurricularExercisesService;
     @Autowired
     private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "获取课外训练列表")
     @GetMapping("/queryPageList")
     private HttpResponseResult findExtraExercilses(ExtraExercilseQueryInfo 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(extracurricularExercisesService.queryPage(queryInfo));
     }