Эх сурвалжийг харах

学校通知、作业发布、成绩发布微信推送

guq 6 жил өмнө
parent
commit
70feabf3cf
25 өөрчлөгдсөн 323 нэмэгдсэн , 23 устгасан
  1. 0 2
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/IcCardController.java
  2. 34 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/HomeWorkServiceImpl.java
  3. 40 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/NoticeServiceImpl.java
  4. 41 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/ScoreServiceImpl.java
  5. 3 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/HomeWorkMapper.java
  6. 4 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/NoticeMapper.java
  7. 2 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/ScoreMapper.java
  8. 4 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/HomeWork.java
  9. 18 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/HomeworkNoticer.java
  10. 22 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/SchoolNoticer.java
  11. 24 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/ScoreNoticer.java
  12. 26 0
      applications/school/school-server/src/main/resources/mapper/HomeWorkMapper.xml
  13. 5 0
      applications/school/school-server/src/main/resources/mapper/NotifyMapper.xml
  14. 6 0
      applications/school/school-server/src/main/resources/mapper/ScoreMapper.xml
  15. 4 0
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WechatApi.java
  16. 21 0
      applications/wechat/wechat-dto/src/main/java/com/usoftchina/smartschool/wechat/dto/TransferDTO.java
  17. 0 4
      applications/wechat/wechat-server/pom.xml
  18. 0 2
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/WechatApplication.java
  19. 18 4
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/TransfersController.java
  20. 0 4
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java
  21. 9 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/po/MessagePackage.java
  22. 2 3
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/ReceiveService.java
  23. 19 0
      applications/wechat/wechat-server/src/test/java/com/usoftchina/smartschool/wechat/NonSpringTest.java
  24. 20 0
      applications/wechat/wechat-server/src/test/java/com/usoftchina/smartschool/wechat/Test_service.java
  25. 1 1
      frontend/pc-web/app.json

+ 0 - 2
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/IcCardController.java

@@ -30,6 +30,4 @@ public class IcCardController {
         String result = icCardService.consumePush(accTransDetailList, school);
         return Result.success(result);
     }
-
-
 }

+ 34 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/HomeWorkServiceImpl.java

@@ -11,14 +11,17 @@ import com.usoftchina.smartschool.school.dto.DocBaseDTO;
 import com.usoftchina.smartschool.school.dto.ListReqDTO;
 import com.usoftchina.smartschool.school.exception.BizExceptionCode;
 import com.usoftchina.smartschool.school.mapper.*;
