Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

soft5566 2 anni fa
parent
commit
7985e2d1ee
68 ha cambiato i file con 2191 aggiunte e 1080 eliminazioni
  1. 264 660
      .idea/workspace.xml
  2. 5 0
      SmartNotificationMapper.xml
  3. 8 0
      src/main/java/com/template/api/SmartAttendanceControllerAPI.java
  4. 7 0
      src/main/java/com/template/api/SmartCodeOpenIdControllerAPI.java
  5. 16 0
      src/main/java/com/template/api/SmartNotificationControllerAPI.java
  6. 1 1
      src/main/java/com/template/api/SmartUserControllerAPI.java
  7. 26 0
      src/main/java/com/template/api/WxGzhControllerAPI.java
  8. 7 4
      src/main/java/com/template/common/utils/GetCameraPreviewURL.java
  9. 1 1
      src/main/java/com/template/common/utils/HttpsClient.java
  10. 90 55
      src/main/java/com/template/common/utils/Message2.java
  11. 3 3
      src/main/java/com/template/common/utils/SendSms.java
  12. 29 2
      src/main/java/com/template/common/utils/TimeExchange.java
  13. 101 13
      src/main/java/com/template/controller/HikvisionController.java
  14. 118 7
      src/main/java/com/template/controller/SmartAttendanceController.java
  15. 21 0
      src/main/java/com/template/controller/SmartCodeOpenIdController.java
  16. 5 0
      src/main/java/com/template/controller/SmartDutiesController.java
  17. 46 0
      src/main/java/com/template/controller/SmartNotificationController.java
  18. 395 244
      src/main/java/com/template/controller/SmartUserController.java
  19. 3 3
      src/main/java/com/template/controller/SmartVisitorController.java
  20. 18 15
      src/main/java/com/template/controller/SmartWarningController.java
  21. 153 0
      src/main/java/com/template/controller/WxGzhController.java
  22. 18 0
      src/main/java/com/template/mapper/SmartCodeOpenIdMapper.java
  23. 2 0
      src/main/java/com/template/mapper/SmartEvaluateSdetailMapper.java
  24. 2 0
      src/main/java/com/template/mapper/SmartEvaluateStudentMapper.java
  25. 3 1
      src/main/java/com/template/mapper/SmartEvaluateTdetailMapper.java
  26. 3 1
      src/main/java/com/template/mapper/SmartEvaluateTeacherMapper.java
  27. 18 0
      src/main/java/com/template/mapper/SmartNotificationMapper.java
  28. 3 1
      src/main/java/com/template/mapper/SmartScoreManageMapper.java
  29. 2 0
      src/main/java/com/template/mapper/SmartSubjectManageMapper.java
  30. 2 0
      src/main/java/com/template/mapper/SmartSubjectRuleMapper.java
  31. 1 0
      src/main/java/com/template/mapper/SmartUserMapper.java
  32. 81 0
      src/main/java/com/template/model/enumModel/eAttendanceStatu.java
  33. 29 3
      src/main/java/com/template/model/enumModel/eTimeGroup.java
  34. 70 0
      src/main/java/com/template/model/enumModel/eXwApproveStatu.java
  35. 24 0
      src/main/java/com/template/model/pojo/SmartAttendance.java
  36. 64 0
      src/main/java/com/template/model/pojo/SmartCodeOpenId.java
  37. 80 0
      src/main/java/com/template/model/pojo/SmartNotification.java
  38. 3 0
      src/main/java/com/template/model/pojo/SmartUser.java
  39. 18 0
      src/main/java/com/template/model/request/otherAppointmentRequest.java
  40. 5 0
      src/main/java/com/template/services/SmartAttendanceService.java
  41. 16 0
      src/main/java/com/template/services/SmartCodeOpenIdService.java
  42. 18 0
      src/main/java/com/template/services/SmartNotificationService.java
  43. 17 0
      src/main/java/com/template/services/SmartUserService.java
  44. 1 0
      src/main/java/com/template/services/SmartWarningService.java
  45. 19 0
      src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java
  46. 20 0
      src/main/java/com/template/services/impl/SmartCodeOpenIdServiceImpl.java
  47. 90 43
      src/main/java/com/template/services/impl/SmartFaceDiscernServiceImpl.java
  48. 2 1
      src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java
  49. 38 0
      src/main/java/com/template/services/impl/SmartNotificationServiceImpl.java
  50. 37 0
      src/main/java/com/template/services/impl/SmartUserServiceImpl.java
  51. 4 0
      src/main/java/com/template/services/impl/SmartWarningServiceImpl.java
  52. 5 0
      src/main/resources/mapper/template/SmartAttendanceMapper.xml
  53. 5 0
      src/main/resources/mapper/template/SmartClassMapper.xml
  54. 5 0
      src/main/resources/mapper/template/SmartDutiesMapper.xml
  55. 5 0
      src/main/resources/mapper/template/SmartGradeMapper.xml
  56. 5 0
      src/main/resources/mapper/template/SmartMenuMapper.xml
  57. 5 0
      src/main/resources/mapper/template/SmartNotificationMapper.xml
  58. 5 0
      src/main/resources/mapper/template/SmartQrcodeMapper.xml
  59. 84 0
      src/main/resources/mapper/template/SmartScoreMapper.xml
  60. 8 0
      src/main/resources/mapper/template/SmartSubjectManageMapper.xml
  61. 8 0
      src/main/resources/mapper/template/SmartUserMapper.xml
  62. 5 5
      target/classes/application-dev.yml
  63. 5 5
      target/classes/application-prod.yml
  64. 5 5
      target/classes/application.yml
  65. 12 7
      target/classes/mapper/template/SmartUserMapper.xml
  66. 11 0
      target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  67. 11 0
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  68. BIN
      target/mybatis_plus-0.0.1-SNAPSHOT.jar.original

File diff suppressed because it is too large
+ 264 - 660
.idea/workspace.xml


+ 5 - 0
SmartNotificationMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartNotificationMapper">
+
+</mapper>

+ 8 - 0
src/main/java/com/template/api/SmartAttendanceControllerAPI.java

@@ -39,4 +39,12 @@ public interface SmartAttendanceControllerAPI {
     @GetMapping(value = "/queryLeaveRecords")
     @ApiOperation(value = "获取请假记录数据", notes = "获取请假记录数据", httpMethod = "GET")
     CommonResult queryLeaveRecords();
+
+    /**
+     * 首页请假数据
+     * 不清楚是获取当年的 还是当月的 还是本周的
+     * 可查询的时间范围不清楚
+     */
+
+
 }

+ 7 - 0
src/main/java/com/template/api/SmartCodeOpenIdControllerAPI.java

@@ -0,0 +1,7 @@
+package com.template.api;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RequestMapping("/api/smart-code-open-id")
+public interface SmartCodeOpenIdControllerAPI {
+}

+ 16 - 0
src/main/java/com/template/api/SmartNotificationControllerAPI.java

@@ -0,0 +1,16 @@
+package com.template.api;
+
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RequestMapping("/api/smart-notification")
+public interface SmartNotificationControllerAPI {
+
+    @GetMapping(value = "/remindingList")
+    @ApiOperation(value = "消息提醒页面展示", notes = "消息提醒页面展示", httpMethod = "GET")
+    CommonResult remindingList(@RequestParam Integer id, @RequestParam int currentPage, @RequestParam int pageCount, String type);
+
+}

+ 1 - 1
src/main/java/com/template/api/SmartUserControllerAPI.java

@@ -42,7 +42,7 @@ public interface SmartUserControllerAPI {
      */
     @PostMapping(value = "importExcelUsers")
     @ApiOperation(value = "批量导入用户信息", notes = "批量导入用户信息", httpMethod = "POST")
-    CommonResult importExcelUsers(@RequestParam("file") MultipartFile excelFile, @RequestParam String headImage) throws IOException;
+    CommonResult importExcelUsers(@RequestParam("file") MultipartFile excelFile, @RequestParam String headImage) throws Exception;
 
     /**
      * 批量导入压缩包

+ 26 - 0
src/main/java/com/template/api/WxGzhControllerAPI.java

@@ -0,0 +1,26 @@
+package com.template.api;
+
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RequestMapping("/api/wxGzh")
+public interface WxGzhControllerAPI {
+
+    @GetMapping(value = "getWxGzhOpenid")
+    @ApiOperation(value = "通过微信公众号的code获取openid", notes = "通过微信公众号的code获取openid", httpMethod = "GET")
+    CommonResult getWxGzhOpenid(@RequestParam String code) throws Exception;
+
+
+    @GetMapping(value = "/vertifyMessage")
+    @ApiOperation(value = "通过手机号绑定公众号openId", notes = "通过手机号绑定公众号openId", httpMethod = "GET")
+    CommonResult vertifyMessage(@RequestParam String phone,@RequestParam String code,@RequestParam String wxGzhCode);
+
+
+    @GetMapping(value = "/unbinding")
+    @ApiOperation(value = "通过手机号解绑", notes = "通过手机号解绑", httpMethod = "GET")
+    CommonResult unbinding(@RequestParam String phone);
+}

+ 7 - 4
src/main/java/com/template/common/utils/GetCameraPreviewURL.java

@@ -80,19 +80,22 @@ public class GetCameraPreviewURL {
         JSONObject jsonBody = new JSONObject();
 
 //        人脸比对
-        int[] ingArr=new int[]{131659};
-        String url = "http://192.168.161.224:8080/wanzai/eventRcv/faceComparison";
+//        int[] ingArr=new int[]{131659};
+//        String url = "http://192.168.161.224:8080/wanzai/eventRcv/faceComparison";
 //        String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/faceComparison";
+//        String url = "http://122.51.35.116:8080/wanzai/eventRcv/faceComparison";
 
 //        区域入侵,进入区域,离开区域,倒地
-//        int[] ingArr=new int[]{131588,131586,131587,131605};
-//        String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
+        int[] ingArr=new int[]{131588,131586,131587,131605};
+        String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
 //        String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/subscription";
+//        String url = "http://122.51.35.116:8080/wanzai/eventRcv/subscription";
 
 //        重点人员识别事件
 //        int[] ingArr = new int[]{1644175361};
 //        String url = "http://192.168.161.224:8080/wanzai/eventRcv/emphasisFace";
 //        String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/emphasisFace";
+//        String url = "http://122.51.35.116:8080/wanzai/eventRcv/emphasisFace";
 
 
         jsonBody.put("eventTypes", ingArr);

+ 1 - 1
src/main/java/com/template/common/utils/HttpsClient.java

@@ -449,7 +449,7 @@ public class HttpsClient {
             // 读取响应
             is = connection.getInputStream();
             int length = (int) connection.getContentLength();// 获取字节长度
-            System.out.println(length);
+//            System.out.println(length);
             if (length != -1) {
                 byte[] data = new byte[length];
                 byte[] temp = new byte[512];

+ 90 - 55
src/main/java/com/template/common/utils/Message2.java

@@ -1,10 +1,25 @@
 package com.template.common.utils;
 
+import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
 
 
+import java.io.IOException;
 import java.util.HashMap;
 
 /**
@@ -12,67 +27,87 @@ import java.util.HashMap;
  */
 public class Message2 {
 
-    /** 公众号推送消息
-     * openid:用户小程序openid, order_num订单号,
-     *  h_type房型, live_end入住和离店日期:2023-08-02~2023-08-06
-     *  user_name:用户名, hotel_name:酒店名
-     * **/
-    public static String send(String openid,String order_num,
-                              String h_type,String live_end,
-                              String user_name,String hotel_name,String id)
+//小程序
+//    static String appId="wx2fc3f45732fae5d3";
+//    static String secret="7eee4a49a4470a77f9222995e8511547";
+
+//公众号
+    static String appId="wxa46ef222053a1047";
+    static String secret="16f74a1265c314fd79fdf90670173467";
+
+    /**
+     * 公众号推送消息
+     * @param openid 公众号openId
+     * @param type  事件
+     * @param location  地点
+     * @param dateTime  时间
+     * @return
+     * @throws Exception
+     */
+    public static String send(String openid,String type,String location,String dateTime)
             throws Exception {
-        Gson gson = new Gson();
-        String access_token = "";
-        JSONObject json = new JSONObject();
-        json.put("grant_type", "client_credential");
-//        公众号
-        json.put("appid","wxa46ef222053a1047");
-        json.put("secret","16f74a1265c314fd79fdf90670173467");
-        String url = "https://api.weixin.qq.com/cgi-bin/stable_token";
-        access_token = HttpsClient.sendJson(url,json);
-        access_token = gson.fromJson(access_token, AccessToken.class).getAccess_token();
+
+        String url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;
+
+        String s = HttpsClient.httpsRequestReturnString(url, "GET", "");
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        String access_token = jsonObject.getString("access_token");
+
+
         JSONObject message = new JSONObject();
         message.put("touser", openid);
-        message.put("template_id", "pQLY-9pKW-lD-6PuOlxieatGmuCHOezubTxI99cs7Zo");
-
-//        JSONObject small = new JSONObject();
-//        small.put("appid", "wx2fc3f45732fae5d3");
-//        small.put("pagepath", "/pages/push/push?id=" + id);
-//        message.put("miniprogram", small);
-        // 订单号
-        JSONObject character_string1_ = new JSONObject();
-        character_string1_.put("value", order_num);
-        character_string1_.put("color", "#173177");
-        // 房型名称
-        JSONObject thing6 = new JSONObject();
-        thing6.put("value", h_type);
-        thing6.put("color", "#0000FF");
-        // 入离时间
-        JSONObject time11 = new JSONObject();
-        time11.put("value", live_end);
-        time11.put("color", "#173177");
-        // 客户名称
-        JSONObject thing10 = new JSONObject();
-        thing10.put("value", user_name);
-        thing10.put("color", "#173177");
-        // 酒店名称
-        JSONObject thing9_ = new JSONObject();
-        thing9_.put("value", hotel_name);
-        thing9_.put("color", "#173177");
+        message.put("template_id", "vPuSS7nivkQHxcGzpZB-NedVKzqJ4ifk0FTiBI7Aa20");
+
+        JSONObject small = new JSONObject();
+        small.put("appid", "wx2fc3f45732fae5d3");
+        small.put("pagepath", "pages/msgWarn/msgWarn");
+        message.put("miniprogram", small);
+        // 报警类型
+        JSONObject const2 = new JSONObject();
+        const2.put("value", type);
+        const2.put("color", "#173177");
+
+        // 报警位置
+        JSONObject thing3 = new JSONObject();
+        thing3.put("value", location);
+        thing3.put("color", "#173177");
+
+        // 报警时间
+        JSONObject time4 = new JSONObject();
+        time4.put("value", dateTime);
+        time4.put("color", "#173177");
+
         // 封装data
         JSONObject data = new JSONObject();
-        // 订单号
-        data.put("character_string1",character_string1_);
-        // 房型名称
-        data.put("thing6",thing6);
-        // 入离时间
-        data.put("time11",time11);
-        // 客户名称
-        data.put("thing10",thing10);
-        // 酒店名称
-        data.put("thing9",thing9_);
+        data.put("const2",const2);
+        data.put("thing3",thing3);
+        data.put("time4",time4);
+
         message.put("data",data);
-        return HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+access_token, message);
+
+        String s1 = HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, message);
+        System.out.println("s1 = " + s1);
+        return s1;
+    }
+
+
+    public static String getToken() throws Exception {
+        String url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;
+
+        String s = HttpsClient.httpsRequestReturnString(url, "GET", "");
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        System.out.println("jsonObject = " + jsonObject);
+        String access_token = jsonObject.getString("access_token");
+//        HttpsClient.httpsRequestReturnString("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+access_token, "POST", message.toJSONString());
+        return access_token;
     }
 
