瀏覽代碼

1、device代码
2、推送队列代码

guq 6 年之前
父節點
當前提交
03a91bf10c
共有 18 個文件被更改,包括 418 次插入24 次删除
  1. 8 0
      applications/device/device-server/pom.xml
  2. 1 1
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/DeviceApplication.java
  3. 65 11
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/listener/AccessControlListener.java
  4. 6 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/DeviceMapper.java
  5. 38 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/Information.java
  6. 51 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/OutInRecord.java
  7. 128 1
      applications/device/device-server/src/main/resources/mapper/DeviceMapper.xml
  8. 1 1
      applications/school/school-api/src/main/java/com/usoftchina/smartschool/school/api/SchoolApi.java
  9. 4 0
      applications/school/school-dto/pom.xml
  10. 53 0
      applications/school/school-dto/src/main/java/com/usoftchina/smartschool/school/dto/StudentDTO.java
  11. 4 0
      applications/wechat/wechat-api/pom.xml
  12. 14 0
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WechatApi.java
  13. 7 6
      applications/wechat/wechat-auth/src/main/java/com/usoftchina/smartschool/wechat/auth/interceptor/OpenApiAuthInterceptor.java
  14. 21 3
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java
  15. 2 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/po/MessageInfo.java
  16. 1 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/impl/WxPushServiceImpl.java
  17. 9 1
      applications/wechat/wechat-server/src/main/resources/config/application-docker-cloud.yml
  18. 5 0
      framework/core/src/main/java/com/usoftchina/smartschool/utils/DateUtils.java

+ 8 - 0
applications/device/device-server/pom.xml

@@ -28,6 +28,10 @@
             <groupId>com.usoftchina.smartschool</groupId>
             <groupId>com.usoftchina.smartschool</groupId>
             <artifactId>file-api</artifactId>
             <artifactId>file-api</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>wechat-api</artifactId>
+        </dependency>
         <dependency>
         <dependency>
             <groupId>org.mybatis.spring.boot</groupId>
             <groupId>org.mybatis.spring.boot</groupId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
@@ -46,6 +50,10 @@
             <artifactId>pagehelper</artifactId>
             <artifactId>pagehelper</artifactId>
             <version>RELEASE</version>
             <version>RELEASE</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>school-dto</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 1 - 1
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/DeviceApplication.java

