Browse Source

修改部分接口对接

koul 7 years ago
parent
commit
47b437bd0b
33 changed files with 447 additions and 362 deletions
  1. 4 0
      applications/school/school-server/pom.xml
  2. 3 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/ClazzCurriculumDO.java
  3. 2 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxClazzCurriculumController.java
  4. 3 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxOutInRecordController.java
  5. 5 10
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxTaskNotifyController.java
  6. 9 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java
  7. 1 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxClazzCurriculumService.java
  8. 0 15
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxOaLeaveService.java
  9. 2 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxOutInRecordService.java
  10. 0 14
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxPrincipalMailboxService.java
  11. 2 17
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxTaskNotifyService.java
  12. 115 38
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxClazzCurriculumServiceImpl.java
  13. 9 10
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxClazzServiceImpl.java
  14. 13 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxMeetingServiceImpl.java
  15. 24 10
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java
  16. 20 6
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java
  17. 12 45
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaLeaveServiceImpl.java
  18. 26 7
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOutInRecordServiceImpl.java
  19. 9 43
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java
  20. 39 49
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java
  21. 3 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTaskReplyMapper.java
  22. 3 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTeacherClazzMapper.java
  23. 45 6
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java
  24. 4 1
      applications/school/school-server/src/main/resources/application.yml
  25. 1 1
      applications/school/school-server/src/main/resources/mapper/WxTaskNotifyMapper.xml
  26. 9 1
      applications/school/school-server/src/main/resources/mapper/WxTaskReplyMapper.xml
  27. 4 0
      applications/school/school-server/src/main/resources/mapper/WxTeacherClazzMapper.xml
  28. 0 12
      applications/wechat/wechat-server/pom.xml
  29. 13 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/WxPushService.java
  30. 61 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java
  31. 0 60
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/wxUtils/WxPushUtil.java
  32. 1 3
      applications/wechat/wechat-server/src/main/resources/application.yml
  33. 5 0
      pom.xml

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

@@ -78,6 +78,10 @@
             <artifactId>poi-ooxml</artifactId>
         </dependency>
         <!--webAPP-->
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>wechat-server</artifactId>
+        </dependency>
         <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>

+ 3 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/ClazzCurriculumDO.java

