From 768239f6df2743558430e3733fec788942037e5e Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Tue, 28 Jul 2020 19:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8F=AD=E7=BA=A7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=AD=A6=E6=A0=A1=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yipin/liuwanr/Test.java | 5 ++++- .../liuwanr/controller/AssesmentController.java | 16 +++++++++++----- .../yipin/liuwanr/mapper/AssesmentMapper.java | 8 ++++---- .../yipin/liuwanr/service/AssesmentService.java | 8 ++++---- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/Test.java b/src/main/java/com/yipin/liuwanr/Test.java index ef7d713..98b9246 100644 --- a/src/main/java/com/yipin/liuwanr/Test.java +++ b/src/main/java/com/yipin/liuwanr/Test.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -13,10 +15,11 @@ public class Test { public static void main(String[] args) throws Exception { //方法一 - //System.out.println((new Test()).getURLContent()); + System.out.println((new Test()).getURLContent()); String urlStr = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=40&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init"; System.out.println((new Test()).getURLContent(urlStr)); } + public static String getURLContent() throws Exception { String strURL = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=40&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init"; diff --git a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java index 043bd45..88747d2 100644 --- a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java +++ b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java @@ -250,13 +250,16 @@ public class AssesmentController { * @return */ @GetMapping("/getExperimentalClass") - Response getExperimentalClass(@RequestParam Integer staffId) { + Response getExperimentalClass(@RequestParam Integer staffId,@RequestParam Integer schoolId) { Response resp = new Response(); if(StringUtils.isEmpty(staffId)){ resp.setStatus(300); resp.setErrmessage("教师信息为空"); - }else{ - HashMap ret = service.queryCretionTime(staffId); + }else if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setErrmessage("学校信息为空"); + } else{ + HashMap ret = service.queryCretionTime(staffId,schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -276,7 +279,7 @@ public class AssesmentController { * @return */ @GetMapping("/getCreationTime") - Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer staffId) { + Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer staffId,@RequestParam Integer schoolId) { Response resp = new Response(); if(StringUtils.isEmpty(staffId)){ resp.setStatus(300); @@ -284,8 +287,11 @@ public class AssesmentController { }else if(StringUtils.isEmpty(creationTime)){ resp.setStatus(300); resp.setErrmessage("实验班级创建时间信息为空"); + }else if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setErrmessage("学校信息为空"); }else { - HashMap ret = service.queryCretionTime(creationTime,staffId); + HashMap ret = service.queryCretionTime(creationTime,staffId,schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java index 11a2e27..013a58d 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java @@ -186,8 +186,8 @@ public interface AssesmentMapper { * @return */ @Select("select DISTINCT DATE_FORMAT(creationTime,'%Y') as creationTime from experimental_class_ning " + - " WHERE isdel=0 and founder=(select staffName from staff where staffId=#{staffId}) GROUP BY creationTime ORDER BY creationTime desc ") - List queryCreationTime(Integer staffId); + " WHERE isdel=0 and founder=(select staffName from staff where staffId=#{staffId}) and schoolId={schoolId} GROUP BY creationTime ORDER BY creationTime desc ") + List queryCreationTime(@Param("staffId") Integer staffId,@Param("schoolId")Integer schoolId); /** @@ -196,13 +196,13 @@ public interface AssesmentMapper { * @param creationTime * @return */ - @Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime like concat('%',#{creationTime},'%') and founder=(select staffName from staff where staffId=#{staffId})") + @Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime like concat('%',#{creationTime},'%') and founder=(select staffName from staff where staffId=#{staffId}) and schoolId={schoolId} ") @Results({ @Result(id = true, column = "experimentalClassId", property = "experimentalClassId"), @Result(column = "experimentalClassName", property = "experimentalClassName"), @Result(column = "experimentalClassId", property = "students", many = @Many(select = "com.yipin.liuwanr.mapper.StudentMapper.getByStudents")) }) - List queryExperimentalClass(@Param("creationTime") String creationTime, @Param("staffId") Integer staffId); + List queryExperimentalClass(@Param("creationTime") String creationTime, @Param("staffId") Integer staffId,@Param("schoolId")Integer schoolId); /** * 考核名称、创建时间、结束时间、教师名称、考核人数、实到人数 diff --git a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java index c793ec2..c818f62 100644 --- a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java +++ b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java @@ -318,10 +318,10 @@ public class AssesmentService { * @param staffId:教师id * @return */ - public HashMap queryCretionTime(Integer staffId) { + public HashMap queryCretionTime(Integer staffId,Integer schoolId) { HashMap resp = new HashMap(); try { - resp.put("retvalue", mapper.queryCreationTime(staffId)); + resp.put("retvalue", mapper.queryCreationTime(staffId,schoolId)); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage()); @@ -339,10 +339,10 @@ public class AssesmentService { * @param cretionTime * @return */ - public HashMap queryCretionTime(String cretionTime, Integer staffId) { + public HashMap queryCretionTime(String cretionTime, Integer staffId,Integer schoolId) { HashMap resp = new HashMap(); try { - resp.put("retvalue", mapper.queryExperimentalClass(cretionTime, staffId)); + resp.put("retvalue", mapper.queryExperimentalClass(cretionTime, staffId,schoolId)); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage());