Browse Source

修复抄送对象

8966 6 years ago
parent
commit
a59740d48d

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

@@ -37,6 +37,9 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 	@Autowired
 	private WxParentsMapper wxParentsMapper;
 
+	@Autowired
+	private WxParentsStuMapper wxParentsStuMapper;
+
 
 	/**
 	 * 获取系统消息和使用帮助
@@ -103,9 +106,14 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsDO.setNotifyId(notifyDO.getNotifyId());
 					notifyrecordsDO.setStuId(l);
 					notifyrecordsMapper.save(notifyrecordsDO);
-					ParentsDO parentsDO = wxParentsMapper.get(l);
-					SchoolDO schoolDO = wxSchoolMapper.get(parentsDO.getSchoolId());
-					this.wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
+					List<ParentsStuDO> parentsStuDOS = wxParentsStuMapper.listByStuId(l);
+					if (parentsStuDOS.size()>0){
+						for (ParentsStuDO ps:parentsStuDOS) {
+							ParentsDO parentsDO = wxParentsMapper.get(ps.getParentId());
+							SchoolDO schoolDO = wxSchoolMapper.get(parentsDO.getSchoolId());
+							this.wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
+						}
+					}
 				}
 			}
 			return "创建成功";

+ 13 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java

@@ -42,6 +42,9 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
 
+	@Autowired
+	private WxParentsStuMapper wxParentsStuMapper;
+
 	/**
 	 * 发布作业
 	 * @param taskString
@@ -74,9 +77,16 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 				SchoolDO schoolDO = wxSchoolMapper.get(schoolId);
 				List<Long> longs = JSON.parseArray(taskNotifier, Long.class);
-				for (Long parentId:longs) {
-					this.wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
-				}
+				for (Long stuId:longs) {
+					List<ParentsStuDO> parentsStuDOS = wxParentsStuMapper.listByStuId(stuId);
+					if (parentsStuDOS.size()>0){
+						for (ParentsStuDO ps:parentsStuDOS) {
+							ParentsDO parentsDO = parentsMapper.get(ps.getParentId());
+							this.wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
+						}
+						}
+					}
+
 			}
 			return "作业发布成功";
 		}else {