Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/smartschool-platform

guq 6 years ago
parent
commit
e696842e25
17 changed files with 184 additions and 100 deletions
  1. 1 0
      applications/school/school-server/pom.xml
  2. 5 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxMeetingServiceImpl.java
  3. 4 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java
  4. 4 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java
  5. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaLeaveServiceImpl.java
  6. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java
  7. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java
  8. 34 15
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxVoteServiceImpl.java
  9. 5 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java
  10. 69 17
      applications/wechat/wechat-api/pom.xml
  11. 2 1
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WxPushApi.java
  12. 18 0
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java
  13. 3 3
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java
  14. 17 2
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/WechatApplication.java
  15. 2 3
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java
  16. 0 13
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java
  17. 11 19
      applications/wechat/wechat-server/src/main/resources/application.yml

+ 1 - 0
applications/school/school-server/pom.xml

@@ -12,6 +12,7 @@
     <artifactId>school-server</artifactId>
 
     <dependencies>
+
         <dependency>
             <groupId>com.usoftchina.smartschool</groupId>
             <artifactId>server-starter</artifactId>

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

@@ -13,7 +13,7 @@ import com.usoftchina.smartschool.school.wxschool.basic.service.WxMeetingService
 import com.usoftchina.smartschool.school.wxschool.support.RemindTask;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -32,7 +32,7 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 	private WxTeacherMapper teacherMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -80,9 +80,9 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 				meetingRecordsMapper.save(meetingRecordsDO);
 			}
 			Timer timer = new Timer();
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,1,meetingDO), startDate);
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,2,meetingDO), endDate);
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,3,meetingDO), reminderDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,1,meetingDO), startDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,2,meetingDO), endDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,3,meetingDO), reminderDate);
 			return "创建成功";
 		}else {
 			throw new Exception("创建失败,请核查");

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

@@ -6,7 +6,7 @@ import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxNotifyService;
 import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -29,7 +29,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 	private WxStudentMapper studentMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -91,7 +91,7 @@ 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, "点击查看详情", "");
+					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
 				}
 			}
 			List<Long> stuIds = JSON.parseArray(notifyStu, Long.class);
@@ -105,7 +105,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsMapper.save(notifyrecordsDO);
 					ParentsDO parentsDO = wxParentsMapper.get(l);
 					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, "点击查看详情", "");
+					this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
 				}
 			}
 			return "创建成功";

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

@@ -15,7 +15,7 @@ import com.usoftchina.smartschool.school.wxschool.oaBean.Manager;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxOaApproveService;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,7 +35,7 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 	private WxTeacherMapper teacherMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -77,9 +77,9 @@ 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,"点击查看详情","");
+				this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}else {
-				wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
+				this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}
 			return i;
 		}else {

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

@@ -8,7 +8,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxOaLeaveService;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,7 +33,7 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
 	private WxOaLeaveReplyMapper oaLeaveReplyMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -67,7 +67,7 @@ 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(),"-", "点击查看详情", "");
