Browse Source

Merge branches 'dev' and 'master' of ssh://10.10.100.21/source/smartschool-platform into dev

FANGLH 7 years ago
parent
commit
2321e5840a
12 changed files with 127 additions and 76 deletions
  1. 2 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java
  2. 12 7
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java
  3. 16 8
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java
  4. 9 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaLeaveServiceImpl.java
  5. 6 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java
  6. 9 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java
  7. 21 13
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxVoteServiceImpl.java
  8. 30 6
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/oaBean/Manager.java
  9. 5 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java
  10. 2 2
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WxPushApi.java
  11. 1 1
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java
  12. 14 22
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java

+ 2 - 4
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java

@@ -9,8 +9,6 @@ import com.usoftchina.smartschool.school.wxschool.basic.service.WxUserService;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
 import com.usoftchina.smartschool.school.wxschool.utils.ResultBean;
 import org.apache.ibatis.annotations.Param;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.Assert;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -148,8 +146,8 @@ public class WxUserController {
 		String encode =null;
 		try {
 			encode = URLEncoder.encode(headimgurl.toString(), "ISO-8859-1");
-			System.err.println("headimgurl======"+headimgurl);
-			System.err.println("encode======"+encode);
+			//System.err.println("headimgurl======"+headimgurl);
+			//System.err.println("encode======"+encode);
 		} catch (UnsupportedEncodingException e) {
 			e.printStackTrace();
 		}

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

@@ -94,7 +94,11 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsMapper.save(notifyrecordsDO);
 					TeacherDO teacherDO = teacherMapper.get(l);
 					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
-					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "https://school-wechat.ubtob.com/notifyDetail/teacher/"+notifyDO.getNotifyId());
+					try {
+						wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "https://school-wechat.ubtob.com/notifyDetail/teacher/"+notifyDO.getNotifyId());
+					}catch (Exception e){
+						e.printStackTrace();
+					}
 				}
 			}
 			List<Long> stuIds = JSON.parseArray(notifyStu, Long.class);
@@ -111,7 +115,11 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 						for (ParentsStuDO ps:parentsStuDOS) {
 							ParentsDO parentsDO = wxParentsMapper.get(ps.getParentId());
 							SchoolDO schoolDO = wxSchoolMapper.get(parentsDO.getSchoolId());
-							wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "https://school-wechat.ubtob.com/notifyDetail/parent/"+notifyDO.getNotifyId());
+							try {
+								wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "https://school-wechat.ubtob.com/notifyDetail/parent/"+notifyDO.getNotifyId());
+							}catch (Exception e){
+								e.printStackTrace();
+							}
 						}
 					}
 				}
@@ -189,9 +197,8 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 			}else {
 				throw new Exception("系统内部错误,请联系管理员");
 			}
-		}else {
-			throw new Exception("通知已被删除,请刷新");
 		}