@@ -1,5 +1,6 @@
 package com.usoftchina.smartschool.school.po;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -40,8 +41,10 @@ public class ClazzCurriculumDO implements Serializable {
 	private Long curSat;
 	private String curSatSubject;
 	//开始时间
+	@JsonFormat(pattern = "HH:mm")
 	private Date curStartTime;
 	//结束时间
+	@JsonFormat(pattern = "HH:mm")
 	private Date curEndTime;
 	//状态  1使用   0草稿
 	private Integer curStatus;

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

@@ -40,8 +40,8 @@ public class WxClazzCurriculumController {
 	@GetMapping("/curriculumListByTeacherId")
 	public ResultBean curriculumListByTeacherId(@Param("teacherId") Long teacherId, @Param("curStatus")Integer curStatus){
 		try {
-			List<ClazzCurriculumDO> curriculumDOS = clazzCurriculumService.selectCurriculumByTeacherId(teacherId, curStatus);
-			return new ResultBean(curriculumDOS);
+			Map<String, Object> map = clazzCurriculumService.selectCurriculumByTeacherId(teacherId, curStatus);
+			return new ResultBean(map);
 		}catch (Exception e){
 			return new ResultBean(e);
 		}

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

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 出入校通知表; InnoDB free: 5120 kB
@@ -36,8 +37,8 @@ public class WxOutInRecordController {
 	@PostMapping("/getOutgoingList")
 	public ResultBean getOutgoingList(@Param("stuId") Long stuId, @Param("pageIndex")Integer pageIndex, @Param("pageSize")Integer pageSize){
 		try {
-			List<OutInRecordDO> outInRecordDOS = outInRecordService.selectRecordOutgoingListByStuId(stuId, pageIndex, pageSize);
-			return new ResultBean(outInRecordDOS);
+			Map<String, Object> map = outInRecordService.selectRecordOutgoingListByStuId(stuId, pageIndex, pageSize);
+			return new ResultBean(map);
 		}catch (Exception e){
 			return new ResultBean(e);
 		}

+ 5 - 10
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxTaskNotifyController.java

@@ -35,12 +35,8 @@ public class WxTaskNotifyController {
 	public ResultBean createTask(String taskString){
 		try {
 			Assert.notNull(taskString,"请填入相应的数据");
-			int task = taskNotifyService.createTask(taskString);
-			if (task>0){
-				return new ResultBean("创建成功");
-			}else {
-				return new ResultBean("创建失败");
-			}
+			String task = taskNotifyService.createTask(taskString);
+			return new ResultBean(task);
 		}catch (Exception e){
 			return new ResultBean(e);
 		}
@@ -83,12 +79,11 @@ public class WxTaskNotifyController {
 	/**
 	 *家长端获取作业详情
 	 * @param taskId
-	 * @param stuId
 	 */
-	@PostMapping("/taskDetailStu")
-	public ResultBean taskDetailStu(@Param("taskId")Long taskId, @Param("stuId")Long stuId){
+	@PostMapping("/taskDetail")
+	public ResultBean taskDetail(Long taskId){
 		try {
-			Map<String, Object> map = taskNotifyService.taskDetailStu(taskId, stuId);
+			Map<String, Object> map = taskNotifyService.taskDetail(taskId);
 			return new ResultBean(map);
 		}catch (Exception e){
 			return new ResultBean(e);

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

@@ -124,8 +124,16 @@ public class WxUserController {
 		params.put("grant_type", "authorization_code");
 		HttpRequest response= HttpRequest.get("https://api.weixin.qq.com/sns/oauth2/access_token", params, true);
 		String result=response.body();
+
 		String openid= JSON.parseObject(result).getString("openid");
-		//String token= JSON.parseObject(result).getString("access_token");
+		String token= JSON.parseObject(result).getString("access_token");
+		HashMap<String, Object> param=new HashMap<>();
+		param.put("openid",openid);
+		param.put("access_token",token);
+		param.put("lang","zh_CN");
+		HttpRequest res= HttpRequest.get("https://api.weixin.qq.com/cgi-bin/user/info", param, true);
+		String body = res.body();
+		System.err.println(body);
 		return  new ModelAndView("redirect:https://school-wechat.ubtob.com/bindMenu/open/"+openid);
 	}
 

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

@@ -1,9 +1,7 @@
 package com.usoftchina.smartschool.school.wxschool.basic.service;
 
-import com.usoftchina.smartschool.school.po.ClazzCurriculumDO;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -29,5 +27,5 @@ public interface WxClazzCurriculumService {
 	 * @param curStatus
 	 * @return
 	 */
-	List<ClazzCurriculumDO> selectCurriculumByTeacherId(@Param("teacherId") Long teacherId, @Param("curStatus") Integer curStatus) throws Exception;
+	Map<String, Object> selectCurriculumByTeacherId(@Param("teacherId") Long teacherId, @Param("curStatus") Integer curStatus) throws Exception;
 }

+ 0 - 15
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxOaLeaveService.java

@@ -14,21 +14,6 @@ import java.util.Map;
  * @date 2019-01-16 16:26:25
  */
 public interface WxOaLeaveService {
-	
-	OaLeaveDO get(Long lvId);
-	
-	List<OaLeaveDO> list(Map<String, Object> map);
-	
-	int count(Map<String, Object> map);
-	
-	int save(OaLeaveDO oaLeave);
-	
-	int update(OaLeaveDO oaLeave);
-	
-	int remove(Long lvId);
-	
-	int batchRemove(Long[] lvIds);
-
 
 	/**
 	 * 请假条提交

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

@@ -3,7 +3,7 @@ package com.usoftchina.smartschool.school.wxschool.basic.service;
 import com.usoftchina.smartschool.school.po.OutInRecordDO;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
+import java.util.Map;
 
 /**
  * 出入校通知表; InnoDB free: 5120 kB
@@ -21,7 +21,7 @@ public interface WxOutInRecordService {
 	 * @param pageSize
 	 * @return
 	 */
-	public List<OutInRecordDO> selectRecordOutgoingListByStuId(@Param("stuId") Long stuId, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
+	public Map<String, Object> selectRecordOutgoingListByStuId(@Param("stuId") Long stuId, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
 
 	/**
 	 * 通知详情

+ 0 - 14
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxPrincipalMailboxService.java

@@ -14,20 +14,6 @@ import java.util.Map;
  * @date 2019-01-16 16:26:26
  */
 public interface WxPrincipalMailboxService {
-	
-	PrincipalMailboxDO get(Long mailboxId);
-	
-	List<PrincipalMailboxDO> list(Map<String, Object> map);
-	
-	int count(Map<String, Object> map);
-	
-	int save(PrincipalMailboxDO principalMailbox);
-	
-	int update(PrincipalMailboxDO principalMailbox);
-	
-	int remove(Long mailboxId);
-	
-	int batchRemove(Long[] mailboxIds);
 
 	/**
 	 * 校长信箱创建

+ 2 - 17
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxTaskNotifyService.java

@@ -14,27 +14,13 @@ import java.util.Map;
  * @date 2019-01-16 16:26:29
  */
 public interface WxTaskNotifyService {
-	
-	TaskNotifyDO get(Long taskId);
-	
-	List<TaskNotifyDO> list(Map<String, Object> map);
-	
-	int count(Map<String, Object> map);
-	
-	int save(TaskNotifyDO taskNotify);
-	
-	int update(TaskNotifyDO taskNotify);
-	
-	int remove(Long taskId);
-	
-	int batchRemove(Long[] taskIds);
 
 	/**
 	 * 发布作业
 	 * @param taskString
 	 * @return
 	 */
-	public int createTask(String taskString);
+	public String createTask(String taskString) throws Exception;
 
 	/**
 	 * 教师端获取作业列表
@@ -57,9 +43,8 @@ public interface WxTaskNotifyService {
 	/**
 	 *家长端获取作业详情
 	 * @param taskId
-	 * @param stuId
 	 */
-	public Map<String, Object> taskDetailStu(@Param("taskId") Long taskId, @Param("stuId") Long stuId);
+	public Map<String, Object> taskDetail(Long taskId);
 
 	/**
 	 * 教师端获取作业详情

+ 115 - 38
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxClazzCurriculumServiceImpl.java

@@ -1,9 +1,8 @@
 package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
-import com.usoftchina.smartschool.school.wxschool.mapper.WxClazzCurriculumMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxClazzMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxStudentMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxSubjectMapper;
+import com.usoftchina.smartschool.school.po.TeacherClazzDO;
+import com.usoftchina.smartschool.school.po.TeacherDO;
+import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.po.ClazzCurriculumDO;
 import com.usoftchina.smartschool.school.po.StudentDO;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxClazzCurriculumService;
@@ -23,29 +22,28 @@ public class WxClazzCurriculumServiceImpl implements WxClazzCurriculumService {
 	private WxClazzCurriculumMapper clazzCurriculumMapper;
 
 	@Autowired
-	private WxStudentMapper studentMapper;
+	private WxSubjectMapper subjectMapper;
 
 	@Autowired
-	private WxClazzMapper clazzMapper;
+	private WxTeacherMapper wxTeacherMapper;
 
 	@Autowired
-	private WxSubjectMapper subjectMapper;
+	private WxTeacherClazzMapper wxTeacherClazzMapper;
 
 	@Override
 	public Map<String, Object> selectCurriculumByStuId(Long stuId, Integer curStatus) throws Exception {
 		List<ClazzCurriculumDO> curricula = clazzCurriculumMapper.selectCurriculumByStuId(stuId, curStatus);
 		if (ObjectUtils.isNotEmpty(curricula)){
-			Map<String, Object> maps = new HashMap<>();
-			StudentDO studentDO = studentMapper.get(stuId);
-			if (ObjectUtils.isNotEmpty(studentDO)){
-				maps.put("stuName",studentDO.getStuName());
-				maps.put("clazzName",clazzMapper.get(studentDO.getClazzId()).getClazzName());
-				getCurr(curricula,subjectMapper);
-				maps.put("curricula",curricula);
-			}else {
-				throw new Exception("该学生不存在,请联系管理员");
-			}
-			return maps;
+			//Map<String, Object> maps = new HashMap<>();
+			//StudentDO studentDO = studentMapper.get(stuId);
+			//if (ObjectUtils.isNotEmpty(studentDO)){
+				//maps.put("stuName",studentDO.getStuName());
+				//maps.put("clazzName",clazzMapper.get(studentDO.getClazzId()).getClazzName());
+				//maps.put("curricula",curricula);
+			//}else {
+				//throw new Exception("该学生不存在,请联系管理员");
+			//}
+			return getCurr(curricula);
 		}else {
 			throw new Exception("暂时没有课程表,请联系管理员");
 		}
@@ -53,10 +51,10 @@ public class WxClazzCurriculumServiceImpl implements WxClazzCurriculumService {
 	}
 
 	@Override
-	public List<ClazzCurriculumDO> selectCurriculumByTeacherId(Long teacherId, Integer curStatus) throws Exception {
+	public Map<String, Object> selectCurriculumByTeacherId(Long teacherId, Integer curStatus) throws Exception {
 		List<ClazzCurriculumDO> curricula = clazzCurriculumMapper.selectCurriculumByteacherId(teacherId, curStatus);
 		if (ObjectUtils.isNotEmpty(curricula)){
-			return getCurr(curricula,subjectMapper);
+			return getCurr(curricula);
 		}else {
 			throw new Exception("暂无数据");
 		}
@@ -67,26 +65,105 @@ public class WxClazzCurriculumServiceImpl implements WxClazzCurriculumService {
 	/**
 	 * 写入科目信息
 	 * @param curricula
-	 * @param subjectMapper
 	 * @return
 	 */
-	private static List<ClazzCurriculumDO> getCurr(List<ClazzCurriculumDO> curricula, WxSubjectMapper subjectMapper) {
-		new ArrayList<>();
-		Map<String, Object> curFriMap = new HashMap<>();
+	private Map<String, Object> getCurr(List<ClazzCurriculumDO> curricula) {
+		Map<String, Object> map = new HashMap<>();
+		List<Map<String,Object>> curFris = new ArrayList<>();
+		List<Map<String,Object>> curMons = new ArrayList<>();					List<Map<String,Object>> curSats = new ArrayList<>();
+		List<Map<String,Object>> curThurs = new ArrayList<>();
+		List<Map<String,Object>> curTuess = new ArrayList<>();
+		List<Map<String,Object>> curWeds = new ArrayList<>();
 		for (ClazzCurriculumDO cc:curricula) {
-		//Long curFri = cc.getCurFri();
-			/*curFriMap.put("",cc.getCurFri());
-			curFriMap.put("",cc.getCurStartTime());
-			curFriMap.put("",cc.getCurEndTime());
-			curFriMap.put("",subjectMapper.get(cc.getCurFri()).getSubjectName());*/
-
-		cc.setCurFriSubject(subjectMapper.get(cc.getCurFri()).getSubjectName());
-		cc.setCurMonSubject(subjectMapper.get(cc.getCurMon()).getSubjectName());
-		cc.setCurSatSubject(subjectMapper.get(cc.getCurSat()).getSubjectName());
-		cc.setCurThurSubject(subjectMapper.get(cc.getCurThur()).getSubjectName());
-		cc.setCurTuesSubject(subjectMapper.get(cc.getCurTues()).getSubjectName());
-		cc.setCurWedSubject(subjectMapper.get(cc.getCurWed()).getSubjectName());
-	}
-		return curricula;
+			Long curFri = cc.getCurFri();
+			if (ObjectUtils.isNotEmpty(curFri)){
+				Map<String, Object> curFriMap = new HashMap<>();
+				curFriMap.put("startTime",cc.getCurStartTime());
+				curFriMap.put("endTime",cc.getCurEndTime());
+				curFriMap.put("subjectName",subjectMapper.get(curFri).getSubjectName());
+				TeacherClazzDO teacher1 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curFri);
+				TeacherDO teacherDO1 = wxTeacherMapper.get(teacher1.getTeacherId());
+				curFriMap.put("teacherName",teacherDO1.getTeacherName());
+				curFriMap.put("teacherPhoto",teacherDO1.getTeacherPhoto());
+				curFris.add(curFriMap);
+			}
+
+
+			Long curMon = cc.getCurMon();
+			if (ObjectUtils.isNotEmpty(curMon)){
+				Map<String, Object> curMonMap = new HashMap<>();
+				curMonMap.put("startTime",cc.getCurStartTime());
+				curMonMap.put("endTime",cc.getCurEndTime());
+				curMonMap.put("subjectName",subjectMapper.get(curMon).getSubjectName());
+				TeacherClazzDO teacher2 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curMon);
+				TeacherDO teacherDO2 = wxTeacherMapper.get(teacher2.getTeacherId());
+				curMonMap.put("teacherName",teacherDO2.getTeacherName());
+				curMonMap.put("teacherPhoto",teacherDO2.getTeacherPhoto());
+				curMons.add(curMonMap);
+			}
+
+
+			Long curSat = cc.getCurSat();
+			if (ObjectUtils.isNotEmpty(curSat)){
+				Map<String, Object> curSatMap = new HashMap<>();
+				curSatMap.put("startTime",cc.getCurStartTime());
+				curSatMap.put("endTime",cc.getCurEndTime());
+				curSatMap.put("subjectName",subjectMapper.get(curSat).getSubjectName());
+				TeacherClazzDO teacher3 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curSat);
+				TeacherDO teacherDO3 = wxTeacherMapper.get(teacher3.getTeacherId());
+				curSatMap.put("teacherName",teacherDO3.getTeacherName());
+				curSatMap.put("teacherPhoto",teacherDO3.getTeacherPhoto());
+				curSats.add(curSatMap);
+			}
+
+
+			Long curThur = cc.getCurThur();
+			if (ObjectUtils.isNotEmpty(curThur)){
+				Map<String, Object> curThurMap = new HashMap<>();
+				curThurMap.put("startTime",cc.getCurStartTime());
+				curThurMap.put("endTime",cc.getCurEndTime());
+				curThurMap.put("subjectName",subjectMapper.get(curThur).getSubjectName());
+				TeacherClazzDO teacher4 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curThur);
+				TeacherDO teacherDO4 = wxTeacherMapper.get(teacher4.getTeacherId());
+				curThurMap.put("teacherName",teacherDO4.getTeacherName());
+				curThurMap.put("teacherPhoto",teacherDO4.getTeacherPhoto());
+				curThurs.add(curThurMap);
+			}
+
+
+			Long curTues = cc.getCurTues();
+			if (ObjectUtils.isNotEmpty(curTues)){
+				Map<String, Object> curTuesMap = new HashMap<>();
+				curTuesMap.put("startTime",cc.getCurStartTime());
+				curTuesMap.put("endTime",cc.getCurEndTime());
+				curTuesMap.put("subjectName",subjectMapper.get(curTues).getSubjectName());
+				TeacherClazzDO teacher5 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curTues);
+				TeacherDO teacherDO5 = wxTeacherMapper.get(teacher5.getTeacherId());
+				curTuesMap.put("teacherName",teacherDO5.getTeacherName());
+				curTuesMap.put("teacherPhoto",teacherDO5.getTeacherPhoto());
+				curTuess.add(curTuesMap);
+			}
+
+
+			Long curWed = cc.getCurWed();
+			if (ObjectUtils.isNotEmpty(curWed)){
+				Map<String, Object> curWedMap = new HashMap<>();
+				curWedMap.put("startTime",cc.getCurStartTime());
+				curWedMap.put("endTime",cc.getCurEndTime());
+				curWedMap.put("subjectName",subjectMapper.get(curWed).getSubjectName());
+				TeacherClazzDO teacher6 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curWed);
+				TeacherDO teacherDO6 = wxTeacherMapper.get(teacher6.getTeacherId());
+				curWedMap.put("teacherName",teacherDO6.getTeacherName());
+				curWedMap.put("teacherPhoto",teacherDO6.getTeacherPhoto());
+				curWeds.add(curWedMap);
+			}
+		}
+		map.put("curMons",curMons);
+		map.put("curFris",curFris);
+		map.put("curSats",curSats);
+		map.put("curThurs",curThurs);
+		map.put("curTuess",curTuess);
+		map.put("curWeds",curWeds);
+		return map;
 	}
 }

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

@@ -77,22 +77,21 @@ public class WxClazzServiceImpl implements WxClazzService {
 	public List<ClazzDO> selectParentPhoneByTeacher(Long teacherId, String selectKey) throws Exception {
 		List<ClazzDO> clazzDOS = selectClazz(teacherId);
 		for (ClazzDO cz:clazzDOS) {
-			List<StudentDO> studentDOS = studentMapper.listByClazzId(cz.getClazzId());
+			Map<String, Object> map = new HashMap<>();
+			map.put("clazzId",cz.getClazzId());
+			map.put("stuName","%"+selectKey+"%");
+			List<StudentDO> studentDOS = studentMapper.list(map);
 			if (ObjectUtils.isNotEmpty(studentDOS)){
 				for (StudentDO st:studentDOS) {
 					List<ParentsStuDO> parentsStuDOS = parentsStuMapper.listByStuId(st.getStuId());
 					if (ObjectUtils.isNotEmpty(parentsStuDOS)){
+						List<ParentsDO> parentsDOS = new ArrayList<>();
 						for (ParentsStuDO ps:parentsStuDOS) {
-							Map<String, Object> map = new HashMap<>();
-							map.put("parentId",ps.getParentId());
-							map.put("parentsName","%"+selectKey+"%");
-							//map.put("","%"+selectKey+"%");
-							List<ParentsDO> list = parentsMapper.list(map);
-							for (ParentsDO pt:list) {
-								pt.setUserPhone(userMapper.get(pt.getUserId()).getUserPhone());
-							}
-							st.setParentsDOS(list);
+							ParentsDO parentsDO = parentsMapper.get(ps.getParentId());
+							parentsDO.setUserPhone(userMapper.get(parentsDO.getUserId()).getUserPhone());
+							parentsDOS.add(parentsDO);
 						}
+						st.setParentsDOS(parentsDOS);
 					}
 				}
 				cz.setStudentDOS(studentDOS);

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

@@ -7,11 +7,13 @@ import com.usoftchina.smartschool.school.po.MeetingRecordsDO;
 import com.usoftchina.smartschool.school.po.TeacherDO;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingRecordsMapper;
+import com.usoftchina.smartschool.school.wxschool.mapper.WxSchoolMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
 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.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -29,6 +31,12 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 	@Autowired
 	private WxTeacherMapper teacherMapper;
 
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
+
 	/**
 	 * 创建会议
 	 * @param jsonMeeting
@@ -59,7 +67,8 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 		int save = meetingMapper.save(meetingDO);
 		if (save>0){
 			List<Long> longs = JSON.parseArray(meetingNotifier, Long.class);
-			for (Long l:longs) {
+			List<Long> list = removeDuplicate(longs);
+			for (Long l:list) {
 				MeetingRecordsDO meetingRecordsDO = new MeetingRecordsDO();
 				if (creator.compareTo(l)==0){
 					meetingRecordsDO.setIsRead(2);
@@ -71,9 +80,9 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 				meetingRecordsMapper.save(meetingRecordsDO);
 			}
 			Timer timer = new Timer();
-			timer.schedule(new RemindTask(meetingMapper,1,meetingDO.getMeetingId()), startDate);
-			timer.schedule(new RemindTask(meetingMapper,2,meetingDO.getMeetingId()), endDate);
-			timer.schedule(new RemindTask(meetingMapper,3,meetingDO.getMeetingId()), 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("创建失败,请核查");

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

@@ -2,19 +2,15 @@ package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxNotifyService;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxNotifyMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxNotifyrecordsMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxStudentMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
-import com.usoftchina.smartschool.school.po.NotifyDO;
-import com.usoftchina.smartschool.school.po.NotifyrecordsDO;
-import com.usoftchina.smartschool.school.po.StudentDO;
-import com.usoftchina.smartschool.school.po.TeacherDO;
+import com.usoftchina.smartschool.school.wxschool.mapper.*;
 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 java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -32,6 +28,15 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 	@Autowired
 	private WxStudentMapper studentMapper;
 
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
+
+	@Autowired
+	private WxParentsMapper wxParentsMapper;
+
 
 	/**
 	 * 获取系统消息和使用帮助
@@ -53,8 +58,10 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 		JSONObject json = JSONObject.parseObject(jsonNotify);
 		NotifyDO notifyDO = new NotifyDO();
 		notifyDO.setCreateDate(new Date());
-		notifyDO.setNotifyTitle(json.getString("notifyTitle"));
-		notifyDO.setNotifyDetails(json.getString("notifyDetails"));
+		String notifyTitle = json.getString("notifyTitle");
+		notifyDO.setNotifyTitle(notifyTitle);
+		String notifyDetails = json.getString("notifyDetails");
+		notifyDO.setNotifyDetails(notifyDetails);
 		Long notifyCreator = json.getLong("notifyCreator");
 		notifyDO.setNotifyCreator(notifyCreator);
 		notifyDO.setSchoolId(teacherMapper.get(notifyCreator).getSchoolId());
@@ -68,6 +75,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 		notifyDO.setNotifyStu(notifyStu);
 		int save = notifyMapper.save(notifyDO);
 		if (save>0){
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 			List<Long> longs = JSON.parseArray(notifyTeacher, Long.class);
 			if (ObjectUtils.isNotEmpty(longs)){
 				List<Long> list = removeDuplicate(longs);
@@ -81,6 +89,9 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsDO.setNotifyId(notifyDO.getNotifyId());
 					notifyrecordsDO.setTeacherId(l);
 					notifyrecordsMapper.save(notifyrecordsDO);
+					TeacherDO teacherDO = teacherMapper.get(l);
+					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
+					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);
@@ -92,6 +103,9 @@ 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());
+					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
 				}
 			}
 			return "创建成功";

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

@@ -4,18 +4,22 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.usoftchina.smartschool.school.po.OaApproveDO;
 import com.usoftchina.smartschool.school.po.OaArticlesDO;
+import com.usoftchina.smartschool.school.po.SchoolDO;
 import com.usoftchina.smartschool.school.po.TeacherDO;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxOaApproveMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxOaArticlesMapper;
+import com.usoftchina.smartschool.school.wxschool.mapper.WxSchoolMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
 import com.usoftchina.smartschool.school.wxschool.oaBean.Leader;
 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.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -30,11 +34,19 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 	@Autowired
 	private WxTeacherMapper teacherMapper;
 
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
+
 	public int oaCreate(String oaString){
 		JSONObject parse = JSONObject.parseObject(oaString);
 		OaApproveDO oaApprove = new OaApproveDO();
-		oaApprove.setApproveTitle(parse.getString("approveTitle"));
-		oaApprove.setApproveDetails(parse.getString("approveDetails"));
+		String approveTitle = parse.getString("approveTitle");
+		oaApprove.setApproveTitle(approveTitle);
+		String approveDetails = parse.getString("approveDetails");
+		oaApprove.setApproveDetails(approveDetails);
 		oaApprove.setApproveFiles(parse.getString("approveFiles"));
 		/** 类型 1、出差  2、用品 3、外出  4、请假*/
 		Integer type = parse.getInteger("approveType");
@@ -52,7 +64,10 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 		oaApprove.setAddress(parse.getString("address"));
 		int i = oaApproveMapper.save(oaApprove);
 		if (i>0){
-			//SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			TeacherDO teacherDO = teacherMapper.get(approver);
+			TeacherDO teacher = teacherMapper.get(proposer);
+			SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
 			if (type!= null && 2==type) {
 				String articles1 = parse.getString("oaArticlesDOS");
 				List<OaArticlesDO> oaArticlesDOS = JSONObject.parseArray(articles1, OaArticlesDO.class);
@@ -62,10 +77,9 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 						oaArticlesMapper.save(articles);
 					}
 				}
-				/*userService.wxPush(userMapper.selectUserById(approver).getUserOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",parse.getString("approveName"),userMapper.selectUserById(proposer).getUserName(),format.format(new Date()),parse.getString("approveDetails"),"点击查看详情","https://www.akuiguoshu.com/smart-school/");
+				wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}else {
-				userService.wxPush(userMapper.selectUserById(approver).getUserOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",parse.getString("approveName"),userMapper.selectUserById(proposer).getUserName(),format.format(new Date()),parse.getString("approveDetails"),"点击查看详情","https://www.akuiguoshu.com/smart-school/");
-			}*/
+				wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}
 			return i;
 		}else {

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

@@ -2,17 +2,13 @@ package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.usoftchina.smartschool.school.po.OaLeaveDO;
-import com.usoftchina.smartschool.school.po.OaLeaveReplyDO;
-import com.usoftchina.smartschool.school.po.StudentDO;
-import com.usoftchina.smartschool.school.po.TeacherDO;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxOaLeaveMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxOaLeaveReplyMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxStudentMapper;
-import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
+import com.usoftchina.smartschool.school.po.*;
+import com.usoftchina.smartschool.school.wxschool.basic.service.WxSchoolService;
+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.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,41 +31,12 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
 
 	@Autowired
 	private WxOaLeaveReplyMapper oaLeaveReplyMapper;
-	
-	@Override
-	public OaLeaveDO get(Long lvId){
-		return oaLeaveMapper.get(lvId);
-	}
-	
-	@Override
-	public List<OaLeaveDO> list(Map<String, Object> map){
-		return oaLeaveMapper.list(map);
-	}
-	
-	@Override
-	public int count(Map<String, Object> map){
-		return oaLeaveMapper.count(map);
-	}
-	
-	@Override
-	public int save(OaLeaveDO oaLeave){
-		return oaLeaveMapper.save(oaLeave);
-	}
-	
-	@Override
-	public int update(OaLeaveDO oaLeave){
-		return oaLeaveMapper.update(oaLeave);
-	}
-	
-	@Override
-	public int remove(Long lvId){
-		return oaLeaveMapper.remove(lvId);
-	}
-	
-	@Override
-	public int batchRemove(Long[] lvIds){
-		return oaLeaveMapper.batchRemove(lvIds);
-	}
+
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
 
 	/**
 	 * 请假条提交
@@ -99,8 +66,8 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
 				List<Long> longs = JSON.parseArray(lvNotifier, Long.class);
 				for (Long teacherId:longs) {
 					TeacherDO teacherDO = teacherMapper.get(teacherId);
-				/*	userService.wxPush(teacherDO.getOpenid(), "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",studentMapper.selectStudentById(lvProposer).getStuName(), json.getString("startDate")+"-"+json.getString("endDate"), leave.getLvDetails(),"-", "点击查看详情", "");*/
-					//"https://tmobile.ubtob.com/
+					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
+					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",studentMapper.get(lvProposer).getStuName(), json.getString("startDate")+"-"+json.getString("endDate"), leave.getLvDetails(),"-", "点击查看详情", "");
 				}
 				return "申请成功";
 			}else {

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

@@ -1,13 +1,21 @@
 package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
+import com.usoftchina.smartschool.school.po.ClazzDO;
 import com.usoftchina.smartschool.school.po.OutInRecordDO;
+import com.usoftchina.smartschool.school.po.StudentDO;
+import com.usoftchina.smartschool.school.wxschool.mapper.WxClazzMapper;
+import com.usoftchina.smartschool.school.wxschool.mapper.WxGradeMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxOutInRecordMapper;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxOutInRecordService;
+import com.usoftchina.smartschool.school.wxschool.mapper.WxStudentMapper;
+import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 
 @Service
@@ -15,15 +23,14 @@ public class WxOutInRecordServiceImpl implements WxOutInRecordService {
 	@Autowired
 	private WxOutInRecordMapper outInRecordMapper;
 
-	/*@Autowired
-	private StudentMapper studentMapper;
+	@Autowired
+	private WxStudentMapper studentMapper;
 
 	@Autowired
-	private ClazzMapper clazzMapper;
+	private WxClazzMapper clazzMapper;
 
 	@Autowired
-	private GradeMapper gradeMapper;
-*/
+	private WxGradeMapper gradeMapper;
 
 	/**
 	 * 获取出入校记录
@@ -33,9 +40,21 @@ public class WxOutInRecordServiceImpl implements WxOutInRecordService {
 	 * @return
 	 */
 	@Override
-	public List<OutInRecordDO> selectRecordOutgoingListByStuId(Long stuId, Integer pageIndex, Integer pageSize) {
+	public Map<String, Object> selectRecordOutgoingListByStuId(Long stuId, Integer pageIndex, Integer pageSize) {
 		Integer pageStart = (pageIndex-1)*pageSize;
-		return outInRecordMapper.selectOutInRecordDOListByStuId(stuId, pageStart, pageSize);
+		Map<String, Object> map = new HashMap<>();
+		List<OutInRecordDO> outInRecordDOS = outInRecordMapper.selectOutInRecordDOListByStuId(stuId, pageStart, pageSize);
+		if (ObjectUtils.isNotEmpty(outInRecordDOS)){
+			Long stuId1 = outInRecordDOS.get(0).getStuId();
+			StudentDO studentDO = studentMapper.get(stuId1);
+			Map<String, Object> map1 = JavaBeanUtil.object2Map(studentDO);
+			ClazzDO clazzDO = clazzMapper.get(studentDO.getClazzId());
+			map1.put("clazzName",clazzDO.getClazzName());
+			map1.put("gradeName",gradeMapper.get(clazzDO.getGradeId()).getGradeName());
+			map.put("student",map1);
+		}
+		map.put("outInRecordDOS",outInRecordDOS);
+		return map;
 	}
 
 	/**

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

@@ -2,18 +2,17 @@ package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.school.wxschool.mapper.*;
-import com.usoftchina.smartschool.school.po.ParentsDO;
-import com.usoftchina.smartschool.school.po.PrincipalMailboxDO;
-import com.usoftchina.smartschool.school.po.PrincipalReplyDO;
-import com.usoftchina.smartschool.school.po.TeacherDO;
 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.service.WxPushService;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -37,40 +36,8 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 	@Autowired
 	private WxSchoolMapper schoolMapper;
 
-	@Override
-	public PrincipalMailboxDO get(Long mailboxId){
-		return principalMailboxMapper.get(mailboxId);
-	}
-	
-	@Override
-	public List<PrincipalMailboxDO> list(Map<String, Object> map){
-		return principalMailboxMapper.list(map);
-	}
-	
-	@Override
-	public int count(Map<String, Object> map){
-		return principalMailboxMapper.count(map);
-	}
-	
-	@Override
-	public int save(PrincipalMailboxDO principalMailbox){
-		return principalMailboxMapper.save(principalMailbox);
-	}
-	
-	@Override
-	public int update(PrincipalMailboxDO principalMailbox){
-		return principalMailboxMapper.update(principalMailbox);
-	}
-	
-	@Override
-	public int remove(Long mailboxId){
-		return principalMailboxMapper.remove(mailboxId);
-	}
-	
-	@Override
-	public int batchRemove(Long[] mailboxIds){
-		return principalMailboxMapper.batchRemove(mailboxIds);
-	}
+	@Autowired
+	private WxPushService wxPushService;
 
 	/**
 	 * 校长信箱创建
@@ -85,15 +52,14 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 		principalMailboxDO.setCreateDate(new Date());
 		int save = principalMailboxMapper.save(principalMailboxDO);
 		if (save>0){
-			principalMailboxDO.getNotifier();
+			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+			SchoolDO schoolDO = schoolMapper.get(schoolId);
+			TeacherDO teacherDO = teacherMapper.get(principalMailboxDO.getNotifier());
+			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("提交失败,请重新提交");
 		}
-					/*SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-					if (ObjectUtils.isNotEmpty(openid)){
-						userService.wxPush(openid, "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",school.getSchName(), userMapper.selectUserById(userId).getUserName(), simpleDateFormat.format(new Date()), details,"点击查看详情", "");
-					}*/
 	}
 
 	/**

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

@@ -1,5 +1,6 @@
 package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxTaskNotifyService;
@@ -7,9 +8,11 @@ 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.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -24,9 +27,6 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 	@Autowired
 	private WxTeacherMapper teacherMapper;
 
-	@Autowired
-	private WxSubjectMapper subjectMapper;
-
 	@Autowired
 	private WxTaskReplyMapper taskReplyMapper;
 
@@ -35,56 +35,29 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 
 	@Autowired
 	private WxStudentMapper studentMapper;
-	
-	@Override
-	public TaskNotifyDO get(Long taskId){
-		return taskNotifyMapper.get(taskId);
-	}
-	
-	@Override
-	public List<TaskNotifyDO> list(Map<String, Object> map){
-		return taskNotifyMapper.list(map);
-	}
-	
-	@Override
-	public int count(Map<String, Object> map){
-		return taskNotifyMapper.count(map);
-	}
-	
-	@Override
-	public int save(TaskNotifyDO taskNotify){
-		return taskNotifyMapper.save(taskNotify);
-	}
-	
-	@Override
-	public int update(TaskNotifyDO taskNotify){
-		return taskNotifyMapper.update(taskNotify);
-	}
-	
-	@Override
-	public int remove(Long taskId){
-		return taskNotifyMapper.remove(taskId);
-	}
-	
-	@Override
-	public int batchRemove(Long[] taskIds){
-		return taskNotifyMapper.batchRemove(taskIds);
-	}
 
+	@Autowired
+	private WxPushService wxPushService;
+
+	@Autowired
+	private WxSchoolMapper wxSchoolMapper;
 
 	/**
 	 * 发布作业
 	 * @param taskString
 	 * @return
 	 */
-	public int createTask(String taskString){
+	public String createTask(String taskString) throws Exception {
 		JSONObject json = JSONObject.parseObject(taskString);
 		TaskNotifyDO taskNotifyDO = new TaskNotifyDO();
-		taskNotifyDO.setTaskTitle(json.getString("taskTitle"));
-		taskNotifyDO.setTaskContext(json.getString("taskContext"));
+		String taskTitle = json.getString("taskTitle");
+		taskNotifyDO.setTaskTitle(taskTitle);
+		String taskContext = json.getString("taskContext");
+		taskNotifyDO.setTaskContext(taskContext);
 		Long taskCreator = json.getLong("taskCreator");
 		taskNotifyDO.setTaskCreator(taskCreator);
-		taskNotifyDO.setSchoolId(teacherMapper.get(taskCreator).getSchoolId());
+		Long schoolId = teacherMapper.get(taskCreator).getSchoolId();
+		taskNotifyDO.setSchoolId(schoolId);
 		taskNotifyDO.setSubjectId(json.getLong("subjectId"));
 		taskNotifyDO.setTaskFiles(json.getString("taskFiles"));
 		taskNotifyDO.setTaskStatus(json.getInteger("taskStatus"));
@@ -93,8 +66,22 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 		taskNotifyDO.setStartDate(startDate);
 		Date endDate = DateFormatUtil.string2Date(json.getString("endDate"));
 		taskNotifyDO.setEndDate(endDate);
-		taskNotifyDO.setTaskNotifier(json.getString("taskNotifier"));
-		return taskNotifyMapper.save(taskNotifyDO);
+		String taskNotifier = json.getString("taskNotifier");
+		taskNotifyDO.setTaskNotifier(taskNotifier);
+		int save = taskNotifyMapper.save(taskNotifyDO);
+		if (save>0){
+			if (ObjectUtils.isNotEmpty(taskNotifier)){
+				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) {
+					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
+				}
+			}
+			return "作业发布成功";
+		}else {
+			throw new Exception("作业发布失败");
+		}
 	}
 
 	/**
@@ -132,6 +119,11 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 		if (ObjectUtils.isNotEmpty(taskNotifyDOS)){
 			List<Map<String, Object>> maps = new ArrayList<>();
 			for (TaskNotifyDO tn:taskNotifyDOS) {
+				List<TaskReplyDO> taskReplyDOS = taskReplyMapper.listByTaskStu(tn.getTaskId(),stuId);
+				if (taskReplyDOS.size()>0){
+					tn.setTaskStatus(2);
+				}
+
 				Map<String, Object> map = taskDetail(tn);
 				maps.add(map);
 			}
@@ -144,9 +136,8 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 	/**
 	 *家长端获取作业详情
 	 * @param taskId
-	 * @param stuId
 	 */
-	public Map<String, Object> taskDetailStu(Long taskId, Long stuId){
+	public Map<String, Object> taskDetail(Long taskId){
 		TaskNotifyDO taskNotifyDO = taskNotifyMapper.get(taskId);
 		return taskDetail(taskNotifyDO);
 
@@ -184,9 +175,8 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 		map1.put("teacherName",teacherDO.getTeacherName());
 		map1.put("teacherPhoto",teacherDO.getTeacherPhoto());
 		List<TaskReplyDO> taskReplyDOS = taskReplyMapper.listByTaskId(taskNotifyDO.getTaskId());
-
+		List<Map<String, Object>> maps = new ArrayList<>();
 		if (ObjectUtils.isNotEmpty(taskReplyDOS)){
-			List<Map<String, Object>> maps = new ArrayList<>();
 			for (TaskReplyDO tr:taskReplyDOS) {
 				Map<String, Object> map = JavaBeanUtil.object2Map(tr);
 				ParentsDO parentsDO = parentsMapper.get(tr.getParentId());
@@ -196,8 +186,8 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 				map.put("stuName",studentDO.getStuName());
 				maps.add(map);
 			}
-			map1.put("taskReplyDOs",maps);
 		}
+		map1.put("taskReplyDOs",maps);
 		return map1;
 	}
 }

+ 3 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTaskReplyMapper.java

@@ -2,6 +2,7 @@ package com.usoftchina.smartschool.school.wxschool.mapper;
 
 import com.usoftchina.smartschool.school.po.TaskReplyDO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -30,4 +31,6 @@ public interface WxTaskReplyMapper {
 	int batchRemove(Long[] taskReplayIds);
 
 	List<TaskReplyDO> listByTaskId(Long taskId);
+
+	List<TaskReplyDO> listByTaskStu(@Param("taskId") Long taskId,@Param("stuId")Long stuId);
 }

+ 3 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTeacherClazzMapper.java

@@ -2,6 +2,7 @@ package com.usoftchina.smartschool.school.wxschool.mapper;
 
 import com.usoftchina.smartschool.school.po.TeacherClazzDO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -30,4 +31,6 @@ public interface WxTeacherClazzMapper {
 	int batchRemove(Long[] teacherClazzIds);
 
 	List<TeacherClazzDO> listByTeacherId(Long teacherId);
+
+	TeacherClazzDO getTeacher(@Param("clazzId") Long clazzId,@Param("subjectId")Long subjectId);
 }

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

@@ -1,9 +1,17 @@
 package com.usoftchina.smartschool.school.wxschool.support;
 
+import com.alibaba.fastjson.JSON;
 import com.usoftchina.smartschool.school.po.MeetingDO;
+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.service.WxPushService;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.TimerTask;
 
 
@@ -12,23 +20,44 @@ public class RemindTask extends TimerTask {
     @Autowired
     private WxMeetingMapper meetingMapper;
 
-    private Long meetingId;
+    @Autowired
+    private WxPushService wxPushService;
+
+    @Autowired
+    private WxSchoolMapper wxSchoolMapper;
+
+    @Autowired
+    private WxTeacherMapper teacherMapper;
+
+    private MeetingDO meetingDO;
 
     private Integer i;
 
-    public RemindTask(WxMeetingMapper nm, Integer ll, Long id){//关键点解决 null指针错误,
+    public RemindTask(WxTeacherMapper teacherM,WxSchoolMapper wxSchool,WxPushService wxPushs,WxMeetingMapper nm, Integer ll, MeetingDO meet){//关键点解决 null指针错误,
+        teacherMapper = teacherM;
+        wxSchoolMapper = wxSchool;
         meetingMapper=nm;
-        meetingId = id;
+        wxPushService = wxPushs;
+        meetingDO = meet;
         i= ll;
         }
 
     public void run() {
         if (1==i){
-            MeetingDO meetingDO = meetingMapper.get(meetingId);
             meetingDO.setMeetingStatus(2);
-            meetingMapper.update(meetingDO);
+            int update = meetingMapper.update(meetingDO);
+            if (update>0){
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+                String meetingNotifier = meetingDO.getMeetingNotifier();
+                List<Long> longs = JSON.parseArray(meetingNotifier, Long.class);
+                List<Long> list = removeDuplicate(longs);
+                for (Long teacherId:list) {
+                    SchoolDO schoolDO = wxSchoolMapper.get(meetingDO.getSchoolId());
+                    wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk","您好,您有一条新的会议通知", meetingDO.getMeetingName(),simpleDateFormat.format(meetingDO.getStartDate()),meetingDO.getMeetingAddress(),"-", "点击查看详情", "");
+                }
+
+            }
         }else if (2==i){
-            MeetingDO meetingDO = meetingMapper.get(meetingId);
             meetingDO.setMeetingStatus(3);
             meetingMapper.update(meetingDO);
         }else if (3==i){
@@ -37,4 +66,14 @@ public class RemindTask extends TimerTask {
 
         }
     }
+
+    private static List removeDuplicate(List list){
+        List listTemp = new ArrayList();
+        for(int i=0;i<list.size();i++){
+            if(!listTemp.contains(list.get(i))){
+                listTemp.add(list.get(i));
+            }
+        }
+        return listTemp;
+    }
 }

+ 4 - 1
applications/school/school-server/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 school:
-  uploadPath: /wxschool/files/
+  uploadPath: D:/wxschool/files/
 spring:
   application:
     name: school-server
@@ -41,6 +41,9 @@ spring:
     port: 6379
   profiles:
     active: dev
+  jackson:
+    date-format: yyyy-MM-dd HH:mm
+    time-zone: GMT+8
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10

+ 1 - 1
applications/school/school-server/src/main/resources/mapper/WxTaskNotifyMapper.xml

@@ -119,7 +119,7 @@
 	</delete>
 
 	<select id="selectListByTeacher" resultType="com.usoftchina.smartschool.school.po.TaskNotifyDO">
-		<include refid="TaskNotifyVo"/> where task_status = #{taskStatus} and task_creator = #{taskCreator}
+		<include refid="TaskNotifyVo"/> where task_status = #{taskStatus} and task_creator = #{teacherId}
 		order by task_id desc
 		limit #{pageStart}, #{pageSize}
 	</select>

+ 9 - 1
applications/school/school-server/src/main/resources/mapper/WxTaskReplyMapper.xml

@@ -77,7 +77,7 @@
 			<if test="replyContext != null">`reply_context` = #{replyContext}, </if>
 			<if test="replyDate != null">`reply_date` = #{replyDate}, </if>
 			<if test="parentId != null">`parent_id` = #{parentId},</if>
-			<if test="stuId != null">stu_id = #{stuId} </if>
+			<if test="stuId != null">`stu_id` = #{stuId} </if>
 		</set>
 		where task_replay_id = #{taskReplayId}
 	</update>
@@ -93,4 +93,12 @@
 		</foreach>
 	</delete>
 
+	<select id="listByTaskId" resultType="com.usoftchina.smartschool.school.po.TaskReplyDO">
+		<include refid="TaskReplyVo"/> where task_id = #{taskId}
+	</select>
+
+	<select id="listByTaskStu" resultType="com.usoftchina.smartschool.school.po.TaskReplyDO">
+		<include refid="TaskReplyVo"/> where task_id = #{taskId} and stu_id = #{stuId}
+	</select>
+
 </mapper>

+ 4 - 0
applications/school/school-server/src/main/resources/mapper/WxTeacherClazzMapper.xml

@@ -82,4 +82,8 @@
 		</foreach>
 	</delete>
 
+	<select id="getTeacher" resultType="com.usoftchina.smartschool.school.po.TeacherClazzDO">
+		<include refid="TeacherClazzVo"/> where clazz_id = #{clazzId} and subject_id = #{subjectId}
+	</select>
+
 </mapper>

+ 0 - 12
applications/wechat/wechat-server/pom.xml

@@ -16,18 +16,6 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-httpclient</groupId>
-            <artifactId>commons-httpclient</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.aliyun</groupId>
-            <artifactId>aliyun-java-sdk-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.aliyun</groupId>
-            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
-        </dependency>
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>

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

@@ -0,0 +1,13 @@
+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);
+}

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

@@ -0,0 +1,61 @@
+package com.usoftchina.smartschool.wechat.service.impl;
+
+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 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+"\","
+                        + "\"template_id\":\""+templateId+"\","
+                        + "\"url\":\""+""+url+""+"\","
+                        + "\"data\":{"
+                        + "\"first\":{\"value\":\""+title+"\","
+                        +"\"color\":\"#173177\"},"
+                        + "\"keyword1\":{\"value\":\""+keyword1+"\",\"color\":\"#173177\"},"
+                        + "\"keyword2\":{\"value\":\""+keyword2+"\",\"color\":\"#173177\"},"
+                        + "\"keyword3\":{\"value\":\""+keyword3+"\",\"color\":\"#173177\"},"
+                        + "\"keyword4\":{\"value\":\""+keyword4+"\",\"color\":\"#173177\"},"
+                        + "\"remark\":{\"value\":\""+remark+"\",\"color\":\"#173177\"}}}";
+                String access_token=  getWxAcessToken(appId,secret);
+                String token= JSON.parseObject(access_token).getString("access_token");
+                com.github.kevinsawicki.http.HttpRequest hRequest=  com.github.kevinsawicki.http.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(result);
+
+			/*if(JSON.parseObject(result).getInteger("errcode")==0&&JSON.parseObject(result).getString("errmsg").equals("ok")){
+				return "推送成功!";
+			}else{
+				throw new Exception("推送失败!access_token:"+access_token+" token:"+token);
+			}*/
+
+            }/*else {
+			throw new Exception("请指定推送人");
+		}*/
+            return "已推送";
+        }
+
+        public String getWxAcessToken(String appId,String secret){
+            HashMap<String, Object> params=new HashMap<>();
+            params.put("appid", appId);
+            params.put("secret", secret);
+            params.put("grant_type", "client_credential");
+            com.github.kevinsawicki.http.HttpRequest httpRequest= HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token",params,false);
+            String content=httpRequest.body();
+            return content;
+        }
+}

+ 0 - 60
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/wxUtils/WxPushUtil.java

@@ -1,60 +0,0 @@
-package com.usoftchina.smartschool.wechat.wxUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.github.kevinsawicki.http.HttpRequest;
-import com.usoftchina.smartschool.wechat.config.WXConfig;
-
-import java.util.HashMap;
-
-public class WxPushUtil {
-    /**
-     * 推送消息
-     * @param
-     * @return
-     */
-    public String wxPush(String openid,String templateId,String title,String keyword1,String keyword2,String keyword3,String keyword4,String remark,String url) throws Exception {
-        if (ObjectUtils.isNotEmpty(openid)){
-            String json="{\"touser\":\""+openid+"\","
-                    + "\"template_id\":\""+templateId+"\","
-                    + "\"url\":\""+""+url+""+"\","
-                    + "\"data\":{"
-                    + "\"first\":{\"value\":\""+title+"\","
-                    +"\"color\":\"#173177\"},"
-                    + "\"keyword1\":{\"value\":\""+keyword1+"\",\"color\":\"#173177\"},"
-                    + "\"keyword2\":{\"value\":\""+keyword2+"\",\"color\":\"#173177\"},"
-                    + "\"keyword3\":{\"value\":\""+keyword3+"\",\"color\":\"#173177\"},"
-                    + "\"keyword4\":{\"value\":\""+keyword4+"\",\"color\":\"#173177\"},"
-                    + "\"remark\":{\"value\":\""+remark+"\",\"color\":\"#173177\"}}}";
-            String access_token=  getWxAcessToken();
-            String token= JSON.parseObject(access_token).getString("access_token");
-            com.github.kevinsawicki.http.HttpRequest hRequest=  com.github.kevinsawicki.http.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(result);
-
-			/*if(JSON.parseObject(result).getInteger("errcode")==0&&JSON.parseObject(result).getString("errmsg").equals("ok")){
-				return "推送成功!";
-			}else{
-				throw new Exception("推送失败!access_token:"+access_token+" token:"+token);
-			}*/
-
-        }/*else {
-			throw new Exception("请指定推送人");
-		}*/
-        return "已推送";
-    }
-
-
-
-
-    public String getWxAcessToken(){
-        HashMap<String, Object> params=new HashMap<>();
-        params.put("appid", WXConfig.getAppID());
-        params.put("secret", WXConfig.getSecret());
-        params.put("grant_type", "client_credential");
-        com.github.kevinsawicki.http.HttpRequest httpRequest= HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token",params,false);
-        String content=httpRequest.body();
-        return content;
-    }
-}

+ 1 - 3
applications/wechat/wechat-server/src/main/resources/application.yml

@@ -1,5 +1,3 @@
-school:
-  uploadPath: D:/mnt/files/
 spring:
   application:
     name: wechat-server
@@ -81,7 +79,7 @@ info:
 mybatis:
   configuration:
     map-underscore-to-camel-case: true
-  type-aliases-package: com.usoftchina.smartschool.wechat.domain
+  type-aliases-package: com.usoftchina.smartschool.wechat.wxDemo
   mapper-locations: classpath:mapper/*.xml
 auth:
   public-key: auth/pub.key

+ 5 - 0
pom.xml

@@ -237,6 +237,11 @@
                 <artifactId>wechat-api</artifactId>
                 <version>${project.release.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.usoftchina.smartschool</groupId>
+                <artifactId>wechat-server</artifactId>
+                <version>${project.release.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.usoftchina.smartschool</groupId>
                 <artifactId>file-api</artifactId>