Переглянути джерело

调整名称,增加定向专业信息查询

mingfu 1 місяць тому
батько
коміт
d5b82cde64

+ 47 - 16
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontStudentController.java

@@ -9,9 +9,13 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dz.domain.DzControl;
 import com.ruoyi.dz.service.IDzControlService;
 import com.ruoyi.ie.domain.AEnrollUniversity;
+import com.ruoyi.ie.domain.AMarjorPlan;
 import com.ruoyi.ie.service.IAEnrollUniversityService;
+import com.ruoyi.ie.service.IAMarjorPlanService;
+import com.ruoyi.learn.domain.LearnDirectedKnowledge;
 import com.ruoyi.learn.domain.LearnPlan;
 import com.ruoyi.learn.domain.LearnPlanStudy;
+import com.ruoyi.learn.service.ILearnDirectedKnowledgeService;
 import com.ruoyi.learn.service.ILearnPlanService;
 import com.ruoyi.learn.service.ILearnPlanStudyService;
 import com.ruoyi.sy.service.ISyMajorService;
@@ -20,6 +24,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.web.bind.annotation.*;
 
@@ -41,19 +46,24 @@ public class FrontStudentController {
     private final ISysUserService sysUserService;
     private final ILearnPlanService learnPlanService;
     private final ILearnPlanStudyService learnPlanStudyService;
+    private final IAMarjorPlanService marjorPlanService;
+    private final ILearnDirectedKnowledgeService learnDirectedKnowledgeService;
 
-    public FrontStudentController(IDzControlService dzControlService, IAEnrollUniversityService universityService, ISyMajorService syMajorService, ISysUserService sysUserService, ILearnPlanService learnPlanService, ILearnPlanStudyService learnPlanStudyService) {
+    public FrontStudentController(IDzControlService dzControlService, IAEnrollUniversityService universityService, ISyMajorService syMajorService, ISysUserService sysUserService,
+                                  ILearnPlanService learnPlanService, ILearnPlanStudyService learnPlanStudyService, IAMarjorPlanService marjorPlanService, ILearnDirectedKnowledgeService learnDirectedKnowledgeService) {
         this.dzControlService = dzControlService;
         this.universityService = universityService;
         this.syMajorService = syMajorService;
         this.sysUserService = sysUserService;
         this.learnPlanService = learnPlanService;
         this.learnPlanStudyService = learnPlanStudyService;
+        this.marjorPlanService = marjorPlanService;
+        this.learnDirectedKnowledgeService = learnDirectedKnowledgeService;
     }
 
     @ApiOperation("01 计划院校列表")
-    @GetMapping(value = "getUniversityList")
-    public AjaxResult getUniversityList() {
+    @GetMapping(value = "university")
+    public AjaxResult getUniversity() {
         DzControl dzControl = dzControlService.selectDzControl(VistorContextHolder.getContext());
         AEnrollUniversity cond = new AEnrollUniversity();
         cond.setYear(dzControl.getPlanYear());
@@ -62,22 +72,44 @@ public class FrontStudentController {
         ).collect(Collectors.toList()));
     }
 
-    @ApiOperation("02 计划院校专业及专业组树")
-    @GetMapping(value = "getGroupMajors")
-    public AjaxResult getGroupMajors(@ApiParam("院校ID") Long universityId) {
+    @ApiOperation("02 计划院校专业及上级")
+    @GetMapping(value = "university/major")
+    public AjaxResult getUniversityMajor(@ApiParam("院校ID") Long universityId) {
         return AjaxResult.success(syMajorService.selectPlanMajorList(VistorContextHolder.getContext(), universityId));
     }
 
+    @ApiOperation("30 计划院校专业信息")
+    @GetMapping("university/plan")
+    public AjaxResult getuniversityPlan(@ApiParam("专业") Long planId) {
+        AMarjorPlan mp = marjorPlanService.selectAMarjorPlanById(planId);
+        LearnDirectedKnowledge cond = new LearnDirectedKnowledge();
+        String groupName = StringUtils.trimToEmpty(mp.getMajorGroup());
+        List<LearnDirectedKnowledge> result = null;
+        if(StringUtils.isNotBlank(mp.getMajorName())) {
+            cond.setDirectKey(mp.getYear() + "_" + mp.getUniversityId() + "_" + groupName + "_" + mp.getMajorName()); // 三级键
+            result = learnDirectedKnowledgeService.selectLearnDirectedKnowledgeList(cond);
+        }
+        if(CollectionUtils.isEmpty(result)) {
+            cond.setDirectKey(mp.getYear() + "_" + mp.getUniversityId() + "_" + groupName); // 二级键
+            result = learnDirectedKnowledgeService.selectLearnDirectedKnowledgeList(cond);
+        }
+        if(CollectionUtils.isEmpty(result) && StringUtils.isNotBlank(groupName)) {
+            cond.setDirectKey(mp.getYear() + "_" + mp.getUniversityId().toString()); // 一级键
+            result = learnDirectedKnowledgeService.selectLearnDirectedKnowledgeList(cond);
+        }
+        return CollectionUtils.isNotEmpty(result) ? AjaxResult.success(result.get(0)) : AjaxResult.error("无计划");
+    }
+
     @ApiOperation("03 查询学生定向院校")
-    @GetMapping(value = "getDirectionSchools")
+    @GetMapping(value = "directed/school")
     public AjaxResult getDirectionSchools() {
         SysUser user = sysUserService.selectUserById(SecurityUtils.getLoginUser().getUserId());
         return AjaxResult.success(JSONArray.parse(user.getDirectedStudy()));
     }
 
     @ApiOperation("04 保存学生定向院校")
-    @PostMapping(value = "saveDirectionSchools")
-    public AjaxResult saveDirectionSchools(@RequestBody JSONArray directionStudy) {
+    @PostMapping(value = "directed/school")
+    public AjaxResult saveStudySchool(@RequestBody JSONArray directionStudy) {
         SysUser user = new SysUser();
         user.setUserId(SecurityUtils.getLoginUser().getUserId());
         user.setDirectedStudy(directionStudy.toJSONString());
@@ -85,15 +117,15 @@ public class FrontStudentController {
     }
 
     @ApiOperation("10 查询学习计划")
-    @GetMapping("getLearnPlan")
-    public AjaxResult getLearnPlan()
+    @GetMapping("plan")
+    public AjaxResult getPlan()
     {
         return AjaxResult.success(getCurrLearnPlan());
     }
 
     @ApiOperation("11 保存学习计划")
-    @PostMapping("saveLearnPlan")
-    public AjaxResult saveLearnPlan(@RequestBody LearnPlan plan)
+    @PostMapping("plan")
+    public AjaxResult savePlan(@RequestBody LearnPlan plan)
     {
         plan.setStudentId(SecurityUtils.getLoginUser().getUserId());
 
@@ -122,8 +154,8 @@ public class FrontStudentController {
     }
 
     @ApiOperation("10 查询学习计划统计")
-    @GetMapping("getLearnPlanStats")
-    public AjaxResult getLearnPlanStats(@ApiParam String reportMonth)
+    @GetMapping("plan/stats")
+    public AjaxResult getPlanStats(@ApiParam String reportMonth)
     {
         LearnPlan curr = getCurrLearnPlan();
         // 统计每天的学习情况, 再汇总
@@ -167,7 +199,6 @@ public class FrontStudentController {
         return AjaxResult.success(stats);
     }
 
-
     private LearnPlan getCurrLearnPlan() {
         LearnPlan cond = new LearnPlan();
         cond.setStudentId(SecurityUtils.getLoginUser().getUserId());

+ 1 - 1
ie-system/src/main/resources/mapper/sy/SyMajorMapper.xml

@@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="selectSyMajorByPlan" resultMap="SyMajorResult">
-        SELECT m.`type`, m.`code`, m.`name`, CONCAT(m2.`name`, '&gt;', m1.`name`) `ancestors`
+        SELECT mp.id, m.`type`, m.`code`, m.`name`, CONCAT(m2.`name`, '&gt;', m1.`name`) `ancestors`
          FROM `a_marjor_plan` mp
          JOIN `sy_major` m ON mp.`majorName` = m.`name` AND mp.`level` = m.`type`
          LEFT JOIN `sy_major` m1 ON m1.`code` = m.`parent_code`