+		return getNotifyDetail(stuId,0L,notifyDO);
 	}
 
 	/**
@@ -211,10 +218,8 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 			}else {
 				throw new Exception("系统内部错误,请联系管理员");
 			}
-		}else {
-			throw new Exception("通知已被删除,请刷新");
 		}
-
+		return getNotifyDetail(0L,teacherId,notifyDO);
 	}
 
 	/**

+ 16 - 8
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java

@@ -77,15 +77,23 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
                         oaArticlesMapper.save(articles);
                     }
                 }
-                wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
-						"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY", "您有一个待审批事项", approveTitle,
-						teacher.getTeacherName(), format.format(new Date()), approveDetails, "点击查看详情",
-                        "https://school-wechat.ubtob.com/approvel-detail/false/" +oaApprove.getApproveId());
+                try {
+                    wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
+                            "ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY", "您有一个待审批事项", approveTitle,
+                            teacher.getTeacherName(), format.format(new Date()), approveDetails, "点击查看详情",
+                            "https://school-wechat.ubtob.com/approvel-detail/false/" +oaApprove.getApproveId());
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
             } else {
-                wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
-						"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY", "您有一个待审批事项", approveTitle,
-						teacher.getTeacherName(), format.format(new Date()), approveDetails, "点击查看详情",
-                        "https://school-wechat.ubtob.com/approvel-detail/false/" +oaApprove.getApproveId());
+                try {
+                    wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
+                            "ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY", "您有一个待审批事项", approveTitle,
+                            teacher.getTeacherName(), format.format(new Date()), approveDetails, "点击查看详情",
+                            "https://school-wechat.ubtob.com/approvel-detail/false/" +oaApprove.getApproveId());
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
             }
             return i;
         } else {

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

@@ -67,11 +67,15 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
                 for (Long teacherId : longs) {
                     TeacherDO teacherDO = teacherMapper.get(teacherId);
                     SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
-							"QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",
-							studentMapper.get(lvProposer).getStuName(),
-							json.getString("startDate") + "-" + json.getString("endDate"), leave.getLvDetails(), "-",
-							"点击查看详情", "https://school-wechat.ubtob.com/leavedetail/teacher/" + leave.getLvId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
+                                "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",
+                                studentMapper.get(lvProposer).getStuName(),
+                                json.getString("startDate") + "-" + json.getString("endDate"), leave.getLvDetails(), "-",
+                                "点击查看详情", "https://school-wechat.ubtob.com/leavedetail/teacher/" + leave.getLvId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }
                 return "申请成功";
             } else {

+ 6 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java

@@ -44,7 +44,7 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 	 * @return
 	 */
 	public Long principalMailboxCreate(String mailboxString) throws Exception {
-		System.err.println(mailboxString);
+		//System.err.println(mailboxString);
 		PrincipalMailboxDO principalMailboxDO = JSONObject.parseObject(mailboxString, PrincipalMailboxDO.class);
 		Long schoolId = parentsMapper.get(principalMailboxDO.getMailboxCreator()).getSchoolId();
 		principalMailboxDO.setNotifier(schoolMapper.get(schoolId).getTeacherId());
@@ -55,7 +55,11 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
 			SchoolDO schoolDO = schoolMapper.get(schoolId);
 			TeacherDO teacherDO = teacherMapper.get(principalMailboxDO.getNotifier());
-			this.wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
+			try {
+				wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
+			}catch (Exception e){
+				e.printStackTrace();
+			}
 			return principalMailboxDO.getMailboxId();
 		}else {
 			throw new Exception("提交失败,请重新提交");

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

@@ -87,11 +87,15 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
                     if (parentsStuDOS.size() > 0) {
                         for (ParentsStuDO ps : parentsStuDOS) {
                             ParentsDO parentsDO = parentsMapper.get(ps.getParentId());
-                            wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(),
-                                    parentsDO.getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8", taskTitle,
-                                    wxSubjectMapper.get(subjectId).getSubjectName(), format.format(new Date()),
-                                    taskContext, "-", "点击查看详情", "https://school-wechat.ubtob" +
-                                            ".com/assignmentDetail/parent/" + taskNotifyDO.getTaskId());
+                            try {
+                                wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(),
+                                        parentsDO.getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8", taskTitle,
+                                        wxSubjectMapper.get(subjectId).getSubjectName(), format.format(new Date()),
+                                        taskContext, "-", "点击查看详情", "https://school-wechat.ubtob" +
+                                                ".com/assignmentDetail/parent/" + taskNotifyDO.getTaskId());
+                            }catch (Exception e){
+                                e.printStackTrace();
+                            }
                         }
                     }
                 }

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

@@ -103,10 +103,14 @@ public class WxVoteServiceImpl implements WxVoteService {
                     TeacherDO teacherDO = teacherMapper.get(ll);
                     SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
                     SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
-                            "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "有一个投票单需要您的支持", schoolDO.getSchoolName(),
-                            teacherMapper.get(creator).getTeacherName(), format.format(new Date()), vote.getVoteName()
-                            , "点击查看详情", "https://school-wechat.ubtob.com/voteDetail/" + vote.getVoteId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
+                                "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "有一个投票单需要您的支持", schoolDO.getSchoolName(),
+                                teacherMapper.get(creator).getTeacherName(), format.format(new Date()), vote.getVoteName()
+                                , "点击查看详情", "https://school-wechat.ubtob.com/voteDetail/" + vote.getVoteId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }
             }
             List<Long> stuId = JSON.parseArray(stuIds, Long.class);
