Explorar o código

1、通知接口修改

guq %!s(int64=6) %!d(string=hai) anos
pai
achega
32c0688996

+ 6 - 7
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxNotifyController.java

@@ -85,19 +85,18 @@ public class WxNotifyController {
 	}*/
 
 	/**
-	 * 家长分页显示
+	 * 分页显示 获取通知 type 0 家长 1 教师
 	 * @param notifyStatus
 	 * @param pageIndex
 	 * @param pageSize
 	 */
 	@GetMapping("/notifyList")
-	public ResultBean notifyList(Long personId, Integer notifyStatus, Integer pageIndex, Integer pageSize){
-		try {
-			List<NotifyDO> notifyDOS = notifyService.notifyList(personId, notifyStatus, pageIndex, pageSize);
-			return new ResultBean(notifyDOS);
-		}catch (Exception e){
-			return new ResultBean(e);
+	public Result notifyList(Long personId, Integer notifyStatus, Integer pageIndex, Integer pageSize, Integer type){
+		if (null == type || null == personId) {
+			throw new BizException(BizExceptionCode.USELESS_DATA);
 		}
+		List<NotifyDO> notifyDOS = notifyService.notifyList(personId, notifyStatus, pageIndex, pageSize, type);
+		return Result.success(notifyDOS);
 	}
 
 /*	*//**

+ 5 - 5
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxNotifyService.java

@@ -31,14 +31,14 @@ public interface WxNotifyService {
 	public String createNotify(String jsonNotify) throws Exception;
 
 
-	/**
+/*	*//**
 	 * 教师分页显示
 	 * @param teacherId
 	 * @param notifyStatus
 	 * @param pageIndex
 	 * @param pageSize
-	 */
-	public Map<String, Object> notifyListByTeacher(@Param("teacherId") Long teacherId, @Param("notifyStatus") Integer notifyStatus, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
+	 *//*
+	public Map<String, Object> notifyListByTeacher(Long teacherId, Integer notifyStatus, Integer pageIndex, Integer pageSize);*/
 
 	/**
 	 * 家长分页显示
@@ -47,7 +47,7 @@ public interface WxNotifyService {
 	 * @param pageIndex
 	 * @param pageSize
 	 */
-	public List<NotifyDO> notifyList(@Param("stuId") Long stuId, @Param("notifyStatus") Integer notifyStatus, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize) throws Exception;
+	public List<NotifyDO> notifyList(Long stuId, Integer notifyStatus, Integer pageIndex, Integer pageSize, Integer type);
 
 	/**
 	 * 家长端获取通知详情
@@ -55,7 +55,7 @@ public interface WxNotifyService {
 	 * @param
 	 * @return
 	 */
-	public NotifyDO getNotifyDetails(@Param("stuId") Long stuId,@Param("notifyId") Long notifyId) throws Exception;
+	public NotifyDO getNotifyDetails( Long stuId, Long notifyId) throws Exception;
 
 	/**
 	 * 教师端获取通知详情

+ 36 - 15
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java

@@ -171,11 +171,11 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 	 * @param pageIndex
 	 * @param pageSize
 	 */
-	public Map<String, Object> notifyListByTeacher(Long teacherId, Integer notifyStatus, Integer pageIndex, Integer pageSize){
-		Map<String, Object> hashMap = new HashMap<>();
+	public List<NotifyDO> notifyListByTeacher(Long teacherId, Integer notifyStatus, Integer pageIndex, Integer pageSize){
+		//Map<String, Object> hashMap = new HashMap<>();
 		Integer pageStart = (pageIndex-1)*pageSize;
-		List<NotifyDO> notifyDOS = notifyMapper.selectNotifyListByCreator(teacherId, notifyStatus, pageStart, pageSize);
-		List<NotifyDO> createList = new ArrayList<>();
+		//List<NotifyDO> notifyDOS = notifyMapper.selectNotifyListByCreator(teacherId, notifyStatus, pageStart, pageSize);
+		/*List<NotifyDO> createList = new ArrayList<>();
 		if (ObjectUtils.isNotEmpty(notifyDOS)){
 			for (NotifyDO nt:notifyDOS) {
 				NotifyDO notifyDO = getNotifyDetail(0L,teacherId, nt);
@@ -183,7 +183,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 				createList.add(notifyDO);
 			}
 		}
-		hashMap.put("create",createList);
+		hashMap.put("create",createList);*/
 
 		List<NotifyDO> notifyList = new ArrayList<>();
 		TeacherDO teacherDO = teacherMapper.get(teacherId);
@@ -195,33 +195,54 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 				notifyList.add(notifyDO);
 			}
 		}
-		hashMap.put("notify",notifyList);
-		return hashMap;
+		//hashMap.put("notify",notifyList);
+		return notifyList;
 	}
 
+
 	/**
 	 * 家长分页显示
-	 * @param personId
+	 * @param stuId
 	 * @param notifyStatus
 	 * @param pageIndex
 	 * @param pageSize
 	 */
-	public List<NotifyDO> notifyList(Long personId, Integer notifyStatus, Integer pageIndex, Integer pageSize) throws Exception {
+	public List<NotifyDO> notifyListByStu(Long stuId, Integer notifyStatus, Integer pageIndex, Integer pageSize) {
 		Integer pageStart = (pageIndex-1)*pageSize;
-		StudentDO studentDO = studentMapper.get(personId);
+		StudentDO studentDO = studentMapper.get(stuId);
+		List<NotifyDO> notifyList = new ArrayList<>();
 		if (ObjectUtils.isNotEmpty(studentDO)){
-			List<NotifyDO> notifyList = new ArrayList<>();
 			List<NotifyDO> notifyDOS = notifyMapper.selectNotifyListSchoolId(studentDO.getSchoolId(), notifyStatus,
 					pageStart, pageSize);
 			for (NotifyDO nt:notifyDOS) {
-				NotifyDO notifyDetail = getNotifyDetail(personId, 0L, nt);
+				NotifyDO notifyDetail = getNotifyDetail(stuId, 0L, nt);
 				notifyList.add(notifyDetail);
 			}
-			return notifyList;
-		}else {
-			throw new Exception("该学生暂时不存在");
 		}
+		return notifyList;
+	}
 
+	/**
+	 * 分页显示
+	 * @param personId
+	 * @param notifyStatus
+	 * @param pageIndex
+	 * @param pageSize
+	 */
+	public List<NotifyDO> notifyList(Long personId, Integer notifyStatus, Integer pageIndex, Integer pageSize, Integer type) {
+		if (null == pageIndex) {
+			pageIndex = 1;
+		}
+		if (null == pageSize) {
+			pageIndex = 10;
+		}
+		List<NotifyDO> notifyList = null;
+		if (0 == type) {
+			notifyList = notifyListByStu(personId, notifyStatus, pageIndex, pageSize);
+		} else {
+			notifyList = notifyListByTeacher(personId, notifyStatus, pageIndex, pageSize);
+		}
+		return notifyList;
 	}
 
 	/**