Commit eda18c424b84b43669891b97649ef0475996ec52

Authored by baishou_zjx
1 parent f06e2b0e
Exists in master

晨检机器人移动端接口初步完成

Showing 23 changed files with 460 additions and 72 deletions   Show diff stats
springboot/morning-check/src/main/java/com/sincere/morningcheck/MorningCheckApplication.java
1 package com.sincere.morningcheck; 1 package com.sincere.morningcheck;
2 2
3 -import org.mybatis.spring.annotation.MapperScan;  
4 import org.springframework.boot.SpringApplication; 3 import org.springframework.boot.SpringApplication;
5 -import org.springframework.boot.autoconfigure.EnableAutoConfiguration;  
6 import org.springframework.boot.autoconfigure.SpringBootApplication; 4 import org.springframework.boot.autoconfigure.SpringBootApplication;
7 import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration; 5 import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
8 import org.springframework.context.annotation.Bean; 6 import org.springframework.context.annotation.Bean;
springboot/morning-check/src/main/java/com/sincere/morningcheck/common/MD5.java
@@ -30,6 +30,7 @@ public class MD5 { @@ -30,6 +30,7 @@ public class MD5 {
30 public static boolean verify(String text, String key, String md5) throws Exception { 30 public static boolean verify(String text, String key, String md5) throws Exception {
31 //根据传入的密钥进行验证 31 //根据传入的密钥进行验证
32 String md5Text = md5(text, key); 32 String md5Text = md5(text, key);
  33 + System.out.println("签名:"+md5Text);
33 if(md5Text.equalsIgnoreCase(md5)) 34 if(md5Text.equalsIgnoreCase(md5))
34 { 35 {
35 return true; 36 return true;
springboot/morning-check/src/main/java/com/sincere/morningcheck/config/CustomConfiguration.java 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +package com.sincere.morningcheck.config;
  2 +
  3 +
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.context.annotation.Configuration;
  6 +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  7 +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  8 +
  9 +@Configuration
  10 +public class CustomConfiguration implements WebMvcConfigurer {
  11 + @Autowired
  12 + private MessageProperties config; //用来获取file-message.properties配置文件中的信息
  13 + public void addResourceHandlers(ResourceHandlerRegistry registry) {
  14 + //上传的图片在D盘下的E:/MorningRobot/UploadData/images/目录下,访问路径如:http://localhost:8081/images/1.jpg
  15 + //其中images表示访问的前缀。"file:E:/MorningRobot/UploadData/images/"是文件真实的存储路径
  16 + registry.addResourceHandler("/images/**").addResourceLocations("file:"+config.getUpPath());
  17 + }
  18 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/config/Swagger2.java
@@ -28,7 +28,7 @@ public class Swagger2 { @@ -28,7 +28,7 @@ public class Swagger2 {
28 private ApiInfo apiInfo() { 28 private ApiInfo apiInfo() {
29 return new ApiInfoBuilder() 29 return new ApiInfoBuilder()
30 .title("晨检机使用的WebApi说明文档") 30 .title("晨检机使用的WebApi说明文档")
31 - .contact(new Contact("Ziv","localhost:8080/swagger-ui.html","")) 31 + .contact(new Contact("Ziv","localhost:8999/swagger-ui.html",""))
32 .description("") 32 .description("")
33 .termsOfServiceUrl("") 33 .termsOfServiceUrl("")
34 .version("2.0") 34 .version("2.0")
springboot/morning-check/src/main/java/com/sincere/morningcheck/controller/CheckReportController.java 0 → 100644
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +package com.sincere.morningcheck.controller;
  2 +
  3 +import com.sincere.morningcheck.common.ServerResponse;
  4 +import com.sincere.morningcheck.model.ApiStudentCheckReport;
  5 +import com.sincere.morningcheck.service.StudentCheckReportService;
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiImplicitParam;
  8 +import io.swagger.annotations.ApiOperation;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.GetMapping;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +
  17 +@RestController
  18 +@RequestMapping("check_report")
  19 +@Api(value = "CheckReportController",tags = "晨检机检查报告接口")
  20 +public class CheckReportController {
  21 +
  22 +
  23 + @Autowired
  24 + StudentCheckReportService studentCheckReportService;
  25 + @ApiOperation(value = "根据学生的用户ID获取学生晨检报告")
  26 + @ApiImplicitParam(name="stuUserId",value = "学生用户ID",required = true)
  27 + @GetMapping("getCheckReport")
  28 + public ServerResponse<ApiStudentCheckReport> getCheckReport(@RequestParam String stuUserId){
  29 +
  30 + return studentCheckReportService.getCheckReport(stuUserId);
  31 + }
  32 +
  33 +
  34 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/controller/MorningCheckController.java
@@ -5,8 +5,10 @@ import com.sincere.morningcheck.common.MD5; @@ -5,8 +5,10 @@ import com.sincere.morningcheck.common.MD5;
5 import com.sincere.morningcheck.common.ServerResponse; 5 import com.sincere.morningcheck.common.ServerResponse;
6 import com.sincere.morningcheck.model.School; 6 import com.sincere.morningcheck.model.School;
7 import com.sincere.morningcheck.model.Student; 7 import com.sincere.morningcheck.model.Student;
  8 +import com.sincere.morningcheck.model.StudentCheckReport;
8 import com.sincere.morningcheck.model.User; 9 import com.sincere.morningcheck.model.User;
9 import com.sincere.morningcheck.service.FileUpAndDownService; 10 import com.sincere.morningcheck.service.FileUpAndDownService;
  11 +import com.sincere.morningcheck.service.StudentCheckReportService;
10 import com.sincere.morningcheck.service.StudentService; 12 import com.sincere.morningcheck.service.StudentService;
11 import com.sincere.morningcheck.service.UserServer; 13 import com.sincere.morningcheck.service.UserServer;
12 import com.sincere.morningcheck.service.impl.FileUpAndDownServiceImpl; 14 import com.sincere.morningcheck.service.impl.FileUpAndDownServiceImpl;
@@ -22,6 +24,9 @@ import org.springframework.beans.factory.annotation.Value; @@ -22,6 +24,9 @@ import org.springframework.beans.factory.annotation.Value;
22 import org.springframework.web.bind.annotation.*; 24 import org.springframework.web.bind.annotation.*;
23 import org.springframework.web.multipart.MultipartFile; 25 import org.springframework.web.multipart.MultipartFile;
24 26
  27 +import javax.servlet.http.HttpServletRequest;
  28 +import javax.servlet.http.HttpServletResponse;
  29 +import javax.servlet.http.HttpSession;
25 import java.text.ParseException; 30 import java.text.ParseException;
26 import java.text.SimpleDateFormat; 31 import java.text.SimpleDateFormat;
27 import java.util.Calendar; 32 import java.util.Calendar;
@@ -39,7 +44,6 @@ public class MorningCheckController { @@ -39,7 +44,6 @@ public class MorningCheckController {
39 @Value("${salt}") 44 @Value("${salt}")
40 private String salt; 45 private String salt;
41 46
42 - EhcacheUtil ehcacheUtil = new EhcacheUtil();  
43 @Autowired 47 @Autowired
44 UserServer userServer; 48 UserServer userServer;
45 49
@@ -49,6 +53,9 @@ public class MorningCheckController { @@ -49,6 +53,9 @@ public class MorningCheckController {
49 @Autowired 53 @Autowired
50 FileUpAndDownService fileUpAndDownService; 54 FileUpAndDownService fileUpAndDownService;
51 55
  56 + @Autowired
  57 + StudentCheckReportService studentCheckReportService;
  58 +
52 @ApiOperation("设备请求登陆接口") 59 @ApiOperation("设备请求登陆接口")
53 @ApiImplicitParams ({ 60 @ApiImplicitParams ({
54 @ApiImplicitParam(name = "deviceNo", value = "设备号", dataType = "String",required = true,paramType = "query"), 61 @ApiImplicitParam(name = "deviceNo", value = "设备号", dataType = "String",required = true,paramType = "query"),
@@ -56,9 +63,8 @@ public class MorningCheckController { @@ -56,9 +63,8 @@ public class MorningCheckController {
56 @ApiImplicitParam(name = "authSign", value = "签名", dataType = "String",required = true,paramType = "query"), 63 @ApiImplicitParam(name = "authSign", value = "签名", dataType = "String",required = true,paramType = "query"),
57 }) 64 })
58 @PostMapping("login") 65 @PostMapping("login")
59 - public ServerResponse login(@RequestParam String deviceNo, @RequestParam String password,@RequestParam String authSign){ 66 + public ServerResponse login(HttpServletRequest request,@RequestParam String deviceNo, @RequestParam String password,@RequestParam String authSign){
60 67
61 -// System.out.println("传入的参数:设备号"+deviceNo+",密码:"+password+",签名"+authSign);  
62 ServerResponse serverResponse = null; 68 ServerResponse serverResponse = null;
63 69
64 Map map = new HashMap(); 70 Map map = new HashMap();
@@ -72,14 +78,15 @@ public class MorningCheckController { @@ -72,14 +78,15 @@ public class MorningCheckController {
72 System.out.println(signUrl); 78 System.out.println(signUrl);
73 // String md5 = MD5.md5(signUrl, salt); 79 // String md5 = MD5.md5(signUrl, salt);
74 boolean verify = MD5.verify(signUrl,salt,authSign); 80 boolean verify = MD5.verify(signUrl,salt,authSign);
75 - System.out.println("签名是否正确"+verify);  
76 81
77 if(verify) { 82 if(verify) {
78 83
79 User user = userServer.getDeviceUser(deviceNo); 84 User user = userServer.getDeviceUser(deviceNo);
80 user.setParameter("0"); 85 user.setParameter("0");
81 user.setToken(token); 86 user.setToken(token);
82 - ehcacheUtil.set("deviceId",user.getDeviceId()); 87 + HttpSession session = request.getSession();
  88 + session.setAttribute("deviceId",user.getDeviceId());
  89 + session.setMaxInactiveInterval(-1);//从不过期
83 serverResponse = ServerResponse.createBySuccess("success",user); 90 serverResponse = ServerResponse.createBySuccess("success",user);
84 91
85 }else{ 92 }else{
@@ -148,9 +155,8 @@ public class MorningCheckController { @@ -148,9 +155,8 @@ public class MorningCheckController {
148 "时间格式为 : yyyy-MM-dd-HH-mm-ss", dataType = "String",paramType = "query") 155 "时间格式为 : yyyy-MM-dd-HH-mm-ss", dataType = "String",paramType = "query")
149 }) 156 })
150 @PostMapping("signByCard") 157 @PostMapping("signByCard")
151 - public ServerResponse swipeCard(@RequestParam String token,@RequestParam String cardNo,@RequestParam Integer imageId,@RequestParam String authSign,@RequestParam(required = false) String date){ 158 + public ServerResponse swipeCard(HttpServletRequest request,@RequestParam String token,@RequestParam String cardNo,@RequestParam Integer imageId,@RequestParam String authSign,@RequestParam(required = false) String date){
152 159
153 -// System.out.println("刷卡签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign);  
154 LogUtil.printInfoLog("刷卡签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign); 160 LogUtil.printInfoLog("刷卡签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign);
155 ServerResponse serverResponse = null; 161 ServerResponse serverResponse = null;
156 162
@@ -185,21 +191,16 @@ public class MorningCheckController { @@ -185,21 +191,16 @@ public class MorningCheckController {
185 boolean verify = MD5.verify(signUrl,salt,authSign); 191 boolean verify = MD5.verify(signUrl,salt,authSign);
186 System.out.println("签名是否正确"+verify); 192 System.out.println("签名是否正确"+verify);
187 if(verify) { 193 if(verify) {
188 - int index = imageId -1;  
189 - if(FileUpAndDownServiceImpl.globalFileEntities.size()>0) {  
190 - System.out.println("对应图像地址:" + FileUpAndDownServiceImpl.globalFileEntities.get(index).getImgObPath());  
191 - }  
192 - //卡号,图片,刷卡时间(如果没有, 当前时间),设备号  
193 - System.out.println("卡号:"+cardNo+",图片ID"+imageId+",设备标识:"+ehcacheUtil.get("deviceId")+",当前时间"+date+",刷进设备的卡号是:"+card);  
194 - 194 + HttpSession session = request.getSession();
  195 + String deviceId = session.getAttribute("deviceId").toString();
195 Map<String,Object> hashMap = new HashMap<>(); 196 Map<String,Object> hashMap = new HashMap<>();
196 //设备编号 197 //设备编号
197 - hashMap.put("att_id",ehcacheUtil.get("deviceId")); 198 + hashMap.put("att_id",deviceId);
198 hashMap.put("card_num",card); 199 hashMap.put("card_num",card);
199 hashMap.put("func_no","08"); 200 hashMap.put("func_no","08");
200 hashMap.put("flag",0); 201 hashMap.put("flag",0);
201 hashMap.put("intime",dateIn); 202 hashMap.put("intime",dateIn);
202 - System.out.println(dateIn); 203 + System.out.println(deviceId);
203 204
204 studentService.swipeCard(hashMap); 205 studentService.swipeCard(hashMap);
205 System.out.println("集合数量:"+hashMap.size()); 206 System.out.println("集合数量:"+hashMap.size());
@@ -232,9 +233,8 @@ public class MorningCheckController { @@ -232,9 +233,8 @@ public class MorningCheckController {
232 @ApiImplicitParam(name = "authSign", value = "签名", dataType = "String",required = true,paramType = "query") 233 @ApiImplicitParam(name = "authSign", value = "签名", dataType = "String",required = true,paramType = "query")
233 }) 234 })
234 @PostMapping("signOutByCard") 235 @PostMapping("signOutByCard")
235 - public ServerResponse signOutByCard(@RequestParam String token,@RequestParam String cardNo,@RequestParam Integer imageId,@RequestParam String authSign){ 236 + public ServerResponse signOutByCard(HttpServletRequest request,@RequestParam String token,@RequestParam String cardNo,@RequestParam Integer imageId,@RequestParam String authSign){
236 237
237 -// System.out.println("离园签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign);  
238 ServerResponse serverResponse = null; 238 ServerResponse serverResponse = null;
239 LogUtil.printInfoLog("离园签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign); 239 LogUtil.printInfoLog("离园签到传入的参数:卡号"+cardNo+",图片ID:"+imageId+",签名"+authSign);
240 240
@@ -251,15 +251,10 @@ public class MorningCheckController { @@ -251,15 +251,10 @@ public class MorningCheckController {
251 boolean verify = MD5.verify(signUrl,salt,authSign); 251 boolean verify = MD5.verify(signUrl,salt,authSign);
252 System.out.println("签名是否正确"+verify); 252 System.out.println("签名是否正确"+verify);
253 if(verify) { 253 if(verify) {
254 -  
255 - int index = imageId -1;  
256 - if(FileUpAndDownServiceImpl.globalFileEntities.size()>0) {  
257 - System.out.println("对应图像地址:" + FileUpAndDownServiceImpl.globalFileEntities.get(index).getImgObPath());  
258 - }  
259 - //卡号,图片,刷卡时间(如果没有, 当前时间),设备号  
260 - System.out.println("卡号:"+cardNo+",图片ID"+imageId+",设备标识:"+ehcacheUtil.get("deviceId")+",刷进设备的卡号是:"+card); 254 + HttpSession session = request.getSession();
  255 + String deviceId = session.getAttribute("deviceId").toString();
261 Map<String,Object> hashMap = new HashMap<>(); 256 Map<String,Object> hashMap = new HashMap<>();
262 - hashMap.put("att_id",ehcacheUtil.get("deviceId")); 257 + hashMap.put("att_id",deviceId);
263 hashMap.put("card_num",card); 258 hashMap.put("card_num",card);
264 hashMap.put("func_no","08"); 259 hashMap.put("func_no","08");
265 hashMap.put("flag",0); 260 hashMap.put("flag",0);
@@ -272,8 +267,7 @@ public class MorningCheckController { @@ -272,8 +267,7 @@ public class MorningCheckController {
272 String msg = String.format("学生%s你好",student.getStuName()); 267 String msg = String.format("学生%s你好",student.getStuName());
273 serverResponse = ServerResponse.createBySuccessMessage(msg); 268 serverResponse = ServerResponse.createBySuccessMessage(msg);
274 }else{ 269 }else{
275 -  
276 - serverResponse = ServerResponse.createByErrorMessage("签名失败"); 270 + serverResponse = ServerResponse.createByErrorMessage("签名校验失败");
277 } 271 }
278 } 272 }
279 catch (Exception ex){ 273 catch (Exception ex){
@@ -293,11 +287,7 @@ public class MorningCheckController { @@ -293,11 +287,7 @@ public class MorningCheckController {
293 }) 287 })
294 public ServerResponse moreFileUpload(@RequestParam(value = "file", required = false) MultipartFile[] file, @RequestParam(value = "token") String token, @RequestParam(value="type") String type,@RequestParam String authSign) { 288 public ServerResponse moreFileUpload(@RequestParam(value = "file", required = false) MultipartFile[] file, @RequestParam(value = "token") String token, @RequestParam(value="type") String type,@RequestParam String authSign) {
295 289
296 -  
297 LogUtil.printInfoLog("上传多个文件传入的类型:"+type+",签名:"+authSign); 290 LogUtil.printInfoLog("上传多个文件传入的类型:"+type+",签名:"+authSign);
298 -// System.out.println("上传多个文件传入的类型:"+type+",签名:"+authSign);  
299 -  
300 - System.out.println("文件数量:"+file.length);  
301 291
302 ServerResponse serverResponse = null; 292 ServerResponse serverResponse = null;
303 Map map = new HashMap(); 293 Map map = new HashMap();
@@ -306,24 +296,22 @@ public class MorningCheckController { @@ -306,24 +296,22 @@ public class MorningCheckController {
306 296
307 String[] fileNames = type.split("_"); 297 String[] fileNames = type.split("_");
308 if(fileNames.length != file.length){ 298 if(fileNames.length != file.length){
309 - System.out.println("类型数量和文件数量不一致,程序中断");  
310 return ServerResponse.createByErrorMessage("类型数量和文件数量不一致,程序中断"); 299 return ServerResponse.createByErrorMessage("类型数量和文件数量不一致,程序中断");
311 - }else {  
312 - System.out.println("类型数量和文件数量一致,文件已经上传");  
313 } 300 }
  301 +
314 String queryUrl = DataConvertHelper.mapAscSortToUrl(map); 302 String queryUrl = DataConvertHelper.mapAscSortToUrl(map);
315 try { 303 try {
316 String signUrl = queryUrl.replace("&",""); 304 String signUrl = queryUrl.replace("&","");
317 // String md5 = MD5.md5(signUrl, salt); 305 // String md5 = MD5.md5(signUrl, salt);
318 boolean verify = MD5.verify(signUrl,salt,authSign); 306 boolean verify = MD5.verify(signUrl,salt,authSign);
319 - System.out.println("签名是否正确"+verify);  
320 if(verify) { 307 if(verify) {
321 try { 308 try {
322 serverResponse = fileUpAndDownService.uploadPicture(file,fileNames); 309 serverResponse = fileUpAndDownService.uploadPicture(file,fileNames);
323 } catch (Exception e) { 310 } catch (Exception e) {
324 - System.out.println(">>>>>>图片上传异常,ex="+e.getMessage());  
325 serverResponse = ServerResponse.createByErrorMessage(String.format(">>>>>>图片上传异常,e=%s", e.getMessage())); 311 serverResponse = ServerResponse.createByErrorMessage(String.format(">>>>>>图片上传异常,e=%s", e.getMessage()));
326 } 312 }
  313 + }else{
  314 + serverResponse = ServerResponse.createByErrorMessage("签名校验失败");
327 } 315 }
328 } 316 }
329 catch (Exception ex){ 317 catch (Exception ex){
@@ -351,14 +339,9 @@ public class MorningCheckController { @@ -351,14 +339,9 @@ public class MorningCheckController {
351 @PostMapping("uploadCheckReport") 339 @PostMapping("uploadCheckReport")
352 public ServerResponse uploadCheckReport(@RequestParam String token,@RequestParam String cardNo,@RequestParam String result,@RequestParam String robotResult,@RequestParam String access,@RequestParam String temperature,@RequestParam(required = false) String handImgId,@RequestParam(required = false) String mouthImgId,@RequestParam(required = false) String eyeImgId,@RequestParam String authSign){ 340 public ServerResponse uploadCheckReport(@RequestParam String token,@RequestParam String cardNo,@RequestParam String result,@RequestParam String robotResult,@RequestParam String access,@RequestParam String temperature,@RequestParam(required = false) String handImgId,@RequestParam(required = false) String mouthImgId,@RequestParam(required = false) String eyeImgId,@RequestParam String authSign){
353 341
354 -// System.out.println("传入的参数:卡号"+cardNo+",检查结果:"+result+",检查机判断结果:"+robotResult+",签名"+authSign);  
355 - LogUtil.printInfoLog("传入的参数:卡号"+cardNo+",检查结果:"+result+",检查机判断结果:"+robotResult+",签名"+authSign);  
356 - System.out.println("嘴部异常图片ID:"+mouthImgId);  
357 - System.out.println("手部异常图片ID:"+handImgId);  
358 - System.out.println("眼部异常图片ID:"+eyeImgId);  
359 - System.out.println("入园许可。 Y : 入园 N:离园:入园情况:"+access); 342 + LogUtil.printInfoLog("传入的参数:卡号"+cardNo+",检查结果:"+result+",检查机判断结果:"+robotResult+",签名"+authSign+"入园许可。 Y : 入园 N:离园:入园情况:"+access);
360 343
361 - ServerResponse serverResponse = null; 344 + ServerResponse serverResponse;
362 345
363 String card = DataConvertHelper.distToX(Long.valueOf(cardNo)); 346 String card = DataConvertHelper.distToX(Long.valueOf(cardNo));
364 347
@@ -377,20 +360,26 @@ public class MorningCheckController { @@ -377,20 +360,26 @@ public class MorningCheckController {
377 try { 360 try {
378 String signUrl = queryUrl.replace("&",""); 361 String signUrl = queryUrl.replace("&","");
379 boolean verify = MD5.verify(signUrl,salt,authSign); 362 boolean verify = MD5.verify(signUrl,salt,authSign);
380 - System.out.println("签名是否正确"+verify);  
381 if(verify) { 363 if(verify) {
  364 + StudentCheckReport studentCheckReport = new StudentCheckReport();
  365 + studentCheckReport.setAccess(access);
  366 + studentCheckReport.setCardNo(card);
  367 + studentCheckReport.setCheckResult(result);
  368 + studentCheckReport.setRobotResult(robotResult);
  369 + java.sql.Date checkDate = new java.sql.Date(new Date().getTime());
  370 + studentCheckReport.setCheckTime(checkDate);
  371 + studentCheckReport.setInTime(checkDate);
  372 + studentCheckReport.setTemperature(temperature);
  373 + studentCheckReport.setEyeImgId(eyeImgId);
  374 + studentCheckReport.setHandImgId(handImgId);
  375 + studentCheckReport.setMouthImgId(mouthImgId);
382 376
383 -// int index = handImgId -1;  
384 -// System.out.println("手部异常图像地址:"+FileUpAndDownServiceImpl.globalFileEntities.get(index).getImgObPath());  
385 -// index = mouthImgId -1;  
386 -// System.out.println("嘴部异常图像地址:"+FileUpAndDownServiceImpl.globalFileEntities.get(index).getImgObPath());  
387 -// index = eyeImgId -1;  
388 -// System.out.println("眼部异常图像地址:"+FileUpAndDownServiceImpl.globalFileEntities.get(index).getImgObPath());  
389 - //卡号,图片,刷卡时间(如果没有, 当前时间),设备号  
390 - System.out.println("卡号:"+cardNo+",图片ID"+handImgId+",设备标识:"+ehcacheUtil.get("deviceId")+",刷进设备的卡号是:"+card);  
391 //message: 学生姓名你好 377 //message: 学生姓名你好
392 Student student = studentService.getStudentByCardNo(card); 378 Student student = studentService.getStudentByCardNo(card);
393 String msg = String.format("学生%s你好,你的晨检报告已经自动生成",student.getStuName()); 379 String msg = String.format("学生%s你好,你的晨检报告已经自动生成",student.getStuName());
  380 + studentCheckReport.setStudent_id(student.getStuId());
  381 + studentCheckReportService.insert(studentCheckReport);
  382 +
394 serverResponse = ServerResponse.createBySuccessMessage(msg); 383 serverResponse = ServerResponse.createBySuccessMessage(msg);
395 }else{ 384 }else{
396 385
springboot/morning-check/src/main/java/com/sincere/morningcheck/dao/FileDao.java 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +package com.sincere.morningcheck.dao;
  2 +
  3 +import com.sincere.morningcheck.model.FileEntity;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +@Mapper
  8 +@Repository
  9 +public interface FileDao {
  10 +
  11 + int insert(FileEntity fileEntity);
  12 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/dao/StudentCheckReportDao.java 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +package com.sincere.morningcheck.dao;
  2 +
  3 +import com.sincere.morningcheck.model.StudentCheckReport;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +@Mapper
  9 +@Repository
  10 +public interface StudentCheckReportDao {
  11 +
  12 + int insert(StudentCheckReport studentCheckReport);
  13 +
  14 + StudentCheckReport getCheckReport(@Param("studentId") Integer studentId);
  15 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/dao/StudentDao.java
@@ -17,6 +17,8 @@ public interface StudentDao { @@ -17,6 +17,8 @@ public interface StudentDao {
17 17
18 Student getStudentByCardNo(@Param("cardNo") String cardNo); 18 Student getStudentByCardNo(@Param("cardNo") String cardNo);
19 19
  20 + Student getStudentByStuUserId(@Param("sUserId") String sUserId);
  21 +
20 /** 22 /**
21 * 传入的参数和返回的结果都在map集合参数params中 23 * 传入的参数和返回的结果都在map集合参数params中
22 * @param params 24 * @param params
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/ApiStudentCheckReport.java 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +package com.sincere.morningcheck.model;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import java.sql.Date;
  8 +
  9 +/**
  10 + * 接口使用类 检查报告
  11 + */
  12 +@Data
  13 +@ApiModel
  14 +public class ApiStudentCheckReport {
  15 +
  16 + @ApiModelProperty(name="id",value = "检查报告标识")
  17 + private Integer id;
  18 +
  19 + @ApiModelProperty(name="isMorningCheck",value = "判断是否有晨检")
  20 + private Boolean isMorningCheck;
  21 +
  22 + @ApiModelProperty(name="student_id",value = "学生标识")
  23 + private Integer student_id;
  24 +
  25 + @ApiModelProperty(name="cardNo",value = "学生卡号")
  26 + private String cardNo;
  27 +
  28 + @ApiModelProperty(name="temperature",value = "温度")
  29 + private String temperature; //json字符串
  30 +
  31 + @ApiModelProperty(name="CheckTime",value = "检查报告时间")
  32 + private String checkTime;
  33 +
  34 + @ApiModelProperty(name="checkResultObj",value = "检查报告")
  35 + private CheckResult checkResultObj;
  36 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/CheckResult.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  1 +package com.sincere.morningcheck.model;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +/**
  8 + * 人为判断结果
  9 + */
  10 +@Data
  11 +@ApiModel
  12 +public class CheckResult {
  13 +
  14 + @ApiModelProperty(name = "handNoEx",value = "00位,手足是否正常,true正常,false不正常")
  15 + private Boolean handNoEx;
  16 +
  17 + @ApiModelProperty(name = "mouthNoEx",value = "01位,口腔是否正常,true正常,false不正常")
  18 + private Boolean mouthNoEx;
  19 +
  20 + @ApiModelProperty(name = "noRedEye",value = "02位,true正常,false红眼")
  21 + private Boolean noRedEye;
  22 +
  23 + @ApiModelProperty(name = "noFever",value = "03位,true正常,false发烧")
  24 + private Boolean noFever;
  25 +
  26 + @ApiModelProperty(name = "noCrotchBig",value = "04位,true正常,false腮部肿大")
  27 + private Boolean noCrotchBig;
  28 +
  29 + @ApiModelProperty(name = "noPoorSpirit",value = "05,true正常,false精神不佳")
  30 + private Boolean noPoorSpirit;
  31 +
  32 + @ApiModelProperty(name = "noPharyngitis",value = "06,true正常,false咽炎")
  33 + private Boolean noPharyngitis;
  34 +
  35 + @ApiModelProperty(name = "noTrauma",value = "07,true正常,false外伤")
  36 + private Boolean noTrauma;
  37 +
  38 + @ApiModelProperty(name = "noCough",value = "08,true正常,false咳嗽")
  39 + private Boolean noCough;
  40 +
  41 + @ApiModelProperty(name = "noNail",value = "09,true正常,false过长")
  42 + private Boolean noNail;
  43 +
  44 + @ApiModelProperty(name = "noToothDecay",value = "10,true正常,false蛀牙")
  45 + private Boolean noToothDecay;
  46 +
  47 + @ApiModelProperty(name = "other",value = "true正常,false不正常")
  48 + private Boolean other;
  49 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/FileEntity.java
@@ -3,6 +3,8 @@ package com.sincere.morningcheck.model; @@ -3,6 +3,8 @@ package com.sincere.morningcheck.model;
3 import com.sincere.morningcheck.common.ImgType; 3 import com.sincere.morningcheck.common.ImgType;
4 import lombok.Data; 4 import lombok.Data;
5 5
  6 +import java.sql.Date;
  7 +
6 @Data 8 @Data
7 public class FileEntity { 9 public class FileEntity {
8 10
@@ -11,9 +13,9 @@ public class FileEntity { @@ -11,9 +13,9 @@ public class FileEntity {
11 */ 13 */
12 private Integer photoId; 14 private Integer photoId;
13 /** 15 /**
14 - * 头像存储的位置(对路径) 16 + * 头像存储的位置(对路径)
15 */ 17 */
16 - private String imgObPath; 18 + private String imgRePath;
17 /** 19 /**
18 * 文件新名称 20 * 文件新名称
19 */ 21 */
@@ -26,4 +28,6 @@ public class FileEntity { @@ -26,4 +28,6 @@ public class FileEntity {
26 * 文件旧名称 28 * 文件旧名称
27 */ 29 */
28 private String oldFileName; 30 private String oldFileName;
  31 +
  32 + private Date inTime;
29 } 33 }
springboot/morning-check/src/main/java/com/sincere/morningcheck/model/StudentCheckReport.java 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  1 +package com.sincere.morningcheck.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.sql.Date;
  6 +
  7 +@Data
  8 +public class StudentCheckReport {
  9 +
  10 +
  11 + private Integer id;
  12 +
  13 + private Integer student_id;
  14 +
  15 + private String cardNo;
  16 +
  17 + /**
  18 + * 人为判别结果
  19 + */
  20 + private String checkResult; //json字符串
  21 +
  22 + /**
  23 + * 机器判别结果
  24 + */
  25 + private String robotResult; //json字符串
  26 +
  27 + private Date checkTime;
  28 +
  29 + private Date inTime;
  30 +
  31 + private String access;
  32 +
  33 + private String temperature;
  34 +
  35 + private String handImgId;
  36 +
  37 + private String mouthImgId;
  38 +
  39 + private String eyeImgId;
  40 +
  41 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/FileUpAndDownService.java
1 package com.sincere.morningcheck.service; 1 package com.sincere.morningcheck.service;
2 2
3 import com.sincere.morningcheck.common.ServerResponse; 3 import com.sincere.morningcheck.common.ServerResponse;
  4 +import com.sincere.morningcheck.model.FileEntity;
4 import org.springframework.web.multipart.MultipartFile; 5 import org.springframework.web.multipart.MultipartFile;
5 6
6 7
7 public interface FileUpAndDownService { 8 public interface FileUpAndDownService {
8 9
9 ServerResponse uploadPicture(MultipartFile[] file, String[] file_Types) throws Exception; 10 ServerResponse uploadPicture(MultipartFile[] file, String[] file_Types) throws Exception;
  11 +
  12 + ServerResponse<Integer> insert(FileEntity fileEntity);
10 } 13 }
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/StudentCheckReportService.java 0 → 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +package com.sincere.morningcheck.service;
  2 +
  3 +
  4 +import com.sincere.morningcheck.common.ServerResponse;
  5 +import com.sincere.morningcheck.model.ApiStudentCheckReport;
  6 +import com.sincere.morningcheck.model.StudentCheckReport;
  7 +
  8 +public interface StudentCheckReportService {
  9 +
  10 + int insert(StudentCheckReport studentCheckReport);
  11 +
  12 + ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId);
  13 +}
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/impl/FileUpAndDownServiceImpl.java
@@ -3,6 +3,7 @@ package com.sincere.morningcheck.service.impl; @@ -3,6 +3,7 @@ package com.sincere.morningcheck.service.impl;
3 import com.sincere.morningcheck.common.ImgType; 3 import com.sincere.morningcheck.common.ImgType;
4 import com.sincere.morningcheck.common.ServerResponse; 4 import com.sincere.morningcheck.common.ServerResponse;
5 import com.sincere.morningcheck.config.MessageProperties; 5 import com.sincere.morningcheck.config.MessageProperties;
  6 +import com.sincere.morningcheck.dao.FileDao;
6 import com.sincere.morningcheck.model.FileEntity; 7 import com.sincere.morningcheck.model.FileEntity;
7 import com.sincere.morningcheck.model.Photo; 8 import com.sincere.morningcheck.model.Photo;
8 import com.sincere.morningcheck.service.FileUpAndDownService; 9 import com.sincere.morningcheck.service.FileUpAndDownService;
@@ -21,19 +22,19 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService { @@ -21,19 +22,19 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService {
21 @Autowired 22 @Autowired
22 private MessageProperties config; //用来获取file-message.properties配置文件中的信息 23 private MessageProperties config; //用来获取file-message.properties配置文件中的信息
23 24
24 - static Integer photoId = 0;  
25 - public static List<FileEntity> globalFileEntities = new LinkedList<>(); 25 + @Autowired
  26 + private FileDao fileDao;
  27 +
26 @Override 28 @Override
27 public ServerResponse uploadPicture(MultipartFile[] files, String[] file_types) throws Exception { 29 public ServerResponse uploadPicture(MultipartFile[] files, String[] file_types) throws Exception {
28 30
29 - System.out.println("进入上传文件方法。");  
30 List<FileEntity> fileEntities = new LinkedList<>(); 31 List<FileEntity> fileEntities = new LinkedList<>();
31 int i = 0; 32 int i = 0;
32 for(MultipartFile file : files) { 33 for(MultipartFile file : files) {
33 System.out.println(file.getOriginalFilename()); 34 System.out.println(file.getOriginalFilename());
34 35
35 try { 36 try {
36 - photoId++; //每进一次方法自增一次,模拟主键自增 37 +
37 Map<String, Object> resMap = new HashMap<>(); 38 Map<String, Object> resMap = new HashMap<>();
38 String[] IMAGE_TYPE = config.getImageType().split(","); 39 String[] IMAGE_TYPE = config.getImageType().split(",");
39 String path = null; 40 String path = null;
@@ -54,11 +55,13 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService { @@ -54,11 +55,13 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService {
54 String suffix = oldFileName.substring(oldFileName.lastIndexOf("."));//带逗号,不带逗号加1 55 String suffix = oldFileName.substring(oldFileName.lastIndexOf("."));//带逗号,不带逗号加1
55 // 新名称 56 // 新名称
56 String imgType = file_types[i]; 57 String imgType = file_types[i];
57 - String newFileName = imgType + "_photoId"+photoId+suffix; 58 + UUID uuid = UUID.randomUUID();
  59 + String newFileName = imgType+ "_" + uuid.toString().replace("-","") +suffix;
58 i++; 60 i++;
59 // 年月日文件夹 61 // 年月日文件夹
60 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); 62 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
61 String basedir = sdf.format(new Date()); 63 String basedir = sdf.format(new Date());
  64 + String rePath = "/images/" + basedir + "/" + newFileName;
62 // 进行压缩(大于4M) 65 // 进行压缩(大于4M)
63 if (file.getSize() > config.getFileSize()) { 66 if (file.getSize() > config.getFileSize()) {
64 path = config.getUpPath() + "/" + basedir + "/" + newFileName; 67 path = config.getUpPath() + "/" + basedir + "/" + newFileName;
@@ -82,16 +85,18 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService { @@ -82,16 +85,18 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService {
82 } 85 }
83 86
84 FileEntity fileEntity = new FileEntity(); 87 FileEntity fileEntity = new FileEntity();
85 - fileEntity.setPhotoId(photoId); 88 +
86 fileEntity.setFileName(newFileName); 89 fileEntity.setFileName(newFileName);
87 - fileEntity.setImgObPath(path); 90 + fileEntity.setImgRePath(rePath);
88 fileEntity.setOldFileName(oldFileName); 91 fileEntity.setOldFileName(oldFileName);
89 fileEntity.setImgType(ImgType.valueOf(imgType)); 92 fileEntity.setImgType(ImgType.valueOf(imgType));
90 93
  94 + fileEntity.setInTime( new java.sql.Date(new Date().getTime()));
  95 + fileEntity.setPhotoId(0);
  96 + insert(fileEntity);
91 fileEntities.add(fileEntity); 97 fileEntities.add(fileEntity);
92 98
93 } else { 99 } else {
94 - System.out.println("result:图片格式不正确,支持png|jpg|jpeg");  
95 return ServerResponse.createByErrorMessage("result:图片格式不正确,支持png|jpg|jpeg"); 100 return ServerResponse.createByErrorMessage("result:图片格式不正确,支持png|jpg|jpeg");
96 } 101 }
97 } catch (Exception e) { 102 } catch (Exception e) {
@@ -99,7 +104,8 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService { @@ -99,7 +104,8 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService {
99 throw new Exception(e.getMessage()); 104 throw new Exception(e.getMessage());
100 } 105 }
101 } 106 }
102 - globalFileEntities.addAll(fileEntities); 107 +
  108 + //返回结果
103 Map<String,Object> map = new HashMap<>(); 109 Map<String,Object> map = new HashMap<>();
104 110
105 List<Photo> photoIds = new ArrayList<>(); 111 List<Photo> photoIds = new ArrayList<>();
@@ -112,4 +118,12 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService { @@ -112,4 +118,12 @@ public class FileUpAndDownServiceImpl implements FileUpAndDownService {
112 map.put("photoIds",photoIds); 118 map.put("photoIds",photoIds);
113 return ServerResponse.createBySuccess(map); 119 return ServerResponse.createBySuccess(map);
114 } 120 }
  121 +
  122 + @Override
  123 + public ServerResponse<Integer> insert(FileEntity fileEntity) {
  124 +
  125 + int result = fileDao.insert(fileEntity);
  126 + return ServerResponse.createBySuccess(result);
  127 + }
  128 +
115 } 129 }
springboot/morning-check/src/main/java/com/sincere/morningcheck/service/impl/StudentCheckReportServiceImpl.java 0 → 100644
@@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
  1 +package com.sincere.morningcheck.service.impl;
  2 +
  3 +import com.sincere.morningcheck.common.ServerResponse;
  4 +import com.sincere.morningcheck.dao.StudentCheckReportDao;
  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;
  10 +import com.sincere.morningcheck.service.StudentCheckReportService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.text.SimpleDateFormat;
  15 +
  16 +@Service
  17 +public class StudentCheckReportServiceImpl implements StudentCheckReportService {
  18 +
  19 + @Autowired
  20 + StudentCheckReportDao studentCheckReportDao;
  21 +
  22 + @Autowired
  23 + StudentDao studentDao;
  24 +
  25 + @Override
  26 + public int insert(StudentCheckReport studentCheckReport) {
  27 + return studentCheckReportDao.insert(studentCheckReport);
  28 + }
  29 +
  30 + @Override
  31 + public ServerResponse<ApiStudentCheckReport> getCheckReport(String stuUserId) {
  32 +
  33 + StudentCheckReport studentCheckReport;
  34 +
  35 + Student student = studentDao.getStudentByStuUserId(stuUserId);
  36 + studentCheckReport = studentCheckReportDao.getCheckReport(student.getStuId());
  37 + Boolean isMorningCheck;
  38 + if(studentCheckReport == null){
  39 + isMorningCheck = false;
  40 + }else{
  41 + isMorningCheck = true;
  42 + }
  43 +
  44 + ApiStudentCheckReport apiStudentCheckReport = getApiStudentReport(studentCheckReport,isMorningCheck);
  45 + return ServerResponse.createBySuccess(apiStudentCheckReport);
  46 + }
  47 +
  48 + private ApiStudentCheckReport getApiStudentReport(StudentCheckReport studentCheckReport,Boolean isMorningCheck){
  49 +
  50 + ApiStudentCheckReport apiStudentCheckReport = new ApiStudentCheckReport();
  51 + if(isMorningCheck) {
  52 + apiStudentCheckReport.setCardNo(studentCheckReport.getCardNo());
  53 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  54 + apiStudentCheckReport.setCheckTime(simpleDateFormat.format(studentCheckReport.getCheckTime()));
  55 + apiStudentCheckReport.setStudent_id(studentCheckReport.getStudent_id());
  56 + apiStudentCheckReport.setTemperature(studentCheckReport.getTemperature());
  57 + 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])));
  73 + apiStudentCheckReport.setCheckResultObj(checkResult);
  74 + }
  75 + apiStudentCheckReport.setIsMorningCheck(isMorningCheck);
  76 + return apiStudentCheckReport;
  77 + }
  78 +
  79 + private Boolean isJudge(String yesOrNo){
  80 +
  81 + if(yesOrNo.equals("Y")){
  82 + return true;
  83 + }
  84 + return false;
  85 + }
  86 +}
springboot/morning-check/src/main/resources/application.properties
@@ -2,9 +2,15 @@ salt = sincere @@ -2,9 +2,15 @@ salt = sincere
2 2
3 server.port=8999 3 server.port=8999
4 4
5 -spring.datasource.username=szjxtuser  
6 -spring.datasource.password=RQminVCJota3H1u8bBYH  
7 -spring.datasource.url=jdbc:sqlserver://116.62.155.137:33419;database=smartcampus 5 +#正式站点数据库
  6 +#spring.datasource.username=szjxtuser
  7 +#spring.datasource.password=RQminVCJota3H1u8bBYH
  8 +#spring.datasource.url=jdbc:sqlserver://116.62.155.137:33419;database=smartcampus
  9 +
  10 +#测试站点数据库
  11 +spring.datasource.username=SZJXTUSER
  12 +spring.datasource.password=xst200919
  13 +spring.datasource.url=jdbc:sqlserver://60.190.202.57:14333;Database=SmartCampusSZ
8 spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver 14 spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
9 15
10 mybatis.mapper-locations=classpath:/mapper/*.xml 16 mybatis.mapper-locations=classpath:/mapper/*.xml
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=D:\\MorningRobot\\UploadData\\images 4 +message.upPath=E:/MorningRobot/UploadData/images/
5 #压缩比例 5 #压缩比例
6 message.scaleRatio=0.90f 6 message.scaleRatio=0.90f
7 #图片类型 7 #图片类型
springboot/morning-check/src/main/resources/mapper/StudentCheckReport.xml 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.sincere.morningcheck.dao.StudentCheckReportDao">
  6 +
  7 + <!--声明返回结果参数-->
  8 + <resultMap id="BaseResultMap" type="com.sincere.morningcheck.model.StudentCheckReport">
  9 + <!-- id:指定查询列中的唯 一标识,即主键,可配置多个-->
  10 + <id column="student_id" property="student_id" jdbcType="INTEGER" javaType="java.lang.Integer"/>
  11 + <result column="cardNo" property="cardNo" 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"/>
  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"/>
  17 + <result column="temperature" property="temperature" 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"/>
  20 + <result column="eyeImgId" property="eyeImgId" jdbcType="VARCHAR" javaType="java.lang.String"/>
  21 + </resultMap>
  22 +
  23 + <sql id="Base_Column_List">
  24 + student_id,cardNo,checkTime,checkResult,robotResult,intime,access,temperature,handImgId,mouthImgId,eyeImgId
  25 + </sql>
  26 +
  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)
  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})
  30 +</insert>
  31 +
  32 + <select id="getCheckReport" resultMap="BaseResultMap">
  33 + select <include refid="Base_Column_List"/> from xiaoan.[dbo].[SZ_StudentCheckReport]
  34 + where student_id = #{studentId} and CONVERT(varchar(10),checkTime,23) = CONVERT(varchar(10),getdate(),23)
  35 + </select>
  36 +
  37 +</mapper>
0 \ No newline at end of file 38 \ No newline at end of file
springboot/morning-check/src/main/resources/mapper/filemapper.xml 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.sincere.morningcheck.dao.FileDao">
  6 +
  7 + <!--声明返回结果参数-->
  8 + <resultMap id="BaseResultMap" type="com.sincere.morningcheck.model.FileEntity">
  9 + <!-- id:指定查询列中的唯 一标识,即主键,可配置多个-->
  10 + <id column="id" property="photoId" jdbcType="INTEGER" javaType="java.lang.Integer"/>
  11 + <result column="imgRePath" property="imgRePath" jdbcType="VARCHAR" javaType="java.lang.String"/>
  12 + <result column="fileName" property="fileName" jdbcType="INTEGER" javaType="java.lang.Integer"/>
  13 + <result column="imgType" property="imgType" jdbcType="VARCHAR" javaType="com.sincere.morningcheck.common.ImgType"/>
  14 + <result column="oldFileName" property="oldFileName" jdbcType="VARCHAR" javaType="java.lang.String"/>
  15 + <result column="intime" property="inTime" jdbcType="DATE" javaType="java.sql.Date"/>
  16 + </resultMap>
  17 +
  18 +
  19 +<!--useGeneratedKeys="true" keyProperty="photoId" 配置属性是用来获取插入返回的-->
  20 +<insert id="insert" useGeneratedKeys="true" keyProperty="photoId" parameterType="com.sincere.morningcheck.model.FileEntity" >
  21 + insert xiaoan.dbo.SZ_MorningCheckFile(imgRePath,fileName,imgType,oldFileName,intime)
  22 +values(#{imgRePath,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{imgType,jdbcType=VARCHAR}, #{oldFileName,jdbcType=VARCHAR},#{inTime,jdbcType=DATE})
  23 +</insert>
  24 +
  25 +</mapper>
0 \ No newline at end of file 26 \ No newline at end of file
springboot/morning-check/src/main/resources/mapper/studentmapper.xml
@@ -33,6 +33,11 @@ @@ -33,6 +33,11 @@
33 where vs.role_state=1 33 where vs.role_state=1
34 </select> 34 </select>
35 35
  36 + <select id="getStudentByStuUserId" resultMap="BaseResultMap">
  37 + select top 1 vs.name,vs.student_id,vs.class_id,vs.class_name,Cards=vs.student_num from SZ_V_School_Student vs
  38 + where user_id=#{sUserId}
  39 + </select>
  40 +
36 <select id="swipeCard" statementType="CALLABLE" resultType="java.util.Map"> 41 <select id="swipeCard" statementType="CALLABLE" resultType="java.util.Map">
37 {call xiaoan.dbo.AttendanceService( 42 {call xiaoan.dbo.AttendanceService(
38 #{att_id, mode=IN}, 43 #{att_id, mode=IN},
springboot/src/main/java/com/sincre/springboot/controller/TuYaYunController.java
@@ -465,7 +465,7 @@ public class TuYaYunController { @@ -465,7 +465,7 @@ public class TuYaYunController {
465 return ServerResponse.createByErrorCodeMessage(400,"参数错误"); 465 return ServerResponse.createByErrorCodeMessage(400,"参数错误");
466 } 466 }
467 else{ 467 else{
468 - if(StringUtils.isBlank(tuYaAirCondition.getRemote_id())||StringUtils.isBlank(tuYaAirCondition.getRemote_index())){ 468 + if(StringUtils.isBlank(tuYaAirCondition.getRemote_index())){
469 return ServerResponse.createByErrorCodeMessage(400,"参数错误"); 469 return ServerResponse.createByErrorCodeMessage(400,"参数错误");
470 } 470 }
471 } 471 }