@@ -119,11 +123,15 @@ public class WxVoteServiceImpl implements WxVoteService {
                         ParentsDO parentsDO = wxParentsMapper.get(ps.getParentId());
                         SchoolDO schoolDO = wxSchoolMapper.get(parentsDO.getSchoolId());
                         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-                        wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), parentsDO.getOpenid()
-                                , "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "有一个投票单需要您的支持",
-                                schoolDO.getSchoolName(), teacherMapper.get(creator).getTeacherName(),
-                                format.format(new Date()), vote.getVoteName(), "点击查看详情",
-                                "https://school-wechat.ubtob.com/voteDetail/" + vote.getVoteId());
+                        try {
+                            wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), parentsDO.getOpenid()
+                                    , "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "有一个投票单需要您的支持",
+                                    schoolDO.getSchoolName(), teacherMapper.get(creator).getTeacherName(),
+                                    format.format(new Date()), vote.getVoteName(), "点击查看详情",
+                                    "https://school-wechat.ubtob.com/voteDetail/" + vote.getVoteId());
+                        }catch (Exception e){
+                            e.printStackTrace();
+                        }
                     }
                 }
             }
@@ -404,14 +412,14 @@ public class WxVoteServiceImpl implements WxVoteService {
 
                         }
                         topic.setVoteOptionsDOS(optionsList);
-                    } else {
+                    } /*else {
                         throw new Exception("投票单没有完成");
-                    }
+                    }*/
                 }
                 vote.setVoteTopicDOS(topics);