@@ -14,7 +14,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
 @EnableEurekaClient
 @EnableEurekaClient
 @EnableAsync
 @EnableAsync
 @EnableFeignClients({
 @EnableFeignClients({
-        "com.usoftchina.smartschool.file.api"
+        "com.usoftchina.smartschool.file.api","com.usoftchina.smartschool.wechat.api"
 })
 })
 public class DeviceApplication {
 public class DeviceApplication {
     public static void main(String[] args) {
     public static void main(String[] args) {

+ 65 - 11
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/listener/AccessControlListener.java

@@ -2,15 +2,23 @@ package com.usoftchina.smartschool.device.listener;
 
 
 import com.usoftchina.smartschool.base.Result;
 import com.usoftchina.smartschool.base.Result;
 import com.usoftchina.smartschool.device.api.DeviceApi;
 import com.usoftchina.smartschool.device.api.DeviceApi;
+import com.usoftchina.smartschool.device.dto.AccessControlInfo;
 import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.event.AccessControlEvent;
 import com.usoftchina.smartschool.device.event.AccessControlEvent;
 import com.usoftchina.smartschool.device.mapper.DeviceMapper;
 import com.usoftchina.smartschool.device.mapper.DeviceMapper;
 import com.usoftchina.smartschool.device.po.Device;
 import com.usoftchina.smartschool.device.po.Device;
 import com.usoftchina.smartschool.device.po.ImageFile;
 import com.usoftchina.smartschool.device.po.ImageFile;
+import com.usoftchina.smartschool.device.po.Information;
+import com.usoftchina.smartschool.device.po.OutInRecord;
 import com.usoftchina.smartschool.device.service.DeviceService;
 import com.usoftchina.smartschool.device.service.DeviceService;
 import com.usoftchina.smartschool.file.api.FileApi;
 import com.usoftchina.smartschool.file.api.FileApi;
 import com.usoftchina.smartschool.file.dto.FileInfoDTO;
 import com.usoftchina.smartschool.file.dto.FileInfoDTO;
+import com.usoftchina.smartschool.school.dto.StudentDTO;
+import com.usoftchina.smartschool.utils.DateUtils;
 import com.usoftchina.smartschool.utils.StringUtils;
 import com.usoftchina.smartschool.utils.StringUtils;
+import com.usoftchina.smartschool.wechat.api.WechatApi;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import org.apache.catalina.realm.LockOutRealm;
 import org.aspectj.util.FileUtil;
 import org.aspectj.util.FileUtil;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -22,7 +30,9 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.io.File;
 import java.io.File;
+import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -32,15 +42,20 @@ import java.util.List;
 @Component
 @Component
 public class AccessControlListener implements InitializingBean{
 public class AccessControlListener implements InitializingBean{
 
 
-    /*@Autowired
-    private FileApi fileApi;*/
+    @Autowired
+    private FileApi fileApi;
 
 
     @Autowired
     @Autowired
     private DeviceApi deviceApi;
     private DeviceApi deviceApi;
 
 
+    @Autowired
+    private WechatApi wechatApi;
+
     @Autowired
     @Autowired
     private DeviceMapper deviceMapper;
     private DeviceMapper deviceMapper;
 
 
+    final static String TEMPLATEID = "JcWRReMGC1odqcaAgXDfETv9sWwVbWLXc9KLEn_Nve0";
+
     private Logger logger = LoggerFactory.getLogger(AccessControlListener.class);
     private Logger logger = LoggerFactory.getLogger(AccessControlListener.class);
 
 
     /**
     /**
@@ -51,26 +66,65 @@ public class AccessControlListener implements InitializingBean{
     @Async
     @Async
     @EventListener(AccessControlEvent.class)
     @EventListener(AccessControlEvent.class)
     public void onAccessControlEvent(AccessControlEvent event) {
     public void onAccessControlEvent(AccessControlEvent event) {
+        Long fileId = null;
+        String cardNo = event.getAccessControlInfo().getCardNo();
+        if (StringUtils.isEmpty(cardNo)) {
+            return;
+        }
+        /**
+         * 查询人员信息
+         */
+        List<Information> information = deviceMapper.selectInfoByCardNo(cardNo);
+        if (null == information || information.size() == 0) {
+            logger.error("学生信息不存在");
+            return;
+        }
         /**
         /**
          * 1、保存图片文件;
          * 1、保存图片文件;
          */
          */
         byte[] imageData = event.getAccessControlInfo().getImageData();
         byte[] imageData = event.getAccessControlInfo().getImageData();
-        MultipartFile file = new ImageFile(imageData, "测试");
-        Result<FileInfoDTO> fileInfo = null;
-        try {
-           // fileInfo = fileApi.upload(0l, file);
-        }catch (Exception ex) {
+        if (null != imageData && imageData.length > 0) {
+            MultipartFile file = new ImageFile(imageData, information.get(0).getStuName());
+            Result<FileInfoDTO> fileInfo = null;
+            try {
+                fileInfo = fileApi.upload(0l, file);
+                fileId = fileInfo.getData().getId();
+            }catch (Exception ex) {
+                logger.error(ex.getMessage());
+            }
         }
         }
         /**
         /**
          * 2、保存门禁出入记录;
          * 2、保存门禁出入记录;
          */
          */
-        Long fileId = fileInfo.getData().getId();
-
-        logger.info(event.getAccessControlInfo().getCardNo());
+        int type = event.getAccessControlInfo().getEventType();
+        Information info = information.get(0);
+        OutInRecord record = new OutInRecord();
+        record.setClazz_id(info.getClazz_id());
+        record.setSchool_id(info.getSchoolId());
+        record.setClazz_name(info.getStuClass());
+        record.setSchool_id(info.getSchoolId());
+        record.setGrade_clazz(info.getStuClassnickname());
+        record.setGrade_name(info.getStuGrade());
+        record.setRecord_date(new Date());
+        record.setStu_sex(info.getStuSex());
+        record.setRecord_type(type);
+        record.setStu_id(info.getStuId());
+        record.setStu_number(info.getStuNumber());
+        record.setRecord_name(info.getStuName() + (type == 1 ? "进人" : "出去"));
+        deviceMapper.insertRecordSelective(record);
         /**
         /**
          * 3、推送消息到消息服务器(微信服务监听此消息发送微信消息)
          * 3、推送消息到消息服务器(微信服务监听此消息发送微信消息)
          */
          */
-
+        MessageInfoDTO msg = new MessageInfoDTO();
+        msg.setAppId(info.getAppId());
+        msg.setSecret(info.getSecret());
+        msg.setTouser(info.getOpenId());
+        msg.setTemplateId(TEMPLATEID);
+        msg.setTitle("出入校提醒");
+        msg.setKeyword1(info.getStuName());
+        msg.setKeyword2(DateUtils.format());
+        msg.setRemark("您好! 你的孩子: " + info.getStuName() + (type == 1 ? " 进人" : " 出去") + "学校");
+        wechatApi.sendMsg(msg);
     }
     }
 
 
     @Override
     @Override

+ 6 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/DeviceMapper.java

@@ -2,6 +2,8 @@ package com.usoftchina.smartschool.device.mapper;
 
 
 import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.po.Device;
 import com.usoftchina.smartschool.device.po.Device;
+import com.usoftchina.smartschool.device.po.Information;
+import com.usoftchina.smartschool.device.po.OutInRecord;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -23,4 +25,8 @@ public interface DeviceMapper {
     void updateByPrimaryKeySelective(Device formdata);
     void updateByPrimaryKeySelective(Device formdata);
 
 
     void deleteByPrimaryKey(Long id);
     void deleteByPrimaryKey(Long id);
+
+    List<Information>selectInfoByCardNo(String cardNo);
+
+    void insertRecordSelective(OutInRecord record);
 }
 }

+ 38 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/Information.java

@@ -0,0 +1,38 @@
+package com.usoftchina.smartschool.device.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: guq
+ * @create: 2019-03-11 10:57
+ **/
+@Data
+public class Information implements Serializable{
+
+    private String appId;
+
+    private String secret;
+
+    private String openId;
+
+    private String stuName;
+
+    private Long stuId;
+
+    private Long schoolId;
+
+    private String stuNumber;
+
+    private Long clazz_id;
+
+    private String stuClass;
+
+    private String stuGrade;
+
+    private String stuClassnickname;
+
+    private int stuSex;
+
+}

+ 51 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/OutInRecord.java

@@ -0,0 +1,51 @@
+package com.usoftchina.smartschool.device.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2019-03-11 11:33
+ **/
+@Data
+public class OutInRecord implements Serializable{
+    private Long record_id;         //编号
+
+    private String record_name;     //记录名
+
+    private Date out_date;          //出校时间
+
+    private Date in_date;           //入校时间
+
+    private String record_details;  //详情
+
+    private String record_remarks;  //备注
+
+    private String device_id;       //设备标识
+
+    private Long stu_id;            //学生编号
+
+    private Long school_id;         //学校编号
+
+    private Integer stu_sex;        //学生性别
+
+    private String stu_number;      //学号
+
+    private String stu_name;	    //学生姓名
+
+    private Long grade_id;	        //年级编号
+
+    private String grade_name;	    //年级名
+
+    private Long clazz_id;	        //班级编号
+
+    private String clazz_name;	    //班级名
+
+    private String grade_clazz;	    //年级加班级名
+
+    private Integer record_type;
+
+    private Date record_date;
+}

+ 128 - 1
applications/device/device-server/src/main/resources/mapper/DeviceMapper.xml

@@ -90,7 +90,7 @@
         <if test="devicePassword != null" >
         <if test="devicePassword != null" >
             devicePassword = #{devicePassword,jdbcType=VARCHAR},
             devicePassword = #{devicePassword,jdbcType=VARCHAR},
         </if>
         </if>
-        <if ktest="deviceIp != null" >
+        <if test="deviceIp != null" >
             deviceIp = #{deviceIp,jdbcType=VARCHAR},
             deviceIp = #{deviceIp,jdbcType=VARCHAR},
         </if>
         </if>
         <if test="deviceRemark != null" >k
         <if test="deviceRemark != null" >k
@@ -107,4 +107,131 @@
         delete from device where deviceId = #{id}
         delete from device where deviceId = #{id}
     </delete>
     </delete>
 
 
+    <select id="selectInfoByCardNo" parameterType="string" resultMap="information">
+        select school_appid,school_secret,sys_parents.openid,sys_student.stu_name,sys_student.stu_id,sys_school.school_id,
+         stu_number,sys_student.clazz_id,stu_class,stu_grade,stu_classnickname,stu_sex from sys_student left join sys_school on sys_student.school_id=sys_school.school_id
+        left join sys_parents_stu on sys_student.stu_id=sys_parents_stu.stu_id left join sys_parents on sys_parents.parent_id =
+        sys_parents_stu.parent_id where stu_cardNo = #{cardNo}
+    </select>
+
+    <resultMap id="information" type="com.usoftchina.smartschool.device.po.Information" >
+        <result column="school_appid" property="appId" jdbcType="VARCHAR" />
+        <result column="school_secret" property="secret" jdbcType="VARCHAR" />
+        <result column="openid" property="openId" jdbcType="VARCHAR" />
+        <result column="stu_name" property="stuName" jdbcType="VARCHAR" />
+        <result column="stu_id" property="stuId" jdbcType="BIGINT"/>
+        <result column="school_id" property="schoolId" jdbcType="BIGINT"/>
+        <result column="stu_number" property="stuNumber" jdbcType="VARCHAR" />
+        <result column="clazz_id" property="clazz_id" jdbcType="BIGINT" />
+        <result column="stu_class" property="stuClass" jdbcType="VARCHAR" />
+        <result column="stu_grade" property="stuGrade" jdbcType="VARCHAR" />
+        <result column="stu_classnickname" property="stuClassnickname" jdbcType="VARCHAR"/>
+        <result column="stu_sex" property="stuSex" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <insert id="insertRecordSelective" parameterType="com.usoftchina.smartschool.device.po.OutInRecord" >
+        insert into out_in_record
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="record_name != null" >
+                record_name,
+            </if>
+            <if test="out_date != null" >
+                out_date,
+            </if>
+            <if test="in_date != null" >
+                in_date,
+            </if>
+            <if test="record_details != null" >
+                record_details,
+            </if>
+            <if test="record_remarks != null" >
+                record_remarks,
+            </if>
+            <if test="device_id != null" >
+                device_id,
+            </if>
+            <if test="stu_id != null" >
+                stu_id,
+            </if>
+            <if test="school_id != null" >
+                school_id,
+            </if>
+            <if test="stu_number != null" >
+                stu_number,
+            </if>
+            <if test="clazz_id != null" >
+                clazz_id,
+            </if>
+            <if test="clazz_name != null" >
+                clazz_name,
+            </if>
+            <if test="grade_name != null" >
+                grade_name,
+            </if>
+            <if test="grade_clazz != null" >
+                grade_clazz,
+            </if>
+            <if test="stu_sex != null" >
+                stu_sex,
+            </if>
+            <if test="record_type != null" >
+                record_type,
+            </if>
+            <if test="record_date != null" >
+                record_date,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="record_name != null" >
+                #{record_name,jdbcType=VARCHAR},
+            </if>
+            <if test="out_date != null" >
+                #{out_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="in_date != null" >
+                #{in_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="record_details != null" >
+                #{record_details,jdbcType=VARCHAR},
+            </if>
+            <if test="record_remarks != null" >
+                #{record_remarks,jdbcType=VARCHAR},
+            </if>
+            <if test="device_id != null" >
+                #{device_id,jdbcType=BIGINT},
+            </if>
+            <if test="stu_id != null" >
+                #{stu_id,jdbcType=BIGINT},
+            </if>
+            <if test="school_id != null" >
+                #{school_id,jdbcType=BIGINT},
+            </if>
+
+            <if test="stu_number != null" >
+                #{stu_number,jdbcType=VARCHAR},
+            </if>
+            <if test="clazz_id != null" >
+                #{clazz_id,jdbcType=BIGINT},
+            </if>
+            <if test="clazz_name != null" >
+                #{clazz_name,jdbcType=VARCHAR},
+            </if>
+            <if test="grade_name != null" >
+                #{grade_name,jdbcType=VARCHAR},
+            </if>
+            <if test="grade_clazz != null" >
+                #{grade_clazz,jdbcType=VARCHAR},
+            </if>
+            <if test="stu_sex != null" >
+                #{stu_sex,jdbcType=INTEGER},
+            </if>
+            <if test="record_type != null" >
+                #{record_type,jdbcType=INTEGER},
+            </if>
+            <if test="record_date != null" >
+                #{record_date,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+
 </mapper>
 </mapper>

+ 1 - 1
applications/school/school-api/src/main/java/com/usoftchina/smartschool/school/api/SchoolApi.java

@@ -9,6 +9,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 @FeignClient("school-server")
 @FeignClient("school-server")
 public interface SchoolApi {
 public interface SchoolApi {
 
 
-    @GetMapping("/find")
+    @GetMapping("/school/find")
     public Result<SysSchoolDTO> find(@RequestParam("schoolName") String schoolName);
     public Result<SysSchoolDTO> find(@RequestParam("schoolName") String schoolName);
 }
 }

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

@@ -16,6 +16,10 @@
             <groupId>com.alibaba</groupId>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
             <artifactId>fastjson</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
 
 

+ 53 - 0
applications/school/school-dto/src/main/java/com/usoftchina/smartschool/school/dto/StudentDTO.java

@@ -0,0 +1,53 @@
+package com.usoftchina.smartschool.school.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2019-03-11 09:02
+ **/
+
+public class StudentDTO implements Serializable{
+    private Long stu_id;
+
+    private String stu_number;
+
+    private String stu_name;
+
+    private Date stu_enroll_date;
+
+    private Date stu_graduate_date;
+
+    private Date stu_birthday;
+
+    private Integer stu_age;
+
+    private Integer stu_sex;
+
+    private String stu_address;
+
+    private String stu_photo;
+
+    private Integer stu_status;
+
+    private Integer stu_is_write;
+
+    private String stu_remarks;
+
+    private Long clazz_id;
+
+    private Long school_id;
+
+    private String stu_classnickname;
+
+    private String stu_class;
+
+    private String stu_grade;
+
+    private String stu_native;
+
+    private String stu_nation;
+
+    private String stu_political;
+}

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

@@ -20,5 +20,9 @@
             <groupId>com.usoftchina.smartschool</groupId>
             <groupId>com.usoftchina.smartschool</groupId>
             <artifactId>core</artifactId>
             <artifactId>core</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>wechat-dto</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 </project>
 </project>

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

@@ -0,0 +1,14 @@
+package com.usoftchina.smartschool.wechat.api;
+
+import com.usoftchina.smartschool.base.Result;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient(name = "wechat-server")
+public interface WechatApi {
+
+    @PostMapping("/send/Message")
+    public Result sendMsg(@RequestBody MessageInfoDTO info);
+}

+ 7 - 6
applications/wechat/wechat-auth/src/main/java/com/usoftchina/smartschool/wechat/auth/interceptor/OpenApiAuthInterceptor.java

@@ -18,6 +18,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.net.URLDecoder;
 import java.util.Map;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 
 
@@ -62,18 +63,18 @@ public class OpenApiAuthInterceptor extends HandlerInterceptorAdapter{
                 logger.info("servletPath:{}", servletPath);
                 logger.info("servletPath:{}", servletPath);
 
 
                 boolean check = false;
                 boolean check = false;
+                schoolName = URLDecoder.decode(schoolName);
                 //获取密钥
                 //获取密钥
                 Result<SysSchoolDTO> result = schoolApi.find(schoolName);
                 Result<SysSchoolDTO> result = schoolApi.find(schoolName);
-                if (result.isSuccess()) {
+                if (result.isSuccess() && null != result.getData()) {
                     String localSign = null;
                     String localSign = null;
                     //TransfersContextHodler.setB2bCompanyId(companyResult.getData().getId());
                     //TransfersContextHodler.setB2bCompanyId(companyResult.getData().getId());
                     localSign = result.getData().getSchool_accesssecret() == null ? HmacUtils.encode(urlMessage) :
                     localSign = result.getData().getSchool_accesssecret() == null ? HmacUtils.encode(urlMessage) :
                                 HmacUtils.encode(urlMessage, result.getData().getSchool_accesssecret());
                                 HmacUtils.encode(urlMessage, result.getData().getSchool_accesssecret());
-
-                    if (servletPath.indexOf("b2b") > -1) {
-                        logger.info("自己生产的sign:{}-----传入的sign:{}", localSign, sign);
-                        check = sign.equals(localSign);
-                    }
+                    //if (servletPath.indexOf("") > -1) {
+                    logger.info("自己生产的sign:{}-----传入的sign:{}", localSign, sign);
+                    check = sign.equals(localSign);
+                  //  }
 
 
                     if (check) {
                     if (check) {
                         String timestamp = request.getParameter(openApiConfig.getTimestampParam());
                         String timestamp = request.getParameter(openApiConfig.getTimestampParam());

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

@@ -1,6 +1,8 @@
 package com.usoftchina.smartschool.wechat.controller;
 package com.usoftchina.smartschool.wechat.controller;
 
 
 import com.usoftchina.smartschool.wechat.auth.annotation.IgnoreOpenApiAuth;
 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 com.usoftchina.smartschool.wechat.service.WxPushService;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,12 +16,28 @@ import org.springframework.web.bind.annotation.*;
 @IgnoreOpenApiAuth
 @IgnoreOpenApiAuth
 public class WxPushController {
 public class WxPushController {
 
 
-    @Autowired
-    private WxPushService wxPushService;
+  /*  @Autowired
+    private WxPushService wxPushService;*/
+  @Autowired
+  private SendService sendService;
 
 
     @GetMapping("/wxpush")
     @GetMapping("/wxpush")
     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){
     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){
-        return wxPushService.wxPush(appId, secret,openid, templateId, title, keyword1, keyword2, keyword3, keyword4, remark, url);
+        MessageInfoDTO msg = new MessageInfoDTO();
+        msg.setAppId(appId);
+        msg.setSecret(secret);
+        msg.setTouser(openid);
+        msg.setTemplateId(templateId);
+        msg.setTitle(title);
+        msg.setKeyword2(keyword1);
+        msg.setKeyword2(keyword2);
+        msg.setKeyword3(keyword3);
+        msg.setKeyword4(keyword4);
+        msg.setRemark(remark);
+        msg.setUrl(url);
+        sendService.sendMessage(msg);
+        return "已推送";
+        //return wxPushService.wxPush(appId, secret,openid, templateId, title, keyword1, keyword2, keyword3, keyword4, remark, url);
     };
     };
 
 
 }
 }

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

@@ -47,6 +47,8 @@ public class MessageInfo implements Serializable {
 
 
     private String keyword5;
     private String keyword5;
 
 
+    private String keyword6;
+
     private String remark;
     private String remark;
 
 
     private String url;
     private String url;

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

@@ -86,6 +86,7 @@ public class WxPushServiceImpl implements WxPushService{
                     + "\"keyword2\":{\"value\":\"" + info.getKeyword2() + "\",\"color\":\"#173177\"},"
                     + "\"keyword2\":{\"value\":\"" + info.getKeyword2() + "\",\"color\":\"#173177\"},"
                     + "\"keyword3\":{\"value\":\"" + info.getKeyword3() + "\",\"color\":\"#173177\"},"
                     + "\"keyword3\":{\"value\":\"" + info.getKeyword3() + "\",\"color\":\"#173177\"},"
                     + "\"keyword4\":{\"value\":\"" + info.getKeyword4() + "\",\"color\":\"#173177\"},"
                     + "\"keyword4\":{\"value\":\"" + info.getKeyword4() + "\",\"color\":\"#173177\"},"
+                    + "\"keyword5\":{\"value\":\"" + info.getKeyword5() + "\",\"color\":\"#173177\"},"
                     + "\"remark\":{\"value\":\"" + info.getRemark() + "\",\"color\":\"#173177\"}}}";
                     + "\"remark\":{\"value\":\"" + info.getRemark() + "\",\"color\":\"#173177\"}}}";
 
 
             HashMap<String, Object> params=new HashMap<>();
             HashMap<String, Object> params=new HashMap<>();

+ 9 - 1
applications/wechat/wechat-server/src/main/resources/config/application-docker-cloud.yml

@@ -20,4 +20,12 @@ spring:
         maximum-pool-size: 50
         maximum-pool-size: 50
         idle-timeout: 30000
         idle-timeout: 30000
         max-lifetime: 1800000
         max-lifetime: 1800000
-        connection-timeout: 30000
+        connection-timeout: 30000
+  rabbitmq:
+      host: 127.0.0.1
+      port: 5672
+      virtual-host: school
+      username: saas
+      password: select123***
+      publisher-returns: true
+      publisher-confirms: true

+ 5 - 0
framework/core/src/main/java/com/usoftchina/smartschool/utils/DateUtils.java

@@ -31,6 +31,11 @@ public class DateUtils {
         return sdf.format(date);
         return sdf.format(date);
     }
     }
 
 
+    public static String format() {
+        Date date = new Date();
+        return YMD_HMS.format(date);
+    }
+
     public static Date parse(String date, String f) {
     public static Date parse(String date, String f) {
         if (date == null) {
         if (date == null) {
             return new Date();
             return new Date();