-import com.usoftchina.smartschool.school.po.HomeWork;
-import com.usoftchina.smartschool.school.po.SysClazz;
-import com.usoftchina.smartschool.school.po.SysGrade;
+import com.usoftchina.smartschool.school.po.*;
+import com.usoftchina.smartschool.utils.DateUtils;
+import com.usoftchina.smartschool.wechat.api.WechatApi;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import com.usoftchina.smartschool.wechat.dto.TransferDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 
@@ -39,6 +42,10 @@ public class HomeWorkServiceImpl implements HomeWorkService{
     private SysStudentMapper sysStudentMapper;
     @Autowired
     private SysTeacherMapper sysTeacherMapper;
+    @Autowired
+    private SysSchoolMapper sysSchoolMapper;
+    @Autowired
+    private WechatApi wechatApi;
 
     @Override
     public DocBaseDTO save(HomeWork formdata) {
@@ -120,6 +127,30 @@ public class HomeWorkServiceImpl implements HomeWorkService{
         if(StringUtils.isEmpty(id) || "0".equals(id)) {
             return;
         }
+        HomeWork data = homeWorkMapper.selectByPrimaryKey(id);
+        //学校信息
+        SysSchool school = sysSchoolMapper.selectByPrimaryKey(BaseContextHolder.getSchoolId());
+        //微信推送
+        List<HomeworkNoticer> noticers = homeWorkMapper.selectHomeworkNoticer(id);
+        //消息内容
+        List<MessageInfoDTO> msgs = new ArrayList<>();
+        noticers.forEach(noticer -> {
+            MessageInfoDTO msg = new MessageInfoDTO();
+            msg.setTitle("作业提醒");
+            msg.setKeyword1(noticer.getSubject());
+            msg.setKeyword2(DateUtils.format());
+            msg.setKeyword3(data.getTask_context());
+            msg.setTouser(noticer.getOpenid());
+            msg.setAppId(school.getSchool_appid());
+            msg.setSecret(school.getSchool_secret());
+            msgs.add(msg);
+        });
+        if (msgs.size() > 0) {
+            TransferDTO transferDTO = new TransferDTO();
+            transferDTO.setData(msgs);
+            //调用推送接口
+            wechatApi.largeMessages(transferDTO);
+        }
         homeWorkMapper.updateByPublish(id);
     }
 

+ 40 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/NoticeServiceImpl.java

@@ -11,11 +11,19 @@ import com.usoftchina.smartschool.school.dto.DocBaseDTO;
 import com.usoftchina.smartschool.school.dto.ListReqDTO;
 import com.usoftchina.smartschool.school.exception.BizExceptionCode;
 import com.usoftchina.smartschool.school.mapper.NoticeMapper;
+import com.usoftchina.smartschool.school.mapper.SysSchoolMapper;
 import com.usoftchina.smartschool.school.po.Notify;
+import com.usoftchina.smartschool.school.po.SchoolNoticer;
+import com.usoftchina.smartschool.school.po.SysSchool;
+import com.usoftchina.smartschool.utils.DateUtils;
 import com.usoftchina.smartschool.utils.StringUtils;
+import com.usoftchina.smartschool.wechat.api.WechatApi;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import com.usoftchina.smartschool.wechat.dto.TransferDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 
@@ -29,6 +37,14 @@ public class NoticeServiceImpl implements NoticeService{
     @Autowired
     private NoticeMapper noticeMapper;
 
+    @Autowired
+    private SysSchoolMapper sysSchoolMapper;
+
+    @Autowired
+    private WechatApi wechatApi;
+
+    final static String TEMPLATEID = "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w";
+
     @Override
     public DocBaseDTO save(Notify formdata) {
         if (StringUtils.isEmpty(formdata)){
@@ -105,6 +121,30 @@ public class NoticeServiceImpl implements NoticeService{
         if(StringUtils.isEmpty(id) || "0".equals(id)) {
             return;
         }
+        Notify data = noticeMapper.selectByPrimaryKey(id);
+        SysSchool school = sysSchoolMapper.selectByPrimaryKey(BaseContextHolder.getSchoolId());
+        List<MessageInfoDTO> msgs = new ArrayList<>();
+        List<SchoolNoticer> noticers = noticeMapper.selectNoticer(BaseContextHolder.getSchoolId());
+        noticers.forEach(noticer -> {
+            MessageInfoDTO msg = new MessageInfoDTO();
+            msg.setTitle(data.getNotify_title());
+            msg.setKeyword1(school.getSchool_name());
+            msg.setKeyword2("校办公室");
+            msg.setKeyword3(DateUtils.format());
+            msg.setKeyword4(data.getNotify_details());
+            msg.setRemark(data.getNotify_remarks());
+            msg.setTemplateId(TEMPLATEID);
+            msg.setTouser(noticer.getOpenid());
+            msg.setAppId(school.getSchool_appid());
+            msg.setSecret(school.getSchool_secret());
+            msgs.add(msg);
+        });
+        if (msgs.size() > 0) {
+            TransferDTO transferDTO = new TransferDTO();
+            transferDTO.setData(msgs);
+            //调用推送接口
+            wechatApi.largeMessages(transferDTO);
+        }
         noticeMapper.updateByPublish(id);
     }
 }

+ 41 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/ScoreServiceImpl.java

@@ -14,6 +14,10 @@ import com.usoftchina.smartschool.school.exception.BizExceptionCode;
 import com.usoftchina.smartschool.school.mapper.*;
 import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.utils.CollectionUtils;
+import com.usoftchina.smartschool.utils.DateUtils;
+import com.usoftchina.smartschool.wechat.api.WechatApi;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import com.usoftchina.smartschool.wechat.dto.TransferDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -47,6 +51,15 @@ public class ScoreServiceImpl implements ScoreService{
     @Autowired
     private SysStudentMapper sysStudentMapper;
 
+    @Autowired
+    private SysSchoolMapper sysSchoolMapper;
+
+    @Autowired
+    private WechatApi wechatApi;
+
+
+    final static String TEMPLATEID = "GwR7hZ9ya7ghAiH3PR-ws1l24P_ETE3phYJBjKTcpKY";
+
     @Override
     public PageInfo<ScoreImportList> getListData(PageRequest page, ListReqDTO listReqDTO) {
         PageHelper.startPage(page.getNumber(), page.getSize());
@@ -202,8 +215,13 @@ public class ScoreServiceImpl implements ScoreService{
         List<StuScore> appScores = new ArrayList<StuScore>();
         StuScore appScore = null;
         Long school_id = BaseContextHolder.getSchoolId();
+        //学校信息
+        SysSchool school = sysSchoolMapper.selectByPrimaryKey(BaseContextHolder.getSchoolId());
+        //表单数据
         ScoreImport main = scoreMapper.selectByPrimaryKey(id);
         List<ScoreImportdetail> details = scoreMapper.selectDetail(id);
+        //消息内容
+        List<MessageInfoDTO> msgs = new ArrayList<>();
         for (ScoreImportdetail detail : details) {
             appScore = new StuScore();
             appScore.setSchool_id(school_id);
@@ -221,6 +239,29 @@ public class ScoreServiceImpl implements ScoreService{
             appScores.add(appScore);
         }
         scoreMapper.batchInsert(appScores);
+        //微信推送
+        List<ScoreNoticer> noticers = scoreMapper.selectWechatMsg(id);
+        noticers.forEach(noticer -> {
+            MessageInfoDTO msg = new MessageInfoDTO();
+            msg.setTitle("您好,请查收您小孩" + noticer.getStuName() + "的成绩单");
+            msg.setKeyword1(noticer.getStuName());
+            msg.setKeyword2(noticer.getStuNo());
+            msg.setKeyword3(main.getSi_examtitle());
+            msg.setKeyword4(DateUtils.format(main.getSi_examdate(),"yyyy-MM-dd"));
+            msg.setKeyword5(school.getSchool_name());
+            msg.setRemark("成绩为:" + noticer.getScore());
+            msg.setTemplateId(TEMPLATEID);
+            msg.setTouser(noticer.getOpenid());
+            msg.setAppId(school.getSchool_appid());
+            msg.setSecret(school.getSchool_secret());
+            msgs.add(msg);
+        });
+        if (msgs.size() > 0) {
+            TransferDTO transferDTO = new TransferDTO();
+            transferDTO.setData(msgs);
+            //调用推送接口
+            wechatApi.largeMessages(transferDTO);
+        }
         //更新已转标志
         scoreMapper.updateTurnPublish(id);
     }

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

@@ -1,6 +1,7 @@
 package com.usoftchina.smartschool.school.mapper;
 
 import com.usoftchina.smartschool.school.po.HomeWork;
+import com.usoftchina.smartschool.school.po.HomeworkNoticer;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -34,4 +35,6 @@ public interface HomeWorkMapper {
     int taskStatus(@Param("task_status") String task_status,@Param("task_id") Long task_id);
 
     Integer homeWorkRelease(Long id);
+
+    List<HomeworkNoticer> selectHomeworkNoticer(Long id);
 }

+ 4 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/NoticeMapper.java

@@ -1,6 +1,7 @@
 package com.usoftchina.smartschool.school.mapper;
 
 import com.usoftchina.smartschool.school.po.Notify;
+import com.usoftchina.smartschool.school.po.SchoolNoticer;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -28,4 +29,7 @@ public interface NoticeMapper {
     int updateByPublish(Long notify_id);
 
     int noticeStatus(Long id);
+
+    List<SchoolNoticer> selectNoticer(Long schoolId);
+
 }

+ 2 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/ScoreMapper.java

@@ -41,4 +41,6 @@ public interface ScoreMapper {
     Integer checkPublish(Long id);
 
     Long selectCountBySubjectAndCode(@Param("si_id") Long si_id, @Param("stu_number") String stu_number, @Param("subject")String subject);
+
+    List<ScoreNoticer> selectWechatMsg(Long id);
 }

+ 4 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/HomeWork.java

@@ -46,4 +46,8 @@ public class HomeWork implements Serializable{
 
     private String accessory;   //附件
 
+    private Long task_classid;
+
+    private Long task_gradeid;
+
 }

+ 18 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/HomeworkNoticer.java

@@ -0,0 +1,18 @@
+package com.usoftchina.smartschool.school.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: guq
+ * @create: 2019-03-13 19:11
+ **/
+@Data
+public class HomeworkNoticer implements Serializable{
+
+    private String openid;
+
+    private String subject;
+
+}

+ 22 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/SchoolNoticer.java

@@ -0,0 +1,22 @@
+package com.usoftchina.smartschool.school.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: guq
+ * @create: 2019-03-13 16:07
+ **/
+@Data
+public class SchoolNoticer implements Serializable{
+    /**
+     * 通知人
+     */
+    private String noticer;
+
+    /**
+     * 微信ID
+     */
+    private String openid;
+}

+ 24 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/ScoreNoticer.java

@@ -0,0 +1,24 @@
+package com.usoftchina.smartschool.school.po;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: guq
+ * @create: 2019-03-13 17:32
+ **/
+@Data
+public class ScoreNoticer implements Serializable{
+
+    private String stuName;
+
+    private String stuNo;
+
+    private String subject;
+
+    private Float  score;
+
+    private String openid;
+}

+ 26 - 0
applications/school/school-server/src/main/resources/mapper/HomeWorkMapper.xml

@@ -96,6 +96,12 @@
             <if test="accessory != null">
                 accessory,
             </if>
+            <if test="task_classid != null">
+                task_classid,
+            </if>
+            <if test="task_gradeid != null">
+                task_gradeid,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="subject_id != null">
@@ -143,6 +149,12 @@
             <if test="accessory != null">
                 #{accessory,jdbcType=VARCHAR},
             </if>
+            <if test="task_classid != null">
+                #{task_classid,jdbcType=BIGINT},
+            </if>
+            <if test="task_gradeid != null">
+                #{task_gradeid,jdbcType=BIGINT},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.school.po.HomeWork">
@@ -193,6 +205,12 @@
             <if test="accessory != null">
                 accessory = #{accessory,jdbcType=VARCHAR},
             </if>
+            <if test="task_classid != null">
+                task_classid = #{task_classid,jdbcType=BIGINT},
+            </if>
+            <if test="task_gradeid != null">
+                task_gradeid = #{task_gradeid,jdbcType=BIGINT},
+            </if>
         </set>
         where task_id = #{task_id,jdbcType=BIGINT}
     </update>
@@ -263,4 +281,12 @@
       select count(1) from sys_clazz left join task_notify on sys_clazz.clazz_name=task_notify.classz_name
       where sys_clazz.clazz_id = #{id} and task_notify.task_status=1
   </select>
+
+    <select id="selectHomeworkNoticer" parameterType="long" resultType="com.usoftchina.smartschool.school.po.HomeworkNoticer">
+        select openid,subject_name subject from task_notify left join sys_student on task_classid = clazz_id
+        left join sys_parents_stu on  sys_parents_stu.stu_id =
+        sys_student.stu_id left join sys_parents on sys_parents.parent_id = sys_parents_stu.parent_id
+        left join subject on task_notify.subject_id = subject.subject_id
+        where  ifnull(sys_parents.openid,'') != '' and  parents_status=1 and task_id = #{id}
+    </select>
 </mapper>

+ 5 - 0
applications/school/school-server/src/main/resources/mapper/NotifyMapper.xml

@@ -225,4 +225,9 @@
     <select id="noticeStatus" parameterType="long" resultType="int">
     select count(1) from notify where notify_status=1 and notify_id=#{id}
   </select>
+
+    <select id="selectNoticer" parameterType="long" resultType="com.usoftchina.smartschool.school.po.SchoolNoticer">
+        select openid,parents_name noticer from sys_parents where school_id=#{schoolId} and ifnull(openid,'') != '' and parents_status=1 union
+				select openid,teacher_name noticer from sys_teacher where school_id=#{schoolId} and ifnull(openid,'') != '' and teacher_status=1;
+    </select>
 </mapper>

+ 6 - 0
applications/school/school-server/src/main/resources/mapper/ScoreMapper.xml

@@ -426,4 +426,10 @@
     and sd_subject = #{subject, jdbcType=VARCHAR}
   </select>
 
+  <select id="selectWechatMsg" parameterType="long" resultType="com.usoftchina.smartschool.school.po.ScoreNoticer">
+    select sd_stu stuName , sd_stunumber stuNo, sd_subject subject ,sd_score score ,openid from score_importdetail left join sys_parents_stu on sd_stuid = sys_parents_stu.stu_id
+	  left join sys_parents on sys_parents.parent_id = sys_parents_stu.parent_id
+	  where sd_siid=#{id}     and  ifnull(sys_parents.openid,'') != '' and  parents_status=1
+  </select>
+
 </mapper>

+ 4 - 0
applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WechatApi.java

@@ -2,6 +2,7 @@ package com.usoftchina.smartschool.wechat.api;
 
 import com.usoftchina.smartschool.base.Result;
 import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import com.usoftchina.smartschool.wechat.dto.TransferDTO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -14,4 +15,7 @@ public interface WechatApi {
 
     @PostMapping("/send/Messages")
     Result sendOutMessages(@RequestBody String data);
+
+    @PostMapping("/send/largeMessages")
+    public Result largeMessages(@RequestBody TransferDTO data);
 }

+ 21 - 0
applications/wechat/wechat-dto/src/main/java/com/usoftchina/smartschool/wechat/dto/TransferDTO.java

@@ -0,0 +1,21 @@
+package com.usoftchina.smartschool.wechat.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2019-03-13 15:09
+ **/
+public class TransferDTO implements Serializable{
+
+    private List<MessageInfoDTO> data;
+
+    public List<MessageInfoDTO> getData() {
+        return data;
+    }
+
+    public void setData(List<MessageInfoDTO> data) {
+        this.data = data;
+    }
+}

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

@@ -91,10 +91,6 @@
             <groupId>com.usoftchina.smartschool</groupId>
             <artifactId>wechat-dto</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.usoftchina.smartschool</groupId>
-            <artifactId>wechat-auth</artifactId>
-        </dependency>
     </dependencies>
 
     <build>

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

@@ -1,7 +1,6 @@
 package com.usoftchina.smartschool.wechat;
 
 
-import com.usoftchina.smartschool.wechat.auth.EnableOpenApiAuthClient;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@@ -16,7 +15,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableTransactionManagement
 @EnableEurekaClient
 @EnableFeignClients({"com.usoftchina.smartschool.wechat","com.usoftchina.smartschool.school"})
-@EnableOpenApiAuthClient
 public class WechatApplication {
     public static void main(String[] args) {
         SpringApplication.run(WechatApplication.class, args);

+ 18 - 4
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/TransfersController.java

@@ -3,8 +3,8 @@ package com.usoftchina.smartschool.wechat.controller;
 
 import com.usoftchina.smartschool.base.Result;
 import com.usoftchina.smartschool.utils.JsonUtils;
-import com.usoftchina.smartschool.wechat.auth.annotation.IgnoreOpenApiAuth;
 import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import com.usoftchina.smartschool.wechat.dto.TransferDTO;
 import com.usoftchina.smartschool.wechat.service.SendService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
@@ -33,7 +33,6 @@ public class TransfersController {
     * @Date: 2019/3/7
     */
     @PostMapping("/Message")
-    @IgnoreOpenApiAuth
     public Result sendMsg(@RequestBody MessageInfoDTO info) {
         if (StringUtils.isEmpty(info)) {
             return Result.error("信息为空");
@@ -43,14 +42,13 @@ public class TransfersController {
     }
 
     /**
-    * @Description 对外提供大量数据使用
+    * @Description
     * @Param: [data]
     * @return: com.usoftchina.smartschool.base.Result
     * @Author: guq
     * @Date: 2019/3/7
     */
     @PostMapping("/Messages")
-    @IgnoreOpenApiAuth
     public Result sendOutMessages(@RequestBody String data) throws UnsupportedEncodingException {
         if (StringUtils.isEmpty(data)) {
             return Result.error("信息为空");
@@ -61,4 +59,20 @@ public class TransfersController {
         return Result.success();
     }
 
+    /**
+     * @Description
+     * @Param: [data]
+     * @return: com.usoftchina.smartschool.base.Result
+     * @Author: guq
+     * @Date: 2019/3/7
+     */
+    @PostMapping("/largeMessages")
+    public Result largeMessages(@RequestBody TransferDTO data) {
+        if (StringUtils.isEmpty(data) || StringUtils.isEmpty(data.getData())) {
+            return Result.error("信息为空");
+        }
+        sendService.sendOutMessages(data.getData());
+        return Result.success();
+    }
+
 }

+ 0 - 4
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java

@@ -1,10 +1,7 @@
 package com.usoftchina.smartschool.wechat.controller;
 
-import com.usoftchina.smartschool.wechat.auth.annotation.IgnoreOpenApiAuth;
 import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
 import com.usoftchina.smartschool.wechat.service.SendService;
-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.*;
 
@@ -13,7 +10,6 @@ import org.springframework.web.bind.annotation.*;
  * @create: 2019-01-27 12:41
  **/
 @RestController
-@IgnoreOpenApiAuth
 public class WxPushController {
 
   /*  @Autowired

+ 9 - 0
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/po/MessagePackage.java

@@ -32,4 +32,13 @@ public class MessagePackage implements Serializable{
     public void addRetry() {
         this.retry ++;
     }
+
+    @Override
+    public String toString() {
+        return "MessagePackage{" +
+                "packageId='" + packageId + '\'' +
+                ", data=" + data +
+                ", retry=" + retry +
+                '}';
+    }
 }

+ 2 - 3
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/ReceiveService.java

@@ -3,7 +3,6 @@ package com.usoftchina.smartschool.wechat.service;
 import com.rabbitmq.client.Channel;
 
 import com.usoftchina.smartschool.base.Result;
-import com.usoftchina.smartschool.wechat.auth.context.TransfersContextHodler;
 import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
 import com.usoftchina.smartschool.wechat.mapper.BrokerMessageLogMapper;
 import com.usoftchina.smartschool.wechat.po.MessageInfo;
@@ -99,7 +98,7 @@ public class ReceiveService {
         //channel.basicNack(deliveryTag,false,true);
     }
 
-    private void getOpenId(MessageInfo msg) {
+   /* private void getOpenId(MessageInfo msg) {
         String openId = msg.getTouser();
         Long school = TransfersContextHodler.getSchoolId();
         if (msg.getUserType() == MessageInfoDTO.UserType.PARENT) {
@@ -108,5 +107,5 @@ public class ReceiveService {
            openId = brokerMessageLogMapper.SelectTeacherOpenId(msg.getTouser(), school);
         }
         msg.setTouser(openId);
-    }
+    }*/
 }

+ 19 - 0
applications/wechat/wechat-server/src/test/java/com/usoftchina/smartschool/wechat/NonSpringTest.java

@@ -0,0 +1,19 @@
+package com.usoftchina.smartschool.wechat;
+
+import com.usoftchina.smartschool.utils.DateUtils;
+import org.junit.Test;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2019-03-13 14:58
+ **/
+public class NonSpringTest {
+
+    @Test
+    public void testF_test() {
+        String format = DateUtils.format(new Date(), "yyyy-MM-dd");
+        System.out.println(format);
+    }
+}

+ 20 - 0
applications/wechat/wechat-server/src/test/java/com/usoftchina/smartschool/wechat/Test_service.java

@@ -13,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -91,4 +92,23 @@ public class Test_service {
         //sendService.sendOutMessages(msg);
     }
 
+    /*@Test
+    public void testE_bean() {
+        List<MessageInfoDTO> data = new ArrayList<>();
+        MessageInfoDTO msg = new MessageInfoDTO();
+        msg.setKeyword1("1");
+        msg.setKeyword2("2");
+        msg.setTitle("测试");
+        data.add(msg);
+        MessagePackageDTO packageDTO = new MessagePackageDTO(data);
+        MessagePackage mp = BeanMapper.map(packageDTO, MessagePackage.class);
+        System.out.println(mp);
+    }*/
+
+    @Test
+    public void testF_test() {
+        String format = DateUtils.format(new Date(), "yyyy-MM-dd");
+        System.out.println(format);
+    }
+
 }

+ 1 - 1
frontend/pc-web/app.json

@@ -336,7 +336,7 @@
             "delay": 250
         },
         "server": {
-            "basePath": "https://school-api.ubtob.com",
+            "basePath": "http://127.0.0.1:9520",
             "urlPattern": "^\/api\/"
         }
     },