Просмотр исходного кода

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

zhaoy 7 лет назад
Родитель
Сommit
5ea4ea323d
39 измененных файлов с 716 добавлено и 942 удалено
  1. 24 0
      applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/po/School.java
  2. 4 2
      applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/repository/SchoolRepository.java
  3. 4 1
      applications/device/device-client/src/main/resources/application.yml
  4. 3 1
      applications/device/device-client/src/main/resources/schema.sql
  5. 31 21
      applications/device/device-client/src/main/resources/static/iccard.html
  6. 2 0
      applications/device/device-client/src/main/resources/static/js/school.js
  7. 21 5
      applications/device/device-client/src/main/resources/static/school.html
  8. 0 2
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/DeviceApplication.java
  9. 66 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessControlController.java
  10. 0 34
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessController.java
  11. 0 44
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/DeviceController.java
  12. 15 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/IcCardController.java
  13. 0 153
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/listener/AccessControlListener.java
  14. 27 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/AccessControlRecordMapper.java
  15. 0 32
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/DeviceMapper.java
  16. 15 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/StudentInfoMapper.java
  17. 1 1
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/AccessControlRecord.java
  18. 0 81
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/Device.java
  19. 1 1
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/StudentInfo.java
  20. 32 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/AccessControlService.java
  21. 0 8
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/AccessService.java
  22. 0 16
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/DeviceService.java
  23. 128 0
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/AccessControlServiceImpl.java
  24. 0 112
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/AccessServiceImpl.java
  25. 0 79
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/DeviceServiceImpl.java
  26. 3 4
      applications/device/device-server/src/main/resources/application.yml
  27. 109 0
      applications/device/device-server/src/main/resources/mapper/AccessControlRecordMapper.xml
  28. 0 237
      applications/device/device-server/src/main/resources/mapper/DeviceMapper.xml
  29. 25 0
      applications/device/device-server/src/main/resources/mapper/StudentInfoMapper.xml
  30. 3 4
      applications/device/device-server/src/test/java/com/usoftchina/smartschool/device/test/TestService.java
  31. 1 1
      applications/wechat/wechat-server/src/main/resources/config/application-docker-cloud.yml
  32. 24 5
      applications/wechat/wechat-server/src/main/resources/config/application-docker-test.yml
  33. 20 15
      frontend/pc-web/app/view/Interaction/homework/List.js
  34. 20 15
      frontend/pc-web/app/view/Interaction/notice/List.js
  35. 52 22
      frontend/pc-web/app/view/Interaction/score/List.js
  36. 43 15
      frontend/pc-web/app/view/Interaction/timetable/List.js
  37. 2 1
      frontend/pc-web/app/view/basic/class/ClassDetail.js
  38. 20 15
      frontend/pc-web/app/view/basic/staff/StaffList.js
  39. 20 15
      frontend/pc-web/app/view/basic/student/StudentList.js

+ 24 - 0
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/po/School.java