+
+
+
+    public static void main(String[] args) throws Exception {
+        String o9MsY67wqvQ__o_pOzF7oeN4MQPM = send("o9MsY67wqvQ__o_pOzF7oeN4MQPM","进入区域","IPCamera 01","2024-01-29 16:16:14");
+//        String token = getToken();
+//        System.out.println("token = " + token);
+    }
 }

+ 3 - 3
src/main/java/com/template/common/utils/SendSms.java

@@ -173,9 +173,9 @@ public class SendSms {
     public static  void main(String[] args) throws TencentCloudSDKException{
         //这里定义一个存储电话号码的数组
 
-        String tels="+8615779633758"; // 手机号前面记得带上国家区域编码
-        String test = sendSms("+8615779633758","123456");
+        String tels="+8618279193722"; // 手机号前面记得带上国家区域编码
+        String test = sendSms("+8618279193722","123456");
 
     }
 
-}
+}

+ 29 - 2
src/main/java/com/template/common/utils/TimeExchange.java

@@ -200,6 +200,30 @@ public class TimeExchange {
         return simpleDateFormat.format(nowTime2.getTime());
     }
 
+    // 获取当天开始时间
+    public static String getStartDate() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 0, 0, 0);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+
+    // 获取当天结束时间
+    public static String getEndDate() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 23, 59, 59);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+
     // 获取当前日期
     public static String getDate() {
         SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
@@ -680,8 +704,11 @@ public class TimeExchange {
     }
 
     public static void main(String[] args) throws ParseException {
-        BigDecimal ss = new BigDecimal(0.3).divide(new BigDecimal(3),2);//.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
-        System.out.println("");
+        int total = 25;
+        int pageSize = 20;
+        int restData =(total + pageSize - 1) / pageSize;
+        System.out.println("数据:"+restData);
+        String sdsd ="";
     }
 }
 

+ 101 - 13
src/main/java/com/template/controller/HikvisionController.java

@@ -4,17 +4,27 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.api.HikvisionAPI;
+import com.template.api.SmartNotificationControllerAPI;
 import com.template.common.utils.GetCameraPreviewURL;
+import com.template.common.utils.Message2;
 import com.template.model.pojo.SmartFaceDiscern;
+import com.template.model.pojo.SmartNotification;
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.services.SmartFaceDiscernService;
+import com.template.services.SmartNotificationService;
+import com.template.services.SmartUserService;
 import com.template.services.SmartWarningService;