-            } else {
+            }/* else {
                 throw new Exception("投票单没有完成");
-            }
+            }*/
             return vote;
         } else {
             throw new Exception("投票单不存在");

+ 30 - 6
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/oaBean/Manager.java

@@ -32,11 +32,23 @@ public class Manager extends Leader {
             SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
             if (i>0){
                 if (1==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"出差",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"出差",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else if (2==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"用品申请",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"用品申请",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else if (4==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"请假",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"TCxxHDaVJWWxKEhJEcpyOoOl4nB75WL9_87-52gmHUg","您好,审批已通过",teacherDO.getTeacherName(),"请假",format.format(new Date()),teacherMapper.get(oaApprove.getApprover()).getTeacherName(),"点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else {
 
                 }
@@ -55,11 +67,23 @@ public class Manager extends Leader {
             SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
             if (i>0){
                 if (1==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","出差",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","出差",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else if(2==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","用品申请",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","用品申请",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else if (4==approveType){
-                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","请假",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    try {
+                        wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"Rs8AcmuluVWDd4uC9L08PDStVNYXJmZrsSCk9xiKxrI","抱歉,您的审批未通过","请假",teacherMapper.get(oaApprove.getApprover()).getTeacherName(),format.format(new Date()),"","点击查看详情","https://school-wechat.ubtob.com/approvel-detail/true/"+oaApprove.getApproveId());
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
                 }else {
 
                 }

+ 5 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java

@@ -56,7 +56,11 @@ public class RemindTask extends TimerTask {
         List<Long> list = removeDuplicate(longs);
         for (Long teacherId:list) {
             SchoolDO schoolDO = wxSchoolMapper.get(meetingDO.getSchoolId());
-            wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk","您好,您有一条新的会议通知", meetingDO.getMeetingName(),simpleDateFormat.format(meetingDO.getStartDate()),meetingDO.getMeetingAddress(),"-", "点击查看详情", "https://school-wechat.ubtob.com/meet-detail/"+meetingDO.getMeetingId());
+            try {
+                wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk", "您好,您有一条新的会议通知", meetingDO.getMeetingName(), simpleDateFormat.format(meetingDO.getStartDate()), meetingDO.getMeetingAddress(), "-", "点击查看详情", "https://school-wechat.ubtob.com/meet-detail/" +teacherId+"/"+ meetingDO.getMeetingId());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
         }else {
 

+ 2 - 2
applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WxPushApi.java

@@ -17,7 +17,7 @@ public interface WxPushApi {
                          @RequestParam("keyword4") String keyword4, @RequestParam("remark") String remark,
                          @RequestParam("url") String url);
 
-    @GetMapping("/getWxAccessToken")
+    /*@GetMapping("/getWxAccessToken")
     public String getWxAccessToken(@RequestParam("appId") String appId, @RequestParam("secret") String secret);
-
+*/
 }

+ 1 - 1
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java

@@ -16,5 +16,5 @@ public interface WxPushService {
                          @Param("keyword3") String keyword3, @Param("keyword4") String keyword4,
                          @Param("remark") String remark, @Param("url") String url);
 
-    public String getWxAccessToken(@Param("appId") String appId, @Param("secret") String secret);
+    /*public String getWxAccessToken(@Param("appId") String appId, @Param("secret") String secret);*/
 }

+ 14 - 22
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java

@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON;
 import com.github.kevinsawicki.http.HttpRequest;
 import com.usoftchina.smartschool.wechat.service.WxPushService;
 import com.usoftchina.smartschool.wechat.wxUtils.ObjectUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -32,13 +30,20 @@ public class WxPushServiceImpl implements WxPushService{
                         + "\"keyword3\":{\"value\":\""+keyword3+"\",\"color\":\"#173177\"},"
                         + "\"keyword4\":{\"value\":\""+keyword4+"\",\"color\":\"#173177\"},"
                         + "\"remark\":{\"value\":\""+remark+"\",\"color\":\"#173177\"}}}";
-                String access_token=  getWxAccessToken(appId,secret);
-                //System.err.println("wxPushAccess_token======" + access_token);
-                HttpRequest hRequest=  HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+access_token)
+                HashMap<String, Object> params=new HashMap<>();
+                params.put("appid", appId);
+                params.put("secret", secret);
+                params.put("grant_type", "client_credential");
+                HttpRequest httpRequest= HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token",params,false);
+                String content=httpRequest.body();
+                //System.err.println("getWxAccessTokenContent======"+content);
+                String token= JSON.parseObject(content).getString("access_token");
+                //System.err.println("getWxAccessTokenToken====="+ token);
+                HttpRequest hRequest=  HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token)
                         .header("Content-Type", "application/json")
                         .send(json.getBytes());
                 String result= hRequest.body();
-                System.err.println("WxPushResult======="+result);
+                //System.err.println("WxPushResult======="+result);
 
 			/*if(JSON.parseObject(result).getInteger("errcode")==0&&JSON.parseObject(result).getString("errmsg").equals("ok")){
 				return "推送成功!";
@@ -52,21 +57,8 @@ public class WxPushServiceImpl implements WxPushService{
             return "已推送";
         }
 
-        public String getWxAccessToken(String appId,String secret){
-            HashMap<String, Object> params=new HashMap<>();
-            params.put("appid", appId);
-            params.put("secret", secret);
-            params.put("grant_type", "client_credential");
-            HttpRequest httpRequest= HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token",params,false);
-            String content=httpRequest.body();
-           // System.err.println("getWxAccessTokenContent======"+content);
-           // HttpRequest response= HttpRequest.get("https://api.weixin.qq.com/sns/oauth2/access_token", params, true);
-            //String result=response.body();
-            //System.err.println("getWxAccessTokenResult======"+result);
-            //String token= JSON.parseObject(result).getString("access_token");
-           // System.err.println("getWxAccessTokenToken====="+token);
-            String token= JSON.parseObject(content).getString("access_token");
-            System.err.println("getWxAccessToken======"+token);
+        /*public String getWxAccessToken(String appId,String secret){
+
             return token;
-        }
+        }*/
 }