@@ -11,6 +11,14 @@ public class School implements Serializable {
      * 学校名称
      */
     private String name;
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * 私钥
+     */
+    private String secret;
 
     public String getName() {
         return name;
@@ -19,4 +27,20 @@ public class School implements Serializable {
     public void setName(String name) {
         this.name = name;
     }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getSecret() {
+        return secret;
+    }
+
+    public void setSecret(String secret) {
+        this.secret = secret;
+    }
 }

+ 4 - 2
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/repository/SchoolRepository.java

@@ -27,10 +27,12 @@ public class SchoolRepository{
     }
 
     public void save(School school) {
-        jdbcTemplate.update("insert into school (name) values (?)", school.getName());
+        jdbcTemplate.update("insert into school (name,id,secret) values (?,?,?)", school.getName(),
+                school.getId(), school.getSecret());
     }
 
     public void update(School school) {
-        jdbcTemplate.update("update school set name=?", school.getName());
+        jdbcTemplate.update("update school set name=?,id=?,secret=?",
+                school.getName(), school.getId(), school.getSecret());
     }
 }

+ 4 - 1
applications/device/device-client/src/main/resources/application.yml

@@ -28,4 +28,7 @@ spring:
       maximum-pool-size: 50
       idle-timeout: 30000
       max-lifetime: 1800000
-      connection-timeout: 30000
+      connection-timeout: 30000
+logging:
+  level:
+    com.usoftchina.smartschool.device.client: debug

+ 3 - 1
applications/device/device-client/src/main/resources/schema.sql

@@ -10,7 +10,9 @@ password varchar(50) not null
 
 create table if not exists school
 (
-name varchar(500) primary key not null
+name varchar(500) not null,
+id varchar(32) not null,
+secret varchar(100) not null
 );
 
 create table if not exists iccard

+ 31 - 21
applications/device/device-client/src/main/resources/static/iccard.html

@@ -26,32 +26,42 @@
 </nav>
 <div class="container">
     <div class="row justify-content-md-center">
-        <div class="col-lg-auto" style="width: 500px">
+        <div class="col-lg-auto" style="width: 500px;padding: 20px">
             <form id="form">
-                <div class="form-group">
-                    <label for="ipInput">IP</label>
-                    <input type="text" class="form-control" id="ipInput" name="ip" required
-                           aria-describedby="ipHelp" placeholder="ip地址,例如192.168.1.100">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="ipInput">IP</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="ipInput" name="ip" required
+                               placeholder="ip地址,例如192.168.1.100">
+                    </div>
                 </div>
-                <div class="form-group">
-                    <label for="portInput">端口</label>
-                    <input type="text" class="form-control" id="portInput" name="port" required
-                           aria-describedby="portHelp" placeholder="tcp端口,例如37777">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="portInput">端口</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="portInput" name="port" required
+                               placeholder="tcp端口,例如1433">
+                    </div>
                 </div>
-                <div class="form-group">
-                    <label for="usernameInput">账号</label>
-                    <input type="text" class="form-control" id="usernameInput" name="username"
-                           value="admin" required aria-describedby="usernameHelp" placeholder="数据库账号,例如sa">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="usernameInput">账号</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="usernameInput" name="username"
+                               value="admin" required placeholder="数据库账号,例如sa">
+                    </div>
                 </div>
-                <div class="form-group">
-                    <label for="passwordInput">密码</label>
-                    <input type="password" class="form-control" id="passwordInput" name="password"
-                           required aria-describedby="passwordHelp" placeholder="数据库密码">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="passwordInput">密码</label>
+                    <div class="col-sm-10">
+                        <input type="password" class="form-control" id="passwordInput" name="password"
+                               required placeholder="数据库密码">
+                    </div>
                 </div>
-                <div class="form-group">
-                    <label for="databaseNameInput">数据库</label>
-                    <input type="text" class="form-control" id="databaseNameInput" name="databaseName"
-                           required aria-describedby="databaseNameHelp" placeholder="数据库名称">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="databaseNameInput">数据库</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="databaseNameInput" name="databaseName"
+                               required placeholder="数据库名称">
+                    </div>
                 </div>
                 <button type="button" class="btn btn-primary btn-save">保存</button>
             </form>

+ 2 - 0
applications/device/device-client/src/main/resources/static/js/school.js

@@ -8,6 +8,8 @@ $(document).ready(function () {
                     success: function (content) {
                         if (content.success) {
                             $('#nameInput').val(content.data.name);
+                            $('#idInput').val(content.data.id);
+                            $('#secretInput').val(content.data.secret);
                         } else {
                             alert(content.message);
                         }

+ 21 - 5
applications/device/device-client/src/main/resources/static/school.html

@@ -26,12 +26,28 @@
 </nav>
 <div class="container">
     <div class="row justify-content-md-center">
-        <div class="col-lg-auto" style="width: 500px">
+        <div class="col-lg-auto" style="width: 500px;padding: 20px">
             <form id="form">
-                <div class="form-group">
-                    <label for="nameInput">名称</label>
-                    <input type="text" class="form-control" id="nameInput" name="name" required
-                           aria-describedby="nameHelp" placeholder="学校名称">
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="nameInput">名称</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="nameInput" name="name" required
+                               placeholder="学校名称">
+                    </div>
+                </div>
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="idInput">ID</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="idInput" name="id" required
+                               placeholder="学校唯一标志">
+                    </div>
+                </div>
+                <div class="form-group row">
+                    <label class="col-sm-2 col-form-label" for="secretInput">私钥</label>
+                    <div class="col-sm-10">
+                        <input type="text" class="form-control" id="secretInput" name="secret" required
+                               placeholder="学校数据传输私钥">
+                    </div>
                 </div>
                 <button type="button" class="btn btn-primary btn-save">保存</button>
             </form>

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

@@ -4,7 +4,6 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.scheduling.annotation.EnableAsync;
 
 /**
  * @author yingp
@@ -12,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
  */
 @SpringBootApplication
 @EnableEurekaClient
-@EnableAsync
 @EnableFeignClients({
         "com.usoftchina.smartschool.file.api","com.usoftchina.smartschool.wechat.api"
 })

+ 66 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessControlController.java

@@ -0,0 +1,66 @@
+package com.usoftchina.smartschool.device.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.smartschool.base.Result;
+import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.po.AccessControlRecord;
+import com.usoftchina.smartschool.device.service.AccessControlService;
+import com.usoftchina.smartschool.page.PageDefault;
+import com.usoftchina.smartschool.page.PageRequest;
+import com.usoftchina.smartschool.school.dto.ListReqDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2019/3/8
+ */
+@RestController
+@RequestMapping("/accesscontrol")
+public class AccessControlController {
+
+    @Autowired
+    private AccessControlService accessControlService;
+
+    /**
+     * 按人和时间期间查找门禁记录
+     *
+     * @param stuNumber
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/record")
+    public Result<List<AccessControlRecord>> getRecords(String stuNumber, Date beginDate, Date endDate) {
+        return Result.success(accessControlService.findByStuNumberAndDate(stuNumber, beginDate, endDate));
+    }
+
+    /**
+     * 门禁记录 - 列表查询
+     *
+     * @param page
+     * @param listReqDTO
+     * @return
+     */
+    @GetMapping("/record/list")
+    public Result<PageInfo<AccessControlRecord>> getRecordsPage(@PageDefault PageRequest page,
+                                                                ListReqDTO listReqDTO) {
+        return Result.success();
+    }
+
+    /**
+     * 接收门禁事件
+     *
+     * @param info
+     * @return
+     */
+    @PostMapping("/event")
+    public Result onAccessControlEvent(AccessControlInfo info) {
+        accessControlService.onAccessControlEvent(info);
+        return Result.success();
+    }
+
+}

+ 0 - 34
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessController.java

@@ -1,34 +0,0 @@
-package com.usoftchina.smartschool.device.controller;
-
-import com.usoftchina.smartschool.base.Result;
-import com.usoftchina.smartschool.device.dto.AccessControlInfo;
-import com.usoftchina.smartschool.device.service.AccessService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author: guq
- * @create: 2019-03-12 09:14
- **/
-@RequestMapping("/accesscontrol")
-@RestController
-public class AccessController {
-
-    @Autowired
-    private AccessService accessService;
-
-    @PostMapping("/event")
-    public Result accessEvent(@RequestBody AccessControlInfo event) {
-        accessService.accessEvent(event);
-        return Result.success();
-    }
-
-   /* @GetMapping("/test")
-    public Result test() {
-        AccessControlInfo info = new AccessControlInfo();
-        info.setCardNo("school");
-        info.setEventType(1);
-        accessService.accessEvent(info);
-        return Result.success();
-    }*/
-}

+ 0 - 44
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/DeviceController.java

@@ -1,44 +0,0 @@
-package com.usoftchina.smartschool.device.controller;
-
-import com.github.pagehelper.PageInfo;
-import com.usoftchina.smartschool.base.Result;
-import com.usoftchina.smartschool.device.po.Device;
-import com.usoftchina.smartschool.device.service.DeviceService;
-import com.usoftchina.smartschool.page.PageDefault;
-import com.usoftchina.smartschool.page.PageRequest;
-import com.usoftchina.smartschool.school.dto.BatchDealBaseDTO;
-import com.usoftchina.smartschool.school.dto.DocBaseDTO;
-import com.usoftchina.smartschool.school.dto.ListReqDTO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author yingp
- * @date 2019/3/8
- */
-@RestController
-@RequestMapping("/device")
-public class DeviceController {
-
-    @Autowired
-    private DeviceService deviceService;
-
-    @GetMapping("/list")
-    public Result getList(@PageDefault PageRequest page, ListReqDTO listReqDTO) {
-        PageInfo<Device> data = deviceService.getListData(page, listReqDTO);
-        return Result.success(data);
-    }
-
-    @PostMapping("/save")
-    public Result saveFormData(@RequestBody Device data) {
-        DocBaseDTO formData = deviceService.saveFormData(data);
-        return Result.success(formData);
-    }
-
-    @PostMapping("/batchDelete")
-    public Result batchDelete(@RequestBody BatchDealBaseDTO baseDTOs) {
-        deviceService.batchDelete(baseDTOs);
-        return Result.success();
-    }
-
-}

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

@@ -0,0 +1,15 @@
+package com.usoftchina.smartschool.device.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 对接IC卡业务
+ *
+ * @author yingp
+ * @date 2019/3/12
+ */
+@RestController
+@RequestMapping("/iccard")
+public class IcCardController {
+}

+ 0 - 153
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/listener/AccessControlListener.java

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

+ 27 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/AccessControlRecordMapper.java

@@ -0,0 +1,27 @@
+package com.usoftchina.smartschool.device.mapper;
+
+import com.usoftchina.smartschool.device.po.AccessControlRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2019/3/8
+ */
+@Mapper
+public interface AccessControlRecordMapper {
+    void insertRecordSelective(AccessControlRecord record);
+
+    /**
+     * 按学号和时间期间查找
+     *
+     * @param stuNumber
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    List<AccessControlRecord> selectByStuNumberAndDate(String stuNumber, Date beginDate,
+                                                     Date endDate);
+}

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

@@ -1,32 +0,0 @@
-package com.usoftchina.smartschool.device.mapper;
-
-import com.usoftchina.smartschool.device.dto.DeviceInfo;
-import com.usoftchina.smartschool.device.po.Device;
-import com.usoftchina.smartschool.device.po.Information;
-import com.usoftchina.smartschool.device.po.OutInRecord;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-
-import java.util.List;
-
-/**
- * @author yingp
- * @date 2019/3/8
- */
-@Mapper
-public interface DeviceMapper {
-    List<DeviceInfo> findAll();
-
-    List<Device> selectByConditon(@Param("con") String condition);
-
-    void insertSelective(Device formdata);
-
-    void updateByPrimaryKeySelective(Device formdata);
-
-    void deleteByPrimaryKey(Long id);
-
-    List<Information>selectInfoByCardNo(String cardNo);
-
-    void insertRecordSelective(OutInRecord record);
-}

+ 15 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/StudentInfoMapper.java

@@ -0,0 +1,15 @@
+package com.usoftchina.smartschool.device.mapper;
+
+import com.usoftchina.smartschool.device.po.StudentInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2019/3/8
+ */
+@Mapper
+public interface StudentInfoMapper {
+    List<StudentInfo> selectInfoByCardNo(String cardNo);
+}

+ 1 - 1
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/OutInRecord.java → applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/AccessControlRecord.java

@@ -10,7 +10,7 @@ import java.util.Date;
  * @create: 2019-03-11 11:33
  **/
 @Data
-public class OutInRecord implements Serializable{
+public class AccessControlRecord implements Serializable{
     private Long record_id;         //编号
 
     private String record_name;     //记录名

+ 0 - 81
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/Device.java

@@ -1,81 +0,0 @@
-package com.usoftchina.smartschool.device.po;
-
-
-import java.io.Serializable;
-
-/**
- * @author: guq
- * @create: 2019-03-08 16:53
- **/
-public class Device implements Serializable{
-
-    private Long deviceId;
-
-    private String deviceName;
-
-    private String deviceIp;
-
-    private Integer devicePort;
-
-    private String deviceUser;
-
-    private String devicePassword;
-
-    private String deviceRemark;
-
-    public Integer getDevicePort() {
-        return devicePort;
-    }
-
-    public void setDevicePort(Integer devicePort) {
-        this.devicePort = devicePort;
-    }
-
-    public String getDeviceIp() {
-        return deviceIp;
-    }
-
-    public void setDeviceIp(String deviceIp) {
-        this.deviceIp = deviceIp;
-    }
-
-    public String getDeviceRemark() {
-        return deviceRemark;
-    }
-
-    public void setDeviceRemark(String deviceRemark) {
-        this.deviceRemark = deviceRemark;
-    }
-
-    public Long getDeviceId() {
-        return deviceId;
-    }
-
-    public void setDeviceId(Long deviceId) {
-        this.deviceId = deviceId;
-    }
-
-    public String getDeviceName() {
-        return deviceName;
-    }
-
-    public void setDeviceName(String deviceName) {
-        this.deviceName = deviceName;
-    }
-
-    public String getDeviceUser() {
-        return deviceUser;
-    }
-
-    public void setDeviceUser(String deviceUser) {
-        this.deviceUser = deviceUser;
-    }
-
-    public String getDevicePassword() {
-        return devicePassword;
-    }
-
-    public void setDevicePassword(String devicePassword) {
-        this.devicePassword = devicePassword;
-    }
-}

+ 1 - 1
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/Information.java → applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/po/StudentInfo.java

@@ -9,7 +9,7 @@ import java.io.Serializable;
  * @create: 2019-03-11 10:57
  **/
 @Data
-public class Information implements Serializable{
+public class StudentInfo implements Serializable{
 
     private String appId;
 

+ 32 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/AccessControlService.java

@@ -0,0 +1,32 @@
+package com.usoftchina.smartschool.device.service;
+
+import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.po.AccessControlRecord;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2019/3/12
+ */
+public interface AccessControlService {
+
+    /**
+     * 处理门禁事件
+     *
+     * @param info
+     */
+    void onAccessControlEvent(AccessControlInfo info);
+
+    /**
+     * 按学号和时间期间查找
+     *
+     * @param stuNumber
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    List<AccessControlRecord> findByStuNumberAndDate(String stuNumber, Date beginDate, Date endDate);
+
+}

+ 0 - 8
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/AccessService.java

@@ -1,8 +0,0 @@
-package com.usoftchina.smartschool.device.service;
-
-import com.usoftchina.smartschool.device.dto.AccessControlInfo;
-
-public interface AccessService {
-
-    void accessEvent(AccessControlInfo event);
-}

+ 0 - 16
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/DeviceService.java

@@ -1,16 +0,0 @@
-package com.usoftchina.smartschool.device.service;
-
-import com.github.pagehelper.PageInfo;
-import com.usoftchina.smartschool.device.po.Device;
-import com.usoftchina.smartschool.page.PageRequest;
-import com.usoftchina.smartschool.school.dto.BatchDealBaseDTO;
-import com.usoftchina.smartschool.school.dto.DocBaseDTO;
-import com.usoftchina.smartschool.school.dto.ListReqDTO;
-
-public interface DeviceService {
-    PageInfo<Device> getListData(PageRequest page, ListReqDTO listReqDTO);
-
-    DocBaseDTO saveFormData(Device data);
-
-    void batchDelete(BatchDealBaseDTO baseDTOs);
-}

+ 128 - 0
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/AccessControlServiceImpl.java

@@ -0,0 +1,128 @@
+package com.usoftchina.smartschool.device.service.impl;
+
+import com.usoftchina.smartschool.base.Result;
+import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.mapper.AccessControlRecordMapper;
+import com.usoftchina.smartschool.device.mapper.StudentInfoMapper;
+import com.usoftchina.smartschool.device.po.AccessControlRecord;
+import com.usoftchina.smartschool.device.po.ImageFile;
+import com.usoftchina.smartschool.device.po.StudentInfo;
+import com.usoftchina.smartschool.device.service.AccessControlService;
+import com.usoftchina.smartschool.file.api.FileApi;
+import com.usoftchina.smartschool.file.dto.FileInfoDTO;
+import com.usoftchina.smartschool.utils.DateUtils;
+import com.usoftchina.smartschool.utils.StringUtils;
+import com.usoftchina.smartschool.wechat.api.WechatApi;
+import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2019/3/12
+ */
+@Service
+public class AccessControlServiceImpl implements AccessControlService{
+
+    @Autowired
+    private FileApi fileApi;
+
+    @Autowired
+    private WechatApi wechatApi;
+
+    @Autowired
+    private AccessControlRecordMapper accessControlRecordMapper;
+
+    @Autowired
+    private StudentInfoMapper studentInfoMapper;
+
+    private Logger logger = LoggerFactory.getLogger(AccessControlServiceImpl.class);
+
+    @Value("${wechat.template.accesscontrol}")
+    private String accessControlTemplateId;
+
+    @Override
+    public void onAccessControlEvent(AccessControlInfo info) {
+        Long fileId = null;
+        String cardNo = info.getCardNo();
+        if (StringUtils.isEmpty(cardNo)) {
+            return;
+        }
+        /**
+         * 查询人员信息
+         */
+        List<StudentInfo> information = studentInfoMapper.selectInfoByCardNo(cardNo);
+        if (null == information || information.size() == 0) {
+            logger.error("学生信息不存在");
+            return;
+        }
+        /**
+         * 1、保存图片文件;
+         */
+        byte[] imageData = info.getImageData();
+        if (null != imageData && imageData.length > 0) {
+            MultipartFile file = new ImageFile(imageData, information.get(0).getStuName());
+            Result<FileInfoDTO> fileInfo = null;
+            try {
+                fileInfo = fileApi.upload(0L, file);
+                fileId = fileInfo.getData().getId();
+            }catch (Exception ex) {
+                logger.error(ex.getMessage());
+            }
+        }
+        /**
+         * 2、保存门禁出入记录;
+         */
+        int type = info.getEventType();
+        StudentInfo studentInfo = information.get(0);
+        AccessControlRecord record = new AccessControlRecord();
+        record.setClazz_id(studentInfo.getClazz_id());
+        record.setSchool_id(studentInfo.getSchoolId());
+        record.setClazz_name(studentInfo.getStuClass());
+        record.setSchool_id(studentInfo.getSchoolId());
+        record.setGrade_clazz(studentInfo.getStuClassnickname());
+        record.setGrade_name(studentInfo.getStuGrade());
+        record.setRecord_date(new Date());
+        record.setStu_sex(studentInfo.getStuSex());
+        record.setRecord_type(type);
+        record.setStu_id(studentInfo.getStuId());
+        record.setStu_number(studentInfo.getStuNumber());
+        record.setRecord_name(studentInfo.getStuName() + (type == 1 ? "进人" : "出去"));
+        accessControlRecordMapper.insertRecordSelective(record);
+        /**
+         * 3、推送消息到消息服务器(微信服务监听此消息发送微信消息)
+         */
+        MessageInfoDTO msg = new MessageInfoDTO();
+        msg.setAppId(studentInfo.getAppId());
+        msg.setSecret(studentInfo.getSecret());
+        msg.setTouser(studentInfo.getOpenId());
+        msg.setTemplateId(accessControlTemplateId);
+        msg.setTitle("出入校提醒");
+        msg.setKeyword1(studentInfo.getStuName());
+        msg.setKeyword2(DateUtils.format());
+        msg.setRemark("您好! 你的孩子: " + studentInfo.getStuName() + (type == 1 ? " 进人" : " 出去") + "学校");
+        wechatApi.sendMsg(msg);
+    }
+
+    /**
+     * 按学号和时间期间查找
+     *
+     * @param stuNumber
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public List<AccessControlRecord> findByStuNumberAndDate(String stuNumber, Date beginDate,
+                                                     Date endDate) {
+        return accessControlRecordMapper.selectByStuNumberAndDate(stuNumber, beginDate, endDate);
+    }
+
+}

+ 0 - 112
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/AccessServiceImpl.java

@@ -1,112 +0,0 @@
-package com.usoftchina.smartschool.device.service.impl;
-
-import com.usoftchina.smartschool.base.Result;
-import com.usoftchina.smartschool.device.api.DeviceApi;
-import com.usoftchina.smartschool.device.dto.AccessControlInfo;
-import com.usoftchina.smartschool.device.mapper.DeviceMapper;
-import com.usoftchina.smartschool.device.po.ImageFile;
-import com.usoftchina.smartschool.device.po.Information;
-import com.usoftchina.smartschool.device.po.OutInRecord;
-import com.usoftchina.smartschool.device.service.AccessService;
-import com.usoftchina.smartschool.file.api.FileApi;
-import com.usoftchina.smartschool.file.dto.FileInfoDTO;
-import com.usoftchina.smartschool.utils.DateUtils;
-import com.usoftchina.smartschool.utils.StringUtils;
-import com.usoftchina.smartschool.wechat.api.WechatApi;
-import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author: guq
- * @create: 2019-03-12 09:28
- **/
-@Service
-public class AccessServiceImpl implements AccessService{
-
-   /* @Autowired
-    private FileApi fileApi;*/
-
-    @Autowired
-    private DeviceApi deviceApi;
-
-    @Autowired
-    private WechatApi wechatApi;
-
-    @Autowired
-    private DeviceMapper deviceMapper;
-
-    final static String TEMPLATEID = "JcWRReMGC1odqcaAgXDfETv9sWwVbWLXc9KLEn_Nve0";
-
-    private Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Override
-    public void accessEvent(AccessControlInfo event) {
-        Long fileId = null;
-        String cardNo = event.getCardNo();
-        if (StringUtils.isEmpty(cardNo)) {
-            return;
-        }
-        /**
-         * 查询人员信息
-         */
-        List<Information> information = deviceMapper.selectInfoByCardNo(cardNo);
-        if (null == information || information.size() == 0) {
-            logger.error("学生信息不存在");
-            return;
-        }
-        /**
-         * 1、保存图片文件;
-         */
-       /* byte[] imageData = event.getImageData();
-        if (null != imageData && imageData.length > 0) {
-            MultipartFile file = new ImageFile(imageData, information.get(0).getStuName());
-            Result<FileInfoDTO> fileInfo = null;
-            try {
-                fileInfo = fileApi.upload(0l, file);
-                fileId = fileInfo.getData().getId();
-            }catch (Exception ex) {
-                logger.error(ex.getMessage());
-            }
-        }*/
-        /**
-         * 2、保存门禁出入记录;
-         */
-        int type = event.getEventType();
-        Information info = information.get(0);
-        OutInRecord record = new OutInRecord();
-        record.setClazz_id(info.getClazz_id());
-        record.setSchool_id(info.getSchoolId());
-        record.setClazz_name(info.getStuClass());
-        record.setSchool_id(info.getSchoolId());
-        record.setGrade_clazz(info.getStuClassnickname());
-        record.setGrade_name(info.getStuGrade());
-        record.setRecord_date(new Date());
-        record.setStu_sex(info.getStuSex());
-        record.setRecord_type(type);
-        record.setStu_id(info.getStuId());
-        record.setStu_number(info.getStuNumber());
-        record.setRecord_name(info.getStuName() + (type == 1 ? "进人" : "出去"));
-        deviceMapper.insertRecordSelective(record);
-        /**
-         * 3、推送消息到消息服务器(微信服务监听此消息发送微信消息)
-         */
-        MessageInfoDTO msg = new MessageInfoDTO();
-        msg.setUserType(0);
-        msg.setAppId(info.getAppId());
-        msg.setSecret(info.getSecret());
-        msg.setTouser(info.getOpenId());
-        msg.setTemplateId(TEMPLATEID);
-        msg.setTitle("出入校提醒");
-        msg.setKeyword1(info.getStuName());
-        msg.setKeyword2(DateUtils.format());
-        msg.setRemark("您好! 你的孩子: " + info.getStuName() + (type == 1 ? " 进人" : " 出去") + "学校");
-        wechatApi.sendMsg(msg);
-    }
-}

+ 0 - 79
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/service/impl/DeviceServiceImpl.java

@@ -1,79 +0,0 @@
-package com.usoftchina.smartschool.device.service.impl;
-
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import com.usoftchina.smartschool.context.BaseContextHolder;
-import com.usoftchina.smartschool.device.mapper.DeviceMapper;
-import com.usoftchina.smartschool.device.po.Device;
-import com.usoftchina.smartschool.device.service.DeviceService;
-import com.usoftchina.smartschool.exception.BizException;
-import com.usoftchina.smartschool.exception.ExceptionCode;
-import com.usoftchina.smartschool.page.PageRequest;
-import com.usoftchina.smartschool.school.dto.BatchDealBaseDTO;
-import com.usoftchina.smartschool.school.dto.DocBaseDTO;
-import com.usoftchina.smartschool.school.dto.ListReqDTO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import java.util.List;
-
-/**
- * @author: guq
- * @create: 2019-03-08 16:48
- **/
-@Service
-public class DeviceServiceImpl implements DeviceService{
-
-    @Autowired
-    private DeviceMapper deviceMapper;
-
-    @Override
-    public PageInfo<Device> getListData(PageRequest page, ListReqDTO listReqDTO) {
-        PageHelper.startPage(page.getNumber(), page.getSize());
-        //condition语句
-        String condition = listReqDTO.getFinalCondition();
-        if(condition == null){
-            condition = "1=1";
-        }
-        List<Device> data = deviceMapper.selectByConditon(condition);
-        PageInfo<Device> list = new PageInfo<>(data);
-        return list;
-    }
-
-    @Override
-    public DocBaseDTO saveFormData(Device formdata) {
-        if (StringUtils.isEmpty(formdata)){
-            throw new BizException(ExceptionCode.ILLEGAL_ARGUMENTS);
-        }
-        Long id = formdata.getDeviceId();
-        if (StringUtils.isEmpty(id) || "0".equals(id.toString())) {
-            deviceMapper.insertSelective(formdata);
-            id = formdata.getDeviceId();
-        } else {
-            //更新
-            deviceMapper.updateByPrimaryKeySelective(formdata);
-        }
-        return new DocBaseDTO(formdata.getDeviceId());
-    }
-
-
-    @Override
-    public void batchDelete(BatchDealBaseDTO baseDTOs) {
-        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
-                baseDTOs.getBaseDTOs().size() == 0) {
-            return;
-        }
-        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
-            delete(base.getId());
-        }
-    }
-
-    private void delete(Long id) {
-        if (null == id || "0".equals(id)) {
-            return;
-        }
-        deviceMapper.deleteByPrimaryKey(id);
-    }
-}

+ 3 - 4
applications/device/device-server/src/main/resources/application.yml

@@ -1,7 +1,6 @@
-device:
-  dahua:
-    wait-time: 5000
-    connect-time: 10000
+wechat:
+  template:
+    accesscontrol: JcWRReMGC1odqcaAgXDfETv9sWwVbWLXc9KLEn_Nve0
 spring:
   application:
     name: device-server

+ 109 - 0
applications/device/device-server/src/main/resources/mapper/AccessControlRecordMapper.xml

@@ -0,0 +1,109 @@
+<?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.usoftchina.smartschool.device.mapper.AccessControlRecordMapper" >
+    <insert id="insertRecordSelective" parameterType="com.usoftchina.smartschool.device.po.AccessControlRecord" >
+        insert into out_in_record
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="record_name != null" >
+                record_name,
+            </if>
+            <if test="out_date != null" >
+                out_date,
+            </if>
+            <if test="in_date != null" >
+                in_date,
+            </if>
+            <if test="record_details != null" >
+                record_details,
+            </if>
+            <if test="record_remarks != null" >
+                record_remarks,
+            </if>
+            <if test="device_id != null" >
+                device_id,
+            </if>
+            <if test="stu_id != null" >
+                stu_id,
+            </if>
+            <if test="school_id != null" >
+                school_id,
+            </if>
+            <if test="stu_number != null" >
+                stu_number,
+            </if>
+            <if test="clazz_id != null" >
+                clazz_id,
+            </if>
+            <if test="clazz_name != null" >
+                clazz_name,
+            </if>
+            <if test="grade_name != null" >
+                grade_name,
+            </if>
+            <if test="grade_clazz != null" >
+                grade_clazz,
+            </if>
+            <if test="stu_sex != null" >
+                stu_sex,
+            </if>
+            <if test="record_type != null" >
+                record_type,
+            </if>
+            <if test="record_date != null" >
+                record_date,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="record_name != null" >
+                #{record_name,jdbcType=VARCHAR},
+            </if>
+            <if test="out_date != null" >
+                #{out_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="in_date != null" >
+                #{in_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="record_details != null" >
+                #{record_details,jdbcType=VARCHAR},
+            </if>
+            <if test="record_remarks != null" >
+                #{record_remarks,jdbcType=VARCHAR},
+            </if>
+            <if test="device_id != null" >
+                #{device_id,jdbcType=BIGINT},
+            </if>
+            <if test="stu_id != null" >
+                #{stu_id,jdbcType=BIGINT},
+            </if>
+            <if test="school_id != null" >
+                #{school_id,jdbcType=BIGINT},
+            </if>
+
+            <if test="stu_number != null" >
+                #{stu_number,jdbcType=VARCHAR},
+            </if>
+            <if test="clazz_id != null" >
+                #{clazz_id,jdbcType=BIGINT},
+            </if>
+            <if test="clazz_name != null" >
+                #{clazz_name,jdbcType=VARCHAR},
+            </if>
+            <if test="grade_name != null" >
+                #{grade_name,jdbcType=VARCHAR},
+            </if>
+            <if test="grade_clazz != null" >
+                #{grade_clazz,jdbcType=VARCHAR},
+            </if>
+            <if test="stu_sex != null" >
+                #{stu_sex,jdbcType=INTEGER},
+            </if>
+            <if test="record_type != null" >
+                #{record_type,jdbcType=INTEGER},
+            </if>
+            <if test="record_date != null" >
+                #{record_date,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+
+</mapper>

+ 0 - 237
applications/device/device-server/src/main/resources/mapper/DeviceMapper.xml

@@ -1,237 +0,0 @@
-<?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.usoftchina.smartschool.device.mapper.DeviceMapper" >
-   <resultMap id="CurriculumDetailDTOMap" type="com.usoftchina.smartschool.device.po.Device">
-        <id column="deviceId" property="deviceId" jdbcType="BIGINT" />
-        <result column="deviceName" property="deviceName" jdbcType="VARCHAR" />
-        <result column="deviceIp" property="deviceIp" jdbcType="VARCHAR" />
-        <result column="devicePort" property="devicePort" jdbcType="VARCHAR" />
-        <result column="deviceUser" property="deviceUser" jdbcType="VARCHAR" />
-        <result column="devicePassword" property="devicePassword" jdbcType="VARCHAR"/>
-    </resultMap>
-    <select id="findAll" resultMap="deviceInfoMap">
-        select * from device
-    </select>
-
-    <resultMap id="deviceInfoMap" type="com.usoftchina.smartschool.device.dto.DeviceInfo">
-        <result column="deviceIp" property="ip" jdbcType="VARCHAR" />
-        <result column="devicePort" property="port" jdbcType="INTEGER" />
-        <result column="deviceUser" property="username" jdbcType="VARCHAR" />
-        <result column="devicePassword" property="password" jdbcType="VARCHAR"/>
-    </resultMap>
-
-    <select id="selectByConditon" resultType="com.usoftchina.smartschool.device.po.Device">
-        select * from device
-        <where>
-            <if test="con != null">
-                ${con}
-            </if>
-        </where>
-        ORDER BY deviceId DESC
-    </select>
-
-
-    <insert id="insertSelective" parameterType="com.usoftchina.smartschool.device.po.Device" >
-        <selectKey  resultType="java.lang.Long" keyProperty="deviceId">
-            SELECT LAST_INSERT_ID() AS ID
-        </selectKey>
-        insert into device
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="deviceUser != null" >
-                deviceUser,
-            </if>
-            <if test="devicePassword != null" >
-                devicePassword,
-            </if>
-            <if test="deviceIp != null" >
-                deviceIp,
-            </if>
-            <if test="devicePort != null" >
-                devicePort,
-            </if>
-            <if test="deviceRemark != null" >
-                deviceRemark,
-            </if>
-            <if test="deviceName != null" >
-                deviceName,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="deviceUser != null" >
-                #{deviceUser,jdbcType=VARCHAR},
-            </if>
-            <if test="devicePassword != null" >
-                #{devicePassword,jdbcType=VARCHAR},
-            </if>
-            <if test="deviceIp != null" >
-                #{deviceIp,jdbcType=VARCHAR},
-            </if>
-            <if test="devicePort != null" >
-                #{devicePort,jdbcType=INTEGER},
-            </if>
-            <if test="deviceRemark != null" >
-                #{deviceRemark,jdbcType=VARCHAR},
-            </if>
-            <if test="deviceName != null" >
-                #{deviceName,jdbcType=VARCHAR},
-            </if>
-        </trim>
-    </insert>
-
-    <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.device.po.Device" >
-        update device
-    <set >
-        <if test="deviceUser != null" >
-            deviceUser = #{deviceUser,jdbcType=VARCHAR},
-        </if>
-        <if test="devicePort != null" >
-            devicePort = #{devicePort,jdbcType=INTEGER},
-        </if>
-        <if test="devicePassword != null" >
-            devicePassword = #{devicePassword,jdbcType=VARCHAR},
-        </if>
-        <if test="deviceIp != null" >
-            deviceIp = #{deviceIp,jdbcType=VARCHAR},
-        </if>
-        <if test="deviceRemark != null" >k
-            deviceRemark = #{deviceRemark,jdbcType=VARCHAR},
-        </if>
-        <if test="deviceName != null" >
-            deviceName = #{deviceName,jdbcType=VARCHAR},
-        </if>
-    </set>
-        where deviceId = #{deviceId,jdbcType=BIGINT}
-    </update>
-
-    <delete id="deleteByPrimaryKey" parameterType="long">
-        delete from device where deviceId = #{id}
-    </delete>
-
-    <select id="selectInfoByCardNo" parameterType="string" resultMap="information">
-        select school_appid,school_secret,sys_parents.openid,sys_student.stu_name,sys_student.stu_id,sys_school.school_id,
-         stu_number,sys_student.clazz_id,stu_class,stu_grade,stu_classnickname,stu_sex from sys_student left join sys_school on sys_student.school_id=sys_school.school_id
-        left join sys_parents_stu on sys_student.stu_id=sys_parents_stu.stu_id left join sys_parents on sys_parents.parent_id =
-        sys_parents_stu.parent_id where stu_cardNo = #{cardNo}
-    </select>
-
-    <resultMap id="information" type="com.usoftchina.smartschool.device.po.Information" >
-        <result column="school_appid" property="appId" jdbcType="VARCHAR" />
-        <result column="school_secret" property="secret" jdbcType="VARCHAR" />
-        <result column="openid" property="openId" jdbcType="VARCHAR" />
-        <result column="stu_name" property="stuName" jdbcType="VARCHAR" />
-        <result column="stu_id" property="stuId" jdbcType="BIGINT"/>
-        <result column="school_id" property="schoolId" jdbcType="BIGINT"/>
-        <result column="stu_number" property="stuNumber" jdbcType="VARCHAR" />
-        <result column="clazz_id" property="clazz_id" jdbcType="BIGINT" />
-        <result column="stu_class" property="stuClass" jdbcType="VARCHAR" />
-        <result column="stu_grade" property="stuGrade" jdbcType="VARCHAR" />
-        <result column="stu_classnickname" property="stuClassnickname" jdbcType="VARCHAR"/>
-        <result column="stu_sex" property="stuSex" jdbcType="INTEGER"/>
-    </resultMap>
-
-    <insert id="insertRecordSelective" parameterType="com.usoftchina.smartschool.device.po.OutInRecord" >
-        insert into out_in_record
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="record_name != null" >
-                record_name,
-            </if>
-            <if test="out_date != null" >
-                out_date,
-            </if>
-            <if test="in_date != null" >
-                in_date,
-            </if>
-            <if test="record_details != null" >
-                record_details,
-            </if>
-            <if test="record_remarks != null" >
-                record_remarks,
-            </if>
-            <if test="device_id != null" >
-                device_id,
-            </if>
-            <if test="stu_id != null" >
-                stu_id,
-            </if>
-            <if test="school_id != null" >
-                school_id,
-            </if>
-            <if test="stu_number != null" >
-                stu_number,
-            </if>
-            <if test="clazz_id != null" >
-                clazz_id,
-            </if>
-            <if test="clazz_name != null" >
-                clazz_name,
-            </if>
-            <if test="grade_name != null" >
-                grade_name,
-            </if>
-            <if test="grade_clazz != null" >
-                grade_clazz,
-            </if>
-            <if test="stu_sex != null" >
-                stu_sex,
-            </if>
-            <if test="record_type != null" >
-                record_type,
-            </if>
-            <if test="record_date != null" >
-                record_date,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="record_name != null" >
-                #{record_name,jdbcType=VARCHAR},
-            </if>
-            <if test="out_date != null" >
-                #{out_date,jdbcType=TIMESTAMP},
-            </if>
-            <if test="in_date != null" >
-                #{in_date,jdbcType=TIMESTAMP},
-            </if>
-            <if test="record_details != null" >
-                #{record_details,jdbcType=VARCHAR},
-            </if>
-            <if test="record_remarks != null" >
-                #{record_remarks,jdbcType=VARCHAR},
-            </if>
-            <if test="device_id != null" >
-                #{device_id,jdbcType=BIGINT},
-            </if>
-            <if test="stu_id != null" >
-                #{stu_id,jdbcType=BIGINT},
-            </if>
-            <if test="school_id != null" >
-                #{school_id,jdbcType=BIGINT},
-            </if>
-
-            <if test="stu_number != null" >
-                #{stu_number,jdbcType=VARCHAR},
-            </if>
-            <if test="clazz_id != null" >
-                #{clazz_id,jdbcType=BIGINT},
-            </if>
-            <if test="clazz_name != null" >
-                #{clazz_name,jdbcType=VARCHAR},
-            </if>
-            <if test="grade_name != null" >
-                #{grade_name,jdbcType=VARCHAR},
-            </if>
-            <if test="grade_clazz != null" >
-                #{grade_clazz,jdbcType=VARCHAR},
-            </if>
-            <if test="stu_sex != null" >
-                #{stu_sex,jdbcType=INTEGER},
-            </if>
-            <if test="record_type != null" >
-                #{record_type,jdbcType=INTEGER},
-            </if>
-            <if test="record_date != null" >
-                #{record_date,jdbcType=TIMESTAMP},
-            </if>
-        </trim>
-    </insert>
-
-</mapper>

+ 25 - 0
applications/device/device-server/src/main/resources/mapper/StudentInfoMapper.xml

@@ -0,0 +1,25 @@
+<?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.usoftchina.smartschool.device.mapper.AccessControlRecordMapper" >
+    <select id="selectInfoByCardNo" parameterType="string" resultMap="studentInfo">
+        select school_appid,school_secret,sys_parents.openid,sys_student.stu_name,sys_student.stu_id,sys_school.school_id,
+         stu_number,sys_student.clazz_id,stu_class,stu_grade,stu_classnickname,stu_sex from sys_student left join sys_school on sys_student.school_id=sys_school.school_id
+        left join sys_parents_stu on sys_student.stu_id=sys_parents_stu.stu_id left join sys_parents on sys_parents.parent_id =
+        sys_parents_stu.parent_id where stu_cardNo = #{cardNo}
+    </select>
+
+    <resultMap id="studentInfo" type="com.usoftchina.smartschool.device.po.StudentInfo" >
+        <result column="school_appid" property="appId" jdbcType="VARCHAR" />
+        <result column="school_secret" property="secret" jdbcType="VARCHAR" />
+        <result column="openid" property="openId" jdbcType="VARCHAR" />
+        <result column="stu_name" property="stuName" jdbcType="VARCHAR" />
+        <result column="stu_id" property="stuId" jdbcType="BIGINT"/>
+        <result column="school_id" property="schoolId" jdbcType="BIGINT"/>
+        <result column="stu_number" property="stuNumber" jdbcType="VARCHAR" />
+        <result column="clazz_id" property="clazz_id" jdbcType="BIGINT" />
+        <result column="stu_class" property="stuClass" jdbcType="VARCHAR" />
+        <result column="stu_grade" property="stuGrade" jdbcType="VARCHAR" />
+        <result column="stu_classnickname" property="stuClassnickname" jdbcType="VARCHAR"/>
+        <result column="stu_sex" property="stuSex" jdbcType="INTEGER"/>
+    </resultMap>
+</mapper>

+ 3 - 4
applications/device/device-server/src/test/java/com/usoftchina/smartschool/device/test/TestService.java

@@ -2,7 +2,6 @@ package com.usoftchina.smartschool.device.test;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.usoftchina.smartschool.device.dto.AccessControlInfo;
-import com.usoftchina.smartschool.device.service.AccessService;
 import com.usoftchina.smartschool.utils.DateUtils;
 import com.usoftchina.smartschool.wechat.api.WechatApi;
 import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
@@ -20,8 +19,8 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest
 public class TestService {
 
-    @Autowired
-    AccessService accessService;
+  /*  @Autowired
+    AccessService accessService;*/
     @Autowired
     WechatApi wechatApi;
 
@@ -30,7 +29,7 @@ public class TestService {
         AccessControlInfo info = new AccessControlInfo();
         info.setCardNo("school");
         info.setEventType(1);
-        accessService.accessEvent(info);
+        //accessService.accessEvent(info);
     }
 
     @Test

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

@@ -22,7 +22,7 @@ spring:
         max-lifetime: 1800000
         connection-timeout: 30000
   rabbitmq:
-      host: 127.0.0.1
+      host: 132.232.174.14
       port: 5672
       virtual-host: school
       username: saas

+ 24 - 5
applications/wechat/wechat-server/src/main/resources/config/application-docker-test.yml

@@ -1,12 +1,31 @@
 eureka:
   instance:
-    hostname: saas-sale-server-test
+    hostname: smartschool-wechat-server
     prefer-ip-address: false
   client:
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@saas-eureka-server-test:8515/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@smartschool-eureka-server:9500/eureka/
 spring:
+  redis:
+    host: 172.27.0.13
+    port: 6379
+    password: select111***
+  datasource:
+      driver-class-name: com.mysql.jdbc.Driver
+      url: jdbc:mysql://172.27.0.15:3306/smart_campus?characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
+      username: root
+      password: select111***
+      hikari:
+        minimum-idle: 5
+        maximum-pool-size: 50
+        idle-timeout: 30000
+        max-lifetime: 1800000
+        connection-timeout: 30000
   rabbitmq:
-    virtual-host: test
-server:
-  port: 8835
+      host: 127.0.0.1
+      port: 5672
+      virtual-host: school
+      username: saas
+      password: select123***
+      publisher-returns: true
+      publisher-confirms: true

+ 20 - 15
frontend/pc-web/app/view/Interaction/homework/List.js

@@ -141,21 +141,26 @@ Ext.define('school.view.interaction.homework.List', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.47:9560/teacher/batchDelete',
-                            url: '/api/school/homework/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function (res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function (e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.47:9560/teacher/batchDelete',
+                                    url: '/api/school/homework/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function (res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function (e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],

+ 20 - 15
frontend/pc-web/app/view/Interaction/notice/List.js

@@ -109,21 +109,26 @@ Ext.define('school.view.interaction.notice.List', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.47:9560/teacher/batchDelete',
-                            url: '/api/school/notice/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function (res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function (e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.47:9560/teacher/batchDelete',
+                                    url: '/api/school/notice/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function (res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function (e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],

+ 52 - 22
frontend/pc-web/app/view/Interaction/score/List.js

@@ -51,15 +51,32 @@ Ext.define('school.view.interaction.score.List', {
             }, {
                 xtype: 'textfield',
                 name: 'keyword',
-                fieldLabel: '学',
+                fieldLabel: '学号/姓名',
                 getCondition: function (value) {
-                    return ' (sd_stu like\'%' + value + '%\') ';
+                    return ' (sd_stu like\'%' + value + '%\' or sd_stunumber like \'%' + value + '%\') ';
                 }
             }, {
                 xtype: 'condatefield',
                 name: 'si_examdate',
                 fieldLabel: '考试时间',
                 columnWidth: 0.5
+            }, {
+                xtype: 'combobox',
+                name: 'si_publish',
+                fieldLabel: '发布状态',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                clearable: true,
+                store: Ext.create('Ext.data.ArrayStore', {
+                    fields: ['name', 'value'],
+                    data: [
+                        ['已发布', 1],
+                        ['未发布', 0]
+                    ]
+                }),
+                minChars: 0,
+                queryMode: 'local'
             }],
 
             gridConfig: {
@@ -113,21 +130,26 @@ Ext.define('school.view.interaction.score.List', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.47:9520/api/school/score/batchDelete',
-                            url: '/api/school/score/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function(res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function(e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.47:9520/api/school/score/batchDelete',
+                                    url: '/api/school/score/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function(res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function(e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],
@@ -148,15 +170,23 @@ Ext.define('school.view.interaction.score.List', {
                     dataIndex: 'si_examscope'
                 }, {
                     text: '年级',
-                    dataIndex: 'si_grade'
+                    dataIndex: 'si_grade',
+                    width: 120
                 }, {
                     text: '班级',
-                    dataIndex: 'si_class'
+                    dataIndex: 'si_class',
+                    width: 120
+                }, {
+                    text: '发布状态',
+                    dataIndex: 'si_publish',
+                    renderer: function(v) {
+                        return v == 1 ? '已发布' : '未发布'
+                    }
                 }],
                 supColumns: [{
-                //     text: '学生编号',
-                //     dataIndex: ''
-                // }, {
+                    text: '学生编号',
+                    dataIndex: 'sd_stunumber'
+                }, {
                     text: '学生姓名',
                     dataIndex: 'sd_stu'
                 }, {

+ 43 - 15
frontend/pc-web/app/view/Interaction/timetable/List.js

@@ -100,6 +100,23 @@ Ext.define('school.view.interaction.timetable.List', {
                     let month = now.getMonth() + 1;
                     return (month < 9) ? '第一学期' : '第二学期'
                 })()
+            }, {
+                xtype: 'combobox',
+                name: 'status',
+                fieldLabel: '发布状态',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                clearable: true,
+                store: Ext.create('Ext.data.ArrayStore', {
+                    fields: ['name', 'value'],
+                    data: [
+                        ['已生效', 1],
+                        ['未生效', 0]
+                    ]
+                }),
+                minChars: 0,
+                queryMode: 'local'
             }],
         
             gridConfig: {
@@ -154,21 +171,26 @@ Ext.define('school.view.interaction.timetable.List', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.36:9520/api/school/curriculum/batchDelete',
-                            url: '/api/school/curriculum/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function (res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function (e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.36:9520/api/school/curriculum/batchDelete',
+                                    url: '/api/school/curriculum/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function (res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function (e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],
@@ -202,6 +224,12 @@ Ext.define('school.view.interaction.timetable.List', {
                     text: '学期',
                     dataIndex: 'termName',
                     width: 120
+                }, {
+                    text: '状态',
+                    dataIndex: 'status',
+                    renderer: function(v) {
+                        return v == '1' ? '已生效' : '未生效'
+                    }
                 }]
             },
         });

+ 2 - 1
frontend/pc-web/app/view/basic/class/ClassDetail.js

@@ -116,6 +116,7 @@ Ext.define('school.view.basic.class.ClassDetail', {
                 idColumn: 'teacher_clazz_id',
                 detnoColumn: 'no',
                 storeModel: 'school.model.basic.Subject',
+                // deleteDetailUrl: 'http://10.1.80.180:9520/api/school/class/deleteDetail',
                 deleteDetailUrl: '/api/school/class/deleteDetail',
                 allowEmpty: true,
                 showCount: false,
@@ -132,7 +133,7 @@ Ext.define('school.view.basic.class.ClassDetail', {
                         xtype: 'textfield'
                     }
                     /**
-                     * TODO 未写入id
+                     * TODO 未写入学科id
                      */
                 }, {
                     text: '学科',

+ 20 - 15
frontend/pc-web/app/view/basic/staff/StaffList.js

@@ -77,21 +77,26 @@ Ext.define('school.view.basic.staff.StaffList', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.47:9560/teacher/batchDelete',
-                            url: '/api/school/teacher/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function (res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function (e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.47:9560/teacher/batchDelete',
+                                    url: '/api/school/teacher/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function (res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function (e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],

+ 20 - 15
frontend/pc-web/app/view/basic/student/StudentList.js

@@ -115,21 +115,26 @@ Ext.define('school.view.basic.student.StudentList', {
                             return;
                         }
 
-                        grid.setLoading(true);
-                        school.util.BaseUtil.request({
-                            // url: 'http://10.1.80.47:9560/student/batchDelete',
-                            url: '/api/school/student/batchDelete',
-                            method: 'POST',
-                            params: JSON.stringify({
-                                baseDTOs: data
-                            })
-                        }).then(function(res) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
-                            grid.store.loadPage(grid.store.currentPage);
-                        }).catch(function(e) {
-                            grid.setLoading(false);
-                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        school.util.BaseUtil.showConfirm('确认删除', '确定要删除这' + data.length + '条记录吗?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                grid.setLoading(true);
+                                school.util.BaseUtil.request({
+                                    // url: 'http://10.1.80.47:9560/student/batchDelete',
+                                    url: '/api/school/student/batchDelete',
+                                    method: 'POST',
+                                    params: JSON.stringify({
+                                        baseDTOs: data
+                                    })
+                                }).then(function(res) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                                    grid.store.loadPage(grid.store.currentPage);
+                                }).catch(function(e) {
+                                    grid.setLoading(false);
+                                    school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                                });
+                            }
                         });
                     }
                 }],