+import org.aspectj.weaver.ast.Var;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
 
 @RestController
 public class HikvisionController implements HikvisionAPI {
@@ -25,9 +35,16 @@ public class HikvisionController implements HikvisionAPI {
     @Autowired
     SmartFaceDiscernService smartFaceDiscernService;
 
+    @Autowired
+    SmartUserService smartUserService;
+
+    @Autowired
+    SmartNotificationService smartNotificationService;
+
 
     /**
      * 事件订阅
+     *
      * @param request
      */
     @Override
@@ -60,9 +77,10 @@ public class HikvisionController implements HikvisionAPI {
 //                地点
             String srcName = jsonObject1.getString("srcName");
             smartWarning.setLocation(srcName);
-
+//            推送的事件
+            String pushType = "";
             if ("131588".equals(eventType)) {
-
+                pushType = "区域入侵";
                 smartWarning.setType("区域入侵");
 
                 JSONArray fielddetection = data.getJSONArray("fielddetection");
@@ -72,7 +90,9 @@ public class HikvisionController implements HikvisionAPI {
                 String imageUrl = jsonObject2.getString("imageUrl");
                 smartWarning.setImage(imageUrl);
 
-            }else if ("131586".equals(eventType)){
+            } else if ("131586".equals(eventType)) {
+                pushType = "进入危险区域";
+
                 smartWarning.setType("进入区域");
 
                 JSONArray regionEntrance = data.getJSONArray("regionEntrance");
@@ -82,7 +102,9 @@ public class HikvisionController implements HikvisionAPI {
                 String imageUrl = jsonObject2.getString("imageUrl");
                 smartWarning.setImage(imageUrl);
 
-            }else if ("131587".equals(eventType)){
+            } else if ("131587".equals(eventType)) {
+                pushType = "离开安全区域";
+
                 smartWarning.setType("离开区域");
 
                 JSONArray regionExiting = data.getJSONArray("regionExiting");
@@ -92,7 +114,9 @@ public class HikvisionController implements HikvisionAPI {
                 String imageUrl = jsonObject2.getString("imageUrl");
                 smartWarning.setImage(imageUrl);
 
-            }else if ("131605".equals(eventType)){
+            } else if ("131605".equals(eventType)) {
+                pushType = "人员倒地";
+
                 smartWarning.setType("倒地");
 
                 JSONArray fallDown = data.getJSONArray("fallDown");
@@ -106,8 +130,38 @@ public class HikvisionController implements HikvisionAPI {
 
             smartWarningService.save(smartWarning);
 
+// 获取推送人
+            List<SmartUser> smartUserList = smartUserService.getListPush();
+
+
+            if (ObjectUtils.isNotEmpty(smartUserList) && smartUserList.size() > 0) {
+                for (SmartUser smartUser : smartUserList) {
+                    SmartNotification smartNotification = new SmartNotification();
+                    smartNotification.setUserId(smartUser.getId());
+                    smartNotification.setTypeName(pushType);
+                    smartNotification.setLocation(smartWarning.getLocation());
+                    smartNotification.setImage(smartWarning.getImage());
+                    smartNotification.setDateTime(smartWarning.getDateTime());
+                    smartNotification.setType(1);
+
+                    String gzhOpenId = smartUser.getGzhOpenId();
+                    if (ObjectUtils.isNotEmpty(gzhOpenId)) {
+
+                        //                        时间格式是 yyyy-MM-dd HH:mm:ss,当前时间格式有问题
+                        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                        LocalDateTime now = LocalDateTime.now();
+                        String format = now.format(dateTimeFormatter1);
+
+//                    公众号信息推送
+                        Message2.send(gzhOpenId, pushType, smartWarning.getLocation(), format);
+
+                        smartNotificationService.save(smartNotification);
+                    }
+
+                }
 
 
+            }
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -116,6 +170,7 @@ public class HikvisionController implements HikvisionAPI {
 
     /**
      * 人脸比对
+     *
      * @param request
      */
     @Override
@@ -167,7 +222,7 @@ public class HikvisionController implements HikvisionAPI {
                 JSONObject jsonObject3 = faces.getJSONObject(0);
 //                对比成功的图片
                 JSONArray identify = jsonObject3.getJSONArray("identify");
-                if (ObjectUtils.isNotEmpty(identify)&&identify.size()>0) {
+                if (ObjectUtils.isNotEmpty(identify) && identify.size() > 0) {
 //                    取对比成功的第一张
                     JSONObject jsonObject4 = identify.getJSONObject(0);
                     JSONArray candidate = jsonObject4.getJSONArray("candidate");
@@ -196,6 +251,7 @@ public class HikvisionController implements HikvisionAPI {
 
     /**
      * 重点人员
+     *
      * @param request
      */
     @Override
@@ -209,7 +265,7 @@ public class HikvisionController implements HikvisionAPI {
             }
             JSONObject jsonObject = JSONObject.parseObject(responseStrBuilder.toString());
 
-            System.out.println("jsonObject = " + jsonObject);
+//            System.out.println("jsonObject = " + jsonObject);
 
             JSONObject params = jsonObject.getJSONObject("params");
 
@@ -255,6 +311,38 @@ public class HikvisionController implements HikvisionAPI {
 
 
                 smartWarningService.save(smartWarning);
+
+
+                // 获取推送人
+                List<SmartUser> smartUserList = smartUserService.getListPush();
+
+                String pushType = "危险人员";
+
+                for (SmartUser smartUser : smartUserList) {
+                    String gzhOpenId = smartUser.getGzhOpenId();
+                    if (ObjectUtils.isNotEmpty(gzhOpenId)) {
+                        SmartNotification smartNotification = new SmartNotification();
+                        smartNotification.setUserId(smartUser.getId());
+                        smartNotification.setUserName(faceInfoName);
+                        smartNotification.setTypeName(pushType);
+                        smartNotification.setLocation(smartWarning.getLocation());
+                        smartNotification.setImage(smartWarning.getImage());
+                        smartNotification.setDateTime(smartWarning.getDateTime());
+                        smartNotification.setType(1);
+
+                        //                        时间格式是 yyyy-MM-dd HH:mm:ss,当前时间格式有问题
+                        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                        LocalDateTime now = LocalDateTime.now();
+                        String format = now.format(dateTimeFormatter1);
+
+//                    公众号信息推送
+                        Message2.send(gzhOpenId, pushType, smartWarning.getLocation(), format);
+
+                        smartNotificationService.save(smartNotification);
+                    }
+                }
+
+
             }
 
 
@@ -265,13 +353,13 @@ public class HikvisionController implements HikvisionAPI {
 
     @Override
     public JSONObject playback() {
-        String url="/api/video/v2/cameras/playbackURLs";
+        String url = "/api/video/v2/cameras/playbackURLs";
         JSONObject jsonBoxdy = new JSONObject();
-        jsonBoxdy.put("cameraIndexCode","ff2a2978a71c4ba0ac43a1a6be97a1a1");
-        jsonBoxdy.put("streamType",0);
-        jsonBoxdy.put("protocol","rtsp");
-        jsonBoxdy.put("transmode",1);
-        String s =GetCameraPreviewURL.CameraPreviewURL(url, jsonBoxdy);
+        jsonBoxdy.put("cameraIndexCode", "ff2a2978a71c4ba0ac43a1a6be97a1a1");
+        jsonBoxdy.put("streamType", 0);
+        jsonBoxdy.put("protocol", "rtsp");
+        jsonBoxdy.put("transmode", 1);
+        String s = GetCameraPreviewURL.CameraPreviewURL(url, jsonBoxdy);
 
         JSONObject jsonObject1 = JSONObject.parseObject(s);
         return jsonObject1;

+ 118 - 7
src/main/java/com/template/controller/SmartAttendanceController.java

@@ -5,17 +5,27 @@ import com.seewo.open.sdk.DefaultSeewoClient;
 import com.seewo.open.sdk.SeewoClient;
 import com.seewo.open.sdk.auth.Account;
 import com.template.api.SmartAttendanceControllerAPI;
+import com.template.common.utils.TimeExchange;
 import com.template.config.SeewoConfig;
+import com.template.model.enumModel.eAttendanceStatu;
+import com.template.model.enumModel.eXwApproveStatu;
 import com.template.model.pojo.*;
 import com.template.model.result.CommonResult;
 import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsParam;
 import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsRequest;
 import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsResult;
+import com.template.services.SmartAttendanceService;
+import com.template.services.SmartUserService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -30,6 +40,11 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
 
     @Resource
     private SeewoConfig seewoConfig;
+    @Autowired
+    private SmartUserService smartUserService;
+    @Autowired
+    private SmartAttendanceService smartAttendanceService;
+
 
     @Override
     public CommonResult insertSmartAttendance(SmartAttendance smartApply, BindingResult bindingResult) {
@@ -53,6 +68,103 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
 
     @Override
     public CommonResult queryLeaveRecords() {
+        int findPageSize = 20;
+
+        PersonalLeaveListSchoolPeriodRecordsResult result = getXwAttendance(TimeExchange.getDate(), TimeExchange.getDate(), 1, findPageSize);
+        if (result == null) {
+            return CommonResult.fail("当天不存在请假数据!");
+        }
+
+        if (!result.getResponseBody().getCode().equals("000000")) {
+            return CommonResult.fail(result.getResponseBody().getMessage());
+        }
+
+        List<SmartAttendance> attendances = new ArrayList<>();
+        for (int i = 0; i < result.getResponseBody().getData().getTotalCount(); i++) {
+            if (result.getResponseBody().getData().getResult().get(i).getLeaveStatus().intValue() == eXwApproveStatu.Passed.getValue()) {
+                SmartAttendance attendance = new SmartAttendance();
+                attendance.setXwuid(result.getResponseBody().getData().getResult().get(i).getUid());
+                attendance.setUserUid(result.getResponseBody().getData().getResult().get(i).getUserUid());
+                attendance.setXwUserName(result.getResponseBody().getData().getResult().get(i).getUserName());
+                attendance.setReason(result.getResponseBody().getData().getResult().get(i).getReason());
+                attendance.setStartTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(i).getStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                attendance.setEndTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(i).getEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                attendance.setInitiateTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+                attendance.setInitiateXwuid(result.getResponseBody().getData().getResult().get(i).getApplyUserUid());
+                attendance.setInitiateXwname(result.getResponseBody().getData().getResult().get(i).getApplyUserName());
+                attendance.setInitiateXwphone(result.getResponseBody().getData().getResult().get(i).getApplyUserPhone());
+                attendance.setStatus(eAttendanceStatu.AskLeave.getValue());
+                attendances.add(attendance);
+            }
+        }
+        //如果总条数大于第二条 那说明还有第二页
+        if (result.getResponseBody().getData().getTotalCount().intValue() > result.getResponseBody().getData().getTotalCount().intValue()) {
+            int totalCount = result.getResponseBody().getData().getTotalCount().intValue();
+            int pageSize = result.getResponseBody().getData().getPageSize().intValue();
+            int totalPage = (totalCount + pageSize - 1) / pageSize;
+            for (int i = 2; i <= totalPage; i++) {
+                PersonalLeaveListSchoolPeriodRecordsResult nextResult = getXwAttendance(TimeExchange.getDate(), TimeExchange.getDate(), i, findPageSize);
+                if (nextResult == null) {
+                    return CommonResult.fail("当天不存在请假数据!");
+                }
+
+                if (!nextResult.getResponseBody().getCode().equals("000000")) {
+                    return CommonResult.fail(result.getResponseBody().getMessage());
+                }
+                for (int j = 0; j < result.getResponseBody().getData().getTotalCount(); j++) {
+                    if (result.getResponseBody().getData().getResult().get(j).getLeaveStatus().intValue() == eXwApproveStatu.Passed.getValue()) {
+                        SmartAttendance attendance = new SmartAttendance();
+                        attendance.setXwuid(result.getResponseBody().getData().getResult().get(j).getUid());
+                        attendance.setUserUid(result.getResponseBody().getData().getResult().get(j).getUserUid());
+                        attendance.setXwUserName(result.getResponseBody().getData().getResult().get(j).getUserName());
+                        attendance.setReason(result.getResponseBody().getData().getResult().get(j).getReason());
+                        attendance.setStartTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(j).getStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                        attendance.setEndTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(j).getEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                        attendance.setInitiateTime(TimeExchange.StringToDate(result.getResponseBody().getData().getResult().get(j).getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+                        attendance.setInitiateXwuid(result.getResponseBody().getData().getResult().get(j).getApplyUserUid());
+                        attendance.setInitiateXwname(result.getResponseBody().getData().getResult().get(j).getApplyUserName());
+                        attendance.setInitiateXwphone(result.getResponseBody().getData().getResult().get(j).getApplyUserPhone());
+                        attendance.setStatus(eAttendanceStatu.AskLeave.getValue());
+                        attendances.add(attendance);
+                    }
+                }
+            }
+        }
+        //获取当天的请假数据中是否存在重复的
+        List<SmartAttendance> oldAttendances = smartAttendanceService.queryExistAttendances(TimeExchange.getStartDate(), TimeExchange.getEndDate());
+        if (oldAttendances != null && oldAttendances.size() > 0) {
+            if (attendances != null && attendances.size() > 0) {
+                for (SmartAttendance oldAttendance : oldAttendances) {
+                    attendances = attendances.stream().filter(e -> !e.getXwuid().equals(oldAttendance.getXwuid())).collect(Collectors.toList());
+                }
+            }
+        }
+
+        //新增请假数据
+        if (attendances != null && attendances.size() > 0) {
+            //获取用户数据
+            List<String> xwuids = attendances.stream().map(SmartAttendance::getUserUid).collect(Collectors.toList());
+            List<SmartUser> users = smartUserService.getSmartUserByxwuids(xwuids);
+            if(users != null && users.size() > 0){
+                for (SmartAttendance attendance:attendances) {
+                    Optional<SmartUser> user = users.stream().filter(e -> e.getXwStudentUid().equals(attendance.getUserUid())).findFirst();
+                    if(user != null && user.isPresent()){
+                        attendance.setUserId(user.get().getId());
+                        attendance.setClassId(user.get().getSchoolClass());
+                    }
+                }
+            }
+
+            boolean insertResult = smartAttendanceService.insertAttendanceBatch(attendances);
+            if(!insertResult){
+                return CommonResult.fail("请假数据获取失败");
+            }
+        }
+
+        return CommonResult.ok("操作成功");
+    }
+
+    public PersonalLeaveListSchoolPeriodRecordsResult getXwAttendance(String startDate, String endDate, Integer currentPage, Integer pageSize) {
         //初始化客户端
         SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
         PersonalLeaveListSchoolPeriodRecordsParam param = new PersonalLeaveListSchoolPeriodRecordsParam();
@@ -63,8 +175,8 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
         //query
         PersonalLeaveListSchoolPeriodRecordsParam.Query query = PersonalLeaveListSchoolPeriodRecordsParam.Query.builder()
                 .schoolUid(seewoConfig.getSchoolId())//学校ID
-                .startDate("2024-01-05")//开始日期
-                .endDate("2024-01-05")//结束日期
+                .startDate(startDate)//开始日期
+                .endDate(endDate)//结束日期
                 .page(1)//当前页
                 .pageSize(20)//分页条数
                 .appId(seewoConfig.getAppId())
@@ -72,17 +184,16 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
         requestBody.setQuery(query);
         param.setRequestBody(requestBody);
         PersonalLeaveListSchoolPeriodRecordsRequest request = new PersonalLeaveListSchoolPeriodRecordsRequest(param);
-        System.out.println("入参:" +request);
+        System.out.println("入参:" + request);
         //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
         //request.setServerUrl("https://openapi.test.seewo.com")
         //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
         PersonalLeaveListSchoolPeriodRecordsResult result = seewoClient.invoke(request);
-        System.out.println("出参:" +result);
-
-        //新增请假数据
+        System.out.println("出参:" + result);
 
 
-        return CommonResult.ok("操作成功");
+        return result;
     }
+
 }
 

+ 21 - 0
src/main/java/com/template/controller/SmartCodeOpenIdController.java

@@ -0,0 +1,21 @@
+package com.template.controller;
+
+
+import com.template.api.SmartCodeOpenIdControllerAPI;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-26
+ */
+@RestController
+public class SmartCodeOpenIdController implements SmartCodeOpenIdControllerAPI {
+
+}
+

+ 5 - 0
src/main/java/com/template/controller/SmartDutiesController.java

@@ -3,6 +3,7 @@ package com.template.controller;
 
 import com.template.api.SmartDutiesControllerAPI;
 import com.template.common.utils.paramUtils;
+import com.template.model.enumModel.eDuties;
 import com.template.model.enumModel.eDutiesType;
 import com.template.model.enumModel.eIdentityStatu;
 import com.template.model.pojo.SmartDuties;
@@ -94,6 +95,10 @@ public class SmartDutiesController implements SmartDutiesControllerAPI {
 
     @Override
     public CommonResult deleteSmartDutiesById(int id) {
+        if(id == eDuties.ClassTeacher.getValue()){
+            return CommonResult.fail("不能删除班主任职务数据!");
+        }
+
         SmartDuties data = smartDutiesService.getSmartById(id);
 
         if (data == null) {

+ 46 - 0
src/main/java/com/template/controller/SmartNotificationController.java

@@ -0,0 +1,46 @@
+package com.template.controller;
+
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.template.api.SmartNotificationControllerAPI;
+import com.template.model.pojo.SmartNotification;
+import com.template.model.pojo.SmartWarning;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.services.SmartNotificationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-30
+ */
+@RestController
+public class SmartNotificationController implements SmartNotificationControllerAPI {
+
+    @Autowired
+    SmartNotificationService smartNotificationService;
+
+
+    @Override
+    public CommonResult remindingList(Integer id, int currentPage, int pageCount, String type) {
+        if (ObjectUtils.isEmpty(currentPage) && currentPage <= 0) {
+            currentPage = 1;
+        }
+
+        if (ObjectUtils.isEmpty(pageCount) && pageCount <= 0) {
+            currentPage = 10;
+        }
+
+        PageUtils<SmartNotification> result = smartNotificationService.pageRemindingList(id, currentPage, pageCount, type);
+
+        return CommonResult.ok(result);
+    }
+}
+

+ 395 - 244
src/main/java/com/template/controller/SmartUserController.java

@@ -133,7 +133,7 @@ public class SmartUserController implements SmartUserControllerAPI {
     }
 
     @Override
-    public CommonResult importExcelUsers(MultipartFile excelFile, String headImage) throws IOException {
+    public CommonResult importExcelUsers(MultipartFile excelFile, String headImage) throws Exception {
         List<SmartUser> result = new ArrayList<>();
 
         //先解析excel如果excel不满足格式就提示错误信息 避免提前占用带宽上传头像
@@ -169,10 +169,197 @@ public class SmartUserController implements SmartUserControllerAPI {
             }
         }
 
-        //批量存储用户信息
-        boolean resultBool = smartUserService.saveBatch(result);
+        //region 将数据加入第三方
+        List<SmartUser> studentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Student.getValue()).collect(Collectors.toList());
+        for (SmartUser student : studentDatas) {
 
-        return resultBool ? CommonResult.ok("导入成功") : CommonResult.fail("导入失败");
+            //region 学生参数必填判断:年级、班级
+            if (student.getGrade() == null) {
+                return CommonResult.fail("学生年级不能为空");
+            }
+
+            if (student.getSchoolClass() == null) {
+                return CommonResult.fail("学生班级不能为空");
+            }
+            //endregion
+
+            //获取班级Uid
+            SmartClass classData = smartClassService.getSmartClassById(student.getSchoolClass());
+            if (classData == null) {
+                return CommonResult.fail("班级数据无效,新增失败");
+            }
+
+            //region 希沃新增学生信息
+            //初始化客户端
+            SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+            StudentServiceBatchSaveClassStudentsParam param = new StudentServiceBatchSaveClassStudentsParam();
+            //请求体,MimeType为 application/json
+            StudentServiceBatchSaveClassStudentsParam.JSONRequestBody requestBody = StudentServiceBatchSaveClassStudentsParam.JSONRequestBody.builder()
+                    .build();
+            param.setRequestBody(requestBody);
+            //查询条件
+            StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery query = StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery.builder()
+                    .appId(seewoConfig.getAppId())
+                    .schoolUid(seewoConfig.getSchoolId())
+                    .classUid(classData.getClassUid())
+                    .build();
+            requestBody.setQuery(query);
+            // 学生列表
+            StudentServiceBatchSaveClassStudentsParam.StudentInfo students = StudentServiceBatchSaveClassStudentsParam.StudentInfo.builder()
+                    .studentName(student.getName())
+                    .studentCode(student.getCardNo())
+                    .gender(student.getSexId())
+                    .phone(student.getPhone() == null ? "" : student.getPhone())
+                    .build();
+            query.setStudents(java.util.Collections.singletonList(students));
+            query.setInPlaceOld(true);// 是否删除旧学生再保存
+            param.setRequestBody(requestBody);
+            StudentServiceBatchSaveClassStudentsRequest request = new StudentServiceBatchSaveClassStudentsRequest(param);
+            System.out.println("入参:" + request);
+            //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+            //request.setServerUrl("https://openapi.test.seewo.com")
+            //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+            StudentServiceBatchSaveClassStudentsResult studentResult = seewoClient.invoke(request);
+            System.out.println("出参:" + studentResult);
+
+            if (studentResult == null) {
+                return CommonResult.fail("希沃学生数据新增失败!");
+            }
+
+            if (!studentResult.getResponseBody().getCode().equals("000000")) {
+                return CommonResult.fail(studentResult.getResponseBody().getMessage());
+            }
+
+            student.setXwStudentUid(studentResult.getResponseBody().getData().get(0).getUserUid());
+            //endregion
+
+            //region 百胜新增学生信息
+            String appId = controlConfig.getAppId();
+            String schoolno = controlConfig.getSchoolCode();
+            String timestamp = TimeExchange.DateNowTimeStamo();
+            String appSecret = controlConfig.getAppSecret();
+            String url = controlConfig.getUrl() + "student/create";
+
+            JSONObject jsonobject = new JSONObject();
+            jsonobject.put("appid", appId);
+            String str = "{\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}";
+            String aesStr = URLEncoder.encode(AesTestOne.encrypt(str, controlConfig.getAppSecret()), "UTF-8");
+            jsonobject.put("data", aesStr);
+            jsonobject.put("schoolno", schoolno);
+            jsonobject.put("timestamp", timestamp);
+
+            String md5Str = "appid=" + appId + "&data={\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}" + "&schoolno=" + schoolno + "&timestamp=" + timestamp + "&key=" + appSecret;
+            String sign = CommonUtil.MD5(md5Str);
+            //sign签名
+            jsonobject.put("sign", sign);
+
+            //返回的结果中 code为1表示成功
+            String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+            if (bsResult.contains("添加成功")) {
+                ObjectMapper objectMapper = new ObjectMapper();
+                BsStudentVo grade = objectMapper.readValue(bsResult, BsStudentVo.class);
+
+                // URL解码
+                String decodedUrl = URLDecoder.decode(grade.getData(), "UTF-8");
+
+                BsStudentNoVo studentNo = objectMapper.readValue(decrypt(decodedUrl, controlConfig.getAppSecret()), BsStudentNoVo.class);
+                student.setBsStudentNo(studentNo.getStudent_no());
+            }
+            //endregion
+
+        }
+
+        if (studentDatas != null && studentDatas.size() > 0) {
+            //批量存储学生信息
+            boolean resultBool = smartUserService.saveBatch(studentDatas);
+            if (!resultBool) {
+                return CommonResult.fail("导入失败");
+            }
+
+            List<String> cardNos = studentDatas.stream().map(SmartUser::getCardNo).collect(Collectors.toList());
+            for (String cardNo : cardNos) {
+
+                //region 希沃新增编辑学生家长信息
+                //学生与家长列表,最大100条
+                List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
+                for (SmartUser student : studentDatas) {
+                    ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
+                            .studentCode(student.getCardNo())
+                            .build();
+                    studentParents.add(students);
+
+                    List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(cardNo)).collect(Collectors.toList());
+                    List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
+                    int i = 0;
+                    for (SmartUser parent : parentDatas) {
+                        ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
+                                .name(parent.getName())
+                                .phone(parent.getPhone())
+                                .index(i)
+                                .build();
+                        parents.add(data);
+                        ++i;
+                    }
+                    //家长列表,最多4个
+                    students.setParents(parents);
+                }
+
+                //初始化客户端
+                SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+                ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
+                //响应体,MimeType为 application/json
+                ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
+                        .build();
+                param.setRequestBody(requestBody);
+                //query
+                ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
+                        .appId(seewoConfig.getAppId())
+                        .schoolUid(seewoConfig.getSchoolId())
+                        .build();
+                requestBody.setQuery(query);
+                query.setStudentParents(studentParents);
+                param.setRequestBody(requestBody);
+                ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
+                System.out.println("入参:" + request);
+                //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+                //request.setServerUrl("https://openapi.test.seewo.com")
+                //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+                ParentServiceBatchSaveOrUpdateParentsResult parentResult = seewoClient.invoke(request);
+                System.out.println("出参:" + parentResult);
+                //endregion
+
+                if (parentResult == null) {
+                    return CommonResult.fail("希沃学生家长数据添加失败!");
+                }
+
+                if (!parentResult.getResponseBody().getCode().equals("000000")) {
+                    return CommonResult.fail(parentResult.getResponseBody().getMessage());
+                }
+            }
+        }
+        //endregion
+
+        List<SmartUser> parents = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue()).collect(Collectors.toList());
+        List<String> cardNos = studentDatas.stream().map(SmartUser::getCardNo).collect(Collectors.toList());
+        if(cardNos != null && cardNos.size() > 0){
+            List<SmartUser> students = smartUserService.querySmartUserByCardNos(cardNos);
+            for (SmartUser parent : parents) {
+                Optional<SmartUser> student = students.stream().filter(e -> e.getCardNo().equals(parent.getAffiliate())).findFirst();
+                if(student != null && student.isPresent()){
+                    parent.setAffiliate(String.valueOf(student.get().getId()));
+                }
+            }
+            if(parents!= null && parents.size() > 0){
+                //批量存储家长信息
+                boolean resultBool = smartUserService.saveBatch(result);
+                if(!resultBool){
+                    return CommonResult.fail("导入失败!");
+                }
+            }
+        }
+
+        return CommonResult.ok("导入成功");
     }
 
 
@@ -269,7 +456,7 @@ public class SmartUserController implements SmartUserControllerAPI {
     }
 
     /**
-     * Xlsx文件读取方法
+     * Xlsx文件读取方法ss
      *
      * @param inputStream 文件流
      * @return
@@ -299,136 +486,103 @@ public class SmartUserController implements SmartUserControllerAPI {
                     //然后poi会根据字符串读取它
                     //标题 校验
                     if (rowNum == 0) {
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));//学号
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (!schoolClass.equals("班级")) {
+                            return CommonResult.fail("导入数据第一列为班级");
+                        }
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));//学号
                         if (!cardNo.equals("学号")) {
-                            return CommonResult.fail("导入数据第一列为学号");
+                            return CommonResult.fail("导入数据第列为学号");
                         }
-                        String name = dataFormatter.formatCellValue(row.getCell(1));//姓名
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
                         if (!name.equals("姓名")) {
-                            return CommonResult.fail("导入数据第二列为姓名");
-                        }
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));//身份
-                        if (!identity.equals("身份")) {
-                            return CommonResult.fail("导入数据第三列为身份");
+                            return CommonResult.fail("导入数据第三列为姓名");
                         }
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));//身份证
-                        if (!idCard.equals("身份证")) {
-                            return CommonResult.fail("导入数据第四列为身份证");
-                        }
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));//性别
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));//性别
                         if (!sex.equals("性别")) {
-                            return CommonResult.fail("导入数据第五列为性别");
-                        }
-                        String department = dataFormatter.formatCellValue(row.getCell(5));//部门
-                        if (!department.equals("部门")) {
-                            return CommonResult.fail("导入数据第六列为部门");
+                            return CommonResult.fail("导入数据第四列为性别");
                         }
-                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//人脸照片
-                        if (!headImage.equals("人脸照片")) {
-                            return CommonResult.fail("导入数据第七列为人脸照片");
+                        String nation = dataFormatter.formatCellValue(row.getCell(4));//民族
+                        if (!nation.equals("民族")) {
+                            return CommonResult.fail("导入数据第五列为民族");
                         }
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        if (!dormitoryNumber.equals("宿舍号")) {
-                            return CommonResult.fail("导入数据第八列为宿舍号");
+                        String cardId = dataFormatter.formatCellValue(row.getCell(5));//身份证
+                        if (!cardId.equals("身份证")) {
+                            return CommonResult.fail("导入数据第六列为身份证");
                         }
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        if (!grade.equals("年级")) {
-                            return CommonResult.fail("导入数据第九列为年级");
+                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//照片
+                        if (!headImage.equals("照片")) {
+                            return CommonResult.fail("导入数据第七列为照片");
                         }
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        if (!schoolClass.equals("班级")) {
-                            return CommonResult.fail("导入数据第十列为班级");
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));//常规时间组
+                        if (!timeGroup.equals("常规时间组")) {
+                            return CommonResult.fail("导入数据第八列为常规时间组");
                         }
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));//手机号
-                        if (!phone.equals("手机号")) {
-                            return CommonResult.fail("导入数据第十一列为手机号");
+                        String address = dataFormatter.formatCellValue(row.getCell(8));//住址
+                        if (!address.equals("住址")) {
+                            return CommonResult.fail("导入数据第九列为住址");
                         }
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (!affiliate.equals("关联人")) {
-                            return CommonResult.fail("导入数据第十二列为关联人");
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));//联系电话
+                        if (!phone.equals("联系电话")) {
+                            return CommonResult.fail("导入数据第十列为联系电话");
                         }
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        if (!title.equals("职称")) {
-                            return CommonResult.fail("导入数据第十三列为职称");
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (!family.equals("家属")) {
+                            return CommonResult.fail("导入数据第十一列为家属");
                         }
-                        String address = dataFormatter.formatCellValue(row.getCell(13));//家庭住址
-                        if (!address.equals("家庭住址")) {
-                            return CommonResult.fail("导入数据第十四列为家庭住址");
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        if (!familyShip.equals("家属与本人关系")) {
+                            return CommonResult.fail("导入数据第十二列为家属与本人关系");
                         }
-                        String nation = dataFormatter.formatCellValue(row.getCell(14));//民族
-                        if (!nation.equals("民族")) {
-                            return CommonResult.fail("导入数据第十五列为民族");
+                        String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                        if (!phoneTwo.equals("联系电话2")) {
+                            return CommonResult.fail("导入数据第十三列为联系电话2");
                         }
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        if (!ofStudent.equals("生源地")) {
-                            return CommonResult.fail("导入数据第十六列为生源地");
+                        String familyTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!familyTwo.equals("家属2")) {
+                            return CommonResult.fail("导入数据第十四列为家属2");
                         }
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        if (!graduate.equals("毕业学校")) {
-                            return CommonResult.fail("导入数据第十七列为毕业学校");
-                        }
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        if (!duties.equals("职务")) {
-                            return CommonResult.fail("导入数据第十八列为职务");
+                        String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                        if (!familyShipTwo.equals("家属与本人关系2")) {
+                            return CommonResult.fail("导入数据第十五列为家属与本人关系2");
                         }
                     } else {
                         SmartUser user = new SmartUser();
-                        String name = dataFormatter.formatCellValue(row.getCell(1));
+                        String name = dataFormatter.formatCellValue(row.getCell(2));
                         if (ObjectUtils.isEmpty(name)) {
                             return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
                         }
 
-                        //身份是否为空判断
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));
-                        if (ObjectUtils.isEmpty(identity)) {
-                            return CommonResult.fail(name + "的身份不能为空");
-                        }
-
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        //身份为学生的情况下 宿舍号、年级、班级不能为空
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Student.getValue()) {
-                            if (ObjectUtils.isEmpty(dormitoryNumber)) {
-                                return CommonResult.fail(name + "的宿舍号不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(grade)) {
-                                return CommonResult.fail(name + "的年级不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(schoolClass)) {
-                                return CommonResult.fail(name + "的班级不能为空");
-                            }
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (ObjectUtils.isEmpty(schoolClass)) {
+                            return CommonResult.fail(name + "的班级不能为空");
                         }
 
                         //手机号重复判断
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue() || eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Teacher.getValue()) {
-                            if (ObjectUtils.isEmpty(phone)) {
-                                return CommonResult.fail(name + "的手机号不能为空");
-                            }
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));
+                        if (ObjectUtils.isEmpty(phone)) {
+                            return CommonResult.fail(name + "家属的手机号不能为空");
                         }
                         if (!ObjectUtils.isEmpty(phone)) {
                             phones.add(phone);
                         }
                         if (phones.stream().distinct().count() != phones.size()) {
-                            return CommonResult.fail("导入的Excel中,手机号:" + phone + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中,联系电话:" + phone + "存在重复数据");
                         }
 
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue()) {
-                            if (ObjectUtils.isEmpty(affiliate)) {
-                                return CommonResult.fail(name + "的关联人不能为空");
-                            }
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (ObjectUtils.isEmpty(family)) {
+                            return CommonResult.fail(name + "的家属不能为空");
                         }
 
                         //性别是否为空判断
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));
                         if (ObjectUtils.isEmpty(sex)) {
                             return CommonResult.fail(name + "的性别不能为空");
                         }
 
                         //家庭住址是否为空判断
-                        String address = dataFormatter.formatCellValue(row.getCell(13));
+                        String address = dataFormatter.formatCellValue(row.getCell(8));
                         if (ObjectUtils.isEmpty(address)) {
                             return CommonResult.fail(name + "的家庭住址不能为空");
                         }
@@ -440,54 +594,49 @@ public class SmartUserController implements SmartUserControllerAPI {
                         }
 
                         //部门是否为空判断
-                        String department = dataFormatter.formatCellValue(row.getCell(5));
+                        String department = dataFormatter.formatCellValue(row.getCell(0)).replace("年级", "") + "学生";
                         if (ObjectUtils.isEmpty(department)) {
                             return CommonResult.fail(name + "的部门不能为空");
                         }
-                        int lastIndex = department.lastIndexOf("/");
                         Integer departmentId = null;
-                        if (lastIndex >= 0) {
-                            Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department.substring(lastIndex))).findFirst();
-                            if (departModel != null && departModel.isPresent()) {
-                                departmentId = departModel.get().getId();
-                            }
+                        Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department)).findFirst();
+                        if (departModel != null && departModel.isPresent()) {
+                            departmentId = departModel.get().getId();
                         }
 
                         //学号重复判断
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));
                         if (!ObjectUtils.isEmpty(cardNo)) {
                             cardNos.add(cardNo);
                         }
                         if (cardNos.stream().distinct().count() != cardNos.size()) {
-                            return CommonResult.fail("导入的Excel中,号:" + cardNo + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的学号:" + cardNo + "存在重复数据");
                         }
 
                         //身份证重复判断
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));
+                        String idCard = dataFormatter.formatCellValue(row.getCell(5));
                         if (!ObjectUtils.isEmpty(idCard)) {
                             idCards.add(idCard);
                         }
-                        //List<String> noEmptyIdCards = idCards.stream().filter(e -> !e.equals("") || e != null).collect(Collectors.toList());
                         if (idCards.stream().distinct().count() != idCards.size()) {
-                            return CommonResult.fail("导入的Excel中,身份证号:" + idCard + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的身份证号:" + idCard + "存在重复数据");
                         }
                         user.setCardNo(cardNo == null ? "" : cardNo);
                         user.setName(name == null ? "" : name);
-                        user.setIdentityId(identity == null ? eIdentityStatu.Student.getValue() : eIdentityStatu.integerOf(identity));
+                        user.setIdentityId(eIdentityStatu.Student.getValue());
                         user.setIdCard(idCard == null ? "" : idCard);
                         user.setSexId(sex == null ? eSexStatu.Man.getValue() : eSexStatu.integerOf(sex));
                         user.setDepartmentId(departmentId);
                         String cellImage = dataFormatter.formatCellValue(row.getCell(6));
                         user.setHeadImage(cellImage);
-                        user.setDormitoryNumber(dormitoryNumber == null ? "" : dormitoryNumber);
-                        user.setGrade(grade == null ? "" : grade);
+                        user.setDormitoryNumber("");
+                        String grade = schoolClass == null ? "" : schoolClass.substring(0, 3);
+                        user.setGrade(grade);
                         Optional<SmartGrade> oGrade = grades.stream().filter(e -> e.getName().equals(grade)).findFirst();
-
                         if (oGrade != null && oGrade.isPresent()) {
                             Integer gradeId = oGrade.get().getId();
-
-                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClass) && e.getGradeId().equals(gradeId)).findFirst();
-
+                            String schoolClassStr = schoolClass.replace("grade", "");
+                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClassStr) && e.getGradeId().equals(gradeId)).findFirst();
                             if (oClass != null && oClass.isPresent()) {
                                 user.setSchoolClass(oClass.get().getId());
                             } else {
@@ -497,25 +646,46 @@ public class SmartUserController implements SmartUserControllerAPI {
                         } else {
                             return CommonResult.fail(name + "的年级数据无效,导入失败");
                         }
-
                         user.setCollege("");
                         user.setSpeciality("");
                         user.setCampus("");
                         user.setPhone(phone == null ? "" : phone);
-                        user.setAffiliate(affiliate == null ? "" : affiliate);
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        user.setTitle(title == null ? "" : title);
+                        user.setAffiliate("");
+                        user.setTitle("");
                         user.setAddress(address == null ? "" : address);
                         user.setNation(nation == null ? "" : nation);
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        user.setOfStudent(ofStudent == null ? "" : ofStudent);
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        user.setGraduate(graduate == null ? "" : graduate);
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        user.setDuties(duties == null ? null : Integer.valueOf(duties));
+                        user.setOfStudent("");
+                        user.setGraduate("");
+                        user.setDuties(null);
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));
+                        user.setTimeGroupId(eTimeGroup.integerOfTimeName(timeGroup));
                         user.setIsCancel(eLogOff.Unlogout.getValue());
 
                         result.add(user);
+
+                        //region 家属
+                        SmartUser familyOne = new SmartUser();
+                        familyOne.setName(family);
+                        familyOne.setPhone(phone);
+                        familyOne.setIdentityId(eIdentityStatu.Parent.getValue());
+                        familyOne.setAffiliate(user.getCardNo());
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        familyOne.setShip(familyShip == null ? "" : familyShip);
+                        result.add(familyOne);
+
+                        SmartUser familyTwo = new SmartUser();
+                        String familyNameTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!ObjectUtils.isEmpty(familyNameTwo)) {
+                            familyTwo.setName(familyNameTwo);
+                            String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                            familyTwo.setPhone(phoneTwo == null ? "" : phoneTwo);
+                            familyTwo.setIdentityId(eIdentityStatu.Parent.getValue());
+                            familyOne.setAffiliate(user.getCardNo());
+                            String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                            familyTwo.setShip(familyShipTwo == null ? "" : familyShipTwo);
+                            result.add(familyTwo);
+                        }
+                        //endregion
                     }
                 }
             }
@@ -558,136 +728,103 @@ public class SmartUserController implements SmartUserControllerAPI {
                     //然后poi会根据字符串读取它
                     //标题 校验
                     if (rowNum == 0) {
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));//学号
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (!schoolClass.equals("班级")) {
+                            return CommonResult.fail("导入数据第一列为班级");
+                        }
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));//学号
                         if (!cardNo.equals("学号")) {
-                            return CommonResult.fail("导入数据第一列为学号");
+                            return CommonResult.fail("导入数据第列为学号");
                         }
-                        String name = dataFormatter.formatCellValue(row.getCell(1));//姓名
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
                         if (!name.equals("姓名")) {
-                            return CommonResult.fail("导入数据第二列为姓名");
-                        }
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));//身份
-                        if (!identity.equals("身份")) {
-                            return CommonResult.fail("导入数据第三列为身份");
+                            return CommonResult.fail("导入数据第三列为姓名");
                         }
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));//身份证
-                        if (!idCard.equals("身份证")) {
-                            return CommonResult.fail("导入数据第四列为身份证");
-                        }
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));//性别
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));//性别
                         if (!sex.equals("性别")) {
-                            return CommonResult.fail("导入数据第五列为性别");
-                        }
-                        String department = dataFormatter.formatCellValue(row.getCell(5));//部门
-                        if (!department.equals("部门")) {
-                            return CommonResult.fail("导入数据第六列为部门");
-                        }
-                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//人脸照片
-                        if (!headImage.equals("人脸照片")) {
-                            return CommonResult.fail("导入数据第七列为人脸照片");
+                            return CommonResult.fail("导入数据第四列为性别");
                         }
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        if (!dormitoryNumber.equals("宿舍号")) {
-                            return CommonResult.fail("导入数据第八列为宿舍号");
+                        String nation = dataFormatter.formatCellValue(row.getCell(4));//民族
+                        if (!nation.equals("民族")) {
+                            return CommonResult.fail("导入数据第五列为民族");
                         }
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        if (!grade.equals("年级")) {
-                            return CommonResult.fail("导入数据第九列为年级");
+                        String cardId = dataFormatter.formatCellValue(row.getCell(5));//身份证
+                        if (!cardId.equals("身份证")) {
+                            return CommonResult.fail("导入数据第六列为身份证");
                         }
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        if (!schoolClass.equals("班级")) {
-                            return CommonResult.fail("导入数据第十列为班级");
+                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//照片
+                        if (!headImage.equals("照片")) {
+                            return CommonResult.fail("导入数据第七列为照片");
                         }
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));//手机号
-                        if (!phone.equals("手机号")) {
-                            return CommonResult.fail("导入数据第十一列为手机号");
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));//常规时间组
+                        if (!timeGroup.equals("常规时间组")) {
+                            return CommonResult.fail("导入数据第八列为常规时间组");
                         }
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (!affiliate.equals("关联人")) {
-                            return CommonResult.fail("导入数据第十二列为关联人");
+                        String address = dataFormatter.formatCellValue(row.getCell(8));//住址
+                        if (!address.equals("住址")) {
+                            return CommonResult.fail("导入数据第九列为住址");
                         }
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        if (!title.equals("职称")) {
-                            return CommonResult.fail("导入数据第十三列为职称");
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));//联系电话
+                        if (!phone.equals("联系电话")) {
+                            return CommonResult.fail("导入数据第十列为联系电话");
                         }
-                        String address = dataFormatter.formatCellValue(row.getCell(13));//家庭住址
-                        if (!address.equals("家庭住址")) {
-                            return CommonResult.fail("导入数据第十四列为家庭住址");
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (!family.equals("家属")) {
+                            return CommonResult.fail("导入数据第十一列为家属");
                         }
-                        String nation = dataFormatter.formatCellValue(row.getCell(14));//民族
-                        if (!nation.equals("民族")) {
-                            return CommonResult.fail("导入数据第十五列为民族");
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        if (!familyShip.equals("家属与本人关系")) {
+                            return CommonResult.fail("导入数据第十二列为家属与本人关系");
                         }
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        if (!ofStudent.equals("生源地")) {
-                            return CommonResult.fail("导入数据第十六列为生源地");
+                        String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                        if (!phoneTwo.equals("联系电话2")) {
+                            return CommonResult.fail("导入数据第十三列为联系电话2");
                         }
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        if (!graduate.equals("毕业学校")) {
-                            return CommonResult.fail("导入数据第十七列为毕业学校");
+                        String familyTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!familyTwo.equals("家属2")) {
+                            return CommonResult.fail("导入数据第十四列为家属2");
                         }
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        if (!duties.equals("职务")) {
-                            return CommonResult.fail("导入数据第十八列为职务");
+                        String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                        if (!familyShipTwo.equals("家属与本人关系2")) {
+                            return CommonResult.fail("导入数据第十五列为家属与本人关系2");
                         }
                     } else {
                         SmartUser user = new SmartUser();
-                        String name = dataFormatter.formatCellValue(row.getCell(1));
+                        String name = dataFormatter.formatCellValue(row.getCell(2));
                         if (ObjectUtils.isEmpty(name)) {
                             return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
                         }
 
-                        //身份是否为空判断
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));
-                        if (ObjectUtils.isEmpty(identity)) {
-                            return CommonResult.fail(name + "的身份不能为空");
-                        }
-
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        //身份为学生的情况下 宿舍号、年级、班级不能为空
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Student.getValue()) {
-                            if (ObjectUtils.isEmpty(dormitoryNumber)) {
-                                return CommonResult.fail(name + "的宿舍号不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(grade)) {
-                                return CommonResult.fail(name + "的年级不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(schoolClass)) {
-                                return CommonResult.fail(name + "的班级不能为空");
-                            }
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (ObjectUtils.isEmpty(schoolClass)) {
+                            return CommonResult.fail(name + "的班级不能为空");
                         }
 
                         //手机号重复判断
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue() || eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Teacher.getValue()) {
-                            if (ObjectUtils.isEmpty(phone)) {
-                                return CommonResult.fail(name + "的手机号不能为空");
-                            }
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));
+                        if (ObjectUtils.isEmpty(phone)) {
+                            return CommonResult.fail(name + "家属的手机号不能为空");
                         }
                         if (!ObjectUtils.isEmpty(phone)) {
                             phones.add(phone);
                         }
                         if (phones.stream().distinct().count() != phones.size()) {
-                            return CommonResult.fail("导入的Excel中,手机号:" + phone + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中,联系电话:" + phone + "存在重复数据");
                         }
 
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue()) {
-                            if (ObjectUtils.isEmpty(affiliate)) {
-                                return CommonResult.fail(name + "的关联人不能为空");
-                            }
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (ObjectUtils.isEmpty(family)) {
+                            return CommonResult.fail(name + "的家属不能为空");
                         }
 
                         //性别是否为空判断
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));
                         if (ObjectUtils.isEmpty(sex)) {
                             return CommonResult.fail(name + "的性别不能为空");
                         }
 
                         //家庭住址是否为空判断
-                        String address = dataFormatter.formatCellValue(row.getCell(13));
+                        String address = dataFormatter.formatCellValue(row.getCell(8));
                         if (ObjectUtils.isEmpty(address)) {
                             return CommonResult.fail(name + "的家庭住址不能为空");
                         }
@@ -699,55 +836,49 @@ public class SmartUserController implements SmartUserControllerAPI {
                         }
 
                         //部门是否为空判断
-                        String department = dataFormatter.formatCellValue(row.getCell(5));
+                        String department = dataFormatter.formatCellValue(row.getCell(0)).replace("年级", "") + "学生";
                         if (ObjectUtils.isEmpty(department)) {
                             return CommonResult.fail(name + "的部门不能为空");
                         }
-                        int lastIndex = department.lastIndexOf("/");
                         Integer departmentId = null;
-                        if (lastIndex >= 0) {
-                            Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department.substring(lastIndex))).findFirst();
-                            if (departModel != null && departModel.isPresent()) {
-                                departmentId = departModel.get().getId();
-                            }
+                        Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department)).findFirst();
+                        if (departModel != null && departModel.isPresent()) {
+                            departmentId = departModel.get().getId();
                         }
 
-
                         //学号重复判断
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));
                         if (!ObjectUtils.isEmpty(cardNo)) {
                             cardNos.add(cardNo);
                         }
                         if (cardNos.stream().distinct().count() != cardNos.size()) {
-                            return CommonResult.fail("导入的Excel中,号:" + cardNo + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的学号:" + cardNo + "存在重复数据");
                         }
 
                         //身份证重复判断
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));
+                        String idCard = dataFormatter.formatCellValue(row.getCell(5));
                         if (!ObjectUtils.isEmpty(idCard)) {
                             idCards.add(idCard);
                         }
-                        //List<String> noEmptyIdCards = idCards.stream().filter(e -> !e.equals("") || e != null).collect(Collectors.toList());
                         if (idCards.stream().distinct().count() != idCards.size()) {
-                            return CommonResult.fail("导入的Excel中,身份证号:" + idCard + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的身份证号:" + idCard + "存在重复数据");
                         }
                         user.setCardNo(cardNo == null ? "" : cardNo);
                         user.setName(name == null ? "" : name);
-                        user.setIdentityId(identity == null ? eIdentityStatu.Student.getValue() : eIdentityStatu.integerOf(identity));
+                        user.setIdentityId(eIdentityStatu.Student.getValue());
                         user.setIdCard(idCard == null ? "" : idCard);
                         user.setSexId(sex == null ? eSexStatu.Man.getValue() : eSexStatu.integerOf(sex));
                         user.setDepartmentId(departmentId);
                         String cellImage = dataFormatter.formatCellValue(row.getCell(6));
                         user.setHeadImage(cellImage);
-                        user.setDormitoryNumber(dormitoryNumber == null ? "" : dormitoryNumber);
-                        user.setGrade(grade == null ? "" : grade);
+                        user.setDormitoryNumber("");
+                        String grade = schoolClass == null ? "" : schoolClass.substring(0, 3);
+                        user.setGrade(grade);
                         Optional<SmartGrade> oGrade = grades.stream().filter(e -> e.getName().equals(grade)).findFirst();
-
                         if (oGrade != null && oGrade.isPresent()) {
                             Integer gradeId = oGrade.get().getId();
-
-                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClass) && e.getGradeId().equals(gradeId)).findFirst();
-
+                            String schoolClassStr = schoolClass.replace("grade", "");
+                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClassStr) && e.getGradeId().equals(gradeId)).findFirst();
                             if (oClass != null && oClass.isPresent()) {
                                 user.setSchoolClass(oClass.get().getId());
                             } else {
@@ -761,20 +892,40 @@ public class SmartUserController implements SmartUserControllerAPI {
                         user.setSpeciality("");
                         user.setCampus("");
                         user.setPhone(phone == null ? "" : phone);
-                        user.setAffiliate(affiliate == null ? "" : affiliate);
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        user.setTitle(title == null ? "" : title);
+                        user.setAffiliate("");
+                        user.setTitle("");
                         user.setAddress(address == null ? "" : address);
                         user.setNation(nation == null ? "" : nation);
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        user.setOfStudent(ofStudent == null ? "" : ofStudent);
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        user.setGraduate(graduate == null ? "" : graduate);
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        user.setDuties(duties == null ? null : Integer.valueOf(duties));
+                        user.setOfStudent("");
+                        user.setGraduate("");
+                        user.setDuties(null);
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));
+                        user.setTimeGroupId(eTimeGroup.integerOfTimeName(timeGroup));
                         user.setIsCancel(eLogOff.Unlogout.getValue());
 
                         result.add(user);
+
+                        //region 家属
+                        SmartUser familyOne = new SmartUser();
+                        familyOne.setName(family);
+                        familyOne.setPhone(phone);
+                        familyOne.setIdentityId(eIdentityStatu.Parent.getValue());
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        familyOne.setShip(familyShip == null ? "" : familyShip);
+                        result.add(familyOne);
+
+                        SmartUser familyTwo = new SmartUser();
+                        String familyNameTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!ObjectUtils.isEmpty(familyNameTwo)) {
+                            familyTwo.setName(familyNameTwo);
+                            String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                            familyTwo.setPhone(phoneTwo == null ? "" : phoneTwo);
+                            familyTwo.setIdentityId(eIdentityStatu.Parent.getValue());
+                            String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                            familyTwo.setShip(familyShipTwo == null ? "" : familyShipTwo);
+                            result.add(familyTwo);
+                        }
+                        //endregion
                     }
                 }
             }
@@ -1345,7 +1496,7 @@ public class SmartUserController implements SmartUserControllerAPI {
             //返回的结果中 code为1表示成功
             String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
 
-            if(bsResult.contains("人员不存在或已删除")){
+            if (bsResult.contains("人员不存在或已删除")) {
                 //获取班级Uid
                 SmartClass classData = smartClassService.getSmartClassById(usur.getSchoolClass());
                 if (classData == null) {
@@ -1516,7 +1667,7 @@ public class SmartUserController implements SmartUserControllerAPI {
 
             for (UserVo data : result.getList()) {
                 Optional<SmartIdentity> identityData = idnetitys.stream().filter(e -> e.getId().equals(data.getIdentityId())).findFirst();
-                if(identityData != null && identityData.isPresent()){
+                if (identityData != null && identityData.isPresent()) {
                     data.setIdentity(identityData.get().getName());
                 }
 
@@ -1850,7 +2001,7 @@ public class SmartUserController implements SmartUserControllerAPI {
                 return CommonResult.fail("当前学生信息已绑定过,请勿重复操作!");
             }
 
-            parentUser.setAffiliate(parentUser.getAffiliate() + "," +String.valueOf(studentUser.getId()));
+            parentUser.setAffiliate(parentUser.getAffiliate() + "," + String.valueOf(studentUser.getId()));
         }
 
         //region 新增希沃学生家长信息

+ 3 - 3
src/main/java/com/template/controller/SmartVisitorController.java

@@ -236,9 +236,9 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
         SmartVisitor sv = new SmartVisitor();
         sv.setUserId(oar.getUserId());
-        sv.setUserName(su.getName());
-        sv.setUserPhone(su.getPhone());
-        sv.setUserNumber(su.getIdCard());
+        sv.setUserName(oar.getUserName());
+        sv.setUserPhone(oar.getUserPhone());
+        sv.setUserNumber(oar.getUserCard());
         sv.setPeerNum(oar.getPeerNum());
         sv.setCarNum(oar.getCarNum());
         sv.setVisitReason(oar.getVisitReason());

+ 18 - 15
src/main/java/com/template/controller/SmartWarningController.java

@@ -300,26 +300,29 @@ public class SmartWarningController implements SmartWarningControllerAPI {
         }
 
 //        添加
-        List<SmartUser> smartUsers = smartUserService.getSmartUserByIds(savePushIds);
-
-        for (SmartUser smartUser : smartUsers) {
-            String gzhOpenId = smartUser.getGzhOpenId();
-            if (ObjectUtils.isEmpty(gzhOpenId)) {
-                return CommonResult.fail(smartUser.getName() + "未关联公众号");
+        if (ObjectUtils.isNotEmpty(savePushIds)&&savePushIds.size()>0) {
+            List<SmartUser> smartUsers = smartUserService.getSmartUserByIds(savePushIds);
+            for (SmartUser smartUser : smartUsers) {
+                String gzhOpenId = smartUser.getGzhOpenId();
+                if (ObjectUtils.isEmpty(gzhOpenId)) {
+                    return CommonResult.fail(smartUser.getName() + "未关联公众号");
+                }
+                smartUser.setIsPush(1);
+                smartUserService.updateSmartUser(smartUser);
             }
-            smartUser.setIsPush(1);
-            smartUserService.updateSmartUser(smartUser);
         }
 
+
 //        删除
-        List<SmartUser> smartUsersDelete = smartUserService.getSmartUserByIds(pushDeleteIds);
-        ArrayList<SmartUser> smartUsersUpdate = new ArrayList<>();
-        for (SmartUser smartUser : smartUsersDelete) {
-            smartUser.setIsPush(0);
-            smartUsersUpdate.add(smartUser);
+        if (ObjectUtils.isNotEmpty(pushDeleteIds)&&pushDeleteIds.size()>0) {
+            List<SmartUser> smartUsersDelete = smartUserService.getSmartUserByIds(pushDeleteIds);
+            ArrayList<SmartUser> smartUsersUpdate = new ArrayList<>();
+            for (SmartUser smartUser : smartUsersDelete) {
+                smartUser.setIsPush(0);
+                smartUsersUpdate.add(smartUser);
+            }
+            smartUserService.updateBatchById(smartUsersUpdate);
         }
-        smartUserService.updateBatchById(smartUsersUpdate);
-
         return CommonResult.ok();
     }
 

+ 153 - 0
src/main/java/com/template/controller/WxGzhController.java

@@ -0,0 +1,153 @@
+package com.template.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.template.annotation.PassToken;
+import com.template.api.WxGzhControllerAPI;
+import com.template.common.utils.*;
+import com.template.model.pojo.SmartCodeOpenId;
+import com.template.model.pojo.SmartUser;
+import com.template.model.pojo.SmsCode;
+import com.template.model.result.CommonResult;
+import com.template.model.weixin.HttpParame;
+import com.template.services.SmartCodeOpenIdService;
+import com.template.services.SmartUserService;
+import com.template.services.SmsCodeService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@RestController
+public class WxGzhController implements WxGzhControllerAPI {
+
+//    公众号的唯一标识
+    private static String appid="wxa46ef222053a1047";
+//    公众号的appsecret
+    private static String secret="16f74a1265c314fd79fdf90670173467";
+
+    @Autowired
+    SmartUserService smartUserService;
+
+    @Autowired
+    SmartCodeOpenIdService smartCodeOpenIdService;
+
+    @Autowired
+    SmsCodeService smsCodeService;
+
+    @Override
+    @PassToken
+    public CommonResult getWxGzhOpenid(String code) throws Exception {
+
+        String url="https://api.weixin.qq.com/sns/oauth2/access_token?appid="+appid+"&secret="+secret+"&code="+code+"&grant_type=authorization_code";
+        System.out.println("url = " + url);
+
+        String s = HttpsClient.httpsRequestReturnString(url, "GET", "");
+
+        JSONObject jsonObject = JSONObject.parseObject(s);
+
+        if (!jsonObject.containsKey("openid")) {
+            return CommonResult.fail("code有误");
+        }
+        String openid = jsonObject.getString("openid");
+
+//        判断openid是否已经存在
+        LambdaQueryWrapper<SmartUser> wrapper=new LambdaQueryWrapper<>();
+        wrapper.eq(SmartUser::getGzhOpenId,openid);
+        SmartUser smartUser = smartUserService.getOne(wrapper);
+        JSONObject jsonObject1 = new JSONObject();
+
+        if (ObjectUtils.isNotEmpty(smartUser)) {
+            jsonObject1.put("phone",smartUser.getPhone());
+            return CommonResult.ok(jsonObject1);
+        }
+        SmartCodeOpenId smartCodeOpenId = new SmartCodeOpenId();
+        smartCodeOpenId.setCode(code);
+        smartCodeOpenId.setOpenId(openid);
+
+        smartCodeOpenIdService.save(smartCodeOpenId);
+
+        System.out.println("openid = " + openid);
+
+        jsonObject1.put("phone","");
+        return CommonResult.ok(jsonObject1);
+    }
+
+    @Override
+    @PassToken
+    public CommonResult vertifyMessage(String phone, String code,String wxGzhCode) {
+        QueryWrapper<SmsCode> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("deleted", 0);
+        queryWrapper1.eq("is_verify", 0);
+        queryWrapper1.eq("phone_number", phone);
+        queryWrapper1.eq("code", code);
+        queryWrapper1.ge("expiration_time", new Date());
+        List<SmsCode> listc = smsCodeService.getSmsCodeByKey(queryWrapper1);
+        if (listc.isEmpty()) {
+            return CommonResult.ok("验证码已失效");
+        }
+
+        for (SmsCode smsCode : listc) {
+            smsCode.setIsVerify("1");
+            smsCodeService.updateSmsCode(smsCode);
+        }
+
+
+        QueryWrapper<SmartUser> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("deleted", 0);
+        queryWrapper2.eq("phone", phone);
+        SmartUser user = smartUserService.getOne(queryWrapper2);
+        if (ObjectUtils.isEmpty(user)) {
+            return CommonResult.fail("该用户不存在");
+        }
+
+        LambdaQueryWrapper<SmartCodeOpenId> wrapperCode=new LambdaQueryWrapper<>();
+        wrapperCode.eq(SmartCodeOpenId::getCode,wxGzhCode);
+        SmartCodeOpenId smartCodeOpenId = smartCodeOpenIdService.getOne(wrapperCode);
+
+        if (ObjectUtils.isNotEmpty(smartCodeOpenId)) {
+            user.setGzhOpenId(smartCodeOpenId.getOpenId());
+            smartUserService.updateSmartUser(user);
+        }
+
+        return CommonResult.ok();
+    }
+
+    @Override
+    @PassToken
+    public CommonResult unbinding(String phone) {
+        if (ObjectUtils.isEmpty(phone)) {
+            return CommonResult.fail("参数异常");
+        }
+
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("deleted", 0);
+        queryWrapper.eq("phone", phone);
+        SmartUser user = smartUserService.getOne(queryWrapper);
+        if (ObjectUtils.isEmpty(user)) {
+            return CommonResult.fail("该用户不存在");
+        }
+        user.setGzhOpenId("");
+
+        smartUserService.updateById(user);
+
+        return CommonResult.ok();
+    }
+
+
+}

+ 18 - 0
src/main/java/com/template/mapper/SmartCodeOpenIdMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.SmartCodeOpenId;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-26
+ */
+@Mapper
+public interface SmartCodeOpenIdMapper extends BaseMapper<SmartCodeOpenId> {
+
+}

+ 2 - 0
src/main/java/com/template/mapper/SmartEvaluateSdetailMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.student.SmartEvaluateSdetail;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.template.model.evaluate.student.SmartEvaluateSdetail;
  * @author ceshi
  * @since 2024-01-08
  */
+@Repository
 public interface SmartEvaluateSdetailMapper extends BaseMapper<SmartEvaluateSdetail> {
 
 }

+ 2 - 0
src/main/java/com/template/mapper/SmartEvaluateStudentMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.student.SmartEvaluateStudent;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.template.model.evaluate.student.SmartEvaluateStudent;
  * @author ceshi
  * @since 2024-01-08
  */
+@Repository
 public interface SmartEvaluateStudentMapper extends BaseMapper<SmartEvaluateStudent> {
 
 }

+ 3 - 1
src/main/java/com/template/mapper/SmartEvaluateTdetailMapper.java

@@ -3,6 +3,7 @@ package com.template.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.teacher.SmartEvaluateTdetail;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -12,7 +13,8 @@ import org.apache.ibatis.annotations.Param;
  * @author ceshi
  * @since 2024-01-02
  */
+@Repository
 public interface SmartEvaluateTdetailMapper extends BaseMapper<SmartEvaluateTdetail> {
 
-    public Double getAvgEvaluateScore(@Param("term") String term,@Param("scoreItem") String scoreItem);
+    Double getAvgEvaluateScore(@Param("term") String term,@Param("scoreItem") String scoreItem);
 }

+ 3 - 1
src/main/java/com/template/mapper/SmartEvaluateTeacherMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.teacher.SmartEvaluateTeacher;
+import org.springframework.stereotype.Repository;
 import org.springframework.web.bind.annotation.RequestParam;
 
 /**
@@ -12,8 +13,9 @@ import org.springframework.web.bind.annotation.RequestParam;
  * @author ceshi
  * @since 2024-01-02
  */
+@Repository
 public interface SmartEvaluateTeacherMapper extends BaseMapper<SmartEvaluateTeacher> {
 
-    public Double getAvgLowingScore(@RequestParam("term") String term);
+    Double getAvgLowingScore(@RequestParam("term") String term);
 
 }

+ 18 - 0
src/main/java/com/template/mapper/SmartNotificationMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.SmartNotification;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-30
+ */
+@Mapper
+public interface SmartNotificationMapper extends BaseMapper<SmartNotification> {
+
+}

+ 3 - 1
src/main/java/com/template/mapper/SmartScoreManageMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.teacher.SmartScoreManage;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,8 +12,9 @@ import com.template.model.evaluate.teacher.SmartScoreManage;
  * @author ceshi
  * @since 2024-01-02
  */
+@Repository
 public interface SmartScoreManageMapper extends BaseMapper<SmartScoreManage> {
 
-    public String getMaxTerm();
+    String getMaxTerm();
 
 }

+ 2 - 0
src/main/java/com/template/mapper/SmartSubjectManageMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.student.SmartSubjectManage;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.template.model.evaluate.student.SmartSubjectManage;
  * @author ceshi
  * @since 2024-01-08
  */
+@Repository
 public interface SmartSubjectManageMapper extends BaseMapper<SmartSubjectManage> {
 
     public String getMaxTerm();

+ 2 - 0
src/main/java/com/template/mapper/SmartSubjectRuleMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.template.model.evaluate.student.SmartSubjectRule;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.template.model.evaluate.student.SmartSubjectRule;
  * @author ceshi
  * @since 2024-01-08
  */
+@Repository
 public interface SmartSubjectRuleMapper extends BaseMapper<SmartSubjectRule> {
 
 }

+ 1 - 0
src/main/java/com/template/mapper/SmartUserMapper.java

@@ -38,4 +38,5 @@ public interface SmartUserMapper extends BaseMapper<SmartUser> {
 
     List<AffiliateParentVo> queryAffiliateParents(@Param("userId") Integer userId);
 
+    List<SmartUser> getAffiliateList(@Param("id")Integer id);
 }

+ 81 - 0
src/main/java/com/template/model/enumModel/eAttendanceStatu.java

@@ -0,0 +1,81 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 16:34
+ * @Description: com.template.model.enumModel
+ * @Version: 1.0
+ * 考勤状态
+ */
+// 准时:0
+// 迟到:1
+// 缺卡:3
+// 请假:6
+// 超时打卡:7
+public enum eAttendanceStatu {
+    OnTime(0),//准时
+    BeLate(1),//迟到
+    LackCard(3),//缺卡
+    AskLeave(6),//请假
+    ClockIn(7);//超时打卡
+
+    private int value;
+
+    eAttendanceStatu(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eAttendanceStatu valueOf(int value) {
+        switch (value) {
+            case 0:
+                return eAttendanceStatu.OnTime;
+            case 1:
+                return eAttendanceStatu.BeLate;
+            case 3:
+                return eAttendanceStatu.LackCard;
+            case 6:
+                return eAttendanceStatu.AskLeave;
+            case 7:
+                return eAttendanceStatu.ClockIn;
+            default:
+                return null;
+        }
+    }
+
+    public static Integer integerOf(String value) {
+        switch (value) {
+            case "准时":
+                return 0;
+            case "迟到":
+                return 1;
+            case "缺卡":
+                return 3;
+            case "请假":
+                return 6;
+            case "超时打卡":
+                return 7;
+            default:
+                return null;
+        }
+    }
+
+    public static String stringOf(Integer value) {
+        switch (value) {
+            case 0:
+                return "准时";
+            case 1:
+                return "迟到";
+            case 3:
+                return "缺卡";
+            case 6:
+                return "请假";
+            case 7:
+                return "超时打卡";
+            default:
+                return null;
+        }
+    }
+}

+ 29 - 3
src/main/java/com/template/model/enumModel/eTimeGroup.java

@@ -63,11 +63,37 @@ public enum eTimeGroup {
     public static String stringOfName(Integer value) {
         switch (value) {
             case 1:
-                return "上午";
+                return "上午时间组";
             case 2:
-                return "中午";
+                return "中午时间组";
             case 3:
-                return "下午";
+                return "傍晚时间组";
+            default:
+                return null;
+        }
+    }
+
+    public static String stringOfTimeName(String value) {
+        switch (value) {
+            case "上午时间组":
+                return "TG1701918449235594";
+            case "中午时间组":
+                return "TG1701747145136852";
+            case "傍晚时间组":
+                return "TG1701747243082762";
+            default:
+                return null;
+        }
+    }
+
+    public static Integer integerOfTimeName(String value) {
+        switch (value) {
+            case "上午时间组":
+                return 1;
+            case "中午时间组":
+                return 2;
+            case "傍晚时间组":
+                return 3;
             default:
                 return null;
         }

+ 70 - 0
src/main/java/com/template/model/enumModel/eXwApproveStatu.java

@@ -0,0 +1,70 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 16:34
+ * @Description: com.template.model.enumModel
+ * @Version: 1.0
+ * 希沃请假数据审核状态
+ * 请假审核状态:1未审核,2未通过,3已通过,4已撤销
+ */
+public enum eXwApproveStatu {
+    Unaudited(1),//未审核
+    Fail(2),//未通过
+    Passed(3),//已通过
+    Revoked(4);//已撤销
+
+    private int value;
+
+    eXwApproveStatu(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eXwApproveStatu valueOf(int value) {
+        switch (value) {
+            case 1:
+                return eXwApproveStatu.Unaudited;
+            case 2:
+                return eXwApproveStatu.Fail;
+            case 3:
+                return eXwApproveStatu.Passed;
+            case 4:
+                return eXwApproveStatu.Revoked;
+            default:
+                return null;
+        }
+    }
+
+    public static Integer integerOf(String value) {
+        switch (value) {
+            case "未审核":
+                return 1;
+            case "未通过":
+                return 2;
+            case "已通过":
+                return 3;
+            case "已撤销":
+                return 4;
+            default:
+                return null;
+        }
+    }
+
+    public static String stringOf(Integer value) {
+        switch (value) {
+            case 1:
+                return "未审核";
+            case 2:
+                return "未通过";
+            case 3:
+                return "已通过";
+            case 4:
+                return "已撤销";
+            default:
+                return null;
+        }
+    }
+}

+ 24 - 0
src/main/java/com/template/model/pojo/SmartAttendance.java

@@ -58,6 +58,30 @@ public class SmartAttendance implements Serializable {
     @ApiModelProperty(value = "希沃用户学号")
     private String xwStudentCode;
 
+    @ApiModelProperty(value = "请假原因")
+    private String reason;
+
+    @ApiModelProperty(value = "开始时间")
+    private Date startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    private Date endTime;
+
+    @ApiModelProperty(value = "希沃发起时间")
+    private Date initiateTime;
+
+    @ApiModelProperty(value = "希沃发起人用户ID")
+    private String initiateXwuid;
+
+    @ApiModelProperty(value = "希沃发起人名称")
+    private String initiateXwname;
+
+    @ApiModelProperty(value = "希沃发起人手机号")
+    private String initiateXwphone;
+
+    @ApiModelProperty(value = "希沃请假ID")
+    private String xwuid;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 64 - 0
src/main/java/com/template/model/pojo/SmartCodeOpenId.java

@@ -0,0 +1,64 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartCodeOpenId对象", description="")
+public class SmartCodeOpenId implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "微信公众号的code")
+    private String code;
+
+    @ApiModelProperty(value = "微信公众号code所对应的openId")
+    private String openId;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 80 - 0
src/main/java/com/template/model/pojo/SmartNotification.java

@@ -0,0 +1,80 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartNotification对象", description="")
+public class SmartNotification implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = " ")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "可查看的userId")
+    private Integer userId;
+
+    @ApiModelProperty(value = "名字")
+    private String userName;
+
+    @ApiModelProperty(value = "事件类型名称")
+    private String typeName;
+
+    @ApiModelProperty(value = "地点")
+    private String location;
+
+    @ApiModelProperty(value = "图片")
+    private String image;
+
+    @ApiModelProperty(value = "时间")
+    private String dateTime;
+
+    @ApiModelProperty(value = "类型——1:预警推送,2:学生轨迹")
+    private Integer type;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 3 - 0
src/main/java/com/template/model/pojo/SmartUser.java

@@ -127,6 +127,9 @@ public class SmartUser implements Serializable {
     @ApiModelProperty(value = "百胜教师编号")
     private String bsStaffCode;
 
+    @ApiModelProperty(value = "家属关系")
+    private String ship;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 18 - 0
src/main/java/com/template/model/request/otherAppointmentRequest.java

@@ -23,6 +23,24 @@ public class otherAppointmentRequest {
     private Integer userId;
 
     /**
+     * 访客姓名
+     */
+    @NotBlank(message = "访客姓名不能为空")
+    private String userName;
+
+    /**
+     * 访客手机号
+     */
+    @NotBlank(message = "访客手机号不能为空")
+    private String userPhone;
+
+    /**
+     * 访客身份证号
+     */
+    @NotBlank(message = "访客身份证号不能为空")
+    private String userCard;
+
+    /**
      * 来访时间
      */
     @NotBlank(message = "来访时间不能为空")

+ 5 - 0
src/main/java/com/template/services/SmartAttendanceService.java

@@ -2,6 +2,7 @@ package com.template.services;
 
 import com.template.model.pojo.SmartAttendance;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.pojo.SmartVisitor;
 
 import java.util.List;
 
@@ -15,4 +16,8 @@ import java.util.List;
  */
 public interface SmartAttendanceService extends IService<SmartAttendance> {
     List<SmartAttendance> queryAttendances(String startDate,String endDate);
+
+    List<SmartAttendance> queryExistAttendances(String startDate, String endDate);
+
+    boolean insertAttendanceBatch(List<SmartAttendance> attendances);
 }

+ 16 - 0
src/main/java/com/template/services/SmartCodeOpenIdService.java

@@ -0,0 +1,16 @@
+package com.template.services;
+
+import com.template.model.pojo.SmartCodeOpenId;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-26
+ */
+public interface SmartCodeOpenIdService extends IService<SmartCodeOpenId> {
+
+}

+ 18 - 0
src/main/java/com/template/services/SmartNotificationService.java

@@ -0,0 +1,18 @@
+package com.template.services;
+
+import com.template.model.pojo.SmartNotification;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.result.PageUtils;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-30
+ */
+public interface SmartNotificationService extends IService<SmartNotification> {
+
+    PageUtils<SmartNotification> pageRemindingList(Integer id, int currentPage, int pageCount, String type);
+}

+ 17 - 0
src/main/java/com/template/services/SmartUserService.java

@@ -68,4 +68,21 @@ public interface SmartUserService extends IService<SmartUser> {
     SmartUser queryUserInfo(String name,String cardNo,String idCard);
 
     SmartUser getSmartById(Integer id);
+
+    List<SmartUser> getSmartUserByxwuids(List<String> xwuids);
+
+    /**
+     * 获取可推送的人
+     * @return
+     */
+    List<SmartUser> getListPush();
+
+    /**
+     * 通过id查找所关联的人
+     * @param id
+     * @return
+     */
+    List<SmartUser> getAffiliateList(Integer id);
+
+    List<SmartUser> querySmartUserByCardNos(List<String> cardNos);
 }

+ 1 - 0
src/main/java/com/template/services/SmartWarningService.java

@@ -1,5 +1,6 @@
 package com.template.services;
 
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.extension.service.IService;

+ 19 - 0
src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java

@@ -2,6 +2,7 @@ package com.template.services.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.template.mapper.SmartAuthorGroupMapper;
+import com.template.model.enumModel.eAttendanceStatu;
 import com.template.model.pojo.SmartAttendance;
 import com.template.mapper.SmartAttendanceMapper;
 import com.template.services.SmartAttendanceService;
@@ -36,4 +37,22 @@ public class SmartAttendanceServiceImpl extends ServiceImpl<SmartAttendanceMappe
         List<SmartAttendance> result = smartAttendanceMapper.selectList(queryWrapper);
         return result;
     }
+
+
+    @Override
+    public List<SmartAttendance> queryExistAttendances(String startDate, String endDate) {
+        QueryWrapper<SmartAttendance> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge(StringUtils.hasText(startDate), "start_time", startDate);//大于等于
+        queryWrapper.le(StringUtils.hasText(endDate), "start_time", endDate);//小于等于
+        queryWrapper.eq("status", eAttendanceStatu.AskLeave.getValue());//小于等于
+
+        List<SmartAttendance> result = smartAttendanceMapper.selectList(queryWrapper);
+        return result;
+    }
+
+    @Override
+    public boolean insertAttendanceBatch(List<SmartAttendance> attendances) {
+        boolean result = this.saveBatch(attendances);
+        return result;
+    }
 }

+ 20 - 0
src/main/java/com/template/services/impl/SmartCodeOpenIdServiceImpl.java

@@ -0,0 +1,20 @@
+package com.template.services.impl;
+
+import com.template.model.pojo.SmartCodeOpenId;
+import com.template.mapper.SmartCodeOpenIdMapper;
+import com.template.services.SmartCodeOpenIdService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-26
+ */
+@Service
+public class SmartCodeOpenIdServiceImpl extends ServiceImpl<SmartCodeOpenIdMapper, SmartCodeOpenId> implements SmartCodeOpenIdService {
+
+}

+ 90 - 43
src/main/java/com/template/services/impl/SmartFaceDiscernServiceImpl.java

@@ -5,15 +5,14 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.template.common.utils.AesTestOne;
-import com.template.common.utils.CommonUtil;
-import com.template.common.utils.RequestUtils;
-import com.template.common.utils.TimeExchange;
+import com.template.common.utils.*;
 import com.template.model.pojo.SmartFaceDiscern;
 import com.template.mapper.SmartFaceDiscernMapper;
+import com.template.model.pojo.SmartNotification;
 import com.template.model.pojo.SmartUser;
 import com.template.services.SmartFaceDiscernService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.template.services.SmartNotificationService;
 import com.template.services.SmartUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -40,6 +39,9 @@ public class SmartFaceDiscernServiceImpl extends ServiceImpl<SmartFaceDiscernMap
     @Autowired
     SmartUserService smartUserService;
 
+    @Autowired
+    SmartNotificationService smartNotificationService;
+
 
     //    static String appid = "sc5efc60f2bd373df9";
     static String appid = "sc1eb792c1ea3237e9";
@@ -51,7 +53,7 @@ public class SmartFaceDiscernServiceImpl extends ServiceImpl<SmartFaceDiscernMap
     private Integer page = 1;
     private Integer size = 20;
 
-//    @Scheduled(cron = "0 0/30 * * * ? ")
+    @Scheduled(cron = "0 0/50 * * * ? ")
     public void baiS() {
         try {
             getFaceDiscern(page, size);
@@ -107,73 +109,118 @@ public class SmartFaceDiscernServiceImpl extends ServiceImpl<SmartFaceDiscernMap
         String decodedUrl = URLDecoder.decode(data1, "UTF-8");
 
         String decrypt = decrypt(decodedUrl, appSecret);
-        System.out.println("decrypt = " + decrypt);
-        if (ObjectUtils.isNotEmpty(decrypt)) {
+//        System.out.println("decrypt = " + decrypt);
+        if (ObjectUtils.isNotEmpty(decrypt)&& decrypt!="") {
             JSONObject jsonObject2 = JSONObject.parseObject(decrypt);
+
+            if (ObjectUtils.isNotEmpty(jsonObject2)) {
+
+
 //            获取总数
-            Integer total = Integer.valueOf(jsonObject2.getString("total"));
+                Integer total = Integer.valueOf(jsonObject2.getString("total"));
+ //               System.out.println("total = " + total);
 
-            if (total > pageindex * pagesize) {
-                page = pageindex + 1;
-            } else {
-                page = pageindex - 1;
-            }
+                if (total > pageindex * pagesize) {
+                    page = pageindex + 1;
+                } else {
+                    page = pageindex - 1;
+                }
 
 
-            JSONArray data2 = jsonObject2.getJSONArray("data");
-            for (int i = 0; i < data2.size(); i++) {
-                JSONObject jsonObject3 = data2.getJSONObject(i);
-                SmartFaceDiscern smartFaceDiscern = new SmartFaceDiscern();
+                JSONArray data2 = jsonObject2.getJSONArray("data");
+                for (int i = 0; i < data2.size(); i++) {
+                    JSONObject jsonObject3 = data2.getJSONObject(i);
+                    SmartFaceDiscern smartFaceDiscern = new SmartFaceDiscern();
 
 //                事件
-                String deviceName = jsonObject3.getString("device_name");
-                smartFaceDiscern.setType(deviceName);
+                    String deviceName = jsonObject3.getString("device_name");
+                    smartFaceDiscern.setType(deviceName);
 
 //                地点
-                String deviceArea = jsonObject3.getString("device_area");
-                smartFaceDiscern.setLocation(deviceArea);
+                    String deviceArea = jsonObject3.getString("device_area");
+                    smartFaceDiscern.setLocation(deviceArea);
 
 //                图片
-                String recordPhoto = jsonObject3.getString("record_photo");
-                smartFaceDiscern.setImage(recordPhoto);
+                    String recordPhoto = jsonObject3.getString("record_photo");
+                    smartFaceDiscern.setImage(recordPhoto);
 
 //                时间
-                String recordAddtime = jsonObject3.getString("record_addtime");
-                smartFaceDiscern.setDateTime(recordAddtime);
+                    String recordAddtime = jsonObject3.getString("record_addtime");
+                    smartFaceDiscern.setDateTime(recordAddtime);
 
 //                名字
-                String student_name = jsonObject3.getString("student_name");
-                smartFaceDiscern.setName(student_name);
+                    String student_name = jsonObject3.getString("student_name");
+                    smartFaceDiscern.setName(student_name);
 //                 学号
-                String student_number = jsonObject3.getString("student_number");
+                    String student_number = jsonObject3.getString("student_number");
 //                编号
-                String student_no = jsonObject3.getString("student_no");
+                    String student_no = jsonObject3.getString("student_no");
 
-                LambdaQueryWrapper<SmartUser> wrapper = new LambdaQueryWrapper<>();
-                wrapper.eq(SmartUser::getBsStudentNo, student_no);
-                wrapper.eq(SmartUser::getName, student_name);
-                SmartUser smartUser = smartUserService.getOne(wrapper);
+                    LambdaQueryWrapper<SmartUser> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(SmartUser::getBsStudentNo, student_no);
+                    wrapper.eq(SmartUser::getName, student_name);
+                    SmartUser smartUser = smartUserService.getOne(wrapper);
 
-                if (ObjectUtils.isNotEmpty(smartUser)) {
-                    smartFaceDiscern.setUserId(smartUser.getId());
+                    if (ObjectUtils.isNotEmpty(smartUser)) {
+                        smartFaceDiscern.setUserId(smartUser.getId());
 
 //                    判断是否已经添加
-                    LambdaQueryWrapper<SmartFaceDiscern> wrapperFD = new LambdaQueryWrapper<>();
-                    wrapperFD.eq(SmartFaceDiscern::getDateTime, recordAddtime)
-                            .eq(SmartFaceDiscern::getUserId, smartUser.getId());
-                    SmartFaceDiscern one = this.getOne(wrapperFD);
+                        LambdaQueryWrapper<SmartFaceDiscern> wrapperFD = new LambdaQueryWrapper<>();
+                        wrapperFD.eq(SmartFaceDiscern::getDateTime, recordAddtime)
+                                .eq(SmartFaceDiscern::getUserId, smartUser.getId());
+                        SmartFaceDiscern one = this.getOne(wrapperFD);
+
+                        if (ObjectUtils.isEmpty(one)) {
+                            this.save(smartFaceDiscern);
+
+//                        通过学生id找到关联的家长affiliate,并找到公众号,如果openid为空则不传
+                            List<SmartUser> userList = smartUserService.getAffiliateList(smartUser.getId());
+                            if (ObjectUtils.isNotEmpty(userList) && userList.size() > 0) {
+                                for (SmartUser user : userList) {
+                                    String gzhOpenId = user.getGzhOpenId();
+                                    if (ObjectUtils.isNotEmpty(gzhOpenId)) {
+                                        String pushType = "";
+                                        if (deviceName.contains("进校")) {
+                                            pushType = "进入大门";
+                                        } else if (deviceName.contains("出校")) {
+                                            pushType = "离开大门";
+                                        }
+
+                                        //                        时间格式是 yyyy-MM-dd HH:mm:ss,当前时间格式有问题
+
+                                        LocalDateTime date = LocalDateTime.now();
+                                        String format = date.format(dateTimeFormatter1);
+
+                                        //                    公众号信息推送
+                                        Message2.send(gzhOpenId, pushType, deviceArea, format);
+
+                                        SmartNotification smartNotification = new SmartNotification();
+                                        smartNotification.setUserId(smartUser.getId());
+                                        smartNotification.setUserName(smartUser.getName());
+                                        smartNotification.setTypeName(pushType);
+                                        smartNotification.setLocation(deviceArea);
+                                        smartNotification.setImage(recordPhoto);
+                                        smartNotification.setDateTime(recordAddtime);
+                                        smartNotification.setType(2);
+
+                                        smartNotificationService.save(smartNotification);
+
+                                    }
+
+                                }
+
+                            }
+
+                        }
 
-                    if (ObjectUtils.isEmpty(one)) {
-                        this.save(smartFaceDiscern);
                     }
 
                 }
-
             }
-
         }
     }
 
+
     @Override
     public List<SmartFaceDiscern> track(String stateTime, String endTime, Integer id) {
 

+ 2 - 1
src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java

@@ -10,6 +10,7 @@ import com.template.services.SmartIdentityService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.List;
 
@@ -50,7 +51,7 @@ public class SmartIdentityServiceImpl extends ServiceImpl<SmartIdentityMapper, S
     public PageUtils<SmartIdentity> queryPageSmartIdentitys(int currentPage, int pageCount, String name) {
         Page<SmartIdentity> page = new Page<>(currentPage, pageCount);
         QueryWrapper<SmartIdentity> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.like(StringUtils.hasText(name), "name", name);
+        queryWrapper.like(StringUtils.hasText(name), "name", name);
         IPage<SmartIdentity> result = smartIdentityMapper.selectPage(page,queryWrapper);
         return new PageUtils<>(result);
     }

+ 38 - 0
src/main/java/com/template/services/impl/SmartNotificationServiceImpl.java

@@ -0,0 +1,38 @@
+package com.template.services.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.template.model.pojo.SmartNotification;
+import com.template.mapper.SmartNotificationMapper;
+import com.template.model.result.PageUtils;
+import com.template.services.SmartNotificationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-01-30
+ */
+@Service
+public class SmartNotificationServiceImpl extends ServiceImpl<SmartNotificationMapper, SmartNotification> implements SmartNotificationService {
+
+    @Override
+    public PageUtils<SmartNotification> pageRemindingList(Integer id, int currentPage, int pageCount, String type) {
+
+        LambdaQueryWrapper<SmartNotification> wrapper=new LambdaQueryWrapper<>();
+        wrapper.eq(SmartNotification::getUserId,id)
+                .eq(ObjectUtils.isNotEmpty(type),SmartNotification::getType,type)
+                .orderByDesc(SmartNotification::getDateTime);
+
+        IPage<SmartNotification> page = this.page(new Page<>(currentPage, pageCount), wrapper);
+
+        return new PageUtils<>(page);
+    }
+}

+ 37 - 0
src/main/java/com/template/services/impl/SmartUserServiceImpl.java

@@ -1,5 +1,7 @@
 package com.template.services.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -7,6 +9,7 @@ import com.template.mapper.SmartUserMapper;
 import com.template.model.dto.WarningUserDto;
 import com.template.model.enumModel.eIdentityStatu;
 import com.template.model.pojo.SmartUser;
+import com.template.model.pojo.SmartWarning;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.*;
 import com.template.services.SmartUserService;
@@ -154,6 +157,32 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
     }
 
     @Override
+    public List<SmartUser> getSmartUserByxwuids(List<String> xwuids) {
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
+        queryWrapper.in("xw_student_uid", xwuids);
+        queryWrapper.eq("is_cancel", 0);
+        List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
+        return result;
+    }
+
+    @Override
+    public List<SmartUser> getListPush() {
+
+        LambdaQueryWrapper<SmartUser> wrapper=new LambdaQueryWrapper<>();
+        wrapper.eq(SmartUser::getIsCancel,0)
+                .eq(SmartUser::getIsPush,1);
+
+        List<SmartUser> smartUserList = this.list(wrapper);
+
+        return smartUserList;
+    }
+
+    @Override
+    public List<SmartUser> getAffiliateList(Integer id) {
+        return smartUserMapper.getAffiliateList(id);
+    }
+
+    @Override
     public List<AffiliateUserVo> queryAffiliateUserById(Integer id) {
         List<AffiliateUserVo> result = smartUserMapper.queryAffiliateUserById(id);
         return result;
@@ -207,4 +236,12 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
         return result;
     }
 
+    @Override
+    public List<SmartUser> querySmartUserByCardNos(List<String> cardNos){
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("is_cancel", 0);
+        queryWrapper.in("card_no", cardNos);
+        List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
+        return result;
+    }
 }

+ 4 - 0
src/main/java/com/template/services/impl/SmartWarningServiceImpl.java

@@ -1,11 +1,13 @@
 package com.template.services.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartWarningMapper;
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.template.mapper.SmartWarningMapper;
@@ -93,4 +95,6 @@ public class SmartWarningServiceImpl extends ServiceImpl<SmartWarningMapper, Sma
     }
 
 
+
+
 }

+ 5 - 0
src/main/resources/mapper/template/SmartAttendanceMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartAttendanceMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartClassMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartClassMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartDutiesMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartDutiesMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartGradeMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartGradeMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartMenuMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartMenuMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartNotificationMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartNotificationMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/template/SmartQrcodeMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartQrcodeMapper">
+
+</mapper>

+ 84 - 0
src/main/resources/mapper/template/SmartScoreMapper.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartScoreMapper">
+
+
+    <resultMap type="com.template.model.vo.ScorePageVo" id="smartScorePageMap">
+        <result property="id" column="id"/>
+        <result property="semester" column="semester"/>
+        <result property="grade" column="grade"/>
+        <result property="gradeId" column="grade_id"/>
+        <result property="schoolClass" column="school_class"/>
+        <result property="schoolClassId" column="school_class_id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="examType" column="exam_type"/>
+        <result property="name" column="name"/>
+        <result property="userId" column="user_id"/>
+        <result property="cardNo" column="card_no"/>
+        <result property="score" column="score"/>
+    </resultMap>
+    <select id="querySmartScorePage" resultType="com.template.model.vo.ScorePageVo" resultMap="smartScorePageMap">
+        select ss.user_id,ss.id,ss.semester,ss.grade_id,ss.school_class_id,ss.grade,ss.school_class,ss.subject_id,ss.exam_type,su.name,ss.card_no,ss.score from
+        smart_score ss
+        left join smart_user su on su.deleted = 0 and su.id = ss.user_id
+        where ss.deleted = 0
+        <if test="name != null and name != ''">
+            and (ss.name like '%' #{name} '%' or ss.card_no like '%' #{name} '%')
+        </if>
+        <if test="semester != null and semester != ''">
+            and ss.semester like '%' #{semester} '%'
+        </if>
+        <if test="grade != null and grade != ''">
+            and ss.grade like '%' #{grade} '%'
+        </if>
+        <if test="schoolClass != null and schoolClass != ''">
+            and ss.school_class like '%' #{schoolClass} '%'
+        </if>
+        <if test="subject != null and subject != ''">
+            and ss.subject_id = #{subject}
+        </if>
+        <if test="examType != null and examType != ''">
+            and ss.exam_type = #{examType}
+        </if>
+        <if test="MinScore != null and MinScore != ''">
+            and ss.score >= #{MinScore}
+        </if>
+        <if test="MaxScore != null and MaxScore != ''">
+            and ss.score &lt;= #{MaxScore}
+        </if>
+    </select>
+
+
+    <select id="querySmartScores" resultType="com.template.model.vo.ScorePageVo" resultMap="smartScorePageMap">
+        select ss.id,ss.semester,ss.grade,ss.school_class,ss.subject_id,ss.exam_type,su.name,ss.card_no,ss.score from
+        smart_score ss
+        left join smart_user su on su.deleted = 0 and su.id = ss.user_id
+        where ss.deleted = 0
+        <if test="name != null and name != ''">
+            and (ss.name like '%' #{name} '%' or ss.card_no like '%' #{name} '%')
+        </if>
+        <if test="semester != null and semester != ''">
+            and ss.semester like '%' #{semester} '%'
+        </if>
+        <if test="grade != null and grade != ''">
+            and ss.grade like '%' #{grade} '%'
+        </if>
+        <if test="schoolClass != null and schoolClass != ''">
+            and ss.school_class like '%' #{schoolClass} '%'
+        </if>
+        <if test="subject != null and subject != ''">
+            and ss.subject_id = #{subject}
+        </if>
+        <if test="examType != null and examType != ''">
+            and ss.exam_type = #{examType}
+        </if>
+        <if test="MinScore != null and MinScore != ''">
+            and ss.score >= #{MinScore}
+        </if>
+        <if test="MaxScore != null and MaxScore != ''">
+            and ss.score &lt;= #{MaxScore}
+        </if>
+    </select>
+
+
+</mapper>

+ 8 - 0
src/main/resources/mapper/template/SmartSubjectManageMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.SmartSubjectManageMapper">
+
+    <select id="getMaxTerm" resultType="String" >
+        select max(term) as term from `smart_subject_manage`
+    </select>
+</mapper>

+ 8 - 0
src/main/resources/mapper/template/SmartUserMapper.xml

@@ -159,4 +159,12 @@
         </if>
     </select>
 
+    <select id="getAffiliateList" resultType="com.template.model.pojo.SmartUser">
+        SELECT * FROM `smart_user`
+        where deleted = 0 and is_cancel=0
+        <if test="id != null and id != ''">
+            and FIND_IN_SET(#{id},affiliate)
+        </if>
+    </select>
+
 </mapper>

+ 5 - 5
target/classes/application-dev.yml

@@ -75,11 +75,11 @@ accesscontrol:
 
 #腾讯云
 tencentcloud:
-  secretID: AKIDDPo13qZCZqtgJsGQL7AyYu1wc7QVMyLl  #签名
-  secretKey: JPGrELFySiv0pOrKOPEwSnulOq9IPPDr     #密钥
-  sdkAppId: 1400813506   #短信应用ID
-  signName: 华仁享学教育   #短信签名内容
-  templateId: 1770016  #模板 ID
+  secretID: AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg  #签名
+  secretKey: NkyCN3cz97qKaeXLvHOGxOcdS8f184pL     #密钥
+  sdkAppId: 1400885930  #短信应用ID
+  signName: 江西省创海科技有限公司   #短信签名内容
+  templateId: 2060673  #模板 ID
   smsMin: 1
 
 #是否开启定时

+ 5 - 5
target/classes/application-prod.yml

@@ -48,11 +48,11 @@ mybatis-plus:
 
 #腾讯云
 tencentcloud:
-  secretID: AKIDDPo13qZCZqtgJsGQL7AyYu1wc7QVMyLl  #签名
-  secretKey: JPGrELFySiv0pOrKOPEwSnulOq9IPPDr     #密钥
-  sdkAppId: 1400813506   #短信应用ID
-  signName: 华仁享学教育   #短信签名内容
-  templateId: 1770016  #模板 ID
+  secretID: AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg  #签名
+  secretKey: NkyCN3cz97qKaeXLvHOGxOcdS8f184pL     #密钥
+  sdkAppId: 1400885930  #短信应用ID
+  signName: 江西省创海科技有限公司   #短信签名内容
+  templateId: 2060673  #模板 ID
   smsMin: 1
 
 # 项目公钥私钥

+ 5 - 5
target/classes/application.yml

@@ -45,11 +45,11 @@ mybatis-plus:
       logic-not-delete-value: 0
 #腾讯云
 tencentcloud:
-  secretID: AKIDDPo13qZCZqtgJsGQL7AyYu1wc7QVMyLl  #签名
-  secretKey: JPGrELFySiv0pOrKOPEwSnulOq9IPPDr     #密钥
-  sdkAppId: 1400813506   #短信应用ID
-  signName: 华仁享学教育   #短信签名内容
-  templateId: 1770016  #模板 ID
+  secretID: AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg  #签名
+  secretKey: NkyCN3cz97qKaeXLvHOGxOcdS8f184pL     #密钥
+  sdkAppId: 1400885930  #短信应用ID
+  signName: 江西省创海科技有限公司   #短信签名内容
+  templateId: 2060673  #模板 ID
   smsMin: 1
 
 # 项目公钥私钥

+ 12 - 7
target/classes/mapper/template/SmartUserMapper.xml

@@ -132,12 +132,16 @@
         </if>
     </select>
 
-    <select id="warningPushList" resultType="com.template.model.pojo.SmartUser">
-        SELECT *
-        FROM `smart_user`
-        WHERE is_push = 1
-          and is_cancel = 0
-          and deleted = 0
+    <select id="warningPushList" resultType="com.template.model.dto.WarningUserDto">
+        SELECT su.id      AS id,
+               su.`name`  AS `name`,
+               su.card_no AS cardNo,
+               sd.`name`  AS departmentName
+        FROM `smart_user` su
+                 LEFT JOIN smart_department sd ON sd.id = su.department_id and sd.deleted = 0
+        WHERE su.is_push = 1
+          and su.is_cancel = 0
+          and su.deleted = 0
     </select>
 
 
@@ -146,7 +150,8 @@
         <result property="name" column="name"/>
     </resultMap>
 
-    <select id="queryAffiliateParents" resultType="com.template.model.vo.AffiliateParentVo" resultMap="affiliateParentMap">
+    <select id="queryAffiliateParents" resultType="com.template.model.vo.AffiliateParentVo"
+            resultMap="affiliateParentMap">
         SELECT id,name FROM `smart_user`
         where deleted = 0 and is_cancel=0
         <if test="userId != null and userId != ''">

+ 11 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -6,6 +6,7 @@ com\template\model\seewo\ParentServiceBatchSaveOrUpdateParentsParam$ParentsItem$
 com\template\model\seewo\StudentLeaveStudentLeaveRequestHandlerParam$StudentLeaveStudentLeaveRequestHandlerParamBuilder.class
 com\template\common\utils\DateUtils.class
 com\template\controller\SystemMenuController.class
+com\template\controller\WxGzhController.class
 com\template\services\SmartSubjectManageService.class
 com\template\services\impl\SmartDepartmentServiceImpl.class
 com\template\model\seewo\StudentServiceUpdateStudentInfoParam$ParentsItem$ParentsItemBuilder.class
@@ -35,6 +36,7 @@ com\template\model\seewo\OrganizationNodeServiceInitSchoolClassesResult.class
 com\template\model\seewo\OrganizationNodeServiceInitSchoolClassesParam$RequestBody.class
 com\template\config\ScheduleConfig.class
 com\template\common\utils\ExcelUtil3.class
+com\template\controller\SmartCodeOpenIdController.class
 com\template\model\phoneBook\BookUser.class
 com\template\model\seewo\OrgClassOpenSeewoUcOpenV1ClassFullParam$JSONRequestBody.class
 com\template\MybatisPlusApplication.class
@@ -55,6 +57,7 @@ com\template\model\vo\BsGradeVo.class
 com\template\mapper\SmartGradeMapper.class
 com\template\services\impl\SmartEvaluateTdetailServiceImpl.class
 com\template\model\seewo\ParentServiceBatchSaveOrUpdateParentsResult.class
+com\template\model\pojo\SmartCodeOpenId.class
 com\template\model\tongji\EnergyTj.class
 com\template\model\seewo\TeacherServiceBatchSaveOrUpdateTeacherResult$TeacherBaseInfoDto.class
 com\template\api\LoginControllerAPI.class
@@ -109,6 +112,7 @@ com\template\controller\SmartSchoolController.class
 com\template\model\seewo\AttendanceRuleListSchoolAttendRuleParam$Query$QueryBuilder.class
 com\template\services\SmartEvaluateStudentService.class
 com\template\services\impl\SmartClassServiceImpl.class
+com\template\api\WxGzhControllerAPI.class
 com\template\mapper\SmartVisitorMapper.class
 com\template\model\pojo\SmartAttendance.class
 com\template\model\vo\SmartEnumVo.class
@@ -193,11 +197,13 @@ com\template\model\seewo\HomeSchoolServiceSendNoteToKidResult$ResponseBody.class
 com\template\services\impl\SmartAttendanceServiceImpl.class
 com\template\common\utils\Message.class
 com\template\model\evaluate\student\SmartSubjectRuleOutList.class
+com\template\services\impl\SmartCodeOpenIdServiceImpl.class
 com\template\common\utils\GetCameraPreviewURL$3.class
 com\template\controller\WechatScanLoginController$2.class
 com\template\annotation\ControllerIsShow.class
 com\template\common\utils\WxConfig.class
 com\template\mapper\SmartFaceDiscernMapper.class
+com\template\services\SmartCodeOpenIdService.class
 com\template\model\request\UpdateSmartSchoolRequest.class
 com\template\model\tongji\MonthMeterDetail.class
 com\template\services\impl\SmartDutiesServiceImpl.class
@@ -219,6 +225,7 @@ com\template\model\weixin\AccessToken.class
 com\template\controller\WechatScanLoginController$1.class
 com\template\api\WechatScanLoginControllerAPI.class
 com\template\model\seewo\StudentServiceBatchSaveClassStudentsResult$JSONResponseBody.class
+com\template\model\enumModel\eXwApproveStatu.class
 com\template\model\weixin\AuthorAndGroup2.class
 com\template\mapper\SmartIdentityMapper.class
 com\template\model\pojo\SystemRole.class
@@ -232,6 +239,7 @@ com\template\model\pojo\SmartDsColumnCor.class
 com\template\model\seewo\AttendanceServiceListAttendClassRecordsResult$RecordsItem.class
 com\template\model\seewo\OrgClassOpenSeewoUcOpenV1ClassFullParam$JSONRequestBody$JSONRequestBodyBuilder.class
 com\template\services\SmartUploadService.class
+com\template\model\pojo\SmartDataTaskSetDebugSql.class
 com\template\model\seewo\TeacherServiceBatchSetClassMastersParam$RequestBody$RequestBodyBuilder.class
 com\template\model\enumModel\eExamineStatu.class
 com\template\model\pojo\SmartScore.class
@@ -539,6 +547,7 @@ com\template\services\impl\SmartDataSourceServiceImpl.class
 com\template\core\JwtAuthenticationInterceptor.class
 com\template\mapper\SmartMeterMapper.class
 com\template\model\seewo\ParentServiceBatchSaveOrUpdateParentsParam$StudentParentsItem.class
+com\template\api\SmartCodeOpenIdControllerAPI.class
 com\template\model\evaluate\student\SmartEvaluateSdetail.class
 com\template\model\tongji\Tj.class
 com\template\controller\SmartScreenshotController.class
@@ -595,6 +604,7 @@ com\template\model\seewo\AttendanceRuleListEventByClazzParam$RequestBody$Request
 com\template\model\seewo\OrganizationNodeServiceInitSchoolClassesParam$Query.class
 com\template\model\seewo\AttendanceRuleListEventByClazzResult$EventsItem.class
 com\template\api\SmartBuildControllerAPI.class
+com\template\model\enumModel\eAttendanceStatu.class
 com\template\model\seewo\AttendanceRuleListSchoolAttendRuleParam$RequestBody$RequestBodyBuilder.class
 com\template\model\seewo\TeacherServiceBatchSetClassMastersResult$ResponseBody.class
 com\template\model\request\updateDutiesRequest.class
@@ -616,5 +626,6 @@ com\template\model\seewo\TeacherServiceBatchSetClassMastersParam$TeacherServiceB
 com\template\model\seewo\HomeSchoolServiceSendNoteToKidParam$HomeSchoolServiceSendNoteToKidParamBuilder.class
 com\template\model\vo\BsStaffNoVo.class
 com\template\services\impl\SmartFreezeRecordServiceImpl.class
+com\template\mapper\SmartCodeOpenIdMapper.class
 com\template\model\pojo\SmartDataTaskDebug.class
 com\template\model\vo\BsStudentVo.class

+ 11 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -55,6 +55,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\UploadControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\common\utils\HttpUtils.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartDataTask.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartCodeOpenIdServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartDataTaskDebug.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartIdentityControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\insertScreenshotRequest.java
@@ -92,11 +93,13 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\common\utils\RSAUtils.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\updateSmartGradeRequest.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\common\utils\GetVertifyCode.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmartCodeOpenIdController.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SmartEvaluateTdetailService.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\insertDutiesRequest.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartDataClassServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartScreenshotServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SmsCodeService.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\WxGzhControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartDataSource.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartScreenshotRecord.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\RepairAdminService.java
@@ -108,6 +111,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\LogInfoControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SmartApplyService.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\insertFreezeRecordRequest.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartCodeOpenId.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartFreezeRecordControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmsCodeServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\bindStudentRequest.java
@@ -175,6 +179,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\mapper\SmartGradeMapper.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\ParentOfStudentsVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\SmartFreezeRecordPageVo.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SmartCodeOpenIdService.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartScoreManageServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartBuildControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\seewo\AttendanceServiceListAttendClassRecordsParam.java
@@ -258,6 +263,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartSubjectRuleServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartMenuControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmartWarningController.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartDataTaskSetDebugSql.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartAuthorGroupServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\ScoreVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\mapper\SmartDutiesMapper.java
@@ -266,6 +272,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\deleteSmartScoreRequest.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\BsStudentVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartMeterControllerAPI.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartCodeOpenIdControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartScoreServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartAttendanceControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartFaceDiscern.java
@@ -289,6 +296,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmartScreenshotController.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SystemMenuService.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\tongji\MeterMonthData.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\mapper\SmartCodeOpenIdMapper.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\enumModel\eIdentityStatu.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\common\utils\GetCameraPreviewURL.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmartDataClassController.java
@@ -334,6 +342,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\TurnOnDeviceVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\evaluate\teacher\SimpleScore.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\dto\WarningDeletePushDto.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\enumModel\eXwApproveStatu.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartSubjectManageServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\SystemMenuTreeVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\seewo\HomeSchoolServiceSendNoteToKidParam.java
@@ -437,6 +446,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\GradeListVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartFreezeRecordServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmartMeterDetailController.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\WxGzhController.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\seewo\TeacherServiceBatchSaveOrUpdateTeacherResult.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\seewo\AttendanceRuleListSchoolAttendRuleResult.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\seewo\AttendanceRuleListEventByClazzParam.java
@@ -486,6 +496,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\controller\SmsCodeController.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\mapper\SmartQrcodeMapper.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\mapper\SystemUserMapper.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\enumModel\eAttendanceStatu.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\enumModel\eDutiesType.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\enumModel\eExamType.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\pojo\SmartWarning.java

BIN
target/mybatis_plus-0.0.1-SNAPSHOT.jar.original