Commit 5556ee022b4a49cd1b8e46690cd8fe69c48a0239
1 parent
eda18c42
Exists in
master
机器人接口完成80%
Showing
16 changed files
with
303 additions
and
34 deletions
Show diff stats
springboot/morning-check/src/main/java/com/sincere/morningcheck/MorningCheckApplication.java
| @@ -4,6 +4,9 @@ import org.springframework.boot.SpringApplication; | @@ -4,6 +4,9 @@ import org.springframework.boot.SpringApplication; | ||
| 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 5 | import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration; | 5 | import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration; |
| 6 | import org.springframework.context.annotation.Bean; | 6 | import org.springframework.context.annotation.Bean; |
| 7 | +import org.springframework.web.cors.CorsConfiguration; | ||
| 8 | +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
| 9 | +import org.springframework.web.filter.CorsFilter; | ||
| 7 | import org.springframework.web.multipart.MultipartResolver; | 10 | import org.springframework.web.multipart.MultipartResolver; |
| 8 | import org.springframework.web.multipart.commons.CommonsMultipartResolver; | 11 | import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
| 9 | 12 | ||
| @@ -30,4 +33,22 @@ public class MorningCheckApplication { | @@ -30,4 +33,22 @@ public class MorningCheckApplication { | ||
| 30 | resolver.setMaxUploadSize(50 * 1024 * 1024);//上传文件大小 50 10*1024*1024 | 33 | resolver.setMaxUploadSize(50 * 1024 * 1024);//上传文件大小 50 10*1024*1024 |
| 31 | return resolver; | 34 | return resolver; |
| 32 | } | 35 | } |
| 36 | + | ||
| 37 | + @Bean | ||
| 38 | + public CorsFilter corsFilter() { | ||
| 39 | + final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
| 40 | + final CorsConfiguration config = new CorsConfiguration(); | ||
| 41 | + config.setAllowCredentials(true); | ||
| 42 | + config.addAllowedOrigin("*"); | ||
| 43 | + config.addAllowedHeader("*"); | ||
| 44 | + config.addAllowedMethod("OPTIONS"); | ||
| 45 | + config.addAllowedMethod("HEAD"); | ||
| 46 | + config.addAllowedMethod("GET"); | ||
| 47 | + config.addAllowedMethod("PUT"); | ||
| 48 | + config.addAllowedMethod("POST"); | ||
| 49 | + config.addAllowedMethod("DELETE"); | ||
| 50 | + config.addAllowedMethod("PATCH"); | ||
| 51 | + source.registerCorsConfiguration("/**", config); | ||
| 52 | + return new CorsFilter(source); | ||
| 53 | + } | ||
| 33 | } | 54 | } |
springboot/morning-check/src/main/java/com/sincere/morningcheck/controller/CheckReportController.java
| @@ -5,6 +5,7 @@ import com.sincere.morningcheck.model.ApiStudentCheckReport; | @@ -5,6 +5,7 @@ import com.sincere.morningcheck.model.ApiStudentCheckReport; | ||
| 5 | import com.sincere.morningcheck.service.StudentCheckReportService; | 5 | import com.sincere.morningcheck.service.StudentCheckReportService; |
| 6 | import io.swagger.annotations.Api; | 6 | import io.swagger.annotations.Api; |
| 7 | import io.swagger.annotations.ApiImplicitParam; | 7 | import io.swagger.annotations.ApiImplicitParam; |
| 8 | +import io.swagger.annotations.ApiImplicitParams; | ||
| 8 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
| 9 | 10 | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -30,5 +31,26 @@ public class CheckReportController { | @@ -30,5 +31,26 @@ public class CheckReportController { | ||
| 30 | return studentCheckReportService.getCheckReport(stuUserId); | 31 | return studentCheckReportService.getCheckReport(stuUserId); |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 34 | + @ApiOperation(value = "根据学校获取学生晨检报告") | ||
| 35 | + @ApiImplicitParams({ | ||
| 36 | + @ApiImplicitParam(name = "schoolId",value = "学校ID",required = true), | ||
| 37 | + @ApiImplicitParam(name = "checkTime",value = "检查报告的时间,格式为yyyy-MM-dd",required = true) | ||
| 38 | + }) | ||
| 39 | + @GetMapping("getCheckReportBySchoolId") | ||
| 40 | + public ServerResponse getCheckReportBySchoolId(@RequestParam Integer schoolId,@RequestParam String checkTime){ | ||
| 41 | + | ||
| 42 | + return studentCheckReportService.getCheckReportBySchool(schoolId,checkTime); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @ApiOperation(value = "根据年级获取学生异常晨检报告的比例") | ||
| 46 | + @ApiImplicitParams({ | ||
| 47 | + @ApiImplicitParam(name = "schoolId",value = "学校ID",required = true), | ||
| 48 | + @ApiImplicitParam(name = "gradeId",value = "年级标识",required = true) | ||
| 49 | + }) | ||
| 50 | + @GetMapping("getCheckExReportByGrade") | ||
| 51 | + public ServerResponse getCheckExReportByGrade(@RequestParam Integer schoolId,@RequestParam Integer gradeId){ | ||
| 52 | + | ||
| 53 | + return studentCheckReportService.getCheckExReportByGrade(schoolId,gradeId); | ||
| 54 | + } | ||
| 33 | 55 | ||
| 34 | } | 56 | } |
springboot/morning-check/src/main/java/com/sincere/morningcheck/controller/MorningCheckController.java
| @@ -366,7 +366,8 @@ public class MorningCheckController { | @@ -366,7 +366,8 @@ public class MorningCheckController { | ||
| 366 | studentCheckReport.setCardNo(card); | 366 | studentCheckReport.setCardNo(card); |
| 367 | studentCheckReport.setCheckResult(result); | 367 | studentCheckReport.setCheckResult(result); |
| 368 | studentCheckReport.setRobotResult(robotResult); | 368 | studentCheckReport.setRobotResult(robotResult); |
| 369 | - java.sql.Date checkDate = new java.sql.Date(new Date().getTime()); | 369 | + //java.sql.Date checkDate = new java.sql.Date(new Date().getTime()); |
| 370 | + Date checkDate = new Date(); | ||
| 370 | studentCheckReport.setCheckTime(checkDate); | 371 | studentCheckReport.setCheckTime(checkDate); |
| 371 | studentCheckReport.setInTime(checkDate); | 372 | studentCheckReport.setInTime(checkDate); |
| 372 | studentCheckReport.setTemperature(temperature); | 373 | studentCheckReport.setTemperature(temperature); |
springboot/morning-check/src/main/java/com/sincere/morningcheck/dao/StudentCheckReportDao.java
| 1 | package com.sincere.morningcheck.dao; | 1 | package com.sincere.morningcheck.dao; |
| 2 | 2 | ||
| 3 | +import com.sincere.morningcheck.model.ClassExReport; | ||
| 3 | import com.sincere.morningcheck.model.StudentCheckReport; | 4 | import com.sincere.morningcheck.model.StudentCheckReport; |
| 4 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
| 5 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
| 6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
| 7 | 8 | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 8 | @Mapper | 11 | @Mapper |
| 9 | @Repository | 12 | @Repository |
| 10 | public interface StudentCheckReportDao { | 13 | public interface StudentCheckReportDao { |
| 11 | 14 | ||
| 12 | int insert(StudentCheckReport studentCheckReport); | 15 | int insert(StudentCheckReport studentCheckReport); |
| 13 | 16 | ||
| 14 | - StudentCheckReport getCheckReport(@Param("studentId") Integer studentId); | 17 | + List<StudentCheckReport> getCheckReport(@Param("studentId") Integer studentId); |
| 18 | + | ||
| 19 | + int getCheckStuCountBySchoolId(@Param("schoolId")Integer schoolId,@Param("checkTime") String checkTime); | ||
| 20 | + | ||
| 21 | + List<StudentCheckReport> getCheckReportBySchoolId(@Param("schoolId")Integer schoolId,@Param("checkTime") String checkTime); | ||
| 22 | + | ||
| 23 | + List<ClassExReport> getCheckExReportByGrade(@Param("schoolId")Integer schoolId,@Param("gradeId") Integer gradeId); | ||
| 15 | } | 24 | } |
springboot/morning-check/src/main/java/com/sincere/morningcheck/dao/StudentDao.java
| 1 | package com.sincere.morningcheck.dao; | 1 | package com.sincere.morningcheck.dao; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.sincere.morningcheck.model.Grade; | ||
| 4 | import com.sincere.morningcheck.model.Student; | 5 | import com.sincere.morningcheck.model.Student; |
| 5 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 6 | import org.apache.ibatis.annotations.Param; | 7 | import org.apache.ibatis.annotations.Param; |
| @@ -19,6 +20,9 @@ public interface StudentDao { | @@ -19,6 +20,9 @@ public interface StudentDao { | ||
| 19 | 20 | ||
| 20 | Student getStudentByStuUserId(@Param("sUserId") String sUserId); | 21 | Student getStudentByStuUserId(@Param("sUserId") String sUserId); |
| 21 | 22 | ||
| 23 | + int getStuCountBySchoolId(@Param("schoolId") Integer schoolId); | ||
| 24 | + | ||
| 25 | + List<Grade> getGradeBySchoolId(@Param("schoolId") Integer schoolId); | ||
| 22 | /** | 26 | /** |
| 23 | * 传入的参数和返回的结果都在map集合参数params中 | 27 | * 传入的参数和返回的结果都在map集合参数params中 |
| 24 | * @param params | 28 | * @param params |
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/ApiStudentCheckReport.java
| @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; | ||
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| 7 | -import java.sql.Date; | 7 | + |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 接口使用类 检查报告 | 10 | * 接口使用类 检查报告 |
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/ClassExReport.java
0 → 100644
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/Grade.java
0 → 100644
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/StudentCheckReport.java
| @@ -2,7 +2,7 @@ package com.sincere.morningcheck.model; | @@ -2,7 +2,7 @@ package com.sincere.morningcheck.model; | ||
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | -import java.sql.Date; | 5 | +import java.util.Date; |
| 6 | 6 | ||
| 7 | @Data | 7 | @Data |
| 8 | public class StudentCheckReport { | 8 | public class StudentCheckReport { |
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/StudentCheckReportService.java
| @@ -10,4 +10,8 @@ public interface StudentCheckReportService { | @@ -10,4 +10,8 @@ public interface StudentCheckReportService { | ||
| 10 | int insert(StudentCheckReport studentCheckReport); | 10 | int insert(StudentCheckReport studentCheckReport); |
| 11 | 11 | ||
| 12 | ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId); | 12 | ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId); |
| 13 | + | ||
| 14 | + ServerResponse getCheckReportBySchool(Integer schoolId,String checkTime); | ||
| 15 | + | ||
| 16 | + ServerResponse getCheckExReportByGrade(Integer schoolId,Integer gradeId); | ||
| 13 | } | 17 | } |
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/impl/StudentCheckReportServiceImpl.java
| @@ -3,15 +3,14 @@ package com.sincere.morningcheck.service.impl; | @@ -3,15 +3,14 @@ package com.sincere.morningcheck.service.impl; | ||
| 3 | import com.sincere.morningcheck.common.ServerResponse; | 3 | import com.sincere.morningcheck.common.ServerResponse; |
| 4 | import com.sincere.morningcheck.dao.StudentCheckReportDao; | 4 | import com.sincere.morningcheck.dao.StudentCheckReportDao; |
| 5 | import com.sincere.morningcheck.dao.StudentDao; | 5 | import com.sincere.morningcheck.dao.StudentDao; |
| 6 | -import com.sincere.morningcheck.model.ApiStudentCheckReport; | ||
| 7 | -import com.sincere.morningcheck.model.CheckResult; | ||
| 8 | -import com.sincere.morningcheck.model.Student; | ||
| 9 | -import com.sincere.morningcheck.model.StudentCheckReport; | 6 | +import com.sincere.morningcheck.model.*; |
| 10 | import com.sincere.morningcheck.service.StudentCheckReportService; | 7 | import com.sincere.morningcheck.service.StudentCheckReportService; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 13 | 10 | ||
| 14 | import java.text.SimpleDateFormat; | 11 | import java.text.SimpleDateFormat; |
| 12 | +import java.util.*; | ||
| 13 | +import java.util.stream.Collectors; | ||
| 15 | 14 | ||
| 16 | @Service | 15 | @Service |
| 17 | public class StudentCheckReportServiceImpl implements StudentCheckReportService { | 16 | public class StudentCheckReportServiceImpl implements StudentCheckReportService { |
| @@ -30,52 +29,202 @@ public class StudentCheckReportServiceImpl implements StudentCheckReportService | @@ -30,52 +29,202 @@ public class StudentCheckReportServiceImpl implements StudentCheckReportService | ||
| 30 | @Override | 29 | @Override |
| 31 | public ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId) { | 30 | public ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId) { |
| 32 | 31 | ||
| 33 | - StudentCheckReport studentCheckReport; | 32 | + List<StudentCheckReport> studentCheckReports = new ArrayList<>(); |
| 33 | + StudentCheckReport studentCheckReport= new StudentCheckReport(); | ||
| 34 | 34 | ||
| 35 | Student student = studentDao.getStudentByStuUserId(stuUserId); | 35 | Student student = studentDao.getStudentByStuUserId(stuUserId); |
| 36 | - studentCheckReport = studentCheckReportDao.getCheckReport(student.getStuId()); | 36 | + studentCheckReports = studentCheckReportDao.getCheckReport(student.getStuId()); |
| 37 | Boolean isMorningCheck; | 37 | Boolean isMorningCheck; |
| 38 | - if(studentCheckReport == null){ | ||
| 39 | - isMorningCheck = false; | 38 | + if(studentCheckReports!=null&&studentCheckReports.size()>0){ |
| 39 | + | ||
| 40 | + studentCheckReport = studentCheckReports.get(0); | ||
| 41 | + isMorningCheck = true; | ||
| 42 | + | ||
| 40 | }else{ | 43 | }else{ |
| 41 | - isMorningCheck = true; | 44 | + isMorningCheck = false; |
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | ApiStudentCheckReport apiStudentCheckReport = getApiStudentReport(studentCheckReport,isMorningCheck); | 47 | ApiStudentCheckReport apiStudentCheckReport = getApiStudentReport(studentCheckReport,isMorningCheck); |
| 45 | return ServerResponse.createBySuccess(apiStudentCheckReport); | 48 | return ServerResponse.createBySuccess(apiStudentCheckReport); |
| 46 | } | 49 | } |
| 47 | 50 | ||
| 51 | + @Override | ||
| 52 | + public ServerResponse getCheckReportBySchool(Integer schoolId, String checkTime) { | ||
| 53 | + | ||
| 54 | + Map<String,Object> map = new HashMap<>(); | ||
| 55 | + | ||
| 56 | + int studentAllCount = getStuCountBySchoolId(schoolId); | ||
| 57 | + int stuCheckStuCount = studentCheckReportDao.getCheckStuCountBySchoolId(schoolId,checkTime); | ||
| 58 | + map.put("studentAllCount",studentAllCount); | ||
| 59 | + map.put("stuCheckStuCount",stuCheckStuCount); | ||
| 60 | + | ||
| 61 | + List<StudentCheckReport> studentCheckReports = studentCheckReportDao.getCheckReportBySchoolId(schoolId,checkTime); | ||
| 62 | + | ||
| 63 | + List<StudentCheckReport> studentExCheckReports = studentCheckReports.stream().filter(n->n.getCheckResult().contains("N")).collect(Collectors.toList()); | ||
| 64 | + //检查报告总人数 | ||
| 65 | + int checkAllCount = studentCheckReports.size(); | ||
| 66 | + //异常人数 | ||
| 67 | + long exCheckCount = studentExCheckReports.size(); | ||
| 68 | + //检查报告中正常的人数 | ||
| 69 | + long checkCount = checkAllCount - exCheckCount; | ||
| 70 | + | ||
| 71 | + map.put("checkCount",checkCount); | ||
| 72 | + map.put("exCheckCount",exCheckCount); | ||
| 73 | + | ||
| 74 | + List<Grade> grades= studentDao.getGradeBySchoolId(schoolId); | ||
| 75 | + | ||
| 76 | + map.put("grades",grades); | ||
| 77 | + | ||
| 78 | + List<String> checkTypeList = new ArrayList<>(); | ||
| 79 | + List<Long> checkTypeCount = new ArrayList<>(); | ||
| 80 | +// String[] checkTypeArrays ={"handNoEx","mouthNoEx","noRedEye","noFever","noCrotchBig","noPoorSpirit","noPharyngitis","noTrauma","noCough","noNail","noToothDecay","other"}; | ||
| 81 | + | ||
| 82 | + List<CheckResult> checkResults = new ArrayList<>(); | ||
| 83 | + for(StudentCheckReport checkReport:studentExCheckReports){ | ||
| 84 | + CheckResult checkResult = new CheckResult(); | ||
| 85 | + char[] chs = checkReport.getCheckResult().toCharArray(); | ||
| 86 | + checkResult = getCheckResult(chs); | ||
| 87 | + checkResults.add(checkResult); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + long count1 = checkResults.stream().filter(n->!n.getHandNoEx()).count(); | ||
| 91 | + if(count1>0){ | ||
| 92 | + checkTypeList.add("handNoEx"); | ||
| 93 | + checkTypeCount.add(count1); | ||
| 94 | + } | ||
| 95 | + long count2= checkResults.stream().filter(n->!n.getMouthNoEx()).count(); | ||
| 96 | + if(count2>0){ | ||
| 97 | + checkTypeList.add("mouthNoEx"); | ||
| 98 | + checkTypeCount.add(count2); | ||
| 99 | + } | ||
| 100 | + long count3= checkResults.stream().filter(n->!n.getNoRedEye()).count(); | ||
| 101 | + if(count3>0){ | ||
| 102 | + checkTypeList.add("noRedEye"); | ||
| 103 | + checkTypeCount.add(count3); | ||
| 104 | + } | ||
| 105 | + long count4= checkResults.stream().filter(n->!n.getNoFever()).count(); | ||
| 106 | + if(count4>0){ | ||
| 107 | + checkTypeList.add("noFever"); | ||
| 108 | + checkTypeCount.add(count4); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + long count5= checkResults.stream().filter(n->!n.getNoCrotchBig()).count(); | ||
| 112 | + if(count5>0){ | ||
| 113 | + checkTypeList.add("noCrotchBig"); | ||
| 114 | + checkTypeCount.add(count5); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + long count6= checkResults.stream().filter(n->!n.getNoPoorSpirit()).count(); | ||
| 118 | + if(count6>0){ | ||
| 119 | + checkTypeList.add("noPoorSpirit"); | ||
| 120 | + checkTypeCount.add(count6); | ||
| 121 | + } | ||
| 122 | + long count7= checkResults.stream().filter(n->!n.getNoPharyngitis()).count(); | ||
| 123 | + if(count7>0){ | ||
| 124 | + checkTypeList.add("noPharyngitis"); | ||
| 125 | + checkTypeCount.add(count7); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + long count8= checkResults.stream().filter(n->!n.getNoTrauma()).count(); | ||
| 129 | + if(count8>0){ | ||
| 130 | + checkTypeList.add("noTrauma"); | ||
| 131 | + checkTypeCount.add(count8); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + long count9= checkResults.stream().filter(n->!n.getNoCough()).count(); | ||
| 135 | + if(count9>0){ | ||
| 136 | + checkTypeList.add("noCough"); | ||
| 137 | + checkTypeCount.add(count9); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + long count10= checkResults.stream().filter(n->!n.getNoNail()).count(); | ||
| 141 | + if(count10>0){ | ||
| 142 | + checkTypeList.add("noNail"); | ||
| 143 | + checkTypeCount.add(count10); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + long count11= checkResults.stream().filter(n->!n.getNoToothDecay()).count(); | ||
| 147 | + if(count11>0){ | ||
| 148 | + checkTypeList.add("noToothDecay"); | ||
| 149 | + checkTypeCount.add(count11); | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + long count12= checkResults.stream().filter(n->!n.getOther()).count(); | ||
| 153 | + if(count12>0){ | ||
| 154 | + checkTypeList.add("other"); | ||
| 155 | + checkTypeCount.add(count12); | ||
| 156 | + } | ||
| 157 | + map.put("checkTypeList",checkTypeList); | ||
| 158 | + map.put("checkTypeCount",checkTypeCount); | ||
| 159 | + return ServerResponse.createBySuccess(map); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + @Override | ||
| 163 | + public ServerResponse getCheckExReportByGrade(Integer schoolId, Integer gradeId) { | ||
| 164 | + | ||
| 165 | + List<ClassExReport> classExReports = studentCheckReportDao.getCheckExReportByGrade(schoolId,gradeId); | ||
| 166 | + float count = 0; | ||
| 167 | + for(ClassExReport classExReport : classExReports){ | ||
| 168 | + count = count + classExReport.getCount(); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + if(count>0){ | ||
| 172 | + for(ClassExReport classExReport : classExReports){ | ||
| 173 | + classExReport.setExRate((classExReport.getCount()/count)*100); | ||
| 174 | + } | ||
| 175 | + }else { | ||
| 176 | + return ServerResponse.createByErrorCodeMessage(10,"暂无数据"); | ||
| 177 | + } | ||
| 178 | + return ServerResponse.createBySuccess(classExReports); | ||
| 179 | + } | ||
| 180 | + | ||
| 48 | private ApiStudentCheckReport getApiStudentReport(StudentCheckReport studentCheckReport,Boolean isMorningCheck){ | 181 | private ApiStudentCheckReport getApiStudentReport(StudentCheckReport studentCheckReport,Boolean isMorningCheck){ |
| 49 | 182 | ||
| 50 | ApiStudentCheckReport apiStudentCheckReport = new ApiStudentCheckReport(); | 183 | ApiStudentCheckReport apiStudentCheckReport = new ApiStudentCheckReport(); |
| 51 | if(isMorningCheck) { | 184 | if(isMorningCheck) { |
| 52 | apiStudentCheckReport.setCardNo(studentCheckReport.getCardNo()); | 185 | apiStudentCheckReport.setCardNo(studentCheckReport.getCardNo()); |
| 53 | - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 186 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); |
| 187 | + System.out.println(studentCheckReport.getCheckTime()); | ||
| 54 | apiStudentCheckReport.setCheckTime(simpleDateFormat.format(studentCheckReport.getCheckTime())); | 188 | apiStudentCheckReport.setCheckTime(simpleDateFormat.format(studentCheckReport.getCheckTime())); |
| 55 | apiStudentCheckReport.setStudent_id(studentCheckReport.getStudent_id()); | 189 | apiStudentCheckReport.setStudent_id(studentCheckReport.getStudent_id()); |
| 56 | apiStudentCheckReport.setTemperature(studentCheckReport.getTemperature()); | 190 | apiStudentCheckReport.setTemperature(studentCheckReport.getTemperature()); |
| 57 | char[] chs = studentCheckReport.getCheckResult().toCharArray(); | 191 | char[] chs = studentCheckReport.getCheckResult().toCharArray(); |
| 58 | - CheckResult checkResult = new CheckResult(); | ||
| 59 | - | ||
| 60 | - //前12位 | ||
| 61 | - checkResult.setHandNoEx(isJudge(Character.toString(chs[0]))); | ||
| 62 | - checkResult.setMouthNoEx(isJudge(Character.toString(chs[1]))); | ||
| 63 | - checkResult.setNoRedEye(isJudge(Character.toString(chs[2]))); | ||
| 64 | - checkResult.setNoFever(isJudge(Character.toString(chs[3]))); | ||
| 65 | - checkResult.setNoCrotchBig(isJudge(Character.toString(chs[4]))); | ||
| 66 | - checkResult.setNoPoorSpirit(isJudge(Character.toString(chs[5]))); | ||
| 67 | - checkResult.setNoPharyngitis(isJudge(Character.toString(chs[6]))); | ||
| 68 | - checkResult.setNoTrauma(isJudge(Character.toString(chs[7]))); | ||
| 69 | - checkResult.setNoCough(isJudge(Character.toString(chs[8]))); | ||
| 70 | - checkResult.setNoNail(isJudge(Character.toString(chs[9]))); | ||
| 71 | - checkResult.setNoToothDecay(isJudge(Character.toString(chs[10]))); | ||
| 72 | - checkResult.setOther(isJudge(Character.toString(chs[11]))); | 192 | + CheckResult checkResult = getCheckResult(chs); |
| 73 | apiStudentCheckReport.setCheckResultObj(checkResult); | 193 | apiStudentCheckReport.setCheckResultObj(checkResult); |
| 74 | } | 194 | } |
| 75 | apiStudentCheckReport.setIsMorningCheck(isMorningCheck); | 195 | apiStudentCheckReport.setIsMorningCheck(isMorningCheck); |
| 76 | return apiStudentCheckReport; | 196 | return apiStudentCheckReport; |
| 77 | } | 197 | } |
| 78 | 198 | ||
| 199 | + private int getStuCountBySchoolId(Integer schoolId){ | ||
| 200 | + | ||
| 201 | + return studentDao.getStuCountBySchoolId(schoolId); | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + /** | ||
| 205 | + * 解析字符串 | ||
| 206 | + * @param chs | ||
| 207 | + * @return | ||
| 208 | + */ | ||
| 209 | + private CheckResult getCheckResult(char[] chs){ | ||
| 210 | + CheckResult checkResult = new CheckResult(); | ||
| 211 | + | ||
| 212 | + //前12位 | ||
| 213 | + checkResult.setHandNoEx(isJudge(Character.toString(chs[0]))); | ||
| 214 | + checkResult.setMouthNoEx(isJudge(Character.toString(chs[1]))); | ||
| 215 | + checkResult.setNoRedEye(isJudge(Character.toString(chs[2]))); | ||
| 216 | + checkResult.setNoFever(isJudge(Character.toString(chs[3]))); | ||
| 217 | + checkResult.setNoCrotchBig(isJudge(Character.toString(chs[4]))); | ||
| 218 | + checkResult.setNoPoorSpirit(isJudge(Character.toString(chs[5]))); | ||
| 219 | + checkResult.setNoPharyngitis(isJudge(Character.toString(chs[6]))); | ||
| 220 | + checkResult.setNoTrauma(isJudge(Character.toString(chs[7]))); | ||
| 221 | + checkResult.setNoCough(isJudge(Character.toString(chs[8]))); | ||
| 222 | + checkResult.setNoNail(isJudge(Character.toString(chs[9]))); | ||
| 223 | + checkResult.setNoToothDecay(isJudge(Character.toString(chs[10]))); | ||
| 224 | + checkResult.setOther(isJudge(Character.toString(chs[11]))); | ||
| 225 | + | ||
| 226 | + return checkResult; | ||
| 227 | + } | ||
| 79 | private Boolean isJudge(String yesOrNo){ | 228 | private Boolean isJudge(String yesOrNo){ |
| 80 | 229 | ||
| 81 | if(yesOrNo.equals("Y")){ | 230 | if(yesOrNo.equals("Y")){ |
| @@ -83,4 +232,5 @@ public class StudentCheckReportServiceImpl implements StudentCheckReportService | @@ -83,4 +232,5 @@ public class StudentCheckReportServiceImpl implements StudentCheckReportService | ||
| 83 | } | 232 | } |
| 84 | return false; | 233 | return false; |
| 85 | } | 234 | } |
| 235 | + | ||
| 86 | } | 236 | } |
springboot/morning-check/src/main/resources/file-message.properties
| 1 | #文件压缩大小(大于5兆压缩) | 1 | #文件压缩大小(大于5兆压缩) |
| 2 | message.fileSize=5242880 | 2 | message.fileSize=5242880 |
| 3 | #图片保存路径 | 3 | #图片保存路径 |
| 4 | -message.upPath=E:/MorningRobot/UploadData/images/ | 4 | +message.upPath=C:/MorningRobot/UploadData/images/ |
| 5 | #压缩比例 | 5 | #压缩比例 |
| 6 | message.scaleRatio=0.90f | 6 | message.scaleRatio=0.90f |
| 7 | #图片类型 | 7 | #图片类型 |
springboot/morning-check/src/main/resources/logback.xml
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <property name="PROJECT_NAME" value="authjwt" /> | 4 | <property name="PROJECT_NAME" value="authjwt" /> |
| 5 | 5 | ||
| 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径,不要写E:\logs,否则识别不出来,\是转义字符,需要\\才能正确识别--> | 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径,不要写E:\logs,否则识别不出来,\是转义字符,需要\\才能正确识别--> |
| 7 | - <property name="LOG_HOME" value="E:\logs" /> | 7 | + <property name="LOG_HOME" value="C:\logs" /> |
| 8 | 8 | ||
| 9 | <!-- 控制台输出 --> | 9 | <!-- 控制台输出 --> |
| 10 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | 10 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
springboot/morning-check/src/main/resources/mapper/StudentCheckReport.xml
| @@ -12,8 +12,8 @@ | @@ -12,8 +12,8 @@ | ||
| 12 | <result column="checkResult" property="checkResult" jdbcType="VARCHAR" javaType="java.lang.String"/> | 12 | <result column="checkResult" property="checkResult" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| 13 | <result column="robotResult" property="robotResult" jdbcType="VARCHAR" javaType="java.lang.String"/> | 13 | <result column="robotResult" property="robotResult" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| 14 | <result column="String" property="String" jdbcType="VARCHAR" javaType="java.lang.String"/> | 14 | <result column="String" property="String" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| 15 | - <result column="intime" property="inTime" jdbcType="DATE" javaType="java.sql.Date"/> | ||
| 16 | - <result column="checkTime" property="checkTime" jdbcType="DATE" javaType="java.sql.Date"/> | 15 | + <result column="intime" property="inTime" jdbcType="DATE" javaType="java.util.Date"/> |
| 16 | + <result column="checkTime" property="checkTime" jdbcType="TIMESTAMP" javaType="java.util.Date"/> | ||
| 17 | <result column="temperature" property="temperature" jdbcType="VARCHAR" javaType="java.lang.String"/> | 17 | <result column="temperature" property="temperature" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| 18 | <result column="handImgId" property="handImgId" jdbcType="VARCHAR" javaType="java.lang.String"/> | 18 | <result column="handImgId" property="handImgId" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| 19 | <result column="mouthImgId" property="mouthImgId" jdbcType="VARCHAR" javaType="java.lang.String"/> | 19 | <result column="mouthImgId" property="mouthImgId" jdbcType="VARCHAR" javaType="java.lang.String"/> |
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | 26 | ||
| 27 | <insert id="insert" parameterType="com.sincere.morningcheck.model.StudentCheckReport" > | 27 | <insert id="insert" parameterType="com.sincere.morningcheck.model.StudentCheckReport" > |
| 28 | insert xiaoan.dbo.SZ_StudentCheckReport(student_id,cardNo,checkResult,robotResult,intime,checkTime,access,temperature,handImgId,mouthImgId,eyeImgId) | 28 | insert xiaoan.dbo.SZ_StudentCheckReport(student_id,cardNo,checkResult,robotResult,intime,checkTime,access,temperature,handImgId,mouthImgId,eyeImgId) |
| 29 | -values(#{student_id,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{robotResult,jdbcType=VARCHAR},#{inTime,jdbcType=DATE},#{checkTime,jdbcType=DATE},#{access,jdbcType=VARCHAR},#{temperature,jdbcType=VARCHAR},#{handImgId,jdbcType=VARCHAR},#{mouthImgId,jdbcType=VARCHAR},#{eyeImgId,jdbcType=VARCHAR}) | 29 | +values(#{student_id,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{robotResult,jdbcType=VARCHAR},#{inTime,jdbcType=TIMESTAMP},#{checkTime,jdbcType=TIMESTAMP},#{access,jdbcType=VARCHAR},#{temperature,jdbcType=VARCHAR},#{handImgId,jdbcType=VARCHAR},#{mouthImgId,jdbcType=VARCHAR},#{eyeImgId,jdbcType=VARCHAR}) |
| 30 | </insert> | 30 | </insert> |
| 31 | 31 | ||
| 32 | <select id="getCheckReport" resultMap="BaseResultMap"> | 32 | <select id="getCheckReport" resultMap="BaseResultMap"> |
| @@ -34,4 +34,20 @@ values(#{student_id,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{checkResult | @@ -34,4 +34,20 @@ values(#{student_id,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{checkResult | ||
| 34 | where student_id = #{studentId} and CONVERT(varchar(10),checkTime,23) = CONVERT(varchar(10),getdate(),23) | 34 | where student_id = #{studentId} and CONVERT(varchar(10),checkTime,23) = CONVERT(varchar(10),getdate(),23) |
| 35 | </select> | 35 | </select> |
| 36 | 36 | ||
| 37 | + <select id="getCheckReportBySchoolId" resultMap="BaseResultMap"> | ||
| 38 | + select sc.student_id,cardNo,checkTime,checkResult,robotResult,intime,access,temperature,handImgId,mouthImgId,eyeImgId from SZ_V_School_Student vs join xiaoan.[dbo].[SZ_StudentCheckReport] sc | ||
| 39 | + on vs.student_id=sc.student_id where school_id=#{schoolId} | ||
| 40 | + and CONVERT(varchar,checkTime,23)=#{checkTime} | ||
| 41 | + </select> | ||
| 42 | + | ||
| 43 | + <select id="getCheckStuCountBySchoolId" resultType="java.lang.Integer"> | ||
| 44 | + select count(0) from SZ_V_School_Student vs join xiaoan.[dbo].[SZ_StudentCheckReport] sc on vs.student_id=sc.student_id where school_id=#{schoolId} and CONVERT(varchar,checkTime,23)=#{checkTime} | ||
| 45 | + </select> | ||
| 46 | + | ||
| 47 | + <select id="getCheckExReportByGrade" resultType="com.sincere.morningcheck.model.ClassExReport"> | ||
| 48 | + select a.class_id,className=a.class_name,count = count(a.class_id) from SZ_V_School_Student a join SZ_Class b on a.class_id=b.class_id | ||
| 49 | +left join xiaoan.[dbo].[SZ_StudentCheckReport] c on a.student_id = c.student_id | ||
| 50 | +where a.school_id=#{schoolId} and state=1 and grade=#{gradeId} and CHARINDEX('N',checkResult)>0 | ||
| 51 | +group by a.class_id,a.class_name | ||
| 52 | + </select> | ||
| 37 | </mapper> | 53 | </mapper> |
| 38 | \ No newline at end of file | 54 | \ No newline at end of file |
springboot/morning-check/src/main/resources/mapper/studentmapper.xml
| @@ -38,6 +38,13 @@ | @@ -38,6 +38,13 @@ | ||
| 38 | where user_id=#{sUserId} | 38 | where user_id=#{sUserId} |
| 39 | </select> | 39 | </select> |
| 40 | 40 | ||
| 41 | + <select id="getStuCountBySchoolId" resultType="java.lang.Integer"> | ||
| 42 | + select count(0) from SZ_V_School_Student where school_id=#{schoolId} | ||
| 43 | + </select> | ||
| 44 | + | ||
| 45 | + <select id="getGradeBySchoolId" resultType="com.sincere.morningcheck.model.Grade"> | ||
| 46 | + select id,grade,ShortName from SZ_Grade where Status=1 and SchoolId = #{schoolId} | ||
| 47 | + </select> | ||
| 41 | <select id="swipeCard" statementType="CALLABLE" resultType="java.util.Map"> | 48 | <select id="swipeCard" statementType="CALLABLE" resultType="java.util.Map"> |
| 42 | {call xiaoan.dbo.AttendanceService( | 49 | {call xiaoan.dbo.AttendanceService( |
| 43 | #{att_id, mode=IN}, | 50 | #{att_id, mode=IN}, |
springboot/src/main/java/com/sincre/springboot/controller/TuYaYunController.java
| @@ -475,6 +475,13 @@ public class TuYaYunController { | @@ -475,6 +475,13 @@ public class TuYaYunController { | ||
| 475 | String json = JSON.toJSONString(tuYaAirCondition); | 475 | String json = JSON.toJSONString(tuYaAirCondition); |
| 476 | String result = ApiHelper.doPost(TuYaCloudService.TuYaOpenUrl + apiUrl,map,json); | 476 | String result = ApiHelper.doPost(TuYaCloudService.TuYaOpenUrl + apiUrl,map,json); |
| 477 | TuYaResResult tuYaResResult = JSON.parseObject(result,TuYaResResult.class); | 477 | TuYaResResult tuYaResResult = JSON.parseObject(result,TuYaResResult.class); |
| 478 | + | ||
| 479 | + if(tuYaResResult.getResult()!=null&&tuYaResResult.getResult().toString().equals("false")){ | ||
| 480 | + | ||
| 481 | + tuYaResResult.setResult("控制失败"); | ||
| 482 | + }else{ | ||
| 483 | + tuYaResResult.setResult("控制成功"); | ||
| 484 | + } | ||
| 478 | return ResultUtils.getInstance().returnResultTuYa(tuYaResResult); | 485 | return ResultUtils.getInstance().returnResultTuYa(tuYaResResult); |
| 479 | } | 486 | } |
| 480 | 487 |