+					this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",studentMapper.get(lvProposer).getStuName(), json.getString("startDate")+"-"+json.getString("endDate"), leave.getLvDetails(),"-", "点击查看详情", "");
 				}
 				return "申请成功";
 			}else {

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

@@ -7,7 +7,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxPrincipalMailboxService;
 import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -37,7 +37,7 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 	private WxSchoolMapper schoolMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	/**
 	 * 校长信箱创建
@@ -55,7 +55,7 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
 			SchoolDO schoolDO = schoolMapper.get(schoolId);
 			TeacherDO teacherDO = teacherMapper.get(principalMailboxDO.getNotifier());
-			wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
+			this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
 			return principalMailboxDO.getMailboxId();
 		}else {
 			throw new Exception("提交失败,请重新提交");

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

@@ -8,7 +8,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -37,7 +37,7 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 	private WxStudentMapper studentMapper;
 
 	@Autowired
-	private WxPushApi wxPushApi;
+	private WxPushService wxPushService;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -75,7 +75,7 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 				SchoolDO schoolDO = wxSchoolMapper.get(schoolId);
 				List<Long> longs = JSON.parseArray(taskNotifier, Long.class);
 				for (Long parentId:longs) {
-					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
+					this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
 				}
 			}
 			return "作业发布成功";

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

@@ -8,10 +8,12 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.support.RemindTaskVote;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -32,6 +34,18 @@ public class WxVoteServiceImpl implements WxVoteService {
 	@Autowired
 	private WxTeacherMapper teacherMapper;
 
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
+
+	@Autowired
+	private WxParentsStuMapper wxParentsStuMapper;
+
+	@Autowired
+	private WxParentsMapper wxParentsMapper;
+
 
 	/** 创建投票单 */
 	public String voteCreate(String voteString) throws Exception {
@@ -79,24 +93,29 @@ public class WxVoteServiceImpl implements WxVoteService {
 				timer.schedule(new RemindTaskVote(voteMapper,vote.getVoteId()),DateFormatUtil.string2Date(voteEndDate));
 			}
 			List<Long> teacherId = JSON.parseArray(teacherIds, Long.class);
-			List<Long> list = removeDuplicate(teacherId);
+			if (ObjectUtils.isNotEmpty(teacherId)){
+				List<Long> list = removeDuplicate(teacherId);
+				for (Long ll:list) {
+					TeacherDO teacherDO = teacherMapper.get(ll);
+					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
+					SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+					this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w","有一个投票单需要您的支持",schoolDO.getSchoolName(),teacherMapper.get(creator).getTeacherName(),format.format(new Date()),vote.getVoteName(),"点击查看详情","");
+				}
+			}
 			List<Long> stuId = JSON.parseArray(stuIds, Long.class);
 			List<Long> list1 = removeDuplicate(stuId);
-			/*for (int j = 0; j <list.size() ; j++) {
-				Long teacherId = list.get(j);
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-				if (ObjectUtils.isNotEmpty(user)){
-					String userOpenid = user.getUserOpenid();
-					if (ObjectUtils.isNotEmpty(userOpenid)){
-						userService.wxPush(userOpenid,"h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w","有一个投票单需要您的支持",schoolMapper.selectSchoolById(userMapper.selectUserById(votes.getLong("creator")).getSchoolId()).getSchName(),userMapper.selectUserById(votes.getLong("creator")).getUserName(),format.format(new Date()),vote.getVoteName(),"点击查看详情","https://www.akuiguoshu.com/smart-school/classRechargeDetail/"+userId+"/"+vote.getVoteId());
-					}*//*else {
-						throw new Exception("请关注智慧校园公众号");
-					}*//*
-				}else {
-					throw new Exception("用户不存在");
+			new ArrayList<Long>();
+			for (Long l:list1) {
+				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());
+						SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+						this.wxPushService.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "有一个投票单需要您的支持", schoolDO.getSchoolName(), teacherMapper.get(creator).getTeacherName(), format.format(new Date()), vote.getVoteName(), "点击查看详情", "");
+					}
 				}
-
-			}*/
+			}
 			return "创建成功";
 		}else {
 			throw new Exception("创建失败");

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

@@ -6,7 +6,7 @@ import com.usoftchina.smartschool.school.po.SchoolDO;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxSchoolMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
-import com.usoftchina.smartschool.wechat.api.WxPushApi;
+import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.SimpleDateFormat;
@@ -21,7 +21,7 @@ public class RemindTask extends TimerTask {
     private WxMeetingMapper meetingMapper;
 
     @Autowired
-    private WxPushApi wxPushApi;
+    private WxPushService wxPushService;
 
     @Autowired
     private WxSchoolMapper wxSchoolMapper;
@@ -33,11 +33,11 @@ public class RemindTask extends TimerTask {
 
     private Integer i;
 
-    public RemindTask(WxTeacherMapper teacherM,WxSchoolMapper wxSchool,WxPushApi wxPushs,WxMeetingMapper nm, Integer ll, MeetingDO meet){//关键点解决 null指针错误,
+    public RemindTask(WxTeacherMapper teacherM,WxSchoolMapper wxSchool,WxPushService wxPushs,WxMeetingMapper nm, Integer ll, MeetingDO meet){//关键点解决 null指针错误,
         teacherMapper = teacherM;
         wxSchoolMapper = wxSchool;
         meetingMapper=nm;
-        wxPushApi = wxPushs;
+        wxPushService = wxPushs;
         meetingDO = meet;
         i= ll;
         }
@@ -53,7 +53,7 @@ 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(),"-", "点击查看详情", "");
+                    this.wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk","您好,您有一条新的会议通知", meetingDO.getMeetingName(),simpleDateFormat.format(meetingDO.getStartDate()),meetingDO.getMeetingAddress(),"-", "点击查看详情", "");
                 }
 
             }

+ 69 - 17
applications/wechat/wechat-api/pom.xml

@@ -11,26 +11,70 @@
 
     <artifactId>wechat-api</artifactId>
 
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
-        <junit.version>4.12</junit.version>
-        <lombok.version>1.16.22</lombok.version>
-    </properties>
-
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>${junit.version}</version>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>wechat-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jdom</groupId>
+            <artifactId>jdom</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.kevinsawicki</groupId>
+            <artifactId>http-request</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>server-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+
+        <!--test-->
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>test-starter</artifactId>
             <scope>test</scope>
         </dependency>
 
+        <!-- db -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <!-- sleuth -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-zipkin</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.amqp</groupId>
+            <artifactId>spring-rabbit</artifactId>
+        </dependency>
         <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <version>${lombok.version}</version>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -41,9 +85,17 @@
             <artifactId>core</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>xstream</artifactId>
-            <version>1.4.9</version>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+        </dependency>
+        <!-- feign -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
         </dependency>
 
     </dependencies>

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

@@ -1,5 +1,6 @@
 package com.usoftchina.smartschool.wechat.api;
 
+/*
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -12,4 +13,4 @@ public interface WxPushApi {
                          @RequestParam("title")String title, @RequestParam("keyword1")String keyword1, @RequestParam("keyword2")String keyword2, @RequestParam("keyword3")String keyword3,
                          @RequestParam("keyword4")String keyword4, @RequestParam("remark")String remark, @RequestParam("url")String url);
 
-}
+}*/

+ 18 - 0
applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java

@@ -0,0 +1,18 @@
+package com.usoftchina.smartschool.wechat.service;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(value = "wechat-server")
+public interface WxPushService {
+
+    /**
+     * 推送消息
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/wxPush", method = RequestMethod.GET)
+    public String wxPush(@RequestParam("appId")String appId, @RequestParam("secret") String secret, @RequestParam("openid") String openid, @RequestParam("templateId")String templateId, @RequestParam("title")String title, @RequestParam("keyword1")String keyword1, @RequestParam("keyword2")String keyword2, @RequestParam("keyword3")String keyword3, @RequestParam("keyword4")String keyword4, @RequestParam("remark")String remark, @RequestParam("url")String url);
+}

+ 3 - 3
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java → applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java

@@ -4,18 +4,18 @@ 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.springframework.stereotype.Service;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 import java.util.HashMap;
 
-@Service
 public class WxPushServiceImpl implements WxPushService{
     /**
      * 推送消息
      * @param
      * @return
      */
-    @Override
     public String wxPush(String appId,String secret,String openid, String templateId, String title, String keyword1, String keyword2, String keyword3, String keyword4, String remark, String url) {
             if (ObjectUtils.isNotEmpty(openid)){
                 String json="{\"touser\":\""+openid+"\","

+ 17 - 2
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/WechatApplication.java

@@ -24,10 +24,25 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @ServletComponentScan
 @MapperScan("com.usoftchina.smartschool.wechat.mapper")
 @EnableEurekaClient
-@EnableFeignClients("com.usoftchina.smartschool")
-public class WechatApplication  {
+@EnableFeignClients("com.usoftchina.smartschool.wechat")
+@ComponentScan(basePackages = {"com.usoftchina.smartschool.wechat"})
+public class WechatApplication  extends WebMvcConfigurerAdapter {
     public static void main(String[] args) {
         SpringApplication.run(WechatApplication.class, args);
     }
 
+    //解决跨域问题
+   /* @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**")
+                .allowedHeaders("*")
+                .allowedOrigins("*")
+                .allowedMethods("*")
+                .allowCredentials(true).maxAge(3600000);
+    }
+
+    @Bean
+    public RestTemplate restTemplate(){
+        return new RestTemplate();
+    }*/
 }

+ 2 - 3
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java

@@ -1,6 +1,5 @@
 package com.usoftchina.smartschool.wechat.controller;
 
-import com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -15,12 +14,12 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 public class WxPushController {
 
-    @Autowired
+   /* @Autowired
     private WxPushService wxPushService;
 
     @PostMapping("/wxpush")
     public String wxPush(@RequestParam("appId")String appId, @RequestParam("secret") String secret, @RequestParam("openid") String openid, @RequestParam("templateId")String templateId, @RequestParam("title")String title, @RequestParam("keyword1")String keyword1, @RequestParam("keyword2")String keyword2, @RequestParam("keyword3")String keyword3, @RequestParam("keyword4")String keyword4, @RequestParam("remark")String remark, @RequestParam("url")String url){
         return wxPushService.wxPush(appId, secret,openid, templateId, title, keyword1, keyword2, keyword3, keyword4, remark, url);
-    };
+    };*/
 
 }

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

@@ -1,13 +0,0 @@
-package com.usoftchina.smartschool.wechat.service;
-
-import org.apache.ibatis.annotations.Param;
-
-public interface WxPushService {
-
-    /**
-     * 推送消息
-     * @param
-     * @return
-     */
-    public String wxPush(@Param("appId")String appId,@Param("secret") String secret,@Param("openid") String openid, @Param("templateId")String templateId, @Param("title")String title, @Param("keyword1")String keyword1, @Param("keyword2")String keyword2, @Param("keyword3")String keyword3, @Param("keyword4")String keyword4, @Param("remark")String remark, @Param("url")String url);
-}

+ 11 - 19
applications/wechat/wechat-server/src/main/resources/application.yml

@@ -7,17 +7,17 @@ spring:
     user:
       name: admin
       password: select111***
-  datasource:
-    driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://10.10.100.166:3306/smart_campus?characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
-    username: root
-    password: select111***
-    hikari:
-      minimum-idle: 5
-      maximum-pool-size: 50
-      idle-timeout: 30000
-      max-lifetime: 1800000
-      connection-timeout: 30000
+  #datasource:
+    #driver-class-name: com.mysql.jdbc.Driver
+    #url: jdbc:mysql://10.10.100.166:3306/smart_campus?characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
+    #username: root
+    #password: select111***
+    #hikari:
+      #minimum-idle: 5
+      #maximum-pool-size: 50
+      #idle-timeout: 30000
+      #max-lifetime: 1800000
+      #connection-timeout: 30000
   messages:
     basename: i18n/messages
     encoding: UTF-8
@@ -39,9 +39,6 @@ spring:
   redis:
     host: 10.10.100.166
     port: 6379
-  jackson:
-    date-format: yyyy-MM-dd HH:mm
-    time-zone: GMT+8
   servlet:
     multipart:
       max-file-size: 100Mb
@@ -76,11 +73,6 @@ info:
   version: '@project.version@'
   spring-boot-version: '@spring.boot.version@'
   spring-cloud-version: '@spring.cloud.version@'
-mybatis:
-  configuration:
-    map-underscore-to-camel-case: true
-  type-aliases-package: com.usoftchina.smartschool.wechat.wxDemo
-  mapper-locations: classpath:mapper/*.xml
 auth:
   public-key: auth/pub.key
 ribbon: